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
walkccc__LeetCode
solutions/1893. Check if All the Integers in a Range Are Covered/1893-2.py
{ "start": 0, "end": 296 }
class ____: def isCovered(self, ranges: list[list[int]], left: int, right: int) -> bool: seen = [0] * 52 for l, r in ranges: seen[l] += 1 seen[r + 1] -= 1 for i in range(1, 52): seen[i] += seen[i - 1] return all(seen[i] for i in range(left, right + 1))
Solution
python
modin-project__modin
modin/pandas/groupby.py
{ "start": 70034, "end": 81483 }
class ____(DataFrameGroupBy): # noqa: GL08 _pandas_class = pandas.core.groupby.SeriesGroupBy _extensions: EXTENSION_DICT_TYPE = EXTENSION_DICT_TYPE(dict) @disable_logging def __getattribute__(self, item: str) -> Any: """ Get an attribute of the object. Python calls this method...
SeriesGroupBy
python
PrefectHQ__prefect
src/prefect/_experimental/bundles/__init__.py
{ "start": 1206, "end": 18675 }
class ____(TypedDict): """ A serialized bundle is a serialized function, context, and flow run that can be easily transported for later execution. """ function: str context: str flow_run: dict[str, Any] dependencies: str def _serialize_bundle_object(obj: Any) -> str: """ Seria...
SerializedBundle
python
django__django
django/forms/widgets.py
{ "start": 1437, "end": 2556 }
class ____: element_template = "{path}" def __init__(self, path, **attributes): self._path = path self.attributes = attributes def __eq__(self, other): # Compare the path only, to ensure performant comparison in # Media.merge. return (self.__class__ is other.__class...
MediaAsset
python
PrefectHQ__prefect
src/prefect/settings/sources.py
{ "start": 2634, "end": 3997 }
class ____(DotEnvSettingsSource): def __init__( self, settings_cls: type[BaseSettings], env_file: Optional[DotenvType] = ENV_FILE_SENTINEL, env_file_encoding: Optional[str] = None, case_sensitive: Optional[bool] = None, env_prefix: Optional[str] = None, env_ne...
FilteredDotEnvSettingsSource
python
boto__boto3
tests/unit/docs/test_collection.py
{ "start": 660, "end": 5894 }
class ____(BaseDocsTest): def test_document_collections(self): collection_documenter = CollectionDocumenter( self.resource, self.root_services_path ) collection_documenter.document_collections(self.doc_structure) self.assert_contains_lines_in_order( [ ...
TestCollectionDocumenter
python
keon__algorithms
tests/test_tree.py
{ "start": 1417, "end": 3072 }
class ____(unittest.TestCase): @classmethod def setUpClass(cls): import random random.seed(18719) cls.random = random cls.range = 10000 def setUp(self): self.keys_to_insert = [self.random.randrange(-self.range, self.range) for i in ran...
TestBTree
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 50731, "end": 51474 }
class ____(Operation): def call(self, x): return backend.numpy.bitwise_invert(x) def compute_output_spec(self, x): return KerasTensor(x.shape, dtype=x.dtype) @keras_export(["keras.ops.bitwise_invert", "keras.ops.numpy.bitwise_invert"]) def bitwise_invert(x): """Compute bit-wise inversion,...
BitwiseInvert
python
huggingface__transformers
src/transformers/models/nemotron/modeling_nemotron.py
{ "start": 28701, "end": 39562 }
class ____(NemotronPreTrainedModel): """ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`NemotronDecoderLayer`] Args: config: NemotronConfig """ def __init__(self, config: NemotronConfig): super().__init__(config) self.padding_idx = co...
NemotronModel
python
getsentry__sentry
tests/sentry/testutils/thread_leaks/test_assertion.py
{ "start": 264, "end": 3015 }
class ____: def test_no_leaks_passes_cleanly(self) -> None: """Test that clean code passes without issues.""" with assert_none(): pass # No threads created # Should not raise def test_thread_leak_strict_mode_raises(self) -> None: """Test that thread leaks raise in s...
TestAssertNoneIntegration
python
dask__distributed
distributed/diagnostics/progress.py
{ "start": 1065, "end": 4360 }
class ____(SchedulerPlugin): """Tracks progress of a set of keys or futures On creation we provide a set of keys or futures that interest us as well as a scheduler. We traverse through the scheduler's dependencies to find all relevant keys on which our keys depend. We then plug into the scheduler to ...
Progress
python
weaviate__weaviate-python-client
weaviate/collections/classes/data.py
{ "start": 1605, "end": 1924 }
class ____(_DataReference): """This class represents a reference between objects within a collection to be used when batching.""" target_collection: str def _to_beacons(self) -> List[str]: return [f"{BEACON}{self.target_collection}/{uuid}" for uuid in self._to_uuids()] @dataclass
DataReferenceMulti
python
huggingface__transformers
src/transformers/models/deepseek_vl/modular_deepseek_vl.py
{ "start": 4390, "end": 4474 }
class ____(IdeficsBaseModelOutputWithPast): pass
DeepseekVLBaseModelOutputWithPast
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 520815, "end": 521685 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("field", "users") field = sgqlc.types.Field( sgqlc.types.non_null("ProjectV2FieldConfiguration"), graphql_name="field" ) users = sgqlc.types.Field( "UserCo...
ProjectV2ItemFieldUserValue
python
huggingface__transformers
src/transformers/models/diffllama/modular_diffllama.py
{ "start": 19461, "end": 19518 }
class ____(GemmaForCausalLM): pass
DiffLlamaForCausalLM
python
apache__airflow
providers/microsoft/azure/src/airflow/providers/microsoft/azure/transfers/s3_to_wasb.py
{ "start": 1618, "end": 1901 }
class ____(Exception): """Custom exception raised when neither a blob_prefix or blob_name are passed to the operator.""" def __init__(self): message: str = "One of blob_name or blob_prefix must be provided." super().__init__(message)
InvalidAzureBlobParameters
python
agronholm__apscheduler
src/apscheduler/_decorators.py
{ "start": 505, "end": 2905 }
class ____(TaskDefaults): id: str | UnsetValue = attrs.field(default=unset) job_executor: str | UnsetValue = attrs.field( validator=if_not_unset(instance_of(str)), default=unset ) max_running_jobs: int | None | UnsetValue = attrs.field( validator=if_not_unset(optional(instance_of(int))),...
TaskParameters
python
tensorflow__tensorflow
tensorflow/python/training/basic_session_run_hooks_test.py
{ "start": 4994, "end": 7909 }
class ____(test.TestCase): def test_raise_in_both_last_step_and_num_steps(self): with self.assertRaises(ValueError): basic_session_run_hooks.StopAtStepHook(num_steps=10, last_step=20) def test_stop_based_on_last_step(self): h = basic_session_run_hooks.StopAtStepHook(last_step=10) with ops.Graph(...
StopAtStepTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-mixpanel/source_mixpanel/components.py
{ "start": 15812, "end": 17096 }
class ____(DefaultErrorHandler): """ Custom error handler for handling export errors specific to Mixpanel streams. This handler addresses: - 400 status code with "to_date cannot be later than today" message, indicating a potential timezone mismatch. - ConnectionResetError during response parsing, i...
ExportErrorHandler
python
getsentry__sentry
tests/sentry/hybridcloud/services/test_region_organization_provisioning.py
{ "start": 1178, "end": 9886 }
class ____(TestCase): def get_provisioning_args( self, user: User, is_test: bool = False, create_default_team: bool = True ) -> OrganizationProvisioningOptions: return OrganizationProvisioningOptions( provision_options=OrganizationOptions( name="Santry", ...
TestRegionOrganizationProvisioningCreateInRegion
python
coleifer__peewee
peewee.py
{ "start": 246474, "end": 247247 }
class ____(BaseModelSelect, CompoundSelectQuery): def __init__(self, model, *args, **kwargs): self.model = model super(ModelCompoundSelectQuery, self).__init__(*args, **kwargs) def _get_model_cursor_wrapper(self, cursor): return self.lhs._get_model_cursor_wrapper(cursor) def _normaliz...
ModelCompoundSelectQuery
python
apache__airflow
providers/databricks/src/airflow/providers/databricks/hooks/databricks.py
{ "start": 3374, "end": 5273 }
class ____: """Utility class for the run state concept of Databricks runs.""" RUN_LIFE_CYCLE_STATES = [ "PENDING", "RUNNING", "TERMINATING", "TERMINATED", "SKIPPED", "INTERNAL_ERROR", "QUEUED", ] def __init__( self, life_cycle_state: str,...
RunState
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/deprecated4.py
{ "start": 193, "end": 992 }
class ____: @property @deprecated("Deprecated v1 getter") def v1(self) -> str: return "" @v1.setter def v1(self, value: str) -> None: ... @v1.deleter def v1(self) -> None: ... @property def v2(self) -> str: return "" @deprecated("Deprecated v2 setter") @v2...
A
python
huggingface__transformers
src/transformers/models/edgetam_video/modeling_edgetam_video.py
{ "start": 55035, "end": 58307 }
class ____(nn.Module): def __init__(self, config: EdgeTamVideoConfig): super().__init__() self.cross_attention = EdgeTamVideoPerceiverAttention(config) self.mlp = EdgeTamVideoPerceiverMLP(config) self.dropout = nn.Dropout(config.perceiver_resampler_hidden_dropout) self.self...
EdgeTamVideoPerceiverEncoderLayer
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 76567, "end": 77072 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("repository_id", "head_sha", "client_mutation_id") repository_id = sgqlc.types.Field( sgqlc.types.non_null(ID), graphql_name="repositoryId" ) head_sha = sgqlc.typ...
CreateCheckSuiteInput
python
django__django
tests/postgres_tests/models.py
{ "start": 5995, "end": 6311 }
class ____(PostgreSQLModel): room = models.ForeignKey("Room", on_delete=models.CASCADE) datespan = DateRangeField() start = models.DateTimeField() end = models.DateTimeField() cancelled = models.BooleanField(default=False) requirements = models.JSONField(blank=True, null=True)
HotelReservation
python
kamyu104__LeetCode-Solutions
Python/count-pairs-in-two-arrays.py
{ "start": 33, "end": 572 }
class ____(object): def countPairs(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: int """ for i in xrange(len(nums1)): nums1[i] -= nums2[i] nums1.sort() result = 0 left, right = 0, len(nums1)-1 ...
Solution
python
django-import-export__django-import-export
tests/core/tests/test_resources/test_bulk_operations.py
{ "start": 295, "end": 1015 }
class ____(TestCase): def setUp(self): class _BookResource(resources.ModelResource): class Meta: model = Book use_bulk = True self.resource = _BookResource() rows = [(i + 1, "book_name") for i in range(10)] self.dataset = tablib.Dataset(*r...
BulkTest
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/dataplex.py
{ "start": 2351, "end": 2544 }
class ____(BaseGoogleLink): """Helper class for constructing Dataplex Tasks link.""" name = "Dataplex Tasks" key = "tasks_conf" format_str = DATAPLEX_TASKS_LINK
DataplexTasksLink
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 827465, "end": 828005 }
class ____( sgqlc.types.Type, Node, AuditEntry, OrganizationAuditEntryData ): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("can_create_repositories", "visibility") can_create_repositories = sgqlc.types.Field( Boolean, graphql_name="canCreateR...
OrgUpdateMemberRepositoryCreationPermissionAuditEntry
python
scipy__scipy
scipy/linalg/tests/test_decomp.py
{ "start": 104488, "end": 108706 }
class ____: def test_datacopied(self): from scipy.linalg._decomp import _datacopied M = matrix([[0, 1], [2, 3]]) A = asarray(M) L = M.tolist() M2 = M.copy() class Fake1: def __array__(self, dtype=None, copy=None): return A class...
TestDatacopied
python
hynek__structlog
tests/test_output.py
{ "start": 4312, "end": 4972 }
class ____: def test_does_not_cache(self): """ Due to doctest weirdness, we must not reuse PrintLoggers. """ f = PrintLoggerFactory() assert f() is not f() def test_passes_file(self): """ If a file is passed to the factory, it get passed on to the logger...
TestPrintLoggerFactory
python
dagster-io__dagster
examples/docs_snippets/docs_snippets/guides/external-systems/apis/use_minimal_resource_in_asset.py
{ "start": 78, "end": 1120 }
class ____(dg.ConfigurableResource): @property def query_string(self) -> str: latittude = "37.615223" longitude = "-122.389977" time_zone = "America/Los_Angeles" return f"https://api.sunrise-sunset.org/json?lat={latittude}&lng={longitude}&date=today&tzid={time_zone}" def sun...
SunResource
python
huggingface__transformers
src/transformers/models/pixtral/image_processing_pixtral.py
{ "start": 1450, "end": 5379 }
class ____(ImagesKwargs, total=False): """ patch_size (`Union[dict[str, int], int]` *optional*, defaults to `{"height": 16, "width": 16}`): Size of the patches in the model, used to calculate the output image size. Can be overridden by `patch_size` in the `preprocess` method. """ patch_size: Un...
PixtralImageProcessorKwargs
python
fluentpython__example-code-2e
07-1class-func/bingocall.py
{ "start": 173, "end": 552 }
class ____: def __init__(self, items): self._items = list(items) # <1> random.shuffle(self._items) # <2> def pick(self): # <3> try: return self._items.pop() except IndexError: raise LookupError('pick from empty BingoCage') # <4> def __call__(sel...
BingoCage
python
tiangolo__fastapi
docs_src/body/tutorial003_py310.py
{ "start": 61, "end": 324 }
class ____(BaseModel): name: str description: str | None = None price: float tax: float | None = None app = FastAPI() @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item): return {"item_id": item_id, **item.dict()}
Item
python
EpistasisLab__tpot
tpot/search_spaces/nodes/estimator_node.py
{ "start": 4629, "end": 5027 }
class ____(SearchSpace): def __init__(self, method, space, hyperparameter_parser=default_hyperparameter_parser): self.method = method self.space = space self.hyperparameter_parser = hyperparameter_parser def generate(self, rng=None): return EstimatorNodeIndividual(self.method, s...
EstimatorNode
python
PrefectHQ__prefect
src/integrations/prefect-kubernetes/prefect_kubernetes/settings.py
{ "start": 881, "end": 2051 }
class ____(PrefectBaseSettings): model_config = build_settings_config(("integrations", "kubernetes", "observer")) enabled: bool = Field( default=True, description="Whether the Kubernetes observer is enabled to watch for Prefect-submitted Kubernetes pod and job events.", ) replicate_pod...
KubernetesObserverSettings
python
tensorflow__tensorflow
tensorflow/compiler/tests/adam_test.py
{ "start": 1665, "end": 7958 }
class ____(xla_test.XLATestCase): def testBasic(self): for dtype in self.float_types | self.complex_types: # TODO: test fails for float16 due to excessive precision requirements. if dtype in [np.float16, dtypes.bfloat16.as_numpy_dtype]: continue with self.session(), self.test_scope(): ...
AdamOptimizerTest
python
pallets__jinja
src/jinja2/ext.py
{ "start": 1386, "end": 8147 }
class ____: """Extensions can be used to add extra functionality to the Jinja template system at the parser level. Custom extensions are bound to an environment but may not store environment specific data on `self`. The reason for this is that an extension can be bound to another environment (for ...
Extension
python
FactoryBoy__factory_boy
factory/base.py
{ "start": 21782, "end": 22292 }
class ____(BaseFactory[T], metaclass=FactoryMetaClass): """Factory base with build and create support. This class has the ability to support multiple ORMs by using custom creation functions. """ # Backwards compatibility AssociatedClassError: Type[Exception] class Meta(BaseMeta): ...
Factory
python
google__jax
jax/_src/layout.py
{ "start": 908, "end": 969 }
class ____: def __repr__(self): return "AUTO"
AutoLayout
python
pandas-dev__pandas
pandas/tests/dtypes/test_missing.py
{ "start": 25762, "end": 27994 }
class ____: @pytest.mark.parametrize("func", [libmissing.checknull, isna]) @pytest.mark.parametrize( "value", na_vals + sometimes_na_vals, # type: ignore[operator] ) def test_checknull_na_vals(self, func, value): assert func(value) @pytest.mark.parametrize("func", [libmissi...
TestLibMissing
python
fastapi__sqlmodel
docs_src/tutorial/one/tutorial007.py
{ "start": 100, "end": 1636 }
class ____(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str = Field(index=True) secret_name: str age: Optional[int] = Field(default=None, index=True) sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_engine(sqlite_u...
Hero
python
yaml__pyyaml
lib/yaml/scanner.py
{ "start": 593, "end": 906 }
class ____: # See below simple keys treatment. def __init__(self, token_number, required, index, line, column, mark): self.token_number = token_number self.required = required self.index = index self.line = line self.column = column self.mark = mark
SimpleKey
python
scipy__scipy
scipy/integrate/_ode.py
{ "start": 40275, "end": 43117 }
class ____(IntegratorBase): runner = getattr(_dop, 'dopri5', None) name = 'dopri5' supports_solout = True messages = {1: 'computation successful', 2: 'computation successful (interrupted by solout)', -1: 'input is not consistent', -2: 'larger nsteps is ne...
dopri5
python
pyca__cryptography
src/cryptography/hazmat/_oid.py
{ "start": 10382, "end": 10527 }
class ____: CA_ISSUERS = ObjectIdentifier("1.3.6.1.5.5.7.48.2") OCSP = ObjectIdentifier("1.3.6.1.5.5.7.48.1")
AuthorityInformationAccessOID
python
huggingface__transformers
src/transformers/models/mask2former/modeling_mask2former.py
{ "start": 84796, "end": 92480 }
class ____(nn.Module): """ Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`Mask2FormerMaskedAttentionDecoderLayer`]. The decoder updates the query embeddings through multiple cross (masked) and self-attention layers. The decoder uses a new **masked attention** mechani...
Mask2FormerMaskedAttentionDecoder
python
django__django
tests/template_tests/test_library.py
{ "start": 2142, "end": 3273 }
class ____(SimpleTestCase): def setUp(self): self.library = Library() def test_simple_tag(self): @self.library.simple_tag def func(): return "" self.assertIn("func", self.library.tags) def test_simple_tag_parens(self): @self.library.simple_tag() ...
SimpleTagRegistrationTests
python
mlflow__mlflow
tests/pyfunc/test_pyfunc_model_config.py
{ "start": 356, "end": 487 }
class ____(mlflow.pyfunc.PythonModel): def predict(self, context, model_input, params=None): return model_input
TestModel
python
django__django
django/contrib/admin/migrations/0003_logentry_add_action_flag_choices.py
{ "start": 43, "end": 538 }
class ____(migrations.Migration): dependencies = [ ("admin", "0002_logentry_remove_auto_add"), ] # No database changes; adds choices to action_flag. operations = [ migrations.AlterField( model_name="logentry", name="action_flag", field=models.Positive...
Migration
python
pytorch__pytorch
torch/fx/passes/graph_manipulation.py
{ "start": 1466, "end": 3965 }
class ____(NamedTuple): output_size: int total_size: int @compatibility(is_backward_compatible=False) def get_size_of_all_nodes( fx_module: GraphModule, args: Optional[list[torch.Tensor]] = None ) -> None: """Given a fx graph module, update each node with its total size (weights + bias + output) a...
size_bytes
python
apache__airflow
providers/jdbc/src/airflow/providers/jdbc/hooks/jdbc.py
{ "start": 1638, "end": 10775 }
class ____(DbApiHook): """ General hook for JDBC access. JDBC URL, username and password will be taken from the predefined connection. Note that the whole JDBC URL must be specified in the "host" field in the DB. Raises an airflow error if the given connection id doesn't exist. To configure dr...
JdbcHook
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol53.py
{ "start": 2749, "end": 2812 }
class ____: def m(self, x: Self) -> None: ...
Impl_ContraSelf
python
ray-project__ray
python/ray/data/_internal/logical/operators/map_operator.py
{ "start": 15303, "end": 16045 }
class ____(AbstractMap): """Logical operator for streaming repartition operation. Args: target_num_rows_per_block: The target number of rows per block granularity for streaming repartition. """ def __init__( self, input_op: LogicalOperator, target_num_rows_per...
StreamingRepartition
python
kubernetes-client__python
kubernetes/client/models/v1_pod_os.py
{ "start": 383, "end": 4154 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1PodOS
python
getsentry__sentry
src/sentry/utils/kvstore/cache.py
{ "start": 2284, "end": 4220 }
class ____(KVStorage[str, V]): """ This class implements a compatibility layer for interacting with storages that have existing data written with cache key prefixes. """ # XXX: ``keys`` must be ``str`` to avoid type mismatches when returning # unwrapped values (e.g. from ``get_many``), even tho...
CacheKeyWrapper
python
getsentry__sentry
src/sentry/search/eap/types.py
{ "start": 2626, "end": 2746 }
class ____(EventsResponse): confidence: ConfidenceData page_token: NotRequired[PageToken] @dataclass()
EAPResponse
python
getsentry__sentry
tests/sentry/auth/providers/test_saml2.py
{ "start": 547, "end": 744 }
class ____(SAML2Provider): name = "dummy" key = "dummy_saml2" def get_saml_setup_pipeline(self) -> list[AuthView]: raise NotImplementedError @control_silo_test
DummySAML2Provider
python
wandb__wandb
hatch_build.py
{ "start": 7516, "end": 7854 }
class ____: goos: str goarch: str def _to_goarch(arch: str) -> str: """Returns a valid GOARCH value or the empty string.""" return { # amd64 synonyms "amd64": "amd64", "x86_64": "amd64", # arm64 synonyms "arm64": "arm64", "aarch64": "arm64", }.get(ar...
TargetPlatform
python
run-llama__llama_index
llama-index-integrations/llms/llama-index-llms-oci-genai/llama_index/llms/oci_genai/base.py
{ "start": 1283, "end": 16431 }
class ____(FunctionCallingLLM): """OCI large language models with function calling support.""" model: str = Field(description="Id of the OCI Generative AI model to use.") temperature: float = Field(description="The temperature to use for sampling.") max_tokens: int = Field(description="The maximum numb...
OCIGenAI
python
joke2k__faker
tests/providers/test_internet.py
{ "start": 27434, "end": 28449 }
class ____: """Test nl_NL internet provider methods""" @patch( "faker.providers.internet.Provider.user_name", lambda x: "fabiënné", ) def test_ascii_safe_email(self, faker): email = faker.ascii_safe_email() validate_email(email) assert email.split("@")[0] == "fab...
TestNlNl
python
tensorflow__tensorflow
tensorflow/python/framework/smart_cond_test.py
{ "start": 3711, "end": 5476 }
class ____(test_util.TensorFlowTestCase): @test_util.run_deprecated_v1 def testTrue(self): x = array_ops.placeholder(dtype=dtypes.int32, shape=[]) conditions = [(True, lambda: constant_op.constant(1)), (x == 0, raise_exception)] y = smart_cond.smart_case(conditions, default=raise_exce...
SmartCaseTest
python
pytorch__pytorch
test/dynamo/test_base_hop.py
{ "start": 7008, "end": 8991 }
class ____(torch.nn.Module): def forward(self, L_x_: "f32[3, 3]", L_y_: "f32[3, 3]"): l_x_ = L_x_ l_y_ = L_y_ subgraph_0 = self.subgraph_0 invoke_quant_test = torch.ops.higher_order.invoke_quant_test(subgraph_0, l_x_, l_y_, scheme = 'nf4'); subgraph_0 = l_x_ = l_y_ = None g...
GraphModule
python
dagster-io__dagster
python_modules/libraries/dagster-dbt/dagster_dbt/dagster_dbt_translator.py
{ "start": 2541, "end": 27962 }
class ____: """Holds a set of methods that derive Dagster asset definition metadata given a representation of a dbt resource (models, tests, sources, etc). This class is exposed so that methods can be overriden to customize how Dagster asset metadata is derived. """ def __init__(self, settings...
DagsterDbtTranslator
python
mlflow__mlflow
mlflow/entities/run_data.py
{ "start": 364, "end": 3039 }
class ____(_MlflowObject): """ Run data (metrics and parameters). """ def __init__(self, metrics=None, params=None, tags=None): """Construct a new mlflow.entities.RunData instance. Args: metrics: List of mlflow.entities.Metric. params: List of mlflow.entities.Pa...
RunData
python
kamyu104__LeetCode-Solutions
Python/binary-tree-maximum-path-sum.py
{ "start": 1189, "end": 1683 }
class ____(object): # @param root, a tree node # @return an integer def maxPathSum(self, root): def dfs(node): if not node: return (float("-inf"), 0) max_left, curr_left = dfs(node.left) max_right, curr_right = dfs(node.right) return (m...
Solution2
python
mahmoud__boltons
boltons/urlutils.py
{ "start": 36484, "end": 55909 }
class ____(dict): """A MultiDict is a dictionary that can have multiple values per key and the OrderedMultiDict (OMD) is a MultiDict that retains original insertion order. Common use cases include: * handling query strings parsed from URLs * inverting a dictionary to create a reverse index (val...
OrderedMultiDict
python
GoogleCloudPlatform__python-docs-samples
functions/firebase/main_test.py
{ "start": 720, "end": 4959 }
class ____: pass def test_rtdb(capsys): data = {"admin": True, "delta": {"id": "my-data"}} context = Context() context.resource = "my-resource" main.hello_rtdb(data, context) out, _ = capsys.readouterr() assert "Function triggered by change to: my-resource" in out assert "Admin?: T...
Context
python
sqlalchemy__sqlalchemy
test/orm/test_loading.py
{ "start": 5018, "end": 6537 }
class ____(_fixtures.FixtureTest): run_setup_mappers = "once" run_inserts = "once" run_deletes = None @classmethod def setup_mappers(cls): cls._setup_stock_mapping() def test_cursor_close_exception_raised_in_iteration(self): """test #8710""" User = self.classes.User ...
InstancesTest
python
TheAlgorithms__Python
data_structures/binary_tree/diff_views_of_binary_tree.py
{ "start": 301, "end": 4827 }
class ____: val: int left: TreeNode | None = None right: TreeNode | None = None def make_tree() -> TreeNode: """ >>> make_tree().val 3 """ return TreeNode(3, TreeNode(9), TreeNode(20, TreeNode(15), TreeNode(7))) def binary_tree_right_side_view(root: TreeNode) -> list[int]: r""" ...
TreeNode
python
airbytehq__airbyte
airbyte-integrations/connectors/source-google-ads/source_google_ads/components.py
{ "start": 25533, "end": 28312 }
class ____(HttpRequester): """ Custom HTTP requester for custom query streams. """ parameters: Mapping[str, Any] def __post_init__(self, parameters: Mapping[str, Any]): super().__post_init__(parameters=parameters) self.query = GAQL.parse(parameters.get("query")) @staticmethod ...
CustomGAQueryHttpRequester
python
allegroai__clearml
clearml/backend_api/services/v2_13/workers.py
{ "start": 13886, "end": 23847 }
class ____(NonStrictDataModel): """ :param id: Worker ID :type id: str :param user: Associated user (under whose credentials are used by the worker daemon) :type user: IdNameEntry :param company: Associated company :type company: IdNameEntry :param ip: IP of the worker :type ...
Worker
python
pandas-dev__pandas
pandas/tests/indexing/test_iloc.py
{ "start": 51669, "end": 54098 }
class ____: def test_iloc(self): ser = Series( np.random.default_rng(2).standard_normal(10), index=list(range(0, 20, 2)) ) ser_original = ser.copy() for i in range(len(ser)): result = ser.iloc[i] exp = ser[ser.index[i]] tm.assert_almos...
TestILocSeries
python
pypa__pip
src/pip/_internal/resolution/resolvelib/base.py
{ "start": 782, "end": 2306 }
class ____: specifier: SpecifierSet hashes: Hashes links: frozenset[Link] @classmethod def empty(cls) -> Constraint: return Constraint(SpecifierSet(), Hashes(), frozenset()) @classmethod def from_ireq(cls, ireq: InstallRequirement) -> Constraint: links = frozenset([ireq.lin...
Constraint
python
PyCQA__bandit
tests/unit/core/test_context.py
{ "start": 163, "end": 10442 }
class ____(testtools.TestCase): def test_context_create(self): ref_context = mock.Mock() new_context = context.Context(context_object=ref_context) self.assertEqual(ref_context, new_context._context) new_context = context.Context() self.assertIsInstance(new_context._context, ...
ContextTests
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 254009, "end": 254413 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("client_mutation_id", "commit", "ref") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") commit = sgqlc.types.Field("Commit", graphql_name="commi...
CreateCommitOnBranchPayload
python
pytorch__pytorch
test/distributed/_shard/sharding_plan/test_sharding_plan.py
{ "start": 1175, "end": 1696 }
class ____(ShardingPlanner): dim = 0 devices = [] def __init__(self, chunk_dim=0, device_count=0): self.dim = chunk_dim self.devices = [f"rank:{i}/cuda:{i}" for i in range(device_count)] def build_plan(self, module: nn.Module) -> ShardingPlan: named_params = module.named_parame...
ChunkAllShardingPlanner
python
django-haystack__django-haystack
haystack/fields.py
{ "start": 15545, "end": 15609 }
class ____(FacetField, DateTimeField): pass
FacetDateTimeField
python
doocs__leetcode
solution/1400-1499/1415.The k-th Lexicographical String of All Happy Strings of Length n/Solution.py
{ "start": 0, "end": 482 }
class ____: def getHappyString(self, n: int, k: int) -> str: def dfs(): if len(s) == n: ans.append("".join(s)) return if len(ans) >= k: return for c in "abc": if not s or s[-1] != c: s.app...
Solution
python
PrefectHQ__prefect
tests/blocks/test_abstract.py
{ "start": 11248, "end": 12933 }
class ____: def test_secret_block_is_abstract(self): with pytest.raises( TypeError, match="Can't instantiate abstract class SecretBlock" ): SecretBlock() def test_secret_block_implementation(self, caplog): class ASecretBlock(SecretBlock): secret_name:...
TestSecretBlock
python
huggingface__transformers
src/transformers/models/starcoder2/modeling_starcoder2.py
{ "start": 2500, "end": 6662 }
class ____(nn.Module): def __init__(self, config: Starcoder2Config): super().__init__() embed_dim = config.hidden_size self.c_fc = nn.Linear(embed_dim, config.intermediate_size, bias=config.use_bias) self.c_proj = nn.Linear(config.intermediate_size, embed_dim, bias=config.use_bias) ...
Starcoder2MLP
python
altair-viz__altair
altair/vegalite/v6/schema/channels.py
{ "start": 340408, "end": 354205 }
class ____(FieldChannelMixin, core.LatLongFieldDef): r""" Longitude schema wrapper. Parameters ---------- shorthand : str, dict, Sequence[str], :class:`RepeatRef` shorthand for field, aggregate, and type aggregate : dict, :class:`Aggregate`, :class:`ArgmaxDef`, :class:`ArgminDef`, :clas...
Longitude
python
realpython__materials
python-self-type/accounts_typevar.py
{ "start": 207, "end": 806 }
class ____: account_number: int balance: float def display_balance(self: TBankAccount) -> TBankAccount: print(f"Account Number: {self.account_number}") print(f"Balance: ${self.balance:,.2f}\n") return self def deposit(self: TBankAccount, amount: float) -> TBankAccount: ...
BankAccount
python
apache__thrift
test/crossrunner/test.py
{ "start": 3454, "end": 5464 }
class ____(object): def __init__(self, testdir, server, client, delay, timeout, **kwargs): self.testdir = testdir self._log = multiprocessing.get_logger() self._config = kwargs self.protocol = kwargs['protocol'] self.transport = kwargs['transport'] self.socket = kwarg...
TestEntry
python
doocs__leetcode
solution/3000-3099/3005.Count Elements With Maximum Frequency/Solution.py
{ "start": 0, "end": 190 }
class ____: def maxFrequencyElements(self, nums: List[int]) -> int: cnt = Counter(nums) mx = max(cnt.values()) return sum(x for x in cnt.values() if x == mx)
Solution
python
scikit-image__scikit-image
tests/skimage/measure/test_ccomp.py
{ "start": 3262, "end": 7397 }
class ____: def setup_method(self): self.x = np.zeros((3, 4, 5), int) self.x[0] = np.array( [[0, 3, 2, 1, 9], [0, 1, 9, 2, 9], [0, 1, 9, 9, 9], [3, 1, 5, 3, 0]] ) self.x[1] = np.array( [[3, 3, 2, 1, 9], [0, 3, 9, 2, 1], [0, 3, 3, 1, 1], [3, 1, 3, 3, 0]] ...
TestConnectedComponents3d
python
apache__airflow
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_tasks.py
{ "start": 3480, "end": 11753 }
class ____(TestTaskEndpoint): def test_should_respond_200(self, test_client): expected = { "class_ref": { "class_name": "EmptyOperator", "module_path": "airflow.providers.standard.operators.empty", }, "depends_on_past": False, "...
TestGetTask
python
PrefectHQ__prefect
src/prefect/client/schemas/actions.py
{ "start": 1555, "end": 1952 }
class ____(ActionBaseModel): """Data used by the Prefect REST API to create a new state.""" type: StateType name: Optional[str] = Field(default=None) message: Optional[str] = Field(default=None, examples=["Run started"]) state_details: StateDetails = Field(default_factory=StateDetails) data: Un...
StateCreate
python
modin-project__modin
modin/config/envvars.py
{ "start": 40156, "end": 40347 }
class ____(EnvironmentVariable, type=str): """Engine to run `read_sql`.""" varname = "MODIN_READ_SQL_ENGINE" default = "Pandas" choices = ("Pandas", "Connectorx")
ReadSqlEngine
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/image_ops/attention_ops_test.py
{ "start": 1079, "end": 11759 }
class ____(test.TestCase): def _VerifyValues(self, tensor_in_sizes, glimpse_sizes, offsets, expected_rows, expected_cols): """Verifies the output values of the glimpse extraction kernel. Args: tensor_in_sizes: Input tensor dimensions in [input_rows, input_cols]. glimpse_sizes...
ExtractGlimpseTest
python
google__pytype
pytype/tools/config_test.py
{ "start": 1950, "end": 3191 }
class ____(unittest.TestCase): def test_items(self): with test_utils.Tempdir() as d: f = d.create_file( 'setup.cfg', textwrap.dedent(""" [test] k1 = v1 k2 = v2 """), ) section = config.IniConfigSection.create_from_file(f, 'test') self.assert...
TestIniConfigSection
python
instagram__MonkeyType
tests/test_stubs.py
{ "start": 48918, "end": 48964 }
class ____: class Child: pass
Parent
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/final2.py
{ "start": 2984, "end": 3054 }
class ____: @final def __init__(self, v: int) -> None: ...
Base5
python
rapidsai__cudf
python/cudf/cudf/core/index.py
{ "start": 162083, "end": 174748 }
class ____(Index): """ A categorical of orderable values that represent the indices of another Column Parameters ---------- data : array-like (1-dimensional) The values of the categorical. If categories are given, values not in categories will be replaced with None/NaN. cate...
CategoricalIndex
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/internal/conjecture/datatree.py
{ "start": 3406, "end": 13173 }
class ____: """Represents a transition to a finished state.""" status: Status interesting_origin: InterestingOrigin | None def _repr_pretty_(self, p: "RepresentationPrinter", cycle: bool) -> None: assert cycle is False o = self.interesting_origin # avoid str(o), which can inclu...
Conclusion
python
tensorflow__tensorflow
tensorflow/python/trackable/resource.py
{ "start": 3049, "end": 7784 }
class ____(base.Trackable, metaclass=_ResourceMetaclass): """Holds a Tensor which a tf.function can capture. `CapturableResource`s are discovered by traversing the graph of object attributes, e.g. during `tf.saved_model.save`. They are excluded from the scope-based tracking of `TrackableResource`; generally th...
CapturableResource
python
tensorflow__tensorflow
tensorflow/python/framework/ops.py
{ "start": 211969, "end": 214627 }
class ____(contextlib.AbstractContextManager[str]): # pylint: disable=invalid-name """Graph-only version of `name_scope_v1`.""" @property def name(self): return self._name def __init__(self, name, default_name=None, values=None) -> None: """Initialize the context manager. Args: name: The n...
internal_name_scope_v1
python
pennersr__django-allauth
allauth/socialaccount/providers/spotify/views.py
{ "start": 181, "end": 894 }
class ____(OAuth2Adapter): provider_id = "spotify" access_token_url = "https://accounts.spotify.com/api/token" # nosec authorize_url = "https://accounts.spotify.com/authorize" profile_url = "https://api.spotify.com/v1/me" def complete_login(self, request, app, token, **kwargs): extra_data ...
SpotifyOAuth2Adapter
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 544418, "end": 544761 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") node = sgqlc.types.Field("PullRequestTimelineItems", graphql_name="node")
PullRequestTimelineItemsEdge