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 | tensorflow__tensorflow | tensorflow/python/ops/distributions/bijector_impl.py | {
"start": 4512,
"end": 43050
} | class ____(metaclass=abc.ABCMeta):
r"""Interface for transformations of a `Distribution` sample.
Bijectors can be used to represent any differentiable and injective
(one to one) function defined on an open subset of `R^n`. Some non-injective
transformations are also supported (see "Non Injective Transforms" b... | Bijector |
python | getsentry__sentry | src/sentry/models/rule.py | {
"start": 1014,
"end": 5479
} | class ____(Model):
__relocation_scope__ = RelocationScope.Organization
DEFAULT_CONDITION_MATCH = "all" # any, all
DEFAULT_FILTER_MATCH = "all" # match to apply on filters
DEFAULT_FREQUENCY = 30 # minutes
project = FlexibleForeignKey("sentry.Project")
environment_id = BoundedPositiveIntegerF... | Rule |
python | huggingface__transformers | src/transformers/models/d_fine/modular_d_fine.py | {
"start": 49945,
"end": 50650
} | class ____(RTDetrConvNormLayer):
def __init__(
self,
config: DFineConfig,
in_channels: int,
out_channels: int,
kernel_size: int,
stride: int,
groups: int = 1,
padding: Optional[int] = None,
activation: Optional[str] = None,
):
super... | DFineConvNormLayer |
python | mlflow__mlflow | mlflow/cli/genai_eval_utils.py | {
"start": 824,
"end": 1108
} | class ____:
"""
Structured cell data for table display with metadata.
"""
value: str
"""The formatted display value for the cell"""
assessment: Assessment | None = None
"""The assessment data for this cell, if it represents an assessment"""
@dataclass
| Cell |
python | davidhalter__jedi | jedi/inference/value/dynamic_arrays.py | {
"start": 5000,
"end": 6300
} | class ____(HelperValueMixin):
"""
Used for the usage of set() and list().
This is definitely a hack, but a good one :-)
It makes it possible to use set/list conversions.
This is not a proper context, because it doesn't have to be. It's not used
in the wild, it's just used within typeshed as an ... | _DynamicArrayAdditions |
python | tensorflow__tensorflow | tensorflow/python/distribute/combinations_test.py | {
"start": 7556,
"end": 8056
} | class ____(test.TestCase, parameterized.TestCase):
@combinations.generate(
combinations.combine(
tf_function_1=combinations.tf_function,
tf_function_2=combinations.no_tf_function,
mode="eager",
))
def testFunc(self, tf_function_1, tf_function_2):
@tf_function_1
de... | TfFunctionTest |
python | facebook__pyre-check | tools/incremental_test/specification.py | {
"start": 9969,
"end": 10456
} | class ____(SingleUpdate):
patch: str
patch_flags: str
def update(self, environment: Environment, working_directory: Path) -> None:
environment.checked_run(
working_directory=working_directory,
command=f"patch {self.patch_flags}",
stdin=self.patch,
)
... | PatchRepositoryUpdate |
python | numba__numba | numba/experimental/jitclass/base.py | {
"start": 1325,
"end": 2554
} | class ____(models.StructModel):
def __init__(self, dmm, fe_typ):
clsty = fe_typ.class_type
members = [(_mangle_attr(k), v) for k, v in clsty.struct.items()]
super(InstanceDataModel, self).__init__(dmm, fe_typ, members)
default_manager.register(types.ClassInstanceType, InstanceModel)
defaul... | InstanceDataModel |
python | getsentry__sentry | tests/sentry/users/api/bases/test_user.py | {
"start": 4943,
"end": 5093
} | class ____(BaseUserEndpointTest):
endpoint = UserEndpoint()
# TODO(HC): Delete this once region silo by default changes land
| ControlUserEndpointTest |
python | coleifer__peewee | tests/regressions.py | {
"start": 34910,
"end": 35008
} | class ____(TestModel):
site = ForeignKeyField(Site, backref='pages')
title = TextField()
| Page |
python | doocs__leetcode | solution/0800-0899/0834.Sum of Distances in Tree/Solution.py | {
"start": 0,
"end": 728
} | class ____:
def sumOfDistancesInTree(self, n: int, edges: List[List[int]]) -> List[int]:
def dfs1(i: int, fa: int, d: int):
ans[0] += d
size[i] = 1
for j in g[i]:
if j != fa:
dfs1(j, i, d + 1)
size[i] += size[j]
... | Solution |
python | pytorch__pytorch | torch/onnx/_internal/torchscript_exporter/registration.py | {
"start": 6595,
"end": 11182
} | class ____:
"""Registry for symbolic functions.
The registry maintains a mapping from qualified names to symbolic functions.
It is used to register new symbolic functions and to dispatch calls to
the appropriate function.
"""
def __init__(self) -> None:
self._registry: dict[str, _Symbo... | SymbolicRegistry |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_bigquery.py | {
"start": 97318,
"end": 101982
} | class ____:
@pytest.mark.parametrize(
("check_type", "check_value", "check_result"),
[
("equal_to", 0, 0),
("greater_than", 0, 1),
("less_than", 0, -1),
("geq_to", 0, 1),
("geq_to", 0, 0),
("leq_to", 0, 0),
("leq_to"... | TestBigQueryColumnCheckOperator |
python | pytorch__pytorch | torch/fx/experimental/meta_tracer.py | {
"start": 1915,
"end": 3590
} | class ____(torch.fx.Proxy):
def install_tensor_meta(self, tensor_meta):
self._tensor_meta = tensor_meta
def size(self, dim=None):
if hasattr(self, "_tensor_meta") and self._tensor_meta is not None:
return self._tensor_meta.size(*[dim] if dim else [])
return self.tracer.creat... | MetaProxy |
python | pdm-project__pdm | src/pdm/termui.py | {
"start": 3141,
"end": 3590
} | class ____:
if is_legacy_windows():
SUCC = "v"
FAIL = "x"
LOCK = " "
POPPER = " "
ELLIPSIS = "..."
ARROW_SEPARATOR = ">"
else:
SUCC = ":heavy_check_mark:"
FAIL = ":heavy_multiplication_x:"
LOCK = ":lock:"
POPPER = ":party_popper:"
... | Emoji |
python | ApeWorX__ape | src/ape/api/transactions.py | {
"start": 10158,
"end": 22311
} | class ____(ExtraAttributesMixin, BaseInterfaceModel):
"""
An abstract class to represent a transaction receipt. The receipt
contains information about the transaction, such as the status
and required confirmations.
**NOTE**: Use a ``required_confirmations`` of ``0`` in your transaction
to not w... | ReceiptAPI |
python | scipy__scipy | benchmarks/benchmarks/fft_basic.py | {
"start": 8805,
"end": 10009
} | class ____(Benchmark):
params = [
['100x100', '1000x100', '256x256', '512x512'],
[1, 8, 32, 100],
['workers', 'threading']
]
param_names = ['size', 'num_transforms', 'method']
def setup(self, size, num_transforms, method):
if not has_scipy_fft:
raise NotImple... | FftThreading |
python | tensorflow__tensorflow | tensorflow/python/data/util/options_test.py | {
"start": 1268,
"end": 1413
} | class ____(options.OptionsBase):
opts = options.create_option(
name="opts", ty=_TestOptions, docstring="nested options")
| _NestedTestOptions |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 78208,
"end": 78555
} | class ____(sgqlc.types.Enum):
"""The possible target states when updating a pull request.
Enumeration Choices:
* `CLOSED`: A pull request that has been closed without being
merged.
* `OPEN`: A pull request that is still open.
"""
__schema__ = github_schema
__choices__ = ("CLOSED", "... | PullRequestUpdateState |
python | nmslib__hnswlib | tests/python/bindings_test_metadata.py | {
"start": 54,
"end": 1584
} | class ____(unittest.TestCase):
def testMetadata(self):
dim = 16
num_elements = 10000
# Generating sample data
data = np.float32(np.random.random((num_elements, dim)))
# Declaring index
p = hnswlib.Index(space='l2', dim=dim) # possible options are l2, cosine or ip
... | RandomSelfTestCase |
python | scipy__scipy | benchmarks/benchmarks/go_benchmark_functions/go_funcs_T.py | {
"start": 5935,
"end": 7091
} | class ____(Benchmark):
r"""
Three Hump Camel objective function.
This class defines the Three Hump Camel [1]_ global optimization problem. This
is a multimodal minimization problem defined as follows:
.. math::
f_{\text{ThreeHumpCamel}}(x) = 2x_1^2 - 1.05x_1^4 + \frac{x_1^6}{6}
... | ThreeHumpCamel |
python | pypa__pip | src/pip/_internal/exceptions.py | {
"start": 25591,
"end": 26133
} | class ____(DiagnosticPipError):
reference = "uninstall-distutils-installed-package"
def __init__(self, *, distribution: BaseDistribution) -> None:
super().__init__(
message=Text(f"Cannot uninstall {distribution}"),
context=(
"It is a distutils installed project a... | LegacyDistutilsInstall |
python | getsentry__sentry | tests/sentry/issue_detection/test_performance_detection.py | {
"start": 22346,
"end": 28503
} | class ____(TestCase):
def test_save_and_fetch(self) -> None:
event = Event(self.project.id, "something")
problem = PerformanceProblem(
"test",
"db",
"something bad happened",
PerformanceNPlusOneGroupType,
["1"],
["2", "3", "4"],... | EventPerformanceProblemTest |
python | pypa__pip | tests/unit/test_cli_spinners.py | {
"start": 661,
"end": 1922
} | class ____:
@pytest.mark.parametrize(
"status, func",
[
("done", lambda: None),
("error", lambda: 1 / 0),
("canceled", Mock(side_effect=KeyboardInterrupt)),
],
)
def test_finish(self, status: str, func: Callable[[], None]) -> None:
"""
... | TestRichSpinner |
python | chroma-core__chroma | chromadb/api/types.py | {
"start": 16357,
"end": 16553
} | class ____(TypedDict):
ids: IDs
embeddings: Embeddings
metadatas: Optional[Metadatas]
documents: Optional[Documents]
uris: Optional[URIs]
# Add result doesn't exist.
| AddRequest |
python | dask__dask | dask/dataframe/dask_expr/_expr.py | {
"start": 112961,
"end": 113100
} | class ____(MaybeAlignPartitions):
_parameters = ["frame", "other", "func", "fill_value"]
_expr_cls = CombineSeries
| CombineSeriesAlign |
python | django__django | tests/sites_tests/tests.py | {
"start": 9738,
"end": 13146
} | class ____(TestCase):
databases = {"default", "other"}
@classmethod
def setUpTestData(cls):
# Delete the site created as part of the default migration process.
Site.objects.all().delete()
def setUp(self):
self.app_config = apps.get_app_config("sites")
def test_basic(self):... | CreateDefaultSiteTests |
python | pytorch__pytorch | tools/code_coverage/package/util/setting.py | {
"start": 1115,
"end": 1323
} | class ____:
need_build: bool = False
need_run: bool = False
need_merge: bool = False
need_export: bool = False
need_summary: bool = False
need_pytest: bool = False
# test platform
| Option |
python | walkccc__LeetCode | solutions/2567. Minimum Score by Changing Two Elements/2567.py | {
"start": 0,
"end": 475
} | class ____:
def minimizeSum(self, nums: list[int]) -> int:
nums.sort()
# Can always change the number to any other number in `nums`, so `low` becomes 0.
# Thus, rephrase the problem as finding the minimum `high`.
highOfChangingTwoMins = nums[-1] - nums[2]
highOfChangingTwoMaxs = nums[-3] - nums[0]... | Solution |
python | langchain-ai__langchain | libs/core/langchain_core/structured_query.py | {
"start": 3026,
"end": 3094
} | class ____(Expr, ABC):
"""Filtering expression."""
| FilterDirective |
python | doocs__leetcode | solution/2400-2499/2491.Divide Players Into Teams of Equal Skill/Solution.py | {
"start": 0,
"end": 351
} | class ____:
def dividePlayers(self, skill: List[int]) -> int:
skill.sort()
t = skill[0] + skill[-1]
i, j = 0, len(skill) - 1
ans = 0
while i < j:
if skill[i] + skill[j] != t:
return -1
ans += skill[i] * skill[j]
i, j = i + 1... | Solution |
python | keras-team__keras | keras/src/layers/activations/softmax_test.py | {
"start": 115,
"end": 2911
} | class ____(testing.TestCase):
@pytest.mark.requires_trainable_backend
def test_softmax(self):
self.run_layer_test(
softmax.Softmax,
init_kwargs={},
input_shape=(2, 3, 4),
supports_masking=True,
assert_built_after_instantiation=True,
)
... | SoftmaxTest |
python | jmcnamara__XlsxWriter | xlsxwriter/test/drawing/test_write_c_nv_pr.py | {
"start": 341,
"end": 1548
} | class ____(unittest.TestCase):
"""
Test the Drawing _write_c_nv_pr() method.
"""
def setUp(self):
self.fh = StringIO()
self.drawing = Drawing()
self.drawing._set_filehandle(self.fh)
def test_write_c_nv_pr(self):
"""Test the _write_c_nv_pr() method"""
drawi... | TestWriteXdrcNvPr |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/experiment_service.py | {
"start": 7145,
"end": 10457
} | class ____(GoogleCloudBaseOperator):
"""
Use the Vertex AI SDK to create experiment run.
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
:param location: Required. The ID of the Google Cloud location that the service belongs to.
:param experiment_name: R... | CreateExperimentRunOperator |
python | crytic__slither | slither/slithir/variables/local_variable.py | {
"start": 287,
"end": 2528
} | class ____(
LocalVariable, SlithIRVariable
): # pylint: disable=too-many-instance-attributes
def __init__(self, local_variable: LocalVariable) -> None:
assert isinstance(local_variable, LocalVariable)
super().__init__()
# initiate ChildContract
self.set_function(local_variable... | LocalIRVariable |
python | spyder-ide__spyder | spyder/plugins/updatemanager/workers.py | {
"start": 8349,
"end": 8445
} | class ____(Exception):
"""Error occured while downloading file"""
pass
| UpdateDownloadError |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_bugbear/B018.py | {
"start": 0,
"end": 28
} | class ____:
"""abc"""
| Foo1 |
python | pandas-dev__pandas | pandas/tests/window/test_numba.py | {
"start": 13805,
"end": 20114
} | class ____:
def test_table_series_valueerror(self):
def f(x):
return np.sum(x, axis=0) + 1
with pytest.raises(
ValueError, match="method='table' not applicable for Series objects."
):
Series(range(1)).rolling(1, method="table").apply(
f, e... | TestTableMethod |
python | readthedocs__readthedocs.org | readthedocs/projects/migrations/0010_migrate_domain_data.py | {
"start": 1338,
"end": 1888
} | class ____(migrations.Migration):
safe = Safe.after_deploy()
dependencies = [
("projects", "0009_add_domain_field"),
]
operations = [
migrations.RunPython(migrate_url),
migrations.AlterField(
model_name="domain",
name="domain",
field=models.Ch... | Migration |
python | airbytehq__airbyte | airbyte-integrations/bases/connector-acceptance-test/connector_acceptance_test/tests/test_core.py | {
"start": 3178,
"end": 33461
} | class ____(BaseTest):
@pytest.fixture(name="skip_backward_compatibility_tests")
async def skip_backward_compatibility_tests_fixture(
self,
inputs: SpecTestConfig,
previous_connector_docker_runner: ConnectorRunner,
previous_connector_spec: ConnectorSpecification,
actual_co... | TestSpec |
python | huggingface__transformers | src/transformers/models/roberta/modeling_roberta.py | {
"start": 34560,
"end": 38117
} | class ____(RobertaPreTrainedModel):
_tied_weights_keys = {
"lm_head.decoder.weight": "roberta.embeddings.word_embeddings.weight",
"lm_head.decoder.bias": "lm_head.bias",
}
def __init__(self, config):
super().__init__(config)
if config.is_decoder:
logger.warning(... | RobertaForMaskedLM |
python | cython__cython | Cython/Compiler/Interpreter.py | {
"start": 253,
"end": 1831
} | class ____:
def lookup(self, name):
return None
empty_scope = EmptyScope()
def interpret_compiletime_options(optlist, optdict, type_env=None, type_args=()):
"""
Tries to interpret a list of compile time option nodes.
The result will be a tuple (optlist, optdict) but where
all expression no... | EmptyScope |
python | dask__distributed | distributed/tests/test_worker_memory.py | {
"start": 37193,
"end": 37811
} | class ____(UserDict):
def __getitem__(self, k):
raise AssertionError()
@gen_cluster(client=True, nthreads=[("", 1)], worker_kwargs={"data": WriteOnlyBuffer})
async def test_delete_spilled_keys(c, s, a):
"""Test that freeing an in-memory key that has been spilled to disk does not
accidentally unspi... | WriteOnlyBuffer |
python | aimacode__aima-python | csp.py | {
"start": 353,
"end": 20241
} | class ____(search.Problem):
"""This class describes finite-domain Constraint Satisfaction Problems.
A CSP is specified by the following inputs:
variables A list of variables; each is atomic (e.g. int or string).
domains A dict of {var:[possible_value, ...]} entries.
neighbors A d... | CSP |
python | sqlalchemy__sqlalchemy | test/orm/inheritance/test_single.py | {
"start": 63796,
"end": 68289
} | class ____(fixtures.MappedTest, AssertsCompiledSQL):
__dialect__ = "default"
@classmethod
def define_tables(cls, metadata):
Table(
"parent",
metadata,
Column(
"id", Integer, primary_key=True, test_needs_autoincrement=True
),
)
... | ManyToManyToSingleTest |
python | HypothesisWorks__hypothesis | hypothesis-python/src/hypothesis/internal/conjecture/choice.py | {
"start": 1253,
"end": 1354
} | class ____(TypedDict):
intervals: IntervalSet
min_size: int
max_size: int
| StringConstraints |
python | pypa__pip | src/pip/_vendor/urllib3/exceptions.py | {
"start": 1417,
"end": 1657
} | class ____(HTTPError):
"""Raised when something unexpected happens mid-request/response."""
pass
#: Renamed to ProtocolError but aliased for backwards compatibility.
ConnectionError = ProtocolError
# Leaf Exceptions
| ProtocolError |
python | pandas-dev__pandas | pandas/tests/indexes/period/test_indexing.py | {
"start": 25751,
"end": 27107
} | class ____:
def test_contains(self):
# GH 17717
p0 = Period("2017-09-01")
p1 = Period("2017-09-02")
p2 = Period("2017-09-03")
p3 = Period("2017-09-04")
ps0 = [p0, p1, p2]
idx0 = PeriodIndex(ps0)
for p in ps0:
assert p in idx0
... | TestContains |
python | prabhupant__python-ds | data_structures/bst/print_ancestor.py | {
"start": 0,
"end": 379
} | class ____():
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def print_ancestor_recursive(root, key):
if not root:
return False
if root.val == key:
return True
if print_ancestor_recursive(root.left, key) or print_ancestor_recursive(r... | Node |
python | getsentry__sentry | src/sentry/workflow_engine/migrations/0094_backfill_issue_stream_detector_workflows.py | {
"start": 2310,
"end": 3770
} | class ____(CheckedMigration):
# This flag is used to mark that a migration shouldn't be automatically run in production.
# This should only be used for operations where it's safe to run the migration after your
# code has deployed. So this should not be used for most operations that alter the schema
# o... | Migration |
python | tensorflow__tensorflow | tensorflow/tools/ci_build/linux/mkl/set-build-env.py | {
"start": 4454,
"end": 5059
} | class ____(IntelPlatform):
def __init__(self):
IntelPlatform.__init__(self, 4, 8)
def get_bazel_gcc_flags(self):
HASWELL_ARCH_OLD = "core-avx2" # Only missing the POPCNT instruction
HASWELL_ARCH_NEW = "haswell"
POPCNT_FLAG = "popcnt"
if self.use_old_arch_names(4, 9):
ret_val = self.BAZE... | HaswellPlatform |
python | has2k1__plotnine | tests/test_ggsave.py | {
"start": 796,
"end": 3440
} | class ____:
def test_default_filename(self):
p.save(verbose=False)
fn = p._save_filename("pdf")
assert_exist_and_clean(fn, "default filename")
def test_save_method(self):
fn = next(filename_gen)
with pytest.warns(PlotnineWarning) as record:
p.save(fn)
... | TestArguments |
python | django__django | django/contrib/gis/db/models/lookups.py | {
"start": 6601,
"end": 6699
} | class ____(GISLookup):
lookup_name = "contains"
@BaseSpatialField.register_lookup
| ContainsLookup |
python | allegroai__clearml | clearml/backend_config/bucket_config.py | {
"start": 645,
"end": 3326
} | class ____(object):
"""Configuration for an S3 bucket"""
bucket = attrib(type=str, converter=_url_stripper, default="")
subdir = attrib(type=str, converter=_url_stripper, default="")
host = attrib(type=str, converter=_none_to_empty_string, default="")
key = attrib(type=str, converter=_none_to_empty_... | S3BucketConfig |
python | mlflow__mlflow | mlflow/types/responses_helpers.py | {
"start": 1124,
"end": 1231
} | class ____(BaseModel):
file_id: str
index: int
type: str = "file_citation"
| AnnotationFileCitation |
python | doocs__leetcode | solution/1000-1099/1081.Smallest Subsequence of Distinct Characters/Solution.py | {
"start": 0,
"end": 410
} | class ____:
def smallestSubsequence(self, s: str) -> str:
last = {c: i for i, c in enumerate(s)}
stk = []
vis = set()
for i, c in enumerate(s):
if c in vis:
continue
while stk and stk[-1] > c and last[stk[-1]] > i:
vis.remove(st... | Solution |
python | vyperlang__vyper | vyper/codegen/memory_allocator.py | {
"start": 137,
"end": 1003
} | class ____:
__slots__ = ("position", "size")
def __init__(self, position: int, size: int) -> None:
self.position = position
self.size = size
def __repr__(self):
return f"(FreeMemory: pos={self.position}, size={self.size})"
def partially_allocate(self, size: int) -> int:
... | FreeMemory |
python | huggingface__transformers | src/transformers/models/sam_hq/modular_sam_hq.py | {
"start": 9759,
"end": 9810
} | class ____(SamFeedForward):
pass
| SamHQFeedForward |
python | PrefectHQ__prefect | src/prefect/server/api/ui/flows.py | {
"start": 917,
"end": 5902
} | class ____(PrefectBaseModel):
id: UUID = Field(default=..., description="The flow run id.")
flow_id: UUID = Field(default=..., description="The flow id.")
name: str = Field(default=..., description="The flow run name")
state_name: str = Field(default=..., description="The state name.")
state_type: S... | SimpleNextFlowRun |
python | tensorflow__tensorflow | tensorflow/python/keras/metrics.py | {
"start": 118936,
"end": 129453
} | class ____(SumOverBatchSize):
"""Wraps a function with the `SumOverBatchSizeMetricWrapper` metric."""
def __init__(self, fn, name=None, dtype=None, **kwargs):
"""Creates a `SumOverBatchSizeMetricWrapper` instance.
Args:
fn: The metric function to wrap, with signature `fn(y_true, y_pred,
**kw... | SumOverBatchSizeMetricWrapper |
python | huggingface__transformers | src/transformers/models/idefics2/modeling_idefics2.py | {
"start": 26241,
"end": 29057
} | class ____(nn.Module):
def __init__(self, config, layer_idx: int):
super().__init__()
self.hidden_size = config.hidden_size
self.n_latents = config.resampler_n_latents
self.depth = config.resampler_depth
self.rms_norm_eps = config.rms_norm_eps
self.input_latents_norm... | Idefics2PerceiverLayer |
python | getsentry__sentry | src/sentry/api/serializers/rest_framework/dashboard.py | {
"start": 48073,
"end": 49108
} | class ____(serializers.Serializer):
dashboard_ids = serializers.ListField(child=serializers.IntegerField(), required=True)
def validate_dashboard_ids(self, dashboard_ids):
if len(dashboard_ids) != len(set(dashboard_ids)):
raise serializers.ValidationError("Single dashboard cannot take up mu... | DashboardStarredOrderSerializer |
python | openai__openai-python | src/openai/resources/beta/threads/runs/steps.py | {
"start": 7896,
"end": 14899
} | class ____(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncStepsWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.gith... | AsyncSteps |
python | facebookresearch__faiss | tests/test_merge_index.py | {
"start": 4433,
"end": 7975
} | class ____(unittest.TestCase):
def do_flat_codes_test(self, factory_key):
ds = SyntheticDataset(32, 300, 300, 100)
index1 = faiss.index_factory(ds.d, factory_key)
index1.train(ds.get_train())
index1.add(ds.get_database())
_, Iref = index1.search(ds.get_queries(), 5)
... | TestMerge2 |
python | apache__airflow | airflow-core/src/airflow/api_fastapi/core_api/datamodels/common.py | {
"start": 1240,
"end": 1400
} | class ____(str, enum.Enum):
"""Bulk Action to be performed on the used model."""
CREATE = "create"
DELETE = "delete"
UPDATE = "update"
| BulkAction |
python | scrapy__scrapy | tests/test_downloadermiddleware.py | {
"start": 727,
"end": 1985
} | class ____:
settings_dict = None
# should be a fixture but async fixtures that use Futures are problematic with pytest-twisted
@asynccontextmanager
async def get_mwman(self) -> AsyncGenerator[DownloaderMiddlewareManager]:
crawler = get_crawler(Spider, self.settings_dict)
crawler.spider ... | TestManagerBase |
python | rapidsai__cudf | python/cudf/cudf/core/accessors/lists.py | {
"start": 760,
"end": 14310
} | class ____(BaseAccessor):
"""
List methods for Series
"""
_column: ListColumn
def __init__(self, parent: Series | Index):
if not is_dtype_obj_list(parent.dtype):
raise AttributeError(
"Can only use .list accessor with a 'list' dtype"
)
super(... | ListMethods |
python | getsentry__sentry | tests/sentry/sentry_apps/api/endpoints/test_sentry_app_avatar.py | {
"start": 449,
"end": 1758
} | class ____(APITestCase):
endpoint = "sentry-api-0-sentry-app-avatar"
def setUp(self) -> None:
super().setUp()
self.unpublished_app = self.create_sentry_app(name="Meow", organization=self.organization)
SentryAppAvatar.objects.create(sentry_app=self.unpublished_app, color=True, avatar_typ... | SentryAppAvatarTestBase |
python | qdrant__qdrant-client | qdrant_client/async_qdrant_client.py | {
"start": 928,
"end": 105344
} | class ____(AsyncQdrantFastembedMixin):
"""Entry point to communicate with Qdrant service via REST or gRPC API.
It combines interface classes and endpoint implementation.
Additionally, it provides custom implementations for frequently used methods like initial collection upload.
All methods in QdrantCl... | AsyncQdrantClient |
python | PyCQA__pyflakes | pyflakes/messages.py | {
"start": 4865,
"end": 5210
} | class ____(Message):
"""A `global` or `nonlocal` statement where the name is never reassigned"""
message = '`%s %s` is unused: name is never assigned in scope'
def __init__(self, filename, loc, name):
Message.__init__(self, filename, loc)
self.message_args = (type(loc).__name__.lower(), nam... | UnusedIndirectAssignment |
python | numpy__numpy | numpy/lib/tests/test_function_base.py | {
"start": 143190,
"end": 159177
} | class ____:
# most of this is already tested by TestPercentile
def V(self, x, y, alpha):
# Identification function used in several tests.
return (x >= y) - alpha
def test_max_ulp(self):
x = [0.0, 0.2, 0.4]
a = np.quantile(x, 0.45)
# The default linear method would r... | TestQuantile |
python | airbytehq__airbyte | airbyte-integrations/connectors/destination-snowflake-cortex/destination_snowflake_cortex/config.py | {
"start": 2290,
"end": 2373
} | class ____(VectorDBConfigModel):
indexing: SnowflakeCortexIndexingModel
| ConfigModel |
python | celery__celery | celery/worker/components.py | {
"start": 925,
"end": 1825
} | class ____(bootsteps.Step):
"""Timer bootstep."""
def create(self, w):
if w.use_eventloop:
# does not use dedicated timer thread.
w.timer = _Timer(max_interval=10.0)
else:
if not w.timer_cls:
# Default Timer is set by the pool, as for example,... | Timer |
python | kamyu104__LeetCode-Solutions | Python/print-immutable-linked-list-in-reverse.py | {
"start": 1358,
"end": 1718
} | class ____(object):
def printLinkedListInReverse(self, head):
"""
:type head: ImmutableListNode
:rtype: None
"""
tail = None
while head != tail:
curr = head
while curr.getNext() != tail:
curr = curr.getNext()
curr.pr... | Solution3 |
python | getsentry__sentry | src/sentry/lang/dart/plugin.py | {
"start": 325,
"end": 1483
} | class ____(Plugin2):
"""
This plugin is responsible for Dart specific processing on events or attachments.
"""
def can_configure_for_project(self, project, **kwargs) -> bool:
return False
def get_event_preprocessors(self, data: Mapping[str, Any]) -> Sequence[EventPreprocessor]:
sdk... | DartPlugin |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/dialects/mysql/types.py | {
"start": 11361,
"end": 12214
} | class ____(_IntegerType):
"""MySQL TINYINT type."""
__visit_name__ = "TINYINT"
def __init__(self, display_width: Optional[int] = None, **kw: Any):
"""Construct a TINYINT.
:param display_width: Optional, maximum display width for this number.
:param unsigned: a boolean, optional.
... | TINYINT |
python | run-llama__llama_index | llama-index-core/llama_index/core/instrumentation/events/agent.py | {
"start": 371,
"end": 773
} | class ____(BaseEvent):
"""
AgentRunStepStartEvent.
Args:
task_id (str): Task ID.
step (Optional[Any]): Task step.
input (Optional[str]): Optional input.
"""
task_id: str
step: Optional[Any]
input: Optional[str]
@classmethod
def class_name(cls) -> str:
... | AgentRunStepStartEvent |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 1599294,
"end": 1599468
} | class ____(sgqlc.types.Union):
"""Entities that can be sponsored via GitHub Sponsors"""
__schema__ = github_schema
__types__ = (Organization, User)
| SponsorableItem |
python | ansible__ansible | test/lib/ansible_test/_internal/cli/parsers/host_config_parsers.py | {
"start": 1191,
"end": 1758
} | class ____(Parser):
"""Composite argument parser for the origin."""
def parse(self, state: ParserState) -> t.Any:
"""Parse the input from the given state and return the result."""
namespace = OriginConfig()
state.set_namespace(namespace)
parser = OriginKeyValueParser()
... | OriginParser |
python | numpy__numpy | numpy/matrixlib/tests/test_defmatrix.py | {
"start": 12726,
"end": 14950
} | class ____:
a = np.array([[1], [2]])
m = matrix([[1], [2]])
def test_shape(self):
assert_equal(self.a.shape, (2, 1))
assert_equal(self.m.shape, (2, 1))
def test_numpy_ravel(self):
assert_equal(np.ravel(self.a).shape, (2,))
assert_equal(np.ravel(self.m).shape, (2,))
... | TestShape |
python | plotly__plotly.py | plotly/graph_objs/layout/_activeselection.py | {
"start": 235,
"end": 3117
} | class ____(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_str = "layout.activeselection"
_valid_props = {"fillcolor", "opacity"}
@property
def fillcolor(self):
"""
Sets the color filling the active selection' interior.
The 'fillcolor' property is a color and m... | Activeselection |
python | astropy__astropy | astropy/units/tests/test_quantity_ufuncs.py | {
"start": 5390,
"end": 12345
} | class ____:
"""
Test trigonometric functions
"""
@pytest.mark.parametrize(
"tc",
(
testcase(
f=np.sin,
q_in=(30.0 * u.degree,),
q_out=(0.5 * u.dimensionless_unscaled,),
),
testcase(
f=np.... | TestQuantityTrigonometricFuncs |
python | astropy__astropy | astropy/modeling/powerlaws.py | {
"start": 15034,
"end": 17142
} | class ____(Fittable1DModel):
"""
One dimensional log parabola model (sometimes called curved power law).
Parameters
----------
amplitude : float
Model amplitude
x_0 : float
Reference point
alpha : float
Power law index
beta : float
Power law curvature
... | LogParabola1D |
python | redis__redis-py | redis/commands/bf/__init__.py | {
"start": 2675,
"end": 3612
} | class ____(CMSCommands, AbstractBloom):
def __init__(self, client, **kwargs):
"""Create a new RedisBloom client."""
# Set the module commands' callbacks
_MODULE_CALLBACKS = {
CMS_INITBYDIM: bool_ok,
CMS_INITBYPROB: bool_ok,
# CMS_INCRBY: spaceHolder,
... | CMSBloom |
python | pandas-dev__pandas | pandas/tests/series/methods/test_convert_dtypes.py | {
"start": 188,
"end": 11486
} | class ____:
@pytest.mark.parametrize(
"data, maindtype, expected_default, expected_other",
[
(
# data
[1, 2, 3],
# original dtype
np.dtype("int32"),
# default expected dtype
"Int32",
... | TestSeriesConvertDtypes |
python | huggingface__transformers | src/transformers/models/sew/modeling_sew.py | {
"start": 10065,
"end": 13425
} | class ____(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(
self,
embed_dim: int,
num_heads: int,
dropout: float = 0.0,
is_decoder: bool = False,
bias: bool = True,
is_causal: bool = False,
config: Opti... | SEWAttention |
python | pytorch__pytorch | test/distributed/checkpoint/_experimental/test_checkpoint_writer.py | {
"start": 1724,
"end": 7106
} | class ____(TestCase):
def setUp(self):
super().setUp()
# Create a temporary directory for test checkpoints
self.temp_dir = tempfile.mkdtemp()
# Create test objects
self.rank_info = RankInfo(
global_rank=0,
global_world_size=1,
)
self.o... | TestCheckpointWriter |
python | more-itertools__more-itertools | tests/test_more.py | {
"start": 157661,
"end": 157868
} | class ____:
def __init__(self, value):
self.value = value
def __lt__(self, other):
return self.value < other.value
def __int__(self):
return int(self.value)
| BarelySortable |
python | ray-project__ray | python/ray/air/tests/test_integration_mlflow.py | {
"start": 11085,
"end": 15680
} | class ____(unittest.TestCase):
def setUp(self):
self.dirpath = tempfile.mkdtemp()
import mlflow
mlflow.set_tracking_uri("sqlite:///" + self.dirpath + "/mlflow.sqlite")
mlflow.create_experiment(name="existing_experiment")
self.mlflow_util = _MLflowLoggerUtil()
self.t... | MLflowUtilTest |
python | xlwings__xlwings | xlwings/constants.py | {
"start": 126219,
"end": 126466
} | class ____:
xlWBATChart = -4109 # from enum XlWBATemplate
xlWBATExcel4IntlMacroSheet = 4 # from enum XlWBATemplate
xlWBATExcel4MacroSheet = 3 # from enum XlWBATemplate
xlWBATWorksheet = -4167 # from enum XlWBATemplate
| WBATemplate |
python | ionelmc__pytest-benchmark | tests/test_storage.py | {
"start": 1263,
"end": 1571
} | class ____(object):
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def __getitem__(self, item):
return self.__dict__[item]
def getoption(self, item, default=None):
try:
return self[item]
except KeyError:
return default
| Namespace |
python | eth-brownie__brownie | brownie/utils/docopt.py | {
"start": 13147,
"end": 13854
} | class ____(_BranchPattern):
def match(self, left: list[_Pattern], collected: list[_Pattern] | None = None) -> Any:
assert len(self.children) == 1
collected = [] if collected is None else collected
original_collected = collected
original_left = left
last_left = None
ma... | _OneOrMore |
python | HypothesisWorks__hypothesis | hypothesis-python/tests/django/toystore/forms.py | {
"start": 3456,
"end": 3907
} | class ____(ReprForm):
num_validators = (MinValueValidator(1), MaxValueValidator(5))
_int_one_to_five = forms.IntegerField(validators=num_validators)
_decimal_one_to_five = forms.FloatField(validators=num_validators)
_float_one_to_five = forms.FloatField(validators=num_validators)
len_validators = (M... | WithValidatorsForm |
python | wandb__wandb | wandb/vendor/pygments/lexers/perl.py | {
"start": 550,
"end": 10459
} | class ____(RegexLexer):
"""
For `Perl <http://www.perl.org>`_ source code.
"""
name = 'Perl'
aliases = ['perl', 'pl']
filenames = ['*.pl', '*.pm', '*.t']
mimetypes = ['text/x-perl', 'application/x-perl']
flags = re.DOTALL | re.MULTILINE
# TODO: give this to a perl guy who knows how... | PerlLexer |
python | google__pytype | pytype/tests/test_flax_overlay.py | {
"start": 1935,
"end": 9821
} | class ____(test_base.BaseTest):
"""Test dataclass construction in flax.linen.Module subclasses."""
def _setup_linen_pyi(self, d):
d.create_file(
"flax/linen/__init__.pyi",
"""
from .module import Module
""",
)
d.create_file(
"flax/linen/module.pyi",
"""
c... | TestLinenModule |
python | astropy__astropy | astropy/io/ascii/latex.py | {
"start": 3614,
"end": 5425
} | class ____(core.BaseHeader):
"""Class to read the header of Latex Tables."""
header_start = r"\begin{tabular}"
splitter_class = LatexSplitter
def start_line(self, lines):
line = find_latex_line(lines, self.header_start)
if line is not None:
return line + 1
else:
... | LatexHeader |
python | dagster-io__dagster | helm/dagster/schema/schema/charts/utils/kubernetes.py | {
"start": 231,
"end": 493
} | class ____(RootModel[dict[str, str]]):
model_config = {
"json_schema_extra": {
"$ref": create_definition_ref(
"io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta/properties/annotations"
)
}
}
| Annotations |
python | realpython__materials | python-contact-book/source_code_step_5/rpcontacts/views.py | {
"start": 389,
"end": 1953
} | class ____(QMainWindow):
"""Main Window."""
def __init__(self, parent=None):
"""Initializer."""
super().__init__(parent)
self.setWindowTitle("RP Contacts")
self.resize(550, 250)
self.centralWidget = QWidget()
self.setCentralWidget(self.centralWidget)
self... | Window |
python | ansible__ansible | test/lib/ansible_test/_internal/host_configs.py | {
"start": 13948,
"end": 14082
} | class ____(HostConfig, metaclass=abc.ABCMeta):
"""Base class for network host configuration."""
@dataclasses.dataclass
| NetworkConfig |
python | getsentry__sentry | src/sentry/data_export/processors/discover.py | {
"start": 604,
"end": 701
} | class ____(Protocol):
def __call__(self, offset: int, limit: int) -> dict[str, Any]: ...
| DataFn |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.