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 | sphinx-doc__sphinx | sphinx/search/ro.py | {
"start": 136,
"end": 537
} | class ____(SearchLanguage):
lang = 'ro'
language_name = 'Romanian'
js_stemmer_rawcode = 'romanian-stemmer.js'
stopwords = frozenset()
def __init__(self, options: dict[str, str]) -> None:
super().__init__(options)
self.stemmer = snowballstemmer.stemmer('romanian')
def stem(self,... | SearchRomanian |
python | facebook__pyre-check | client/commands/infer.py | {
"start": 2142,
"end": 2251
} | class ____:
name: str
location: RawAnnotationLocation
@dataclasses.dataclass(frozen=True)
| RawAnnotation |
python | apache__airflow | helm-tests/tests/helm_tests/other/test_pgbouncer.py | {
"start": 24677,
"end": 30254
} | class ____:
"""Tests PgBouncer exporter."""
def test_secret_not_created_by_default(self):
docs = render_chart(
show_only=["templates/secrets/pgbouncer-stats-secret.yaml"],
)
assert len(docs) == 0
def test_should_add_annotations_to_pgbouncer_stats_secret(self):
d... | TestPgbouncerExporter |
python | ray-project__ray | python/ray/train/v2/_internal/execution/scaling_policy/fixed.py | {
"start": 255,
"end": 773
} | class ____(ScalingPolicy):
def make_decision_for_non_running_worker_group(self) -> ScalingDecision:
return ResizeDecision(
num_workers=self.scaling_config.num_workers,
resources_per_worker=self.scaling_config._resources_per_worker_not_none,
)
def make_decision_for_runnin... | FixedScalingPolicy |
python | cython__cython | Cython/Compiler/PyrexTypes.py | {
"start": 182210,
"end": 182825
} | class ____(PyrexType):
# Used to prevent propagation of error messages.
is_error = 1
exception_value = 0
exception_check = False
to_py_function = "dummy"
from_py_function = "dummy"
def create_to_py_utility_code(self, env):
return True
def create_from_py_utility_code(self, env)... | ErrorType |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/cloud_composer.py | {
"start": 8487,
"end": 12261
} | class ____(GoogleCloudBaseOperator):
"""
Delete an environment.
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
:param region: Required. The ID of the Google Cloud region that the service belongs to.
:param environment_id: Required. The ID of the Google ... | CloudComposerDeleteEnvironmentOperator |
python | huggingface__transformers | src/transformers/models/detr/modeling_detr.py | {
"start": 34101,
"end": 38918
} | class ____(DetrPreTrainedModel):
"""
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`DetrEncoderLayer`].
The encoder updates the flattened feature map through multiple self-attention layers.
Small tweak for DETR:
- object_queries are added to... | DetrEncoder |
python | huggingface__transformers | tests/models/omdet_turbo/test_modeling_omdet_turbo.py | {
"start": 7428,
"end": 28679
} | class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (OmDetTurboForObjectDetection,) if is_torch_available() else ()
is_encoder_decoder = True
pipeline_model_mapping = (
{"zero-shot-object-detection": OmDetTurboForObjectDetection} if is_torch_available() else {}... | OmDetTurboModelTest |
python | pytest-dev__pytest | src/_pytest/capture.py | {
"start": 6618,
"end": 6851
} | class ____(CaptureIO):
def __init__(self, other: TextIO) -> None:
self._other = other
super().__init__()
def write(self, s: str) -> int:
super().write(s)
return self._other.write(s)
| TeeCaptureIO |
python | apache__airflow | providers/teradata/tests/unit/teradata/utils/test_tpt_util.py | {
"start": 1374,
"end": 29333
} | class ____:
"""Test cases for TPT utility functions."""
def test_write_file(self):
"""Test write_file function."""
with tempfile.NamedTemporaryFile(mode="w", delete=False) as tmp_file:
test_path = tmp_file.name
try:
test_content = "Test content\nLine 2"
... | TestTptUtil |
python | PrefectHQ__prefect | src/prefect/client/orchestration/__init__.py | {
"start": 38892,
"end": 67979
} | class ____(
ArtifactClient,
ArtifactCollectionClient,
LogClient,
VariableClient,
ConcurrencyLimitClient,
DeploymentClient,
AutomationClient,
SlaClient,
FlowRunClient,
FlowClient,
BlocksDocumentClient,
BlocksSchemaClient,
BlocksTypeClient,
WorkPoolClient,
Event... | SyncPrefectClient |
python | scikit-learn__scikit-learn | sklearn/linear_model/_glm/_newton_solver.py | {
"start": 535,
"end": 15694
} | class ____(ABC):
"""Newton solver for GLMs.
This class implements Newton/2nd-order optimization routines for GLMs. Each Newton
iteration aims at finding the Newton step which is done by the inner solver. With
Hessian H, gradient g and coefficients coef, one step solves:
H @ coef_newton = -g
... | NewtonSolver |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/errors.py | {
"start": 17849,
"end": 17999
} | class ____(DagsterError):
"""Dagster was unable to reach a user code server to fetch information about user code."""
| DagsterUserCodeUnreachableError |
python | django__django | tests/introspection/models.py | {
"start": 3341,
"end": 3618
} | class ____(models.Model):
fk_do_nothing = models.ForeignKey(Country, on_delete=models.DO_NOTHING)
fk_db_cascade = models.ForeignKey(City, on_delete=models.DB_CASCADE)
class Meta:
required_db_features = {"supports_on_delete_db_cascade"}
| DbOnDeleteCascadeModel |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-jira/integration_tests/fixtures/data_generator/streams.py | {
"start": 13779,
"end": 14165
} | class ____(Screens, GeneratorMixin):
"""
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-screens/#api-rest-api-3-screens-post
"""
def generate(self):
for index in range(1, 20):
payload = json.dumps({"name": f"Test screen {index}", "description": f"Test screen {... | ScreensGenerator |
python | pytorch__pytorch | torch/__init__.py | {
"start": 100754,
"end": 107111
} | class ____:
lib = torch.library.Library("triton", "DEF")
ops_table: dict[tuple[str, str], _Callable] = {}
@classmethod
def registerOp(cls, op_key, full_schema, op_impl, dispatch_key):
if (op_key, dispatch_key) not in cls.ops_table:
cls.lib.define(full_schema)
cls.lib.imp... | _TritonLibrary |
python | doocs__leetcode | solution/0000-0099/0018.4Sum/Solution.py | {
"start": 0,
"end": 1038
} | class ____:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
n = len(nums)
ans = []
if n < 4:
return ans
nums.sort()
for i in range(n - 3):
if i and nums[i] == nums[i - 1]:
continue
for j in range(i + 1, n... | Solution |
python | cython__cython | Cython/Debugger/Tests/test_libcython_in_gdb.py | {
"start": 12345,
"end": 13564
} | class ____(DebugTestCase):
def workaround_for_coding_style_checker(self, correct_result_wrong_whitespace):
correct_result = ""
for line in correct_result_test_list_inside_func.split("\n"):
if len(line) < 10 and len(line) > 0:
line += " "*4
correct_result += li... | TestList |
python | google__jax | tests/pallas/pallas_test.py | {
"start": 76717,
"end": 79430
} | class ____(PallasBaseTest):
INTERPRET = True
def test_interpret_mode_out_of_bounds_access(self):
block_size = 32
dtype = jnp.float32
# Create input tensors which require a reduction along an axis
# not divisible by block_size.
x = jax.random.normal(jax.random.key(0),
(... | PallasOutOfBoundsInterpretTest |
python | jmcnamara__XlsxWriter | xlsxwriter/test/core/test_core01.py | {
"start": 365,
"end": 1736
} | class ____(unittest.TestCase):
"""
Test assembling a complete Core file.
"""
def test_assemble_xml_file(self):
"""Test writing an Core file."""
self.maxDiff = None
fh = StringIO()
core = Core()
core._set_filehandle(fh)
properties = {
"autho... | TestAssembleCore |
python | ansible__ansible | lib/ansible/errors/__init__.py | {
"start": 6881,
"end": 7018
} | class ____(AnsibleError):
"""A playbook or data file could not be parsed."""
_exit_code = ExitCode.PARSER_ERROR
| AnsibleParserError |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 96345,
"end": 96764
} | class ____(sgqlc.types.Input):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("pull_request_review_id", "client_mutation_id")
pull_request_review_id = sgqlc.types.Field(
sgqlc.types.non_null(ID), graphql_name="pullRequestReviewId"
)
client_... | DeletePullRequestReviewInput |
python | pymupdf__PyMuPDF | src/table.py | {
"start": 13714,
"end": 19529
} | class ____:
"""
A WordMap maps words->chars.
"""
def __init__(self, tuples) -> None:
self.tuples = tuples
def to_textmap(
self,
layout: bool = False,
layout_width=0,
layout_height=0,
layout_width_chars: int = 0,
layout_height_chars: int = 0,
... | WordMap |
python | pytorch__pytorch | torch/_dynamo/package.py | {
"start": 33122,
"end": 37064
} | class ____(abc.ABC):
"""
A DynamoStore tracks active CompilePackages, and provides methods to store and retrieve them.
This is an abstract base class for different storage implementations.
"""
def record_package(self, package: CompilePackage) -> None:
"""
Records a package to Preco... | DynamoStore |
python | weaviate__weaviate-python-client | weaviate/collections/queries/near_text/generate/async_.py | {
"start": 314,
"end": 465
} | class ____(
Generic[Properties, References],
_NearTextGenerateExecutor[ConnectionAsync, Properties, References],
):
pass
| _NearTextGenerateAsync |
python | walkccc__LeetCode | solutions/1707. Maximum XOR With an Element From Array/1707.py | {
"start": 130,
"end": 914
} | class ____:
def __init__(self, maxBit: int):
self.maxBit = maxBit
self.root = TrieNode()
def insert(self, num: int) -> None:
node = self.root
for i in range(self.maxBit, -1, -1):
bit = num >> i & 1
if not node.children[bit]:
node.children[bit] = TrieNode()
node = node.chil... | BitTrie |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/methodOverride3.py | {
"start": 1369,
"end": 1411
} | class ____(F3[int], F1[int]):
pass
| FSub2 |
python | wandb__wandb | wandb/automations/_generated/enums.py | {
"start": 348,
"end": 753
} | class ____(str, Enum):
CREATE_ARTIFACT = "CREATE_ARTIFACT"
UPDATE_ARTIFACT_ALIAS = "UPDATE_ARTIFACT_ALIAS"
ADD_ARTIFACT_ALIAS = "ADD_ARTIFACT_ALIAS"
ADD_ARTIFACT_TAG = "ADD_ARTIFACT_TAG"
LINK_MODEL = "LINK_MODEL"
RUN_METRIC = "RUN_METRIC"
RUN_METRIC_CHANGE = "RUN_METRIC_CHANGE"
RUN_STATE... | EventTriggeringConditionType |
python | mlflow__mlflow | tests/genai/evaluate/test_evaluation.py | {
"start": 5897,
"end": 44887
} | class ____:
host_type: Literal["local", "remote", "databricks"]
backend_type: Literal["file", "sqlalchemy"] | None = None
@pytest.fixture(scope="module")
def cached_db(tmp_path_factory: pytest.TempPathFactory) -> Path:
"""Creates and caches a SQLite database to avoid repeated migrations for each test run.... | ServerConfig |
python | ansible__ansible | test/units/_internal/templating/test_lazy_containers.py | {
"start": 31793,
"end": 40969
} | class ____(c.Sequence):
def __init__(self, values) -> None:
self._content = list(values)
def __getitem__(self, item) -> t.Any:
return self._content[item]
def __len__(self) -> int:
return len(self._content)
@pytest.mark.parametrize("expression, expected_result", (
# verify tem... | CustomSequence |
python | donnemartin__interactive-coding-challenges | graphs_trees/bst_second_largest/test_bst_second_largest.py | {
"start": 18,
"end": 962
} | class ____(unittest.TestCase):
def test_bst_second_largest(self):
bst = Solution(None)
self.assertRaises(TypeError, bst.find_second_largest)
root = Node(10)
bst = Solution(root)
node5 = bst.insert(5)
node15 = bst.insert(15)
node3 = bst.insert(3)
node8... | TestBstSecondLargest |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/function7.py | {
"start": 811,
"end": 1028
} | class ____:
def write(self, __a: str, b: str):
pass
def make_writer3(w: _Writer3):
pass
# This should generate an error because the source function is positional-only.
make_writer3(Writer3())
| Writer3 |
python | aio-libs__aiohttp | tests/test_client_exceptions.py | {
"start": 160,
"end": 2994
} | class ____:
request_info = client.RequestInfo(
url=URL("http://example.com"),
method="GET",
headers=CIMultiDictProxy(CIMultiDict()),
real_url=URL("http://example.com"),
)
def test_default_status(self) -> None:
err = client.ClientResponseError(history=(), request_info... | TestClientResponseError |
python | streamlit__streamlit | lib/tests/streamlit/web/server/oauth_authlib_routes_test.py | {
"start": 1619,
"end": 4930
} | class ____(tornado.testing.AsyncHTTPTestCase):
def get_app(self):
return tornado.web.Application(
[
(
r"/auth/login",
AuthLoginHandler,
{"base_url": ""},
)
]
)
@patch(
"st... | LoginHandlerTest |
python | celery__celery | celery/bin/base.py | {
"start": 7019,
"end": 7435
} | class ____(ParamType):
"""JSON formatted array argument."""
name = "json array"
def convert(self, value, param, ctx):
if isinstance(value, list):
return value
try:
v = json.loads(value)
except ValueError as e:
self.fail(str(e))
if not i... | JsonArray |
python | more-itertools__more-itertools | tests/test_more.py | {
"start": 84299,
"end": 104177
} | class ____(TestCase):
def test_basic(self):
for args, expected in [
((4,), [0, 1, 2, 3]),
((4.0,), [0.0, 1.0, 2.0, 3.0]),
((1.0, 4), [1.0, 2.0, 3.0]),
((1, 4.0), [1.0, 2.0, 3.0]),
((1.0, 5), [1.0, 2.0, 3.0, 4.0]),
((0, 20, 5), [0, 5, 10... | NumericRangeTests |
python | pytorch__pytorch | torch/nn/modules/padding.py | {
"start": 19984,
"end": 20249
} | class ____(Module):
__constants__ = ["padding"]
padding: Sequence[int]
def forward(self, input: Tensor) -> Tensor:
return F.pad(input, self.padding, "replicate")
def extra_repr(self) -> str:
return f"{self.padding}"
| _ReplicationPadNd |
python | PyCQA__pylint | tests/functional/i/implicit/implicit_flag_alias.py | {
"start": 86,
"end": 209
} | class ____(IntFlag):
"""Class with flags that do not overlap"""
X = 1
W = 2
R = 4
S = auto()
| DisjointFlags |
python | django__django | tests/backends/base/test_introspection.py | {
"start": 150,
"end": 1489
} | class ____(SimpleTestCase):
may_require_msg = (
"subclasses of BaseDatabaseIntrospection may require a %s() method"
)
def setUp(self):
self.introspection = BaseDatabaseIntrospection(connection=connection)
def test_get_table_list(self):
msg = self.may_require_msg % "get_table_li... | SimpleDatabaseIntrospectionTests |
python | spack__spack | lib/spack/spack/llnl/util/tty/log.py | {
"start": 15225,
"end": 23992
} | class ____:
"""
Under the hood, we spawn a daemon and set up a pipe between this
process and the daemon. The daemon writes our output to both the
file and to stdout (if echoing). The parent process can communicate
with the daemon to tell it when and when not to echo; this is what
force_echo do... | nixlog |
python | optuna__optuna | tutorial/20_recipes/007_optuna_callback.py | {
"start": 964,
"end": 2549
} | class ____:
def __init__(self, threshold: int):
self.threshold = threshold
self._consequtive_pruned_count = 0
def __call__(self, study: optuna.study.Study, trial: optuna.trial.FrozenTrial) -> None:
if trial.state == optuna.trial.TrialState.PRUNED:
self._consequtive_pruned_co... | StopWhenTrialKeepBeingPrunedCallback |
python | django__django | tests/admin_views/admin.py | {
"start": 20901,
"end": 21006
} | class ____(admin.ModelAdmin):
prepopulated_fields = {"slug": ("title",)}
| PrePopulatedPostLargeSlugAdmin |
python | charliermarsh__ruff | crates/ty_python_semantic/resources/corpus/77_class__class__nonlocals_2.py | {
"start": 0,
"end": 157
} | class ____:
def f(self):
class Inner:
nonlocal __class__
__class__ = 42
def f():
__class__
| Outer |
python | fastapi__sqlmodel | docs_src/tutorial/code_structure/tutorial002/hero_model.py | {
"start": 149,
"end": 497
} | class ____(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str = Field(index=True)
secret_name: str
age: Optional[int] = Field(default=None, index=True)
team_id: Optional[int] = Field(default=None, foreign_key="team.id")
team: Optional["Team"] = Relationsh... | Hero |
python | openai__openai-python | src/openai/lib/streaming/responses/_responses.py | {
"start": 7749,
"end": 13614
} | class ____(Generic[TextFormatT]):
def __init__(
self,
*,
input_tools: Iterable[ToolParam] | Omit,
text_format: type[TextFormatT] | Omit,
) -> None:
self.__current_snapshot: ParsedResponseSnapshot | None = None
self._completed_response: ParsedResponse[TextFormatT] ... | ResponseStreamState |
python | django__django | tests/queries/models.py | {
"start": 3503,
"end": 3805
} | class ____(models.Model):
num = models.IntegerField()
other_num = models.IntegerField(null=True)
another_num = models.IntegerField(null=True)
def __str__(self):
return str(self.num)
# Symmetrical m2m field with a normal field using the reverse accessor name
# ("valid").
| Number |
python | altair-viz__altair | tests/utils/test_plugin_registry.py | {
"start": 179,
"end": 3785
} | class ____(PluginRegistry):
_global_settings = {"global_setting": None}
@property
def global_setting(self):
return self._global_settings["global_setting"]
@global_setting.setter
def global_setting(self, val):
self._global_settings["global_setting"] = val
def test_plugin_registry(... | GeneralCallableRegistry |
python | huggingface__transformers | src/transformers/modeling_gguf_pytorch_utils.py | {
"start": 8866,
"end": 9430
} | class ____(TensorProcessor):
def __init__(self, config=None):
super().__init__(config=config)
# ref: https://github.com/ggerganov/llama.cpp/blob/d79d8f39b4da6deca4aea8bf130c6034c482b320/convert_hf_to_gguf.py#L3191
# ref: https://github.com/huggingface/transformers/blob/fc37f38915372c15992b540dfcbbe... | Gemma2TensorProcessor |
python | Textualize__textual | docs/examples/guide/screens/modal03.py | {
"start": 498,
"end": 1047
} | class ____(ModalScreen[bool]): # (1)!
"""Screen with a dialog to quit."""
def compose(self) -> ComposeResult:
yield Grid(
Label("Are you sure you want to quit?", id="question"),
Button("Quit", variant="error", id="quit"),
Button("Cancel", variant="primary", id="canc... | QuitScreen |
python | pytorch__pytorch | test/distributed/_composable/test_contract.py | {
"start": 255,
"end": 757
} | class ____(nn.Module):
def __init__(self) -> None:
super().__init__()
self.seq1 = nn.Sequential(*[nn.Linear(10, 10) for _ in range(2)])
self.seq2 = nn.Sequential(*[nn.Linear(10, 10) for _ in range(2)])
self.p = nn.Parameter(torch.randn(10, 10), requires_grad=True)
self.b = to... | ToyModel |
python | pytorch__pytorch | test/dynamo/cpython/3_13/test_set.py | {
"start": 64411,
"end": 64605
} | class ____:
def __eq__(self, other):
if be_bad:
set2.clear()
raise ZeroDivisionError
return self is other
def __hash__(self):
return 0
| bad_eq |
python | wandb__wandb | wandb/sdk/data_types/trace_tree.py | {
"start": 2370,
"end": 3907
} | class ____(Media):
"""Media object for trace tree data.
Args:
root_span (Span): The root span of the trace tree.
model_dict (dict, optional): A dictionary containing the model dump.
NOTE: model_dict is a completely-user-defined dict. The UI will render
a JSON viewer for ... | WBTraceTree |
python | facebook__pyre-check | source/interprocedural_analyses/taint/test/integration/constructors.py | {
"start": 1737,
"end": 1826
} | class ____:
def __init__(self) -> None:
self.x = _test_source()
| BaseConstructor |
python | tensorflow__tensorflow | tensorflow/python/debug/wrappers/local_cli_wrapper_test.py | {
"start": 2171,
"end": 5078
} | class ____(
local_cli_wrapper.LocalCLIDebugWrapperSession):
"""Subclasses the wrapper class for testing.
Overrides its CLI-related methods for headless testing environments.
Inserts observer variables for assertions.
"""
def __init__(self,
command_sequence,
sess,
... | LocalCLIDebuggerWrapperSessionForTest |
python | openai__gym | tests/wrappers/test_filter_observation.py | {
"start": 1533,
"end": 2972
} | class ____:
@pytest.mark.parametrize(
"observation_keys,filter_keys", FILTER_OBSERVATION_TEST_CASES
)
def test_filter_observation(self, observation_keys, filter_keys):
env = FakeEnvironment(observation_keys=observation_keys)
# Make sure we are testing the right environment for the t... | TestFilterObservation |
python | pytest-dev__pytest | src/_pytest/capture.py | {
"start": 17718,
"end": 18958
} | class ____(FDCaptureBase[str]):
"""Capture IO to/from a given OS-level file descriptor.
snap() produces text.
"""
EMPTY_BUFFER = ""
def snap(self) -> str:
self._assert_state("snap", ("started", "suspended"))
self.tmpfile.seek(0)
res = self.tmpfile.read()
self.tmpfi... | FDCapture |
python | astropy__astropy | astropy/nddata/tests/test_blocks.py | {
"start": 177,
"end": 2493
} | class ____:
def test_1d(self):
data = np.arange(16)
reshaped = reshape_as_blocks(data, 2)
assert reshaped.shape == (8, 2)
reshaped = reshape_as_blocks(data, 4)
assert reshaped.shape == (4, 4)
reshaped = reshape_as_blocks(data, 8)
assert reshaped.shape == (2, 8... | TestReshapeAsBlocks |
python | astropy__astropy | astropy/modeling/bounding_box.py | {
"start": 34759,
"end": 41252
} | class ____(tuple):
"""
Contains the CompoundBoundingBox slicing description.
Parameters
----------
input_ :
The SelectorArgument values
Methods
-------
validate :
Returns a valid SelectorArguments for its model.
get_selector :
Returns the selector a set of ... | _SelectorArguments |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 259900,
"end": 260359
} | class ____(sgqlc.types.Input):
"""Autogenerated input type of PinIssue"""
__schema__ = github_schema
__field_names__ = ("issue_id", "client_mutation_id")
issue_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="issueId")
"""The ID of the issue to be pinned"""
client_mutation_id = s... | PinIssueInput |
python | django__django | tests/generic_views/forms.py | {
"start": 55,
"end": 224
} | class ____(forms.ModelForm):
name = forms.CharField()
slug = forms.SlugField()
class Meta:
model = Author
fields = ["name", "slug"]
| AuthorForm |
python | getsentry__sentry | tests/sentry/search/events/builder/test_metrics.py | {
"start": 61876,
"end": 115899
} | class ____(MetricBuilderBaseTest):
@pytest.mark.querybuilder
def test_get_query(self) -> None:
orig_query = TimeseriesMetricQueryBuilder(
self.params,
dataset=Dataset.PerformanceMetrics,
interval=900,
query="",
selected_columns=["p50(transactio... | TimeseriesMetricQueryBuilderTest |
python | scikit-learn__scikit-learn | sklearn/ensemble/tests/test_bagging.py | {
"start": 8049,
"end": 24067
} | class ____(BaseEstimator):
def fit(self, X, y):
self.training_size_ = X.shape[0]
self.training_hash_ = joblib.hash(X)
def predict(self, X):
return np.ones(X.shape[0])
def test_bootstrap_samples():
# Test that bootstrapping samples generate non-perfect base estimators.
rng = ch... | DummySizeEstimator |
python | getsentry__sentry | tests/sentry/receivers/test_staff.py | {
"start": 141,
"end": 523
} | class ____(TestCase):
def test_disable_staff_active_upon_logout(self) -> None:
staff_user = self.create_user(is_staff=True)
staff_request = self.make_request(user=staff_user, is_staff=True)
assert is_active_staff(staff_request)
disable_staff(request=staff_request, user=staff_user)
... | StaffReceiverTest |
python | gevent__gevent | src/gevent/tests/test__fileobject.py | {
"start": 10626,
"end": 13757
} | class ____(object):
# Additional tests for fileobjects that cooperate
# and we have full control of the implementation
def test_read1_binary_present(self):
# Issue #840
r, w = self._pipe()
reader = self._makeOne(r, 'rb')
self._close_on_teardown(reader)
writer = self.... | ConcurrentFileObjectMixin |
python | great-expectations__great_expectations | tests/datasource/fluent/test_snowflake_datasource.py | {
"start": 39765,
"end": 44408
} | class ____:
def test_schema(
self,
ds_config: dict,
seed_env_vars: None,
param_id: str,
ephemeral_context_with_defaults: AbstractDataContext,
):
datasource = SnowflakeDatasource(name=param_id, **ds_config)
if isinstance(datasource.connection_string, Config... | TestConvenienceProperties |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/array_ops/depthtospace_op_test.py | {
"start": 13457,
"end": 15215
} | class ____(test.TestCase):
# Check the gradients.
def _checkGrad(self, x, block_size, data_format):
# NCHW is implemented for only GPU.
if data_format == "NCHW" and not test.is_gpu_available():
return
assert 4 == x.ndim
with self.cached_session():
tf_x = ops.convert_to_tensor(x)
... | DepthToSpaceGradientTest |
python | catalyst-team__catalyst | catalyst/contrib/data/sampler.py | {
"start": 4265,
"end": 9388
} | class ____(Sampler):
"""
This kind of sampler can be used for classification tasks with significant
class imbalance.
The idea of this sampler that we start with the original class distribution
and gradually move to uniform class distribution like with downsampling.
Let's define :math: D_i = #C... | DynamicBalanceClassSampler |
python | scrapy__scrapy | tests/test_utils_misc/test_return_with_argument_inside_generator.py | {
"start": 590,
"end": 9634
} | class ____:
@pytest.fixture
def mock_spider(self):
class MockSettings:
def __init__(self, settings_dict=None):
self.settings_dict = settings_dict or {
"WARN_ON_GENERATOR_RETURN_VALUE": True
}
def getbool(self, name, default=Fal... | TestUtilsMisc |
python | kamyu104__LeetCode-Solutions | Python/count-hills-and-valleys-in-an-array.py | {
"start": 49,
"end": 474
} | class ____(object):
def countHillValley(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
result, inc = 0, -1
for i in xrange(len(nums)-1):
if nums[i] < nums[i+1]:
result += int(inc == 0)
inc = 1
elif nums[i... | Solution |
python | davidhalter__jedi | test/refactor/extract_function.py | {
"start": 1687,
"end": 1916
} | class ____:
def z(self): pass
def ab(x, b):
return x + b * 2
def f(x, b):
#? 11 text {'new_name': 'ab'}
return x.ab(b)
# -------------------------------------------------- in-method-2
glob1 = 1
| X |
python | ray-project__ray | python/ray/autoscaler/v2/scheduler.py | {
"start": 4448,
"end": 4875
} | class ____(Enum):
"""
The source of the resource request.
"""
# The resource request is from demand, e.g. ray tasks/actors,
# placement groups, etc.
PENDING_DEMAND = "PENDING_DEMAND"
# The resource request is from the cluster resource constraints, i.e.
# from ray.autoscaler.sdk.request_... | ResourceRequestSource |
python | getsentry__sentry | tests/sentry/notifications/notification_action/test_issue_alert_registry_handlers.py | {
"start": 33972,
"end": 39607
} | class ____(BaseWorkflowTest):
def setUp(self) -> None:
super().setUp()
self.project = self.create_project()
self.group, self.event, self.group_event = self.create_group_event()
self.event_data = WorkflowEventData(
event=self.group_event, workflow_env=self.environment, gro... | TestInvokeFutureWithErrorHandling |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/definitions/partitions/mapping/multi/base.py | {
"start": 12531,
"end": 13636
} | class ____(
NamedTuple(
"_DimensionPartitionMapping",
[
("dimension_name", str),
("partition_mapping", PartitionMapping),
],
)
):
"""A helper class for MultiPartitionMapping that defines a partition mapping used to calculate
the dependent partition keys in... | DimensionPartitionMapping |
python | getsentry__sentry | src/sentry/workflow_engine/typings/notification_action.py | {
"start": 2330,
"end": 5336
} | class ____(TypedDict):
"""Mapping between Action model fields and Rule Action blob fields"""
id: str
integration_id_key: NotRequired[str]
target_identifier_key: NotRequired[str]
target_display_key: NotRequired[str]
ACTION_FIELD_MAPPINGS: dict[str, ActionFieldMapping] = {
ActionType.SLACK: Act... | ActionFieldMapping |
python | MongoEngine__mongoengine | mongoengine/context_managers.py | {
"start": 811,
"end": 1513
} | class ____(threading.local):
def __init__(self):
# {DocCls: count} keeping track of classes with an active no_dereference context
self.no_dereferencing_class = {}
thread_locals = MyThreadLocals()
def no_dereferencing_active_for_class(cls):
return cls in thread_locals.no_dereferencing_class
... | MyThreadLocals |
python | ansible__ansible | lib/ansible/errors/__init__.py | {
"start": 7133,
"end": 7798
} | class ____(AnsibleParserError):
"""JSON-specific parsing failure wrapping an exception raised by the JSON parser."""
_default_message = 'JSON parsing failed.'
_include_cause_message = False # hide the underlying cause message, it's included by `handle_exception` as needed
@classmethod
def handle_... | AnsibleJSONParserError |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/linalg/matrix_solve_ls_op_test.py | {
"start": 10246,
"end": 13806
} | class ____(test_lib.Benchmark):
matrix_shapes = [
(4, 4),
(8, 4),
(4, 8),
(10, 10),
(10, 8),
(8, 10),
(16, 16),
(16, 10),
(10, 16),
(101, 101),
(101, 31),
(31, 101),
(256, 256),
(256, 200),
(200, 256),
(1001, 1001),
... | MatrixSolveLsBenchmark |
python | getsentry__sentry | src/sentry/integrations/jira_server/webhooks.py | {
"start": 2027,
"end": 3978
} | class ____(Endpoint):
owner = ApiOwner.INTEGRATIONS
publish_status = {
"POST": ApiPublishStatus.PRIVATE,
}
rate_limits = RateLimitConfig(
limit_overrides={
"POST": {
RateLimitCategory.IP: RateLimit(limit=100, window=1),
RateLimitCategory.USER:... | JiraServerIssueUpdatedWebhook |
python | doocs__leetcode | solution/2300-2399/2318.Number of Distinct Roll Sequences/Solution.py | {
"start": 0,
"end": 817
} | class ____:
def distinctSequences(self, n: int) -> int:
if n == 1:
return 6
mod = 10**9 + 7
dp = [[[0] * 6 for _ in range(6)] for _ in range(n + 1)]
for i in range(6):
for j in range(6):
if gcd(i + 1, j + 1) == 1 and i != j:
... | Solution |
python | doocs__leetcode | solution/1900-1999/1977.Number of Ways to Separate Numbers/Solution.py | {
"start": 0,
"end": 919
} | class ____:
def numberOfCombinations(self, num: str) -> int:
def cmp(i, j, k):
x = lcp[i][j]
return x >= k or num[i + x] >= num[j + x]
mod = 10**9 + 7
n = len(num)
lcp = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(n - 1, -1, -1):
... | Solution |
python | pandas-dev__pandas | asv_bench/benchmarks/reindex.py | {
"start": 2162,
"end": 2857
} | class ____:
def setup(self):
self.index = MultiIndex(
levels=[np.arange(10), np.arange(100), np.arange(100)],
codes=[
np.arange(10).repeat(10000),
np.tile(np.arange(100).repeat(100), 10),
np.tile(np.tile(np.arange(100), 100), 10),
... | LevelAlign |
python | apache__airflow | airflow-core/tests/unit/api_fastapi/execution_api/versions/v2025_09_23/test_task_instances.py | {
"start": 3237,
"end": 5083
} | class ____:
"""Test that API version 2025-09-23 converts NULL conf to empty dict."""
def setup_method(self):
clear_db_runs()
def teardown_method(self):
clear_db_runs()
def test_ti_run_null_conf_converted_to_dict(
self,
ver_client,
session,
create_task_i... | TestTIRunConfV20250923 |
python | getsentry__sentry | src/sentry/integrations/example/integration.py | {
"start": 1444,
"end": 2667
} | class ____:
TEMPLATE = """
<form method="POST">
<p>This is an example integration configuration page.</p>
<p><label>Integration Name:</label></p>
<p><input type="name" name="name" /></p>
<p><input type="submit" value="Continue" /></p>
</form>
"""
... | ExampleSetupView |
python | getsentry__sentry | tests/sentry/integrations/jira/test_webhooks.py | {
"start": 8726,
"end": 9480
} | class ____(JiraWebhookBase):
permission_classes = ()
dummy_exception = Exception("whoops")
# In order to be able to use `as_view`'s `initkwargs` (in other words, in order to be able to
# pass kwargs to `as_view` and have `as_view` pass them onto the `__init__` method below), any
# kwarg we'd like to... | MockErroringJiraEndpoint |
python | run-llama__llama_index | llama-index-core/llama_index/core/evaluation/benchmarks/beir.py | {
"start": 342,
"end": 4191
} | class ____:
"""
Refer to: https://github.com/beir-cellar/beir for a full list of supported datasets
and a full description of BEIR.
"""
def __init__(self) -> None:
try:
pass
except ImportError:
raise ImportError(
"Please install beir to use th... | BeirEvaluator |
python | RaRe-Technologies__gensim | gensim/test/test_fasttext.py | {
"start": 56155,
"end": 61803
} | class ____(unittest.TestCase):
def setUp(self):
self.expected_text = {
'test': ['<te', 'tes', 'est', 'st>', '<tes', 'test', 'est>', '<test', 'test>'],
'at the': [
'<at', 'at ', 't t', ' th', 'the', 'he>',
'<at ', 'at t', 't th', ' the', 'the>', '<at t'... | NgramsTest |
python | ray-project__ray | python/ray/serve/tests/unit/test_application_state.py | {
"start": 58087,
"end": 99621
} | class ____:
def test_autoscale(self, mocked_application_state_manager):
"""Test autoscaling behavior with two deployments under load."""
(
app_state_manager,
deployment_state_manager,
_,
) = mocked_application_state_manager
# Setup: Create autosca... | TestAutoscale |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-google-ads/source_google_ads/streams.py | {
"start": 13132,
"end": 13349
} | class ____(GoogleAdsStream):
"""
This stream is intended to be used as a service class, not exposed to a user
"""
CATCH_CUSTOMER_NOT_ENABLED_ERROR = False
primary_key = ["customer.id"]
| ServiceAccounts |
python | dagster-io__dagster | python_modules/libraries/dagster-airlift/dagster_airlift_tests/integration_tests/materialize_assets_operator_test_project/dags/dag.py | {
"start": 684,
"end": 1573
} | class ____(BaseMaterializeAssetsOperator):
"""An assets operator which opens a blank session and expects the dagster URL to be set in the environment.
The dagster url is expected to be set in the environment as DAGSTER_URL.
"""
def get_dagster_session(self, context: Context) -> requests.Session: # pyr... | BlankSessionAssetsOperator |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 263121,
"end": 263634
} | class ____(sgqlc.types.Input):
"""Ordering options for project v2 item field value connections"""
__schema__ = github_schema
__field_names__ = ("field", "direction")
field = sgqlc.types.Field(sgqlc.types.non_null(ProjectV2ItemFieldValueOrderField), graphql_name="field")
"""The field to order the pr... | ProjectV2ItemFieldValueOrder |
python | getsentry__sentry | tests/sentry/preprod/api/endpoints/test_preprod_artifact_rerun_analysis.py | {
"start": 6549,
"end": 10929
} | class ____(BaseRerunAnalysisTest):
endpoint = "sentry-admin-preprod-artifact-rerun-analysis"
method = "post"
def setUp(self):
super().setUp()
self.user = self.create_user(is_staff=True)
self.organization = self.create_organization(owner=self.user)
self.project = self.create_... | PreprodArtifactAdminRerunAnalysisTest |
python | huggingface__transformers | tests/models/grounding_dino/test_image_processing_grounding_dino.py | {
"start": 1306,
"end": 5981
} | class ____:
def __init__(
self,
parent,
batch_size=7,
num_channels=3,
min_resolution=30,
max_resolution=400,
do_resize=True,
size=None,
do_normalize=True,
image_mean=[0.5, 0.5, 0.5],
image_std=[0.5, 0.5, 0.5],
do_rescale... | GroundingDinoImageProcessingTester |
python | joke2k__faker | tests/providers/test_currency.py | {
"start": 8926,
"end": 9351
} | class ____:
"""Test en_AU currency provider"""
num_samples = 100
@classmethod
def setup_class(cls):
from faker.providers.currency.en_AU import Provider as EnAuCurrencyProvider
cls.provider = EnAuCurrencyProvider
def test_pricetag(self, faker, num_samples):
for _ in range(... | TestEnAu |
python | sqlalchemy__sqlalchemy | test/dialect/mysql/test_query.py | {
"start": 9022,
"end": 10477
} | class ____(fixtures.TablesTest):
__only_on__ = "mysql", "mariadb"
__backend__ = True
@classmethod
def define_tables(cls, metadata):
Table(
"stuff",
metadata,
Column("id", Integer, primary_key=True),
Column("value", Integer),
)
@classm... | AnyAllTest |
python | patrick-kidger__equinox | equinox/debug/_max_traces.py | {
"start": 964,
"end": 6135
} | class ____(Module):
fn: Callable
max_traces: int | None = field(static=True)
tag: _Weakrefable = field(static=True)
def __init__(self, fn, max_traces):
self.fn = fn
self.max_traces = max_traces
self.tag = _Weakrefable()
_traces[self.tag] = 0
_seen_args[self.tag] ... | _AssertMaxTraces |
python | pandas-dev__pandas | pandas/core/window/rolling.py | {
"start": 2476,
"end": 22141
} | class ____(SelectionMixin):
"""Provides utilities for performing windowing operations."""
_attributes: list[str] = []
exclusions: frozenset[Hashable] = frozenset()
_on: Index
def __init__(
self,
obj: NDFrame,
window=None,
min_periods: int | None = None,
cent... | BaseWindow |
python | numba__numba | numba/tests/test_sort.py | {
"start": 40006,
"end": 40848
} | class ____(MemoryLeakMixin, TestCase):
"""Tests specific to array.argsort"""
def test_exceptions(self):
@njit
def nonliteral_kind(kind):
np.arange(5).argsort(kind=kind)
# check non-literal kind
with self.assertRaises(errors.TypingError) as raises:
# val... | TestArrayArgsort |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/backfill.py | {
"start": 4034,
"end": 4238
} | class ____(graphene.Union):
class Meta:
types = (GrapheneResumeBackfillSuccess, GrapheneUnauthorizedError, GraphenePythonError)
name = "ResumeBackfillResult"
| GrapheneResumeBackfillResult |
python | altair-viz__altair | altair/vegalite/v6/api.py | {
"start": 10970,
"end": 17312
} | class ____(_expr_core.OperatorMixin):
"""A Parameter object."""
_schema: t.ClassVar[_TypeMap[Literal["object"]]] = {"type": "object"}
def _compute_hash(self) -> str:
"""
Compute a deterministic hash of the parameter specification.
Includes parameter type, configuration, and contex... | Parameter |
python | matplotlib__matplotlib | lib/mpl_toolkits/axes_grid1/inset_locator.py | {
"start": 2177,
"end": 3027
} | class ____(AnchoredLocatorBase):
def __init__(self, parent_axes, zoom, loc,
borderpad=0.5,
bbox_to_anchor=None,
bbox_transform=None):
self.parent_axes = parent_axes
self.zoom = zoom
if bbox_to_anchor is None:
bbox_to_anchor = par... | AnchoredZoomLocator |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.