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 | django__django | tests/staticfiles_tests/test_management.py | {
"start": 15537,
"end": 16352
} | class ____(TestDefaults, CollectionTestCase):
"""
The ``--no-default-ignore`` option of the ``collectstatic`` management
command.
"""
def run_collectstatic(self):
super().run_collectstatic(use_default_ignore_patterns=False)
def test_no_common_ignore_patterns(self):
"""
... | TestCollectionNoDefaultIgnore |
python | ansible__ansible | test/lib/ansible_test/_internal/target.py | {
"start": 25113,
"end": 25569
} | class ____(ApplicationError):
"""One or more targets were not matched when a match was required."""
def __init__(self, patterns: set[str]) -> None:
self.patterns = sorted(patterns)
if len(patterns) > 1:
message = 'Target patterns not matched:\n%s' % '\n'.join(self.patterns)
... | TargetPatternsNotMatched |
python | realpython__materials | python-enum/oses.py | {
"start": 163,
"end": 275
} | class ____(Enum):
UBUNTU = "linux"
MACOS = "darwin"
WINDOWS = "win"
DEBIAN = "linux"
| OperatingSystem |
python | zarr-developers__zarr-python | src/zarr/core/indexing.py | {
"start": 18046,
"end": 19522
} | class ____(NamedTuple):
"""A mapping of items from chunk to output array. Can be used to extract items from the
chunk array for loading into an output array. Can also be used to extract items from a
value array for setting/updating in a chunk array.
Attributes
----------
chunk_coords
In... | ChunkProjection |
python | tensorflow__tensorflow | tensorflow/python/autograph/tests/generator_test.py | {
"start": 971,
"end": 1506
} | class ____(reference_test_base.TestCase):
def test_basic_generator(self):
with self.assertRaisesRegex(NotImplementedError, 'generators'):
tf.function(basic_generator)()
def test_generator_in_for(self):
with self.assertRaisesRegex(NotImplementedError, 'generators'):
tf.function(generator_in_for... | LoopControlFlowTest |
python | numba__numba | numba/core/targetconfig.py | {
"start": 3599,
"end": 3696
} | class ____:
def __repr__(self):
return "<NotSet>"
_NotSet = _NotSetType()
| _NotSetType |
python | coleifer__peewee | tests/sqlite.py | {
"start": 90944,
"end": 91515
} | class ____(ModelTestCase):
database = get_in_memory_db()
requires = [TDecModel]
def test_tdecimal_field(self):
value = D('12345678.0123456789012345')
value_ov = D('12345678.012345678901234567890123456789')
td1 = TDecModel.create(value=value)
td2 = TDecModel.create(value=val... | TestTDecimalField |
python | keras-team__keras | keras/src/layers/convolutional/separable_conv2d.py | {
"start": 245,
"end": 6533
} | class ____(BaseSeparableConv):
"""2D separable convolution layer.
This layer performs a depthwise convolution that acts separately on
channels, followed by a pointwise convolution that mixes channels.
If `use_bias` is True and a bias initializer is provided,
it adds a bias vector to the output. It ... | SeparableConv2D |
python | django__django | tests/admin_widgets/tests.py | {
"start": 32208,
"end": 34476
} | class ____(TestCase):
def test_render(self):
band = Band.objects.create(name="Linkin Park")
m1 = Member.objects.create(name="Chester")
m2 = Member.objects.create(name="Mike")
band.members.add(m1, m2)
rel = Band._meta.get_field("members").remote_field
w = widgets.Man... | ManyToManyRawIdWidgetTest |
python | ray-project__ray | rllib/algorithms/ppo/tests/test_ppo_learner.py | {
"start": 1318,
"end": 4825
} | class ____(unittest.TestCase):
ENV = gym.make("CartPole-v1")
@classmethod
def setUpClass(cls):
ray.init()
@classmethod
def tearDownClass(cls):
ray.shutdown()
def test_save_to_path_and_restore_from_path(self):
"""Tests saving and loading the state of the PPO Learner Gro... | TestPPO |
python | google__pytype | pytype/errors/error_types.py | {
"start": 1867,
"end": 1988
} | class ____:
sig: types.Signature
passed_args: Sequence[tuple[str, types.BaseValue]]
bad_param: BadType | None
| BadCall |
python | pandas-dev__pandas | pandas/tests/frame/indexing/test_setitem.py | {
"start": 38926,
"end": 43974
} | class ____:
@pytest.mark.parametrize(
"mask_type",
[lambda df: df > np.abs(df) / 2, lambda df: (df > np.abs(df) / 2).values],
ids=["dataframe", "array"],
)
def test_setitem_boolean_mask(self, mask_type, float_frame):
# Test for issue #18582
df = float_frame.copy()
... | TestDataFrameSetItemBooleanMask |
python | openai__openai-python | src/openai/resources/evals/evals.py | {
"start": 25175,
"end": 25904
} | class ____:
def __init__(self, evals: AsyncEvals) -> None:
self._evals = evals
self.create = async_to_streamed_response_wrapper(
evals.create,
)
self.retrieve = async_to_streamed_response_wrapper(
evals.retrieve,
)
self.update = async_to_strea... | AsyncEvalsWithStreamingResponse |
python | huggingface__transformers | src/transformers/models/qwen3_vl_moe/configuration_qwen3_vl_moe.py | {
"start": 1325,
"end": 9743
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`Qwen3VLMoeTextModel`]. It is used to instantiate a
Qwen3-VL-MOE model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a s... | Qwen3VLMoeTextConfig |
python | huggingface__transformers | src/transformers/models/superpoint/modeling_superpoint.py | {
"start": 5637,
"end": 7420
} | class ____(nn.Module):
"""
SuperPoint encoder module. It is made of 4 convolutional layers with ReLU activation and max pooling, reducing the
dimensionality of the image.
"""
def __init__(self, config: SuperPointConfig) -> None:
super().__init__()
# SuperPoint uses 1 channel images... | SuperPointEncoder |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/dialects/postgresql/hstore.py | {
"start": 8211,
"end": 8342
} | class ____(sqlfunc.GenericFunction):
type = sqltypes.Boolean
name = "defined"
inherit_cache = True
| _HStoreDefinedFunction |
python | pytorch__pytorch | test/jit/test_dataclasses.py | {
"start": 1018,
"end": 1192
} | class ____:
def __init__(self, alpha: float = 0.125, scheme: MixupScheme2 = MixupScheme2.A):
self.alpha = alpha
self.scheme = scheme
@dataclass
| MixupParams2 |
python | pallets__werkzeug | tests/test_debug.py | {
"start": 536,
"end": 6783
} | class ____:
def test_basic_repr(self):
assert debug_repr([]) == "[]"
assert debug_repr([1, 2]) == (
'[<span class="number">1</span>, <span class="number">2</span>]'
)
assert debug_repr([1, "test"]) == (
'[<span class="number">1</span>,'
' <span cla... | TestDebugRepr |
python | numba__numba | numba/tests/test_stencils.py | {
"start": 3686,
"end": 21250
} | class ____(TestStencilBase):
def __init__(self, *args, **kwargs):
super(TestStencil, self).__init__(*args, **kwargs)
@skip_unsupported
def test_stencil1(self):
"""Tests whether the optional out argument to stencil calls works.
"""
def test_with_out(n):
A = np.ar... | TestStencil |
python | vyperlang__vyper | vyper/codegen/jumptable_utils.py | {
"start": 164,
"end": 259
} | class ____:
method_id: int
payable: bool
# bucket for dense function
@dataclass
| Signature |
python | pytorch__pytorch | torch/distributed/_tools/sac_ilp.py | {
"start": 8362,
"end": 11321
} | class ____(IntEnum):
RECOMPUTE = 0
SAVE = 1
def get_optimal_checkpointing_policy_per_module(
sac_stats: SACStats, memory_budget: float
) -> list[int]:
"""
This is adapted from --
https://github.com/facebookresearch/xformers/blob/c6c0ac31f1b08542a0bc27278c6ed10f825f6963/xformers/checkpoint.py#L... | SACDecision |
python | openai__openai-python | src/openai/types/beta/realtime/conversation_item_with_reference.py | {
"start": 252,
"end": 1014
} | class ____(BaseModel):
id: Optional[str] = None
"""
ID of a previous conversation item to reference (for `item_reference` content
types in `response.create` events). These can reference both client and server
created items.
"""
audio: Optional[str] = None
"""Base64-encoded audio bytes, ... | Content |
python | tensorflow__tensorflow | tensorflow/dtensor/python/tests/spmd_test.py | {
"start": 93281,
"end": 101367
} | class ____(test_util.DTensorBaseTest):
def setUp(self):
super(DTensorConvSPMDTest, self).setUp()
# TODO(b/169436213): Re-enable TPU after figuring out multi-chip story.
self.skipForDeviceType(['TPU'], 'reserving 4 chips on forge is unreliable')
if config.list_physical_devices('GPU') or config.list_... | DTensorConvSPMDTest |
python | allegroai__clearml | clearml/backend_api/services/v2_13/queues.py | {
"start": 71419,
"end": 72796
} | class ____(Request):
"""
:param queue: Queue id
:type queue: str
:param task: Task id
:type task: str
"""
_service = "queues"
_action = "move_task_to_front"
_version = "2.13"
_schema = {
"definitions": {},
"properties": {
"queue": {"description": "Que... | MoveTaskToFrontRequest |
python | spyder-ide__spyder | spyder/plugins/help/widgets.py | {
"start": 2177,
"end": 2276
} | class ____:
Display = 'display_section'
Other = 'other_section'
| HelpWidgetOptionsMenuSections |
python | realpython__materials | python-guitar-synthesizer/source_code_final/src/digitar/burst.py | {
"start": 249,
"end": 428
} | class ____:
def __call__(self, num_samples: int, sampling_rate: Hertz) -> np.ndarray:
return np.random.uniform(-1.0, 1.0, num_samples)
@dataclass(frozen=True)
| WhiteNoise |
python | pytorch__pytorch | test/test_unary_ufuncs.py | {
"start": 2238,
"end": 78385
} | class ____(TestCase):
exact_dtype = True
@ops(
[_fn for _fn in unary_ufuncs if _fn.domain != (None, None)],
allowed_dtypes=floating_types_and(torch.bfloat16, torch.half),
)
def test_float_domains(self, device, dtype, op):
eps = (1e-5, 1e-3, 1e-1, 1, 2, 10, 20, 50, 100)
... | TestUnaryUfuncs |
python | arrow-py__arrow | arrow/locales.py | {
"start": 57654,
"end": 60038
} | class ____(Locale):
names = [
"ar",
"ar-ae",
"ar-bh",
"ar-dj",
"ar-eg",
"ar-eh",
"ar-er",
"ar-km",
"ar-kw",
"ar-ly",
"ar-om",
"ar-qa",
"ar-sa",
"ar-sd",
"ar-so",
"ar-ss",
"ar-td",
... | ArabicLocale |
python | Textualize__textual | src/textual/widgets/_progress_bar.py | {
"start": 6656,
"end": 13150
} | class ____(Widget, can_focus=False):
"""A progress bar widget."""
DEFAULT_CSS = """
ProgressBar {
width: auto;
height: 1;
layout: horizontal;
}
"""
progress: reactive[float] = reactive(0.0)
"""The progress so far, in number of steps."""
total: reactive[float | N... | ProgressBar |
python | paramiko__paramiko | tests/_util.py | {
"start": 5730,
"end": 14478
} | class ____(ServerInterface):
paranoid_did_password = False
paranoid_did_public_key = False
paranoid_key = Ed25519Key.from_private_key_file(_support("ed25519.key"))
def __init__(self, allowed_keys=None):
self.allowed_keys = allowed_keys if allowed_keys is not None else []
def check_channel_... | TestServer |
python | apache__airflow | task-sdk/src/airflow/sdk/execution_time/comms.py | {
"start": 29591,
"end": 29724
} | class ____(BaseModel):
ti_id: UUID
type: Literal["GetPrevSuccessfulDagRun"] = "GetPrevSuccessfulDagRun"
| GetPrevSuccessfulDagRun |
python | pypa__pip | src/pip/_vendor/truststore/_windows.py | {
"start": 3282,
"end": 3483
} | class ____(Structure):
_fields_ = (
("cbSize", DWORD),
("dwAuthType", DWORD),
("fdwChecks", DWORD),
("pwszServerName", LPCWSTR),
)
| SSL_EXTRA_CERT_CHAIN_POLICY_PARA |
python | doocs__leetcode | lcci/08.06.Hanota/Solution2.py | {
"start": 0,
"end": 382
} | class ____:
def hanota(self, A: List[int], B: List[int], C: List[int]) -> None:
stk = [(len(A), A, B, C)]
while stk:
n, a, b, c = stk.pop()
if n == 1:
c.append(a.pop())
else:
stk.append((n - 1, b, a, c))
stk.append((... | Solution |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_chart_drop_lines01.py | {
"start": 315,
"end": 1547
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("chart_drop_lines01.xlsx")
def test_create_file(self):
"""Test the creation of an XlsxWriter file with drop down lines."""
workbook... | TestCompareXLSXFiles |
python | django__django | tests/queries/models.py | {
"start": 412,
"end": 831
} | class ____(models.Model):
name = models.CharField(max_length=10)
parent = models.ForeignKey(
"self",
models.SET_NULL,
blank=True,
null=True,
related_name="children",
)
category = models.ForeignKey(
NamedCategory, models.SET_NULL, null=True, default=None
... | Tag |
python | conda__conda | conda/models/match_spec.py | {
"start": 39241,
"end": 40379
} | class ____(MatchInterface):
__slots__ = ("_raw_value",)
def __init__(self, value):
super().__init__(self._convert(value))
def _convert(self, value):
try:
return frozenset(value.replace(" ", ",").split(","))
except AttributeError:
if isiterable(value):
... | SplitStrMatch |
python | spyder-ide__spyder | spyder/plugins/projects/widgets/projectdialog.py | {
"start": 2177,
"end": 7241
} | class ____(SpyderConfigPage, SpyderFontsMixin):
"""Base project page."""
# SidebarPage API
MIN_HEIGHT = 300
MAX_WIDTH = 430 if MAC else (400 if WIN else 420)
# SpyderConfigPage API
LOAD_FROM_CONFIG = False
# Own API
LOCATION_TEXT = _("Location")
LOCATION_TIP = None
def __init... | BaseProjectPage |
python | networkx__networkx | networkx/utils/tests/test_heaps.py | {
"start": 90,
"end": 3711
} | class ____:
def __eq__(self, other):
raise self is other
def __ne__(self, other):
raise self is not other
def __lt__(self, other):
raise TypeError("cannot compare")
def __le__(self, other):
raise TypeError("cannot compare")
def __ge__(self, other):
raise T... | X |
python | getsentry__sentry | tests/sentry/incidents/endpoints/test_organization_incident_index.py | {
"start": 395,
"end": 8077
} | class ____(APITestCase):
endpoint = "sentry-api-0-organization-incident-index"
@cached_property
def organization(self):
return self.create_organization()
@cached_property
def project(self):
return self.create_project(organization=self.organization)
@cached_property
def use... | IncidentListEndpointTest |
python | sanic-org__sanic | guide/webapp/display/plugins/attrs.py | {
"start": 235,
"end": 1184
} | class ____(DirectivePlugin):
def __call__(self, directive, md):
directive.register("attrs", self.parse)
if md.renderer.NAME == "html":
md.renderer.register("attrs", self._render)
def parse(
self, block: BlockParser, m: Match, state: BlockState
) -> dict[str, Any]:
... | Attributes |
python | apache__airflow | providers/apache/druid/src/airflow/providers/apache/druid/hooks/druid.py | {
"start": 7568,
"end": 9839
} | class ____(DbApiHook):
"""
Interact with Druid broker.
This hook is purely for users to query druid broker.
For ingestion, please use druidHook.
:param context: Optional query context parameters to pass to the SQL endpoint.
Example: ``{"sqlFinalizeOuterSketches": True}``
See: https... | DruidDbApiHook |
python | pypa__pip | src/pip/_vendor/pygments/style.py | {
"start": 1500,
"end": 5429
} | class ____(type):
def __new__(mcs, name, bases, dct):
obj = type.__new__(mcs, name, bases, dct)
for token in STANDARD_TYPES:
if token not in obj.styles:
obj.styles[token] = ''
def colorformat(text):
if text in ansicolors:
return text
... | StyleMeta |
python | nedbat__coveragepy | tests/test_plugins.py | {
"start": 5501,
"end": 10875
} | class ____(CoverageTest):
"""Test plugins through the Coverage class."""
def test_plugin_imported(self) -> None:
# Prove that a plugin will be imported.
self.make_file(
"my_plugin.py",
"""\
from coverage import CoveragePlugin
class Plugin(Coverage... | PluginTest |
python | huggingface__transformers | tests/models/zamba2/test_modeling_zamba2.py | {
"start": 10474,
"end": 20753
} | class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (
(
Zamba2Model,
Zamba2ForCausalLM,
Zamba2ForSequenceClassification,
)
if is_torch_available()
else ()
)
pipeline_model_mapping... | Zamba2ModelTest |
python | dagster-io__dagster | python_modules/dagster/dagster/_utils/indenting_printer.py | {
"start": 264,
"end": 2393
} | class ____:
def __init__(
self,
indent_level: int = 2,
printer: Callable[..., Any] = print,
current_indent: int = 0,
line_length: int = LINE_LENGTH,
):
self.current_indent = current_indent
self.indent_level = check.int_param(indent_level, "indent_level")
... | IndentingPrinter |
python | huggingface__transformers | src/transformers/models/aya_vision/configuration_aya_vision.py | {
"start": 818,
"end": 4790
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`AyaVisionForConditionalGeneration`]. It is used to instantiate an
AyaVision model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults wi... | AyaVisionConfig |
python | davidhalter__parso | parso/python/errors.py | {
"start": 35317,
"end": 35838
} | class ____(SyntaxRule):
message = "default 'except:' must be last"
def is_issue(self, try_stmt):
default_except = None
for except_clause in try_stmt.children[3::3]:
if except_clause in ('else', 'finally'):
break
if except_clause == 'except':
... | _TryStmtRule |
python | sqlalchemy__sqlalchemy | test/sql/test_types.py | {
"start": 56341,
"end": 62670
} | class ____(fixtures.TestBase, AssertsCompiledSQL):
def setup_test(self):
class UTypeOne(types.UserDefinedType):
cache_ok = True
def get_col_spec(self):
return "UTYPEONE"
def bind_processor(self, dialect):
def process(value):
... | VariantTest |
python | pytorch__pytorch | test/typing/pass/arithmetic_ops.py | {
"start": 6251,
"end": 13363
} | class ____:
"""
This class demonstrates what is possible by overriding every magic method
relating to binary operations.
"""
def __add__(self, other: NUMBER) -> "Binary": # type: ignore[override]
return self
def __and__(self, other: NUMBER) -> "Binary": # type: ignore[override]
... | Binary |
python | scrapy__scrapy | scrapy/core/downloader/handlers/__init__.py | {
"start": 894,
"end": 3950
} | class ____:
def __init__(self, crawler: Crawler):
self._crawler: Crawler = crawler
# stores acceptable schemes on instancing
self._schemes: dict[str, str | Callable[..., Any]] = {}
# stores instanced handlers for schemes
self._handlers: dict[str, DownloadHandlerProtocol] = {}... | DownloadHandlers |
python | qiwsir__algorithm | binary_tree2.py | {
"start": 154,
"end": 366
} | class ____:
left , right, data = None, None, 0
def __init__(self, data):
# initializes the data members
self.left = None
self.right = None
self.data = data
| CNode |
python | doocs__leetcode | solution/0200-0299/0231.Power of Two/Solution2.py | {
"start": 0,
"end": 99
} | class ____:
def isPowerOfTwo(self, n: int) -> bool:
return n > 0 and n == n & (-n)
| Solution |
python | huggingface__transformers | src/transformers/models/deberta_v2/modeling_deberta_v2.py | {
"start": 20465,
"end": 23670
} | class ____(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
pad_token_id = getattr(config, "pad_token_id", 0)
self.embedding_size = getattr(config, "embedding_size", config.hidden_size)
self.... | DebertaV2Embeddings |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/self5.py | {
"start": 171,
"end": 295
} | class ____:
@property
def one(self) -> Self: ...
@classmethod
@property
def two(cls) -> type[Self]: ...
| A |
python | GoogleCloudPlatform__python-docs-samples | datastore/cloud-client/admin_test.py | {
"start": 815,
"end": 1614
} | class ____:
def test_client_create(self):
assert admin.client_create()
def test_get_index(self):
indexes = admin.list_indexes(PROJECT)
if not indexes:
pytest.skip(
"Skipping datastore test. At least "
"one index should present in database."
... | TestDatastoreAdminSnippets |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/paramSpec36.py | {
"start": 274,
"end": 1040
} | class ____(Protocol):
def __call__(
self, func: Callable[P, R], *args: P.args, **kwargs: P.kwargs
) -> Future[R]: ...
@contextlib.contextmanager
def submit_wrapper() -> Iterator[TakesFunctionWithArguments]:
with ThreadPoolExecutor() as pool:
def my_submit(
func: Callable[P, R]... | TakesFunctionWithArguments |
python | kamyu104__LeetCode-Solutions | Python/reschedule-meetings-for-maximum-free-time-ii.py | {
"start": 37,
"end": 1203
} | class ____(object):
def maxFreeTime(self, eventTime, startTime, endTime):
"""
:type eventTime: int
:type startTime: List[int]
:type endTime: List[int]
:rtype: int
"""
def topk(a, k): # Time: O(k * n)
result = [[float("-inf")]*2 for _ in xrange(k)]... | Solution |
python | apache__airflow | airflow-core/src/airflow/metrics/otel_logger.py | {
"start": 6137,
"end": 10563
} | class ____:
"""Otel Logger."""
def __init__(
self,
otel_provider,
prefix: str = DEFAULT_METRIC_NAME_PREFIX,
metrics_validator: ListValidator = PatternAllowListValidator(),
):
self.otel: Callable = otel_provider
self.prefix: str = prefix
self.metrics_v... | SafeOtelLogger |
python | h5py__h5py | h5py/tests/test_group.py | {
"start": 1221,
"end": 3363
} | class ____(BaseGroup):
"""
Feature: New groups can be created via .create_group method
"""
def test_create_str(self):
""" Simple .create_group call """
grp = self.f.create_group(make_name())
self.assertIsInstance(grp, Group)
def test_create_bytes(self):
grp = s... | TestCreate |
python | pytorch__pytorch | torch/utils/data/datapipes/dataframe/dataframes.py | {
"start": 9667,
"end": 10085
} | class ____(Capture):
def __init__(self, left, key, value, ctx) -> None:
self.ctx = ctx
self.left = left
self.key = key
self.value = value
def __str__(self) -> str:
return f"{self.left}[{get_val(self.key)}] = {self.value}"
def execute(self) -> None:
left = se... | CaptureSetItem |
python | hyperopt__hyperopt | hyperopt/tests/unit/test_domains.py | {
"start": 8053,
"end": 8649
} | class ____:
# -- this is a mixin
# -- Override self.work to execute a test for each kind of self.bandit
def test_quadratic1(self):
self.bandit = quadratic1()
self.work()
def test_q1lognormal(self):
self.bandit = q1_lognormal()
self.work()
def test_twoarms(self):
... | NonCategoricalCasePerDomain |
python | pytest-dev__pytest-xdist | src/xdist/remote.py | {
"start": 1856,
"end": 3117
} | class ____:
"""A simple queue that can be inspected and modified while the lock is held via the ``lock()`` method."""
Item = Union[int, Literal[Marker.SHUTDOWN]]
def __init__(self, execmodel: execnet.gateway_base.ExecModel):
self._items: collections.deque[TestQueue.Item] = collections.deque()
... | TestQueue |
python | facebook__pyre-check | client/language_server/protocol.py | {
"start": 13878,
"end": 14021
} | class ____(json_mixins.CamlCaseAndExcludeJsonMixin):
kernel_runtime_dir: List[str]
@dataclasses.dataclass(frozen=True)
| WorkspaceConfiguration |
python | sqlalchemy__sqlalchemy | test/dialect/oracle/test_dialect.py | {
"start": 1576,
"end": 2390
} | class ____(fixtures.TestBase):
def test_cx_oracle_version_parse(self):
dialect = cx_oracle.OracleDialect_cx_oracle()
def check(version):
dbapi = Mock(version=version)
dialect._load_version(dbapi)
return dialect.cx_oracle_ver
eq_(check("8.2"), (8, 2))
... | CxOracleDialectTest |
python | plotly__plotly.py | plotly/graph_objs/layout/scene/xaxis/_tickfont.py | {
"start": 235,
"end": 9914
} | class ____(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scene.xaxis"
_path_str = "layout.scene.xaxis.tickfont"
_valid_props = {
"color",
"family",
"lineposition",
"shadow",
"size",
"style",
"textcase",
"variant",
"weight",
... | Tickfont |
python | tensorflow__tensorflow | tensorflow/python/data/kernel_tests/zip_test.py | {
"start": 7429,
"end": 8582
} | class ____(
checkpoint_test_base.CheckpointTestBase, parameterized.TestCase
):
def _build_dataset(self, arr, options=None):
components = [
np.tile(np.array([[1], [2], [3], [4]]), 20),
np.tile(np.array([[12], [13], [14], [15]]), 22),
np.array(arr)
]
datasets = [
dataset... | ZipCheckpointTest |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/missingSuper1.py | {
"start": 931,
"end": 1047
} | class ____(ParentA, ParentBPrime, ParentC):
def __init__(self):
super(ParentBPrime).__init__()
| ChildCPrime |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_slots/SLOT001.py | {
"start": 0,
"end": 40
} | class ____(tuple): # SLOT001
pass
| Bad |
python | pypa__warehouse | warehouse/observations/models.py | {
"start": 1118,
"end": 1575
} | class ____(db.Model):
__tablename__ = "observers"
created: Mapped[datetime_now]
_association_id: Mapped[UUID | None] = mapped_column(
ForeignKey(ObserverAssociation.id)
)
_association: Mapped[ObserverAssociation] = relationship(
back_populates="observer", uselist=False
)
o... | Observer |
python | getsentry__sentry | src/sentry/api/serializers/models/projectownership.py | {
"start": 235,
"end": 377
} | class ____(TypedDict, total=False):
schema: dict
# JSON object representing this serializer in API response
| ProjectOwnershipResponseOptional |
python | pyca__cryptography | tests/hazmat/primitives/test_serialization.py | {
"start": 58545,
"end": 61664
} | class ____:
def test_load_der_private_key(self, backend):
data = load_vectors_from_file(
os.path.join("asymmetric", "X25519", "x25519-pkcs8-enc.der"),
lambda derfile: derfile.read(),
mode="rb",
)
unencrypted = load_vectors_from_file(
os.path.jo... | TestX25519Serialization |
python | pydantic__pydantic | tests/test_json_schema.py | {
"start": 96594,
"end": 96657
} | class ____(str, Enum):
d = 'd'
e = 'e'
f = 'f'
| MyEnum |
python | sqlalchemy__sqlalchemy | test/orm/inheritance/test_single.py | {
"start": 82173,
"end": 82338
} | class ____(EagerDefaultEvalTest):
@classmethod
def setup_classes(cls):
super().setup_classes(include_sub_defaults=True)
| EagerDefaultEvalTestSubDefaults |
python | tensorflow__tensorflow | tensorflow/compiler/tests/tensor_list_ops_test.py | {
"start": 1180,
"end": 11619
} | class ____(parameterized.TestCase, xla_test.XLATestCase):
def testElementShape(self):
with self.session() as sess, self.test_scope():
dim = array_ops.placeholder(dtypes.int32)
l = list_ops.empty_tensor_list(
element_shape=(dim, 15),
element_dtype=dtypes.float32,
max_num_... | ListOpsTest |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/array_ops/diag_op_test.py | {
"start": 47388,
"end": 48063
} | class ____(test.TestCase):
@test_util.run_deprecated_v1
def testDiagGrad(self):
np.random.seed(0)
shapes = ((3,), (3, 3), (3, 3, 3))
dtypes = (dtypes_lib.float32, dtypes_lib.float64)
with self.session(use_gpu=False):
errors = []
for shape in shapes:
for dtype in dtypes:
... | DiagGradOpTest |
python | apache__airflow | airflow-core/src/airflow/ti_deps/deps/dag_unpaused_dep.py | {
"start": 961,
"end": 1604
} | class ____(BaseTIDep):
"""Determines whether a task's DAG is not paused."""
NAME = "Dag Not Paused"
IGNORABLE = True
@staticmethod
def _is_dag_paused(dag_id: str, session) -> bool:
"""Check if a dag is paused. Extracted to simplify testing."""
from airflow.models.dag import DagMode... | DagUnpausedDep |
python | walkccc__LeetCode | solutions/357. Count Numbers with Unique Digits/357.py | {
"start": 0,
"end": 312
} | class ____:
def countNumbersWithUniqueDigits(self, n: int) -> int:
if n == 0:
return 1
ans = 10
uniqueDigits = 9
availableNum = 9
while n > 1 and availableNum > 0:
uniqueDigits *= availableNum
ans += uniqueDigits
n -= 1
availableNum -= 1
return ans
| Solution |
python | davidhalter__jedi | jedi/inference/docstring_utils.py | {
"start": 371,
"end": 759
} | class ____(ModuleContext):
def __init__(self, module_value, in_module_context):
super().__init__(module_value)
self._in_module_context = in_module_context
def get_filters(self, origin_scope=None, until_position=None):
yield from super().get_filters(until_position=until_position)
... | DocstringModuleContext |
python | plotly__plotly.py | plotly/graph_objs/_deprecations.py | {
"start": 12836,
"end": 13715
} | class ____(dict):
"""
plotly.graph_objs.RadialAxis is deprecated.
Please replace it with one of the following more specific types
- plotly.graph_objs.layout.RadialAxis
- plotly.graph_objs.layout.polar.RadialAxis
"""
def __init__(self, *args, **kwargs):
"""
p... | RadialAxis |
python | scrapy__scrapy | tests/test_robotstxt_interface.py | {
"start": 416,
"end": 4589
} | class ____:
def _setUp(self, parser_cls):
self.parser_cls = parser_cls
def test_allowed(self):
robotstxt_robotstxt_body = (
b"User-agent: * \nDisallow: /disallowed \nAllow: /allowed \nCrawl-delay: 10"
)
rp = self.parser_cls.from_crawler(
crawler=None, rob... | BaseRobotParserTest |
python | vyperlang__vyper | vyper/venom/basicblock.py | {
"start": 24314,
"end": 24489
} | class ____:
def _pre_instruction(self, inst: IRInstruction) -> str:
return ""
def _post_instruction(self, inst: IRInstruction) -> str:
return ""
| IRPrinter |
python | spyder-ide__spyder | spyder/plugins/editor/widgets/codeeditor/lsp_mixin.py | {
"start": 1964,
"end": 2085
} | class ____(Exception):
"""Error raised if there is an error handling an LSP response."""
@class_register
| LSPHandleError |
python | docker__docker-py | docker/utils/build.py | {
"start": 4723,
"end": 6932
} | class ____:
def __init__(self, patterns):
self.patterns = list(filter(
lambda p: p.dirs, [Pattern(p) for p in patterns]
))
self.patterns.append(Pattern('!.dockerignore'))
def matches(self, filepath):
matched = False
parent_path = os.path.dirname(filepath)
... | PatternMatcher |
python | mlflow__mlflow | mlflow/server/job_api.py | {
"start": 1497,
"end": 2194
} | class ____(BaseModel):
function_fullname: str
params: dict[str, Any]
timeout: float | None = None
@job_api_router.post("/", response_model=Job)
def submit_job(payload: SubmitJobPayload) -> Job:
from mlflow.server.jobs import submit_job
from mlflow.server.jobs.utils import _load_function
funct... | SubmitJobPayload |
python | huggingface__transformers | src/transformers/models/phi4_multimodal/modeling_phi4_multimodal.py | {
"start": 28886,
"end": 29557
} | class ____(nn.Module):
def __init__(self, config: Phi4MultimodalAudioConfig, padding: int = 0):
super().__init__()
self.dw_conv = nn.Conv1d(
config.hidden_size,
config.hidden_size * config.depthwise_multiplier,
config.kernel_size,
1,
paddin... | Phi4MultimodalAudioDepthWiseSeparableConv1d |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/dataproc.py | {
"start": 101525,
"end": 108057
} | class ____(GoogleCloudBaseOperator):
"""
Diagnose a cluster in a project.
After the operation completes, the response contains the Cloud Storage URI of the diagnostic output report containing a summary of collected diagnostics.
:param region: Required. The Cloud Dataproc region in which to handle the ... | DataprocDiagnoseClusterOperator |
python | simonw__datasette | tests/test_utils_check_callable.py | {
"start": 137,
"end": 197
} | class ____:
def __call__(self):
pass
| NotAsyncClass |
python | pydantic__pydantic | tests/test_main.py | {
"start": 25863,
"end": 55682
} | class ____:
pass
def test_arbitrary_type_allowed_validation_fails():
class ArbitraryTypeAllowedModel(BaseModel):
model_config = ConfigDict(arbitrary_types_allowed=True)
t: ArbitraryType
input_value = OtherClass()
with pytest.raises(ValidationError) as exc_info:
ArbitraryTypeAl... | OtherClass |
python | networkx__networkx | networkx/algorithms/tests/test_cluster.py | {
"start": 1073,
"end": 4673
} | class ____:
def test_empty(self):
G = nx.Graph()
assert list(nx.triangles(G).values()) == []
def test_path(self):
G = nx.path_graph(10)
assert list(nx.triangles(G).values()) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
assert nx.triangles(G) == {
0: 0,
1: 0,... | TestTriangles |
python | joke2k__faker | faker/providers/passport/de_AT/__init__.py | {
"start": 74,
"end": 334
} | class ____(PassportProvider):
"""Implement passport provider for ``de_AT`` locale.
Sources:
- https://www.bmi.gv.at/607/Reisepass.aspx
"""
passport_number_formats: ElementsType[str] = (
"?#######",
"??#######",
)
| Provider |
python | huggingface__transformers | src/transformers/models/edgetam_video/modular_edgetam_video.py | {
"start": 30850,
"end": 31171
} | class ____(Sam2VideoPositionEmbeddingSine):
# maxsize=2 because we need to cache the forward method for both memory encoder and perceiver resampler
@compile_compatible_method_lru_cache(maxsize=2)
def forward(self, **super_kwargs):
return super().forward(**super_kwargs)
| EdgeTamVideoPositionEmbeddingSine |
python | pydata__xarray | xarray/tests/indexes.py | {
"start": 607,
"end": 2409
} | class ____(Index):
def __init__(self, x: PandasIndex, y: PandasIndex):
self.x: PandasIndex = x
self.y: PandasIndex = y
@classmethod
def from_variables(cls, variables, *, options):
return cls(
x=PandasIndex.from_variables({"x": variables["x"]}, options=options),
... | XYIndex |
python | doocs__leetcode | solution/1600-1699/1695.Maximum Erasure Value/Solution2.py | {
"start": 0,
"end": 367
} | class ____:
def maximumUniqueSubarray(self, nums: List[int]) -> int:
vis = set()
ans = s = i = 0
for x in nums:
while x in vis:
y = nums[i]
s -= y
vis.remove(y)
i += 1
vis.add(x)
s += x
... | Solution |
python | sqlalchemy__sqlalchemy | test/orm/test_generative.py | {
"start": 9733,
"end": 11302
} | class ____(fixtures.MappedTest):
@classmethod
def define_tables(cls, metadata):
Table("Table1", metadata, Column("ID", Integer, primary_key=True))
Table(
"Table2",
metadata,
Column("T1ID", Integer, ForeignKey("Table1.ID"), primary_key=True),
Column... | CaseSensitiveTest |
python | pytorch__pytorch | benchmarks/tensorexpr/reduction.py | {
"start": 3111,
"end": 3571
} | class ____(ReduceBench):
def __init__(self, mode, device, dtype, M, skip_input_transform):
super().__init__(mode, device, dtype, "full", M, 1, 1, skip_input_transform)
def config(self):
return [self.M * self.N * self.K, self._skip_input_transform_str()]
@staticmethod
def default_config... | ReduceFullBench |
python | pytest-dev__pytest-xdist | src/xdist/dsession.py | {
"start": 728,
"end": 813
} | class ____(KeyboardInterrupt):
"""signals an immediate interruption."""
| Interrupted |
python | google__jax | tests/pallas/tpu_pallas_state_test.py | {
"start": 5819,
"end": 6934
} | class ____(jtu.JaxTestCase):
def setUp(self):
super().setUp()
if not jtu.is_device_tpu_at_least(4):
self.skipTest("Only supported on TPU v4+")
def test_basic(self):
@jax.jit
def f(x):
x_pinned = pin(x)
x_pinned = pl.pallas_call(
lambda *_: None, out_shape=x_pinned,
... | PinnedBufferTest |
python | kubernetes-client__python | kubernetes/client/api/certificates_v1alpha1_api.py | {
"start": 543,
"end": 245004
} | class ____(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
... | CertificatesV1alpha1Api |
python | apache__airflow | providers/amazon/tests/unit/amazon/aws/triggers/test_mwaa.py | {
"start": 1632,
"end": 5283
} | class ____:
def test_init_states(self):
trigger = MwaaDagRunCompletedTrigger(**TRIGGER_DAG_RUN_KWARGS)
assert trigger.success_states == {DagRunState.SUCCESS.value}
assert trigger.failure_states == {DagRunState.FAILED.value}
acceptors = trigger.waiter_config_overrides["acceptors"]
... | TestMwaaDagRunCompletedTrigger |
python | huggingface__transformers | src/transformers/trainer_pt_utils.py | {
"start": 14510,
"end": 18196
} | class ____:
"""
Adds label-smoothing on a pre-computed output from a Transformers model.
Args:
epsilon (`float`, *optional*, defaults to 0.1):
The label smoothing factor.
ignore_index (`int`, *optional*, defaults to -100):
The index in the labels to ignore when compu... | LabelSmoother |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.