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
fabric__fabric
integration/connection.py
{ "start": 327, "end": 5684 }
class ____: class ssh_connections: def open_method_generates_real_connection(self): c = Connection("localhost") c.open() assert c.client.get_transport().active is True assert c.is_connected is True return c def close_method_closes_connecti...
Connection_
python
has2k1__plotnine
plotnine/scales/limits.py
{ "start": 4077, "end": 5626 }
class ____: """ Set aesthetic limits Parameters ---------- kwargs : Aesthetic and the values of the limits. e.g `x=(40, 100)` Notes ----- If the 2nd value of `limits` is less than the first, a reversed scale will be created. """ def __init__(self, **kwargs)...
lims
python
spack__spack
lib/spack/spack/test/installer.py
{ "start": 35714, "end": 50435 }
class ____(Exception): pass _old_complete_task = None def _install_fail_my_build_exception(installer, task, install_status, **kwargs): if task.pkg.name == "pkg-a": raise MyBuildException("mock internal package build error for pkg-a") else: _old_complete_task(installer, task, install_stat...
MyBuildException
python
bokeh__bokeh
tests/unit/bokeh/embed/test_util__embed.py
{ "start": 24754, "end": 25181 }
class ____: def test_basic(self) -> None: t = Theme(json={}) d = Document() beu._themes[d] = t beu._unset_temp_theme(d) assert d.theme is t assert d not in beu._themes def test_no_old_theme(self) -> None: d = Document() orig = d.theme beu....
Test__unset_temp_theme
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/steps/gradle.py
{ "start": 711, "end": 812 }
class ____(Exception): """Raised when a Gradle operation times out.""" pass
GradleTimeoutError
python
catalyst-team__catalyst
catalyst/contrib/datasets/cifar.py
{ "start": 3554, "end": 8747 }
class ____(VisionDataset): """`CIFAR10 <https://www.cs.toronto.edu/~kriz/cifar.html>`_ Dataset. Args: root (string): Root directory of dataset where directory ``cifar-10-batches-py`` exists or will be saved to if download is set to True. train (bool, optional): If True, creates data...
CIFAR10
python
PrefectHQ__prefect
tests/server/orchestration/api/test_task_run_states.py
{ "start": 99, "end": 961 }
class ____: async def test_read_task_run_state(self, task_run, client, session): # create a flow run state to read result = await models.task_runs.set_task_run_state( session=session, task_run_id=task_run.id, state=schemas.states.Running(), ) await...
TestReadTaskRunStateById
python
apache__airflow
providers/http/tests/unit/http/triggers/test_http.py
{ "start": 7441, "end": 11544 }
class ____: @staticmethod def _mock_run_result(result_to_mock): f = Future() f.set_result(result_to_mock) return f def test_serialization(self, event_trigger): """ Asserts that the HttpEventTrigger correctly serializes its arguments and classpath. """...
TestHttpEventTrigger
python
pytorch__pytorch
test/dynamo/test_python_dispatcher.py
{ "start": 395, "end": 2388 }
class ____(torch._dynamo.test_case.TestCase): def test_dispatch_key1(self): @torch.compile(backend="aot_eager", fullgraph=True) def fn(x): x = x + 1 return torch._C._dispatch_keys(x) x = torch.randn(2, 3) self.assertTrue(fn(x).raw_repr() == torch._C._dispatch...
PythonDispatcherTests
python
davidhalter__jedi
test/completion/basic.py
{ "start": 3714, "end": 5340 }
class ____(Exception): def __init__(self, my_attr): self.my_attr = my_attr try: raise MyException(1) except MyException as e: #? ['my_attr'] e.my_attr #? 22 ['my_attr'] for x in e.my_attr: pass # ----------------- # params # ----------------- my_param = 1 #? 9 str() def foo1(m...
MyException
python
keon__algorithms
tests/test_maths.py
{ "start": 8172, "end": 8474 }
class ____(unittest.TestCase): """[summary] Test for the file pythagoras.py Arguments: unittest {[type]} -- [description] """ def test_pythagoras(self): self.assertEqual("Hypotenuse = 3.605551275463989", pythagoras(3, 2, "?"))
TestPythagoras
python
pyinstaller__pyinstaller
tests/unit/test_modulegraph/test_imports.py
{ "start": 13895, "end": 14682 }
class ____ (unittest.TestCase): if not hasattr(unittest.TestCase, 'assertIsInstance'): def assertIsInstance(self, value, types): if not isinstance(value, types): self.fail("%r is not an instance of %r"%(value, types)) def setUp(self): root = os.path.join( ...
TestRegressions2
python
numpy__numpy
numpy/random/tests/test_direct.py
{ "start": 16176, "end": 17634 }
class ____(Base): @classmethod def setup_class(cls): cls.bit_generator = MT19937 cls.bits = 32 cls.dtype = np.uint32 cls.data1 = cls._read_csv(join(pwd, './data/mt19937-testset-1.csv')) cls.data2 = cls._read_csv(join(pwd, './data/mt19937-testset-2.csv')) cls.seed_...
TestMT19937
python
getsentry__sentry
tests/sentry/api/helpers/test_group_index.py
{ "start": 1933, "end": 3911 }
class ____(TestCase): def run_test(self, query: str) -> None: validate_search_filter_permissions(self.organization, parse_search_query(query), self.user) def assert_analytics_recorded(self, mock_record: Mock) -> None: assert_last_analytics_event( mock_record, AdvancedSea...
ValidateSearchFilterPermissionsTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-google-ads/source_google_ads/components.py
{ "start": 13333, "end": 15652 }
class ____(RecordTransformation): """ Transforms keys in a Google Ads record to snake_case. The difference with KeysToSnakeCaseTransformation is that this transformation doesn't add underscore before digits. """ token_pattern: re.Pattern[str] = re.compile( r""" \d*[A-Z]+[a-z]*\d...
KeysToSnakeCaseGoogleAdsTransformation
python
apache__airflow
task-sdk/tests/task_sdk/api/test_client.py
{ "start": 38878, "end": 40723 }
class ____: @pytest.mark.parametrize( "request_params", [ ({"name": "this_asset", "uri": "s3://bucket/key"}), ({"alias_name": "this_asset_alias"}), ], ) def test_by_name_get_success(self, request_params): def handle_request(request: httpx.Request) -> h...
TestAssetEventOperations
python
numpy__numpy
numpy/random/tests/test_randomstate.py
{ "start": 81444, "end": 87749 }
class ____: def _create_arrays(self): return np.array([2]), np.array([3]), np.array([4]), (1,) def test_one_arg_funcs(self): argOne, _, _, tgtShape = self._create_arrays() funcs = (random.exponential, random.standard_gamma, random.chisquare, random.standard_t, ...
TestSingleEltArrayInput
python
PrefectHQ__prefect
tests/blocks/test_core.py
{ "start": 87898, "end": 93309 }
class ____: def test_block_type_slug_is_included_in_dict(self): assert "block_type_slug" in AChildBlock().model_dump() def test_block_type_slug_respects_exclude(self): assert "block_type_slug" not in AChildBlock().model_dump( exclude={"block_type_slug"} ) def test_block...
TestTypeDispatch
python
pydata__xarray
asv_bench/benchmarks/dataarray_missing.py
{ "start": 978, "end": 1872 }
class ____: def setup(self, shape, chunks, limit): if chunks is not None: requires_dask() self.da = make_bench_data(shape, 0.1, chunks) @parameterized( ["shape", "chunks", "limit"], ( [(365, 75, 75)], [None, {"x": 25, "y": 25}], [N...
DataArrayMissingBottleneck
python
numba__llvmlite
llvmlite/binding/orcjit.py
{ "start": 395, "end": 6749 }
class ____: """ Create a library for linking by OrcJIT OrcJIT operates like a linker: a number of compilation units and dependencies are collected together and linked into a single dynamic library that can export functions to other libraries or to be consumed directly as entry points into JITte...
JITLibraryBuilder
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_dlp.py
{ "start": 5443, "end": 6321 }
class ____: @mock.patch("airflow.providers.google.cloud.operators.dlp.CloudDLPHook") def test_create_inspect_template(self, mock_hook): mock_hook.return_value.create_inspect_template.return_value = InspectTemplate(name=DLP_JOB_PATH) operator = CloudDLPCreateInspectTemplateOperator(organization_i...
TestCloudDLPCreateInspectTemplateOperator
python
tensorflow__tensorflow
tensorflow/python/ops/control_flow_ops_test.py
{ "start": 65305, "end": 65648 }
class ____(test_util.TensorFlowTestCase): def testAsyncNoop(self): @def_function.function def f(): x = constant_op.constant(2) with ops.control_dependencies([while_v2.async_noop()]): y = x + 2 return y self.assertEqual(self.evaluate(f()), 4) if __name__ == "__main__": goog...
AsyncNoopTest
python
sqlalchemy__sqlalchemy
test/sql/test_metadata.py
{ "start": 30742, "end": 58903 }
class ____(fixtures.TestBase, AssertsCompiledSQL, ComparesTables): @testing.fixture def copy_fixture(self, metadata): from sqlalchemy.testing.schema import Table table = Table( "mytable", metadata, Column("myid", Integer, Sequence("foo_id_seq"), primary_key=...
ToMetaDataTest
python
scrapy__scrapy
scrapy/extensions/telnet.py
{ "start": 905, "end": 4070 }
class ____(protocol.ServerFactory): def __init__(self, crawler: Crawler): if not crawler.settings.getbool("TELNETCONSOLE_ENABLED"): raise NotConfigured self.crawler: Crawler = crawler self.noisy: bool = False self.portrange: list[int] = [ int(x) for x in craw...
TelnetConsole
python
numpy__numpy
numpy/_core/memmap.py
{ "start": 406, "end": 12651 }
class ____(ndarray): """Create a memory-map to an array stored in a *binary* file on disk. Memory-mapped files are used for accessing small segments of large files on disk, without reading the entire file into memory. NumPy's memmap's are array-like objects. This differs from Python's ``mmap`` mo...
memmap
python
dagster-io__dagster
python_modules/dagster/dagster/_core/loader.py
{ "start": 3148, "end": 5389 }
class ____(ABC, Generic[TKey, TContext]): """Make An object Loadable by ID of type TKey using a LoadingContext.""" @classmethod async def _batch_load(cls, keys: Iterable[TKey], context: TContext) -> Iterable[Optional[Self]]: return cls._blocking_batch_load(keys, context) @classmethod @abst...
LoadableBy
python
getsentry__sentry
tests/snuba/models/test_group.py
{ "start": 19268, "end": 26061 }
class ____(TestCase, SnubaTestCase, OccurrenceTestMixin): def setUp(self) -> None: super().setUp() self.project = self.create_project() self.issue_occ_a, _ = self.process_occurrence( project_id=self.project.id, event_id="a" * 32, event_data={ ...
GroupTestSnubaOccurrenceIssue
python
Textualize__textual
tests/test_binding_inheritance.py
{ "start": 13101, "end": 14267 }
class ____(AppKeyRecorder): """An app with a non-default screen that handles movement key bindings.""" SCREENS = {"main": ScreenWithMovementBindings} def on_mount(self) -> None: self.push_screen("main") async def test_contained_focused_child_widget_with_movement_bindings_on_screen() -> ( Non...
AppWithScreenWithBindingsWrappedWidgetNoBindings
python
pyca__cryptography
tests/hazmat/primitives/test_aes.py
{ "start": 8970, "end": 12737 }
class ____: test_ctr = generate_encrypt_test( load_nist_vectors, os.path.join("ciphers", "AES", "CTR"), ["aes-128-ctr.txt", "aes-192-ctr.txt", "aes-256-ctr.txt"], lambda key, **kwargs: algorithms.AES(binascii.unhexlify(key)), lambda iv, **kwargs: modes.CTR(binascii.unhexlify(...
TestAESModeCTR
python
xlwings__xlwings
xlwings/constants.py
{ "start": 96313, "end": 96754 }
class ____: xlPivotTableVersion10 = 1 # from enum XlPivotTableVersionList xlPivotTableVersion11 = 2 # from enum XlPivotTableVersionList xlPivotTableVersion12 = 3 # from enum XlPivotTableVersionList xlPivotTableVersion14 = 4 # from enum XlPivotTableVersionList xlPivotTableVersion2000 = 0 # from ...
PivotTableVersionList
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/array_ops/diag_op_test.py
{ "start": 31133, "end": 37673 }
class ____(test.TestCase): @test_util.run_deprecated_v1 def testSquare(self): with self.session(): v = np.array([1.0, 2.0, 3.0]) mat = np.diag(v) mat_diag = array_ops.matrix_diag_part(mat) self.assertEqual((3,), mat_diag.get_shape()) self.assertAllEqual(mat_diag, v) for off...
MatrixDiagPartTest
python
apache__airflow
airflow-core/src/airflow/api_fastapi/execution_api/versions/v2025_11_07.py
{ "start": 1122, "end": 2311 }
class ____(VersionChange): """Add the `partition_key` field to DagRun model.""" description = __doc__ instructions_to_migrate_to_previous_version = ( schema(DagRun).field("partition_key").didnt_exist, schema(AssetEventResponse).field("partition_key").didnt_exist, ) @convert_respon...
AddPartitionKeyField
python
huggingface__transformers
src/transformers/models/cohere2_vision/modular_cohere2_vision.py
{ "start": 3572, "end": 6493 }
class ____(AyaVisionModel): _checkpoint_conversion_mapping = {} def get_image_features(self, pixel_values: torch.FloatTensor): """ Obtains image last hidden states from the vision tower and apply multimodal projection. Args: pixel_values (`torch.FloatTensor]` of shape `(bat...
Cohere2VisionModel
python
bokeh__bokeh
src/bokeh/core/property/visual.py
{ "start": 7066, "end": 9049 }
class ____(Either): """ Accept (min, max) bounds tuples for use with Ranges. Bounds are provided as a tuple of ``(min, max)`` so regardless of whether your range is increasing or decreasing, the first item should be the minimum value of the range and the second item should be the maximum. Setting min >...
MinMaxBounds
python
celery__celery
celery/worker/request.py
{ "start": 2011, "end": 27859 }
class ____: """A request for task execution.""" acknowledged = False time_start = None worker_pid = None time_limits = (None, None) _already_revoked = False _already_cancelled = False _terminate_on_ack = None _apply_result = None _tzlocal = None if not IS_PYPY: # pragma: n...
Request
python
oauthlib__oauthlib
tests/oauth2/rfc6749/test_utils.py
{ "start": 471, "end": 3725 }
class ____(TestCase): def test_escape(self): """Assert that we are only escaping unicode""" self.assertRaises(ValueError, escape, b"I am a string type. Not a unicode type.") self.assertEqual(escape("I am a unicode type."), "I%20am%20a%20unicode%20type.") def test_host_from_uri(self): ...
UtilsTests
python
scipy__scipy
scipy/_lib/_util.py
{ "start": 23710, "end": 23976 }
class ____: """ Object to wrap user's function, allowing picklability """ def __init__(self, f, args): self.f = f self.args = [] if args is None else args def __call__(self, x): return self.f(x, *self.args)
_FunctionWrapper
python
pyqtgraph__pyqtgraph
benchmarks/arrayToQPath.py
{ "start": 860, "end": 988 }
class ____(_TimeSuite): def __init__(self): super().__init__() self.have_nonfinite = True
TimeSuiteWithNonFinite
python
readthedocs__readthedocs.org
readthedocs/api/v2/views/integrations.py
{ "start": 2735, "end": 13135 }
class ____: """Base class for Webhook mixins.""" permission_classes = (permissions.AllowAny,) renderer_classes = (JSONRenderer,) integration = None integration_type = None invalid_payload_msg = "Payload not valid" missing_secret_deprecated_msg = dedent( """ This webhook does...
WebhookMixin
python
ipython__ipython
IPython/core/history.py
{ "start": 5958, "end": 19436 }
class ____(HistoryAccessorBase): """Access the history database without adding to it. This is intended for use by standalone history tools. IPython shells use HistoryManager, below, which is a subclass of this.""" # counter for init_db retries, so we don't keep trying over and over _corrupt_db_cou...
HistoryAccessor
python
django-extensions__django-extensions
django_extensions/management/email_notifications.py
{ "start": 150, "end": 5312 }
class ____(BaseCommand): """ A BaseCommand subclass which adds sending email functionality. Subclasses will have an extra command line option ``--email-notification`` and will be able to send emails by calling ``send_email_notification()`` if SMTP host and port are specified in settings. The handli...
EmailNotificationCommand
python
mlflow__mlflow
mlflow/server/graphql/autogenerated_graphql_schema.py
{ "start": 10851, "end": 11658 }
class ____(graphene.ObjectType): mlflow_search_datasets = graphene.Field(MlflowSearchDatasetsResponse, input=MlflowSearchDatasetsInput()) mlflow_search_runs = graphene.Field(MlflowSearchRunsResponse, input=MlflowSearchRunsInput()) def resolve_mlflow_search_datasets(self, info, input): input_dict = ...
MutationType
python
dagster-io__dagster
python_modules/dagster/dagster/_core/instance/instance.py
{ "start": 3313, "end": 39035 }
class ____( SettingsMethods, StorageMethods, DaemonMethods, RunLauncherMethods, EventMethods, SchedulingMethods, AssetMethods, RunMethods, DynamicPartitionsStore, ): """Core abstraction for managing Dagster's access to storage and other resources. Use DagsterInstance.get() t...
DagsterInstance
python
allegroai__clearml
clearml/backend_api/services/v2_23/queues.py
{ "start": 26540, "end": 27401 }
class ____(Response): """ Response of queues.create endpoint. :param id: New queue ID :type id: str """ _service = "queues" _action = "create" _version = "2.23" _schema = { "definitions": {}, "properties": {"id": {"description": "New queue ID", "type": ["string", "n...
CreateResponse
python
coleifer__peewee
peewee.py
{ "start": 163690, "end": 163747 }
class ____(_StringField): field_type = 'TEXT'
TextField
python
pydantic__pydantic
pydantic/v1/errors.py
{ "start": 9818, "end": 10080 }
class ____(PydanticValueError): code = 'any_str.max_length' msg_template = 'ensure this value has at most {limit_value} characters' def __init__(self, *, limit_value: int) -> None: super().__init__(limit_value=limit_value)
AnyStrMaxLengthError
python
streamlit__streamlit
lib/streamlit/source_util.py
{ "start": 979, "end": 3168 }
class ____(TypedDict): script_path: ScriptPath page_script_hash: PageHash icon: NotRequired[Icon] page_name: NotRequired[PageName] url_pathname: NotRequired[str] def open_python_file(filename: str) -> TextIO: """Open a read-only Python file taking proper care of its encoding. In Python 3,...
PageInfo
python
apache__airflow
providers/openlineage/src/airflow/providers/openlineage/utils/sql.py
{ "start": 1373, "end": 1764 }
class ____(IntEnum): """Enumerates the indices of columns in information schema view.""" SCHEMA = 0 TABLE_NAME = 1 COLUMN_NAME = 2 ORDINAL_POSITION = 3 # Use 'udt_name' which is the underlying type of column UDT_NAME = 4 # Database is optional as 6th column DATABASE = 5 TablesHier...
ColumnIndex
python
apache__airflow
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
{ "start": 8342, "end": 14720 }
class ____(TestPoolsEndpoint): @pytest.mark.parametrize( ("pool_name", "query_params", "body", "expected_status_code", "expected_response"), [ # Error ( Pool.DEFAULT_POOL_NAME, {}, {}, 400, {"deta...
TestPatchPool
python
huggingface__transformers
src/transformers/models/xlm_roberta/tokenization_xlm_roberta.py
{ "start": 1128, "end": 4915 }
class ____(TokenizersBackend): r""" Construct an XLM-RoBERTa tokenizer (backed by HuggingFace's tokenizers library). Based on SentencePiece. This tokenizer inherits from [`TokenizersBackend`] which contains most of the main methods. Users should refer to this superclass for more information regarding t...
XLMRobertaTokenizer
python
apache__airflow
providers/databricks/src/airflow/providers/databricks/operators/databricks_repos.py
{ "start": 1289, "end": 6775 }
class ____(BaseOperator): """ Creates, and optionally checks out, a Databricks Repo using the POST api/2.0/repos API endpoint. See: https://docs.databricks.com/dev-tools/api/latest/repos.html#operation/create-repo :param git_url: Required HTTPS URL of a Git repository :param git_provider: Optiona...
DatabricksReposCreateOperator
python
django-haystack__django-haystack
haystack/fields.py
{ "start": 10671, "end": 11577 }
class ____(SearchField): field_type = "date" def __init__(self, **kwargs): if kwargs.get("facet_class") is None: kwargs["facet_class"] = FacetDateField super().__init__(**kwargs) def prepare(self, obj): return self.convert(super().prepare(obj)) def convert(self, v...
DateField
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/data_loss_prevention.py
{ "start": 2719, "end": 3015 }
class ____(BaseGoogleLink): """Helper class for constructing Cloud Data Loss Prevention link.""" name = "Cloud DLP Deidentify Template Details" key = "cloud_dlp_deidentify_template_details_key" format_str = DLP_DEIDENTIFY_TEMPLATE_DETAILS_LINK
CloudDLPDeidentifyTemplateDetailsLink
python
pypa__setuptools
setuptools/_vendor/inflect/__init__.py
{ "start": 39998, "end": 40941 }
class ____(str): lowered: str split_: List[str] first: str last: str def __init__(self, orig) -> None: self.lowered = self.lower() self.split_ = self.split() self.first = self.split_[0] self.last = self.split_[-1] Falsish = Any # ideally, falsish would only valida...
Words
python
allegroai__clearml
clearml/backend_api/services/v2_20/events.py
{ "start": 21170, "end": 23303 }
class ____(NonStrictDataModel): """ :param task: Task ID :type task: str :param metric: Metric name :type metric: str :param variants: Metric variant names :type variants: Sequence[str] """ _schema = { "properties": { "metric": {"description": "Metric name", "typ...
TaskMetricVariants
python
huggingface__transformers
examples/pytorch/multiple-choice/run_swag.py
{ "start": 3642, "end": 16947 }
class ____: """ Arguments pertaining to what data we are going to input our model for training and eval. """ train_file: Optional[str] = field(default=None, metadata={"help": "The input training data file (a text file)."}) validation_file: Optional[str] = field( default=None, metada...
DataTrainingArguments
python
tensorflow__tensorflow
tensorflow/python/data/experimental/ops/readers.py
{ "start": 34548, "end": 48481 }
class ____(dataset_ops.DatasetV1Adapter): """A Dataset comprising lines from one or more CSV files.""" @functools.wraps(CsvDatasetV2.__init__, ("__module__", "__name__")) def __init__(self, filenames, record_defaults, compression_type=None, buffer_size=...
CsvDatasetV1
python
PrefectHQ__prefect
tests/blocks/test_abstract.py
{ "start": 236, "end": 1059 }
class ____: def test_credentials_block_is_abstract(self): with pytest.raises( TypeError, match="Can't instantiate abstract class CredentialsBlock" ): CredentialsBlock() def test_credentials_block_implementation(self, caplog): class ACredentialsBlock(CredentialsBl...
TestCredentialsBlock
python
getsentry__sentry
src/sentry/workflow_engine/typings/notification_action.py
{ "start": 10920, "end": 11647 }
class ____(BaseActionTranslator): @property def action_type(self) -> ActionType: return ActionType.MSTEAMS @property def required_fields(self) -> list[str]: return [ ACTION_FIELD_MAPPINGS[ActionType.MSTEAMS][ ActionFieldMappingKeys.INTEGRATION_ID_KEY.value ...
MSTeamsActionTranslator
python
walkccc__LeetCode
solutions/3327. Check if DFS Strings Are Palindromes/3327.py
{ "start": 0, "end": 2376 }
class ____: def findAnswer(self, parent: list[int], s: str) -> list[bool]: n = len(parent) tree = [[] for _ in parent] start = [0] * n # start[i] := the start index of `dfsStr` of node i end = [0] * n # end[i] := the end index of `dfsStr` of node i dfsStr = [] for i in range(1, n): tr...
Solution
python
scipy__scipy
scipy/linalg/tests/test_lapack.py
{ "start": 2502, "end": 5847 }
class ____: def test_gebal(self): a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] a1 = [[1, 0, 0, 3e-4], [4, 0, 0, 2e-3], [7, 1, 0, 0], [0, 1, 0, 0]] for p in 'sdzc': f = getattr(flapack, p+'gebal', None) if f is None: ...
TestFlapackSimple
python
tensorflow__tensorflow
tensorflow/examples/custom_ops_doc/simple_hash_table/simple_hash_table_test.py
{ "start": 1114, "end": 4851 }
class ____(tf.test.TestCase, parameterized.TestCase): # Helper function using "create, find, insert, find, remove, find def _use_table(self, key_dtype, value_dtype): hash_table = simple_hash_table.SimpleHashTable(key_dtype, value_dtype, 111) result1 = hash_table.find(1, -999) hash_table.insert(1, 100) ...
SimpleHashTableTest
python
davidhalter__jedi
jedi/inference/arguments.py
{ "start": 1059, "end": 4449 }
class ____(Exception): pass def repack_with_argument_clinic(clinic_string): """ Transforms a function or method with arguments to the signature that is given as an argument clinic notation. Argument clinic is part of CPython and used for all the functions that are implemented in C (Python 3.7...
ParamIssue
python
miyuchina__mistletoe
test/test_html_renderer.py
{ "start": 5359, "end": 6228 }
class ____(TestCase): @parameterized.expand([ (False, False, '" and \''), (False, True, '" and &#x27;'), (True, False, '&quot; and \''), (True, True, '&quot; and &#x27;'), ]) def test_escape_html_text(self, escape_double, escape_single, expected): with HtmlRenderer(ht...
TestHtmlRendererEscaping
python
PyCQA__pylint
tests/functional/t/too/too_many_ancestors_ignored_parents.py
{ "start": 651, "end": 709 }
class ____(B, C): # [too-many-ancestors] """5 parents"""
A
python
fluentpython__example-code-2e
05-data-classes/meaning/demo_dc.py
{ "start": 46, "end": 148 }
class ____: a: int # <1> b: float = 1.1 # <2> c = 'spam' # <3>
DemoDataClass
python
getsentry__sentry
tests/sentry/integrations/discord/test_utils.py
{ "start": 580, "end": 1404 }
class ____(TestCase): def test_verify_signature_valid(self) -> None: public_key_string = "3AC1A3E56E967E1C61E3D17B37FA1865CB20CD6C54418631F4E8AE4D1E83EE0E" signature = "DBC99471F8DD30BA0F488912CF9BA7AC1E938047782BB72FF9A6873D452A1A75DC9F8A07182B8EB7FC67A3771C2271D568DCDC2AB2A5D927A42A4F0FC233C506" ...
AuthTest
python
paramiko__paramiko
tests/_stub_sftp.py
{ "start": 1116, "end": 1347 }
class ____(ServerInterface): def check_auth_password(self, username, password): # all are allowed return AUTH_SUCCESSFUL def check_channel_request(self, kind, chanid): return OPEN_SUCCEEDED
StubServer
python
great-expectations__great_expectations
great_expectations/exceptions/exceptions.py
{ "start": 4396, "end": 4541 }
class ____(GreatExpectationsError): def __init__(self) -> None: super().__init__("No available batches found.")
NoAvailableBatchesError
python
huggingface__transformers
src/transformers/models/distilbert/modeling_distilbert.py
{ "start": 8978, "end": 10216 }
class ____(GradientCheckpointingLayer): def __init__(self, config: PreTrainedConfig): super().__init__() # Have an even number of Configure multi-heads if config.dim % config.n_heads != 0: raise ValueError(f"config.n_heads {config.n_heads} must divide config.dim {config.dim} eve...
TransformerBlock
python
doocs__leetcode
solution/2000-2099/2025.Maximum Number of Ways to Partition an Array/Solution.py
{ "start": 0, "end": 662 }
class ____: def waysToPartition(self, nums: List[int], k: int) -> int: n = len(nums) s = [nums[0]] * n right = defaultdict(int) for i in range(1, n): s[i] = s[i - 1] + nums[i] right[s[i - 1]] += 1 ans = 0 if s[-1] % 2 == 0: ans = r...
Solution
python
getsentry__sentry
src/sentry/replays/usecases/ingest/event_parser.py
{ "start": 970, "end": 1068 }
class ____: click_event: ClickEvent click_count: int @dataclass(frozen=True)
MultiClickEvent
python
pytorch__pytorch
test/distributed/fsdp/test_fsdp_sharded_grad_scaler.py
{ "start": 6056, "end": 13989 }
class ____(FSDPTest): def _get_init_modes_for_test(self, cpu_offload): modes = [DEVICEInitMode.DEVICE_AFTER, DEVICEInitMode.DEVICE_BEFORE] # Note that DEVICEInitMode.DEVICE_NEVER works currently only with CPU # offload as we explicitly bring the param back to CUDA device. In # genera...
TestShardedGradScalerParityWithDDP
python
gevent__gevent
src/gevent/libev/watcher.py
{ "start": 6393, "end": 6443 }
class ____(_base.CheckMixin, watcher): pass
check
python
facebookresearch__faiss
tests/test_factory.py
{ "start": 12503, "end": 12981 }
class ____(unittest.TestCase): def test_constructor(self): index = faiss.IndexIVFSpectralHash(faiss.IndexFlat(10), 10, 20, 10, 1) gc.collect() index.quantizer.ntotal # this should not crash def test_replace_vt(self): index = faiss.IndexIVFSpectralHash(faiss.IndexFlat(10), 10,...
TestIVFSpectralHashOwnership
python
pytorch__pytorch
benchmarks/tensorexpr/reduction.py
{ "start": 5104, "end": 5571 }
class ____(Reduce2DBench): def __init__(self, mode, device, dtype, dim0, dim1): super().__init__(mode, device, dtype, 1, dim0, dim1) @staticmethod def default_configs(): parent_config = Reduce2DBench.default_configs()[0] return [parent_config[1:]] def config(self): pare...
Reduce2DInnerBench
python
django__django
tests/serializers/test_jsonl.py
{ "start": 362, "end": 9105 }
class ____(SerializersTestBase, TestCase): serializer_name = "jsonl" pkless_str = [ '{"pk": null,"model": "serializers.category","fields": {"name": "Reference"}}', '{"model": "serializers.category","fields": {"name": "Non-fiction"}}', ] pkless_str = "\n".join([s.replace("\n", "") for s i...
JsonlSerializerTestCase
python
apache__airflow
task-sdk/src/airflow/sdk/definitions/asset/__init__.py
{ "start": 7141, "end": 8491 }
class ____: """ Protocol for all asset triggers to use in ``DAG(schedule=...)``. :meta private: """ def __bool__(self) -> bool: return True def __or__(self, other: BaseAsset) -> BaseAsset: if not isinstance(other, BaseAsset): return NotImplemented return As...
BaseAsset
python
pandas-dev__pandas
pandas/tests/plotting/frame/test_hist_box_by.py
{ "start": 548, "end": 6611 }
class ____: @pytest.mark.slow @pytest.mark.parametrize( "by, column, titles, legends", [ ("C", "A", ["a", "b", "c"], [["A"]] * 3), ("C", ["A", "B"], ["a", "b", "c"], [["A", "B"]] * 3), ("C", None, ["a", "b", "c"], [["A", "B"]] * 3), ( ...
TestHistWithBy
python
spyder-ide__spyder
spyder/api/widgets/main_container.py
{ "start": 516, "end": 5438 }
class ____(QWidget, SpyderWidgetMixin): """ Spyder plugin main container class. This class handles a non-dockable widget to be able to contain, parent and store references to other widgets, like status bar widgets, toolbars, context menus, etc. Notes ----- All Spyder non dockable plugi...
PluginMainContainer
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/beta_tool_text_editor_20250429_param.py
{ "start": 361, "end": 1086 }
class ____(TypedDict, total=False): name: Required[Literal["str_replace_based_edit_tool"]] """Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks. """ type: Required[Literal["text_editor_20250429"]] allowed_callers: List[Literal["direct", "code_executio...
BetaToolTextEditor20250429Param
python
apache__airflow
providers/apache/kafka/src/airflow/providers/apache/kafka/hooks/client.py
{ "start": 1039, "end": 2686 }
class ____(KafkaBaseHook): """ A hook for interacting with the Kafka Cluster. :param kafka_config_id: The connection object to use, defaults to "kafka_default" """ def __init__(self, kafka_config_id=KafkaBaseHook.default_conn_name) -> None: super().__init__(kafka_config_id=kafka_config_id)...
KafkaAdminClientHook
python
sphinx-doc__sphinx
sphinx/errors.py
{ "start": 87, "end": 860 }
class ____(Exception): """Base class for Sphinx errors. This is the base class for "nice" exceptions. When such an exception is raised, Sphinx will abort the build and present the exception category and message to the user. Extensions are encouraged to derive from this exception for their custom ...
SphinxError
python
huggingface__transformers
src/transformers/models/data2vec/modeling_data2vec_text.py
{ "start": 20811, "end": 21376 }
class ____(PreTrainedModel): config_class = Data2VecTextConfig base_model_prefix = "data2vec_text" supports_gradient_checkpointing = True _no_split_modules = ["Data2VecTextForTextEmbeddings", "Data2VecTextLayer"] _supports_flash_attn = True _supports_sdpa = True _supports_flex_attn = True ...
Data2VecTextPreTrainedModel
python
run-llama__llama_index
llama-index-packs/llama-index-packs-code-hierarchy/tests/test_code_hierarchy_with_skeleton.py
{ "start": 12739, "end": 13565 }
class ____ {{ {double_forward_slash} {CodeHierarchyNodeParser._get_comment_text(chunks[2])} }} function baz() {{ {double_forward_slash} {CodeHierarchyNodeParser._get_comment_text(chunks[4])} }}""" ) # Test the second chunk (function foo) assert ( chunks[1].text == """\ function foo...
Example
python
scrapy__scrapy
tests/test_spidermiddleware_referer.py
{ "start": 24133, "end": 24310 }
class ____( MixinNoReferrerWhenDowngrade, TestRefererMiddleware ): req_meta = {"referrer_policy": POLICY_NO_REFERRER_WHEN_DOWNGRADE}
TestRequestMetaNoReferrerWhenDowngrade
python
huggingface__transformers
src/transformers/models/qwen2_audio/modeling_qwen2_audio.py
{ "start": 4079, "end": 7848 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" # Copied from transformers.models.whisper.modeling_whisper.WhisperAttention.__init__ with Whisper->Qwen2Audio def __init__( self, embed_dim: int, num_heads: int, dropout: float = 0.0, ...
Qwen2AudioAttention
python
huggingface__transformers
src/transformers/models/mobilevitv2/modeling_mobilevitv2.py
{ "start": 26977, "end": 29058 }
class ____(nn.Module): """ ASPP module defined in DeepLab papers: https://huggingface.co/papers/1606.00915, https://huggingface.co/papers/1706.05587 """ def __init__(self, config: MobileViTV2Config) -> None: super().__init__() encoder_out_channels = make_divisible(512 * config.width_mu...
MobileViTV2ASPP
python
kamyu104__LeetCode-Solutions
Python/count-negative-numbers-in-a-sorted-matrix.py
{ "start": 33, "end": 361 }
class ____(object): def countNegatives(self, grid): """ :type grid: List[List[int]] :rtype: int """ result, c = 0, len(grid[0])-1 for row in grid: while c >= 0 and row[c] < 0: c -= 1 result += len(grid[0])-1-c return res...
Solution
python
dagster-io__dagster
python_modules/dagster/dagster/_core/scheduler/instigation.py
{ "start": 8288, "end": 11404 }
class ____( NamedTuple( "_InstigationState", [ ("origin", RemoteInstigatorOrigin), ("instigator_type", InstigatorType), ("status", InstigatorStatus), ("instigator_data", Optional[InstigatorData]), ], ) ): def __new__( cls, ...
InstigatorState
python
apache__airflow
providers/elasticsearch/tests/unit/elasticsearch/hooks/test_elasticsearch.py
{ "start": 4213, "end": 7572 }
class ____: def setup_method(self): sql = MagicMock(spec=SqlClient) sql.query.side_effect = RESPONSES es = MagicMock(sql=sql, spec=Elasticsearch) self.cur = ElasticsearchSQLCursor(es=es, options={}) self.spy_agency = SpyAgency() self.spy_agency.spy_on(self.cur.close, ...
TestElasticsearchSQLHook
python
ray-project__ray
rllib/env/env_runner_group.py
{ "start": 1752, "end": 55212 }
class ____: """Set of EnvRunners with n @ray.remote workers and zero or one local worker. Where: n >= 0. """ def __init__( self, *, env_creator: Optional[EnvCreator] = None, validate_env: Optional[Callable[[EnvType], None]] = None, default_policy_class: Optional...
EnvRunnerGroup
python
gevent__gevent
src/greentest/3.12/test_interpreters.py
{ "start": 1600, "end": 2011 }
class ____(unittest.TestCase): def os_pipe(self): r, w = os.pipe() def cleanup(): try: os.close(w) except Exception: pass try: os.close(r) except Exception: pass self.addCleanup(c...
TestBase
python
tensorflow__tensorflow
tensorflow/python/ops/parsing_config.py
{ "start": 12075, "end": 15150 }
class ____( collections.namedtuple( "SparseFeature", ["index_key", "value_key", "dtype", "size", "already_sorted"])): """Configuration for parsing a sparse input feature from an `Example`. Note, preferably use `VarLenFeature` (possibly in combination with a `SequenceExample`) in order to pars...
SparseFeature
python
plotly__plotly.py
plotly/graph_objs/funnel/legendgrouptitle/_font.py
{ "start": 233, "end": 9921 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "funnel.legendgrouptitle" _path_str = "funnel.legendgrouptitle.font" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", "weight",...
Font
python
getsentry__sentry
src/sentry/models/files/abstractfileblobowner.py
{ "start": 110, "end": 300 }
class ____(Model): __relocation_scope__ = RelocationScope.Excluded organization_id = BoundedBigIntegerField(db_index=True) class Meta: abstract = True
AbstractFileBlobOwner
python
optuna__optuna
tests/storages_tests/rdb_tests/test_models.py
{ "start": 4839, "end": 7476 }
class ____: @staticmethod def test_default_datetime(session: Session) -> None: # Regardless of the initial state the trial created here should have null datetime_start session.add(TrialModel(state=TrialState.WAITING)) session.commit() trial_model = session.query(TrialModel).firs...
TestTrialModel
python
pytorch__pytorch
torch/distributed/checkpoint/filesystem.py
{ "start": 16521, "end": 18520 }
class ____(FileSystemBase): @contextmanager def create_stream( self, path: Union[str, os.PathLike], mode: str ) -> Generator[io.IOBase, None, None]: if not isinstance(path, Path): path = Path(path) with path.open(mode) as stream: yield cast(io.IOBase, stream) ...
FileSystem
python
pypa__warehouse
tests/unit/manage/test_forms.py
{ "start": 453, "end": 2308 }
class ____: def test_validate(self): user_service = pretend.stub(find_userid=pretend.call_recorder(lambda userid: 1)) form = forms.CreateRoleForm( formdata=MultiDict({"role_name": "Owner", "username": "valid_username"}), user_service=user_service, ) assert fo...
TestCreateRoleForm
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_datacatalog.py
{ "start": 9679, "end": 11487 }
class ____: @mock.patch( "airflow.providers.google.cloud.operators.datacatalog.CloudDataCatalogHook", **{"return_value.create_entry_group.return_value": TEST_ENTRY_GROUP}, ) def test_assert_valid_hook_call(self, mock_hook) -> None: with pytest.warns(AirflowProviderDeprecationWarning)...
TestCloudDataCatalogCreateEntryGroupOperator