language
stringclasses
1 value
repo
stringclasses
346 values
path
stringlengths
6
201
class_span
dict
source
stringlengths
21
2.38M
target
stringlengths
1
96
python
pallets__jinja
src/jinja2/nodes.py
{ "start": 20717, "end": 21975 }
class ____(Expr): """A conditional expression (inline if expression). (``{{ foo if bar else baz }}``) """ fields = ("test", "expr1", "expr2") test: Expr expr1: Expr expr2: Expr | None def as_const(self, eval_ctx: EvalContext | None = None) -> t.Any: eval_ctx = get_eval_context...
CondExpr
python
spack__spack
lib/spack/spack/vendor/six.py
{ "start": 14764, "end": 17668 }
class ____(_LazyModule): """Lazy loading of moved objects in six.moves.urllib_request""" _urllib_request_moved_attributes = [ MovedAttribute("urlopen", "urllib2", "urllib.request"), MovedAttribute("install_opener", "urllib2", "urllib.request"), MovedAttribute("build_opener", "urllib2", "urllib.reques...
Module_six_moves_urllib_request
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/partition_sets.py
{ "start": 16978, "end": 17178 }
class ____(graphene.Union): class Meta: types = (GraphenePartitionSets, GraphenePipelineNotFoundError, GraphenePythonError) name = "PartitionSetsOrError"
GraphenePartitionSetsOrError
python
spack__spack
lib/spack/spack/cmd/create.py
{ "start": 5978, "end": 6241 }
class ____(PackageTemplate): """Provides appropriate overrides for cargo-based packages""" base_class_name = "CargoPackage" package_class_import = "from spack_repo.builtin.build_systems.cargo import CargoPackage" body_def = ""
CargoPackageTemplate
python
networkx__networkx
networkx/generators/tests/test_lattice.py
{ "start": 7950, "end": 10102 }
class ____: "Tests for :func:`networkx.generators.lattice.hexagonal_lattice_graph`" def test_lattice_points(self): """Tests that the graph is really a hexagonal lattice.""" for m, n in [(4, 5), (4, 4), (4, 3), (3, 2), (3, 3), (3, 5)]: G = nx.hexagonal_lattice_graph(m, n) ...
TestHexagonalLatticeGraph
python
tornadoweb__tornado
tornado/test/ioloop_test.py
{ "start": 26620, "end": 27988 }
class ____(unittest.TestCase): def run_python(self, *statements): stmt_list = [ "from tornado.ioloop import IOLoop", "classname = lambda x: x.__class__.__name__", ] + list(statements) args = [sys.executable, "-c", "; ".join(stmt_list)] return native_str(subpro...
TestIOLoopConfiguration
python
pallets__jinja
src/jinja2/exceptions.py
{ "start": 4885, "end": 5026 }
class ____(TemplateRuntimeError): """This error is raised if a filter was called with inappropriate arguments """
FilterArgumentError
python
huggingface__transformers
tests/models/rag/test_modeling_rag.py
{ "start": 40726, "end": 47611 }
class ____(unittest.TestCase): @classmethod def setUpClass(cls): cls.temp_dir = tempfile.TemporaryDirectory() cls.dataset_path = cls.temp_dir.name cls.index_path = os.path.join(cls.temp_dir.name, "index.faiss") ds = load_dataset("hf-internal-testing/wiki_dpr_dummy")["train"] ...
RagModelSaveLoadTests
python
dagster-io__dagster
python_modules/libraries/dagster-dg-cli/dagster_dg_cli/cli/api/client.py
{ "start": 505, "end": 2872 }
class ____: """Test context for DG API commands.""" def __init__(self, client_factory: GraphQLClientFactory): self.client_factory = client_factory self.organization = TEST_ORGANIZATION self.deployment = TEST_DEPLOYMENT def create_dg_api_graphql_client( ctx: click.Context, config: ...
DgApiTestContext
python
numba__numba
numba/tests/test_parallel_backend.py
{ "start": 8866, "end": 10370 }
class ____(TestParallelBackendBase): """ These are like the numba.tests.test_threadsafety tests but designed instead to torture the parallel backend. If a suitable backend is supplied via NUMBA_THREADING_LAYER these tests can be run directly. This test class cannot be run using the multiprocessing o...
TestParallelBackend
python
scipy__scipy
scipy/signal/tests/test_ltisys.py
{ "start": 26980, "end": 31674 }
class ____: def test_initialization(self): # Check that all initializations work StateSpace(1, 1, 1, 1) StateSpace([1], [2], [3], [4]) StateSpace(np.array([[1, 2], [3, 4]]), np.array([[1], [2]]), np.array([[1, 0]]), np.array([[0]])) def test_conversion(self): ...
TestStateSpace
python
PyCQA__pylint
tests/functional/a/alternative/alternative_union_syntax.py
{ "start": 1746, "end": 1793 }
class ____: my_var: int | str
CustomDataClass4
python
keras-team__keras
keras/src/layers/rnn/stacked_rnn_cells_test.py
{ "start": 212, "end": 10380 }
class ____(testing.TestCase): @pytest.mark.requires_trainable_backend def test_basics(self): self.run_layer_test( layers.RNN, init_kwargs={ "cell": [ OneStateRNNCell(3), OneStateRNNCell(4), OneStateRNNCel...
StackedRNNTest
python
ray-project__ray
rllib/examples/envs/classes/repeat_initial_obs_env.py
{ "start": 79, "end": 905 }
class ____(gym.Env): """Env in which the initial observation has to be repeated all the time. Runs for n steps. r=1 if action correct, -1 otherwise (max. R=100). """ def __init__(self, episode_len=100): self.observation_space = Discrete(2) self.action_space = Discrete(2) se...
RepeatInitialObsEnv
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/datamodels/assets.py
{ "start": 4237, "end": 4482 }
class ____(BaseModel): """Queued Event serializer for responses..""" dag_id: str asset_id: int created_at: datetime dag_display_name: str = Field(validation_alias=AliasPath("dag_model", "dag_display_name"))
QueuedEventResponse
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/datamodels/xcom.py
{ "start": 2705, "end": 2856 }
class ____(StrictBaseModel): """Payload serializer for creating an XCom entry.""" key: str value: Any map_index: int = -1
XComCreateBody
python
huggingface__transformers
src/transformers/models/glm4v_moe/modeling_glm4v_moe.py
{ "start": 3216, "end": 4154 }
class ____(ModelOutput): r""" past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). Contains pre-...
Glm4vMoeModelOutputWithPast
python
kamyu104__LeetCode-Solutions
Python/minimum-substring-partition-of-equal-character-frequency.py
{ "start": 62, "end": 669 }
class ____(object): def minimumSubstringsInPartition(self, s): """ :type s: str :rtype: int """ INF = float("inf") dp = [INF]*(len(s)+1) dp[0] = 0 for i in xrange(len(s)): cnt = [0]*26 d = mx = 0 for j in reversed(xr...
Solution
python
numba__numba
numba/cuda/cudadrv/driver.py
{ "start": 92747, "end": 96216 }
class ____(Linker): """ Links for current device if no CC given """ def __init__(self, max_registers=0, lineinfo=False, cc=None): super().__init__(max_registers, lineinfo, cc) logsz = config.CUDA_LOG_SIZE linkerinfo = (c_char * logsz)() linkererrors = (c_char * logsz)() ...
CtypesLinker
python
getsentry__sentry
tests/sentry/api/test_utils.py
{ "start": 6369, "end": 8765 }
class ____(APITestCase): @patch("sentry.api.utils.ParseError") def test_handle_query_errors(self, mock_parse_error: MagicMock) -> None: exceptions = [ DatasetSelectionError, IncompatibleMetricsQuery, InvalidSearchQuery, QueryConnectionFailed, Q...
HandleQueryErrorsTest
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/types.py
{ "start": 4193, "end": 4423 }
class ____(sqltypes.TypeEngine[str]): """Provide the PostgreSQL TSQUERY type. .. versionadded:: 2.0.0rc1 """ __visit_name__ = "TSQUERY" operator_classes = OperatorClass.BASE | OperatorClass.COMPARISON
TSQUERY
python
openai__openai-python
src/openai/types/eval_create_params.py
{ "start": 4684, "end": 5307 }
class ____(TypedDict, total=False): content: Required[TestingCriterionLabelModelInputEvalItemContent] """Inputs to the model - can contain template strings.""" role: Required[Literal["user", "assistant", "system", "developer"]] """The role of the message input. One of `user`, `assistant`, `system`...
TestingCriterionLabelModelInputEvalItem
python
great-expectations__great_expectations
great_expectations/data_context/_version_checker.py
{ "start": 218, "end": 272 }
class ____(TypedDict): version: str
_PyPIPackageInfo
python
numba__numba
numba/tests/test_linalg.py
{ "start": 86295, "end": 88450 }
class ____(TestLinalgBase): """ Tests for np.linalg.matrix_power. """ def assert_int_exponenent(self, cfunc, args): # validate first arg is ok cfunc(args[0], 1) # pass in both args and assert fail with self.assertRaises(errors.TypingError): cfunc(*args) ...
TestLinalgMatrixPower
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/classes5.py
{ "start": 4989, "end": 5079 }
class ____(ParentClass2): cv_decl_1, cv_decl_2, cv_decl_3 = (3, 4.5, 6.0)
SubclassTuple1
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/resource_requirement.py
{ "start": 3739, "end": 4424 }
class ____(ResourceKeyRequirement): key: str # pyright: ignore[reportIncompatibleMethodOverride] node_description: str input_name: str root_input: bool @property def expected_type(self) -> type: from dagster._core.storage.io_manager import IInputManagerDefinition return IInput...
InputManagerRequirement
python
doocs__leetcode
solution/0600-0699/0659.Split Array into Consecutive Subsequences/Solution.py
{ "start": 0, "end": 313 }
class ____: def isPossible(self, nums: List[int]) -> bool: d = defaultdict(list) for v in nums: if h := d[v - 1]: heappush(d[v], heappop(h) + 1) else: heappush(d[v], 1) return all(not v or v and v[0] > 2 for v in d.values())
Solution
python
getsentry__sentry
src/sentry/web/frontend/debug/debug_oauth_authorize.py
{ "start": 287, "end": 1096 }
class ____(View): def get(self, request: HttpRequest) -> HttpResponse: application = ApiApplication( name="Example Application", homepage_url="http://example.com", terms_url="http://example.com/terms", privacy_url="http://example.com/privacy", ) ...
DebugOAuthAuthorizeView
python
nedbat__coveragepy
tests/test_cmdline.py
{ "start": 7751, "end": 38299 }
class ____(BaseCmdLineTest): """Tests of the coverage.py command line.""" def test_annotate(self) -> None: # coverage annotate [-d DIR] [-i] [--omit DIR,...] [FILE1 FILE2 ...] self.cmd_executes( "annotate", """\ cov = Coverage() cov.load() ...
CmdLineTest
python
huggingface__transformers
src/transformers/models/rag/retrieval_rag.py
{ "start": 13605, "end": 15242 }
class ____(HFIndexBase): """ A wrapper around an instance of [`~datasets.Datasets`]. The dataset and the index are both loaded from the indicated paths on disk. Args: vector_size (`int`): the dimension of the passages embeddings used by the index dataset_path (`str`): The pa...
CustomHFIndex
python
huggingface__transformers
tests/models/poolformer/test_image_processing_poolformer.py
{ "start": 1018, "end": 3023 }
class ____: def __init__( self, parent, batch_size=7, num_channels=3, min_resolution=30, max_resolution=400, do_resize_and_center_crop=True, size=None, crop_pct=0.9, crop_size=None, do_normalize=True, image_mean=[0.5, 0....
PoolFormerImageProcessingTester
python
facebookresearch__faiss
tests/test_contrib.py
{ "start": 726, "end": 1790 }
class ____(unittest.TestCase): def do_test_compute_GT(self, metric=faiss.METRIC_L2, ngpu=0): d = 64 xt, xb, xq = get_dataset_2(d, 0, 10000, 100) index = faiss.IndexFlat(d, metric) index.add(xb) Dref, Iref = index.search(xq, 10) # iterator function on the matrix ...
TestComputeGT
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/sqltypes.py
{ "start": 131750, "end": 135309 }
class ____(Uuid[_UUID_RETURN], type_api.NativeForEmulated): """Represent the SQL UUID type. This is the SQL-native form of the :class:`_types.Uuid` database agnostic datatype, and is backwards compatible with the previous PostgreSQL-only version of ``UUID``. The :class:`_sqltypes.UUID` datatype on...
UUID
python
GoogleCloudPlatform__python-docs-samples
speech/microphone/transcribe_streaming_infinite_v2_test.py
{ "start": 735, "end": 2663 }
class ____: def __init__(self: object, audio_filename: str) -> None: self.audio_filename = audio_filename def __call__(self: object, *args: object) -> object: return self def open( self: object, stream_callback: object, rate: int, *args: object, **kw...
MockPyAudio
python
apache__airflow
shared/logging/src/airflow_shared/logging/percent_formatter.py
{ "start": 1203, "end": 3050 }
class ____(collections.abc.Mapping): __slots__ = ("event", "styles", "level_styles", "method_name", "no_colors") def __init__( self, event: EventDict, method_name: str, level_styles: dict[str, str], styles: ColumnStyles ): self.event = event self.method_name = method_name se...
_LazyLogRecordDict
python
networkx__networkx
networkx/algorithms/tests/test_link_prediction.py
{ "start": 471, "end": 1883 }
class ____: @classmethod def setup_class(cls): cls.func = staticmethod(nx.resource_allocation_index) cls.test = staticmethod(partial(_test_func, predict_func=cls.func)) def test_K5(self): G = nx.complete_graph(5) self.test(G, [(0, 1)], [(0, 1, 0.75)]) def test_P3(self):...
TestResourceAllocationIndex
python
langchain-ai__langchain
libs/langchain/tests/unit_tests/evaluation/agents/test_eval_chain.py
{ "start": 998, "end": 5961 }
class ____(FakeChatModel): queries: dict = Field(default_factory=dict) sequential_responses: bool | None = False response_index: int = 0 @override def _call( self, messages: list[BaseMessage], stop: list[str] | None = None, run_manager: CallbackManagerForLLMRun | Non...
_FakeTrajectoryChatModel
python
sphinx-doc__sphinx
sphinx/pycode/__init__.py
{ "start": 399, "end": 6156 }
class ____: annotations: dict[tuple[str, str], str] attr_docs: dict[tuple[str, str], list[str]] finals: list[str] overloads: dict[str, list[Signature]] tagorder: dict[str, int] tags: dict[str, tuple[str, int, int]] # cache for analyzer objects -- caches both by module and file name cach...
ModuleAnalyzer
python
google__jax
tests/pallas/pallas_jumble_test.py
{ "start": 10803, "end": 10935 }
class ____(PallasCallRaggedVmapTest): INTERPRET = True if __name__ == "__main__": absltest.main()
PallasCallNamedGridInterpretTest
python
dask__dask
dask/dataframe/dask_expr/_expr.py
{ "start": 114723, "end": 114883 }
class ____(MaybeAlignPartitions): _parameters = ["frame", "other", "op", "na_action", "meta"] _projection_passthrough = False _expr_cls = Map
MapAlign
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/internal/conjecture/dfa/lstar.py
{ "start": 17295, "end": 19320 }
class ____: """A class for replacing non-negative integers with a "canonical" value that is equivalent for all relevant purposes.""" def __init__(self): # We store canonical values as a sorted list of integers # with each value being treated as equivalent to the largest # intege...
IntegerNormalizer
python
python-markdown__markdown
markdown/inlinepatterns.py
{ "start": 14504, "end": 15345 }
class ____(Pattern): # pragma: no cover """ Return element of type `tag` with a text attribute of `group(3)` of a Pattern. """ def __init__(self, pattern: str, tag: str): """ Create an instant of an simple tag pattern. Arguments: pattern: A regular expression t...
SimpleTagPattern
python
ray-project__ray
python/ray/train/v2/tests/test_torch_gpu.py
{ "start": 4887, "end": 7584 }
class ____(LinearDataset): """Modifies the LinearDataset to also return non-tensor objects.""" def __getitem__(self, index): return {"x": self.x[index, None], "y": 2} @pytest.mark.parametrize( "dataset", (LinearDataset, LinearDatasetDict, NonTensorDataset) ) def test_torch_prepare_dataloader(ray_...
NonTensorDataset
python
scipy__scipy
scipy/cluster/tests/test_hierarchy.py
{ "start": 26575, "end": 27905 }
class ____: def test_leaves_list_1x4(self, xp): # Tests leaves_list(Z) on a 1x4 linkage. Z = xp.asarray([[0, 1, 3.0, 2]], dtype=xp.float64) to_tree(Z) assert_allclose(leaves_list(Z), [0, 1], rtol=1e-15) def test_leaves_list_2x4(self, xp): # Tests leaves_list(Z) on a 2x4...
TestLeavesList
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 157767, "end": 158972 }
class ____(sgqlc.types.Input): """Autogenerated input type of CloneProject""" __schema__ = github_schema __field_names__ = ("target_owner_id", "source_id", "include_workflows", "name", "body", "public", "client_mutation_id") target_owner_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="ta...
CloneProjectInput
python
run-llama__llama_index
llama-index-integrations/llms/llama-index-llms-cloudflare-ai-gateway/llama_index/llms/cloudflare_ai_gateway/base.py
{ "start": 2157, "end": 3868 }
class ____: """Wrapper for HTTP clients that intercepts requests and routes through AI Gateway.""" def __init__(self, gateway_instance, original_client, llm_instance): self.gateway = gateway_instance self.original_client = original_client self.llm = llm_instance self.provider_co...
AIGatewayClientWrapper
python
charliermarsh__ruff
crates/ruff_python_formatter/resources/test/fixtures/black/cases/form_feeds.py
{ "start": 693, "end": 995 }
class ____: def __init__(self): pass def something(self): pass # pass pass # a = 1 # pass a = 1 a = [ ] # as internal whitespace of a comment is allowed but why "form feed literal in a string is okay " # form feeds at the very end get removed.
Baz
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum/llama_index/embeddings/huggingface_optimum/base.py
{ "start": 497, "end": 6778 }
class ____(BaseEmbedding): folder_name: str = Field(description="Folder name to load from.") max_length: int = Field(description="Maximum length of input.") pooling: str = Field(description="Pooling strategy. One of ['cls', 'mean'].") normalize: bool = Field(default=True, description="Normalize embeddin...
OptimumEmbedding
python
ray-project__ray
python/ray/serve/tests/test_api.py
{ "start": 17794, "end": 34467 }
class ____: @serve.deployment class A: pass @serve.deployment def f(): pass class TypedArgs(BaseModel): message: str num_replicas: Optional[int] def test_prebuilt_app(self): a = self.A.bind() assert call_user_app_builder_with_args_if_necessary(a...
TestAppBuilder
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/triggers/dataproc.py
{ "start": 3350, "end": 10106 }
class ____(DataprocBaseTrigger): """ DataprocSubmitTrigger run on the trigger worker to perform create Build operation. :param job_id: The ID of a Dataproc job. :param project_id: Google Cloud Project where the job is running :param region: The Cloud Dataproc region in which to handle the request. ...
DataprocSubmitTrigger
python
wandb__wandb
wandb/vendor/pygments/lexers/verification.py
{ "start": 1880, "end": 3705 }
class ____(RegexLexer): """ For `Silver <https://bitbucket.org/viperproject/silver>`_ source code. .. versionadded:: 2.2 """ name = 'Silver' aliases = ['silver'] filenames = ['*.sil', '*.vpr'] tokens = { 'root': [ # Whitespace and Comments (r'\n', Whites...
SilverLexer
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mssql/base.py
{ "start": 41077, "end": 41360 }
class ____: def bind_processor(self, dialect): def process(value): if type(value) == datetime.date: return datetime.datetime(value.year, value.month, value.day) else: return value return process
_DateTimeBase
python
pandas-dev__pandas
pandas/tests/tseries/offsets/common.py
{ "start": 802, "end": 901 }
class ____: MON = 0 TUE = 1 WED = 2 THU = 3 FRI = 4 SAT = 5 SUN = 6
WeekDay
python
ansible__ansible
lib/ansible/modules/user.py
{ "start": 64745, "end": 70680 }
class ____(User): """ This is a OpenBSD User manipulation class. Main differences are that OpenBSD:- - has no concept of "system" account. - has no force delete user This overrides the following methods from the generic class:- - create_user() - remove_user() - modify_user()...
OpenBSDUser
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/refurb/FURB118.py
{ "start": 2574, "end": 2918 }
class ____: a = final(lambda self, other: self == other) b = override(lambda self, other: self == other) c = no_type_check(lambda self, other: self == other) d = final(override(no_type_check(lambda self, other: self == other))) # lambdas used in decorators do not constitute method definitions, # so th...
Foo
python
django__django
tests/model_meta/models.py
{ "start": 1733, "end": 2751 }
class ____(AbstractPerson): # DATA fields data_base = models.CharField(max_length=10) fk_base = models.ForeignKey(Relation, models.CASCADE, related_name="fk_base_rel") # M2M fields m2m_base = models.ManyToManyField(Relation, related_name="m2m_base_rel") friends_base = models.ManyToManyField("se...
BasePerson
python
spack__spack
lib/spack/spack/vendor/jinja2/nodes.py
{ "start": 12133, "end": 12462 }
class ____(Stmt): """Specific node for with statements. In older versions of Jinja the with statement was implemented on the base of the `Scope` node instead. .. versionadded:: 2.9.3 """ fields = ("targets", "values", "body") targets: t.List["Expr"] values: t.List["Expr"] body: t.List...
With
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol17.py
{ "start": 1107, "end": 1361 }
class ____(Protocol[_T1_co]): # This should generate an error because a covariant TypeVar # should not be used as a parameter type. def m1(self, p0: _T1_co) -> None: ... # This should generate an error because _T1 should be covariant.
Protocol5
python
bottlepy__bottle
bottle.py
{ "start": 157131, "end": 158191 }
class ____(BaseTemplate): def prepare(self, filters=None, tests=None, globals={}, **kwargs): from jinja2 import Environment, FunctionLoader self.env = Environment(loader=FunctionLoader(self.loader), **kwargs) if filters: self.env.filters.update(filters) if tests: self.env.tests.updat...
Jinja2Template
python
tornadoweb__tornado
tornado/test/httputil_test.py
{ "start": 16967, "end": 18568 }
class ____(unittest.TestCase): # Make sure that all the input types are supported. TIMESTAMP = 1359312200.503611 EXPECTED = "Sun, 27 Jan 2013 18:43:20 GMT" def check(self, value): self.assertEqual(format_timestamp(value), self.EXPECTED) def test_unix_time_float(self): self.check(se...
FormatTimestampTest
python
scrapy__scrapy
tests/test_downloader_handlers_http_base.py
{ "start": 28699, "end": 31704 }
class ____(ABC): is_secure = False expected_http_proxy_request_body = b"http://example.com" @property @abstractmethod def download_handler_cls(self) -> type[DownloadHandlerProtocol]: raise NotImplementedError @pytest.fixture(scope="session") def proxy_mockserver(self) -> Generator[...
TestHttpProxyBase
python
PyCQA__pylint
tests/functional/i/invalid/invalid_enum_extension.py
{ "start": 798, "end": 920 }
class ____(Enum): red: None = None def __init__(self, red: None) -> None: self.red = red
IncorrectColorEnum
python
pytorch__pytorch
test/distributed/test_device_mesh.py
{ "start": 2013, "end": 2601 }
class ____(DTensorTestBase): @property def backend(self): return "gloo" @with_comms def test_device_mesh_reuse_default_group(self): mesh = init_device_mesh(self.device_type, (self.world_size,)) mesh_group = mesh.get_group() default_group = _get_default_group() if...
DeviceMeshTestGlooBackend
python
pytorch__pytorch
torch/_inductor/ir.py
{ "start": 188286, "end": 191287 }
class ____(OperationBuffer): inputs: Sequence[Union[IRNode, Sequence[IRNode]]] def input_name(self, i: int) -> str: input = self.inputs[i] assert isinstance(input, IRNode) return input.get_name() def get_read_writes(self) -> dependencies.ReadWrites: reads = OrderedSet[depen...
InputsKernel
python
dagster-io__dagster
python_modules/libraries/dagster-census/dagster_census/translator.py
{ "start": 516, "end": 1302 }
class ____: """A record representing all content in a Census workspace. Provided as context for the translator so that it can resolve dependencies between content. """ syncs: list[CensusSync] @property def syncs_by_id(self) -> Mapping[int, CensusSync]: """Returns a mapping of sync IDs ...
CensusWorkspaceData
python
marshmallow-code__apispec
tests/test_core.py
{ "start": 24569, "end": 44278 }
class ____(RefsSchemaTestMixin): paths = { "/pet/{petId}": { "get": { "parameters": [ { "required": True, "format": "int64", "name": "petId", "in": "path", ...
TestPath
python
tensorflow__tensorflow
tensorflow/python/eager/wrap_function.py
{ "start": 9434, "end": 18612 }
class ____(function.ConcreteFunction): """Wraps a tf V1 piece of code in a function.""" def __init__( self, fn_graph, variable_holder, attrs=None, signature=None, are_keyword_args_also_positional=False, ): self._variable_holder = variable_holder _lift_unlifted_variable...
WrappedFunction
python
huggingface__transformers
src/transformers/models/hiera/modeling_hiera.py
{ "start": 11711, "end": 15021 }
class ____(nn.Module): """ Construct position and patch embeddings. """ def __init__(self, config: HieraConfig, is_mae: bool = False) -> None: super().__init__() self.patch_stride = config.patch_stride tokens_spatial_shape = [i // s for i, s in zip(config.image_size, config.patc...
HieraEmbeddings
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeNarrowingIsinstance1.py
{ "start": 3933, "end": 3971 }
class ____(Base1): value: str
Sub1_1
python
getsentry__sentry
src/sentry/apidocs/examples/notification_examples.py
{ "start": 645, "end": 1828 }
class ____: CREATE_NOTIFICATION_ACTION = [ OpenApiExample( "Create a new email spike protection notification action for a project", value=NOTIFICATION_ACTION_ONE, status_codes=["201"], response_only=True, ) ] GET_NOTIFICATION_ACTION = [ ...
NotificationActionExamples
python
getsentry__sentry
tests/snuba/api/endpoints/test_discover_key_transactions.py
{ "start": 951, "end": 1103 }
class ____(Protocol): def __call__( self, url: str, data: dict[str, Any], format: str, **kwargs: Any ) -> HttpResponse: ...
ClientCallable
python
pallets__jinja
src/jinja2/lexer.py
{ "start": 13030, "end": 13395 }
class ____(tuple): # type: ignore[type-arg] """A special tuple for marking a point in the state that can have lstrip applied. """ __slots__ = () # Even though it looks like a no-op, creating instances fails # without this. def __new__(cls, *members, **kwargs): # type: ignore retu...
OptionalLStrip
python
getsentry__sentry
tests/sentry/tsdb/test_base.py
{ "start": 228, "end": 5357 }
class ____(TestCase): def setUp(self) -> None: self.tsdb = BaseTSDB( rollups=( # time in seconds, samples to keep (10, 30), # 5 minutes at 10 seconds (ONE_MINUTE, 120), # 2 hours at 1 minute (ONE_HOUR, 24), # 1 days at 1 hour ...
BaseTSDBTest
python
huggingface__transformers
src/transformers/models/imagegpt/modeling_imagegpt.py
{ "start": 26929, "end": 32832 }
class ____(ImageGPTPreTrainedModel, GenerationMixin): _tied_weights_keys = {"lm_head.weight": "transformer.wte.weight"} def __init__(self, config: ImageGPTConfig): super().__init__(config) self.transformer = ImageGPTModel(config) self.lm_head = nn.Linear(config.n_embd, config.vocab_size...
ImageGPTForCausalImageModeling
python
kamyu104__LeetCode-Solutions
Python/minimum-moves-to-move-a-box-to-their-target-location.py
{ "start": 80, "end": 2673 }
class ____(object): def minPushBox(self, grid): """ :type grid: List[List[str]] :rtype: int """ directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] def dot(a, b): return a[0]*b[0]+a[1]*b[1] def can_reach(grid, b, p, t): closer, detour = [p...
Solution
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/fail_test_audit_docstring/package.py
{ "start": 225, "end": 962 }
class ____(MakefilePackage): """Simple package with a stand-alone test that is missing its docstring.""" homepage = "http://github.com/dummy/fail-test-audit-docstring" url = "https://github.com/dummy/fail-test-audit-docstring/archive/v1.0.tar.gz" version("2.0", sha256="c3e5e9fdd5004dcb542feda5ee4f0ff0...
FailTestAuditDocstring
python
plotly__plotly.py
_plotly_utils/exceptions.py
{ "start": 41, "end": 93 }
class ____(PlotlyError): pass
PlotlyEmptyDataError
python
viewflow__viewflow
viewflow/workflow/admin.py
{ "start": 75, "end": 595 }
class ____(admin.TabularInline): """Task inline.""" model = Task fields = ["flow_task", "flow_task_type", "status", "token", "owner"] readonly_fields = ["flow_task", "flow_task_type", "status", "token", "owner"] def has_add_permission(self, request, obj=None): """Disable manually task crea...
TaskInline
python
getsentry__sentry
tests/sentry/cache/test_django.py
{ "start": 89, "end": 1289 }
class ____(TestCase): def setUp(self) -> None: self.cache = DjangoCache() self.cache_key = "test-key" self.cache_val = "test-val" def test_get_set(self) -> None: assert self.cache.get(self.cache_key) is None self.cache.set(self.cache_key, self.cache_val, 50) ass...
DjangoCacheTest
python
scipy__scipy
scipy/interpolate/_fitpack2.py
{ "start": 22907, "end": 27258 }
class ____(UnivariateSpline): """ 1-D interpolating spline for a given set of data points. .. legacy:: class Specifically, we recommend using `make_interp_spline` instead. Fits a spline y = spl(x) of degree `k` to the provided `x`, `y` data. Spline function passes through all provided poi...
InterpolatedUnivariateSpline
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_checkbox04.py
{ "start": 315, "end": 1758 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("checkbox04.xlsx") def test_create_file_with_insert_checkbox(self): """Test the creation of a simple XlsxWriter file.""" workbook =...
TestCompareXLSXFiles
python
openai__openai-python
src/openai/resources/vector_stores/file_batches.py
{ "start": 33092, "end": 33628 }
class ____: def __init__(self, file_batches: FileBatches) -> None: self._file_batches = file_batches self.create = to_streamed_response_wrapper( file_batches.create, ) self.retrieve = to_streamed_response_wrapper( file_batches.retrieve, ) self...
FileBatchesWithStreamingResponse
python
doocs__leetcode
solution/1900-1999/1974.Minimum Time to Type Word Using Special Typewriter/Solution.py
{ "start": 0, "end": 231 }
class ____: def minTimeToType(self, word: str) -> int: ans, a = len(word), ord("a") for c in map(ord, word): d = abs(c - a) ans += min(d, 26 - d) a = c return ans
Solution
python
spyder-ide__spyder
spyder/plugins/layout/widgets/dialog.py
{ "start": 826, "end": 933 }
class ____: MoveUp = 'move_up' MoveDown = 'move_down' Remove = 'remove'
LayoutSettingsToolButtons
python
getsentry__sentry-python
sentry_sdk/integrations/strawberry.py
{ "start": 2050, "end": 4515 }
class ____(Integration): identifier = "strawberry" origin = f"auto.graphql.{identifier}" def __init__(self, async_execution=None): # type: (Optional[bool]) -> None if async_execution not in (None, False, True): raise ValueError( 'Invalid value for async_execution...
StrawberryIntegration
python
cython__cython
Cython/Debugger/libpython.py
{ "start": 79575, "end": 81086 }
class ____: """ This class defines the interface that ExecutionControlCommandBase needs to provide language-specific execution control. Classes that implement this interface should implement: lineno(frame) Tells the current line number (only called for a relevant frame). ...
LanguageInfo
python
jazzband__django-oauth-toolkit
tests/test_hybrid.py
{ "start": 52095, "end": 57943 }
class ____(BaseTest): def test_pre_auth_default_scopes(self): """ Test response for a valid client_id with response_type: code using default scopes """ self.client.login(username="hy_test_user", password="123456") query_string = urlencode( { "clie...
TestDefaultScopesHybrid
python
crytic__slither
slither/tools/upgradeability/checks/initialization.py
{ "start": 5043, "end": 7157 }
class ____(AbstractCheck): ARGUMENT = "missing-init-modifier" IMPACT = CheckClassification.HIGH HELP = "initializer() is not called" WIKI = "https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializer-is-not-called" WIKI_TITLE = "initializer() is not called" # region wiki_descript...
MissingInitializerModifier
python
run-llama__llama_index
llama-index-core/llama_index/core/selectors/embedding_selectors.py
{ "start": 514, "end": 3058 }
class ____(BaseSelector): """ Embedding selector. Embedding selector that chooses one out of many options. Args: embed_model (BaseEmbedding): An embedding model. """ def __init__( self, embed_model: BaseEmbedding, ) -> None: self._embed_model = embed_model...
EmbeddingSingleSelector
python
getsentry__sentry
src/sentry/release_health/release_monitor/metrics.py
{ "start": 927, "end": 11810 }
class ____(BaseReleaseMonitorBackend): def fetch_projects_with_recent_sessions_with_offset(self) -> Mapping[int, Sequence[int]]: with metrics.timer( "release_monitor.fetch_projects_with_recent_sessions.loop", sample_rate=1.0 ): aggregated_projects = defaultdict(list) ...
MetricReleaseMonitorBackend
python
Pylons__pyramid
tests/test_config/test_rendering.py
{ "start": 18, "end": 1365 }
class ____(unittest.TestCase): def _makeOne(self, *arg, **kw): from pyramid.config import Configurator config = Configurator(*arg, **kw) return config def test_add_default_renderers(self): from pyramid.config.rendering import DEFAULT_RENDERERS from pyramid.interfaces im...
TestRenderingConfiguratorMixin
python
weaviate__weaviate-python-client
weaviate/connect/integrations.py
{ "start": 787, "end": 1136 }
class ____(_IntegrationConfig): api_key: str = Field(serialization_alias="X-Huggingface-Api-Key") requests_per_minute_embeddings: Optional[int] = Field( serialization_alias="X-Huggingface-Ratelimit-RequestPM-Embedding" ) base_url: Optional[str] = Field(serialization_alias="X-Huggingface-Baseurl"...
_IntegrationConfigHuggingface
python
sqlalchemy__sqlalchemy
test/ext/test_compiler.py
{ "start": 15201, "end": 16776 }
class ____(fixtures.TestBase, AssertsCompiledSQL): """Test replacement of default compilation on existing constructs.""" __dialect__ = "default" def teardown_test(self): for cls in (Select, BindParameter): deregister(cls) def test_select(self): t1 = table("t1", column("c1"...
DefaultOnExistingTest
python
apache__airflow
task-sdk/src/airflow/sdk/api/datamodels/_generated.py
{ "start": 10562, "end": 10857 }
class ____(BaseModel): """ Request body schema for creating variables. """ model_config = ConfigDict( extra="forbid", ) val: Annotated[str | None, Field(title="Val")] = None description: Annotated[str | None, Field(title="Description")] = None
VariablePostBody
python
plotly__plotly.py
plotly/graph_objs/heatmap/hoverlabel/_font.py
{ "start": 233, "end": 17143 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "heatmap.hoverlabel" _path_str = "heatmap.hoverlabel.font" _valid_props = { "color", "colorsrc", "family", "familysrc", "lineposition", "linepositionsrc", "shadow", "shadowsrc", "s...
Font
python
Textualize__textual
docs/examples/guide/reactivity/dynamic_watch.py
{ "start": 544, "end": 972 }
class ____(App[None]): def compose(self) -> ComposeResult: yield Counter() yield ProgressBar(total=100, show_eta=False) def on_mount(self): def update_progress(counter_value: int): # (2)! self.query_one(ProgressBar).update(progress=counter_value) self.watch(self.qu...
WatchApp
python
mlflow__mlflow
mlflow/tracing/utils/warning.py
{ "start": 106, "end": 2655 }
class ____(logging.Filter): def __init__(self, module: str, message: str): super().__init__() self.module = module self.message = message def filter(self, record: logging.LogRecord) -> bool: if record.name == self.module and self.message in record.getMessage(): recor...
LogDemotionFilter
python
python-excel__xlrd
tests/test_xldate.py
{ "start": 234, "end": 2316 }
class ____(unittest.TestCase): def test_date_as_tuple(self): date = xldate.xldate_as_tuple(2741., DATEMODE) self.assertEqual(date, (1907, 7, 3, 0, 0, 0)) date = xldate.xldate_as_tuple(38406., DATEMODE) self.assertEqual(date, (2005, 2, 23, 0, 0, 0)) date = xldate.xldate_as_tup...
TestXLDate
python
bokeh__bokeh
tests/unit/bokeh/util/test_callback_manager.py
{ "start": 2238, "end": 2667 }
class ____: def __call__(self): pass def method(self): pass def _good_event(event): pass def _bad_event(x,y,z): pass def _partially_good_event(arg, event): pass def _partially_bad_event(event): pass #-----------------------------------------------------------------------------...
_BadEventCallback
python
pypa__pip
src/pip/_vendor/urllib3/connection.py
{ "start": 10127, "end": 20107 }
class ____(HTTPConnection): """ Many of the parameters to this constructor are passed to the underlying SSL socket by means of :py:func:`urllib3.util.ssl_wrap_socket`. """ default_port = port_by_scheme["https"] cert_reqs = None ca_certs = None ca_cert_dir = None ca_cert_data = None...
HTTPSConnection