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 | davidhalter__jedi | test/completion/classes.py | {
"start": 7547,
"end": 7640
} | class ____(object):
a = 3
def return_sup(self):
return 1
SuperCopy = Super
| Super |
python | huggingface__transformers | tests/models/bridgetower/test_modeling_bridgetower.py | {
"start": 20297,
"end": 24349
} | class ____(unittest.TestCase):
all_training_supported_model_classes = (
(BridgeTowerForImageAndTextRetrieval, BridgeTowerForMaskedLM, BridgeTowerForContrastiveLearning)
if is_torch_available()
else ()
)
def setUp(self):
self.model_tester = BridgeTowerModelTester(self)
... | BridgeTowerModelTrainingTest |
python | huggingface__transformers | src/transformers/models/pegasus_x/modeling_pegasus_x.py | {
"start": 66869,
"end": 67416
} | class ____(PegasusXPreTrainedModel):
"""
This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is
used in combination with the [`EncoderDecoderModel`] framework.
"""
def __init__(self, config):
super().__init__(config)
self.deco... | PegasusXDecoderWrapper |
python | google__pytype | pytype/tests/test_reingest1.py | {
"start": 6546,
"end": 9198
} | class ____(test_base.BaseTest):
"""Tests for strict none."""
def setUp(self):
super().setUp()
self.options.tweak(strict_none_binding=False)
def test_pyi_return_constant(self):
foo = self.Infer("""
x = None
def f():
return x
""")
with test_utils.Tempdir() as d:
d.cre... | StrictNoneTest |
python | django__django | tests/queries/models.py | {
"start": 14148,
"end": 14433
} | class ____(models.Model):
parent = models.ForeignKey(
"self", models.SET_NULL, null=True, blank=True, related_name="children"
)
data = models.CharField(max_length=100)
created_at = models.DateTimeField(auto_now_add=True)
# Models for #17600 regressions
| MyObject |
python | apache__airflow | providers/amazon/src/airflow/providers/amazon/aws/operators/rds.py | {
"start": 11373,
"end": 13767
} | class ____(RdsBaseOperator):
"""
Deletes a DB instance or cluster snapshot or terminating the copy operation.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:RdsDeleteDbSnapshotOperator`
:param db_type: Type of the DB - eith... | RdsDeleteDbSnapshotOperator |
python | getsentry__sentry | src/sentry/types/ratelimit.py | {
"start": 1788,
"end": 2032
} | class ____:
"""
Rate Limit metadata for Snuba's RateLimitExceeded error
"""
policy: str | None
quota_unit: str | None
quota_used: int | None
rejection_threshold: int | None
storage_key: str | None
| SnubaRateLimitMeta |
python | huggingface__transformers | src/transformers/models/qwen3_vl_moe/modeling_qwen3_vl_moe.py | {
"start": 18781,
"end": 20070
} | class ____(PreTrainedModel):
config: Qwen3VLMoeConfig
base_model_prefix = "model"
supports_gradient_checkpointing = True
_no_split_modules = ["Qwen3VLMoeTextDecoderLayer", "Qwen3VLMoeVisionBlock"]
_skip_keys_device_placement = ["past_key_values"]
_supports_flash_attn = True
_supports_sdpa = ... | Qwen3VLMoePreTrainedModel |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/logs/events.py | {
"start": 18051,
"end": 18314
} | class ____(graphene.ObjectType):
class Meta:
interfaces = (GrapheneMessageEvent, GrapheneStepEvent)
name = "ObjectStoreOperationEvent"
operation_result = graphene.NonNull(GrapheneObjectStoreOperationResult)
| GrapheneObjectStoreOperationEvent |
python | kamyu104__LeetCode-Solutions | Python/construct-string-with-minimum-cost-easy.py | {
"start": 1972,
"end": 3632
} | class ____(object):
def minimumCost(self, target, words, costs):
"""
:type target: str
:type words: List[str]
:type costs: List[int]
:rtype: int
"""
INF = float("inf")
class Trie(object):
def __init__(self):
self.__nodes = [... | Solution3 |
python | scipy__scipy | benchmarks/benchmarks/cython_special.py | {
"start": 510,
"end": 1489
} | class ____(type):
"""
Add time_* benchmarks corresponding to cython_special._bench_*_cy
"""
def __new__(cls, cls_name, bases, dct):
params = [(10, 100, 1000), ('python', 'numpy', 'cython')]
param_names = ['N', 'api']
def get_time_func(name, args):
@with_attributes(... | _CythonSpecialMeta |
python | numba__numba | numba/tests/test_datamodel.py | {
"start": 1237,
"end": 1329
} | class ____(test_factory()):
fe_type = types.UniTuple(types.int32, 2)
| TestUniTupleOf2xInt32 |
python | PrefectHQ__prefect | tests/utilities/schema_tools/test_validation.py | {
"start": 19721,
"end": 23642
} | class ____:
@pytest.fixture
def schema(self) -> dict:
return {
"title": "Parameters",
"type": "object",
"properties": {
"param": {
"title": "param",
"position": 0,
"allOf": [{"$ref": "#/defini... | TestNestedObject |
python | tensorflow__tensorflow | tensorflow/python/data/ops/rebatch_op.py | {
"start": 1331,
"end": 5969
} | class ____(dataset_ops.UnaryDataset):
"""A `Dataset` that rebatches elements from its input into new batch sizes.
`_RebatchDataset(input_dataset, batch_sizes)` is functionally equivalent to
`input_dataset.unbatch().batch(N)`, where the value of N cycles through the
`batch_sizes` input list. The elements produc... | _RebatchDataset |
python | kubernetes-client__python | kubernetes/client/models/v2_horizontal_pod_autoscaler.py | {
"start": 383,
"end": 7586
} | 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... | V2HorizontalPodAutoscaler |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI036.py | {
"start": 846,
"end": 1139
} | class ____:
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ...
async def __aexit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None, *args: list[None]) -> None: ...
| GoodFour |
python | pytorch__pytorch | torch/nn/modules/batchnorm.py | {
"start": 15640,
"end": 19366
} | class ____(_BatchNorm):
r"""Applies Batch Normalization over a 4D input.
4D is a mini-batch of 2D inputs
with additional channel dimension. Method described in the paper
`Batch Normalization: Accelerating Deep Network Training by Reducing
Internal Covariate Shift <https://arxiv.org/abs/1502.03167>`... | BatchNorm2d |
python | doocs__leetcode | lcof2/剑指 Offer II 054. 所有大于等于节点的值之和/Solution.py | {
"start": 192,
"end": 519
} | class ____:
def convertBST(self, root: TreeNode) -> TreeNode:
def dfs(root):
nonlocal s
if root is None:
return
dfs(root.right)
s += root.val
root.val = s
dfs(root.left)
s = 0
dfs(root)
return ro... | Solution |
python | ansible__ansible | lib/ansible/plugins/vars/host_group_vars.py | {
"start": 2583,
"end": 5921
} | class ____(BaseVarsPlugin):
REQUIRES_ENABLED = True
is_stateless = True
def load_found_files(self, loader, data, found_files):
for found in found_files:
new_data = loader.load_from_file(found, cache='all', unsafe=True, trusted_as_template=True)
if new_data: # ignore empty ... | VarsModule |
python | psf__black | src/black/lines.py | {
"start": 17675,
"end": 17864
} | class ____:
"""Intermediate split result from a right hand split."""
head: Line
body: Line
tail: Line
opening_bracket: Leaf
closing_bracket: Leaf
@dataclass
| RHSResult |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_textbox31.py | {
"start": 315,
"end": 1035
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("textbox31.xlsx")
self.ignore_elements = {"xl/drawings/drawing1.xml": ["<a:pPr/>"]}
def test_create_file(self):
"""Test the creatio... | TestCompareXLSXFiles |
python | modin-project__modin | modin/experimental/core/io/sql/sql_dispatcher.py | {
"start": 969,
"end": 4779
} | class ____(SQLDispatcher):
"""Class handles experimental utils for reading SQL queries or database tables."""
__read_sql_with_offset = None
@classmethod
def preprocess_func(cls): # noqa: RT01
"""Prepare a function for transmission to remote workers."""
if cls.__read_sql_with_offset is... | ExperimentalSQLDispatcher |
python | ray-project__ray | doc/source/ray-core/doc_code/streaming_generator.py | {
"start": 978,
"end": 1068
} | class ____:
def f(self):
for i in range(5):
yield i
@ray.remote
| Actor |
python | buildout__buildout | src/zc/buildout/easy_install.py | {
"start": 82809,
"end": 94276
} | class ____(Wheel):
"""Extension for Wheel class to get the actual project name."""
def get_project_name(self):
"""Get project name by looking in the .dist-info of the wheel.
This is adapted from the Wheel.install_as_egg method and the methods
it calls.
Ideally, this would be t... | BuildoutWheel |
python | allegroai__clearml | clearml/backend_api/services/v2_9/tasks.py | {
"start": 276237,
"end": 278130
} | class ____(Response):
"""
Response of tasks.set_requirements endpoint.
:param updated: Number of tasks updated (0 or 1)
:type updated: int
:param fields: Updated fields names and values
:type fields: dict
"""
_service = "tasks"
_action = "set_requirements"
_version = "2.9"
... | SetRequirementsResponse |
python | conda__conda | conda/exceptions.py | {
"start": 38952,
"end": 39203
} | class ____(InvalidSpec):
def __init__(self, invalid_spec: str | MatchSpec, details: str):
message = "Invalid spec '%(invalid_spec)s': %(details)s"
super().__init__(message, invalid_spec=invalid_spec, details=details)
| InvalidMatchSpec |
python | wandb__wandb | wandb/vendor/pygments/lexers/haskell.py | {
"start": 22059,
"end": 22758
} | class ____(LiterateLexer):
"""
For Literate Idris (Bird-style or LaTeX) source.
Additional options accepted:
`litstyle`
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
is autodetected: if the first non-whitespace character in the source
is a backslash or p... | LiterateIdrisLexer |
python | mlflow__mlflow | mlflow/metrics/genai/base.py | {
"start": 112,
"end": 3861
} | class ____:
"""
Stores the sample example during few shot learning during LLM evaluation
Args:
input: The input provided to the model
output: The output generated by the model
score: The score given by the evaluator
justification: The justification given by the evaluator
... | EvaluationExample |
python | huggingface__transformers | src/transformers/models/aimv2/modeling_aimv2.py | {
"start": 14396,
"end": 15897
} | class ____(nn.Module):
def __init__(self, config: Aimv2VisionConfig):
super().__init__()
self.hidden_size = config.hidden_size
self.num_heads = config.num_attention_heads
self.k_proj = nn.Linear(self.hidden_size, self.hidden_size, bias=config.qkv_bias)
self.v_proj = nn.Linea... | Aimv2AttentionPoolingHead |
python | django__django | tests/auth_tests/test_management.py | {
"start": 5809,
"end": 9905
} | class ____(TestCase):
@classmethod
def setUpTestData(cls):
cls.user = User.objects.create_user(username="joe", password="qwerty")
def setUp(self):
self.stdout = StringIO()
self.addCleanup(self.stdout.close)
self.stderr = StringIO()
self.addCleanup(self.stderr.close)
... | ChangepasswordManagementCommandTestCase |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_pie/PIE790.py | {
"start": 1580,
"end": 1760
} | class ____(Protocol):
def func(self) -> str:
"""Docstring"""
...
def impl(self) -> str:
"""Docstring"""
return self.func()
import abc
| Repro |
python | pypa__pip | src/pip/_vendor/rich/live.py | {
"start": 1249,
"end": 15180
} | class ____(JupyterMixin, RenderHook):
"""Renders an auto-updating live display of any given renderable.
Args:
renderable (RenderableType, optional): The renderable to live display. Defaults to displaying nothing.
console (Console, optional): Optional Console instance. Defaults to an internal Co... | Live |
python | apache__thrift | lib/py/src/transport/THeaderTransport.py | {
"start": 2081,
"end": 12931
} | class ____(TTransportBase, CReadableTransport):
def __init__(self, transport, allowed_client_types, default_protocol=THeaderSubprotocolID.BINARY):
self._transport = transport
self._client_type = THeaderClientType.HEADERS
self._allowed_client_types = allowed_client_types
self._read_b... | THeaderTransport |
python | google__jax | tests/pallas/mgpu_matmul_test.py | {
"start": 1610,
"end": 2725
} | class ____(jtu.JaxTestCase):
def setUp(self):
super().setUp()
if not jtu.test_device_matches(["cuda"]):
self.skipTest("Test requires an NVIDIA GPU")
self.enter_context(pallas_call._PALLAS_USE_MOSAIC_GPU(True))
@parameterized.product(
m=(1024, 4096),
k=(1024, 4096),
n=(1024, 409... | MatrixMultiplicationSm100ATest |
python | readthedocs__readthedocs.org | readthedocs/organizations/filters.py | {
"start": 6111,
"end": 8276
} | class ____(OrganizationFilterSet):
"""
Filter and sorting set for organization member listing page.
This filter set's underlying queryset from the member listing view is the
manager method ``Organization.members``. The model described in this filter
is effectively ``User``, but through a union of `... | OrganizationTeamMemberListFilterSet |
python | sphinx-doc__sphinx | tests/roots/test-ext-autodoc/target/typed_vars.py | {
"start": 80,
"end": 226
} | class ____:
def __init__(self, name):
self.__doc__ = f'This is {name}'
def __get__(self): # NoQA: PLE0302
pass
| _Descriptor |
python | tornadoweb__tornado | tornado/test/netutil_test.py | {
"start": 1808,
"end": 2107
} | class ____(_ResolverTestMixin):
def setUp(self):
super().setUp()
self.resolver = BlockingResolver()
# getaddrinfo-based tests need mocking to reliably generate errors;
# some configurations are slow to produce errors and take longer than
# our default timeout.
| BlockingResolverTest |
python | openai__openai-python | src/openai/resources/responses/responses.py | {
"start": 156373,
"end": 157380
} | class ____:
def __init__(self, responses: AsyncResponses) -> None:
self._responses = responses
self.create = _legacy_response.async_to_raw_response_wrapper(
responses.create,
)
self.retrieve = _legacy_response.async_to_raw_response_wrapper(
responses.retrieve... | AsyncResponsesWithRawResponse |
python | scikit-learn__scikit-learn | sklearn/model_selection/tests/test_validation.py | {
"start": 4710,
"end": 5292
} | class ____(BaseEstimator):
"""Dummy classifier to test the validation curve"""
def __init__(self, param=0.5):
self.X_subset = None
self.param = param
def fit(self, X_subset, y_subset):
self.X_subset = X_subset
self.train_sizes = X_subset.shape[0]
return self
de... | MockEstimatorWithParameter |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 964634,
"end": 966355
} | class ____(sgqlc.types.Type):
"""An individual vulnerability within an Advisory"""
__schema__ = github_schema
__field_names__ = ("advisory", "first_patched_version", "package", "severity", "updated_at", "vulnerable_version_range")
advisory = sgqlc.types.Field(sgqlc.types.non_null("SecurityAdvisory"), g... | SecurityVulnerability |
python | bokeh__bokeh | src/bokeh/models/tools.py | {
"start": 31097,
"end": 35116
} | class ____(Tap, SelectTool):
''' *toolbar icon*: |tap_icon|
The tap selection tool allows the user to select at single points by
left-clicking a mouse, or tapping with a finger.
See :ref:`ug_styling_plots_selected_unselected_glyphs` for information
on styling selected and unselected glyphs.
.... | TapTool |
python | python-openxml__python-docx | src/docx/image/tiff.py | {
"start": 9706,
"end": 10379
} | class ____(_IfdEntry):
"""IFD entry expressed as a numerator, denominator pair."""
@classmethod
def _parse_value(cls, stream_rdr, offset, value_count, value_offset):
"""Return the rational (numerator / denominator) value at `value_offset` in
`stream_rdr` as a floating-point number.
... | _RationalIfdEntry |
python | getsentry__sentry | tests/sentry/api/endpoints/test_event_committers.py | {
"start": 613,
"end": 13117
} | class ____(APITestCase):
def test_simple(self) -> None:
self.login_as(user=self.user)
project = self.create_project()
min_ago = before_now(minutes=1).isoformat()
event = self.store_event(
data={
"fingerprint": ["group1"],
"timestamp": min... | EventCommittersTest |
python | pytest-dev__pytest | src/_pytest/logging.py | {
"start": 34930,
"end": 35262
} | class ____(logging.NullHandler):
"""A logging handler used when live logging is disabled."""
def reset(self) -> None:
pass
def set_when(self, when: str) -> None:
pass
def handleError(self, record: logging.LogRecord) -> None:
# Handled by LogCaptureHandler.
pass
| _LiveLoggingNullHandler |
python | huggingface__transformers | src/transformers/models/layoutlm/modeling_layoutlm.py | {
"start": 11187,
"end": 12678
} | class ____(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.chunk_size_feed_forward = config.chunk_size_feed_forward
self.seq_len_dim = 1
self.attention = LayoutLMAttention(config)
self.intermediate = LayoutLMIntermediate(config)
self.o... | LayoutLMLayer |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/protocol6.py | {
"start": 733,
"end": 1215
} | class ____:
species: str
attributes: list[str]
type_of_hooves: str
a: Mammal[str] = Sloth()
# This should generate an error because Armadillo
# uses bytes for its attributes, not str.
b: Mammal[str] = Armadillo()
# This should generate an error because Tapir
# doesn't provide an attributes.
c: Mammal[st... | Cow |
python | getsentry__sentry | src/sentry/models/transaction_threshold.py | {
"start": 3069,
"end": 4054
} | class ____(DefaultFieldsModelExisting):
__relocation_scope__ = RelocationScope.Excluded
project = FlexibleForeignKey("sentry.Project", unique=True, db_constraint=False)
organization = FlexibleForeignKey("sentry.Organization")
threshold = models.IntegerField()
metric = models.PositiveSmallIntegerFie... | ProjectTransactionThreshold |
python | great-expectations__great_expectations | great_expectations/expectations/core/expect_column_median_to_be_between.py | {
"start": 2711,
"end": 16008
} | class ____(ColumnAggregateExpectation):
__doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION}
ExpectColumnMedianToBeBetween is a \
Column Aggregate Expectation.
Column Aggregate Expectations are one of the most common types of Expectation.
They are evaluated for a single column, and produce an aggregate M... | ExpectColumnMedianToBeBetween |
python | scipy__scipy | scipy/sparse/tests/test_base.py | {
"start": 216169,
"end": 217435
} | class ____(_MatrixMixin, TestBSR):
spcreator = bsr_matrix
TestBSR.init_class()
TestBSRMatrix.init_class()
#------------------------------------------------------------------------------
# Tests for non-canonical representations (with duplicates, unsorted indices)
#-----------------------------------------------... | TestBSRMatrix |
python | openai__openai-python | src/openai/types/responses/response_input_item_param.py | {
"start": 4784,
"end": 5268
} | class ____(TypedDict, total=False):
id: Required[str]
"""The unique ID of the image generation call."""
result: Required[Optional[str]]
"""The generated image encoded in base64."""
status: Required[Literal["in_progress", "completed", "generating", "failed"]]
"""The status of the image generati... | ImageGenerationCall |
python | Netflix__metaflow | metaflow/plugins/argo/argo_workflows_decorator.py | {
"start": 297,
"end": 8282
} | class ____(StepDecorator):
name = "argo_workflows_internal"
defaults = {"auto-emit-argo-events": True}
def task_pre_step(
self,
step_name,
task_datastore,
metadata,
run_id,
task_id,
flow,
graph,
retry_count,
max_user_code_retr... | ArgoWorkflowsInternalDecorator |
python | allegroai__clearml | clearml/backend_api/services/v2_9/events.py | {
"start": 51079,
"end": 54346
} | class ____(Response):
"""
Response of events.get_multi_task_plots endpoint.
:param plots: Plots mapping (keyed by task name)
:type plots: dict
:param returned: Number of results returned
:type returned: int
:param total: Total number of results available for this query
:type total: floa... | GetMultiTaskPlotsResponse |
python | numba__numba | numba/cuda/simulator/kernelapi.py | {
"start": 1544,
"end": 3628
} | class ____(object):
'''
CUDA Shared arrays.
Limitations: assumes that only one call to cuda.shared.array is on a line,
and that that line is only executed once per thread. i.e.::
a = cuda.shared.array(...); b = cuda.shared.array(...)
will erroneously alias a and b, and::
for i in... | FakeCUDAShared |
python | pypa__warehouse | tests/unit/utils/test_paginate.py | {
"start": 2238,
"end": 4065
} | class ____:
def test_slices_and_length(self):
wrapper = paginate._OpenSearchWrapper(FakeQuery([1, 2, 3, 4, 5, 6]))
assert wrapper[1:3] == [2, 3]
assert len(wrapper) == 6
def test_slice_start_clamps_to_max(self):
wrapper = paginate._OpenSearchWrapper(FakeQuery([1, 2, 3, 4, 5, 6])... | TestOpenSearchWrapper |
python | pytorch__pytorch | test/dynamo/test_fx_passes_pre_grad.py | {
"start": 183,
"end": 1169
} | class ____(torch._dynamo.test_case.TestCase):
@mock.patch("torch._inductor.utils.ShapeProp.propagate")
def test_pass_execution_and_save(self, mock_shape_prop):
class TestModule(torch.nn.Module):
def __init__(self) -> None:
super().__init__()
self.param = torch... | FxPassesPreGradTests |
python | walkccc__LeetCode | solutions/897. Increasing Order Search Tree/897.py | {
"start": 0,
"end": 266
} | class ____:
def increasingBST(self, root: TreeNode, tail: TreeNode = None) -> TreeNode:
if not root:
return tail
res = self.increasingBST(root.left, root)
root.left = None
root.right = self.increasingBST(root.right, tail)
return res
| Solution |
python | PrefectHQ__prefect | tests/test_tasks.py | {
"start": 6192,
"end": 17505
} | class ____:
def test_sync_task_called_inside_sync_flow(self):
@task
def foo(x):
return x
@flow
def bar():
return foo(1)
assert bar() == 1
async def test_async_task_called_inside_async_flow(self):
@task
async def foo(x):
... | TestTaskCall |
python | getsentry__sentry | src/sentry/lang/native/sources.py | {
"start": 7429,
"end": 29662
} | class ____(Exception):
pass
def get_internal_url_prefix() -> str:
"""
Returns the `internal-url-prefix` normalized in such a way that it works in local
development environments.
"""
internal_url_prefix = options.get("system.internal-url-prefix")
if not internal_url_prefix:
internal... | InvalidSourcesError |
python | realpython__materials | rp-portfolio/projects/apps.py | {
"start": 36,
"end": 148
} | class ____(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "projects"
| ProjectsConfig |
python | getsentry__sentry | src/sentry_plugins/bitbucket/endpoints/webhook.py | {
"start": 3317,
"end": 5647
} | class ____(View):
_handlers = {"repo:push": PushEventWebhook}
def get_handler(self, event_type):
return self._handlers.get(event_type)
@method_decorator(csrf_exempt)
def dispatch(self, request: HttpRequest, *args, **kwargs) -> HttpResponseBase:
if request.method != "POST":
... | BitbucketPluginWebhookEndpoint |
python | spack__spack | lib/spack/spack/llnl/util/lang.py | {
"start": 13142,
"end": 20111
} | class ____(typing.MutableMapping[K, V]):
"""This is a hashable, comparable dictionary. Hash is performed on
a tuple of the values in the dictionary."""
__slots__ = ("dict",)
def __init__(self):
self.dict: Dict[K, V] = {}
def __getitem__(self, key: K) -> V:
return self.dict[key]
... | HashableMap |
python | sympy__sympy | sympy/core/function.py | {
"start": 27619,
"end": 28681
} | class ____(Function):
"""
Base class for expressions resulting from the application of an undefined
function.
"""
is_number = False
name: str
def __new__(cls, *args, **options) -> Expr: # type: ignore
args = tuple(map(sympify, args))
u = [a.name for a in args if isinstanc... | AppliedUndef |
python | gevent__gevent | src/gevent/_fileobjectcommon.py | {
"start": 2094,
"end": 2822
} | class ____(object):
def writeall(self, value):
"""
Similar to :meth:`socket.socket.sendall`, ensures that all the contents of
*value* have been written (though not necessarily flushed) before returning.
Returns the length of *value*.
.. versionadded:: 20.12.0
"""
... | WriteallMixin |
python | openai__openai-python | src/openai/types/beta/assistant_stream_event.py | {
"start": 5591,
"end": 5820
} | class ____(BaseModel):
data: Message
"""
Represents a message within a
[thread](https://platform.openai.com/docs/api-reference/threads).
"""
event: Literal["thread.message.completed"]
| ThreadMessageCompleted |
python | jazzband__prettytable | tests/test_prettytable.py | {
"start": 11290,
"end": 11962
} | class ____:
"""Make sure all options are properly overwritten by get_string."""
def test_border(self, city_data: PrettyTable) -> None:
assert city_data.get_string() != city_data.get_string(border=False)
def test_header(self, city_data: PrettyTable) -> None:
assert city_data.get_string() !=... | TestOptionOverride |
python | tensorflow__tensorflow | tensorflow/python/distribute/input_ops_test.py | {
"start": 10203,
"end": 12069
} | class ____(test.TestCase):
def _assert_datasets_equal(self, ds1, ds2):
# First lets assert the structure is the same.
self.assertTrue(
structure.are_compatible(ds1.element_spec, ds2.element_spec))
# Now create iterators on both and assert they produce the same values.
it1 = dataset_ops.make_... | CloneDatasetTest |
python | numba__numba | numba/experimental/function_type.py | {
"start": 1803,
"end": 12475
} | class ____(models.StructModel):
"""FunctionModel holds addresses of function implementations
"""
def __init__(self, dmm, fe_type):
members = [
# Address of cfunc wrapper function.
# This uses a C callconv and doesn't not support exceptions.
('c_addr', types.voidpt... | FunctionModel |
python | ray-project__ray | python/ray/serve/_private/common.py | {
"start": 26089,
"end": 26225
} | class ____:
"""Sent from the GRPC proxy to replicas on both unary and streaming codepaths."""
user_request_proto: Any
| gRPCRequest |
python | langchain-ai__langchain | libs/core/langchain_core/runnables/base.py | {
"start": 214416,
"end": 217272
} | class ____(Protocol[Input, Output]):
def __call__(
self, _in: AsyncIterator[Input], /, *, config: RunnableConfig
) -> AsyncIterator[Output]: ...
RunnableLike = (
Runnable[Input, Output]
| Callable[[Input], Output]
| Callable[[Input], Awaitable[Output]]
| Callable[[Iterator[Input]], Ite... | _RunnableCallableAsyncIterator |
python | django__django | django/tasks/exceptions.py | {
"start": 339,
"end": 437
} | class ____(TaskException):
"""The requested TaskResult does not exist."""
| TaskResultDoesNotExist |
python | django__django | tests/admin_views/admin.py | {
"start": 24921,
"end": 25043
} | class ____(admin.ModelAdmin):
def get_queryset(self, request):
return FilteredManager.objects
| CustomManagerAdmin |
python | streamlit__streamlit | lib/tests/streamlit/components/v2/test_bidi_presentation.py | {
"start": 962,
"end": 1283
} | class ____:
def __init__(self) -> None:
self.widget_metadata: dict[str, Any] = {}
self._payloads: dict[str, Any] = {}
def __getitem__(self, k: str) -> Any: # emulate WStates __getitem__
if k not in self._payloads:
raise KeyError(k)
return self._payloads[k]
| _FakeWStates |
python | huggingface__transformers | src/transformers/models/emu3/modeling_emu3.py | {
"start": 49998,
"end": 53011
} | class ____(Emu3PreTrainedModel, GenerationMixin):
_tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
_tp_plan = {"lm_head": "colwise_rep"}
_pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
config: Emu3TextConfig
def __init__(self, config):
super().__init__(config)
... | Emu3ForCausalLM |
python | conda__conda | conda/exceptions.py | {
"start": 13824,
"end": 13994
} | class ____(CondaError, EnvironmentError):
def __init__(self, message: str, *args):
msg = f"{message}"
super().__init__(msg, *args)
| CondaEnvironmentError |
python | GokuMohandas__MadeWithML | madewithml/data.py | {
"start": 5036,
"end": 5666
} | class ____:
"""Custom preprocessor class."""
def __init__(self, class_to_index={}):
self.class_to_index = class_to_index or {} # mutable defaults
self.index_to_class = {v: k for k, v in self.class_to_index.items()}
def fit(self, ds):
tags = ds.unique(column="tag")
self.cla... | CustomPreprocessor |
python | pennersr__django-allauth | allauth/templatetags/allauth.py | {
"start": 1115,
"end": 2182
} | class ____(template.Node):
def __init__(self, name, nodelist):
self.name = name
self.nodelist = nodelist
def render(self, context):
slots = context.render_context.get(SLOTS_CONTEXT_KEY)
with context.push():
if slots is None:
if self.name in context["s... | SlotNode |
python | joke2k__faker | faker/cli.py | {
"start": 3705,
"end": 9113
} | class ____:
def __init__(self, argv: Optional[str] = None) -> None:
self.argv = argv or sys.argv[:]
self.prog_name = Path(self.argv[0]).name
def execute(self) -> None:
"""
Given the command-line arguments, this creates a parser appropriate
to that command, and runs it.
... | Command |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_2.py | {
"start": 289,
"end": 335
} | class ____:
x: pandas.DataFrame
@dataclass
| C |
python | viewflow__viewflow | viewflow/views/list.py | {
"start": 4003,
"end": 6334
} | class ____(BaseColumn):
"""
Retrieve attribute value from external data source.
Data source attribute could be a property or callable.
For a callable, to get the value it would be called with model
instance.
"""
def __init__(self, data_source, attr_name, verbose_name=None):
super()... | DataSourceColumn |
python | davidhalter__jedi | test/completion/dynamic_params.py | {
"start": 2123,
"end": 2199
} | class ____():
#? str()
x_method = lambda self, a: a
X().x_method('')
| X |
python | getsentry__sentry | src/sentry/hybridcloud/rpc/__init__.py | {
"start": 4738,
"end": 8491
} | class ____(Generic[ServiceInterface]):
"""
It is possible to run monolith mode in a split database scenario -- in this case, the silo mode does not help
select the correct implementation to ensure non mingled transactions. This helper picks a backing implementation
by checking if an open transaction ex... | DelegatedByOpenTransaction |
python | jazzband__django-model-utils | tests/test_managers/test_softdelete_manager.py | {
"start": 114,
"end": 1056
} | class ____(TestCase):
def test_custom_manager_empty(self) -> None:
qs = CustomSoftDelete.available_objects.only_read()
self.assertEqual(qs.count(), 0)
def test_custom_qs_empty(self) -> None:
qs = CustomSoftDelete.available_objects.all().only_read()
self.assertEqual(qs.count(), ... | CustomSoftDeleteManagerTests |
python | huggingface__transformers | src/transformers/models/sam2_video/configuration_sam2_video.py | {
"start": 6705,
"end": 20462
} | class ____(PreTrainedConfig):
r"""
[`Sam2Config`] is the configuration class to store the configuration of a [`Sam2Model`]. It is used to instantiate a
SAM2 model according to the specified arguments, defining the memory attention, memory encoder, and image encoder
configs. Instantiating a configuration... | Sam2VideoConfig |
python | scikit-learn__scikit-learn | sklearn/impute/tests/test_base.py | {
"start": 341,
"end": 549
} | class ____(_BaseImputer):
def fit(self, X, y=None):
return self
def transform(self, X, y=None):
return self._concatenate_indicator(X, self._transform_indicator(X))
| NoFitIndicatorImputer |
python | pytorch__pytorch | torch/cuda/memory.py | {
"start": 51180,
"end": 54129
} | class ____(_MemPool):
r"""MemPool represents a pool of memory in a caching allocator. Currently,
it's just the ID of the pool object maintained in the CUDACachingAllocator.
Args:
allocator(torch._C._cuda_CUDAAllocator, optional): a
torch._C._cuda_CUDAAllocator object that can be used to... | MemPool |
python | scrapy__scrapy | tests/test_spiderloader/test_spiders/spider0.py | {
"start": 36,
"end": 112
} | class ____(Spider):
allowed_domains = ["scrapy1.org", "scrapy3.org"]
| Spider0 |
python | python-attrs__attrs | tests/test_make.py | {
"start": 34939,
"end": 34989
} | class ____:
@attr.s
class D:
pass
| GC |
python | python__mypy | mypyc/ir/rtypes.py | {
"start": 32140,
"end": 34974
} | class ____(RType):
"""union[x, ..., y]"""
is_unboxed = False
def __init__(self, items: list[RType]) -> None:
self.name = "union"
self.items = items
self.items_set = frozenset(items)
self._ctype = "PyObject *"
@staticmethod
def make_simplified_union(items: list[RTyp... | RUnion |
python | python-pillow__Pillow | src/PIL/DcxImagePlugin.py | {
"start": 977,
"end": 2145
} | class ____(PcxImageFile):
format = "DCX"
format_description = "Intel DCX"
_close_exclusive_fp_after_loading = False
def _open(self) -> None:
# Header
s = self.fp.read(4)
if not _accept(s):
msg = "not a DCX file"
raise SyntaxError(msg)
# Component... | DcxImageFile |
python | python-markdown__markdown | tests/test_extensions.py | {
"start": 1009,
"end": 2501
} | class ____(unittest.TestCase):
""" Test markdown.extensions.Extension. """
def setUp(self):
class TestExtension(markdown.extensions.Extension):
config = {
'foo': ['bar', 'Description of foo'],
'bar': ['baz', 'Description of bar']
}
self.e... | TestExtensionClass |
python | viewflow__viewflow | viewflow/this_object.py | {
"start": 1390,
"end": 2555
} | class ____(object):
"""
Helper for forward references to class attributes.
This class is used to defer the resolution of an attribute reference until
the class is fully constructed. This allows for the use of class attributes
before they are defined.
Attributes:
name (str): The name of... | ThisObject |
python | tensorflow__tensorflow | tensorflow/python/framework/tensor_shape_test.py | {
"start": 10304,
"end": 10826
} | class ____(test_util.TensorFlowTestCase):
def testSerialization(self):
shape_1 = tensor_shape.TensorShape([1, 2, 3])
shape_2 = tensor_shape.TensorShape([None, 2, None])
shape_3 = tensor_shape.TensorShape(None)
self.assertEqual(
trace_type.deserialize(trace_type.serialize(shape_1)), shape_1)
... | SerilizationTest |
python | readthedocs__readthedocs.org | readthedocs/api/v3/filters.py | {
"start": 417,
"end": 1002
} | class ____(filters.FilterSet):
# TODO this is copying the patterns from other filter sets, where the fields
# are all ``icontains`` lookups by default. We discussed reversing this
# pattern in the future though, see:
# https://github.com/readthedocs/readthedocs.org/issues/9862
name = filters.CharFil... | ProjectFilter |
python | mlflow__mlflow | dev/clint/src/clint/rules/unparameterized_generic_type.py | {
"start": 84,
"end": 902
} | class ____(Rule):
def __init__(self, type_hint: str) -> None:
self.type_hint = type_hint
@staticmethod
def is_generic_type(node: ast.Name | ast.Attribute, resolver: Resolver) -> bool:
if names := resolver.resolve(node):
return tuple(names) in {
("typing", "Callab... | UnparameterizedGenericType |
python | getsentry__sentry | src/sentry/sentry_apps/utils/webhooks.py | {
"start": 690,
"end": 791
} | class ____(SentryAppActionType):
CREATED = "created"
DELETED = "deleted"
| InstallationActionType |
python | ray-project__ray | python/ray/data/context.py | {
"start": 11505,
"end": 35651
} | class ____:
"""Global settings for Ray Data.
Configure this class to enable advanced features and tune performance.
.. warning::
Apply changes before creating a :class:`~ray.data.Dataset`. Changes made after
won't take effect.
.. note::
This object is automatically propagated ... | DataContext |
python | sphinx-doc__sphinx | tests/test_util/typing_test_data.py | {
"start": 1014,
"end": 1907
} | class ____:
def __repr__(self):
return 'CustomAnnotation'
def f11(x: CustomAnnotation(), y: 123) -> None:
pass
def f12() -> Tuple[int, str, int]:
pass
def f13() -> Optional[str]:
pass
def f14() -> Any:
pass
def f15(x: 'Unknown', y: 'int') -> Any: # NoQA: F821 # type: ignore[attr-... | CustomAnnotation |
python | has2k1__plotnine | plotnine/themes/theme_light.py | {
"start": 140,
"end": 1415
} | class ____(theme_gray):
"""
A theme similar to [](`~plotnine.themes.theme_linedraw.theme_linedraw`)
Has light grey lines lines and axes to direct more attention
towards the data.
Parameters
----------
base_size : int
Base font size. All text sizes are a scaled versions of
t... | theme_light |
python | geekcomputers__Python | venv/Lib/site-packages/pip/_vendor/rich/panel.py | {
"start": 467,
"end": 10705
} | class ____(JupyterMixin):
"""A console renderable that draws a border around its contents.
Example:
>>> console.print(Panel("Hello, World!"))
Args:
renderable (RenderableType): A console renderable object.
box (Box, optional): A Box instance that defines the look of the border (see... | Panel |
python | langchain-ai__langchain | libs/core/langchain_core/runnables/passthrough.py | {
"start": 20852,
"end": 26230
} | class ____(RunnableSerializable[dict[str, Any], Any]):
"""`Runnable` that picks keys from `dict[str, Any]` inputs.
`RunnablePick` class represents a `Runnable` that selectively picks keys from a
dictionary input. It allows you to specify one or more keys to extract
from the input dictionary.
!!! n... | RunnablePick |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.