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 | crytic__slither | slither/tools/upgradeability/checks/abstract_checks.py | {
"start": 983,
"end": 5050
} | class ____(metaclass=abc.ABCMeta):
ARGUMENT = ""
HELP = ""
IMPACT: CheckClassification = CheckClassification.UNIMPLEMENTED
WIKI = ""
WIKI_TITLE = ""
WIKI_DESCRIPTION = ""
WIKI_EXPLOIT_SCENARIO = ""
WIKI_RECOMMENDATION = ""
REQUIRE_CONTRACT = False
REQUIRE_PROXY = False
REQ... | AbstractCheck |
python | Lightning-AI__lightning | src/lightning/pytorch/cli.py | {
"start": 13848,
"end": 40146
} | class ____:
"""Implementation of a configurable command line tool for pytorch-lightning."""
def __init__(
self,
model_class: Optional[Union[type[LightningModule], Callable[..., LightningModule]]] = None,
datamodule_class: Optional[Union[type[LightningDataModule], Callable[..., Lightning... | LightningCLI |
python | pytorch__pytorch | test/dynamo/test_subclasses.py | {
"start": 120781,
"end": 123170
} | class ____(torch.nn.Module):
def forward(
self,
primals_1: "Sym(s51)", # PlainAOTInput(idx=0)
primals_8: "Sym(s51)", # SubclassSizeAOTInput(base=PlainAOTInput(idx=3), idx=0)
primals_10: "Sym(s55)", # SubclassStrideAOTInput(base=PlainAOTInput(idx=3), idx=1)
tangents_1: "f64... | GraphModule |
python | apache__airflow | task-sdk/src/airflow/sdk/execution_time/comms.py | {
"start": 16547,
"end": 17412
} | class ____(ConnectionResponse):
type: Literal["ConnectionResult"] = "ConnectionResult"
@classmethod
def from_conn_response(cls, connection_response: ConnectionResponse) -> ConnectionResult:
"""
Get ConnectionResult from ConnectionResponse.
ConnectionResponse is autogenerated from t... | ConnectionResult |
python | pytorch__pytorch | torch/testing/_internal/common_quantization.py | {
"start": 82467,
"end": 83085
} | class ____(torch.nn.Module):
def __init__(self) -> None:
super().__init__()
self.weight = torch.rand(3, 3, 3, 3)
self.bias = torch.rand(3)
self.stride = (1, 1)
self.padding = (0, 0)
self.dilation = (1, 1)
self.groups = 1
def forward(self, x):
retu... | FunctionalConv2d |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pyupgrade/UP004.py | {
"start": 46,
"end": 80
} | class ____(
object,
):
...
| A |
python | huggingface__transformers | src/transformers/models/sam2_video/modeling_sam2_video.py | {
"start": 34145,
"end": 37023
} | class ____(nn.Module):
"""Attention with rotary position encoding."""
def __init__(
self,
config: Sam2VideoConfig,
kv_in_dim: Optional[int] = None,
rope_k_repeat=False,
):
super().__init__()
self.config = config
self.hidden_size = config.memory_attent... | Sam2VideoRoPEAttention |
python | django-mptt__django-mptt | tests/myapp/tests.py | {
"start": 68757,
"end": 71427
} | class ____(TreeTestCase):
def test_insert_ordered_DFS_backwards_root_nodes(self):
rock = OrderedInsertion.objects.create(name="Rock")
OrderedInsertion.objects.create(name="Led Zeppelin", parent=rock)
OrderedInsertion.objects.create(name="Classical")
self.assertTreeEqual(
... | TestOrderedInsertionBFS |
python | google__jax | tests/debugger_test.py | {
"start": 1505,
"end": 11379
} | class ____(jtu.JaxTestCase):
def setUp(self):
super().setUp()
if not jtu.test_device_matches(["cpu", "gpu", "tpu"]):
self.skipTest(f"Host callback not supported on {jtu.device_under_test()}")
def test_debugger_eof(self):
stdin, stdout = make_fake_stdin_stdout([])
def f(x):
y = jnp.sin... | CliDebuggerTest |
python | django__django | django/contrib/postgres/fields/array.py | {
"start": 10429,
"end": 10508
} | class ____(ArrayRHSMixin, Exact):
pass
@ArrayField.register_lookup
| ArrayExact |
python | Pylons__pyramid | src/pyramid/util.py | {
"start": 21696,
"end": 22603
} | class ____:
def loads(self, bstruct):
return text_(bstruct)
def dumps(self, appstruct):
return bytes_(appstruct)
def is_bound_method(ob):
return inspect.ismethod(ob) and getattr(ob, '__self__', None) is not None
def is_unbound_method(fn):
"""
This consistently verifies that the ... | SimpleSerializer |
python | wandb__wandb | wandb/automations/automations.py | {
"start": 1553,
"end": 2712
} | class ____(GQLInput, extra="forbid", validate_default=False):
"""A new automation to be created."""
name: Optional[str] = None
"""The name of this automation."""
description: Optional[str] = None
"""An optional description of this automation."""
enabled: Optional[bool] = None
"""Whether t... | NewAutomation |
python | pyparsing__pyparsing | examples/pythonGrammarParser.py | {
"start": 6007,
"end": 8047
} | class ____(SemanticGroup):
def __init__(self, contents):
if len(contents) > 1:
self.rep = contents[1]
else:
self.rep = ""
if isinstance(contents, str):
self.contents = contents
else:
self.contents = contents[0]
def __str__(self):
... | Atom |
python | pytorch__pytorch | torch/_inductor/virtualized.py | {
"start": 6350,
"end": 8910
} | class ____(NullHandler):
"""
We need access `V.kernel.removed_buffers` in DeferredLine class when there
is no kernel in the context. This happens when codegening the wrapper.
Initialize `removed_buffers` and `inplaced_to_remove` explicitly so we don't
need call 'getattr' with default value which is ... | NullKernelHandler |
python | airbytehq__airbyte | airbyte-integrations/connectors/destination-databend/destination_databend/client.py | {
"start": 106,
"end": 852
} | class ____:
def __init__(self, host: str, port: int, database: str, table: str, username: str, ssl: bool, password: str = None):
self.host = host
self.port = port
self.database = database
self.table = table
self.username = username
self.password = password
sel... | DatabendClient |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/ext/hybrid.py | {
"start": 44128,
"end": 44940
} | class ____(QueryableAttribute[_T]):
"""Describe the object returned by a hybrid_property() when
called as a class-level descriptor.
"""
if TYPE_CHECKING:
def getter(
self, fget: _HybridGetterType[_T]
) -> hybrid_property[_T]: ...
def setter(
self, fset... | _HybridClassLevelAccessor |
python | wandb__wandb | wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py | {
"start": 635,
"end": 2744
} | class ____(ArtifactManifest):
manifest_version: Annotated[Literal[1], Field(repr=False)] = 1
entries: Dict[str, ArtifactManifestEntry] = Field(default_factory=dict)
storage_policy: StoragePolicy = Field(
default_factory=make_storage_policy, exclude=True, repr=False
)
@classmethod
def f... | ArtifactManifestV1 |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/variant_values/package.py | {
"start": 216,
"end": 888
} | class ____(Package):
"""Test variant value validation with multiple definitions."""
homepage = "https://www.example.org"
url = "https://example.org/files/v3.4/cmake-3.4.3.tar.gz"
version("1.0", md5="4cb3ff35b2472aae70f542116d616e63")
version("2.0", md5="b2472aae70f542116d616e634cb3ff35")
versi... | VariantValues |
python | squidfunk__mkdocs-material | material/plugins/blog/author.py | {
"start": 1672,
"end": 1754
} | class ____(Config):
authors = DictOfItems(SubConfig(Author), default = {})
| Authors |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/sparse_ops/sparse_matmul_op_test.py | {
"start": 1357,
"end": 4688
} | class ____(test.TestCase):
def _testCpuMatmul(self,
x,
y,
tr_a=False,
tr_b=False,
sp_a=True,
sp_b=False,
x_dtype=dtypes.float32,
y_dtype=dtypes.float... | SparseMatMulTest |
python | pypa__pipenv | pipenv/patched/pip/_vendor/rich/style.py | {
"start": 846,
"end": 26205
} | class ____:
"""A terminal style.
A terminal style consists of a color (`color`), a background color (`bgcolor`), and a number of attributes, such
as bold, italic etc. The attributes have 3 states: they can either be on
(``True``), off (``False``), or not set (``None``).
Args:
color (Union[... | Style |
python | ray-project__ray | rllib/algorithms/iql/iql.py | {
"start": 8230,
"end": 8458
} | class ____(MARWIL):
"""Implicit Q-learning (derived from MARWIL).
Uses MARWIL training step.
"""
@classmethod
@override(MARWIL)
def get_default_config(cls) -> AlgorithmConfig:
return IQLConfig()
| IQL |
python | wandb__wandb | wandb/integration/catboost/catboost.py | {
"start": 256,
"end": 5986
} | class ____:
"""`WandbCallback` automatically integrates CatBoost with wandb.
Args:
- metric_period: (int) if you are passing `metric_period` to your CatBoost model please pass the same value here (default=1).
Passing `WandbCallback` to CatBoost will:
- log training and validation metrics at ev... | WandbCallback |
python | google__flatbuffers | python/flatbuffers/compat.py | {
"start": 2133,
"end": 2373
} | class ____(RuntimeError):
"""Error raised when user tries to use a feature that
requires numpy without having numpy installed.
"""
pass
# NOTE: Future Jython support may require code here (look at `six`).
| NumpyRequiredForThisFeature |
python | sqlalchemy__sqlalchemy | test/dialect/oracle/test_types.py | {
"start": 40709,
"end": 47272
} | class ____(fixtures.TablesTest):
__only_on__ = "oracle"
__backend__ = True
run_inserts = "once"
run_deletes = None
@classmethod
def define_tables(cls, metadata):
Table(
"z_test",
metadata,
Column("id", Integer, primary_key=True),
Column("... | LOBFetchTest |
python | openai__openai-python | src/openai/types/realtime/response_mcp_call_arguments_done.py | {
"start": 205,
"end": 708
} | class ____(BaseModel):
arguments: str
"""The final JSON-encoded arguments string."""
event_id: str
"""The unique ID of the server event."""
item_id: str
"""The ID of the MCP tool call item."""
output_index: int
"""The index of the output item in the response."""
response_id: str
... | ResponseMcpCallArgumentsDone |
python | pypa__pip | tests/unit/test_utils_compatibility_tags.py | {
"start": 622,
"end": 1579
} | class ____:
def mock_get_config_var(self, **kwd: str) -> Callable[[str], Any]:
"""
Patch sysconfig.get_config_var for arbitrary keys.
"""
get_config_var = sysconfig.get_config_var
def _mock_get_config_var(var: str) -> Any:
if var in kwd:
return kw... | Testcompatibility_tags |
python | django__django | tests/generic_relations_regress/tests.py | {
"start": 551,
"end": 13936
} | class ____(TestCase):
def test_inherited_models_content_type(self):
"""
GenericRelations on inherited classes use the correct content type.
"""
p = Place.objects.create(name="South Park")
r = Restaurant.objects.create(name="Chubby's")
l1 = Link.objects.create(content_... | GenericRelationTests |
python | pytorch__pytorch | test/export/test_export.py | {
"start": 15894,
"end": 96401
} | class ____(TestCase):
def _test_export_same_as_eager(self, f, args, kwargs=None):
kwargs = kwargs or {}
exported_program = export(f, args, kwargs)
self.assertEqual(exported_program.module()(*args, **kwargs), f(*args, **kwargs))
# this is not supported by .module()
# reversed_... | TestExport |
python | mlflow__mlflow | mlflow/data/dataset.py | {
"start": 175,
"end": 4237
} | class ____:
"""
Represents a dataset for use with MLflow Tracking, including the name, digest (hash),
schema, and profile of the dataset as well as source information (e.g. the S3 bucket or
managed Delta table from which the dataset was derived). Most datasets expose features
and targets for trainin... | Dataset |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/abstractClass7.py | {
"start": 307,
"end": 519
} | class ____(RGB):
def __init__(self, red: int, green: int, blue: int) -> None:
self.rgb = red, green, blue
# This should generate an error because "intensity" is not implemented.
p = Point(1, 2, 3)
| Point |
python | getsentry__sentry | tests/sentry/dashboards/endpoints/test_organization_dashboards.py | {
"start": 737,
"end": 81341
} | class ____(OrganizationDashboardWidgetTestCase):
def setUp(self) -> None:
super().setUp()
self.login_as(self.user)
self.url = reverse(
"sentry-api-0-organization-dashboards",
kwargs={"organization_id_or_slug": self.organization.slug},
)
self.dashboard_... | OrganizationDashboardsTest |
python | ray-project__ray | python/ray/serve/tests/test_target_capacity.py | {
"start": 14009,
"end": 14858
} | class ____(BaseModel):
min_replicas: int
initial_replicas: Optional[int]
max_replicas: int
def create_autoscaling_controlled_app(
config: AutoscalingControllerAppConfig,
) -> Application:
min_replicas = config.min_replicas
initial_replicas = config.initial_replicas
max_replicas = config.ma... | AutoscalingControllerAppConfig |
python | huggingface__transformers | src/transformers/models/maskformer/modeling_maskformer_swin.py | {
"start": 1627,
"end": 2564
} | class ____(ModelOutput):
r"""
pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`):
Last layer hidden-state after a mean pooling operation.
hidden_states_spatial_dimensions (`tuple(tuple(int, int))`, *optional*):
A tuple containing the spatial dimension of each `hidden_st... | MaskFormerSwinModelOutputWithPooling |
python | wandb__wandb | wandb/sdk/lib/printer.py | {
"start": 12284,
"end": 15606
} | class ____(Printer):
def __init__(self, *, settings: wandb.Settings | None) -> None:
super().__init__()
self._settings = settings
self._progress = ipython.jupyter_progress_bar()
from IPython import display
self._ipython_display = display
@override
@contextlib.conte... | _PrinterJupyter |
python | ansible__ansible | lib/ansible/module_utils/facts/virtual/openbsd.py | {
"start": 2677,
"end": 2785
} | class ____(VirtualCollector):
_fact_class = OpenBSDVirtual
_platform = 'OpenBSD'
| OpenBSDVirtualCollector |
python | ray-project__ray | python/ray/train/v2/_internal/execution/scaling_policy/scaling_policy.py | {
"start": 362,
"end": 421
} | class ____(ScalingDecision):
pass
@dataclass
| NoopDecision |
python | huggingface__transformers | src/transformers/models/aria/modular_aria.py | {
"start": 53327,
"end": 54104
} | class ____(PreTrainedModel):
config: AriaTextConfig
base_model_prefix = "model"
input_modalities = ("image", "text")
_no_split_modules = ["AriaTextDecoderLayer", "AriaGroupedExpertsGemm"]
supports_gradient_checkpointing = True
_skip_keys_device_placement = "past_key_values"
_supports_flash_a... | AriaTextPreTrainedModel |
python | dask__dask | dask/dataframe/dask_expr/_reductions.py | {
"start": 41716,
"end": 43652
} | class ____(ReductionConstantDim):
_defaults = {
"sort": None,
"ascending": False,
"dropna": True,
"normalize": False,
"split_every": None,
"split_out": 1,
"total_length": None,
}
_parameters = [
"frame",
"sort",
"ascending",
... | ValueCounts |
python | prabhupant__python-ds | data_structures/bst/check_if_bt_if_bst.py | {
"start": 50,
"end": 493
} | class ____:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def check_BST(root, min, max):
if root is None:
return True
if root.val < min or root.val > max:
return False
return (check_BST(root.left, min, root.val - 1) and check_BST(... | Node |
python | kamyu104__LeetCode-Solutions | Python/merge-triplets-to-form-target-triplet.py | {
"start": 29,
"end": 424
} | class ____(object):
def mergeTriplets(self, triplets, target):
"""
:type triplets: List[List[int]]
:type target: List[int]
:rtype: bool
"""
result = [0]*3
for t in triplets:
if all(t[i] <= target[i] for i in xrange(3)):
result = [ma... | Solution |
python | walkccc__LeetCode | solutions/1387. Sort Integers by The Power Value/1387.py | {
"start": 0,
"end": 311
} | class ____:
def getKth(self, lo: int, hi: int, k: int) -> int:
return sorted([(self._getPow(i), i) for i in range(lo, hi + 1)])[k - 1][1]
def _getPow(self, n: int) -> int:
if n == 1:
return 0
if n % 2 == 0:
return 1 + self._getPow(n // 2)
return 1 + self._getPow(n * 3 + 1)
| Solution |
python | pdm-project__pdm | src/pdm/exceptions.py | {
"start": 1038,
"end": 1266
} | class ____(PDMWarning):
def __init__(self, project_name: str, extras: list[str]) -> None:
super().__init__(f"Extras not found for {project_name}: [{','.join(extras)}]")
self.extras = tuple(extras)
| ExtrasWarning |
python | mlflow__mlflow | mlflow/genai/optimize/optimizers/gepa_optimizer.py | {
"start": 389,
"end": 9684
} | class ____(BasePromptOptimizer):
"""
A prompt adapter that uses GEPA (Genetic-Pareto) optimization algorithm
to optimize prompts.
GEPA uses iterative mutation, reflection, and Pareto-aware candidate selection
to improve text components like prompts. It leverages large language models to
reflect... | GepaPromptOptimizer |
python | geekcomputers__Python | game_of_life/05_mixed_sorting.py | {
"start": 1277,
"end": 1593
} | class ____(unittest.TestCase):
def test_1(self):
self.assertEqual(mixed_sorting([8, 13, 11, 90, -5, 4]), [4, 13, 11, 8, -5, 90])
def test_2(self):
self.assertEqual(mixed_sorting([1, 2, 3, 6, 5, 4]), [5, 2, 3, 4, 1, 6])
if __name__ == "__main__":
unittest.main(verbosity=2)
| TestMixedSorting |
python | sphinx-doc__sphinx | sphinx/domains/cpp/_ast.py | {
"start": 56816,
"end": 57880
} | class ____(ASTOperator):
def __init__(self, identifier: ASTIdentifier) -> None:
self.identifier = identifier
def __eq__(self, other: object) -> bool:
if not isinstance(other, ASTOperatorLiteral):
return NotImplemented
return self.identifier == other.identifier
def __has... | ASTOperatorLiteral |
python | keras-team__keras | keras/src/trainers/data_adapters/py_dataset_adapter.py | {
"start": 18965,
"end": 23990
} | class ____(PyDatasetEnqueuer):
"""Builds a Enqueuer from a PyDataset.
Args:
py_dataset: A `keras.utils.PyDataset` object.
use_multiprocessing: use multiprocessing if True, otherwise threading
shuffle: whether to shuffle the data at the beginning of each epoch
"""
def __init__(
... | OrderedEnqueuer |
python | PyCQA__bandit | bandit/plugins/django_xss.py | {
"start": 178,
"end": 10302
} | class ____:
def __init__(self, var_name, ignore_nodes=None):
self.var_name = var_name
self.ignore_nodes = ignore_nodes
def is_assigned_in(self, items):
assigned = []
for ast_inst in items:
new_assigned = self.is_assigned(ast_inst)
if new_assigned:
... | DeepAssignation |
python | doocs__leetcode | solution/3200-3299/3281.Maximize Score of Numbers in Ranges/Solution.py | {
"start": 0,
"end": 543
} | class ____:
def maxPossibleScore(self, start: List[int], d: int) -> int:
def check(mi: int) -> bool:
last = -inf
for st in start:
if last + mi > st + d:
return False
last = max(st, last + mi)
return True
start.s... | Solution |
python | huggingface__transformers | src/transformers/models/tvp/image_processing_tvp.py | {
"start": 3115,
"end": 23148
} | class ____(BaseImageProcessor):
r"""
Constructs a Tvp image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the
`do_resize` parameter in the `preproces... | TvpImageProcessor |
python | RaRe-Technologies__gensim | gensim/test/test_text_analysis.py | {
"start": 3735,
"end": 4952
} | class ____(BaseTestCases.TextAnalyzerTestBase):
accumulator_cls = InvertedIndexAccumulator
def test_accumulate1(self):
accumulator = InvertedIndexAccumulator(self.top_ids, self.dictionary)\
.accumulate(self.texts, 2)
# [['this', 'is'], ['is', 'a'], ['test', 'document'], ['this', 'te... | TestInvertedIndexAccumulator |
python | Textualize__textual | tests/snapshot_tests/snapshot_apps/digits.py | {
"start": 80,
"end": 789
} | class ____(App):
CSS = """
.left {
text-align: left;
}
.center {
text-align:center;
}
.right {
text-align:right;
}
.bold {
text-style: bold;
}
"""
def compose(self) -> ComposeResult:
yield Digits("3.14159265359", classes="left")
... | DigitApp |
python | python__mypy | mypyc/irbuild/context.py | {
"start": 4005,
"end": 5694
} | class ____:
"""Contains information regarding implicitly generated classes.
Implicit classes are generated for nested functions and generator
functions. They are not explicitly defined in the source code.
NOTE: This is both a concrete class and used as a base class.
"""
def __init__(self, ir:... | ImplicitClass |
python | pandas-dev__pandas | pandas/tests/scalar/timestamp/test_arithmetic.py | {
"start": 310,
"end": 10855
} | class ____:
def test_overflow_offset(self):
# no overflow expected
stamp = Timestamp("2000/1/1")
offset_no_overflow = to_offset("D") * 100
expected = Timestamp("2000/04/10")
assert stamp + offset_no_overflow == expected
assert offset_no_overflow + stamp == expected... | TestTimestampArithmetic |
python | modin-project__modin | asv_bench/benchmarks/benchmarks.py | {
"start": 25670,
"end": 28129
} | class ____:
param_names = ["shape", "dtype", "index_structure"]
params = [
get_benchmark_shapes("TimeIndexingNumericSeries"),
(np.int64, np.uint64, np.float64),
("unique_monotonic_inc", "nonunique_monotonic_inc"),
]
def setup(self, shape, dtype, index_structure):
N = sha... | TimeIndexingNumericSeries |
python | lazyprogrammer__machine_learning_examples | svm_class/kernel_svm_gradient_primal.py | {
"start": 1194,
"end": 5976
} | class ____:
def __init__(self, kernel=linear, C=1.0):
self.C = C
self.kernel = kernel
def _objective(self, margins):
return 0.5 * self.u.dot(self.K.dot(self.u)) + \
self.C * np.maximum(0, 1 - margins).sum()
def fit(self, X, Y, lr=1e-5, n_iters=400):
N, D = X.shape
self.N = N
self.u... | KernelSVM |
python | HypothesisWorks__hypothesis | hypothesis-python/tests/nocover/test_stateful.py | {
"start": 1403,
"end": 2122
} | class ____(RuleBasedStateMachine):
trees = Bundle("BinaryTree")
@rule(target=trees, x=st.booleans())
def leaf(self, x):
return Leaf(x)
@rule(target=trees, left=trees, right=trees)
def split(self, left, right):
return Split(left, right)
@rule(tree=trees)
def test_is_balance... | BalancedTrees |
python | scipy__scipy | scipy/special/tests/test_basic.py | {
"start": 172676,
"end": 174835
} | class ____:
def test_pbdn_seq(self):
pb = special.pbdn_seq(1, .1)
assert_allclose(pb, (array([0.9975,
0.0998]),
array([-0.0499,
0.9925])),
atol=1.5e-4, rtol=0)
def test_p... | TestParabolicCylinder |
python | django__django | django/contrib/admin/checks.py | {
"start": 30992,
"end": 47579
} | class ____(BaseModelAdminChecks):
def check(self, admin_obj, **kwargs):
return [
*super().check(admin_obj),
*self._check_save_as(admin_obj),
*self._check_save_on_top(admin_obj),
*self._check_inlines(admin_obj),
*self._check_list_display(admin_obj),... | ModelAdminChecks |
python | getsentry__sentry | src/sentry/api/endpoints/organization_events_spans_performance.py | {
"start": 21031,
"end": 28885
} | class ____(BaseQueryBuilder):
config_class = DiscoverDatasetConfig
def resolve_span_function(
self,
function: str,
span: Span,
alias: str,
min_exclusive_time: float | None = None,
max_exclusive_time: float | None = None,
) -> Function:
op = span.op
... | SpanQueryBuilder |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/sql/functions.py | {
"start": 60677,
"end": 60800
} | class ____(AnsiFunction[str]):
"""The USER() SQL function."""
type = sqltypes.String()
inherit_cache = True
| user |
python | doocs__leetcode | solution/2500-2599/2500.Delete Greatest Value in Each Row/Solution.py | {
"start": 0,
"end": 180
} | class ____:
def deleteGreatestValue(self, grid: List[List[int]]) -> int:
for row in grid:
row.sort()
return sum(max(col) for col in zip(*grid))
| Solution |
python | plotly__plotly.py | plotly/graph_objs/layout/mapbox/_layer.py | {
"start": 235,
"end": 24492
} | class ____(_BaseLayoutHierarchyType):
_parent_path_str = "layout.mapbox"
_path_str = "layout.mapbox.layer"
_valid_props = {
"below",
"circle",
"color",
"coordinates",
"fill",
"line",
"maxzoom",
"minzoom",
"name",
"opacity",
... | Layer |
python | apache__airflow | task-sdk/src/airflow/sdk/execution_time/comms.py | {
"start": 5931,
"end": 6154
} | class ____(_RequestFrame, frozen=True):
id: int
"""
The id of the request this is a response to
"""
body: dict[str, Any] | None = None
error: dict[str, Any] | None = None
@attrs.define()
| _ResponseFrame |
python | RaRe-Technologies__gensim | gensim/models/bm25model.py | {
"start": 5062,
"end": 9637
} | class ____(BM25ABC):
"""The original Okapi BM25 scoring function of Robertson et al. [2]_.
Examples
--------
.. sourcecode:: pycon
>>> from gensim.corpora import Dictionary
>>> from gensim.models import OkapiBM25Model
>>> from gensim.test.utils import common_texts
>>>
... | OkapiBM25Model |
python | huggingface__transformers | tests/models/phi4_multimodal/test_modeling_phi4_multimodal.py | {
"start": 6563,
"end": 9398
} | class ____(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
"""
Model tester for `Phi4Multimodal`.
"""
all_model_classes = (Phi4MultimodalForCausalLM, Phi4MultimodalModel) if is_torch_available() else ()
_is_composite = True
def setUp(self):
self.model_tester = Phi4Multimo... | Phi4MultimodalModelTest |
python | doocs__leetcode | solution/1800-1899/1807.Evaluate the Bracket Pairs of a String/Solution.py | {
"start": 0,
"end": 427
} | class ____:
def evaluate(self, s: str, knowledge: List[List[str]]) -> str:
d = {a: b for a, b in knowledge}
i, n = 0, len(s)
ans = []
while i < n:
if s[i] == '(':
j = s.find(')', i + 1)
ans.append(d.get(s[i + 1 : j], '?'))
i... | Solution |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/classes1.py | {
"start": 644,
"end": 699
} | class ____(E, metaclass=type, metaclass=type):
pass
| H |
python | PrefectHQ__prefect | tests/server/models/test_flows.py | {
"start": 10151,
"end": 10825
} | class ____:
async def test_delete_flow(self, session):
# create a flow to delete
flow = await models.flows.create_flow(
session=session, flow=schemas.core.Flow(name="my-flow")
)
assert flow.name == "my-flow"
assert await models.flows.delete_flow(session=session, ... | TestDeleteFlow |
python | milvus-io__pymilvus | tests/test_search_iterator.py | {
"start": 310,
"end": 6563
} | class ____:
@pytest.fixture
def mock_connection(self):
connection = Mock()
connection.describe_collection.return_value = {"collection_id": "test_id"}
return connection
@pytest.fixture
def search_data(self):
rng = np.random.default_rng(seed=19530)
return rng.rando... | TestSearchIteratorV2 |
python | HypothesisWorks__hypothesis | hypothesis-python/tests/cover/test_direct_strategies.py | {
"start": 22399,
"end": 26038
} | class ____(enum.Enum):
a = 1
def requires_arg(value):
"""Similar to the enum.Enum.__call__ method."""
@given(st.data())
def test_builds_error_messages(data):
# If we call them directly, we get a simple TypeError in both cases
with pytest.raises(TypeError):
requires_arg()
with pytest.rais... | AnEnum |
python | apache__airflow | airflow-core/src/airflow/executors/workloads.py | {
"start": 1726,
"end": 1863
} | class ____(BaseModel):
"""Schema for telling task which bundle to run with."""
name: str
version: str | None = None
| BundleInfo |
python | scipy__scipy | scipy/integrate/tests/test_integrate.py | {
"start": 652,
"end": 1834
} | class ____:
# Check integrate.odeint
def _do_problem(self, problem):
t = arange(0.0, problem.stop_t, 0.05)
# Basic case
z, infodict = odeint(problem.f, problem.z0, t, full_output=True)
assert_(problem.verify(z, t))
# Use tfirst=True
z, infodict = odeint(lambda ... | TestOdeint |
python | readthedocs__readthedocs.org | readthedocs/api/v3/filters.py | {
"start": 2423,
"end": 2677
} | class ____(filters.FilterSet):
name = filters.CharFilter(field_name="name", lookup_expr="icontains")
class Meta:
model = RemoteOrganization
fields = [
"name",
"vcs_provider",
]
| RemoteOrganizationFilter |
python | getsentry__sentry | tests/sentry/search/events/builder/test_errors.py | {
"start": 532,
"end": 4558
} | class ____(TestCase):
def setUp(self) -> None:
self.projects = [self.project.id]
@pytest.mark.querybuilder
def test_simple_query(self) -> None:
query = ErrorsQueryBuilder(
dataset=Dataset.Events,
query="status:unresolved",
selected_columns=["count_unique(... | ErrorsQueryBuilderTest |
python | celery__celery | celery/loaders/base.py | {
"start": 734,
"end": 9147
} | class ____:
"""Base class for loaders.
Loaders handles,
* Reading celery client/worker configurations.
* What happens when a task starts?
See :meth:`on_task_init`.
* What happens when the worker starts?
See :meth:`on_worker_init`.
* What happens when ... | BaseLoader |
python | getsentry__sentry | src/sentry/sentry_apps/api/serializers/servicehook.py | {
"start": 143,
"end": 487
} | class ____(Serializer):
def serialize(self, obj, attrs, user, **kwargs):
return {
"id": obj.guid,
"url": obj.url,
"secret": obj.secret,
"status": obj.get_status_display(),
"events": sorted(obj.events),
"dateCreated": obj.date_added,
... | ServiceHookSerializer |
python | apache__airflow | providers/microsoft/azure/src/airflow/providers/microsoft/azure/sensors/wasb.py | {
"start": 4326,
"end": 7397
} | class ____(BaseSensorOperator):
"""
Wait for blobs matching a prefix to arrive on Azure Blob Storage.
:param container_name: Name of the container.
:param prefix: Prefix of the blob.
:param wasb_conn_id: Reference to the wasb connection.
:param check_options: Optional keyword arguments that
... | WasbPrefixSensor |
python | xlwings__xlwings | tests/test_range.py | {
"start": 30818,
"end": 31598
} | class ____(TestBase):
def test_cell_errors_default(self):
wb = xw.Book(Path(this_dir) / "cell_errors.xlsx")
sheet = wb.sheets[0]
for i in range(1, 8):
self.assertIsNone(sheet.range((i, 1)).value)
wb.close()
def test_cell_errors_str(self):
wb = xw.Book(Path(t... | TestCellErrors |
python | pypa__twine | twine/exceptions.py | {
"start": 5166,
"end": 5298
} | class ____(TwineException):
"""Raised if we expected to use trusted publishing but couldn't."""
pass
| TrustedPublishingFailure |
python | ray-project__ray | rllib/env/tests/test_pettingzoo_env.py | {
"start": 762,
"end": 3904
} | class ____(unittest.TestCase):
def setUp(self) -> None:
ray.init()
def tearDown(self) -> None:
ray.shutdown()
def test_pettingzoo_pistonball_v6_policies_are_dict_env(self):
def env_creator(config):
env = pistonball_v6.env()
env = dtype_v0(env, dtype=float32)... | TestPettingZooEnv |
python | spack__spack | lib/spack/spack/cmd/info.py | {
"start": 1176,
"end": 4935
} | class ____:
"""Generic formatter for elements displayed by `spack info`.
Elements have four parts: name, values, when condition, and description. They can
be formatted two ways (shown here for variants):
Grouped by when (default)::
when +cuda
cuda_arch [none] ... | Formatter |
python | milvus-io__pymilvus | pymilvus/client/abstract.py | {
"start": 11160,
"end": 13651
} | class ____:
def __init__(self, raw: Any):
self._raw = raw
self._primary_keys = []
self._insert_cnt = 0
self._delete_cnt = 0
self._upsert_cnt = 0
self._timestamp = 0
self._succ_index = []
self._err_index = []
self._cost = 0
self._pack(r... | MutationResult |
python | getsentry__sentry | src/sentry/overwatch_webhooks/webhook_publisher.py | {
"start": 298,
"end": 1659
} | class ____:
_publisher_client: PublisherClient
_region: Region
_integration_provider: str
def __init__(self, integration_provider: str, region: Region):
self._integration_provider = integration_provider
self._region = region
def enqueue_webhook(self, webhook_details: WebhookDetails... | OverwatchWebhookPublisher |
python | sqlalchemy__sqlalchemy | test/dialect/postgresql/test_types.py | {
"start": 202928,
"end": 203030
} | class ____(
_NumMultiRangeTests, _MultiRangeTypeCompilation
):
pass
| NumMultiRangeCompilationTest |
python | pandas-dev__pandas | pandas/util/_doctools.py | {
"start": 214,
"end": 6911
} | class ____:
"""
Layout some DataFrames in vertical/horizontal layout for explanation.
Used in merging.rst
"""
def __init__(
self,
cell_width: float = 0.37,
cell_height: float = 0.25,
font_size: float = 7.5,
) -> None:
self.cell_width = cell_width
... | TablePlotter |
python | pandas-dev__pandas | pandas/tests/arithmetic/test_period.py | {
"start": 16206,
"end": 19409
} | class ____:
"""Test PeriodIndex and Period Series Ops consistency"""
# TODO: needs parametrization+de-duplication
def _check(self, values, func, expected):
# Test PeriodIndex and Period Series Ops consistency
idx = PeriodIndex(values)
result = func(idx)
# check that we do... | TestPeriodIndexSeriesComparisonConsistency |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/storage/event_log/base.py | {
"start": 5689,
"end": 6567
} | class ____(
LoadableBy[AssetCheckKey],
):
asset_check_key: AssetCheckKey
last_check_execution_record: Optional[AssetCheckExecutionRecord]
last_run_id: Optional[str]
last_completed_check_execution_record: Optional[AssetCheckExecutionRecord]
@classmethod
def _blocking_batch_load(
cls,... | AssetCheckSummaryRecord |
python | mlflow__mlflow | mlflow/server/graphql/autogenerated_graphql_schema.py | {
"start": 1943,
"end": 2791
} | class ____(graphene.ObjectType):
name = graphene.String()
version = graphene.String()
creation_timestamp = LongString()
last_updated_timestamp = LongString()
user_id = graphene.String()
current_stage = graphene.String()
description = graphene.String()
source = graphene.String()
run_i... | MlflowModelVersion |
python | getsentry__sentry | src/sentry/core/endpoints/team_members.py | {
"start": 1082,
"end": 1408
} | class ____(OrganizationMemberResponse):
# NOTE: We override users to be required b/c team members will always have
# an existing user to be part of a team.
user: UserSerializerResponse # type: ignore[misc]
teamRole: str | None
teamSlug: str
@register(OrganizationMemberTeam)
| OrganizationMemberOnTeamResponse |
python | airbytehq__airbyte | airbyte-ci/connectors/connectors_qa/src/connectors_qa/models.py | {
"start": 861,
"end": 1009
} | class ____(Enum):
"""The status of a QA check"""
PASSED = "✅ Passed"
FAILED = "❌ Failed"
SKIPPED = "🔶 Skipped"
@dataclass
| CheckStatus |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/dataclassHash1.py | {
"start": 264,
"end": 332
} | class ____:
a: int
v2: Hashable = DC2(0)
@dataclass(eq=True)
| DC2 |
python | huggingface__transformers | src/transformers/models/resnet/modeling_resnet.py | {
"start": 1251,
"end": 1999
} | class ____(nn.Module):
def __init__(
self, in_channels: int, out_channels: int, kernel_size: int = 3, stride: int = 1, activation: str = "relu"
):
super().__init__()
self.convolution = nn.Conv2d(
in_channels, out_channels, kernel_size=kernel_size, stride=stride, padding=kerne... | ResNetConvLayer |
python | apache__airflow | providers/teradata/tests/unit/teradata/operators/test_bteq.py | {
"start": 1073,
"end": 11281
} | class ____:
@mock.patch.object(BteqHook, "execute_bteq_script")
@mock.patch.object(BteqHook, "__init__", return_value=None)
def test_execute(self, mock_hook_init, mock_execute_bteq):
task_id = "test_bteq_operator"
sql = "SELECT * FROM my_table;"
teradata_conn_id = "teradata_default"
... | TestBteqOperator |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/callbackProtocol2.py | {
"start": 394,
"end": 504
} | class ____:
def __call__(self, inputs) -> int:
return 5
g1: MyCallable[int, int] = Class1()
| Class1 |
python | huggingface__transformers | src/transformers/models/instructblip/modeling_instructblip.py | {
"start": 37480,
"end": 45987
} | class ____(InstructBlipPreTrainedModel):
main_input_name = "pixel_values"
_keep_in_fp32_modules = ["query_tokens"] # TODO @ArthurZucker I don't know why this is required for FP8
def __init__(self, config: InstructBlipConfig):
super().__init__(config)
self.vision_model = InstructBlipVision... | InstructBlipModel |
python | ipython__ipython | IPython/core/tbtools.py | {
"start": 10678,
"end": 16880
} | class ____:
"""Basic tools used by all traceback printer classes."""
# Number of frames to skip when reporting tracebacks
tb_offset = 0
_theme_name: str
_old_theme_name: str
call_pdb: bool
ostream: Any
debugger_cls: Any
pdb: Any
def __init__(
self,
color_scheme:... | TBTools |
python | openai__openai-python | src/openai/types/beta/realtime/transcription_session.py | {
"start": 2275,
"end": 3184
} | class ____(BaseModel):
client_secret: ClientSecret
"""Ephemeral key returned by the API.
Only present when the session is created on the server via REST API.
"""
input_audio_format: Optional[str] = None
"""The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`."""
inp... | TranscriptionSession |
python | huggingface__transformers | src/transformers/models/depth_anything/modeling_depth_anything.py | {
"start": 9802,
"end": 12226
} | class ____(nn.Module):
"""
Output head consisting of 3 convolutional layers. It progressively halves the feature dimension and upsamples
the predictions to the input resolution after the first convolutional layer (details can be found in the DPT paper's
supplementary material). The final activation func... | DepthAnythingDepthEstimationHead |
python | openai__openai-python | src/openai/_models.py | {
"start": 1534,
"end": 1610
} | class ____(Protocol):
allow_population_by_field_name: bool
| _ConfigProtocol |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.