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 | joke2k__faker | faker/providers/bank/th_TH/__init__.py | {
"start": 42,
"end": 1059
} | class ____(BankProvider):
"""Implement bank provider for ``th_TH`` locale."""
bban_format = "#" * 10
country_code = "TH"
swift_bank_codes = (
"AIAC",
"ANZB",
"BKKB",
"BAAB",
"BOFA",
"AYUD",
"BKCH",
"BOTH",
"BNPA",
"UBOB",
... | Provider |
python | falconry__falcon | tests/test_cookies.py | {
"start": 1546,
"end": 1992
} | class ____:
def on_get(self, req, resp):
resp.set_cookie('foo', 'bar', same_site='Lax')
resp.set_cookie('barz', 'barz', same_site='')
def on_post(self, req, resp):
resp.set_cookie('bar', 'foo', same_site='STRICT')
def on_put(self, req, resp):
resp.set_cookie('baz', 'foo', s... | CookieResourceSameSite |
python | readthedocs__readthedocs.org | readthedocs/builds/migrations/0039_migrate_config_data.py | {
"start": 1361,
"end": 1576
} | class ____(migrations.Migration):
safe = Safe.after_deploy()
dependencies = [
("builds", "0038_add_new_jsonfields"),
]
operations = [
migrations.RunPython(forwards_func),
]
| Migration |
python | scrapy__scrapy | docs/_ext/scrapydocs.py | {
"start": 434,
"end": 487
} | class ____(General, Element):
pass
| SettingslistNode |
python | huggingface__transformers | src/transformers/models/bert/configuration_bert.py | {
"start": 864,
"end": 5870
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`BertModel`]. It is used to
instantiate a BERT model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configurati... | BertConfig |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/solids.py | {
"start": 6775,
"end": 8856
} | class ____(graphene.ObjectType):
solid = graphene.NonNull(lambda: GrapheneSolid)
definition = graphene.NonNull(GrapheneOutputDefinition)
depended_by = non_null_list(GrapheneInput)
class Meta:
name = "Output"
def __init__(self, represented_pipeline, current_dep_structure, solid_name, output... | GrapheneOutput |
python | numba__numba | numba/core/types/npytypes.py | {
"start": 16813,
"end": 17961
} | class ____(Type):
"""
This is the type for `np.ndarray.ctypes`.
"""
def __init__(self, arytype):
# This depends on the ndim for the shape and strides attributes,
# even though they are not implemented, yet.
self.dtype = arytype.dtype
self.ndim = arytype.ndim
name ... | ArrayCTypes |
python | PyCQA__pylint | tests/functional/i/invalid/invalid_name/invalid_name_module_level.py | {
"start": 1286,
"end": 1423
} | class ____:
INPUT = ">>> "
INPUT = Theme()
input = Theme() # pylint: disable=redefined-builtin
OUTPUT = Theme()
output = Theme()
| Theme |
python | getsentry__sentry | tests/sentry/plugins/interfaces/test_releasehook.py | {
"start": 256,
"end": 742
} | class ____(TestCase):
def test_minimal(self) -> None:
project = self.create_project()
version = "bbee5b51f84611e4b14834363b8514c2"
hook = ReleaseHook(project)
hook.finish_release(version)
release = Release.objects.get(organization_id=project.organization_id, version=version... | FinishReleaseTest |
python | numba__numba | numba/misc/llvm_pass_timings.py | {
"start": 3224,
"end": 8983
} | class ____:
"""A class for processing raw timing report from LLVM.
The processing is done lazily so we don't waste time processing unused
timing information.
"""
def __init__(self, raw_data):
self._raw_data = raw_data
def __bool__(self):
return bool(self._raw_data)
def ge... | ProcessedPassTimings |
python | pytorch__pytorch | tools/test/test_codegen_model.py | {
"start": 384,
"end": 5168
} | class ____(expecttest.TestCase):
def assertParseErrorInline(self, yaml_str: str, expect: str) -> None:
es = yaml.load(yaml_str, Loader=LineLoader)
try:
parse_native_yaml_struct(es, set())
except AssertionError as e:
# hack to strip out the context
msg, _ =... | TestCodegenModel |
python | viewflow__viewflow | viewflow/workflow/migrations/0006_merge.py | {
"start": 108,
"end": 277
} | class ____(migrations.Migration):
dependencies = [
("viewflow", "0005_rename_flowcls"),
("viewflow", "0005_merge"),
]
operations = []
| Migration |
python | tensorflow__tensorflow | tensorflow/python/keras/layers/convolutional.py | {
"start": 15820,
"end": 21782
} | class ____(Conv):
"""1D convolution layer (e.g. temporal convolution).
This layer creates a convolution kernel that is convolved
with the layer input over a single spatial (or temporal) dimension
to produce a tensor of outputs.
If `use_bias` is True, a bias vector is created and added to the outputs.
Final... | Conv1D |
python | numba__numba | numba/core/types/function_type.py | {
"start": 3186,
"end": 4028
} | class ____(FunctionType):
_counter = 0
def __init__(self, nargs, dispatchers):
from numba.core.typing.templates import Signature
signature = Signature(types.undefined,
(types.undefined,) * nargs, recvr=None)
super(UndefinedFunctionType, self).__init__(sig... | UndefinedFunctionType |
python | getsentry__sentry | tests/sentry/db/models/manager/test_base_query_set.py | {
"start": 1315,
"end": 3850
} | class ____(TestCase):
def test_not_triggered(self) -> None:
with (
catch_signal(post_update) as handler,
override_options({"groups.enable-post-update-signal": True}),
):
self.group.message = "hi"
self.group.save()
assert not handler.called
... | TestSendPostUpdateSignal |
python | weaviate__weaviate-python-client | weaviate/collections/classes/config_vectorizers.py | {
"start": 12011,
"end": 12567
} | class ____(_VectorizerConfigCreate):
vectorizer: Union[Vectorizers, _EnumLikeStr] = Field(
default=Vectorizers.TEXT2VEC_COHERE, frozen=True, exclude=True
)
baseURL: Optional[AnyHttpUrl]
model: Optional[str]
dimensions: Optional[int]
truncate: Optional[CohereTruncation]
vectorizeClass... | _Text2VecCohereConfig |
python | apache__airflow | providers/microsoft/azure/tests/unit/microsoft/azure/fs/test_msgraph.py | {
"start": 1521,
"end": 5923
} | class ____:
@patch("airflow.providers.microsoft.azure.fs.msgraph.BaseHook.get_connection")
@patch("msgraphfs.MSGDriveFS")
def test_get_fs_with_drive_id(self, mock_msgdrivefs, mock_get_connection, mock_connection):
mock_get_connection.return_value = mock_connection
mock_fs_instance = MagicMoc... | TestMSGraphFS |
python | cython__cython | docs/examples/tutorial/memory_allocation/some_memory.py | {
"start": 96,
"end": 1095
} | class ____:
data: cython.p_double
def __cinit__(self, number: cython.size_t):
# allocate some memory (uninitialised, may contain arbitrary data)
self.data = cython.cast(cython.p_double, PyMem_Malloc(
number * cython.sizeof(cython.double)))
if not self.data:
raise... | SomeMemory |
python | huggingface__transformers | src/transformers/models/cohere/modeling_cohere.py | {
"start": 3155,
"end": 6203
} | class ____(nn.Module):
inv_freq: torch.Tensor # fix linting for `register_buffer`
def __init__(self, config: CohereConfig, device=None):
super().__init__()
self.max_seq_len_cached = config.max_position_embeddings
self.original_max_seq_len = config.max_position_embeddings
self.... | CohereRotaryEmbedding |
python | sqlalchemy__sqlalchemy | test/orm/test_relationships.py | {
"start": 7319,
"end": 10982
} | class ____(fixtures.MappedTest):
"""Test flush() when a mapper is dependent on multiple relationships"""
run_setup_mappers = "once"
run_inserts = "once"
run_deletes = None
@classmethod
def define_tables(cls, metadata):
Table(
"tbl_a",
metadata,
Colum... | DependencyTwoParentTest |
python | tensorflow__tensorflow | tensorflow/python/compiler/tensorrt/test/shape_output_test.py | {
"start": 4266,
"end": 5390
} | class ____(trt_test.TfTrtIntegrationTestBase):
"""In TRT 7, an input tensor can be pruned if it is not used by the network.
This happens if only its shape is used, but the shape is already defined by
the optimization profile by setting min=max. (nvbugs/3153064)
After pruning, the TRT network has no input bind... | PrunedInputTest |
python | django__django | tests/prefetch_related/models.py | {
"start": 7596,
"end": 7791
} | class ____(models.Model):
lesson_entry = models.ForeignKey(LessonEntry, models.CASCADE)
name = models.CharField(max_length=200)
# Ticket #21410: Regression when related_name="+"
| WordEntry |
python | readthedocs__readthedocs.org | readthedocs/config/tests/test_config.py | {
"start": 6381,
"end": 67964
} | class ____:
def test_version(self):
build = get_build_config({})
assert build.version == "2"
def test_formats_check_valid(self):
build = get_build_config({"formats": ["htmlzip", "pdf", "epub"]})
build.validate()
assert build.formats == ["htmlzip", "pdf", "epub"]
@py... | TestBuildConfigV2 |
python | doocs__leetcode | solution/1100-1199/1157.Online Majority Element In Subarray/Solution.py | {
"start": 0,
"end": 136
} | class ____:
__slots__ = ("l", "r", "x", "cnt")
def __init__(self):
self.l = self.r = 0
self.x = self.cnt = 0
| Node |
python | apache__airflow | dev/breeze/tests/test_ui_commands.py | {
"start": 1023,
"end": 2379
} | class ____:
def test_get_plural_base_with_suffix(self):
suffixes = ["_one", "_other"]
assert get_plural_base("message_one", suffixes) == "message"
assert get_plural_base("message_other", suffixes) == "message"
def test_get_plural_base_without_suffix(self):
suffixes = ["_one", "_... | TestPluralHandling |
python | apache__airflow | airflow-core/src/airflow/models/backfill.py | {
"start": 3345,
"end": 5140
} | class ____(Base):
"""Model representing a backfill job."""
__tablename__ = "backfill"
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
dag_id: Mapped[str] = mapped_column(StringID(), nullable=False)
from_date: Mapped[datetime] = mapped_column(UtcDateTime, nullable=Fal... | Backfill |
python | sympy__sympy | sympy/utilities/lambdify.py | {
"start": 51451,
"end": 59739
} | class ____(_EvaluatorPrinter):
def _print_unpacking(self, lvalues, rvalue):
"""Generate argument unpacking code.
This method is used when the input value is not iterable,
but can be indexed (see issue #14655).
"""
def flat_indexes(elems):
for n, el in enumerate(... | _TensorflowEvaluatorPrinter |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/sql/base.py | {
"start": 83570,
"end": 84559
} | class ____(
util.ReadOnlyContainer, ColumnCollection[_COLKEY, _COL_co]
):
__slots__ = ("_parent",)
def __init__(self, collection: ColumnCollection[_COLKEY, _COL_co]):
object.__setattr__(self, "_parent", collection)
object.__setattr__(self, "_colset", collection._colset)
object.__set... | ReadOnlyColumnCollection |
python | encode__django-rest-framework | rest_framework/fields.py | {
"start": 27213,
"end": 27521
} | class ____(CharField):
default_error_messages = {
'invalid': _('Enter a valid email address.')
}
def __init__(self, **kwargs):
super().__init__(**kwargs)
validator = EmailValidator(message=self.error_messages['invalid'])
self.validators.append(validator)
| EmailField |
python | doocs__leetcode | solution/0800-0899/0859.Buddy Strings/Solution.py | {
"start": 0,
"end": 377
} | class ____:
def buddyStrings(self, s: str, goal: str) -> bool:
m, n = len(s), len(goal)
if m != n:
return False
cnt1, cnt2 = Counter(s), Counter(goal)
if cnt1 != cnt2:
return False
diff = sum(s[i] != goal[i] for i in range(n))
return diff == 2 ... | Solution |
python | huggingface__transformers | src/transformers/models/udop/modeling_udop.py | {
"start": 43111,
"end": 43949
} | class ____(RelativePositionBiasBase):
def __init__(self, scaling_factor=1, max_distance=128, **kwargs):
"""
Reimplementation of T5 relative position bias. Distance between given tokens is their distance in the sequence.
Parameters are the same as in base class
"""
super().__i... | RelativePositionBias1D |
python | pandas-dev__pandas | asv_bench/benchmarks/rolling.py | {
"start": 9162,
"end": 9975
} | class ____:
params = (
["sum", "median", "mean", "max", "min", "kurt", "sum"],
[
("rolling", {"window": 2}),
("rolling", {"window": "30s"}),
("expanding", {}),
],
)
def setup(self, method, window_kwargs):
N = 1000
window, kwargs = ... | Groupby |
python | apache__airflow | providers/standard/tests/unit/standard/operators/test_python.py | {
"start": 39972,
"end": 49140
} | class ____(BasePythonTest):
def test_template_fields(self):
assert set(PythonOperator.template_fields).issubset(PythonVirtualenvOperator.template_fields)
def test_fail(self):
def f():
raise RuntimeError
with pytest.raises(CalledProcessError):
self.run_as_task(f)... | BaseTestPythonVirtualenvOperator |
python | nedbat__coveragepy | tests/test_api.py | {
"start": 41557,
"end": 44641
} | class ____(CoverageTest):
"""Test that the API works properly the way various third-party plugins call it.
We don't actually use the plugins, but these tests call the API the same
way they do.
"""
def pretend_to_be_nose_with_cover(self, erase: bool = False, cd: bool = False) -> None:
"""T... | TestRunnerPluginTest |
python | google__jax | tests/pmap_test.py | {
"start": 128202,
"end": 129110
} | class ____(EagerPmapMixin, PythonPmapTest):
def test_custom_jvp(self):
@jax.custom_jvp
def foo(x):
return jnp.exp(x)
@foo.defjvp
def foo_jvp(xs, ts):
(x,), (t,) = xs, ts
return foo(x), t * 4.
f = lambda x, t: jax.jvp(foo, (x,), (t,))
x = jnp.arange(
jax.local_device... | PythonPmapEagerTest |
python | getsentry__sentry | src/sentry/issues/grouptype.py | {
"start": 16321,
"end": 16695
} | class ____(GroupType):
type_id = 1015
slug = "performance_large_http_payload"
description = "Large HTTP payload"
category = GroupCategory.PERFORMANCE.value
category_v2 = GroupCategory.HTTP_CLIENT.value
noise_config = NoiseConfig()
default_priority = PriorityLevel.LOW
released = True
@d... | PerformanceLargeHTTPPayloadGroupType |
python | Netflix__metaflow | metaflow/packaging_sys/v1.py | {
"start": 805,
"end": 23139
} | class ____(MetaflowCodeContentV1Base):
METAFLOW_SUFFIXES_LIST = [".py", ".html", ".css", ".js"]
def __init__(
self,
code_dir: str = MetaflowCodeContentV1Base._code_dir,
other_dir: str = MetaflowCodeContentV1Base._other_dir,
criteria: Callable[[ModuleType], bool] = lambda x: True... | MetaflowCodeContentV1 |
python | google__jax | jax/_src/pallas/triton/lowering.py | {
"start": 20609,
"end": 21841
} | class ____:
arg_types: Sequence[jax.typing.DTypeLike]
symbol: str
result_type: str
def matches(self, avals: Sequence[jax_core.ShapedArray]) -> bool:
if len(avals) != len(self.arg_types):
return False
return all(
aval.dtype == jnp.dtype(arg_type)
or (aval.weak_type and aval.dtype.k... | _Extern |
python | pypa__warehouse | tests/unit/accounts/test_views.py | {
"start": 3948,
"end": 6906
} | class ____:
def test_user_redirects_username(self, db_request):
user = UserFactory.create()
db_request.current_route_path = pretend.call_recorder(
lambda username: "/user/the-redirect/"
)
# Intentionally swap the case of the username to trigger the redirect
db_re... | TestUserProfile |
python | pytorch__pytorch | test/quantization/eager/test_fuse_eager.py | {
"start": 913,
"end": 23117
} | class ____(QuantizationTestCase):
def test_fuse_module_train(self):
model = ModelForFusion(default_qat_qconfig).train()
# Test step by step fusion
model = fuse_modules_qat(model, ["conv1", "bn1", "relu1"])
model = fuse_modules_qat(model, ["sub1.conv", "sub1.bn"])
self.assertE... | TestFuseEager |
python | walkccc__LeetCode | solutions/3251. Find the Count of Monotonic Pairs II/3251.py | {
"start": 0,
"end": 1234
} | class ____:
# Same as 3250. Find the Count of Monotonic Pairs I
def countOfPairs(self, nums: list[int]) -> int:
MOD = 1_000_000_007
MAX = 1000
n = len(nums)
# dp[i][num] := the number of valid ways to fill the arrays up to index i
# with arr1[i] = num
dp = [[0] * (MAX + 1) for _ in range(n)]... | Solution |
python | numpy__numpy | numpy/distutils/ccompiler_opt.py | {
"start": 634,
"end": 23216
} | class ____:
"""An abstract class holds all configurable attributes of `CCompilerOpt`,
these class attributes can be used to change the default behavior
of `CCompilerOpt` in order to fit other requirements.
Attributes
----------
conf_nocache : bool
Set True to disable memory and file cac... | _Config |
python | ethereum__web3.py | ens/_normalization.py | {
"start": 2192,
"end": 2562
} | class ____:
type: str
tokens: list[Token]
def __init__(
self,
type: str = None,
tokens: list[Token] = None,
) -> None:
self.type = type
self.tokens = tokens
@property
def text(self) -> str:
if not self.tokens:
return ""
retur... | Label |
python | django__django | tests/template_tests/filter_tests/test_rjust.py | {
"start": 163,
"end": 856
} | class ____(SimpleTestCase):
@setup(
{
"rjust01": (
'{% autoescape off %}.{{ a|rjust:"5" }}. .{{ b|rjust:"5" }}.'
"{% endautoescape %}"
)
}
)
def test_rjust01(self):
output = self.engine.render_to_string(
"rjust01", {... | RjustTests |
python | modin-project__modin | modin/tests/config/test_envvars.py | {
"start": 10626,
"end": 29914
} | class ____:
@pytest.mark.parametrize(
"engine, storage_format, expected_backend",
[
("Python", "Pandas", "Python_Test"),
("Ray", "Pandas", "Ray"),
param(
"Unidist",
"Pandas",
"Unidist",
marks=pytest.... | TestBackend |
python | cython__cython | Cython/Compiler/PyrexTypes.py | {
"start": 88937,
"end": 89110
} | class ____(CIntType):
to_py_function = "PyLong_FromSsize_t"
from_py_function = "PyLong_AsSsize_t"
def sign_and_name(self):
return "Py_ssize_t"
| CSSizeTType |
python | getsentry__sentry | tests/sentry/seer/assisted_query/test_issues_tools.py | {
"start": 22395,
"end": 30849
} | class ____(APITestCase, SnubaTestCase):
databases = {"default", "control"}
def setUp(self):
super().setUp()
self.min_ago = before_now(minutes=1)
def test_get_issues_stats_success(self):
"""Test that get_issues_stats returns stats for issues"""
# Store two events to create i... | TestGetIssuesStats |
python | getsentry__sentry | src/sentry/rules/conditions/existing_high_priority_issue.py | {
"start": 440,
"end": 1727
} | class ____(EventCondition):
id = "sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition"
label = "Sentry marks an existing issue as high priority"
def passes(self, event: GroupEvent, state: EventState) -> bool:
if state.is_new:
return False
return state... | ExistingHighPriorityIssueCondition |
python | falconry__falcon | tests/test_httperror.py | {
"start": 36515,
"end": 40570
} | class ____:
@pytest.fixture
def client(self, util, asgi):
app = util.create_app(asgi)
app.add_route('/', GoneResource())
return testing.TestClient(app)
def test_unknown_accept(self, client):
res = client.simulate_get(headers={'Accept': 'foo/bar'})
assert res.content_... | TestDefaultSerializeError |
python | walkccc__LeetCode | solutions/3142. Check if Grid Satisfies Conditions/3142.py | {
"start": 0,
"end": 360
} | class ____:
def satisfiesConditions(self, grid: list[list[int]]) -> bool:
m = len(grid)
n = len(grid[0])
return (all(grid[i][j] == grid[i + 1][j]
for i in range(m - 1)
for j in range(n)) and
all(grid[i][j] != grid[i][j + 1]
for i in range(m)
... | Solution |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/paramSpec40.py | {
"start": 608,
"end": 862
} | class ____(TypedDict, total=False):
e: str
f: str
def func3(
a: int, b: int, /, *, c: str = ..., d: str = ..., **kwargs: Unpack[TD1]
) -> float: ...
call(func3, 1, 2, e="", c="")
call(func3, 1, 2, c="", d="", e="")
call(func3, 1, 2, e="")
| TD1 |
python | google__flatbuffers | tests/MyGame/Example/NestedStruct.py | {
"start": 3326,
"end": 5225
} | class ____(object):
# NestedStructT
def __init__(
self,
a = None,
b = 0,
c = None,
d = None,
):
self.a = a # type: Optional[List[int]]
self.b = b # type: int
self.c = c # type: Optional[List[int]]
self.d = d # type: Optional[List[i... | NestedStructT |
python | jazzband__django-pipeline | pipeline/finders.py | {
"start": 2605,
"end": 3333
} | class ____(PatternFilterMixin, DjangoFileSystemFinder):
"""
Like FileSystemFinder, but doesn't return any additional ignored patterns
This allows us to concentrate/compress our components without dragging
the raw versions in too.
"""
ignore_patterns = [
"*.js",
"*.css",
... | FileSystemFinder |
python | ray-project__ray | python/ray/train/tests/test_torch_utils.py | {
"start": 3865,
"end": 4920
} | class ____:
def test_load_module(self):
assert load_torch_model(torch_module) == torch_module
def test_load_state_dict(self):
state_dict = torch_module.state_dict()
model_definition = torch.nn.Linear(1, 1)
assert model_definition.state_dict() != state_dict
assert load_t... | TestLoadTorchModel |
python | TheAlgorithms__Python | maths/numerical_analysis/adams_bashforth.py | {
"start": 262,
"end": 7099
} | class ____:
"""
args:
func: An ordinary differential equation (ODE) as function of x and y.
x_initials: List containing initial required values of x.
y_initials: List containing initial required values of y.
step_size: The increment value of x.
x_final: The final value of x.
Returns: So... | AdamsBashforth |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/callbackProtocol1.py | {
"start": 2268,
"end": 2474
} | class ____:
def __call__(self) -> None:
pass
def test_func7(*args: *tuple[int, *tuple[int, ...]]) -> int:
return 123
# This should generate an error.
f7: TestClass7 = test_func7
| TestClass7 |
python | HypothesisWorks__hypothesis | hypothesis-python/tests/attrs/test_pretty.py | {
"start": 2243,
"end": 2436
} | class ____:
@attrs.define
class A:
x: int
def test_includes_namespace_classes_in_pretty():
obj = Namespace.A(x=1)
assert pretty.pretty(obj) == "Namespace.A(x=1)"
| Namespace |
python | spack__spack | lib/spack/spack/vendor/jinja2/runtime.py | {
"start": 4121,
"end": 12787
} | class ____:
"""The template context holds the variables of a template. It stores the
values passed to the template and also the names the template exports.
Creating instances is neither supported nor useful as it's created
automatically at various stages of the template evaluation and should not
be... | Context |
python | django__django | tests/managers_regress/models.py | {
"start": 1494,
"end": 1617
} | class ____(AbstractBase1):
data = models.CharField(max_length=25)
def __str__(self):
return self.data
| Child1 |
python | PyCQA__pylint | tests/functional/a/arguments_differ.py | {
"start": 4360,
"end": 4795
} | class ____(ParentClass):
def meth(self, _arg, dummy):
# no error here, "dummy" and "_" are being ignored if
# spotted in a variable name (declared in dummy_parameter_regex)
pass
# https://github.com/pylint-dev/pylint/issues/4443
# Some valid overwrites with type annotations
import typing... | ChildClass |
python | pypa__twine | twine/exceptions.py | {
"start": 1926,
"end": 2821
} | class ____(TwineException):
"""An upload attempt was detected to deprecated PyPI domains.
The sites pypi.python.org and testpypi.python.org are deprecated.
"""
@classmethod
def from_args(
cls, target_url: str, default_url: str, test_url: str
) -> "UploadToDeprecatedPyPIDetected":
... | UploadToDeprecatedPyPIDetected |
python | django__django | tests/admin_inlines/admin.py | {
"start": 3548,
"end": 3650
} | class ____(admin.ModelAdmin):
class Media:
js = ("my_awesome_admin_scripts.js",)
| HolderAdmin |
python | urllib3__urllib3 | dummyserver/testcase.py | {
"start": 9532,
"end": 11289
} | class ____:
"""
Marks an HTTP(S)Connection's socket after a request was made.
Helps a test server understand when a client finished a request,
without implementing a complete HTTP server.
"""
MARK_FORMAT = b"$#MARK%04x*!"
@classmethod
@contextlib.contextmanager
def mark(cls, monke... | ConnectionMarker |
python | euske__pdfminer | pdfminer/layout.py | {
"start": 3685,
"end": 3977
} | class ____(LTComponent):
def __init__(self, linewidth, pts):
LTComponent.__init__(self, get_bound(pts))
self.pts = pts
self.linewidth = linewidth
return
def get_pts(self):
return ','.join('%.3f,%.3f' % p for p in self.pts)
## LTLine
##
| LTCurve |
python | pytorch__pytorch | test/inductor/test_mix_order_reduction.py | {
"start": 443,
"end": 699
} | class ____(TestCase):
def setUp(self):
super().setUp()
metrics.reset()
def check_numeric(self, f, args, tol=1e-3):
ref = f(*args)
act = torch.compile(f)(*args)
self.assertTrue(same(ref, act, tol=tol))
| TestBase |
python | HypothesisWorks__hypothesis | hypothesis-python/tests/cover/test_lookup.py | {
"start": 32486,
"end": 32889
} | class ____(typing.Generic[_ValueType]):
value: _ValueType # the same name we have in `__init__`
__signature__ = signature(use_signature)
def __init__(self, value: int) -> None:
"""By this example we show, that ``__signature__`` is the most important source."""
assert isinstance(value, str... | AnnotatedConstructorWithSignature |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/run_coordinator/base.py | {
"start": 1038,
"end": 2052
} | class ____(ABC, MayHaveInstanceWeakref[T_DagsterInstance]):
@abstractmethod
def submit_run(self, context: SubmitRunContext) -> DagsterRun:
"""Submit a run to the run coordinator for execution.
Args:
context (SubmitRunContext): information about the submission - every run coordinator... | RunCoordinator |
python | tensorflow__tensorflow | tensorflow/python/autograph/core/converter_testing.py | {
"start": 3014,
"end": 4082
} | class ____(test.TestCase):
"""Base class for unit tests in this module. Contains relevant utilities."""
def setUp(self):
# AutoGraph tests must run in graph mode to properly test control flow.
self.graph = ops.Graph().as_default()
self.graph.__enter__()
def tearDown(self):
self.graph.__exit__(No... | TestCase |
python | pytorch__pytorch | torch/_inductor/dtype_propagation.py | {
"start": 2236,
"end": 12027
} | class ____:
"""
Propagate dtype from args to output
"""
# Singleton DtypePropagationOpsHandler, because we meta program over a number of op rules.
# Those are only defined after other inductor state has run.
_instance: Optional["DtypePropagationOpsHandler"] = None
def __new__(cls):
... | DtypePropagationOpsHandler |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pylint/invalid_return_type_length.py | {
"start": 932,
"end": 1006
} | class ____:
def __len__(self):
raise NotImplementedError
| Length5 |
python | pypa__warehouse | warehouse/utils/sns.py | {
"start": 502,
"end": 4230
} | class ____:
def __init__(self, *, topics, session=None):
self.topics = topics
self.http = session if session is not None else requests.session()
def verify(self, message):
if message.get("SignatureVersion") == "2":
self._validate_v2_signature(message)
else:
... | MessageVerifier |
python | weaviate__weaviate-python-client | weaviate/collections/classes/batch.py | {
"start": 6231,
"end": 6411
} | class ____:
"""This class contains the error information for a single reference in a batch operation."""
message: str
reference: BatchReference
@dataclass
| ErrorReference |
python | kubernetes-client__python | kubernetes/client/models/v1_glusterfs_volume_source.py | {
"start": 383,
"end": 5961
} | 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... | V1GlusterfsVolumeSource |
python | davidhalter__parso | parso/python/token.py | {
"start": 350,
"end": 909
} | class ____(Enum):
STRING = TokenType('STRING')
NUMBER = TokenType('NUMBER')
NAME = TokenType('NAME', contains_syntax=True)
ERRORTOKEN = TokenType('ERRORTOKEN')
NEWLINE = TokenType('NEWLINE')
INDENT = TokenType('INDENT')
DEDENT = TokenType('DEDENT')
ERROR_DEDENT = TokenType('ERROR_DEDENT'... | PythonTokenTypes |
python | charliermarsh__ruff | crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/class_definition.py | {
"start": 1192,
"end": 1236
} | class ____:
"""Docstring"""
x = 1
| Test |
python | pandas-dev__pandas | pandas/tests/libs/test_hashtable.py | {
"start": 19316,
"end": 21277
} | class ____:
def test_get_set_contains_len(self, table_type, dtype):
index = float("nan")
table = table_type()
assert index not in table
table.set_item(index, 42)
assert len(table) == 1
assert index in table
assert table.get_item(index) == 42
table.se... | TestHashTableWithNans |
python | spyder-ide__spyder | spyder/plugins/help/widgets.py | {
"start": 6782,
"end": 8690
} | class ____(QWidget):
"""
Read-only editor widget with find dialog
"""
# Signals
focus_changed = Signal()
sig_custom_context_menu_requested = Signal(QPoint)
def __init__(self, parent):
QWidget.__init__(self, parent)
self.editor = None
# Read-only simple code editor
... | PlainText |
python | python__mypy | mypy/stats.py | {
"start": 1437,
"end": 15711
} | class ____(TraverserVisitor):
def __init__(
self,
inferred: bool,
filename: str,
modules: dict[str, MypyFile],
typemap: dict[Expression, Type] | None = None,
all_nodes: bool = False,
visit_untyped_defs: bool = True,
) -> None:
self.inferred = infer... | StatisticsVisitor |
python | conda__conda | conda/models/records.py | {
"start": 2986,
"end": 3132
} | class ____(DictSafeMixin, Entity):
source = StringField()
type = LinkTypeField(LinkType, required=False)
EMPTY_LINK = Link(source="")
| Link |
python | sqlalchemy__sqlalchemy | test/dialect/postgresql/test_types.py | {
"start": 187239,
"end": 187320
} | class ____(_NumRangeTests, _RangeTypeCompilation):
pass
| NumRangeCompilationTest |
python | jina-ai__jina | jina/proto/docarray_v1/pb/jina_pb2_grpc.py | {
"start": 21252,
"end": 22148
} | class ____(object):
"""*
jina gRPC service to trigger a snapshot at the Executor Runtime.
"""
@staticmethod
def snapshot_status(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
... | JinaExecutorSnapshotProgress |
python | huggingface__transformers | src/transformers/models/glm4v_moe/modular_glm4v_moe.py | {
"start": 21030,
"end": 21177
} | class ____(Glm4MoeTopkRouter, nn.Module):
def __init__(self, config: Glm4vMoeTextConfig):
super().__init__(config)
| Glm4vMoeTextTopkRouter |
python | pytorch__pytorch | test/export/test_export_opinfo.py | {
"start": 4067,
"end": 8250
} | class ____(TestCase):
# In CI, this test runs on a CUDA machine with cuda build
# We set CUDA_VISIBLE_DEVICES="" to simulate a CPU machine with cuda build
# Running this on all ops in op_db is too slow, so we only run on a selected subset
@onlyCUDA
@skipIfRocm
@ops(selected_op_db, allowed_dtypes... | TestExportOnFakeCuda |
python | PyCQA__pyflakes | pyflakes/messages.py | {
"start": 4532,
"end": 4865
} | class ____(Message):
"""
Indicates that a variable has been explicitly annotated to but not actually
used.
"""
message = 'local variable %r is annotated but never used'
def __init__(self, filename, loc, names):
Message.__init__(self, filename, loc)
self.message_args = (names,)
... | UnusedAnnotation |
python | ipython__ipython | tests/test_hooks.py | {
"start": 852,
"end": 2302
} | class ____(object):
def __init__(self, message):
self.message = message
self.called = False
def __call__(self):
self.called = True
raise TryNext(self.message)
# -----------------------------------------------------------------------------
# Test functions
# -------------------... | Fail |
python | pytorch__pytorch | test/dynamo/cpython/3_13/test_generators.py | {
"start": 51469,
"end": 53533
} | class ____:
def __init__(self, n):
self.n = n
rangen = range(n)
# Assign a unique int to each column and diagonal.
# columns: n of those, range(n).
# NW-SE diagonals: 2n-1 of these, i-j unique and invariant along
# each, smallest i-j is 0-(n-1) = 1-n, so add n-1 to ... | Queens |
python | django__django | django/contrib/postgres/lookups.py | {
"start": 1125,
"end": 1230
} | class ____(Transform):
bilateral = True
lookup_name = "unaccent"
function = "UNACCENT"
| Unaccent |
python | sympy__sympy | sympy/polys/polymatrix.py | {
"start": 367,
"end": 9771
} | class ____:
"""
A mutable matrix of objects from poly module or to operate with them.
Examples
========
>>> from sympy.polys.polymatrix import PolyMatrix
>>> from sympy import Symbol, Poly
>>> x = Symbol('x')
>>> pm1 = PolyMatrix([[Poly(x**2, x), Poly(-x, x)], [Poly(x**3, x), Poly(-1 +... | MutablePolyDenseMatrix |
python | joke2k__faker | faker/providers/internet/pl_PL/__init__.py | {
"start": 46,
"end": 510
} | class ____(InternetProvider):
free_email_domains = (
"onet.pl",
"interia.pl",
"gmail.com",
"o2.pl",
"yahoo.com",
"hotmail.com",
)
tlds = ("com", "com", "com", "net", "org", "pl", "pl", "pl")
replacements = (
("ą", "a"),
("ć", "c"),
... | Provider |
python | pandas-dev__pandas | pandas/core/arrays/sparse/accessor.py | {
"start": 8310,
"end": 15178
} | class ____(BaseAccessor, PandasDelegate):
"""
DataFrame accessor for sparse data.
It allows users to interact with a `DataFrame` that contains sparse data types
(`SparseDtype`). It provides methods and attributes to efficiently work with sparse
storage, reducing memory usage while maintaining compa... | SparseFrameAccessor |
python | chroma-core__chroma | chromadb/api/configuration.py | {
"start": 13958,
"end": 14776
} | class ____(CollectionConfigurationInternal):
"""Configuration parameters for creating a collection."""
def __init__(self, hnsw_configuration: Optional[HNSWConfigurationInternal]):
"""Initializes a new instance of the CollectionConfiguration class.
Args:
hnsw_configuration: The HNSW ... | CollectionConfigurationInterface |
python | gevent__gevent | src/gevent/tests/test__threadpool.py | {
"start": 14973,
"end": 15203
} | class ____(object):
refs = None
def func(self, arg1, kwarg1=None):
result = Object()
self.refs.extend([weakref.ref(x) for x in (arg1, kwarg1, result)])
return result
def noop():
pass
| SomeClass |
python | pytorch__pytorch | torch/fx/graph.py | {
"start": 8742,
"end": 8966
} | class ____(NamedTuple):
"""
Contains extra info stored when we're using Pytrees
"""
orig_args: list[str]
in_spec: pytree.TreeSpec
out_spec: Optional[pytree.TreeSpec]
@dataclass(frozen=True)
| _PyTreeInfo |
python | tensorflow__tensorflow | tensorflow/python/distribute/v1/input_lib.py | {
"start": 7275,
"end": 9029
} | class ____(input_lib.DistributedIteratorBase):
"""Input Iterator for a distributed dataset."""
# We need a private initializer method for re-initializing multidevice
# iterators when used with Keras training loops. If we don't reinitialize the
# iterator we run into memory leak issues (b/123315763).
@propert... | DistributedIteratorV1 |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/streams.py | {
"start": 21489,
"end": 21812
} | class ____(GithubStream):
"""
API docs: https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repository-tags
"""
primary_key = ["repository", "name"]
def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str:
return f"repos/{stream_slice['repository']}/tags"... | Tags |
python | walkccc__LeetCode | solutions/3244. Shortest Distance After Road Addition Queries II/3244.py | {
"start": 0,
"end": 645
} | class ____:
def shortestDistanceAfterQueries(
self,
n: int,
queries: list[list[int]],
) -> list[int]:
ans = []
nodeToFarthestNode = {i: i + 1 for i in range(n - 1)}
for u, v in queries:
# If `u` exists in the map and `v` is farther than the current farthest
# node for `u`,... | Solution |
python | ray-project__ray | rllib/models/tf/layers/relative_multi_head_attention.py | {
"start": 5286,
"end": 5757
} | class ____(tf.keras.layers.Layer if tf else object):
def __init__(self, out_dim, **kwargs):
super().__init__(**kwargs)
self.inverse_freq = 1 / (10000 ** (tf.range(0, out_dim, 2.0) / out_dim))
def call(self, seq_length):
pos_offsets = tf.cast(tf.range(seq_length - 1, -1, -1), tf.float32)... | PositionalEmbedding |
python | spack__spack | lib/spack/spack/test/modules/common.py | {
"start": 2740,
"end": 2982
} | class ____:
def __init__(self, db_ids, spec_hash_to_db):
self.upstream_dbs = db_ids
self.spec_hash_to_db = spec_hash_to_db
def db_for_spec_hash(self, spec_hash):
return self.spec_hash_to_db.get(spec_hash)
| MockDb |
python | tensorflow__tensorflow | tensorflow/python/ops/data_flow_ops.py | {
"start": 4415,
"end": 25337
} | class ____:
"""Base class for queue implementations.
A queue is a TensorFlow data structure that stores tensors across
multiple steps, and exposes operations that enqueue and dequeue
tensors.
Each queue element is a tuple of one or more tensors, where each
tuple component has a static dtype, and may have ... | QueueBase |
python | ray-project__ray | python/ray/_private/gcs_pubsub.py | {
"start": 6593,
"end": 7433
} | class ____(_AioSubscriber):
def __init__(
self,
worker_id: bytes = None,
address: str = None,
channel: grpc.Channel = None,
):
super().__init__(
pubsub_pb2.RAY_NODE_RESOURCE_USAGE_CHANNEL, worker_id, address, channel
)
async def poll(self, timeout... | GcsAioResourceUsageSubscriber |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.