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/keras/layers/pooling.py | {
"start": 27848,
"end": 30487
} | class ____(Pooling3D):
"""Max pooling operation for 3D data (spatial or spatio-temporal).
Downsamples the input along its spatial dimensions (depth, height, and width)
by taking the maximum value over an input window
(of size defined by `pool_size`) for each channel of the input.
The window is shifted by `st... | MaxPooling3D |
python | streamlit__streamlit | lib/streamlit/runtime/stats.py | {
"start": 3143,
"end": 3839
} | class ____:
def __init__(self) -> None:
self._cache_stats_providers: list[CacheStatsProvider] = []
def register_provider(self, provider: CacheStatsProvider) -> None:
"""Register a CacheStatsProvider with the manager.
This function is not thread-safe. Call it immediately after
cr... | StatsManager |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/freshness.py | {
"start": 744,
"end": 1018
} | class ____(graphene.ObjectType):
class Meta:
name = "CronFreshnessPolicy"
deadlineCron = graphene.NonNull(graphene.String)
lowerBoundDeltaSeconds = graphene.NonNull(graphene.Int)
timezone = graphene.NonNull(graphene.String)
| GrapheneCronFreshnessPolicy |
python | google__jax | jax/experimental/mosaic/gpu/constraints.py | {
"start": 1343,
"end": 1444
} | class ____(abc.ABC):
"""A constant is a known layout."""
@dataclasses.dataclass(frozen=True)
| Constant |
python | scipy__scipy | scipy/signal/_ltisys.py | {
"start": 50817,
"end": 52996
} | class ____(StateSpace, lti):
r"""
Continuous-time Linear Time Invariant system in state-space form.
Represents the system as the continuous-time, first order differential
equation :math:`\dot{x} = A x + B u`.
Continuous-time `StateSpace` systems inherit additional functionality
from the `lti` c... | StateSpaceContinuous |
python | cython__cython | Cython/Compiler/Nodes.py | {
"start": 368025,
"end": 379841
} | class ____(StatNode):
# try ... finally statement
#
# body StatNode
# finally_clause StatNode
# finally_except_clause deep-copy of finally_clause for exception case
# in_generator inside of generator => must store away current exception also in return case
#
# Ea... | TryFinallyStatNode |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/protocolExplicit3.py | {
"start": 750,
"end": 928
} | class ____(Protocol1, Protocol3):
cm1 = 3
cm10 = 3
def __init__(self):
self.im1 = 3
self.im10 = 10
self.cm11 = 3
Concrete4()
@final
| Concrete4 |
python | pyca__cryptography | tests/x509/test_x509_ext.py | {
"start": 144771,
"end": 152394
} | class ____:
def test_distribution_point_full_name_not_general_names(self):
with pytest.raises(TypeError):
x509.DistributionPoint(
["notgn"], # type:ignore[list-item]
None,
None,
None,
)
def test_distribution_point_... | TestDistributionPoint |
python | pytorch__pytorch | torch/distributed/tensor/placement_types.py | {
"start": 17130,
"end": 26270
} | class ____(torch._C._distributed.StridedShard, Shard):
"""
_StridedShard is only introduced to support 2D FSDP2 + TP sharding where the tensor
is sharded on the TP mesh dimension first, then sharded on the FSDP mesh dimension.
We call this right-to-left sharding which is the opposite of the default
... | _StridedShard |
python | pytorch__pytorch | test/torch_np/numpy_tests/linalg/test_linalg.py | {
"start": 12538,
"end": 13679
} | class ____(LinalgTestCase):
@slow
def test_generalized_herm_cases(self):
self.check_cases(require={"generalized", "hermitian"}, exclude={"size-0"})
@slow
def test_generalized_empty_herm_cases(self):
self.check_cases(
require={"generalized", "hermitian", "size-0"}, exclude={"... | HermitianGeneralizedTestCase |
python | getsentry__sentry | src/sentry/core/endpoints/scim/utils.py | {
"start": 5033,
"end": 7425
} | class ____(OrganizationEndpoint):
owner = ApiOwner.ENTERPRISE
content_negotiation_class = SCIMClientNegotiation
cursor_name = "startIndex"
def add_cursor_headers(self, request: Request, response, cursor_result):
pass
def list_api_format(self, results, total_results, start_index):
r... | SCIMEndpoint |
python | doocs__leetcode | solution/0100-0199/0143.Reorder List/Solution.py | {
"start": 151,
"end": 691
} | class ____:
def reorderList(self, head: Optional[ListNode]) -> None:
fast = slow = head
while fast.next and fast.next.next:
slow = slow.next
fast = fast.next.next
cur = slow.next
slow.next = None
pre = None
while cur:
t = cur.next... | Solution |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/openblas_with_lapack/package.py | {
"start": 217,
"end": 568
} | class ____(Package):
"""Dummy version of OpenBLAS that also provides LAPACK, for testing."""
homepage = "http://www.openblas.net"
url = "http://github.com/xianyi/OpenBLAS/archive/v0.2.15.tar.gz"
version("0.2.15", md5="b1190f3d3471685f17cfd1ec1d252ac9")
provides("lapack", "blas")
depends_on("c... | OpenblasWithLapack |
python | facebook__pyre-check | source/interprocedural_analyses/taint/test/integration/attributes.py | {
"start": 1897,
"end": 2149
} | class ____:
token: str = ""
def test_attribute_union_sink(t: Union[Sink, Untainted]):
t.token = _test_source()
if isinstance(t, Sink):
t.token = _test_source()
elif isinstance(t, Untainted):
t.token = _test_source()
| Sink |
python | pydantic__pydantic | tests/mypy/modules/plugin_success.py | {
"start": 2420,
"end": 2560
} | class ____(BaseModel):
x: int
y: ClassVar[int] = 1
ClassVarModel(x=1)
@dataclass(config={'validate_assignment': True})
| ClassVarModel |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeNarrowingTuple1.py | {
"start": 1094,
"end": 1643
} | class ____(Enum):
A = 0
B = 1
MsgE = tuple[Literal[MyEnum.A], str]
MsgF = tuple[Literal[MyEnum.B], float]
MsgEOrF = MsgE | MsgF
def func5(m: MsgEOrF):
if m[0] is MyEnum.A:
reveal_type(m, expected_text="tuple[Literal[MyEnum.A], str]")
else:
reveal_type(m, expected_text="tuple[Literal... | MyEnum |
python | ray-project__ray | python/ray/train/tests/test_iter_torch_batches_gpu.py | {
"start": 2615,
"end": 3012
} | class ____(ArrowBatchCollateFn):
"""Collate function that returns id and value as a dictionary of chunked tensors."""
def __call__(self, batch: pa.Table) -> Dict[str, List[torch.Tensor]]:
assert isinstance(batch, pa.Table)
modified_batch = _chunk_table_in_half(batch)
return arrow_batch_... | ChunkedDictArrowBatchCollateFn |
python | getsentry__sentry | tests/sentry/snuba/test_transactions.py | {
"start": 108200,
"end": 120391
} | class ____(SnubaTestCase, TestCase):
def setUp(self) -> None:
super().setUp()
self.day_ago = before_now(days=1).replace(hour=10, minute=0, second=0, microsecond=0)
self.now = before_now()
event_data = load_data("transaction")
# Half of duration so we don't get weird rounding... | TransactionsArithmeticTest |
python | ray-project__ray | python/ray/data/tests/test_issue_detection.py | {
"start": 730,
"end": 6509
} | class ____:
def test_hanging_detector_configuration(self, restore_data_context):
"""Test hanging detector configuration and initialization."""
# Test default configuration from DataContext
ctx = DataContext.get_current()
default_config = ctx.issue_detectors_config.hanging_detector_co... | TestHangingExecutionIssueDetector |
python | bokeh__bokeh | tests/unit/bokeh/test_resources.py | {
"start": 3410,
"end": 18899
} | class ____:
def test_basic(self) -> None:
r = resources.Resources()
assert r.mode == "cdn"
def test_clone(self) -> None:
r = resources.Resources(mode="server-dev")
assert r.mode == "server"
assert r.dev is True
assert r.components == ["bokeh", "bokeh-gl", "bokeh-... | TestResources |
python | oauthlib__oauthlib | oauthlib/openid/connect/core/exceptions.py | {
"start": 2966,
"end": 3199
} | class ____(OpenIDClientError):
"""
The OP does not support use of the request_uri parameter.
"""
error = 'request_uri_not_supported'
description = 'The request_uri parameter is not supported.'
| RequestURINotSupported |
python | ansible__ansible | test/lib/ansible_test/_internal/host_profiles.py | {
"start": 15338,
"end": 18249
} | class ____[TRemoteConfig: RemoteConfig](SshTargetHostProfile[TRemoteConfig], metaclass=abc.ABCMeta):
"""Base class for remote instance profiles."""
@property
def name(self) -> str:
"""The name of the host profile."""
return self.config.name
@property
def core_ci_state(self) -> t.Op... | RemoteProfile |
python | sanic-org__sanic | sanic/mixins/base.py | {
"start": 86,
"end": 132
} | class ____(Protocol):
name: str
| NameProtocol |
python | automl__auto-sklearn | autosklearn/pipeline/components/data_preprocessing/imputation/categorical_imputation.py | {
"start": 464,
"end": 3653
} | class ____(AutoSklearnPreprocessingAlgorithm):
"""
Substitute missing values by constant:
When strategy == “constant”, fill_value is used to replace all
occurrences of missing_values.
If left to the default, fill_value will be 0 when imputing
numerical data and “missing_value” fo... | CategoricalImputation |
python | fastai__fastai | fastai/text/core.py | {
"start": 14579,
"end": 17603
} | class ____():#TODO: pass the special tokens symbol to sp
"SentencePiece tokenizer for `lang`"
def __init__(self, lang='en', special_toks=None, sp_model=None, vocab_sz=None, max_vocab_sz=30000,
model_type='unigram', char_coverage=None, cache_dir='tmp'):
try: from sentencepiece import Sen... | SentencePieceTokenizer |
python | psf__black | src/blib2to3/pytree.py | {
"start": 22503,
"end": 30322
} | class ____(BasePattern):
"""
A wildcard pattern can match zero or more nodes.
This has all the flexibility needed to implement patterns like:
.* .+ .? .{m,n}
(a b c | d e | f)
(...)* (...)+ (...)? (...){m,n}
except it always uses non-greedy matching.
"""
min: in... | WildcardPattern |
python | getsentry__sentry | tests/snuba/sessions/test_sessions.py | {
"start": 4135,
"end": 6367
} | class ____(TestCase, BaseMetricsTestCase):
backend = MetricsReleaseHealthBackend()
def test_check_has_health_data(self) -> None:
self.store_session(
self.build_session(
project_id=self.project.id,
org_id=self.project.organization_id,
status="e... | CheckHasHealthDataTestCase |
python | coleifer__peewee | tests/fields.py | {
"start": 42337,
"end": 43369
} | class ____(ModelTestCase):
database = get_in_memory_db()
requires = [UpperModel]
def test_sql_function_db_value(self):
# Verify that the db function is applied as part of an INSERT.
um = UpperModel.create(name='huey')
um_db = UpperModel.get(UpperModel.id == um.id)
self.asser... | TestSQLFunctionDBValue |
python | zarr-developers__zarr-python | tests/test_dtype_registry.py | {
"start": 746,
"end": 8199
} | class ____:
@staticmethod
def test_register(data_type_registry_fixture: DataTypeRegistry) -> None:
"""
Test that registering a dtype in a data type registry works.
"""
data_type_registry_fixture.register(Bool._zarr_v3_name, Bool)
assert data_type_registry_fixture.get(Bool... | TestRegistry |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_datastore.py | {
"start": 5578,
"end": 6001
} | class ____:
@mock.patch(HOOK_PATH)
def test_execute(self, mock_hook):
op = CloudDatastoreDeleteOperationOperator(task_id="test_task", gcp_conn_id=CONN_ID, name=TRANSACTION)
op.execute({})
mock_hook.assert_called_once_with(gcp_conn_id=CONN_ID, impersonation_chain=None)
mock_hook.... | TestCloudDatastoreDeleteOperation |
python | scipy__scipy | scipy/stats/_fit.py | {
"start": 1608,
"end": 59867
} | class ____:
r"""Result of fitting a discrete or continuous distribution to data
Attributes
----------
params : namedtuple
A namedtuple containing the maximum likelihood estimates of the
shape parameters, location, and (if applicable) scale of the
distribution.
success : bool... | FitResult |
python | realpython__materials | typer-cli-python/source_code_step_5/rptodo/rptodo.py | {
"start": 284,
"end": 1238
} | class ____:
def __init__(self, db_path: Path) -> None:
self._db_handler = DatabaseHandler(db_path)
def add(self, description: List[str], priority: int = 2) -> CurrentTodo:
"""Add a new to-do to the database."""
description_text = " ".join(description)
if not description_text.end... | Todoer |
python | pytest-dev__pytest | testing/test_collection.py | {
"start": 27576,
"end": 32263
} | class ____:
def test_check_collect_hashes(self, pytester: Pytester) -> None:
p = pytester.makepyfile(
"""
def test_1():
pass
def test_2():
pass
"""
)
shutil.copy(p, p.parent / (p.stem + "2" + ".py"))
items, ... | Test_genitems |
python | mlflow__mlflow | mlflow/store/artifact/databricks_artifact_repo_resources.py | {
"start": 6728,
"end": 9005
} | class ____(_Resource):
def get_credentials(
self,
cred_type: _CredentialType,
paths: list[str] | None = None,
page_token: str | None = None,
) -> tuple[list[ArtifactCredentialInfo], str | None]:
api = GetCredentialsForRead if cred_type == _CredentialType.READ else GetCred... | _Run |
python | kamyu104__LeetCode-Solutions | Python/strong-password-checker.py | {
"start": 29,
"end": 1619
} | class ____(object):
def strongPasswordChecker(self, s):
"""
:type s: str
:rtype: int
"""
missing_type_cnt = 3
if any('a' <= c <= 'z' for c in s):
missing_type_cnt -= 1
if any('A' <= c <= 'Z' for c in s):
missing_type_cnt -= 1
if... | Solution |
python | ray-project__ray | python/ray/data/_internal/datasource/tfrecords_datasource.py | {
"start": 15845,
"end": 16653
} | class ____(AggregateFn):
def __init__(self, columns: List[str]):
self._columns = columns
super().__init__(
init=self._init,
merge=self._merge,
accumulate_row=self._accumulate_row,
finalize=lambda a: a,
name="max_list_size",
)
d... | _MaxListSize |
python | joke2k__faker | tests/providers/test_ssn.py | {
"start": 46877,
"end": 47656
} | class ____(unittest.TestCase):
def setUp(self):
self.fake = Faker("uk_Ua")
Faker.seed(0)
self.provider = uk_Provider
def test_ssn_len(self):
assert len(self.fake.ssn()) == 10
def test_start_ssn(self):
assert self.fake.ssn("21-06-1994")[:5] == "34505"
def test_s... | TestUkUA |
python | getsentry__sentry | src/sentry/testutils/cases.py | {
"start": 88776,
"end": 90063
} | class ____(AcceptanceTestCase, SnubaTestCase):
def setUp(self):
self.now = datetime.now(UTC)
super().setUp()
self.drop_replays()
patcher = mock.patch("django.utils.timezone.now", return_value=self.now)
patcher.start()
self.addCleanup(patcher.stop)
def drop_replay... | ReplaysAcceptanceTestCase |
python | tensorflow__tensorflow | tensorflow/python/autograph/tests/datasets_test.py | {
"start": 3219,
"end": 5931
} | class ____(reference_test_base.TestCase):
def setUp(self):
super(ReferenceTest, self).setUp()
self.ds = tf.data.Dataset.range(7)
def test_dataset_no_vars_loop(self):
self.assertFunctionMatchesEager(dataset_no_vars_loop, self.ds)
def test_iterator_no_vars_loop(self):
self.assertFunctionMatchesEa... | ReferenceTest |
python | pypa__setuptools | setuptools/tests/test_wheel.py | {
"start": 4596,
"end": 18721
} | class ____:
def __init__(self, id, **kwargs) -> None:
self._id = id
self._fields = kwargs
def __repr__(self) -> str:
return f'{self._id}(**{self._fields!r})'
# Using Any to avoid possible type union issues later in test
# making a TypedDict is not worth in a test and anonymous/inline ... | Record |
python | getsentry__sentry | tests/acceptance/test_create_project.py | {
"start": 374,
"end": 2885
} | class ____(AcceptanceTestCase):
def setUp(self) -> None:
super().setUp()
self.user = self.create_user("foo@example.com")
self.org = self.create_organization(name="Rowdy Tiger", owner=self.user)
self.login_as(self.user)
self.path = f"/organizations/{self.org.slug}/projects/new... | CreateProjectTest |
python | qdrant__qdrant-client | qdrant_client/embed/schema_parser.py | {
"start": 746,
"end": 11846
} | class ____:
"""Model schema parser. Parses json schemas to retrieve paths to objects requiring inference.
The parser is stateful, it accumulates the results of parsing in its internal structures.
Attributes:
_defs: definitions extracted from json schemas
_recursive_refs: set of recursive r... | ModelSchemaParser |
python | facebook__pyre-check | tools/generate_taint_models/tests/test_functions.py | {
"start": 717,
"end": 926
} | class ____(TestClass):
def __init__(self, x: int) -> None:
...
all_functions = [
testA,
testB,
testC,
testD,
testE,
TestClass.methodA,
TestClass.methodB,
]
| TestChildClassB |
python | openai__openai-python | src/openai/types/eval_custom_data_source_config.py | {
"start": 267,
"end": 589
} | class ____(BaseModel):
schema_: Dict[str, object] = FieldInfo(alias="schema")
"""
The json schema for the run data source items. Learn how to build JSON schemas
[here](https://json-schema.org/).
"""
type: Literal["custom"]
"""The type of data source. Always `custom`."""
| EvalCustomDataSourceConfig |
python | google__python-fire | fire/main_test.py | {
"start": 703,
"end": 1398
} | class ____(testutils.BaseTestCase):
"""Tests to verify the behavior of __main__ (python -m fire)."""
def testNameSetting(self):
# Confirm one of the usage lines has the gettempdir member.
with self.assertOutputMatches('gettempdir'):
__main__.main(['__main__.py', 'tempfile'])
def testArgPassing(sel... | MainModuleTest |
python | walkccc__LeetCode | solutions/661. Image Smoother/661.py | {
"start": 0,
"end": 462
} | class ____:
def imageSmoother(self, M: list[list[int]]) -> list[list[int]]:
m = len(M)
n = len(M[0])
ans = [[0 for j in range(n)] for i in range(m)]
for i in range(m):
for j in range(n):
ones = 0
count = 0
for y in range(max(0, i - 1), min(m, i + 2)):
for x in ... | Solution |
python | tensorflow__tensorflow | tensorflow/python/data/ops/take_op.py | {
"start": 1058,
"end": 1673
} | class ____(dataset_ops.UnaryUnchangedStructureDataset):
"""A `Dataset` containing the first `count` elements from its input."""
def __init__(self, input_dataset, count, name=None):
"""See `Dataset.take()` for details."""
self._input_dataset = input_dataset
self._count = ops.convert_to_tensor(count, dty... | _TakeDataset |
python | python-pillow__Pillow | Tests/test_font_leaks.py | {
"start": 824,
"end": 1284
} | class ____(TestTTypeFontLeak):
# fails at iteration 37 in main
iterations = 100
mem_limit = 1024 # k
def test_leak(self) -> None:
if features.check_module("freetype2"):
ImageFont.core = _util.DeferredError(ImportError("Disabled for testing"))
try:
default_font =... | TestDefaultFontLeak |
python | huggingface__transformers | src/transformers/models/qwen3_vl_moe/modeling_qwen3_vl_moe.py | {
"start": 17669,
"end": 18781
} | class ____(nn.Module):
def __init__(self, config):
super().__init__()
self.top_k = config.num_experts_per_tok
self.num_experts = config.num_experts
self.norm_topk_prob = config.norm_topk_prob
self.hidden_dim = config.hidden_size
self.weight = nn.Parameter(torch.zeros(... | Qwen3VLMoeTextTopKRouter |
python | altair-viz__altair | altair/vegalite/v6/schema/core.py | {
"start": 433406,
"end": 433598
} | class ____(Data):
"""Generator schema wrapper."""
_schema = {"$ref": "#/definitions/Generator"}
def __init__(self, *args, **kwds):
super().__init__(*args, **kwds)
| Generator |
python | tensorflow__tensorflow | tensorflow/lite/python/metrics/metrics_nonportable_test.py | {
"start": 14582,
"end": 23692
} | class ____(test_util.TensorFlowTestCase,
parameterized.TestCase):
"""Testing conversion error metric."""
def setUp(self):
super(ConverterErrorMetricTest, self).setUp()
# Mock metrics instance except errors so other test cases are not affected.
mock_attempt = mock.create_... | ConverterErrorMetricTest |
python | great-expectations__great_expectations | great_expectations/validator/validator.py | {
"start": 4597,
"end": 64939
} | class ____:
"""Validator is the key object used to create Expectations, validate Expectations, and get Metrics for Expectations.
Validators are used by Checkpoints to validate Expectations.
Args:
execution_engine: The Execution Engine to be used to perform validation.
interactive_evaluatio... | Validator |
python | django__django | tests/modeladmin/models.py | {
"start": 983,
"end": 1708
} | class ____(models.Model):
name = models.CharField(max_length=100)
slug = models.SlugField()
users = models.ManyToManyField(User)
state = models.CharField(
max_length=2, choices=(("CO", "Colorado"), ("WA", "Washington"))
)
is_active = models.BooleanField(default=False)
pub_date = mode... | ValidationTestModel |
python | getsentry__sentry | tests/sentry/utils/sdk_crashes/test_sdk_crash_detection_cocoa.py | {
"start": 28572,
"end": 28874
} | class ____(
TestCase, CococaSDKFilenameTestMixin, CococaSDKFramesTestMixin, CococaSDKFunctionTestMixin
):
def create_event(self, data, project_id, assert_no_errors=True):
return self.store_event(data=data, project_id=project_id, assert_no_errors=assert_no_errors)
| SDKCrashDetectionCocoaTest |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_cond_format10.py | {
"start": 315,
"end": 1285
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("cond_format10.xlsx")
def test_create_file(self):
"""Test the creation of a simple XlsxWriter file with conditional formatting."""
... | TestCompareXLSXFiles |
python | Pylons__pyramid | src/pyramid/exceptions.py | {
"start": 2950,
"end": 3513
} | class ____(ConfigurationError):
"""Raised when a configuration conflict is detected during action
processing"""
def __init__(self, conflicts):
self._conflicts = conflicts
def __str__(self):
r = ["Conflicting configuration actions"]
for discriminator, infos in self._conflicts.it... | ConfigurationConflictError |
python | numba__numba | numba/core/ssa.py | {
"start": 8714,
"end": 8860
} | class ____:
def __init__(self):
raise NotImplementedError("Not intended for instantiation")
target = ir.UNDEFINED
| UndefinedVariable |
python | pandas-dev__pandas | pandas/tests/tseries/offsets/test_custom_business_hour.py | {
"start": 999,
"end": 12217
} | class ____:
def test_constructor_errors(self):
msg = "time data must be specified only with hour and minute"
with pytest.raises(ValueError, match=msg):
CustomBusinessHour(start=dt_time(11, 0, 5))
msg = "time data must match '%H:%M' format"
with pytest.raises(ValueError, m... | TestCustomBusinessHour |
python | ray-project__ray | python/ray/llm/_internal/serve/core/configs/openai_api_models.py | {
"start": 2522,
"end": 2673
} | class ____(vLLMCompletionStreamResponse):
model_config = ConfigDict(arbitrary_types_allowed=True)
# TODO (Kourosh): Upstream
| CompletionStreamResponse |
python | pypa__warehouse | warehouse/oidc/models/gitlab.py | {
"start": 12155,
"end": 15525
} | class ____(GitLabPublisherMixin, OIDCPublisher):
__tablename__ = "gitlab_oidc_publishers"
__mapper_args__ = {"polymorphic_identity": "gitlab_oidc_publishers"}
__table_args__ = (
UniqueConstraint(
"namespace",
"project",
"workflow_filepath",
"environmen... | GitLabPublisher |
python | django-extensions__django-extensions | tests/testapp/models.py | {
"start": 2300,
"end": 2432
} | class ____(ActivatorModel):
title = models.CharField(max_length=255)
class Meta:
app_label = "django_extensions"
| Post |
python | ray-project__ray | python/ray/serve/_private/logging_utils.py | {
"start": 3895,
"end": 7641
} | class ____(TextFormatter):
"""Serve Logging Formatter
The formatter will generate the log format on the fly based on the field of record.
Optimized to pre-compute format strings and formatters for better performance.
"""
COMPONENT_LOG_FMT = f"%({SERVE_LOG_LEVEL_NAME})s %({SERVE_LOG_TIME})s {{{SERV... | ServeFormatter |
python | pytorch__pytorch | test/dynamo/test_aot_autograd.py | {
"start": 1318,
"end": 62835
} | class ____(torch._inductor.test_case.TestCase):
def test_LSTM(self):
# https://github.com/pytorch/torchdynamo/issues/1147
class Repro(torch.nn.Module):
def __init__(self) -> None:
super().__init__()
self.self_mod_model_lstm_lstm = torch.nn.LSTM(
... | AotAutogradFallbackTests |
python | pytorch__pytorch | test/cpp_extensions/open_registration_extension/torch_openreg/tests/test_streams.py | {
"start": 140,
"end": 2509
} | class ____(TestCase):
@skipIfTorchDynamo()
def test_stream_create(self):
stream = torch.Stream(device="openreg")
self.assertEqual(stream.device_index, torch.openreg.current_device())
stream = torch.Stream(device="openreg:1")
self.assertEqual(stream.device.type, "openreg")
... | TestStream |
python | py-pdf__pypdf | pypdf/errors.py | {
"start": 839,
"end": 959
} | class ____(PdfReadError):
"""Raised when there is an issue reading the stream of data in a PDF file."""
| PdfStreamError |
python | dabeaz-course__practical-python | Solutions/6_12/portfolio.py | {
"start": 16,
"end": 722
} | class ____:
def __init__(self, holdings):
self._holdings = holdings
def __iter__(self):
return self._holdings.__iter__()
def __len__(self):
return len(self._holdings)
def __getitem__(self, index):
return self._holdings[index]
def __contains__(self, name):
... | Portfolio |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-bing-ads/unit_tests/integrations/test_hourly_reports.py | {
"start": 63217,
"end": 70502
} | class ____(HourlyReportsTestWithStateChangesAfterMigration):
stream_name = "user_location_performance_report_hourly"
report_file = "user_location_performance_report_hourly"
records_number = 24
state_file = "hourly_reports_state"
incremental_report_file = "user_location_performance_report_hourly_incr... | TestUserLocationPerformanceReportHourlyStream |
python | modin-project__modin | asv_bench/benchmarks/scalability/scalability_benchmarks.py | {
"start": 1495,
"end": 1986
} | class ____:
param_names = ["shape", "cpus"]
params = [
get_benchmark_shapes("TimeFromPandas"),
[4, 16, 32],
]
def setup(self, shape, cpus):
self.data = pandas.DataFrame(gen_data("int", *shape, RAND_LOW, RAND_HIGH))
from modin.config import NPartitions
NPartition... | TimeFromPandas |
python | pytorch__pytorch | torch/_dynamo/source.py | {
"start": 8270,
"end": 8653
} | class ____(Source):
global_name: str
def reconstruct(self, codegen: "PyCodegen") -> None:
codegen.append_output(codegen.create_load_global(self.global_name, add=True))
def guard_source(self) -> GuardSource:
return GuardSource.GLOBAL
def name(self) -> str:
return f"G[{repr(self... | GlobalSource |
python | plotly__plotly.py | plotly/graph_objs/histogram/_insidetextfont.py | {
"start": 233,
"end": 9946
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "histogram"
_path_str = "histogram.insidetextfont"
_valid_props = {
"color",
"family",
"lineposition",
"shadow",
"size",
"style",
"textcase",
"variant",
"weight",
}
@prope... | Insidetextfont |
python | django-debug-toolbar__django-debug-toolbar | debug_toolbar/panels/request.py | {
"start": 243,
"end": 1991
} | class ____(Panel):
"""
A panel to display request variables (POST/GET, session, cookies).
"""
template = "debug_toolbar/panels/request.html"
title = _("Request")
@property
def nav_subtitle(self):
"""
Show abbreviated name of view function as subtitle
"""
vi... | RequestPanel |
python | huggingface__transformers | src/transformers/models/cpmant/modeling_cpmant.py | {
"start": 28514,
"end": 32344
} | class ____(CpmAntPreTrainedModel, GenerationMixin):
_tied_weights_keys = {"lm_head.weight": "cpmant.input_embedding.weight"}
def __init__(self, config: CpmAntConfig):
super().__init__(config)
self.cpmant = CpmAntModel(config)
# lm_head.weight is tied to cpmant.input_embedding.weight
... | CpmAntForCausalLM |
python | tensorflow__tensorflow | tensorflow/lite/python/convert_test.py | {
"start": 9210,
"end": 18463
} | class ____(test_util.TensorFlowTestCase):
"""Test the hint to stub functionality."""
def _getGraphOpTypes(self, graphdef, output_nodes):
"""Returns used op types in `graphdef` reachable from `output_nodes`.
This is used to check that after the stub transformation the expected
nodes are there.
NOT... | ConvertTestOpHint |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/ruff/RUF009.py | {
"start": 3248,
"end": 3339
} | class ____:
@dataclass(frozen=True)
class D:
foo: int = 1
d: D = D() # OK | C |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 825238,
"end": 826020
} | class ____(sgqlc.types.relay.Connection):
"""The connection type for OrganizationInvitation."""
__schema__ = github_schema
__field_names__ = ("edges", "nodes", "page_info", "total_count")
edges = sgqlc.types.Field(sgqlc.types.list_of("OrganizationInvitationEdge"), graphql_name="edges")
"""A list of... | OrganizationInvitationConnection |
python | pytorch__pytorch | torch/_dynamo/variables/functions.py | {
"start": 109570,
"end": 110139
} | class ____(VariableTracker):
def call_function(
self,
tx: "InstructionTranslator",
args: Sequence[VariableTracker],
kwargs: dict[str, VariableTracker],
) -> VariableTracker:
tensor = kwargs["tensor"] if "tensor" in kwargs else args[0]
block_shape = kwargs["block_s... | CreateTMADescriptorStableVariable |
python | ray-project__ray | rllib/examples/algorithms/classes/appo_w_shared_data_actor.py | {
"start": 200,
"end": 839
} | class ____:
"""Simple example of an actor that's accessible from all other actors of an algo.
Exposes remote APIs `put` and `get` to other actors for storing and retrieving
arbitrary data.
"""
def __init__(self):
self.storage = {}
def get(self, key, delete: bool = False):
valu... | SharedDataActor |
python | celery__celery | t/unit/events/test_snapshot.py | {
"start": 332,
"end": 2262
} | class ____:
def setup_method(self):
self.state = self.app.events.State()
def test_constructor(self):
x = Polaroid(self.state, app=self.app)
assert x.app is self.app
assert x.state is self.state
assert x.freq
assert x.cleanup_freq
assert x.logger
... | test_Polaroid |
python | getsentry__sentry | src/sentry/relocation/models/relocation.py | {
"start": 13201,
"end": 14006
} | class ____(DefaultFieldsModelExisting):
"""
Represents a single Google CloudBuild validation run invocation, and tracks it over its
lifetime.
"""
__relocation_scope__ = RelocationScope.Excluded
relocation = FlexibleForeignKey("sentry.Relocation")
relocation_validation = FlexibleForeignKey(... | RelocationValidationAttempt |
python | jazzband__django-oauth-toolkit | tests/test_implicit.py | {
"start": 10264,
"end": 18380
} | class ____(BaseTest):
@classmethod
def setUpTestData(cls):
super().setUpTestData()
cls.application.algorithm = Application.RS256_ALGORITHM
cls.application.save()
def test_id_token_post_auth_allow(self):
"""
Test authorization code is given for an allowed request with... | TestOpenIDConnectImplicitFlow |
python | django-extensions__django-extensions | tests/testapp/models.py | {
"start": 8081,
"end": 8398
} | class ____(models.Model):
title = models.CharField(max_length=42)
slug = AutoSlugField(populate_from="title", overwrite_on_add=False)
class Meta:
app_label = "django_extensions"
def get_readable_title(instance):
return "The title is {}".format(instance.title)
| SluggedTestNoOverwriteOnAddModel |
python | realpython__materials | python-313/docstrings.py | {
"start": 44,
"end": 273
} | class ____:
"""Model a person with a name, location, and Python version."""
name: str
place: str
version: str
print(Person.__doc__)
print(len(dataclasses.replace.__doc__))
print(dataclasses.replace.__doc__)
| Person |
python | rq__rq | tests/test_callbacks.py | {
"start": 4402,
"end": 7702
} | class ____(RQTestCase):
def test_success_callback(self):
"""Test success callback is executed only when job is successful"""
queue = Queue(is_async=False, connection=self.connection)
job = queue.enqueue(say_hello, on_success=save_result)
self.assertEqual(job.get_status(), JobStatus.... | SyncJobCallback |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 219698,
"end": 220158
} | class ____(sgqlc.types.Input):
"""Autogenerated input type of DeleteRef"""
__schema__ = github_schema
__field_names__ = ("ref_id", "client_mutation_id")
ref_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="refId")
"""The Node ID of the Ref to be deleted."""
client_mutation_id = s... | DeleteRefInput |
python | davidhalter__jedi | test/refactor/extract_function.py | {
"start": 7579,
"end": 7993
} | class ____:
# ha
def g(self): pass
# haha
def ab(self, b):
#foo
local1 = 3
local2 = 4
x= self.g() or self.f(b) ^ glob1 & b is local1
return x
def f(self, b, c):
#? 11 text {'new_name': 'ab', 'until_line': 12, 'until_column': 28}
x = self.ab(b... | X |
python | pytorch__pytorch | test/dynamo/test_backward_higher_order_ops.py | {
"start": 5880,
"end": 9296
} | class ____(torch.nn.Module):
def forward(self, L_inputs_ : list, s69: "Sym(s21)", L_sizes_0_: "f32[0, s21]"):
l_inputs_ = L_inputs_
l_sizes_0_ = L_sizes_0_
getitem: "f32[s21]" = l_inputs_[0]
getitem_1: "f32[s21]" = l_inputs_[1]
getitem_2: "f32[s21]" = l_inputs_[2]; l_inputs... | GraphModule |
python | getsentry__responses | responses/tests/test_responses.py | {
"start": 73005,
"end": 74199
} | class ____:
"""Test to validate that multiple decorators could be applied.
Ensures that we can call one function that is wrapped with
``responses.activate`` decorator from within another wrapped function.
Validates that mock patch is not leaked to other tests.
For more detail refer to https://gith... | TestMultipleWrappers |
python | bokeh__bokeh | src/bokeh/models/glyphs.py | {
"start": 36842,
"end": 37870
} | class ____(LRTBGlyph):
''' Render axis-aligned quads.
'''
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
__example__ = "examples/reference/models/Quad.py"
_args = ('left', 'right', 'top', 'bottom... | Quad |
python | realpython__materials | python-313/replace.py | {
"start": 595,
"end": 1638
} | class ____:
def __init__(self, name, **items):
print(f"Initializing {name} with {items}")
self.name = name
self.items = items
def __replace__(self, **kwargs):
""".__replace__() is called by copy.replace()"""
if "name" in kwargs:
raise ValueError("'name' can't... | NamedContainer |
python | walkccc__LeetCode | solutions/286. Walls and Gates/286.py | {
"start": 0,
"end": 632
} | class ____:
def wallsAndGates(self, rooms: list[list[int]]) -> None:
DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
INF = 2**31 - 1
m = len(rooms)
n = len(rooms[0])
q = collections.deque((i, j)
for i in range(m)
for j in range(n)
... | Solution |
python | doocs__leetcode | solution/3200-3299/3223.Minimum Length of String After Operations/Solution.py | {
"start": 0,
"end": 145
} | class ____:
def minimumLength(self, s: str) -> int:
cnt = Counter(s)
return sum(1 if x & 1 else 2 for x in cnt.values())
| Solution |
python | docker__docker-py | tests/integration/api_image_test.py | {
"start": 11528,
"end": 12227
} | class ____(BaseAPIIntegrationTest):
@requires_api_version('1.23')
def test_get_image_load_image(self):
with tempfile.TemporaryFile() as f:
stream = self.client.get_image(TEST_IMG)
for chunk in stream:
f.write(chunk)
f.seek(0)
result = self... | SaveLoadImagesTest |
python | walkccc__LeetCode | solutions/640. Solve the Equation/640.py | {
"start": 0,
"end": 1041
} | class ____:
def solveEquation(self, equation: str) -> str:
def calculate(s: str) -> tuple:
coefficient = 0
constant = 0
num = 0
sign = 1
for i, c in enumerate(s):
if c.isdigit():
num = num * 10 + int(c)
elif c in '+-':
constant += sign * num
... | Solution |
python | plotly__plotly.py | plotly/graph_objs/histogram/_error_y.py | {
"start": 233,
"end": 14397
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "histogram"
_path_str = "histogram.error_y"
_valid_props = {
"array",
"arrayminus",
"arrayminussrc",
"arraysrc",
"color",
"symmetric",
"thickness",
"traceref",
"tracerefminus",
... | ErrorY |
python | pydantic__pydantic | pydantic/warnings.py | {
"start": 512,
"end": 1951
} | class ____(DeprecationWarning):
"""A Pydantic specific deprecation warning.
This warning is raised when using deprecated functionality in Pydantic. It provides information on when the
deprecation was introduced and the expected version in which the corresponding functionality will be removed.
Attribut... | PydanticDeprecationWarning |
python | great-expectations__great_expectations | great_expectations/exceptions/resource_freshness.py | {
"start": 941,
"end": 1024
} | class ____(GreatExpectationsAggregateError):
pass
| ResourceFreshnessAggregateError |
python | run-llama__llama_index | llama-index-core/tests/program/test_streaming_utils.py | {
"start": 382,
"end": 486
} | class ____(BaseModel):
"""Test joke model."""
setup: str
punchline: Optional[str] = None
| Joke |
python | altair-viz__altair | tools/schemapi/utils.py | {
"start": 32248,
"end": 33083
} | class ____(Generic[T]):
"""
Simple group-by like utility.
Intended for consuming an iterator in full, splitting into true/false cases.
Parameters
----------
iterable
Elements to divide into two groups.
predicate
Function to classify each element.
Attributes
-------... | Grouped |
python | tensorflow__tensorflow | ci/official/utilities/extract_resultstore_links.py | {
"start": 1422,
"end": 11184
} | class ____:
tests_failed = 'tests_failed'
build_failed = 'build_failed'
passed = 'passed'
def parse_args() -> argparse.Namespace:
"""Parses the commandline args."""
parser = argparse.ArgumentParser(
description='Extracts ResultStore links from a build log.\n'
'These can be then print... | InvokeStatus |
python | bokeh__bokeh | tests/unit/bokeh/core/property/test_data_frame.py | {
"start": 2913,
"end": 3783
} | class ____:
def test_valid(self) -> None:
prop = bcpp.EagerSeries()
assert prop.is_valid(pd.Series(dtype='float64'))
def test_valid_polars(self) -> None:
polars = pytest.importorskip('polars')
prop = bcpp.EagerSeries()
assert prop.is_valid(polars.Series())
def test_... | Test_EagerSeries |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.