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
apache__airflow
airflow-core/hatch_build.py
{ "start": 1298, "end": 5444 }
class ____(BuilderInterface[BuilderConfig, PluginManager]): """Custom build class for Airflow assets and git version.""" # Note that this name of the plugin MUST be `custom` - as long as we use it from custom # hatch_build.py file and not from external plugin. See note in the: # https://hatch.pypa.io/l...
CustomBuild
python
allegroai__clearml
clearml/storage/helper.py
{ "start": 14822, "end": 17527 }
class ____(object): encoding = None mode = "rw" name = "" newlines = "\n" softspace = False def __init__(self, input_iterator: Optional[Iterator[Any]] = None) -> None: self.closed = False self._buffer = Queue() self._input_iterator = input_iterator self._leftover...
_Stream
python
pytorch__pytorch
test/test_determination.py
{ "start": 169, "end": 4328 }
class ____(TestCase): # Test determination on a subset of tests TESTS = [ "test_nn", "test_jit_profiling", "test_jit", "test_torch", "test_cpp_extensions_aot_ninja", "test_cpp_extensions_aot_no_ninja", "test_utils", "test_determination", "t...
DeterminationTest
python
weaviate__weaviate-python-client
weaviate/collections/classes/config_vector_index.py
{ "start": 5183, "end": 5483 }
class ____(_VectorIndexConfigUpdate): threshold: Optional[int] hnsw: Optional[_VectorIndexConfigHNSWUpdate] flat: Optional[_VectorIndexConfigFlatUpdate] @staticmethod def vector_index_type() -> VectorIndexType: return VectorIndexType.DYNAMIC
_VectorIndexConfigDynamicUpdate
python
dagster-io__dagster
python_modules/dagster/dagster/_core/events/__init__.py
{ "start": 67119, "end": 67697 }
class ____( NamedTuple( "_StepExpectationResultData", [ ("expectation_result", ExpectationResult), ], ) ): def __new__(cls, expectation_result: ExpectationResult): return super().__new__( cls, expectation_result=check.inst_param( ...
StepExpectationResultData
python
PrefectHQ__prefect
tests/experimental/test_sla.py
{ "start": 2908, "end": 3190 }
class ____: async def test_create_sla(self): sla = ServiceLevelAgreement( name="test-sla", ) deployment_id = uuid4() sla.set_deployment_id(deployment_id) assert sla.owner_resource == f"prefect.deployment.{deployment_id}"
TestSla
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/triggers/test_opensearch_serverless.py
{ "start": 1700, "end": 3972 }
class ____: EXPECTED_WAITER_NAME = "collection_available" COLLECTION_NAME = "test_collection_name" COLLECTION_ID = "test_collection_id" @pytest.mark.parametrize( ("collection_name", "collection_id", "expected_pass"), [ pytest.param(COLLECTION_NAME, COLLECTION_ID, False, id="...
TestOpenSearchServerlessCollectionActiveTrigger
python
run-llama__llama_index
llama-index-integrations/llms/llama-index-llms-predibase/llama_index/llms/predibase/base.py
{ "start": 645, "end": 12931 }
class ____(CustomLLM): """ Predibase LLM. To use, you should have the ``predibase`` python package installed, and have your Predibase API key. The `model_name` parameter is the Predibase "serverless" base_model ID (see https://docs.predibase.com/user-guide/inference/models for the catalog). ...
PredibaseLLM
python
GoogleCloudPlatform__python-docs-samples
speech/microphone/transcribe_streaming_infinite_v2.py
{ "start": 1611, "end": 13364 }
class ____: """Opens a recording stream as a generator yielding the audio chunks.""" def __init__( self: object, rate: int, chunk_size: int, ) -> None: """Creates a resumable microphone stream. Args: self: The class instance. rate: The audio file's s...
ResumableMicrophoneStream
python
pytorch__pytorch
torch/_inductor/ir.py
{ "start": 181655, "end": 181782 }
class ____(ChoiceCaller): def get_make_kernel_render(self) -> Any: raise NotImplementedError
TritonTemplateCallerBase
python
scikit-image__scikit-image
benchmarks/benchmark_transform.py
{ "start": 51, "end": 411 }
class ____: """Benchmark for transform routines in scikit-image.""" def setup(self): self.image = np.zeros((2000, 2000)) idx = np.arange(500, 1500) self.image[idx[::-1], idx] = 255 self.image[idx, idx] = 255 def time_hough_line(self): result1, result2, result3 = tra...
TransformSuite
python
wireservice__csvkit
tests/test_utilities/test_csvsql.py
{ "start": 352, "end": 10243 }
class ____(CSVKitTestCase, EmptyFileTests): Utility = CSVSQL def test_launch_new_instance(self): with patch.object(sys, 'argv', [self.Utility.__name__.lower(), 'examples/dummy.csv']): launch_new_instance() def test_options(self): for args, message in ( ( ...
TestCSVSQL
python
google__pytype
pytype/tests/test_base_test.py
{ "start": 6495, "end": 6980 }
class ____(test_base.BaseTest): def test_dep_tree(self): foo_pyi = """ class A: pass """ bar_py = """ import foo x = foo.A() """ deps = [("foo.pyi", foo_pyi), ("bar.py", bar_py)] with self.DepTree(deps) as d: self.Check(""" import foo import bar ...
DepTreeTest
python
apache__airflow
helm-tests/tests/helm_tests/airflow_aux/test_database_cleanup.py
{ "start": 2453, "end": 18225 }
class ____: """Tests database cleanup.""" def test_should_create_cronjob_for_enabled_cleanup(self): docs = render_chart( values={ "databaseCleanup": {"enabled": True}, }, show_only=["templates/database-cleanup/database-cleanup-cronjob.yaml"], ...
TestDatabaseCleanup
python
pypa__warehouse
warehouse/manage/views/__init__.py
{ "start": 52861, "end": 89318 }
class ____: def __init__(self, release, request): self.release = release self.request = request @view_config(request_method="GET") def manage_project_release(self): return { "project": self.release.project, "release": self.release, "files": self.r...
ManageProjectRelease
python
tensorflow__tensorflow
tensorflow/python/autograph/pyct/origin_info.py
{ "start": 5221, "end": 9975 }
class ____(gast.NodeVisitor): """Annotates an AST with additional source information like file name.""" def __init__(self, root_node, source_lines, comments_map, context_lineno, context_col_offset, filepath): self._source_lines = source_lines self._comments_map = comments_map ...
OriginResolver
python
ipython__ipython
IPython/core/interactiveshell.py
{ "start": 5964, "end": 7661 }
class ____(types.ModuleType): def __init__(self) -> None: super().__init__( "__main__", doc="Automatically created module for the IPython interactive environment", ) def make_main_module_type(user_ns: dict[str, Any]) -> type[_IPythonMainModuleBase]: @undoc class IPy...
_IPythonMainModuleBase
python
ray-project__ray
python/ray/air/util/object_extensions/arrow.py
{ "start": 3348, "end": 4358 }
class ____(pa.ExtensionArray): """Array class for ArrowPythonObjectType""" def from_objects( objects: typing.Union[np.ndarray, typing.Iterable[typing.Any]] ) -> "ArrowPythonObjectArray": if isinstance(objects, np.ndarray): objects = objects.tolist() type_ = ArrowPythonOb...
ArrowPythonObjectArray
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/unnecessaryIsInstance2.py
{ "start": 177, "end": 632 }
class ____(BBase): ... def func1(a: AFinal, b: BFinal): # This should generate an error if reportUnnecessaryIsinstance is true. if isinstance(a, BBase): reveal_type(a) # This should generate an error if reportUnnecessaryIsinstance is true. if isinstance(a, BBase): reveal_type(a) def...
BFinal
python
doocs__leetcode
solution/2500-2599/2545.Sort the Students by Their Kth Score/Solution.py
{ "start": 0, "end": 148 }
class ____: def sortTheStudents(self, score: List[List[int]], k: int) -> List[List[int]]: return sorted(score, key=lambda x: -x[k])
Solution
python
getlogbook__logbook
src/logbook/handlers.py
{ "start": 30309, "end": 35184 }
class ____(FileHandler): """This handler rotates based on dates. It will name the file after the filename you specify and the `date_format` pattern. So for example if you configure your handler like this:: handler = TimedRotatingFileHandler("/var/log/foo.log", date_format="%Y-%m-%d") The fil...
TimedRotatingFileHandler
python
openai__openai-python
src/openai/types/webhooks/fine_tuning_job_succeeded_webhook_event.py
{ "start": 332, "end": 798 }
class ____(BaseModel): id: str """The unique ID of the event.""" created_at: int """The Unix timestamp (in seconds) of when the fine-tuning job succeeded.""" data: Data """Event data payload.""" type: Literal["fine_tuning.job.succeeded"] """The type of the event. Always `fine_tuning.j...
FineTuningJobSucceededWebhookEvent
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/constructor18.py
{ "start": 493, "end": 887 }
class ____(Generic[_T1]): def __new__(cls, *args, **kwargs) -> Self: return super().__new__(cls, *args, **kwargs) @overload def __init__(self, arg: _T1) -> None: ... @overload def __init__(self: "ClassB[str]", arg: int) -> None: ... def __init__(self, arg: int | ClassA | str) -> None:...
ClassB
python
ray-project__ray
release/train_tests/benchmark/runner.py
{ "start": 14534, "end": 16112 }
class ____(TrainLoopRunner): """A simple runner that uses a PyTorch model, optimizer, and loss function.""" def _setup(self): model = self.factory.get_model() self.model = ray.train.torch.prepare_model(model) self.loss_fn = self.factory.get_loss_fn() self.optimizer = torch.optim...
VanillaTorchRunner
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_dataplex.py
{ "start": 33390, "end": 34329 }
class ____: @mock.patch(HOOK_STR) def test_execute(self, hook_mock): op = DataplexCatalogDeleteEntryTypeOperator( project_id=PROJECT_ID, location=REGION, entry_type_id=ENTRY_TYPE_NAME, task_id="delete_task", gcp_conn_id=GCP_CONN_ID, ...
TestDataplexCatalogDeleteEntryTypeOperator
python
numba__numba
numba/parfors/parfor.py
{ "start": 127198, "end": 132634 }
class ____(ParforPassStates): """ParforFusionPass class is responsible for fusing parfors """ def run(self): """run parfor fusion pass""" # simplify CFG of parfor body loops since nested parfors with extra # jumps can be created with prange conversion n_parfors = simplify_...
ParforFusionPass
python
facebookresearch__faiss
tests/test_fast_scan_ivf.py
{ "start": 31554, "end": 32756 }
class ____(unittest.TestCase): IMPLEM = 12 def do_test(self, metric=faiss.METRIC_L2): ds = datasets.SyntheticDataset(32, 750, 200, 100) index = faiss.index_factory(ds.d, "IVF32,PQ16x4np", metric) index.train(ds.get_train()) index.add(ds.get_database()) index.nprobe = 4 ...
TestRangeSearchImplem12
python
getsentry__sentry
src/sentry/eventtypes/security.py
{ "start": 141, "end": 1142 }
class ____(BaseEvent): def extract_metadata(self, data): # Relay normalizes the message for security reports into the log entry # field, so we grab the message from there. # (https://github.com/getsentry/relay/pull/558) message = strip( get_path(data, "logentry", "formatt...
SecurityEvent
python
kamyu104__LeetCode-Solutions
Python/longest-increasing-path-in-a-matrix.py
{ "start": 65, "end": 1633 }
class ____(object): def longestIncreasingPath(self, matrix): """ :type matrix: List[List[int]] :rtype: int """ directions = [(0, -1), (0, 1), (-1, 0), (1, 0)] if not matrix: return 0 in_degree = [[0]*len(matrix[0]) for _ in xrange(len(mat...
Solution
python
great-expectations__great_expectations
great_expectations/execution_engine/execution_engine.py
{ "start": 2298, "end": 3295 }
class ____(DictDot): """ MetricComputationConfiguration is a "dataclass" object, which holds components required for metric computation. """ # noqa: E501 # FIXME CoP metric_configuration: MetricConfiguration metric_fn: sa.func | F # type: ignore[valid-type] # FIXME CoP metric_provider_kwargs:...
MetricComputationConfiguration
python
apache__airflow
airflow-ctl/src/airflowctl/api/datamodels/generated.py
{ "start": 33703, "end": 34667 }
class ____(BaseModel): """ Asset serializer for responses. """ id: Annotated[int, Field(title="Id")] name: Annotated[str, Field(title="Name")] uri: Annotated[str, Field(title="Uri")] group: Annotated[str, Field(title="Group")] extra: Annotated[dict[str, JsonValue] | None, Field(title="E...
AssetResponse
python
huggingface__transformers
tests/models/rt_detr/test_modeling_rt_detr.py
{ "start": 9684, "end": 26488 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (RTDetrModel, RTDetrForObjectDetection) if is_torch_available() else () pipeline_model_mapping = ( {"image-feature-extraction": RTDetrModel, "object-detection": RTDetrForObjectDetection} if is_torch_availab...
RTDetrModelTest
python
rq__rq
tests/test_registry.py
{ "start": 11660, "end": 14579 }
class ____(RQTestCase): def setUp(self): super().setUp() self.registry = DeferredJobRegistry(connection=self.connection) def test_key(self): self.assertEqual(self.registry.key, 'rq:deferred:default') def test_add(self): """Adding a job to DeferredJobsRegistry.""" jo...
TestDeferredRegistry
python
huggingface__transformers
src/transformers/models/auto/modeling_auto.py
{ "start": 91848, "end": 92104 }
class ____(_BaseAutoModelClass): _model_mapping = MODEL_FOR_AUDIO_TOKENIZATION_MAPPING AutoModelForAudioTokenization = auto_class_update( AutoModelForAudioTokenization, head_doc="audio tokenization through codebooks" )
AutoModelForAudioTokenization
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1571815, "end": 1573816 }
class ____(TopLevelParameter): """ VariableParameter schema wrapper. Parameters ---------- name : str, :class:`ParameterName` A unique name for the variable parameter. Parameter names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or "$", o...
VariableParameter
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/list_files_test.py
{ "start": 9115, "end": 10954 }
class ____(ListFilesTest, parameterized.TestCase): @combinations.generate( combinations.times( test_base.default_test_combinations(), combinations.combine( repetitions=[1, 2], seed=[None, 42], reshuffle_each_iteration=[True, False]))) def test( ...
ListFilesGlobalShuffleTest
python
Netflix__metaflow
metaflow/plugins/datatools/local.py
{ "start": 174, "end": 258 }
class ____(MetaflowException): headline = "Invalid path"
MetaflowLocalURLException
python
django__django
django/contrib/gis/db/models/lookups.py
{ "start": 10611, "end": 11303 }
class ____(DistanceLookupBase): def as_sql(self, compiler, connection): spheroid = ( len(self.rhs_params) == 2 and self.rhs_params[-1] == "spheroid" ) or None distance_expr = connection.ops.distance_expr_for_lookup( self.lhs, self.rhs, spheroid=spheroid ) ...
DistanceLookupFromFunction
python
pytorch__pytorch
test/package/package_a/fake_interface.py
{ "start": 800, "end": 1064 }
class ____(torch.nn.Module): proxy_mod: ModuleInterface def __init__(self) -> None: super().__init__() self.proxy_mod = OrigModule() def forward(self, input: Tensor) -> Tensor: return self.proxy_mod.one(input, input)
UsesInterface
python
django__django
tests/model_inheritance_regress/models.py
{ "start": 1512, "end": 1608 }
class ____(models.Model): created = models.DateTimeField(default=datetime.datetime.now)
Parent
python
wandb__wandb
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/polling.py
{ "start": 4230, "end": 4875 }
class ____(BaseObserver): """ File system independent observer that polls a directory to detect changes. """ def __init__(self, stat, listdir, polling_interval=1): """ :param stat: stat function. See ``os.stat`` for details. :param listdir: listdir function. See ``os.listdir`` f...
PollingObserverVFS
python
ray-project__ray
doc/source/serve/doc_code/multiplexed.py
{ "start": 1503, "end": 1877 }
class ____: def __init__(self, downstream: DeploymentHandle): self._h = downstream async def __call__(self, request: starlette.requests.Request): return await self._h.options(multiplexed_model_id="bar").remote() serve.run(Upstream.bind(Downstream.bind())) resp = requests.get("http://localhost...
Upstream
python
PrefectHQ__prefect
tests/test_task_worker.py
{ "start": 15448, "end": 16225 }
class ____: async def test_task_run_via_task_worker_respects_tags( self, async_foo_task, prefect_client, events_pipeline ): @task(tags=["foo", "bar"]) async def task_with_tags(x): return x task_worker = TaskWorker(task_with_tags) task_run_future = task_with_...
TestTaskWorkerTaskTags
python
airbytehq__airbyte
airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ActorDefinitionResourceRequirements.py
{ "start": 1022, "end": 1379 }
class ____(BaseModel): class Config: extra = Extra.forbid default: Optional[ResourceRequirements] = Field( None, description="if set, these are the requirements that should be set for ALL jobs run for this actor definition.", ) jobSpecific: Optional[List[JobTypeResourceLimit]] =...
ActorDefinitionResourceRequirements
python
numba__numba
numba/tests/test_numpy_support.py
{ "start": 5380, "end": 7393 }
class ____(object): """ Common tests for the typing of values. Also used by test_special. """ def check_number_values(self, func): """ Test *func*() with scalar numeric values. """ f = func # Standard Python types get inferred by numpy self.assertIn(f(1)...
ValueTypingTestBase
python
chroma-core__chroma
chromadb/errors.py
{ "start": 2702, "end": 2889 }
class ____(ChromaError): @overrides def code(self) -> int: return 500 @classmethod @overrides def name(cls) -> str: return "InternalError"
InternalError
python
django-import-export__django-import-export
tests/core/tests/test_mixins.py
{ "start": 4145, "end": 5024 }
class ____(TestCase): def test_get_import_formats(self): class Format: def __init__(self, id, can_import): self.id = id self.val = can_import def can_import(self): return self.val class CanImportFormat(Format): def...
BaseImportMixinTest
python
django-haystack__django-haystack
haystack/fields.py
{ "start": 15489, "end": 15545 }
class ____(FacetField, DateField): pass
FacetDateField
python
encode__django-rest-framework
tests/test_fields.py
{ "start": 73003, "end": 73145 }
class ____(DjangoImageField): default_validators = [ext_validator] def to_python(self, value): return value
PassImageValidation
python
huggingface__transformers
src/transformers/generation/continuous_batching/scheduler.py
{ "start": 13179, "end": 16245 }
class ____(Scheduler): """Scheduler that prioritizes split prefill requests over decoding requests. This scheduler ensures that split prefill requests (which are continuations of partially processed prompts) are completed before processing new decoding requests.""" @traced def schedule_batch(self, ...
PrefillFirstScheduler
python
joke2k__faker
tests/providers/test_bank.py
{ "start": 5353, "end": 5819 }
class ____: """Test uk_UA bank provider""" def test_bban(self, faker, num_samples): for _ in range(num_samples): assert re.fullmatch(r"\d{27}", faker.bban()) def test_iban(self, faker, num_samples): for _ in range(num_samples): iban = faker.iban() assert...
TestUkUa
python
kamyu104__LeetCode-Solutions
Python/maximum-score-of-spliced-array.py
{ "start": 58, "end": 601 }
class ____(object): def maximumsSplicedArray(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: int """ def kadane(a): result = curr = 0 for x in a: curr = max(curr+x, 0) result = max(...
Solution
python
huggingface__transformers
src/transformers/models/blt/modular_blt.py
{ "start": 23012, "end": 25217 }
class ____(BltPreTrainedModel): config: BltGlobalTransformerConfig _can_record_outputs = { "global_attentions": OutputRecorder(BltSelfAttention, index=1, layer_name="global_transformer"), } def __init__(self, config: BltGlobalTransformerConfig): super().__init__(config) self.con...
BltGlobalTransformer
python
altair-viz__altair
altair/utils/plugin_registry.py
{ "start": 1291, "end": 2324 }
class ____(Generic[PluginT, R]): """ Context manager for enabling plugins. This object lets you use enable() as a context manager to temporarily enable a given plugin:: with plugins.enable("name"): do_something() # 'name' plugin temporarily enabled # plugins back to origin...
PluginEnabler
python
openai__openai-python
src/openai/types/shared_params/response_format_json_schema.py
{ "start": 272, "end": 1239 }
class ____(TypedDict, total=False): name: Required[str] """The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. """ description: str """ A description of what the response format is for, used by the model to determine ...
JSONSchema
python
falconry__falcon
falcon/middleware.py
{ "start": 365, "end": 7331 }
class ____(UniversalMiddlewareWithProcessResponse): """CORS Middleware. This middleware provides a simple out-of-the box CORS policy, including handling of preflighted requests from the browser. See also: * https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS * https://www.w3.org/TR/cors/#r...
CORSMiddleware
python
ipython__ipython
IPython/core/prefilter.py
{ "start": 2661, "end": 12733 }
class ____(Configurable): """Main prefilter component. The IPython prefilter is run on all user input before it is run. The prefilter consumes lines of input and produces transformed lines of input. The implementation consists of two phases: 1. Transformers 2. Checkers and handlers ...
PrefilterManager
python
allegroai__clearml
clearml/backend_api/services/v2_20/queues.py
{ "start": 31594, "end": 32795 }
class ____(Response): """ Response of queues.delete_metadata endpoint. :param updated: Number of queues updated (0 or 1) :type updated: int """ _service = "queues" _action = "delete_metadata" _version = "2.20" _schema = { "definitions": {}, "properties": { ...
DeleteMetadataResponse
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 822550, "end": 823081 }
class ____( sgqlc.types.Type, Node, AuditEntry, OrganizationAuditEntryData ): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("membership_types", "reason") membership_types = sgqlc.types.Field( sgqlc.types.list_of( sgqlc.types.non_nu...
OrgRemoveMemberAuditEntry
python
jschneier__django-storages
tests/test_ftp.py
{ "start": 8144, "end": 9634 }
class ____(TestCase): def setUp(self): self.storage = ftp.FTPStorage(location=URL) @patch("ftplib.FTP", **{"return_value.retrlines": list_retrlines}) def test_size(self, mock_ftp): file_ = ftp.FTPStorageFile("fi", self.storage, "wb") self.assertEqual(file_.size, 1024) @patch("f...
FTPStorageFileTest
python
Lightning-AI__lightning
tests/tests_pytorch/models/test_hparams.py
{ "start": 26747, "end": 30371 }
class ____(BoringModel): def __init__(self, my_path, any_param=123): super().__init__() self.save_hyperparameters() def test_model_with_fsspec_as_parameter(tmp_path): model = UnsafeParamModel(LocalFileSystem(tmp_path)) trainer = Trainer( default_root_dir=tmp_path, limit_train_batch...
UnsafeParamModel
python
pandas-dev__pandas
pandas/tests/reductions/test_reductions.py
{ "start": 8041, "end": 18990 }
class ____: # Note: the name TestIndexReductions indicates these tests # were moved from an Index-specific test file, _not_ that these tests are # intended long-term to be Index-specific @pytest.mark.parametrize( "start,stop,step", [ (0, 400, 3), (500, 0, -6), ...
TestIndexReductions
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/collective_ops_test.py
{ "start": 5329, "end": 18384 }
class ____(test.TestCase, parameterized.TestCase): def setUp(self): _setup_context(num_devices=16) super().setUp() def testReduce(self, collective_ops, device, communication): dev0 = '/device:%s:0' % device dev1 = '/device:%s:1' % device tokens = {} for dev in [dev0, dev1]: with ops...
CollectiveOpsTest
python
django-import-export__django-import-export
tests/core/tests/test_resources/test_import_export.py
{ "start": 19853, "end": 20906 }
class ____(TestCase): """ Issue 2020 - export should handle QuerySet.values() """ class _EBookResource(ModelResource): def get_queryset(self): return EBook.objects.all().values("id", "name", "published") class Meta: model = EBook fields = ("id", "na...
QuerysetValuesOnExportTest
python
sphinx-doc__sphinx
sphinx/ext/autosummary/generate.py
{ "start": 2044, "end": 2131 }
class ____: def emit_firstresult(self, *args: Any) -> None: pass
_DummyEvents
python
jmcnamara__XlsxWriter
xlsxwriter/test/styles/test_write_num_fmts.py
{ "start": 332, "end": 1087 }
class ____(unittest.TestCase): """ Test the Styles _write_num_fmts() method. """ def setUp(self): self.fh = StringIO() self.styles = Styles() self.styles._set_filehandle(self.fh) def test_write_num_fmts(self): """Test the _write_num_fmts() method""" xf_for...
TestWriteNumFmts
python
pypa__warehouse
warehouse/manage/forms.py
{ "start": 7310, "end": 8951 }
class ____(WebAuthnCredentialMixin, wtforms.Form): __params__ = ["label", "credential"] label = wtforms.StringField( validators=[ wtforms.validators.InputRequired(message="Specify a label"), wtforms.validators.Length( max=64, message=("Label must be 64 characters...
ProvisionWebAuthnForm
python
astropy__astropy
astropy/io/ascii/core.py
{ "start": 7721, "end": 7791 }
class ____(NumType): """ Describes integer data. """
IntType
python
langchain-ai__langchain
libs/core/langchain_core/utils/aiter.py
{ "start": 5032, "end": 8996 }
class ____(Generic[T]): """Create `n` separate asynchronous iterators over `iterable`. This splits a single `iterable` into multiple iterators, each providing the same items in the same order. All child iterators may advance separately but share the same items from `iterable` -- when the most advan...
Tee
python
great-expectations__great_expectations
great_expectations/datasource/fluent/metadatasource.py
{ "start": 462, "end": 2174 }
class ____(ModelMetaclass): __cls_set: Set[Type] = set() def __new__( # noqa: PYI034 # Self cannot be used with Metaclass meta_cls: Type[MetaDatasource], cls_name: str, bases: tuple[type], cls_dict ) -> MetaDatasource: """ MetaDatasource hook that runs when a new `Datasource` is de...
MetaDatasource
python
kamyu104__LeetCode-Solutions
Python/reorder-routes-to-make-all-paths-lead-to-the-city-zero.py
{ "start": 50, "end": 762 }
class ____(object): def minReorder(self, n, connections): """ :type n: int :type connections: List[List[int]] :rtype: int """ lookup, graph = set(), collections.defaultdict(list) for u, v in connections: lookup.add(u*n+v) graph[v].appen...
Solution
python
pyparsing__pyparsing
examples/bf.py
{ "start": 2641, "end": 2742 }
class ____(Instruction): def execute(self, bf_engine: BFEngine): bf_engine.ptr += 1
IncrPtr
python
doocs__leetcode
solution/2000-2099/2009.Minimum Number of Operations to Make Array Continuous/Solution.py
{ "start": 0, "end": 272 }
class ____: def minOperations(self, nums: List[int]) -> int: ans = n = len(nums) nums = sorted(set(nums)) for i, v in enumerate(nums): j = bisect_right(nums, v + n - 1) ans = min(ans, n - (j - i)) return ans
Solution
python
kamyu104__LeetCode-Solutions
Python/minimum-number-of-moves-to-make-palindrome.py
{ "start": 33, "end": 445 }
class ____(object): # 0-indexed def __init__(self, n): self.__bit = [0]*(n+1) def add(self, i, val): i += 1 while i < len(self.__bit): self.__bit[i] += val i += (i & -i) def query(self, i): i += 1 ret = 0 while i > 0: ret...
BIT
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0129_addons_notification_data_migration.py
{ "start": 914, "end": 1163 }
class ____(migrations.Migration): safe = Safe.before_deploy() dependencies = [ ("projects", "0128_addons_notifications"), ] operations = [ migrations.RunPython(forward_add_fields, reverse_remove_fields), ]
Migration
python
huggingface__transformers
src/transformers/models/speecht5/modeling_speecht5.py
{ "start": 45734, "end": 49810 }
class ____(GradientCheckpointingLayer): def __init__(self, config: SpeechT5Config, layer_idx=None): super().__init__() self.self_attn = SpeechT5Attention( embed_dim=config.hidden_size, num_heads=config.decoder_attention_heads, dropout=config.attention_dropout, ...
SpeechT5DecoderLayer
python
joke2k__faker
tests/providers/test_geo.py
{ "start": 4967, "end": 5262 }
class ____(unittest.TestCase): def setUp(self): self.fake = Faker("pt_PT") Faker.seed(0) def test_nationality(self): nationality = self.fake.nationality() assert isinstance(nationality, str) assert nationality in PtPtProvider.nationalities
TestPtPT
python
facebook__pyre-check
scripts/callgraph_utilities.py
{ "start": 7159, "end": 9033 }
class ____: dependency_graph: Dict[str, Set[str]] entrypoints: Entrypoints def __init__(self, input_call_graph: InputFormat, entrypoints: Entrypoints) -> None: self.entrypoints = entrypoints self.dependency_graph = defaultdict(lambda: set()) call_graph = input_call_graph.call_graph ...
DependencyGraph
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_stateful.py
{ "start": 5686, "end": 10458 }
class ____(RuleBasedStateMachine): b = Bundle("b") def __init__(self): self.expected_bundle_length = 0 super().__init__() @invariant() def bundle_length(self): assert len(self.bundle("b")) == self.expected_bundle_length @rule(target=b, items=lists(elements=integers(), max_...
MachineUsingMultiple
python
Lightning-AI__lightning
examples/pytorch/basics/autoencoder.py
{ "start": 1393, "end": 4176 }
class ____(callbacks.Callback): def __init__( self, num_samples: int = 3, nrow: int = 8, padding: int = 2, normalize: bool = True, value_range: Optional[tuple[int, int]] = None, scale_each: bool = False, pad_value: int = 0, ) -> None: """ ...
ImageSampler
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/lambda9.py
{ "start": 238, "end": 514 }
class ____(Generic[_OutT]): @overload def map(self, func: Callable[[_OutT], Exception], /) -> "Flow[None]": ... @overload def map(self, func: Callable[[_OutT], _Out2T], /) -> "Flow[_Out2T]": ... def map(self, obj, /): return cast("Flow", self)
Flow
python
walkccc__LeetCode
solutions/2572. Count the Number of Square-Free Subsets/2572.py
{ "start": 0, "end": 1117 }
class ____: def squareFreeSubsets(self, nums: list[int]) -> int: MOD = 1_000_000_007 primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] def getMask(num: int) -> int: """ e.g. num = 10 = 2 * 5, so mask = 0b101 . 0b1010 (append a 0) num = 15 = 3 * 5, so mask = 0b110 . 0b1100 (append a 0) ...
Solution
python
Netflix__metaflow
metaflow/plugins/cards/exception.py
{ "start": 2962, "end": 3338 }
class ____(MetaflowException): headline = "Unable to render @card" def __init__(self, card_type, args): msg = ( "Card of type %s is unable to be rendered with arguments %s.\nStack trace : " " %s" % (card_type, args, traceback.format_exc()) ) super(UnrenderableCa...
UnrenderableCardException
python
lepture__authlib
authlib/jose/errors.py
{ "start": 99, "end": 158 }
class ____(JoseError): error = "decode_error"
DecodeError
python
tensorflow__tensorflow
tensorflow/python/ops/variables.py
{ "start": 7406, "end": 54868 }
class ____(trackable.Trackable, metaclass=VariableMetaclass): """See the [variable guide](https://tensorflow.org/guide/variable). A variable maintains shared, persistent state manipulated by a program. The `Variable()` constructor requires an initial value for the variable, which can be a `Tensor` of any type...
Variable
python
ray-project__ray
python/ray/serve/_private/application_state.py
{ "start": 44357, "end": 70793 }
class ____: def __init__( self, deployment_state_manager: DeploymentStateManager, autoscaling_state_manager: AutoscalingStateManager, endpoint_state: EndpointState, kv_store: KVStoreBase, logging_config: LoggingConfig, ): self._deployment_state_manager = d...
ApplicationStateManager
python
PyCQA__pylint
tests/pyreverse/functional/class_diagrams/annotations/method_annotation.py
{ "start": 216, "end": 643 }
class ____: def eat(self, food: Banana | Coconut) -> None: print(f"Monkey eats {food}") def munch(self, food: Union[Leaf, Insect]) -> None: print(f"Monkey munches {food}") def jump(self, height: Optional[int] = 10) -> None: print(f"Monkey jumps {height}") def scream(self, volu...
Monkey
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/sensors/gcs.py
{ "start": 1615, "end": 5833 }
class ____(BaseSensorOperator): """ Checks for the existence of a file in Google Cloud Storage. :param bucket: The Google Cloud Storage bucket where the object is. :param object: The name of the object to check in the Google cloud storage bucket. :param use_glob: When set to True the object...
GCSObjectExistenceSensor
python
pandas-dev__pandas
pandas/tests/series/methods/test_astype.py
{ "start": 18963, "end": 25741 }
class ____: def test_astype_categorical_to_other(self): cat = Categorical([f"{i} - {i + 499}" for i in range(0, 10000, 500)]) ser = Series(np.random.default_rng(2).integers(0, 10000, 100)).sort_values() ser = cut(ser, range(0, 10500, 500), right=False, labels=cat) expected = ser ...
TestAstypeCategorical
python
python-poetry__poetry
tests/conftest.py
{ "start": 5837, "end": 6418 }
class ____(KeyringBackend): @properties.classproperty def priority(self) -> float: return 42 def set_password(self, service: str, username: str, password: str) -> None: raise KeyringLocked() def get_password(self, service: str, username: str) -> str | None: raise KeyringLocked(...
LockedBackend
python
tensorflow__tensorflow
tensorflow/python/autograph/tests/type_annotations_test.py
{ "start": 887, "end": 1074 }
class ____(reference_test_base.TestCase): def test_pure_declaration(self): self.assertFunctionMatchesEager(pure_declaration) if __name__ == '__main__': tf.test.main()
ReferenceTest
python
doocs__leetcode
lcof/面试题59 - I. 滑动窗口的最大值/Solution.py
{ "start": 0, "end": 402 }
class ____: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: q = deque() ans = [] for i, x in enumerate(nums): if q and i - q[0] + 1 > k: q.popleft() while q and nums[q[-1]] <= x: q.pop() q.append(i) ...
Solution
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-vectorx/tests/test_vector_stores_vectorx.py
{ "start": 7052, "end": 8838 }
class ____(VectorXTestSetup): @classmethod def setUpClass(cls): super().setUpClass() cls.embed_model = HuggingFaceEmbedding( "sentence-transformers/all-MiniLM-L6-v2", device="cpu" ) cls.vector_store = VectorXVectorStore.from_params( api_token=cls.vecx_api_...
TestQueryAndFilter
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_format22.py
{ "start": 315, "end": 1624 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_format22.xlsx") def test_create_file(self): """Test the creation of an XlsxWriter file with chart formatting.""" workbook = ...
TestCompareXLSXFiles
python
django__django
tests/admin_views/models.py
{ "start": 836, "end": 2014 }
class ____(models.Model): """ A simple article to test admin views. Test backwards compatibility. """ title = models.CharField(max_length=100) content = models.TextField() date = models.DateTimeField() section = models.ForeignKey(Section, models.CASCADE, null=True, blank=True) another_s...
Article
python
paramiko__paramiko
tests/test_config.py
{ "start": 15326, "end": 17071 }
class ____: def test_SSHConfigDict_construct_empty(self): assert not SSHConfigDict() def test_SSHConfigDict_construct_from_list(self): assert SSHConfigDict([(1, 2)])[1] == 2 def test_SSHConfigDict_construct_from_dict(self): assert SSHConfigDict({1: 2})[1] == 2 @mark.parametriz...
TestSSHConfigDict
python
numba__llvmlite
llvmlite/ir/values.py
{ "start": 31551, "end": 31861 }
class ____(_BaseArgument): """ The specification of a function's return value. """ def __str__(self): attrs = self.attributes._to_list(self.type) if attrs: return "{0} {1}".format(' '.join(attrs), self.type) else: return str(self.type)
ReturnValue
python
ipython__ipython
IPython/core/crashhandler.py
{ "start": 3174, "end": 8747 }
class ____: """Customizable crash handlers for IPython applications. Instances of this class provide a :meth:`__call__` method which can be used as a ``sys.excepthook``. The :meth:`__call__` signature is:: def __call__(self, etype, evalue, etb) """ message_template = _default_message_tem...
CrashHandler
python
great-expectations__great_expectations
great_expectations/core/expectation_validation_result.py
{ "start": 18516, "end": 18938 }
class ____(TypedDict): active_batch_definition: LegacyBatchDefinition batch_markers: BatchMarkers batch_parameters: dict | None batch_spec: BatchSpec checkpoint_id: Optional[str] checkpoint_name: str expectation_suite_name: str great_expectations_version: str run_id: RunIdentifier ...
ExpectationSuiteValidationResultMeta
python
ApeWorX__ape
tests/functional/test_exceptions.py
{ "start": 1116, "end": 1328 }
class ____: def test_shows_line_number(self): actual = str(Abort()) expected = re.compile(r"Operation aborted in [\w<>.]*::[\w<>]* on line \d+\.") assert expected.match(actual)
TestAbort