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 | python-poetry__poetry | src/poetry/mixology/version_solver.py | {
"start": 1005,
"end": 1486
} | class ____(IntEnum):
"""
Preference is one of the criteria for choosing which dependency to solve
first. A higher value means that there are "more options" to satisfy
a dependency. A lower value takes precedence.
"""
DIRECT_ORIGIN = 0
NO_CHOICE = 1
USE_LATEST = 2
LOCKED = 3
DEFA... | Preference |
python | pandas-dev__pandas | pandas/tests/indexes/categorical/test_category.py | {
"start": 351,
"end": 9816
} | class ____:
@pytest.fixture
def simple_index(self) -> CategoricalIndex:
"""
Fixture that provides a CategoricalIndex.
"""
return CategoricalIndex(list("aabbca"), categories=list("cab"), ordered=False)
def test_can_hold_identifiers(self):
idx = CategoricalIndex(list("... | TestCategoricalIndex |
python | pytorch__pytorch | tools/experimental/torchfuzz/operators/nn_functional.py | {
"start": 16095,
"end": 19066
} | class ____(Operator):
"""Operator for torch.nn.functional.rms_norm (Root Mean Square Normalization).
RMSNorm is commonly used in modern LLMs like LLaMA. It normalizes by the RMS of the input.
"""
def __init__(self):
super().__init__("torch.nn.functional.rms_norm")
self.weight = 5.0
... | RMSNormOperator |
python | coleifer__peewee | playhouse/migrate.py | {
"start": 16805,
"end": 17185
} | class ____(PostgresqlMigrator):
explicit_create_foreign_key = True
def add_inline_fk_sql(self, ctx, field):
pass
@operation
def drop_index(self, table, index_name):
return (self
.make_context()
.literal('DROP INDEX ')
.sql(Entity(index_na... | CockroachDBMigrator |
python | sqlalchemy__sqlalchemy | test/orm/test_naturalpks.py | {
"start": 25177,
"end": 29199
} | class ____(fixtures.MappedTest):
# mssql, mysql don't allow
# ON UPDATE on self-referential keys
__unsupported_on__ = ("mssql", "mysql", "mariadb")
__requires__ = ("on_update_or_deferrable_fks",)
__sparse_driver_backend__ = True
@classmethod
def define_tables(cls, metadata):
fk_arg... | SelfReferentialTest |
python | great-expectations__great_expectations | contrib/cli/great_expectations_contrib/package.py | {
"start": 1045,
"end": 1209
} | class ____(str, Enum):
TWITTER = "TWITTER"
GITHUB = "GITHUB"
LINKEDIN = "LINKEDIN"
MEDIUM = "MEDIUM"
WEBSITE = "WEBSITE"
@dataclass
| SocialLinkType |
python | apache__airflow | dev/breeze/tests/test_ui_commands.py | {
"start": 2379,
"end": 3161
} | class ____:
def test_flatten_simple_dict(self):
data = {"key1": "value1", "key2": "value2"}
keys = flatten_keys(data)
assert set(keys) == {"key1", "key2"}
def test_flatten_nested_dict(self):
data = {"parent": {"child1": "value1", "child2": "value2"}}
keys = flatten_keys(... | TestFlattenKeys |
python | HypothesisWorks__hypothesis | hypothesis-python/src/hypothesis/internal/conjecture/choice.py | {
"start": 964,
"end": 1116
} | class ____(TypedDict):
min_value: int | None
max_value: int | None
weights: dict[int, float] | None
shrink_towards: int
| IntegerConstraints |
python | pydata__xarray | xarray/tests/test_backends.py | {
"start": 262777,
"end": 264320
} | class ____:
def test_extract_nc4_variable_encoding(self) -> None:
var = xr.Variable(("x",), [1, 2, 3], {}, {"foo": "bar"})
with pytest.raises(ValueError, match=r"unexpected encoding"):
_extract_nc4_variable_encoding(var, raise_on_invalid=True)
var = xr.Variable(("x",), [1, 2, 3]... | TestEncodingInvalid |
python | pytorch__pytorch | torch/optim/rprop.py | {
"start": 555,
"end": 17717
} | class ____(Optimizer): # noqa: D101
def __init__(
self,
params: ParamsT,
lr: Union[float, Tensor] = 1e-2,
etas: tuple[float, float] = (0.5, 1.2),
step_sizes: tuple[float, float] = (1e-6, 50),
*,
capturable: bool = False,
foreach: Optional[bool] = None... | Rprop |
python | bokeh__bokeh | src/bokeh/core/property/alias.py | {
"start": 2639,
"end": 3666
} | class ____(Alias[T]):
"""
Alias of another property of a model showing a deprecation message when used.
"""
def __init__(self, aliased_name: str, *, since: Version,
extra: str | None = None, help: str | None = None) -> None:
super().__init__(aliased_name, help=help)
self.sin... | DeprecatedAlias |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/array_ops/spacetobatch_op_test.py | {
"start": 12237,
"end": 12318
} | class ____(SpaceToBatchSpaceToDepth, CppOpImpl):
pass
| SpaceToBatchSpaceToDepthCpp |
python | wandb__wandb | wandb/vendor/pygments/lexers/haskell.py | {
"start": 13366,
"end": 18941
} | class ____(RegexLexer):
"""
FIXME: A Cryptol2 lexer based on the lexemes defined in the Haskell 98 Report.
.. versionadded:: 2.0
"""
name = 'Cryptol'
aliases = ['cryptol', 'cry']
filenames = ['*.cry']
mimetypes = ['text/x-cryptol']
reserved = ('Arith', 'Bit', 'Cmp', 'False', 'Inf',... | CryptolLexer |
python | bokeh__bokeh | src/bokeh/models/widgets/groups.py | {
"start": 3718,
"end": 4077
} | class ____(ToggleButtonGroup):
''' A group of check boxes rendered as toggle buttons.
'''
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
active = List(Int, help="""
The list of indices of selected... | CheckboxButtonGroup |
python | spack__spack | lib/spack/spack/builder.py | {
"start": 25579,
"end": 27350
} | class ____(spack.package_base.PackageBase):
"""Build system base class for packages that do not use a specific build system. It adds the
``build_system=generic`` variant to the package.
This is the only build system base class defined in Spack core. All other build systems
are defined in the builtin pa... | Package |
python | wandb__wandb | wandb/integration/openai/resolver.py | {
"start": 309,
"end": 466
} | class ____:
elapsed_time: float = None
prompt_tokens: int = None
completion_tokens: int = None
total_tokens: int = None
@dataclass
| UsageMetrics |
python | dagster-io__dagster | python_modules/libraries/dagster-airbyte/dagster_airbyte/resources.py | {
"start": 18346,
"end": 28312
} | class ____(ConfigurableResource):
"""This class represents a Airbyte workspace and provides utilities
to interact with Airbyte APIs.
"""
request_max_retries: int = Field(
default=3,
description=(
"The maximum number of times requests to the Airbyte API should be retried "
... | BaseAirbyteWorkspace |
python | sphinx-doc__sphinx | sphinx/domains/python/__init__.py | {
"start": 14962,
"end": 17399
} | class ____(SphinxDirective):
"""Directive to mark description of a new module."""
has_content = True
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = False
option_spec: ClassVar[OptionSpec] = {
'platform': lambda x: x,
'synopsis': lambda x: x,
'n... | PyModule |
python | protocolbuffers__protobuf | python/google/protobuf/internal/descriptor_pool_test.py | {
"start": 46440,
"end": 47525
} | class ____(object):
def __init__(self, number, extended_type):
self.number = number
self.extended_type = extended_type
def CheckField(self, test, msg_desc, name, index, file_desc):
field_desc = msg_desc.extensions_by_name[name]
test.assertEqual(name, field_desc.name)
expected_field_full_name =... | ExtensionField |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/enum1.py | {
"start": 4546,
"end": 5129
} | class ____(Enum):
_other1: int
_other2: int
def __new__(cls, value: str, other1: int, other2: int):
obj = object.__new__(cls)
obj._value_ = value
obj._other1 = other1
obj._other2 = other2
return obj
A = ("a", 1, 2)
B = ("b", 2, 3)
te9_A = TestEnum9.A
revea... | TestEnum9 |
python | bokeh__bokeh | src/bokeh/sphinxext/_internal/bokeh_releases.py | {
"start": 2153,
"end": 3410
} | class ____(BokehDirective):
def run(self):
srcdir = self.env.app.srcdir
versions = [x.rstrip(".rst") for x in listdir(join(srcdir, "docs", "releases")) if x.endswith(".rst")]
versions.sort(key=V, reverse=True)
rst = []
for version in versions:
try:
... | BokehReleases |
python | pytorch__pytorch | test/dynamo/test_autograd_function.py | {
"start": 2002,
"end": 3139
} | class ____(torch.autograd.Function):
# Note that forward, setup_context, and backward are @staticmethods
@staticmethod
def forward(input, weight, bias):
output = input.mm(weight.t())
if bias is not None:
output += bias.unsqueeze(0).expand_as(output)
return output
@st... | LinearFunction |
python | HypothesisWorks__hypothesis | hypothesis-python/src/hypothesis/internal/conjecture/dfa/lstar.py | {
"start": 3644,
"end": 4648
} | class ____:
"""Relevant information for a state that we have witnessed as definitely
distinct from ones we have previously seen so far."""
# Index of this state in the learner's list of states
index: int
# A string that witnesses this state (i.e. when starting from the origin
# and following t... | DistinguishedState |
python | HypothesisWorks__hypothesis | whole_repo_tests/types/revealed_types.py | {
"start": 2069,
"end": 5971
} | class ____(NamedTuple):
value: str
mypy: str
pyright: str
DIFF_REVEALED_TYPES = [
DifferingRevealedTypes("none() | integers()", "None | int", "int | None"),
DifferingRevealedTypes(
"data()", "hypothesis.strategies._internal.core.DataObject", "DataObject"
),
# We have overloads for ... | DifferingRevealedTypes |
python | numpy__numpy | numpy/distutils/system_info.py | {
"start": 109126,
"end": 109993
} | class ____(system_info):
section = 'amd'
dir_env_var = 'AMD'
_lib_names = ['amd']
def calc_info(self):
lib_dirs = self.get_lib_dirs()
opt = self.get_option_single('amd_libs', 'libraries')
amd_libs = self.get_libs(opt, self._lib_names)
info = self.check_libs(lib_dirs, am... | amd_info |
python | aio-libs__aiohttp | tests/test_http_exceptions.py | {
"start": 120,
"end": 1454
} | class ____:
def test_ctor(self) -> None:
err = http_exceptions.HttpProcessingError(
code=500, message="Internal error", headers=CIMultiDict()
)
assert err.code == 500
assert err.message == "Internal error"
assert err.headers == CIMultiDict()
def test_pickle(s... | TestHttpProcessingError |
python | kubernetes-client__python | kubernetes/client/models/v1_cluster_role_binding.py | {
"start": 383,
"end": 7815
} | class ____(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attri... | V1ClusterRoleBinding |
python | doocs__leetcode | solution/3500-3599/3561.Resulting String After Adjacent Removals/Solution.py | {
"start": 0,
"end": 263
} | class ____:
def resultingString(self, s: str) -> str:
stk = []
for c in s:
if stk and abs(ord(c) - ord(stk[-1])) in (1, 25):
stk.pop()
else:
stk.append(c)
return "".join(stk)
| Solution |
python | imageio__imageio | imageio/plugins/_tifffile.py | {
"start": 71110,
"end": 115380
} | class ____(object):
"""Read image and metadata from TIFF file.
TiffFile instances must be closed using the 'close' method, which is
automatically called when using the 'with' context manager.
Attributes
----------
pages : TiffPages
Sequence of TIFF pages in file.
series : list of T... | TiffFile |
python | dagster-io__dagster | python_modules/libraries/dagster-dg-cli/dagster_dg_cli_tests/yaml_template/test_yaml_template_generator.py | {
"start": 533,
"end": 8415
} | class ____:
@property
def test_data_dir(self) -> Path:
"""Get the test data directory path."""
return Path(__file__).parent / "test_data"
def load_expected_schema(self, test_case_name: str) -> str:
"""Load expected schema template from disk for a given test case."""
expected... | TestYamlTemplateGenerator |
python | huggingface__transformers | src/transformers/models/deepseek_v2/modular_deepseek_v2.py | {
"start": 1401,
"end": 11420
} | class ____(LlamaConfig):
r"""
This is the configuration class to store the configuration of a [`DeepseekV2Model`]. It is used to instantiate a DeepSeek
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar config... | DeepseekV2Config |
python | tensorflow__tensorflow | tensorflow/python/eager/remote_test.py | {
"start": 8388,
"end": 10848
} | class ____(test.TestCase):
def setUp(self):
super(RemoteAsyncTest, self).setUp()
workers, _ = test_util.create_local_cluster(1, 0)
remote.connect_to_remote_host(workers[0].target)
def tearDown(self):
super(RemoteAsyncTest, self).tearDown()
# Reset the context to avoid polluting other test ca... | RemoteAsyncTest |
python | PrefectHQ__prefect | tests/server/models/test_flows.py | {
"start": 2448,
"end": 3068
} | class ____:
async def test_read_flow(self, session):
# create a flow to read
flow = await models.flows.create_flow(
session=session, flow=schemas.core.Flow(name="my-flow")
)
assert flow.name == "my-flow"
read_flow = await models.flows.read_flow(session=session, f... | TestReadFlow |
python | cython__cython | tests/run/for_in_iter.py | {
"start": 2527,
"end": 3446
} | class ____(object):
def __init__(self):
self.i = 0
def __iter__(self):
return self
def __next__(self):
if self.i > 5:
raise StopIteration
self.i += 1
self.__next__ = self.next2
return 1
def next2(self):
self.__next__ = self.next3
... | NextReplacingIterable |
python | pypa__setuptools | setuptools/_scripts.py | {
"start": 3075,
"end": 3157
} | class ____(CommandSpec):
split_args = _SplitArgs(posix=False)
| WindowsCommandSpec |
python | google__jax | jax/_src/test_util.py | {
"start": 66300,
"end": 71870
} | class ____(np.vectorize):
"""Same as numpy.vectorize but using mpmath backend for function evaluation.
"""
map_float_to_complex = dict(float16='complex32', float32='complex64', float64='complex128', float128='complex256', longdouble='clongdouble')
map_complex_to_float = {v: k for k, v in map_float_to_complex.i... | vectorize_with_mpmath |
python | doocs__leetcode | solution/3100-3199/3154.Find Number of Ways to Reach the K-th Stair/Solution.py | {
"start": 0,
"end": 391
} | class ____:
def waysToReachStair(self, k: int) -> int:
@cache
def dfs(i: int, j: int, jump: int) -> int:
if i > k + 1:
return 0
ans = int(i == k)
if i > 0 and j == 0:
ans += dfs(i - 1, 1, jump)
ans += dfs(i + (1 << jump)... | Solution |
python | kamyu104__LeetCode-Solutions | Python/reorder-list.py | {
"start": 233,
"end": 987
} | class ____(object):
# @param head, a ListNode
# @return nothing
def reorderList(self, head):
if head == None or head.next == None:
return head
fast, slow, prev = head, head, None
while fast != None and fast.next != None:
fast, slow, prev = fast.next.next, slo... | Solution |
python | numba__numba | numba/core/annotations/type_annotations.py | {
"start": 272,
"end": 984
} | class ____(Mapping):
def __init__(self, func):
try:
lines, startno = inspect.getsourcelines(func)
except OSError:
self.lines = ()
self.startno = 0
else:
self.lines = textwrap.dedent(''.join(lines)).splitlines()
self.startno = start... | SourceLines |
python | astropy__astropy | astropy/visualization/wcsaxes/__init__.py | {
"start": 554,
"end": 1264
} | class ____(_config.ConfigNamespace):
"""
Configuration parameters for `astropy.visualization.wcsaxes`.
"""
coordinate_range_samples = _config.ConfigItem(
50,
"The number of samples along each image axis when determining "
"the range of coordinates in a plot.",
)
frame_b... | Conf |
python | getsentry__sentry | src/sentry/dynamic_sampling/rules/biases/boost_replay_id_bias.py | {
"start": 191,
"end": 952
} | class ____(Bias):
"""
Boosts at 100% sample rate all the traces that have a replay_id.
"""
def generate_rules(self, project: Project, base_sample_rate: float) -> list[PolymorphicRule]:
return [
{
"samplingValue": {"type": "sampleRate", "value": 1.0},
... | BoostReplayIdBias |
python | sympy__sympy | sympy/polys/domains/complexfield.py | {
"start": 502,
"end": 6159
} | class ____(Field, CharacteristicZero, SimpleDomain):
"""Complex numbers up to the given precision. """
rep = 'CC'
is_ComplexField = is_CC = True
is_Exact = False
is_Numerical = True
has_assoc_Ring = False
has_assoc_Field = True
_default_precision = 53
@property
def has_defa... | ComplexField |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_return/RET501.py | {
"start": 413,
"end": 576
} | class ____:
@cached_property
def prop(self) -> None:
print("Property not found")
return None
import abc
import enum
import types
| BaseCache2 |
python | allegroai__clearml | clearml/hyperdatasets/data_view.py | {
"start": 978,
"end": 6288
} | class ____:
lucene_parser_warning_sent = False
@classmethod
def _validate_lucene(cls, lucene_query):
"""Validate the supplied Lucene query string using `luqum`.
Empty strings are considered valid. Non-empty values are parsed and raise a
`LuceneParseError` when the expression is mal... | HyperDatasetQuery |
python | PyCQA__pylint | tests/functional/m/mixin_class_rgx.py | {
"start": 658,
"end": 880
} | class ____:
"""Class that does not match the option pattern"""
def set_attribute(self):
"""Set an attribute outside of __init__"""
self.attr = 1 # [attribute-defined-outside-init]
| OutsideInitMixedin |
python | python-openxml__python-docx | src/docx/shared.py | {
"start": 11368,
"end": 11858
} | class ____:
"""Provides common services for document elements that occur below a part but may
occasionally require an ancestor object to provide a service, such as add or drop a
relationship.
Provides ``self._parent`` attribute to subclasses.
"""
def __init__(self, parent: t.ProvidesXmlPart):
... | Parented |
python | pydata__xarray | xarray/computation/arithmetic.py | {
"start": 4043,
"end": 4155
} | class ____(
SupportsArithmetic,
DataArrayGroupByOpsMixin,
):
__slots__ = ()
| DataArrayGroupbyArithmetic |
python | plotly__plotly.py | plotly/graph_objs/layout/polar/radialaxis/title/_font.py | {
"start": 235,
"end": 9946
} | class ____(_BaseLayoutHierarchyType):
_parent_path_str = "layout.polar.radialaxis.title"
_path_str = "layout.polar.radialaxis.title.font"
_valid_props = {
"color",
"family",
"lineposition",
"shadow",
"size",
"style",
"textcase",
"variant",
... | Font |
python | gevent__gevent | src/gevent/tests/test__memleak.py | {
"start": 263,
"end": 1466
} | class ____(TestCase): # pragma: no cover
# pylint:disable=bare-except,no-member
def test(self):
refcounts = []
for _ in range(15):
try:
Timeout.start_new(0.01)
gevent.sleep(0.1)
self.fail('must raise Timeout')
except Timeo... | TestQueue |
python | google__pytype | pytype/state.py | {
"start": 805,
"end": 6458
} | class ____(utils.ContextWeakrefMixin):
"""Immutable state object, for attaching to opcodes."""
__slots__ = ["block_stack", "data_stack", "node", "exception", "why"]
def __init__(self, data_stack, block_stack, node, ctx, exception, why):
super().__init__(ctx)
self.data_stack = data_stack
self.block_s... | FrameState |
python | gevent__gevent | src/gevent/testing/timing.py | {
"start": 1618,
"end": 3351
} | class ____(object):
_default_wait_timeout = SMALL_TICK
_default_delay_min_adj = SMALL_TICK_MIN_ADJ
_default_delay_max_adj = SMALL_TICK_MAX_ADJ
def wait(self, timeout):
raise NotImplementedError('override me in subclass')
def _check_delay_bounds(self, timeout, delay,
... | _DelayWaitMixin |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/namedTuple2.py | {
"start": 158,
"end": 954
} | class ____(NamedTuple):
entry_1: str
entry_2: int
nt1 = MyDataClass("yes", 1)
(a1, a2) = nt1
a1_1: str = a1
a2_1: int = a2
# These should generate an error because a1 and a2 are
# the wrong types.
a1_2: int = a1
a2_2: str = a2
b1 = nt1[0]
b2 = nt1[1]
b1_1: str = b1
b2_1: int = b2
# These should generate ... | MyDataClass |
python | gevent__gevent | src/greentest/3.9/test_socket.py | {
"start": 24835,
"end": 72951
} | class ____(unittest.TestCase):
def test_SocketType_is_socketobject(self):
import _socket
self.assertTrue(socket.SocketType is _socket.socket)
s = socket.socket()
self.assertIsInstance(s, socket.SocketType)
s.close()
def test_repr(self):
s = socket.socket(socket.... | GeneralModuleTests |
python | kamyu104__LeetCode-Solutions | Python/super-palindromes.py | {
"start": 44,
"end": 888
} | class ____(object):
def superpalindromesInRange(self, L, R):
"""
:type L: str
:type R: str
:rtype: int
"""
def is_palindrome(k):
return str(k) == str(k)[::-1]
K = int((10**((len(R)+1)*0.25)))
l, r = int(L), int(R)
result = 0
... | Solution |
python | spyder-ide__spyder | spyder/plugins/profiler/widgets/main_widget.py | {
"start": 1503,
"end": 1671
} | class ____:
GotoDefinition = "goto_definition_action"
ShowCallees = "show_callees_action"
ShowCallers = "show_callers_action"
| ProfilerWidgetContextMenuActions |
python | huggingface__transformers | tests/models/cpmant/test_modeling_cpmant.py | {
"start": 4555,
"end": 6234
} | class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (CpmAntModel, CpmAntForCausalLM) if is_torch_available() else ()
# Doesn't run generation tests. There are interface mismatches when using `generate` -- TODO @gante
all_generative_model_classes = ()
pipeline_model_... | CpmAntModelTest |
python | pytorch__pytorch | test/test_numpy_interop.py | {
"start": 560,
"end": 26713
} | class ____(TestCase):
# Note: the warning this tests for only appears once per program, so
# other instances of this warning should be addressed to avoid
# the tests depending on the order in which they're run.
@onlyCPU
def test_numpy_non_writeable(self, device):
arr = np.zeros(5)
ar... | TestNumPyInterop |
python | cython__cython | Cython/TestUtils.py | {
"start": 4444,
"end": 7089
} | class ____(CythonTest):
"""
Utility base class for transform unit tests. It is based around constructing
test trees (either explicitly or by parsing a Cython code string); running
the transform, serialize it using a customized Cython serializer (with
special markup for nodes that cannot be represent... | TransformTest |
python | getsentry__sentry | src/sentry/api/serializers/models/grouprelease.py | {
"start": 1131,
"end": 3043
} | class ____(GroupReleaseSerializer):
STATS_PERIODS = {
"24h": StatsPeriod(24, timedelta(hours=1)),
"30d": StatsPeriod(30, timedelta(hours=24)),
}
def __init__(self, since=None, until=None):
self.since = since
self.until = until
def get_attrs(self, item_list, user, **kwar... | GroupReleaseWithStatsSerializer |
python | pytorch__pytorch | torch/_dynamo/pgo.py | {
"start": 6318,
"end": 6777
} | class ____:
automatic_dynamic: defaultdict[str, FrameStateSizeEntry] = dataclasses.field(
# pyrefly: ignore [unbound-name]
default_factory=lambda: defaultdict(FrameStateSizeEntry)
)
_INIT_CODE_STATE: Optional[defaultdict[CodeId, CodeState]] = None
_CODE_STATE: Optional[defaultdict[CodeId, Code... | CodeState |
python | pyca__cryptography | src/cryptography/x509/general_name.py | {
"start": 586,
"end": 766
} | class ____(metaclass=abc.ABCMeta):
@property
@abc.abstractmethod
def value(self) -> typing.Any:
"""
Return the value of the object
"""
| GeneralName |
python | ansible__ansible | test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/callback/usercallback.py | {
"start": 352,
"end": 726
} | class ____(CallbackBase):
CALLBACK_VERSION = 2.0
CALLBACK_TYPE = 'aggregate'
CALLBACK_NAME = 'usercallback'
def __init__(self):
super(CallbackModule, self).__init__()
self._display.display("loaded usercallback from collection, yay")
def v2_runner_on_ok(self, result):
self.... | CallbackModule |
python | tensorflow__tensorflow | tensorflow/python/distribute/coordinator/cluster_coordinator.py | {
"start": 33977,
"end": 42521
} | class ____(object):
"""Handles worker preemptions."""
def __init__(self, server_def, cluster):
self._server_def = server_def
self._cluster = cluster
self._cluster_update_lock = threading.Lock()
self._cluster_due_for_update_or_finish = threading.Event()
self._worker_up_cond = threading.Condition... | WorkerPreemptionHandler |
python | doocs__leetcode | solution/0600-0699/0633.Sum of Square Numbers/Solution2.py | {
"start": 0,
"end": 356
} | class ____:
def judgeSquareSum(self, c: int) -> bool:
for i in range(2, int(sqrt(c)) + 1):
if c % i == 0:
exp = 0
while c % i == 0:
c //= i
exp += 1
if i % 4 == 3 and exp % 2 != 0:
return ... | Solution |
python | django-import-export__django-import-export | tests/core/migrations/0009_auto_20211111_0807.py | {
"start": 92,
"end": 3131
} | class ____(migrations.Migration):
dependencies = [
("core", "0008_auto_20190409_0846"),
]
operations = [
migrations.AlterField(
model_name="author",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False... | Migration |
python | gevent__gevent | src/greentest/3.9/test_smtpd.py | {
"start": 10810,
"end": 30886
} | class ____(unittest.TestCase):
def setUp(self):
smtpd.socket = asyncore.socket = mock_socket
self.old_debugstream = smtpd.DEBUGSTREAM
self.debug = smtpd.DEBUGSTREAM = io.StringIO()
self.server = DummyServer((socket_helper.HOST, 0), ('b', 0),
decode_d... | SMTPDChannelTest |
python | django__django | tests/gis_tests/geoapp/feeds.py | {
"start": 859,
"end": 929
} | class ____(TestGeoRSS1):
feed_type = feeds.GeoAtom1Feed
| TestGeoAtom1 |
python | django__django | tests/template_tests/filter_tests/test_urlencode.py | {
"start": 629,
"end": 866
} | class ____(SimpleTestCase):
def test_urlencode(self):
self.assertEqual(urlencode("fran\xe7ois & jill"), "fran%C3%A7ois%20%26%20jill")
def test_non_string_input(self):
self.assertEqual(urlencode(1), "1")
| FunctionTests |
python | huggingface__transformers | src/transformers/models/jetmoe/modular_jetmoe.py | {
"start": 18156,
"end": 21231
} | class ____(MixtralModel):
def __init__(self, config: JetMoeConfig):
super().__init__(config)
self.padding_idx = config.pad_token_id
self.vocab_size = config.vocab_size
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
self.layers = nn.... | JetMoeModel |
python | spack__spack | lib/spack/spack/spec.py | {
"start": 23046,
"end": 24319
} | class ____:
"""Adaptor to the old compiler spec interface. Exposes just a few attributes"""
def __init__(self, spec):
self.spec = spec
@property
def name(self):
return self.spec.name
@property
def version(self):
return self.spec.version
@property
def versions(... | CompilerSpec |
python | catalyst-team__catalyst | catalyst/callbacks/metrics/functional_metric.py | {
"start": 192,
"end": 1705
} | class ____(FunctionalBatchMetricCallback):
"""
Args:
input_key: input key to use for metric calculation, specifies our `y_pred`
target_key: output key to use for metric calculation, specifies our `y_true`
metric_fn: metric function, that get outputs, targets
and return score... | FunctionalMetricCallback |
python | huggingface__transformers | src/transformers/models/prompt_depth_anything/modular_prompt_depth_anything.py | {
"start": 3897,
"end": 4833
} | class ____(DepthAnythingFeatureFusionStage):
def forward(self, hidden_states, size=None, prompt_depth=None):
# reversing the hidden_states, we start from the last
hidden_states = hidden_states[::-1]
fused_hidden_states = []
fused_hidden_state = None
for idx, (hidden_state, ... | PromptDepthAnythingFeatureFusionStage |
python | getsentry__sentry | tests/sentry/integrations/api/endpoints/test_organization_coding_agents.py | {
"start": 2470,
"end": 6726
} | class ____(APITestCase):
"""Base test class with common setup for coding agent endpoint tests."""
endpoint = "sentry-api-0-organization-coding-agents"
def setUp(self):
super().setUp()
self.login_as(self.user)
self._setup_mock_integration()
def _setup_mock_integration(self):
... | BaseOrganizationCodingAgentsTest |
python | tensorflow__tensorflow | tensorflow/python/keras/layers/core.py | {
"start": 2899,
"end": 5252
} | class ____(Layer):
"""Masks a sequence by using a mask value to skip timesteps.
For each timestep in the input tensor (dimension #1 in the tensor),
if all values in the input tensor at that timestep
are equal to `mask_value`, then the timestep will be masked (skipped)
in all downstream layers (as long as the... | Masking |
python | sympy__sympy | sympy/polys/domains/gmpyrationalfield.py | {
"start": 353,
"end": 3178
} | class ____(RationalField):
"""Rational field based on GMPY's ``mpq`` type.
This will be the implementation of :ref:`QQ` if ``gmpy`` or ``gmpy2`` is
installed. Elements will be of type ``gmpy.mpq``.
"""
dtype = GMPYRational
zero = dtype(0)
one = dtype(1)
tp = type(one)
alias = 'QQ_g... | GMPYRationalField |
python | kamyu104__LeetCode-Solutions | Python/apply-operations-on-array-to-maximize-sum-of-squares.py | {
"start": 90,
"end": 553
} | class ____(object):
def maxSum(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
MOD = 10**9+7
l = max(nums).bit_length()
cnt = [0]*l
for i in xrange(l):
for x in nums:
if x&(1<<i):
... | Solution |
python | google__pytype | pytype/tests/test_quick2.py | {
"start": 233,
"end": 3939
} | class ____(test_base.BaseTest):
"""Tests for --quick."""
@classmethod
def setUpClass(cls):
super().setUpClass()
for method in ("Check", "CheckWithErrors", "Infer", "InferWithErrors"):
setattr(cls, method, make_quick(getattr(cls, method)))
def test_multiple_returns(self):
with test_utils.Temp... | QuickTest |
python | huggingface__transformers | tests/models/perceiver/test_modeling_perceiver.py | {
"start": 2162,
"end": 11622
} | class ____:
def __init__(
self,
parent,
batch_size=13,
seq_length=7,
num_channels=3,
image_size=32,
train_size=[20, 20],
num_frames=5,
audio_samples_per_frame=200,
samples_per_patch=20,
nchunks=20,
num_latents=10,
... | PerceiverModelTester |
python | google__pytype | pytype/rewrite/flow/frame_base_test.py | {
"start": 551,
"end": 722
} | class ____(opcodes.Opcode):
_FLAGS = opcodes.NO_NEXT
def __init__(self, index):
super().__init__(index=index, line=0)
# pylint: enable=invalid-name
| FAKE_OP_NO_NEXT |
python | tensorflow__tensorflow | tensorflow/python/data/ops/dataset_ops.py | {
"start": 5677,
"end": 155319
} | class ____(
collections_abc.Iterable,
tracking_base.Trackable,
composite_tensor.CompositeTensor,
data_types.DatasetV2,
metaclass=abc.ABCMeta):
"""Represents a potentially large set of elements.
The `tf.data.Dataset` API supports writing descriptive and efficient input
pipelines. `Dataset` usa... | DatasetV2 |
python | great-expectations__great_expectations | great_expectations/expectations/expectation.py | {
"start": 97348,
"end": 109159
} | class ____(BatchExpectation, ABC):
"""Base class for ColumnPairMapExpectations.
ColumnPairMapExpectations are evaluated for a pair of columns and ask a yes/no question about the row-wise
relationship between those two columns. Based on the result, they then calculate the percentage of rows
that gave a ... | ColumnPairMapExpectation |
python | coleifer__peewee | peewee.py | {
"start": 160013,
"end": 160061
} | class ____(Field):
field_type = 'ANY'
| AnyField |
python | readthedocs__readthedocs.org | readthedocs/projects/migrations/0128_addons_notifications.py | {
"start": 150,
"end": 1809
} | class ____(migrations.Migration):
safe = Safe.before_deploy()
dependencies = [
("projects", "0127_default_to_semver"),
]
operations = [
migrations.AddField(
model_name="addonsconfig",
name="notifications_enabled",
field=models.BooleanField(default=Tr... | Migration |
python | cython__cython | Cython/Compiler/PyrexTypes.py | {
"start": 175234,
"end": 178113
} | class ____(CIntLike, CType, EnumMixin):
# name string
# doc string or None
# cname string or None
# typedef_flag boolean
# values [string], populated during declaration analysis
is_enum = 1
signed = 1
rank = -1 # Ranks below any integer type... | CEnumType |
python | mlflow__mlflow | mlflow/models/rag_signatures.py | {
"start": 1383,
"end": 1738
} | class ____:
index: int = 0
delta: Message = field(
default_factory=lambda: Message(
role="assistant",
content="MLflow is an open source platform for the machine learning lifecycle.",
)
)
finish_reason: str = "stop"
@deprecated("mlflow.types.llm.ChatCompletionRes... | ChainCompletionChunk |
python | google__python-fire | fire/core_test.py | {
"start": 750,
"end": 9613
} | class ____(testutils.BaseTestCase):
def testOneLineResult(self):
self.assertEqual(core._OneLineResult(1), '1') # pylint: disable=protected-access
self.assertEqual(core._OneLineResult('hello'), 'hello') # pylint: disable=protected-access
self.assertEqual(core._OneLineResult({}), '{}') # pylint: disable... | CoreTest |
python | tornadoweb__tornado | tornado/test/template_test.py | {
"start": 10689,
"end": 18213
} | class ____(unittest.TestCase):
def setUp(self):
self.templates = {
"escaped.html": "{% autoescape xhtml_escape %}{{ name }}",
"unescaped.html": "{% autoescape None %}{{ name }}",
"default.html": "{{ name }}",
"include.html": """\
escaped: {% include 'escaped.h... | AutoEscapeTest |
python | PrefectHQ__prefect | tests/test_task_engine.py | {
"start": 6392,
"end": 7687
} | class ____:
def test_run_task_with_client_provided_uuid(
self, sync_prefect_client, events_pipeline
):
@task
def foo():
return 42
task_run_id = uuid4()
run_task_sync(foo, task_run_id=task_run_id)
events_pipeline.process_events(_sync=True)
t... | TestRunTask |
python | pytorch__pytorch | torch/distributions/transforms.py | {
"start": 31522,
"end": 33614
} | class ____(Transform):
"""
Transform from unconstrained space to the simplex of one additional
dimension via a stick-breaking process.
This transform arises as an iterated sigmoid transform in a stick-breaking
construction of the `Dirichlet` distribution: the first logit is
transformed via sigm... | StickBreakingTransform |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/final3.py | {
"start": 2103,
"end": 2910
} | class ____(ClassA):
# This should generate an error because we are overriding
# a member that is marked Final in the parent class.
member1 = 5
# This should generate an error because we are overriding
# a member that is marked Final in the parent class.
_member7: Final = 6
# This should no... | ClassB |
python | tensorflow__tensorflow | tensorflow/python/types/internal.py | {
"start": 1486,
"end": 1646
} | class ____(object):
"""Interface for internal isinstance checks to ops/ragged/ragged_tensor.py.
This helps to avoid circular dependencies.
"""
| RaggedTensor |
python | pytorch__pytorch | test/ao/sparsity/test_kernels.py | {
"start": 694,
"end": 9178
} | class ____(TestCase):
@skipIfTorchDynamo("TorchDynamo fails here for unknown reasons")
@override_qengines
def test_sparse_qlinear(self):
batch_size = 12
input_channels = 16
output_channels = 4
decimal_val = 4
row_block_size = 1
col_block_size = 4
# X8... | TestQuantizedSparseKernels |
python | allegroai__clearml | clearml/backend_api/services/v2_20/workers.py | {
"start": 68065,
"end": 72089
} | class ____(Response):
"""
Response of workers.get_stats endpoint.
:param workers: List of the requested workers with their statistics
:type workers: Sequence[WorkerStats]
"""
_service = "workers"
_action = "get_stats"
_version = "2.20"
_schema = {
"definitions": {
... | GetStatsResponse |
python | doocs__leetcode | solution/0800-0899/0848.Shifting Letters/Solution.py | {
"start": 0,
"end": 304
} | class ____:
def shiftingLetters(self, s: str, shifts: List[int]) -> str:
n, t = len(s), 0
s = list(s)
for i in range(n - 1, -1, -1):
t += shifts[i]
j = (ord(s[i]) - ord("a") + t) % 26
s[i] = ascii_lowercase[j]
return "".join(s)
| Solution |
python | scrapy__scrapy | tests/test_commands.py | {
"start": 14540,
"end": 15367
} | class ____:
def test_valid_command(self) -> None:
argv = ["scrapy", "crawl", "my_spider"]
command = _pop_command_name(argv)
assert command == "crawl"
assert argv == ["scrapy", "my_spider"]
def test_no_command(self) -> None:
argv = ["scrapy"]
command = _pop_comman... | TestPopCommandName |
python | getsentry__sentry | src/sentry/models/organizationmember.py | {
"start": 2638,
"end": 3488
} | class ____(Enum):
APPROVED = 0
REQUESTED_TO_BE_INVITED = 1
REQUESTED_TO_JOIN = 2
@classmethod
def as_choices(cls):
return (
(InviteStatus.APPROVED.value, _("Approved")),
(
InviteStatus.REQUESTED_TO_BE_INVITED.value,
_("Organization mem... | InviteStatus |
python | arrow-py__arrow | arrow/locales.py | {
"start": 67634,
"end": 68929
} | class ____(Locale):
names = ["hi", "hi-in"]
past = "{0} पहले"
future = "{0} बाद"
timeframes = {
"now": "अभी",
"second": "एक पल",
"seconds": "{0} सेकंड्",
"minute": "एक मिनट ",
"minutes": "{0} मिनट ",
"hour": "एक घंटा",
"hours": "{0} घंटे",
... | HindiLocale |
python | django__django | tests/null_fk_ordering/models.py | {
"start": 362,
"end": 629
} | class ____(models.Model):
title = models.CharField(max_length=150)
author = models.ForeignKey(Author, models.SET_NULL, null=True)
class Meta:
ordering = ["author__name"]
# These following 4 models represent a far more complex ordering case.
| Article |
python | doocs__leetcode | solution/2500-2599/2551.Put Marbles in Bags/Solution.py | {
"start": 0,
"end": 199
} | class ____:
def putMarbles(self, weights: List[int], k: int) -> int:
arr = sorted(a + b for a, b in pairwise(weights))
return sum(arr[len(arr) - k + 1 :]) - sum(arr[: k - 1])
| Solution |
python | py-pdf__pypdf | pypdf/errors.py | {
"start": 143,
"end": 232
} | class ____(Exception):
"""Raised when a deprecated feature is used."""
| DeprecationError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.