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
pytorch__pytorch
test/dynamo/cpython/3_13/typinganndata/ann_module.py
{ "start": 816, "end": 1120 }
class ____(metaclass = Meta): x: str = 'something' y: str = 'something else' def foo(x: int = 10): def bar(y: List[str]): x: str = 'yes' bar() def dec(func): @wraps(func) def wrapper(*args, **kwargs): return func(*args, **kwargs) return wrapper u: int | float
S
python
great-expectations__great_expectations
scripts/cleanup/cleanup_redshift.py
{ "start": 299, "end": 2172 }
class ____(BaseSettings): """Environment variables for Redshift connection. These are injected in via CI, but when running locally, you may use your own credentials. """ REDSHIFT_HOST: str REDSHIFT_PORT: int REDSHIFT_USERNAME: str REDSHIFT_PASSWORD: str REDSHIFT_DATABASE: str REDSHI...
RedshiftConnectionConfig
python
dagster-io__dagster
python_modules/libraries/dagster-dbt/dagster_dbt/cloud_v2/client.py
{ "start": 958, "end": 16674 }
class ____(DagsterModel): account_id: int = Field( ..., description="The dbt Cloud Account ID. Can be found on the Account Info page of dbt Cloud.", ) token: str = Field( ..., description="The token to access the dbt Cloud API. Can be either a personal token or a service toke...
DbtCloudWorkspaceClient
python
spack__spack
lib/spack/spack/test/llnl/util/file_list.py
{ "start": 4759, "end": 10787 }
class ____: def test_repr(self, header_list): x = eval(repr(header_list)) assert header_list == x def test_joined_and_str(self, header_list): s1 = header_list.joined() expected = " ".join( [ "/dir1/Python.h", "/dir2/date.time.h", ...
TestHeaderList
python
walkccc__LeetCode
solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.py
{ "start": 0, "end": 370 }
class ____: def kIncreasing(self, arr: list[int], k: int) -> int: def numReplaced(arr: list[int]) -> int: tails = [] for a in arr: if not tails or tails[-1] <= a: tails.append(a) else: tails[bisect_right(tails, a)] = a return len(arr) - len(tails) return ...
Solution
python
django__django
tests/select_related_regress/models.py
{ "start": 240, "end": 461 }
class ____(models.Model): device = models.ForeignKey("Device", models.CASCADE) port_number = models.CharField(max_length=10) def __str__(self): return "%s/%s" % (self.device.name, self.port_number)
Port
python
kubernetes-client__python
kubernetes/client/models/v1_volume_resource_requirements.py
{ "start": 383, "end": 5285 }
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...
V1VolumeResourceRequirements
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/cloud_build.py
{ "start": 26286, "end": 29962 }
class ____(GoogleCloudBaseOperator): """ Lists existing BuildTriggers. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudBuildListBuildTriggersOperator` :param location: The location of the project. :param project_id:...
CloudBuildListBuildTriggersOperator
python
doocs__leetcode
solution/3200-3299/3234.Count the Number of Substrings With Dominant Ones/Solution.py
{ "start": 0, "end": 615 }
class ____: def numberOfSubstrings(self, s: str) -> int: n = len(s) nxt = [n] * (n + 1) for i in range(n - 1, -1, -1): nxt[i] = nxt[i + 1] if s[i] == "0": nxt[i] = i ans = 0 for i in range(n): cnt0 = int(s[i] == "0") ...
Solution
python
ray-project__ray
python/ray/data/tests/test_state_export.py
{ "start": 2217, "end": 18415 }
class ____(LogicalOperator): """A dummy logical operator for testing _get_logical_args with various data types.""" def __init__(self, input_op=None): super().__init__("DummyOperator", []) # Test various data types that might be returned by _get_logical_args self._string_value = "test_s...
DummyLogicalOperator
python
openai__gym
gym/envs/toy_text/cliffwalking.py
{ "start": 298, "end": 10940 }
class ____(Env): """ This is a simple implementation of the Gridworld Cliff reinforcement learning task. Adapted from Example 6.6 (page 106) from [Reinforcement Learning: An Introduction by Sutton and Barto](http://incompleteideas.net/book/bookdraft2018jan1.pdf). With inspiration from: [ht...
CliffWalkingEnv
python
jazzband__django-model-utils
tests/test_fields/test_field_tracker.py
{ "start": 36286, "end": 38286 }
class ____(TestCase): def setUp(self) -> None: self.instance = Tracked.objects.create(number=1) self.tracker = self.instance.tracker def assertChanged(self, *fields: str) -> None: for f in fields: self.assertTrue(self.tracker.has_changed(f)) def assertNotChanged(self, ...
TrackerContextDecoratorTests
python
catalyst-team__catalyst
catalyst/callbacks/optimizer.py
{ "start": 348, "end": 3655 }
class ____(IOptimizerCallback): """Optimizer callback, abstraction over optimizer step. Args: metric_key: a key to get loss from ``runner.batch_metrics`` model_key: a key to select a model from ``runner.model`` in case there are several of them and they are in a dictionary format. ...
OptimizerCallback
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/util/queue.py
{ "start": 1192, "end": 1287 }
class ____(Exception): "Exception raised by Queue.get(block=0)/get_nowait()." pass
Empty
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/hooks/test_base_aws.py
{ "start": 6160, "end": 15534 }
class ____: @conf_vars({("aws", "session_factory"): "unit.amazon.aws.hooks.test_base_aws.CustomSessionFactory"}) def test_resolve_session_factory_class(self): cls = resolve_session_factory() assert issubclass(cls, CustomSessionFactory) @conf_vars({("aws", "session_factory"): ""}) def te...
TestSessionFactory
python
psf__black
src/black/brackets.py
{ "start": 1216, "end": 12410 }
class ____: """Keeps track of brackets on a line.""" depth: int = 0 bracket_match: dict[tuple[Depth, NodeType], Leaf] = field(default_factory=dict) delimiters: dict[LeafID, Priority] = field(default_factory=dict) previous: Leaf | None = None _for_loop_depths: list[int] = field(default_factory=l...
BracketTracker
python
getsentry__sentry
tests/sentry/issues/test_status_change_consumer.py
{ "start": 1823, "end": 9262 }
class ____(IssueOccurrenceTestBase): @django_db_all def setUp(self) -> None: super().setUp() message = get_test_message(self.project.id) with self.feature("organizations:profile-file-io-main-thread-ingest"): result = _process_message(message) assert result is not None...
StatusChangeProcessMessageTest
python
Netflix__metaflow
metaflow/_vendor/v3_7/typeguard/_transformer.py
{ "start": 15935, "end": 43918 }
class ____(NodeTransformer): def __init__( self, target_path: Sequence[str] | None = None, target_lineno: int | None = None ) -> None: self._target_path = tuple(target_path) if target_path else None self._memo = self._module_memo = TransformMemo(None, None, ()) self.names_used_in...
TypeguardTransformer
python
openai__openai-python
src/openai/types/responses/response_computer_tool_call_output_screenshot.py
{ "start": 245, "end": 662 }
class ____(BaseModel): type: Literal["computer_screenshot"] """Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`. """ file_id: Optional[str] = None """The identifier of an uploaded file that contains the screenshot.""" image_url: Opt...
ResponseComputerToolCallOutputScreenshot
python
allegroai__clearml
clearml/backend_api/services/v2_13/queues.py
{ "start": 70118, "end": 71419 }
class ____(Response): """ Response of queues.move_task_to_back endpoint. :param position: The new position of the task entry in the queue (index, -1 represents bottom of queue) :type position: int """ _service = "queues" _action = "move_task_to_back" _version = "2.13" _sche...
MoveTaskToBackResponse
python
pydantic__pydantic
pydantic/warnings.py
{ "start": 2269, "end": 2587 }
class ____(PydanticDeprecationWarning): """A specific `PydanticDeprecationWarning` subclass defining functionality deprecated since Pydantic 2.6.""" def __init__(self, message: str, *args: object) -> None: super().__init__(message, *args, since=(2, 6), expected_removal=(3, 0))
PydanticDeprecatedSince26
python
scrapy__scrapy
tests/test_robotstxt_interface.py
{ "start": 6374, "end": 6623 }
class ____(BaseRobotParserTest): def setup_method(self): super()._setUp(ProtegoRobotParser) def test_order_based_precedence(self): pytest.skip("Protego does not support order based directives precedence.")
TestProtegoRobotParser
python
chroma-core__chroma
chromadb/telemetry/product/events.py
{ "start": 343, "end": 606 }
class ____(ProductTelemetryEvent): is_cli: bool def __init__(self) -> None: super().__init__() self.is_cli = os.environ.get("CHROMA_CLI", "False") == "True" # TODO: Re-enable embedding function tracking in create_collection
ServerStartEvent
python
matplotlib__matplotlib
galleries/examples/units/evans_test.py
{ "start": 651, "end": 2221 }
class ____(units.ConversionInterface): @staticmethod def axisinfo(unit, axis): """Return the Foo AxisInfo.""" if unit == 1.0 or unit == 2.0: return units.AxisInfo( majloc=ticker.IndexLocator(8, 0), majfmt=ticker.FormatStrFormatter("VAL: %s"), ...
FooConverter
python
pypa__pipenv
pipenv/vendor/click/testing.py
{ "start": 1489, "end": 2379 }
class ____(io.TextIOWrapper): def __init__( self, buffer: t.BinaryIO, name: str, mode: str, **kwargs: t.Any ) -> None: super().__init__(buffer, **kwargs) self._name = name self._mode = mode @property def name(self) -> str: return self._name @property def...
_NamedTextIOWrapper
python
facelessuser__pymdown-extensions
tests/test_extensions/test_blocks/test_general_blocks.py
{ "start": 160, "end": 5047 }
class ____(unittest.TestCase): """Validate various type functions.""" def test_type_any(self): """Test `type_any`.""" self.assertEqual(3, block.type_any(3)) self.assertEqual({}, block.type_any({})) self.assertEqual('string', block.type_any('string')) def test_type_number(s...
TestTypeFunctions
python
ansible__ansible
lib/ansible/cli/arguments/option_helpers.py
{ "start": 5635, "end": 5870 }
class ____(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): ansible_version = to_native(version(getattr(parser, 'prog'))) print(ansible_version) parser.exit()
AnsibleVersion
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/build_systems/autotools.py
{ "start": 1444, "end": 3952 }
class ____(BuilderWithDefaults): #: Phases of a GNU Autotools package phases = ("autoreconf", "configure", "build", "install") #: Names associated with package methods in the old build-system format package_methods = ("configure_args", "check", "installcheck") #: Names associated with package attr...
AutotoolsBuilder
python
huggingface__transformers
src/transformers/models/qwen3_moe/modeling_qwen3_moe.py
{ "start": 20699, "end": 27492 }
class ____(Qwen3MoePreTrainedModel): def __init__(self, config: Qwen3MoeConfig): super().__init__(config) self.padding_idx = config.pad_token_id self.vocab_size = config.vocab_size self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx) self...
Qwen3MoeModel
python
doocs__leetcode
lcof/面试题35. 复杂链表的复制/Solution2.py
{ "start": 203, "end": 794 }
class ____: def copyRandomList(self, head: "Node") -> "Node": if head is None: return None cur = head while cur: node = Node(cur.val, cur.next) cur.next = node cur = node.next cur = head while cur: if cur.random: ...
Solution
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/selectable.py
{ "start": 158795, "end": 174991 }
class ____(util.MemoizedSlots, CompileState): __slots__ = ( "from_clauses", "froms", "columns_plus_names", "_label_resolve_dict", ) if TYPE_CHECKING: default_select_compile_options: CacheableOptions else: class default_select_compile_options(CacheableOpt...
SelectState
python
pallets__jinja
tests/test_imports.py
{ "start": 4523, "end": 7571 }
class ____: def test_context_include(self, test_env): t = test_env.from_string('{% include "header" %}') assert t.render(foo=42) == "[42|23]" t = test_env.from_string('{% include "header" with context %}') assert t.render(foo=42) == "[42|23]" t = test_env.from_string('{% incl...
TestIncludes
python
streamlit__streamlit
lib/tests/streamlit/elements/multiselect_test.py
{ "start": 21990, "end": 25722 }
class ____: def test_serialize(self): options = ["Option A", "Option B", "Option C"] formatted_options, formatted_option_to_option_index = create_mappings(options) serde = MultiSelectSerde( options, formatted_options=formatted_options, formatted_option_to_...
TestMultiSelectSerde
python
wandb__wandb
wandb/sdk/artifacts/_generated/unlink_artifact.py
{ "start": 258, "end": 348 }
class ____(GQLResult): success: bool UnlinkArtifact.model_rebuild()
UnlinkArtifactResult
python
keon__algorithms
tests/test_array.py
{ "start": 8375, "end": 9495 }
class ____(unittest.TestCase): def test_plus_one_v1(self): self.assertListEqual(plus_one_v1([0]), [1]) self.assertListEqual(plus_one_v1([9]), [1, 0]) self.assertListEqual(plus_one_v1([1, 0, 9]), [1, 1, 0]) self.assertListEqual(plus_one_v1([9, 9, 8, 0, 0, 9]), [9, 9, 8, 0, 1, 0]) ...
TestPlusOne
python
aimacode__aima-python
gui/xy_vacuum_environment.py
{ "start": 125, "end": 6136 }
class ____(VacuumEnvironment): """This is a two-dimensional GUI environment. Each location may be dirty, clean or can have a wall. The user can change these at each step. """ xi, yi = (0, 0) perceptible_distance = 1 def __init__(self, root, width=7, height=7, elements=None): super().__i...
Gui
python
PyCQA__pylint
tests/functional/ext/docparams/return/missing_return_doc_required_Google.py
{ "start": 1339, "end": 1771 }
class ____: """test_ignores_non_property_return_type_google Example of a class function trying to use `type` as return documentation in a Google style docstring """ def foo_method(self): # [missing-return-doc, missing-return-type-doc] """int: docstring ... Raises: Runt...
Foo
python
kamyu104__LeetCode-Solutions
Python/determine-the-winner-of-a-bowling-game.py
{ "start": 37, "end": 594 }
class ____(object): def isWinner(self, player1, player2): """ :type player1: List[int] :type player2: List[int] :rtype: int """ k = 2 def f(arr): result = cnt = 0 for i in xrange(len(arr)): result += 2*arr[i] if cnt else...
Solution
python
MongoEngine__mongoengine
tests/document/test_dynamic.py
{ "start": 136, "end": 13339 }
class ____(MongoDBTestCase): def setUp(self): super().setUp() class Person(DynamicDocument): name = StringField() meta = {"allow_inheritance": True} Person.drop_collection() self.Person = Person def test_simple_dynamic_document(self): """Ensure...
TestDynamicDocument
python
doocs__leetcode
solution/2500-2599/2507.Smallest Value After Replacing With Sum of Prime Factors/Solution.py
{ "start": 0, "end": 361 }
class ____: def smallestValue(self, n: int) -> int: while 1: t, s, i = n, 0, 2 while i <= n // i: while n % i == 0: n //= i s += i i += 1 if n > 1: s += n if s == t: ...
Solution
python
falconry__falcon
tests/test_middleware.py
{ "start": 3967, "end": 4149 }
class ____: def process_resource(self, req, resp, resource, params): global context params['added'] = True context['params'] = params
AccessParamsMiddleware
python
pola-rs__polars
py-polars/src/polars/datatypes/classes.py
{ "start": 11394, "end": 12703 }
class ____(NumericType): """ Decimal 128-bit type with an optional precision and non-negative scale. Parameters ---------- precision Maximum number of digits in each number. If set to `None` (default), the precision is set to 38 (the maximum supported by Polars). scale ...
Decimal
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVarTuple2.py
{ "start": 1166, "end": 1333 }
class ____(Generic[Unpack[_Xs]]): ... # This should generate two errors because _Xs must be unpacked. def func0(value: Array[_Xs]) -> tuple[complex, _Xs, str]: ...
Array
python
dagster-io__dagster
python_modules/dagster/dagster/_core/storage/io_manager.py
{ "start": 1506, "end": 4814 }
class ____(ResourceDefinition, IInputManagerDefinition, IOutputManagerDefinition): """Definition of an IO manager resource. IOManagers are used to store op outputs and load them as inputs to downstream ops. An IOManagerDefinition is a :py:class:`ResourceDefinition` whose `resource_fn` returns an :py:c...
IOManagerDefinition
python
readthedocs__readthedocs.org
readthedocs/organizations/migrations/0009_update_meta_options.py
{ "start": 120, "end": 755 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("organizations", "0008_migrate_old_invitations"), ] operations = [ migrations.AlterModelOptions( name="organization", options={ "base_manager_name": "objects", ...
Migration
python
google__jax
tests/multiprocess/all_gather_test.py
{ "start": 793, "end": 1822 }
class ____(jt_multiprocess.MultiProcessTest): @parameterized.parameters( (np.int32,), (jnp.float32,), (jnp.float16,), (jnp.bfloat16,) ) def test_all_gather_shard_map(self, dtype): mesh_shape = (jax.process_count(), jax.local_device_count()) mesh = jtu.create_mesh(mesh_shape, ("x", "y")) spec = ...
AllGatherTest
python
PrefectHQ__prefect
src/integrations/prefect-gcp/prefect_gcp/cloud_storage.py
{ "start": 18893, "end": 21208 }
class ____(Enum): """ An enumeration class to represent different file formats, compression options for upload_from_dataframe Attributes: CSV: Representation for 'csv' file format with no compression and its related content type and suffix. CSV_GZIP: Representation for 'csv...
DataFrameSerializationFormat
python
airbytehq__airbyte
airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorIPCOptions.py
{ "start": 214, "end": 446 }
class ____(BaseModel): class Config: extra = Extra.forbid version: str supportedSerialization: List[Literal["JSONL", "PROTOBUF", "FLATBUFFERS"]] supportedTransport: List[Literal["STDIO", "SOCKET"]]
DataChannel
python
h5py__h5py
h5py/tests/test_group.py
{ "start": 15397, "end": 16239 }
class ____(BaseGroup): def populate(self, g): for i in range(100): # Mix group and dataset creation. if i % 10 == 0: g.create_group(str(i)) else: g[str(i)] = [i] def test_track_order(self): g = self.f.create_group(make_name(), ...
TestTrackOrder
python
huggingface__transformers
src/transformers/models/exaone4/modular_exaone4.py
{ "start": 17875, "end": 20827 }
class ____(LlamaForCausalLM): def forward( self, input_ids: Optional[torch.LongTensor] = None, attention_mask: Optional[torch.Tensor] = None, position_ids: Optional[torch.LongTensor] = None, past_key_values: Optional[Cache] = None, inputs_embeds: Optional[torch.FloatT...
Exaone4ForCausalLM
python
Lightning-AI__lightning
tests/tests_pytorch/models/test_hparams.py
{ "start": 9654, "end": 9890 }
class ____(CustomBoringModel): any_other_loss = torch.nn.CrossEntropyLoss() def __init__(self, *args, subclass_arg=1200, **kwargs): super().__init__(*args, **kwargs) self.save_hyperparameters()
SubClassBoringModel
python
Netflix__metaflow
test/core/metaflow_test/__init__.py
{ "start": 4087, "end": 5804 }
class ____(object): def __init__(self, flow): pass def get_run(self): return None @property def run_id(self): return sys.argv[2] @property def cli_options(self): return sys.argv[3:] def assert_artifact(self, step, name, value, fields=None): raise N...
MetaflowCheck
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/constrainedTypeVar9.py
{ "start": 213, "end": 248 }
class ____(Generic[XOrY]): pass
A
python
matplotlib__matplotlib
lib/matplotlib/tests/test_ticker.py
{ "start": 2288, "end": 3471 }
class ____: def test_basic(self): loc = mticker.LinearLocator(numticks=3) test_value = np.array([-0.8, -0.3, 0.2]) assert_almost_equal(loc.tick_values(-0.8, 0.2), test_value) def test_zero_numticks(self): loc = mticker.LinearLocator(numticks=0) loc.tick_values(-0.8, 0.2)...
TestLinearLocator
python
sqlalchemy__sqlalchemy
test/ext/declarative/test_reflection.py
{ "start": 2514, "end": 9372 }
class ____(testing.AssertsCompiledSQL, DeferredReflectBase): @classmethod def define_tables(cls, metadata): Table( "users", metadata, Column( "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("name", Strin...
DeferredReflectionTest
python
dask__distributed
distributed/comm/tests/test_comms.py
{ "start": 36287, "end": 39184 }
class ____: def __reduce__(self): return _raise_eoferror, () async def check_deserialize_eoferror(addr): """ EOFError when deserializing should close the comm. """ async def handle_comm(comm): await comm.write({"data": to_serialize(_EOFRaising())}) with pytest.raises(CommC...
_EOFRaising
python
django__django
django/contrib/admin/widgets.py
{ "start": 4542, "end": 7476 }
class ____(forms.TextInput): """ A Widget for displaying ForeignKeys in the "raw_id" interface rather than in a <select> box. """ template_name = "admin/widgets/foreign_key_raw_id.html" def __init__(self, rel, admin_site, attrs=None, using=None): self.rel = rel self.admin_site ...
ForeignKeyRawIdWidget
python
astropy__astropy
astropy/stats/bayesian_blocks.py
{ "start": 13482, "end": 15716 }
class ____(FitnessFunc): r"""Bayesian blocks fitness for regular events. This is for data which has a fundamental "tick" length, so that all measured values are multiples of this tick length. In each tick, there are either zero or one counts. Parameters ---------- dt : float tick ...
RegularEvents
python
realpython__materials
wordcount/tests/fixtures.py
{ "start": 1021, "end": 1463 }
class ____(FakeFile): @cached_property def path(self) -> Path: name = "".join(random.choices(ascii_lowercase, k=10)) return Path(gettempdir()) / name def __post_init__(self): self.path.write_bytes(self.content) def delete(self): if self.path.is_dir(): self.p...
TempFile
python
walkccc__LeetCode
solutions/141. Linked List Cycle/141.py
{ "start": 0, "end": 237 }
class ____: def hasCycle(self, head: ListNode) -> bool: slow = head fast = head while fast and fast.next: slow = slow.next fast = fast.next.next if slow == fast: return True return False
Solution
python
python-openxml__python-docx
tests/opc/unitdata/rels.py
{ "start": 1654, "end": 2777 }
class ____(BaseBuilder): """ Test data builder for CT_Default (Default) XML element that appears in `[Content_Types].xml`. """ def __init__(self): """Establish instance variables with default values""" self._content_type = "application/xml" self._extension = "xml" se...
CT_DefaultBuilder
python
huggingface__transformers
src/transformers/models/dinat/modeling_dinat.py
{ "start": 14469, "end": 17550 }
class ____(nn.Module): def __init__(self, config, dim, num_heads, dilation, drop_path_rate=0.0): super().__init__() self.chunk_size_feed_forward = config.chunk_size_feed_forward self.kernel_size = config.kernel_size self.dilation = dilation self.window_size = self.kernel_size...
DinatLayer
python
huggingface__transformers
src/transformers/models/smolvlm/modular_smolvlm.py
{ "start": 1456, "end": 4561 }
class ____(Idefics3VisionConfig): r""" This is the configuration class to store the configuration of a [`SmolVLMVisionModel`]. It is used to instantiate a SmolVLM vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yi...
SmolVLMVisionConfig
python
joke2k__faker
tests/providers/test_automotive.py
{ "start": 11764, "end": 12074 }
class ____(_SimpleAutomotiveTestMixin): """Test th_TH automotive provider methods""" license_plate_pattern: Pattern = re.compile( r"(\d [ก-ฮ]{2} \d{1,4})|" # car r"([ก-ฮ]{2} \d{1,4})|" # car r"([ก-ฮ]{3} \d{1,3})|" # motorcycle r"(\d{2}-\d{4})", # truck )
TestThTh
python
django__django
tests/defer/models.py
{ "start": 1316, "end": 1575 }
class ____(models.Model): """ ShadowParent declares a scalar, rather than a field. When this is overridden, the field value, rather than the scalar value must still be used when the field is deferred. """ name = "aphrodite"
ShadowParent
python
openai__openai-python
src/openai/resources/evals/runs/output_items.py
{ "start": 12176, "end": 12530 }
class ____: def __init__(self, output_items: AsyncOutputItems) -> None: self._output_items = output_items self.retrieve = async_to_streamed_response_wrapper( output_items.retrieve, ) self.list = async_to_streamed_response_wrapper( output_items.list, )...
AsyncOutputItemsWithStreamingResponse
python
pypa__warehouse
tests/unit/utils/test_attrs.py
{ "start": 139, "end": 855 }
class ____: def test_on_class(self): class Fake: foo = "bar" __repr__ = make_repr("foo") assert repr(Fake()) == "Fake(foo={})".format(repr("bar")) def test_with_function(self): class Fake: foo = "bar" def __repr__(self): ...
TestMakeRepr
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/pool/base.py
{ "start": 4311, "end": 4422 }
class ____(Protocol): def __call__(self, rec: ConnectionPoolEntry) -> DBAPIConnection: ...
_CreatorWRecFnType
python
getsentry__sentry
src/sentry/discover/arithmetic.py
{ "start": 843, "end": 1061 }
class ____(ArithmeticError): """The math itself isn't valid""" OperandType = Union["Operation", float, str] JsonQueryType = list[Union[str, list[Union[str, float, None, "JsonQueryType"]]]]
ArithmeticValidationError
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/key_binding/key_bindings.py
{ "start": 2874, "end": 4516 }
class ____: """ Key binding: (key sequence + handler + filter). (Immutable binding class.) :param record_in_macro: When True, don't record this key binding when a macro is recorded. """ def __init__( self, keys: tuple[Keys | str, ...], handler: KeyHandlerCallabl...
Binding
python
euske__pdfminer
pdfminer/pdftypes.py
{ "start": 1202, "end": 4223 }
class ____(PDFObject): def __init__(self, doc, objid, _): if objid == 0: if STRICT: raise PDFValueError('PDF object id cannot be 0.') self.doc = doc self.objid = objid #self.genno = genno # Never used. return def __repr__(self): retu...
PDFObjRef
python
scikit-learn__scikit-learn
examples/semi_supervised/plot_label_propagation_digits.py
{ "start": 524, "end": 3197 }
class ____ be very good. At the end, the top 10 most uncertain predictions will be shown. """ # Authors: The scikit-learn developers # SPDX-License-Identifier: BSD-3-Clause # %% # Data generation # --------------- # # We use the digits dataset. We only use a subset of randomly selected samples. import numpy as np ...
will
python
huggingface__transformers
src/transformers/models/udop/modeling_udop.py
{ "start": 72233, "end": 81458 }
class ____(UdopPreTrainedModel, GenerationMixin): _tied_weights_keys = { "encoder.embed_tokens.weight": "shared.weight", "decoder.embed_tokens.weight": "shared.weight", "encoder.embed_patches.proj.weight": "patch_embed.proj.weight", "encoder.embed_patches.proj.bias": "patch_embed.pro...
UdopForConditionalGeneration
python
kamyu104__LeetCode-Solutions
Python/find-servers-that-handled-most-number-of-requests.py
{ "start": 1600, "end": 2580 }
class ____(object): def busiestServers(self, k, arrival, load): """ :type k: int :type arrival: List[int] :type load: List[int] :rtype: List[int] """ count = [0]*k min_heap_of_endtimes = [] availables = sortedcontainers.SortedList(xrange(k)) ...
Solution2
python
wntrblm__nox
tests/resources/noxfile_normalization.py
{ "start": 66, "end": 270 }
class ____: pass @nox.session(venv_backend="none") @nox.parametrize( "arg", ["Jane", "Joe's", '"hello world"', datetime.datetime(1980, 1, 1), [42], Foo()], ) def test(session, arg): pass
Foo
python
great-expectations__great_expectations
tests/integration/metrics/column/test_descriptive_stats.py
{ "start": 480, "end": 1148 }
class ____: @parameterize_batch_for_data_sources( data_source_configs=ALL_DATA_SOURCES, data=DATA_FRAME, ) def test_descriptive_stats(self, batch_for_datasource: Batch) -> None: metric = ColumnDescriptiveStats(column=COLUMN_NAME) metric_result = batch_for_datasource.compute_m...
TestColumnDescriptiveStats
python
PyCQA__pylint
tests/functional/g/generic_alias/generic_alias_collections.py
{ "start": 2709, "end": 3519 }
class ____(CustomAbstractCls2): # [abstract-method,abstract-method] # __iter__, __len__ pass # Type annotations var_tuple: tuple[int, int] var_dict: dict[int, str] var_ordereddict: collections.OrderedDict[int, str] var_container: collections.abc.Container[int] var_sequence: collections.abc.Sequence[int] var_ite...
CustomImplementation
python
wandb__wandb
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py
{ "start": 1001, "end": 1352 }
class ____(SkipRepeatsQueue): """Thread-safe event queue based on a special queue that skips adding the same event (:class:`FileSystemEvent`) multiple times consecutively. Thus avoiding dispatching multiple event handling calls when multiple identical events are produced quicker than an observer can...
EventQueue
python
pytorch__pytorch
torch/distributed/elastic/timer/file_based_local_timer.py
{ "start": 1611, "end": 3084 }
class ____(TimerRequest): """ Data object representing a countdown timer acquisition and release that is used between the ``FileTimerClient`` and ``FileTimerServer``. A negative ``expiration_time`` should be interpreted as a "release" request. ``signal`` is the signal to reap the worker process ...
FileTimerRequest
python
pyodide__pyodide
src/py/pyodide/console.py
{ "start": 2223, "end": 3918 }
class ____(_Stream): def __init__( self, read_handler: Callable[[int], str], name: str, encoding: str = "utf-8", errors: str = "strict", ): super().__init__(name, encoding, errors) self._read_handler = read_handler self._buffer = "" def readab...
_ReadStream
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/sensors/glue.py
{ "start": 1563, "end": 6156 }
class ____(AwsBaseSensor[GlueJobHook]): """ Waits for an AWS Glue Job to reach any of the status below. 'FAILED', 'STOPPED', 'SUCCEEDED' .. seealso:: For more information on how to use this sensor, take a look at the guide: :ref:`howto/sensor:GlueJobSensor` :param job_name: The AW...
GlueJobSensor
python
ansible__ansible
test/lib/ansible_test/_util/controller/sanity/pylint/plugins/deprecated_calls.py
{ "start": 801, "end": 1536 }
class ____: """Arguments passed to a deprecation function.""" msg: object = None version: object = None date: object = None collection_name: object = None deprecator: object = None help_text: object = None # only on Display.deprecated, warnings.deprecate and deprecate_value obj: object...
DeprecationCallArgs
python
ApeWorX__ape
src/ape/exceptions.py
{ "start": 10823, "end": 11372 }
class ____(VirtualMachineError): """ Raised when detecting a transaction failed because it ran out of gas. """ def __init__( self, code: Optional[int] = None, txn: Optional[FailedTxn] = None, base_err: Optional[Exception] = None, set_ape_traceback: bool = Fal...
OutOfGasError
python
walkccc__LeetCode
solutions/1614. Maximum Nesting Depth of the Parentheses/1614.py
{ "start": 0, "end": 224 }
class ____: def maxDepth(self, s: str) -> int: ans = 0 opened = 0 for c in s: if c == '(': opened += 1 ans = max(ans, opened) elif c == ')': opened -= 1 return ans
Solution
python
readthedocs__readthedocs.org
readthedocs/api/v3/serializers.py
{ "start": 9586, "end": 9988 }
class ____(BaseLinksSerializer, serializers.Serializer): edit = serializers.SerializerMethodField() def get_edit(self, obj): path = reverse( "project_version_detail", kwargs={ "project_slug": obj.project.slug, "version_slug": obj.slug, ...
VersionDashboardURLsSerializer
python
pytest-dev__pytest
testing/test_assertion.py
{ "start": 1181, "end": 2354 }
class ____: SOME_VERBOSITY_LEVEL = 3 SOME_OTHER_VERBOSITY_LEVEL = 10 def test_verbose_exposes_value(self): config = mock_config(verbose=TestMockConfig.SOME_VERBOSITY_LEVEL) assert config.get_verbosity() == TestMockConfig.SOME_VERBOSITY_LEVEL def test_get_assertion_override_not_set_ver...
TestMockConfig
python
great-expectations__great_expectations
contrib/great_expectations_geospatial_expectations/great_expectations_geospatial_expectations/expectations/expect_column_values_to_be_valid_geometry.py
{ "start": 1644, "end": 4310 }
class ____(ColumnMapExpectation): """Expect values in this column to be valid geometry types (Polygon, LineString, etc.). See https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoSeries.is_valid.html \ for more information. """ # These examples will be shown in the public gallery. #...
ExpectColumnValuesToBeValidGeometry
python
google__jax
jax/experimental/serialize_executable.py
{ "start": 3073, "end": 3538 }
class ____(pickle.Pickler): device_types = (xc.Device,) client_types = (xc.Client,) def persistent_id(self, obj): if isinstance(obj, xc.LoadedExecutable): return ('exec', obj.client.serialize_executable(obj)) if isinstance(obj, xc._xla.Executable): return ('exec', obj.serialize()) if isin...
_JaxPjrtPickler
python
has2k1__plotnine
plotnine/themes/themeable.py
{ "start": 55890, "end": 56235 }
class ____(themeable): """ Justification of guide boxes Parameters ---------- theme_element : Literal["left", "right", "center", "top", "bottom", \ "baseline"], default=None If `None`, the value that will apply depends on [](`~plotnine.theme.themeables.legend_box...
legend_box_just
python
huggingface__transformers
src/transformers/models/qwen3_vl_moe/modular_qwen3_vl_moe.py
{ "start": 9994, "end": 10056 }
class ____(Qwen3VLVisionConfig): pass
Qwen3VLMoeVisionConfig
python
spack__spack
lib/spack/spack/vendor/pyrsistent/_checked_types.py
{ "start": 13982, "end": 14803 }
class ____(type): def __new__(mcs, name, bases, dct): _store_types(dct, bases, '_checked_key_types', '__key_type__') _store_types(dct, bases, '_checked_value_types', '__value_type__') store_invariants(dct, bases, '_checked_invariants', '__invariant__') def default_serializer(self, _...
_CheckedMapTypeMeta
python
bokeh__bokeh
examples/advanced/extensions/parallel_plot/parallel_selection_tool.py
{ "start": 101, "end": 699 }
class ____(BoxSelectTool): """ Selection tool for parallel plot To create a selection box, drag the selection around an axe When hovering a selection the box can be dragged upside-down Double-click on a selection to remove it Escape key remove all selections """ __implementation__ = 'parall...
ParallelSelectionTool
python
pytorch__pytorch
test/distributed/elastic/metrics/api_test.py
{ "start": 744, "end": 893 }
class ____(abc.ABC): @abc.abstractmethod def func(self): raise NotImplementedError def base_func(self): self.func()
Parent
python
huggingface__transformers
src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
{ "start": 30319, "end": 33977 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config if config.position_embeddings_type == "relative": self.embed_positions = SeamlessM4TConformerRelPositionalEmbedding(config) elif config.position_embeddings_type == "rotary": ...
SeamlessM4TConformerEncoder
python
eth-brownie__brownie
brownie/utils/toposort.py
{ "start": 1624, "end": 3659 }
class ____(ValueError): def __init__(self, data): # Sort the data just to make the output consistent, for use in # error messages. That's convenient for doctests. super().__init__( "Circular dependencies exist among these items: {{{}}}".format( ", ".join("{!r}:{...
CircularDependencyError
python
protocolbuffers__protobuf
python/google/protobuf/internal/message_listener.py
{ "start": 1894, "end": 2008 }
class ____(object): """No-op MessageListener implementation.""" def Modified(self): pass
NullMessageListener
python
dask__dask
dask/_task_spec.py
{ "start": 5039, "end": 9856 }
class ____(Container): container: tuple __slots__ = ("container",) def __init__(self, *container): self.container = container def __contains__(self, o: object) -> bool: return any(o in c for c in self.container) SubgraphType = None def _execute_subgraph(inner_dsk, outkey, inkeys, *...
_MultiContainer
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/constructor18.py
{ "start": 393, "end": 493 }
class ____: ... _T1 = TypeVar("_T1", bound=ClassA | str, covariant=True) _T2 = TypeVar("_T2")
ClassA
python
getsentry__sentry
src/sentry/api/serializers/models/organization.py
{ "start": 9658, "end": 9910 }
class ____(TypedDict): # The control silo will not, cannot, should not contain most organization data. # Therefore, we need a specialized, limited via of that data. id: str slug: str name: str
ControlSiloOrganizationSerializerResponse
python
bottlepy__bottle
bottle.py
{ "start": 160800, "end": 160849 }
class ____(TemplateError): pass
StplSyntaxError