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
pypa__pipenv
pipenv/patched/pip/_internal/models/pylock.py
{ "start": 5344, "end": 6286 }
class ____: lock_version: str = "1.0" # (not supported) environments: Optional[List[str]] # (not supported) requires_python: Optional[str] # (not supported) extras: List[str] = [] # (not supported) dependency_groups: List[str] = [] created_by: str = "pip" packages: List[Package] = dataclasse...
Pylock
python
sqlalchemy__sqlalchemy
test/orm/declarative/test_dc_transforms.py
{ "start": 2331, "end": 33464 }
class ____(AssertsCompiledSQL, fixtures.TestBase): @testing.fixture(params=["(MAD, DB)", "(DB, MAD)"]) def dc_decl_base(self, request, metadata): _md = metadata if request.param == "(MAD, DB)": class Base(MappedAsDataclass, DeclarativeBase): _mad_before = True ...
DCTransformsTest
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/ext/asyncio/result.py
{ "start": 25710, "end": 31648 }
class ____(AsyncCommon[_R], util.TypingOnly): """A :class:`_asyncio.AsyncResult` that's typed as returning plain Python tuples instead of rows. Since :class:`_engine.Row` acts like a tuple in every way already, this class is a typing only class, regular :class:`_asyncio.AsyncResult` is still used a...
AsyncTupleResult
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 190597, "end": 191126 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("id", "body", "body_version", "client_mutation_id") id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="id") body = sgqlc.types.Field(sgqlc.types.non_null(String),...
UpdateTeamDiscussionCommentInput
python
huggingface__transformers
src/transformers/models/falcon/modeling_falcon.py
{ "start": 50482, "end": 55933 }
class ____(FalconPreTrainedModel): def __init__(self, config: FalconConfig): super().__init__(config) self.num_labels = config.num_labels self.transformer = FalconModel(config) self.score = nn.Linear(config.hidden_size, config.num_labels, bias=False) # Initialize weights and...
FalconForSequenceClassification
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/svd_op_test.py
{ "start": 1840, "end": 10015 }
class ____(test.TestCase): @test_util.run_in_graph_and_eager_modes(use_gpu=True) def testWrongDimensions(self): # The input to svd should be a tensor of at least rank 2. scalar = constant_op.constant(1.) with self.assertRaisesRegex((ValueError, errors_impl.InvalidArgumentError), ...
SvdOpTest
python
django__django
tests/fixtures_regress/models.py
{ "start": 2091, "end": 2422 }
class ____(models.Model): name = models.CharField(max_length=255, unique=True) main = models.ForeignKey("self", models.SET_NULL, null=True) objects = TestManager() class Meta: ordering = ("name",) def __str__(self): return self.name def natural_key(self): return (self...
Store
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_axis11.py
{ "start": 315, "end": 1391 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_axis11.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_...
TestCompareXLSXFiles
python
google__jax
jax/_src/dispatch.py
{ "start": 6140, "end": 14337 }
class ____: __slots__ = ['fmt', 'fun_name', 'event', 'start_time'] def __init__(self, fmt: str, fun_name: str, event: str | None = None): self.fmt = fmt self.fun_name = fun_name self.event = event def __enter__(self): self.start_time = time.time() if self.event is not None: record_scal...
LogElapsedTimeContextManager
python
sympy__sympy
sympy/codegen/ast.py
{ "start": 12398, "end": 12961 }
class ____(Token): """ The AST equivalence of Python's NoneType The corresponding instance of Python's ``None`` is ``none``. Examples ======== >>> from sympy.codegen.ast import none, Variable >>> from sympy import pycode >>> print(pycode(Variable('x').as_Declaration(value=none))) x = ...
NoneToken
python
huggingface__transformers
src/transformers/models/qwen3/modeling_qwen3.py
{ "start": 19960, "end": 23388 }
class ____(Qwen3PreTrainedModel, GenerationMixin): _tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"} _tp_plan = {"lm_head": "colwise_rep"} _pp_plan = {"lm_head": (["hidden_states"], ["logits"])} def __init__(self, config): super().__init__(config) self.model = Qwen3Mo...
Qwen3ForCausalLM
python
matplotlib__matplotlib
lib/matplotlib/backends/backend_template.py
{ "start": 5247, "end": 5598 }
class ____(FigureManagerBase): """ Helper class for pyplot mode, wraps everything up into a neat bundle. For non-interactive backends, the base class is sufficient. For interactive backends, see the documentation of the `.FigureManagerBase` class for the list of methods that can/should be overridd...
FigureManagerTemplate
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/callbackProtocol1.py
{ "start": 830, "end": 1343 }
class ____(Protocol): def __call__(self, *vals: bytes, **kwargs: str) -> None: pass def func1(*a: bytes, **b: str): pass def func2(*a: bytes): pass def func3(*a: str, **b: str): pass def func4(*a: bytes, **b: bytes): pass def func5(**b: str): pass var2: TestClass2 = func1 # ...
TestClass2
python
encode__django-rest-framework
tests/test_validators.py
{ "start": 38666, "end": 40506 }
class ____(TestCase): def test_qs_exists_handles_type_error(self): class TypeErrorQueryset: def exists(self): raise TypeError assert qs_exists(TypeErrorQueryset()) is False def test_qs_exists_handles_value_error(self): class ValueErrorQueryset: d...
ValidatorsTests
python
spyder-ide__spyder
spyder/api/widgets/toolbars.py
{ "start": 1150, "end": 1337 }
class ____: Top = Qt.TopToolBarArea Bottom = Qt.BottomToolBarArea # ---- Event filters # ----------------------------------------------------------------------------
ToolbarLocation
python
doocs__leetcode
lcof2/剑指 Offer II 119. 最长连续序列/Solution.py
{ "start": 0, "end": 402 }
class ____: def longestConsecutive(self, nums: List[int]) -> int: n = len(nums) if n < 2: return n nums.sort() ans = t = 1 for a, b in pairwise(nums): if a == b: continue if a + 1 == b: t += 1 ...
Solution
python
huggingface__transformers
src/transformers/models/qwen3_moe/modeling_qwen3_moe.py
{ "start": 32164, "end": 32561 }
class ____(GenericForQuestionAnswering, Qwen3MoePreTrainedModel): base_model_prefix = "transformer" # For BC, where `transformer` was used instead of `model` __all__ = [ "Qwen3MoeForCausalLM", "Qwen3MoeForQuestionAnswering", "Qwen3MoeModel", "Qwen3MoePreTrainedModel", "Qwen3MoeForSequenceClas...
Qwen3MoeForQuestionAnswering
python
graphql-python__graphene
graphene/relay/tests/test_mutation_async.py
{ "start": 376, "end": 670 }
class ____(ClientIDMutation): class Input: what = String() phrase = String() @staticmethod async def mutate_and_get_payload(self, info, what, client_mutation_id=None): return SaySomethingAsync(phrase=str(what)) # MyEdge = MyNode.Connection.Edge
SaySomethingAsync
python
bokeh__bokeh
examples/advanced/extensions/gears/gear.py
{ "start": 186, "end": 1905 }
class ____(Glyph): """ Render gears. The details and nomenclature concerning gear construction can be quite involved. For more information, consult the `Wikipedia article for Gear`_. .. _Wikipedia article for Gear: http://en.wikipedia.org/wiki/Gear """ __view_module__ = "gears" x = N...
Gear
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 7864, "end": 7979 }
class ____(BaseModel): status: Literal[ "disabled", ] = Field(..., description="")
ClusterStatusOneOf
python
pydantic__pydantic
pydantic/fields.py
{ "start": 3453, "end": 38654 }
class ____(_repr.Representation): """This class holds information about a field. `FieldInfo` is used for any field definition regardless of whether the [`Field()`][pydantic.fields.Field] function is explicitly used. !!! warning The `FieldInfo` class is meant to expose information about a field...
FieldInfo
python
django__django
tests/user_commands/tests.py
{ "start": 984, "end": 1920 }
class ____(SimpleTestCase): def test_unhandled_exceptions(self): cases = [ StringIO("Hello world"), TextIOWrapper(BytesIO(b"Hello world")), ] for out in cases: with self.subTest(out=out): wrapper = OutputWrapper(out) out.clo...
OutputWrapperTests
python
dagster-io__dagster
python_modules/dagster/dagster/_core/execution/context/system.py
{ "start": 53562, "end": 54484 }
class ____: """The ``context`` object available to a type check function on a DagsterType.""" def __init__( self, run_id: str, log_manager: DagsterLogManager, scoped_resources_builder: ScopedResourcesBuilder, dagster_type: DagsterType, ): self._run_id = run_i...
TypeCheckContext
python
protocolbuffers__protobuf
python/google/protobuf/internal/containers.py
{ "start": 12373, "end": 15854 }
class ____(MutableMapping[_K, _V]): """Simple, type-checked, dict-like container for holding repeated scalars.""" # Disallows assignment to other attributes. __slots__ = ['_key_checker', '_value_checker', '_values', '_message_listener', '_entry_descriptor'] def __init__( self, messa...
ScalarMap
python
joblib__joblib
joblib/externals/loky/cloudpickle_wrapper.py
{ "start": 119, "end": 819 }
class ____: def __init__(self, obj, keep_wrapper=False): self._obj = obj self._keep_wrapper = keep_wrapper def __reduce__(self): _pickled_object = dumps(self._obj) if not self._keep_wrapper: return loads, (_pickled_object,) return _reconstruct_wrapper, (_pic...
CloudpickledObjectWrapper
python
tensorflow__tensorflow
tensorflow/python/data/ops/unique_op.py
{ "start": 1072, "end": 1915 }
class ____(dataset_ops.UnaryUnchangedStructureDataset): """A dataset containing the unique elements of an input dataset.""" def __init__(self, input_dataset, name=None): """See `tf.data.Dataset.unique` for details.""" self._input_dataset = input_dataset for ty in nest.flatten(dataset_ops.get_legacy_out...
_UniqueDataset
python
chroma-core__chroma
chromadb/ingest/__init__.py
{ "start": 1061, "end": 2512 }
class ____(Component): """Interface for writing embeddings to an ingest stream""" @abstractmethod def delete_log(self, collection_id: UUID) -> None: pass @abstractmethod def purge_log(self, collection_id: UUID) -> None: """Truncates the log for the given collection, removing all se...
Producer
python
tensorflow__tensorflow
tensorflow/compiler/tests/reverse_sequence_op_test.py
{ "start": 946, "end": 3362 }
class ____(xla_test.XLATestCase): def _testReverseSequence(self, x, batch_axis, seq_axis, seq_lengths, truth, expected_err_re=None): with self.session(...
ReverseSequenceTest
python
pytorch__pytorch
torch/_inductor/codegen/simd.py
{ "start": 12298, "end": 48096 }
class ____(Kernel[CSEVariableType], Generic[CSEVariableType]): """ Common base class for Triton/Halide codegen which both use flattened indexing rather than loop nests. """ sexpr: Callable[[sympy.Expr], str] = pexpr kexpr: Callable[[sympy.Expr], str] allow_block_ptr: bool = False # pyrefly:...
SIMDKernel
python
django__django
tests/i18n/test_extraction.py
{ "start": 48398, "end": 48647 }
class ____(AdminScriptTestCase): def test_makemessages_no_settings(self): out, err = self.run_django_admin(["makemessages", "-l", "en", "-v", "0"]) self.assertNoOutput(err) self.assertNoOutput(out)
NoSettingsExtractionTests
python
getsentry__sentry
tests/sentry/workflow_engine/test_base.py
{ "start": 2121, "end": 2247 }
class ____(Model): __relocation_scope__ = RelocationScope.Excluded class Meta: app_label = "fixtures"
MockModel
python
spyder-ide__spyder
spyder/dependencies.py
{ "start": 13141, "end": 18600 }
class ____(object): """ Spyder's dependency Version may starts with =, >=, > or < to specify the exact requirement; multiple conditions may be separated by ',' (e.g. '>=0.13,<1.0')""" OK = 'OK' NOK = 'NOK' def __init__(self, modname, package_name, features, required_version, ...
Dependency
python
huggingface__transformers
src/transformers/models/led/modeling_led.py
{ "start": 42424, "end": 47124 }
class ____(GradientCheckpointingLayer): def __init__(self, config: LEDConfig, layer_idx=None): super().__init__() self.embed_dim = config.d_model self.self_attn = LEDDecoderAttention( embed_dim=self.embed_dim, num_heads=config.decoder_attention_heads, dro...
LEDDecoderLayer
python
apache__airflow
providers/common/sql/src/airflow/providers/common/sql/operators/generic_transfer.py
{ "start": 1294, "end": 8524 }
class ____(BaseOperator): """ Moves data from a connection to another. Assuming that they both provide the required methods in their respective hooks. The source hook needs to expose a `get_records` method, and the destination a `insert_rows` method. This is meant to be used on small-ish datas...
GenericTransfer
python
tornadoweb__tornado
demos/chat/chatdemo.py
{ "start": 848, "end": 1770 }
class ____: def __init__(self): # cond is notified whenever the message cache is updated self.cond = tornado.locks.Condition() self.cache = [] self.cache_size = 200 def get_messages_since(self, cursor): """Returns a list of messages newer than the given cursor. ...
MessageBuffer
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pep8_naming/N805.py
{ "start": 1974, "end": 2039 }
class ____(type): def __subclasscheck__(cls, other): ...
MyMeta
python
tensorflow__tensorflow
tensorflow/python/eager/backprop.py
{ "start": 3916, "end": 24812 }
class ____(object): """Pretends to be a tf.Operation for the gradient functions.""" def __init__(self, attrs, inputs, outputs, typ, skip_input_indices): self.attrs = attrs self.inputs = inputs self.outputs = outputs self.type = typ self.skip_input_indices = skip_input_indices def get_attr(se...
_MockOp
python
huggingface__transformers
src/transformers/models/ernie/modular_ernie.py
{ "start": 35533, "end": 38751 }
class ____(BertForQuestionAnswering): @can_return_tuple @auto_docstring def forward( self, input_ids: Optional[torch.Tensor] = None, attention_mask: Optional[torch.Tensor] = None, token_type_ids: Optional[torch.Tensor] = None, task_type_ids: Optional[torch.Tensor] = N...
ErnieForQuestionAnswering
python
python-openxml__python-docx
tests/test_package.py
{ "start": 464, "end": 1769 }
class ____: """Unit-test suite for `docx.package.Package`.""" def it_can_get_or_add_an_image_part_containing_a_specified_image( self, image_parts_prop_: Mock, image_parts_: Mock, image_part_: Mock ): image_parts_prop_.return_value = image_parts_ image_parts_.get_or_add_image_part.re...
DescribePackage
python
sqlalchemy__sqlalchemy
test/dialect/mssql/test_engine.py
{ "start": 27936, "end": 28916 }
class ____(fixtures.TablesTest): __only_on__ = "mssql" __backend__ = True @classmethod def define_tables(cls, metadata): Table( "error_t", metadata, Column("error_code", String(50), primary_key=True), ) @classmethod def insert_data(cls, conne...
InvalidTransactionFalsePositiveTest
python
huggingface__transformers
src/transformers/models/convbert/modeling_convbert.py
{ "start": 30113, "end": 30814 }
class ____(nn.Module): """Prediction module for the generator, made up of two dense layers.""" def __init__(self, config): super().__init__() self.activation = get_activation("gelu") self.LayerNorm = nn.LayerNorm(config.embedding_size, eps=config.layer_norm_eps) self.dense = nn...
ConvBertGeneratorPredictions
python
realpython__materials
python-built-in-exceptions/rainbow.py
{ "start": 394, "end": 729 }
class ____: def __init__(self, name="Red"): name = name.title() if name not in COLORS: raise ValueError(f"{name} is not a valid rainbow color") self.name = name def as_hex(self): return COLORS[self.name]["Hex"] def as_rgb(self): return COLORS[self.name][...
RainbowColor
python
django-haystack__django-haystack
haystack/backends/elasticsearch7_backend.py
{ "start": 20168, "end": 20322 }
class ____(ElasticsearchSearchQuery): def add_field_facet(self, field, **options): self.facets[field] = options.copy()
Elasticsearch7SearchQuery
python
getsentry__sentry
tests/sentry/models/test_grouphistory.py
{ "start": 2526, "end": 4041 }
class ____(TestCase): def test_no_history(self) -> None: # Test both statuses with/without a previous status assert get_prev_history(self.group, GroupHistoryStatus.UNRESOLVED) is None assert get_prev_history(self.group, GroupHistoryStatus.DELETED) is None def test_history(self) -> None:...
GetPrevHistoryTest
python
gevent__gevent
src/greentest/3.12/test_ssl.py
{ "start": 66411, "end": 68849 }
class ____(unittest.TestCase): def test_str(self): # The str() of a SSLError doesn't include the errno e = ssl.SSLError(1, "foo") self.assertEqual(str(e), "foo") self.assertEqual(e.errno, 1) # Same for a subclass e = ssl.SSLZeroReturnError(1, "foo") self.asse...
SSLErrorTests
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_gradient05.py
{ "start": 315, "end": 1560 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_gradient05.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self....
TestCompareXLSXFiles
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/nn_ops/rnn_test.py
{ "start": 3860, "end": 26943 }
class ____(test.TestCase): def setUp(self): self._seed = 23489 np.random.seed(self._seed) @test_util.run_in_graph_and_eager_modes def testInvalidSequenceLengthShape(self): cell = Plus1RNNCell() if context.executing_eagerly(): inputs = [constant_op.constant(np.ones((3, 4)))] else: ...
RNNTest
python
squidfunk__mkdocs-material
material/plugins/tags/structure/tag/__init__.py
{ "start": 1424, "end": 4943 }
class ____: """ A tag. Tags can be used to categorize pages and group them into a tag structure. A tag is a simple string, which can be split into a hierarchy of tags by using the character or string as defined in the `hierarchy_separator` setting in `mkdocs.yml`. Each parent tag contains their...
Tag
python
django-haystack__django-haystack
test_haystack/test_managers.py
{ "start": 721, "end": 892 }
class ____(SearchIndexManager): def filter(self, *args, **kwargs): return self.get_search_queryset().filter(content="foo1").filter(*args, **kwargs)
CustomManager
python
walkccc__LeetCode
solutions/667. Beautiful Arrangement II/667.py
{ "start": 0, "end": 254 }
class ____: def constructArray(self, n: int, k: int) -> list[int]: ans = list(range(1, n - k + 1)) for i in range(k): if i % 2 == 0: ans.append(n - i // 2) else: ans.append(n - k + (i + 1) // 2) return ans
Solution
python
getsentry__sentry
src/sentry/incidents/handlers/condition/anomaly_detection_handler.py
{ "start": 1151, "end": 1343 }
class ____(TypedDict): value: int source_id: int subscription_id: int timestamp: datetime @condition_handler_registry.register(Condition.ANOMALY_DETECTION)
AnomalyDetectionUpdate
python
dagster-io__dagster
python_modules/dagster/dagster/_core/storage/config.py
{ "start": 821, "end": 928 }
class ____(TypedDict): postgres_url: str postgres_db: "PostgresStorageConfigDb"
PostgresStorageConfig
python
weaviate__weaviate-python-client
weaviate/exceptions.py
{ "start": 8276, "end": 8525 }
class ____(WeaviateQueryError): """Is raised if a gRPC tenant get request to Weaviate fails in any way.""" def __init__(self, message: str): super().__init__(message, "tenant get") self.message = message
WeaviateTenantGetError
python
geekcomputers__Python
LinkedLists all Types/doubly_linked_list.py
{ "start": 674, "end": 7115 }
class ____: def __init__(self): self.head = self.tail = None self.length = 0 def insert_front(self, data): node = Node(data, self.head) if self.head == None: self.tail = node node.prev = self.head self.head = node self.length += 1 def ins...
DoublyLinkedList
python
FactoryBoy__factory_boy
tests/test_using.py
{ "start": 86028, "end": 87441 }
class ____(unittest.TestCase): def setUp(self): self.relateds = [] class TestRelatedObject: def __init__(subself, obj): self.relateds.append(subself) subself.obj = obj obj.related = subself class TestRelatedObjectFactory(factory.F...
RelatedFactoryExtractionTestCase
python
nedbat__coveragepy
tests/test_debug.py
{ "start": 15473, "end": 17589 }
class ____(CoverageTest): """Tests of debug.py:short_filename.""" def test_short_filename(self) -> None: s = os.sep se = re.escape(s) assert short_filename(ast.__file__) == f"syspath:{s}ast.py" assert short_filename(pytest.__file__) == f"syspath:{s}pytest{s}__init__.py" ...
ShortFilenameTest
python
PyCQA__pylint
tests/functional/g/generic_alias/generic_alias_collections.py
{ "start": 2128, "end": 2168 }
class ____(list[int]): pass
DerivedList
python
dask__distributed
distributed/http/scheduler/prometheus/semaphore.py
{ "start": 173, "end": 3514 }
class ____(PrometheusCollector): def __init__(self, server): super().__init__(server) self.subsystem = "semaphore" def collect(self): try: sem_ext = self.server.extensions["semaphores"] except KeyError: return semaphore_max_leases_family = GaugeMe...
SemaphoreMetricCollector
python
plotly__plotly.py
plotly/graph_objs/splom/marker/colorbar/title/_font.py
{ "start": 233, "end": 9939 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "splom.marker.colorbar.title" _path_str = "splom.marker.colorbar.title.font" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", "...
Font
python
PrefectHQ__prefect
src/prefect/client/schemas/actions.py
{ "start": 33210, "end": 33649 }
class ____(ActionBaseModel): """Data used by the Prefect REST API to update a global concurrency limit.""" name: Optional[Name] = Field(default=None) limit: Optional[NonNegativeInteger] = Field(default=None) active: Optional[bool] = Field(default=None) active_slots: Optional[NonNegativeInteger] = F...
GlobalConcurrencyLimitUpdate
python
allegroai__clearml
clearml/backend_api/services/v2_20/events.py
{ "start": 101266, "end": 104634 }
class ____(Response): """ Response of events.get_task_events endpoint. :param events: Events list :type events: Sequence[dict] :param returned: Number of results returned :type returned: int :param total: Total number of results available for this query :type total: float :param scr...
GetTaskEventsResponse
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/functions.py
{ "start": 59781, "end": 59946 }
class ____(AnsiFunction[datetime.datetime]): """The CURRENT_TIMESTAMP() SQL function.""" type = sqltypes.DateTime() inherit_cache = True
current_timestamp
python
zarr-developers__zarr-python
src/zarr/core/buffer/core.py
{ "start": 17343, "end": 18026 }
class ____(NamedTuple): """Prototype of the Buffer and NDBuffer class The protocol must be pickable. Attributes ---------- buffer The Buffer class to use when Zarr needs to create new Buffer. nd_buffer The NDBuffer class to use when Zarr needs to create new NDBuffer. """ ...
BufferPrototype
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/refurb/FURB142.py
{ "start": 573, "end": 1282 }
class ____: s: set[int] c = C() for x in (1, 2, 3): c.s.add(x) # Ok s.update(x for x in (1, 2, 3)) for x in (1, 2, 3): s.add(x) else: pass async def f(y): async for x in y: s.add(x) def g(): for x in (set(),): x.add(x) # Test cases for lambda and ternary expressions -...
C
python
great-expectations__great_expectations
great_expectations/datasource/fluent/sql_datasource.py
{ "start": 8257, "end": 8726 }
class ____(_PartitionerDatetime): column_name: str sort_ascending: bool = True method_name: Literal["partition_on_year_and_month_and_day"] = ( "partition_on_year_and_month_and_day" ) @property @override def param_names(self) -> List[str]: return ["year", "month", "day"] ...
SqlPartitionerYearAndMonthAndDay
python
ray-project__ray
python/ray/llm/_internal/serve/core/configs/openai_api_models.py
{ "start": 4077, "end": 4177 }
class ____(vLLMScoreRequest): model_config = ConfigDict(arbitrary_types_allowed=True)
ScoreRequest
python
scikit-learn__scikit-learn
sklearn/tests/test_base.py
{ "start": 2403, "end": 2549 }
class ____(BaseEstimator): "A buggy estimator that does not set its parameters right." def __init__(self, a=None): self.a = 1
Buggy
python
google__pytype
pytype/directors/directors.py
{ "start": 4208, "end": 5537 }
class ____: """A collection of possibly nested start..end ranges from AST nodes.""" def __init__(self, start_to_end_mapping): self._starts = sorted(start_to_end_mapping) self._start_to_end = start_to_end_mapping self._end_to_start = {v: k for k, v in start_to_end_mapping.items()} def has_start(self,...
_BlockRanges
python
sympy__sympy
sympy/functions/combinatorial/numbers.py
{ "start": 69346, "end": 70493 }
class ____(DefinedFunction): r""" Calculate the number of prime factors counting multiplicities for a positive integer n. If n's prime factorization is: .. math :: n = \prod_{i=1}^k p_i^{m_i}, then ``primeomega(n)`` or `\Omega(n)` is: .. math :: \Omega(n) = \sum_{i=1}^k ...
primeomega
python
pytorch__pytorch
test/torch_np/test_basic.py
{ "start": 15983, "end": 17017 }
class ____(TestCase): def test_ndarrays_to_tensors(self): out = _util.ndarrays_to_tensors(((w.asarray(42), 7), 3)) assert len(out) == 2 assert isinstance(out[0], tuple) and len(out[0]) == 2 assert isinstance(out[0][0], torch.Tensor) @skip(not TEST_CUDA, reason="requires cuda") ...
TestMisc
python
getsentry__sentry
tests/sentry/models/test_debugfile.py
{ "start": 12303, "end": 20074 }
class ____(APITestCase): def test_simple_cache_clear(self) -> None: project = self.create_project(name="foo") url = reverse( "sentry-api-0-dsym-files", kwargs={ "organization_id_or_slug": project.organization.slug, "project_id_or_slug": projec...
DebugFilesClearTest
python
huggingface__transformers
src/transformers/models/mt5/modeling_mt5.py
{ "start": 3825, "end": 5189 }
class ____(nn.Module): def __init__(self, config: MT5Config): super().__init__() self.wi_0 = nn.Linear(config.d_model, config.d_ff, bias=False) self.wi_1 = nn.Linear(config.d_model, config.d_ff, bias=False) self.wo = nn.Linear(config.d_ff, config.d_model, bias=False) self.dro...
MT5DenseGatedActDense
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_types.py
{ "start": 199925, "end": 200315 }
class ____: _col_type = DATEMULTIRANGE _col_str = "DATEMULTIRANGE" def _data_str(self): return "{[2013-03-23,2013-03-24), [2014-05-23,2014-05-24)}" def _data_obj(self): return [ Range(datetime.date(2013, 3, 23), datetime.date(2013, 3, 24)), Range(datetime.date(2...
_DateMultiRangeTests
python
realpython__materials
python-class/animals.py
{ "start": 139, "end": 201 }
class ____(Animal): unique_feature = "Mammary glands"
Mammal
python
pytorch__pytorch
torch/jit/mobile/__init__.py
{ "start": 1731, "end": 8889 }
class ____: def __init__(self, cpp_module) -> None: self._c = cpp_module super().__init__() def __call__(self, *input): return self._c.forward(input) def find_method(self, method_name): return self._c.find_method(method_name) def forward(self, *input): return s...
LiteScriptModule
python
walkccc__LeetCode
solutions/2861. Maximum Number of Alloys/2861.py
{ "start": 0, "end": 793 }
class ____: def maxNumberOfAlloys(self, n: int, k: int, budget: int, composition: list[list[int]], stock: list[int], costs: list[int]) -> int: l = 1 r = 1_000_000_000 def isPossible(m: int) -> bool: """Returns True if it's possible to create `m` alloy...
Solution
python
patrick-kidger__equinox
equinox/_vmap_pmap.py
{ "start": 15350, "end": 23761 }
class ____(Module): _fun: Callable _in_axes: PyTree[AxisSpec] _out_axes: PyTree[AxisSpec] _axis_name: Hashable | None _axis_size: int | None _filter_warning: bool _pmapkwargs: dict[str, Any] @property def __wrapped__(self): return self._fun def _call(self, is_lower, arg...
_PmapWrapper
python
realpython__materials
tic-tac-toe-ai-python/source_code_bonus/tic-tac-toe/library/src/tic_tac_toe/game/players.py
{ "start": 262, "end": 862 }
class ____(metaclass=abc.ABCMeta): def __init__(self, mark: Mark) -> None: self.mark = mark def make_move(self, game_state: GameState) -> GameState: if self.mark is game_state.current_mark: if move := self.get_move(game_state): return move.after_state rai...
Player
python
kamyu104__LeetCode-Solutions
Python/minimum-time-for-k-virus-variants-to-spread.py
{ "start": 2560, "end": 4248 }
class ____(object): def minDayskVariants(self, points, k): """ :type points: List[List[int]] :type k: int :rtype: int """ def add_rec(rec, intervals): x0, y0, x1, y1 = rec # add [y0, y1] by 1 in [x0, x1+1) intervals.append([[x0, +...
Solution
python
astropy__astropy
astropy/io/fits/header.py
{ "start": 69404, "end": 72050 }
class ____(collections.abc.Mapping): """This class provides a fast header parsing, without all the additional features of the Header class. Here only standard keywords are parsed, no support for CONTINUE, HIERARCH, COMMENT, HISTORY, or rvkc. The raw card images are stored and parsed only if needed. The...
_BasicHeader
python
dagster-io__dagster
python_modules/libraries/dagster-airflow/dagster_airflow_tests/test_dagster_operator.py
{ "start": 905, "end": 4089 }
class ____(unittest.TestCase): @mock.patch("dagster_airflow.hooks.dagster_hook.DagsterHook.launch_run", return_value="run_id") @mock.patch("dagster_airflow.hooks.dagster_hook.DagsterHook.wait_for_run") def test_operator(self, launch_run, wait_for_run): dag = DAG(dag_id="anydag", start_date=datetime....
TestDagsterOperator
python
airbytehq__airbyte
airbyte-integrations/connectors/source-amazon-ads/unit_tests/integrations/ad_responses/oauth_response_builder.py
{ "start": 195, "end": 791 }
class ____: @classmethod def token_response(cls, status_code: int = 200) -> "OAuthResponseBuilder": return cls("oauth", status_code) def __init__(self, resource: str, status_code: int = 200) -> None: self._status_code: int = status_code self._resource: str = resource def with_s...
OAuthResponseBuilder
python
django__django
tests/middleware_exceptions/middleware.py
{ "start": 341, "end": 611 }
class ____: def __init__(self, get_response): self.get_response = get_response if iscoroutinefunction(self.get_response): markcoroutinefunction(self) def __call__(self, request): return self.get_response(request)
BaseMiddleware
python
huggingface__transformers
src/transformers/models/dbrx/modeling_dbrx.py
{ "start": 15433, "end": 16673 }
class ____(nn.Module): """Modular DBRX MLP/FFN component with MoE support.""" def __init__(self, config, **kwargs): super().__init__() self.router = DbrxRouter(config.ffn_config) self.experts = DbrxExperts(config.ffn_config) self.moe_normalize_expert_weights = config.ffn_config...
DbrxFFN
python
apache__airflow
providers/google/src/airflow/providers/google/marketing_platform/operators/analytics_admin.py
{ "start": 14077, "end": 17010 }
class ____(GoogleCloudBaseOperator): """ Deletes Data stream. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:GoogleAnalyticsAdminDeleteDataStreamOperator` :param property_id: ID of the property which is parent for the data ...
GoogleAnalyticsAdminDeleteDataStreamOperator
python
kubernetes-client__python
kubernetes/client/api/certificates_api.py
{ "start": 543, "end": 5197 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client ...
CertificatesApi
python
Pylons__pyramid
src/pyramid/interfaces.py
{ "start": 52896, "end": 53361 }
class ____(Interface): def text(): """ A textual description of the predicate used in the introspector. For example, ``'content_type = application/json'`` for a ``ContentTypePredicate`` with a ``value == 'application/json'``. """ def phash(): """ A uniq...
IPredicate
python
dateutil__dateutil
src/dateutil/tz/_factories.py
{ "start": 1654, "end": 2569 }
class ____(_TzFactory): def __init__(cls, *args, **kwargs): cls.__instances = weakref.WeakValueDictionary() cls.__strong_cache = OrderedDict() cls.__strong_cache_size = 8 cls.__cache_lock = _thread.allocate_lock() def __call__(cls, s, posix_offset=False): key = (s, posi...
_TzStrFactory
python
pyqtgraph__pyqtgraph
pyqtgraph/flowchart/library/Filters.py
{ "start": 734, "end": 1474 }
class ____(CtrlNode): """Bessel filter. Input data must have time values.""" nodeName = 'BesselFilter' uiTemplate = [ ('band', 'combo', {'values': ['lowpass', 'highpass'], 'index': 0}), ('cutoff', 'spin', {'value': 1000., 'step': 1, 'dec': True, 'bounds': [0.0, None], 'suffix': 'Hz', 'siPref...
Bessel
python
numba__numba
numba/core/datamodel/models.py
{ "start": 34202, "end": 34555 }
class ____(StructModel): def __init__(self, dmm, fe_type): members = [('start', types.intp), ('stop', types.intp), ('step', types.intp), ] super(SliceModel, self).__init__(dmm, fe_type, members) @register_default(types.NPDatetime) @register_...
SliceModel
python
getsentry__sentry
src/sentry/integrations/cursor/models.py
{ "start": 436, "end": 576 }
class ____(BaseModel): autoCreatePr: bool branchName: str openAsCursorGithubApp: bool | None = None
CursorAgentLaunchRequestTarget
python
ray-project__ray
python/ray/_private/thirdparty/pynvml/pynvml.py
{ "start": 107844, "end": 118685 }
class ____(Structure): _fields_ = [('version', c_uint), ('attackerAdvantage', c_ulong), ] ConfComputeGetKeyRotationThresholdInfo_v1 = 0x1000010 ## string/bytes conversion for ease of use def convertStrBytes(func): ''' In python 3, strings are unicode instead of bytes, and nee...
c_nvmlConfComputeGetKeyRotationThresholdInfo_t
python
pypa__pipenv
pipenv/patched/pip/_internal/commands/lock.py
{ "start": 891, "end": 6091 }
class ____(RequirementCommand): """ EXPERIMENTAL - Lock packages and their dependencies from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports locking from "requirements files", wh...
LockCommand
python
walkccc__LeetCode
solutions/3428. Maximum and Minimum Sums of at Most Size K Subsequences/3428.py
{ "start": 0, "end": 1466 }
class ____: def minMaxSums(self, nums: list[int], k: int) -> int: # In a sorted array, nums[i] will be # 1. The maximum for subsequences formed by nums[0..i]. # 2. The minimum for subsequences formed by nums[i..n - 1]. # # The number of times nums[i] is the maximum is the same as the number of...
Solution
python
pytorch__pytorch
torch/_inductor/utils.py
{ "start": 88623, "end": 96679 }
class ____(enum.Enum): # The placeholder for the actual name of a triton kernel. # e.g. for "def triton_" it would be "triton_" KERNEL_NAME = "KERNEL_NAME" # The descriptive name of the triton kernel; when unique_kernel_names = False, this # placeholder will be replaced with a string with more info...
Placeholder
python
Netflix__metaflow
metaflow/plugins/events_decorator.py
{ "start": 396, "end": 11145 }
class ____(FlowDecorator): """ Specifies the event(s) that this flow depends on. ``` @trigger(event='foo') ``` or ``` @trigger(events=['foo', 'bar']) ``` Additionally, you can specify the parameter mappings to map event payload to Metaflow parameters for the flow. ``` ...
TriggerDecorator
python
matplotlib__matplotlib
lib/matplotlib/projections/polar.py
{ "start": 10302, "end": 14131 }
class ____(maxis.XTick): """ A theta-axis tick. This subclass of `.XTick` provides angular ticks with some small modification to their re-positioning such that ticks are rotated based on tick location. This results in ticks that are correctly perpendicular to the arc spine. When 'auto' rot...
ThetaTick
python
pydata__xarray
xarray/tests/test_merge.py
{ "start": 408, "end": 994 }
class ____: def test_broadcast_dimension_size(self): actual = merge.broadcast_dimension_size( [xr.Variable("x", [1]), xr.Variable("y", [2, 1])] ) assert actual == {"x": 1, "y": 2} actual = merge.broadcast_dimension_size( [xr.Variable(("x", "y"), [[1, 2]]), xr...
TestMergeInternals
python
wandb__wandb
wandb/vendor/graphql-core-1.1/wandb_graphql/language/ast.py
{ "start": 31989, "end": 33116 }
class ____(TypeDefinition): __slots__ = ('loc', 'name', 'fields', 'directives',) _fields = ('name', 'fields',) def __init__(self, name, fields, loc=None, directives=None): self.loc = loc self.name = name self.fields = fields self.directives = directives def __eq__(self,...
InputObjectTypeDefinition
python
django-import-export__django-import-export
import_export/instance_loaders.py
{ "start": 956, "end": 2089 }
class ____(ModelInstanceLoader): """ Loads all possible model instances in dataset avoid hitting database for every ``get_instance`` call. This instance loader work only when there is one ``import_id_fields`` field. """ def __init__(self, *args, **kwargs): super().__init__(*args, *...
CachedInstanceLoader