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 | microsoft__pyright | packages/pyright-internal/src/tests/samples/protocol48.py | {
"start": 156,
"end": 281
} | class ____(Protocol[T]):
def method1(self) -> T: ...
def apply_method1(__x: SupportsMethod1[T]) -> T: ...
| SupportsMethod1 |
python | spack__spack | lib/spack/spack/util/web.py | {
"start": 30694,
"end": 30963
} | class ____(SpackWebError):
"""Raised when an operation can't get an internet connection."""
def __init__(self, message, url):
super().__init__("No network connection: " + str(message), "URL was: " + str(url))
self.url = url
| NoNetworkConnectionError |
python | pytorch__pytorch | test/jit/test_models.py | {
"start": 886,
"end": 1518
} | class ____(nn.Module):
def __init__(self) -> None:
super().__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2_drop = nn.Dropout2d()
self.fc1 = nn.Linear(320, 50)
self.fc2 = nn.Linear(50, 10)
def forwar... | MnistNet |
python | sympy__sympy | sympy/polys/domains/pythonintegerring.py | {
"start": 428,
"end": 3007
} | class ____(IntegerRing):
"""Integer ring based on Python's ``int`` type.
This will be used as :ref:`ZZ` if ``gmpy`` and ``gmpy2`` are not
installed. Elements are instances of the standard Python ``int`` type.
"""
dtype = PythonInteger # type: ignore
zero = dtype(0) # type: ignore
one = dty... | PythonIntegerRing |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 485159,
"end": 485690
} | class ____(sgqlc.types.Type):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("cursor", "has_two_factor_enabled", "node", "role")
cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor")
has_two_factor_enabled = sgqlc.types.Field(... | OrganizationMemberEdge |
python | Pylons__pyramid | tests/test_config/test_testing.py | {
"start": 8321,
"end": 8505
} | class ____(SecurityAPIMixin, AuthenticationAPIMixin):
def __init__(self, environ=None):
if environ is None:
environ = {}
self.environ = environ
| DummyRequest |
python | sqlalchemy__sqlalchemy | test/orm/test_froms.py | {
"start": 4680,
"end": 11278
} | class ____(QueryTest, AssertsCompiledSQL):
__dialect__ = "default"
query_correlated = (
"SELECT users.name AS users_name, "
"(SELECT count(addresses.id) AS count_1 FROM addresses "
"WHERE addresses.user_id = users.id) AS anon_1 FROM users"
)
query_not_correlated = (
"SE... | QueryCorrelatesLikeSelect |
python | anthropics__anthropic-sdk-python | src/anthropic/_exceptions.py | {
"start": 3611,
"end": 3751
} | class ____(APIStatusError):
status_code: Literal[503] = 503 # pyright: ignore[reportIncompatibleVariableOverride]
| ServiceUnavailableError |
python | kamyu104__LeetCode-Solutions | Python/number-of-1-bits.py | {
"start": 1976,
"end": 2175
} | class ____(object):
# @param n, an integer
# @return an integer
def hammingWeight(self, n: int) -> int:
b="{0:b}".format(n)
result=b.count("1")
return result
| Solution4 |
python | getsentry__sentry | src/sentry/apidocs/examples/autofix_examples.py | {
"start": 7784,
"end": 7905
} | class ____:
AUTOFIX_POST_RESPONSE = AUTOFIX_POST_RESPONSE
AUTOFIX_GET_RESPONSE = AUTOFIX_GET_RESPONSE
| AutofixExamples |
python | cython__cython | Cython/Compiler/Code.py | {
"start": 139857,
"end": 143761
} | class ____:
"""
Can be used for writing out some Cython code.
"""
def __init__(self, buffer=None, indent_level=0, context=None, encoding='ascii'):
self.buffer = buffer or StringIOTree()
self.level = indent_level
self.original_level = indent_level
self.context = context
... | PyxCodeWriter |
python | doocs__leetcode | solution/2000-2099/2073.Time Needed to Buy Tickets/Solution.py | {
"start": 0,
"end": 227
} | class ____:
def timeRequiredToBuy(self, tickets: List[int], k: int) -> int:
ans = 0
for i, x in enumerate(tickets):
ans += min(x, tickets[k] if i <= k else tickets[k] - 1)
return ans
| Solution |
python | pyqtgraph__pyqtgraph | pyqtgraph/util/mutex.py | {
"start": 44,
"end": 3266
} | class ____(QtCore.QMutex):
"""
Subclass of QMutex that provides useful debugging information during
deadlocks--tracebacks are printed for both the code location that is
attempting to lock the mutex as well as the location that has already
acquired the lock.
Also provides __enter__ and __ex... | Mutex |
python | django__django | django/core/serializers/base.py | {
"start": 1786,
"end": 6504
} | class ____:
"""
Abstract serializer base class.
"""
# Indicates if the implemented serializer is only available for
# internal Django use.
internal_use_only = False
progress_class = ProgressBar
stream_class = StringIO
def serialize(
self,
queryset,
*,
... | Serializer |
python | cython__cython | docs/examples/userguide/extension_types/penguin2.py | {
"start": 50,
"end": 247
} | class ____:
food: object
def __cinit__(self, food):
self.food = food
penguin = Penguin('fish 1')
penguin = None
penguin = Penguin('fish 2') # does not need to allocate memory!
| Penguin |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 709381,
"end": 713505
} | class ____(sgqlc.types.Type, Node):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = (
"app",
"branch",
"check_runs",
"commit",
"conclusion",
"created_at",
"creator",
"database_id",
"matching... | CheckSuite |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_chartsheet05.py | {
"start": 315,
"end": 1431
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("chartsheet05.xlsx")
def test_create_file(self):
"""Test the worksheet properties of an XlsxWriter chartsheet file."""
workbook = W... | TestCompareXLSXFiles |
python | RaRe-Technologies__gensim | gensim/test/test_miislita.py | {
"start": 1474,
"end": 3675
} | class ____(unittest.TestCase):
def test_textcorpus(self):
"""Make sure TextCorpus can be serialized to disk. """
# construct corpus from file
miislita = CorpusMiislita(datapath('head500.noblanks.cor.bz2'))
# make sure serializing works
ftmp = get_tmpfile('test_textcorpus.mm'... | TestMiislita |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-confluence/tests/test_readers_confluence.py | {
"start": 438,
"end": 11481
} | class ____:
def __init__(self, *args, **kwargs) -> None:
pass
@pytest.fixture(autouse=True)
def mock_atlassian_confluence(monkeypatch):
monkeypatch.setattr("atlassian.Confluence", MockConfluence)
def test_confluence_reader_with_oauth2():
reader = ConfluenceReader(
base_url="https://examp... | MockConfluence |
python | numba__numba | numba/core/types/iterators.py | {
"start": 2326,
"end": 2912
} | class ____(SimpleIteratorType):
"""
Type class for `zip` objects.
Type instances are parametered with the underlying source types.
"""
def __init__(self, iterable_types):
from numba.core.types import Tuple
self.source_types = tuple(tp.iterator_type for tp in iterable_types)
... | ZipType |
python | pytorch__pytorch | torch/_export/db/examples/cond_operands.py | {
"start": 136,
"end": 799
} | class ____(torch.nn.Module):
"""
The operands passed to cond() must be:
- a list of tensors
- match arguments of `true_fn` and `false_fn`
NOTE: If the `pred` is test on a dim with batch size < 2, it will be specialized.
"""
def forward(self, x, y):
def true_fn(x, y):
re... | CondOperands |
python | django-haystack__django-haystack | test_haystack/test_loading.py | {
"start": 7090,
"end": 7234
} | class ____(indexes.BasicSearchIndex, indexes.Indexable):
def get_model(self):
return AnotherMockModel
| BasicAnotherMockModelSearchIndex |
python | python-pillow__Pillow | src/PIL/MicImagePlugin.py | {
"start": 662,
"end": 2564
} | class ____(TiffImagePlugin.TiffImageFile):
format = "MIC"
format_description = "Microsoft Image Composer"
_close_exclusive_fp_after_loading = False
def _open(self) -> None:
# read the OLE directory and see if this is a likely
# to be a Microsoft Image Composer file
try:
... | MicImageFile |
python | davidhalter__jedi | jedi/inference/compiled/subprocess/functions.py | {
"start": 8283,
"end": 8464
} | class ____:
"""Stores information returned from an implicit namespace spec"""
def __init__(self, name, paths):
self.name = name
self.paths = paths
| ImplicitNSInfo |
python | nedbat__coveragepy | coverage/misc.py | {
"start": 4481,
"end": 6292
} | class ____:
"""Hashes Python data for fingerprinting."""
def __init__(self) -> None:
self.hash = hashlib.new("sha3_256", usedforsecurity=False)
def update(self, v: Any) -> None:
"""Add `v` to the hash, recursively if needed."""
self.hash.update(str(type(v)).encode("utf-8"))
... | Hasher |
python | ApeWorX__ape | tests/functional/utils/test_basemodel.py | {
"start": 1683,
"end": 2887
} | class ____:
@pytest.fixture(scope="class")
def ExampleModel(self):
class _ExampleModel(DiskCacheableModel):
aa: int
bb: str
cc: dict[str, dict[str, int]]
return _ExampleModel
def test_model_validate_file(self, ExampleModel):
with create_tempdir()... | TestDiskCacheableModel |
python | facebook__pyre-check | source/interprocedural_analyses/taint/test/integration/decorator.py | {
"start": 3876,
"end": 8889
} | class ____:
def sink_method(self, x: str) -> None:
print(x)
_test_sink(x)
@with_logging_args_kwargs_no_sink
def foo(self, x: str) -> None:
self.sink_method(x)
@with_logging_args_kwargs_no_sink
@with_logging_args_kwargs
def bar(self, x: str) -> None:
print(x)
... | Foo |
python | apache__airflow | providers/slack/tests/unit/slack/operators/test_slack.py | {
"start": 7101,
"end": 11001
} | class ____:
def setup_method(self):
self.test_username = "test_username"
self.test_channel = "#test_slack_channel"
self.test_initial_comment = "test text file test_filename.txt"
self.filename = "test_filename.txt"
self.test_content = "This is a test text file!"
self.t... | TestSlackAPIFileOperator |
python | vyperlang__vyper | vyper/codegen/core.py | {
"start": 1754,
"end": 53481
} | class ____(VyperType):
_invalid_locations = tuple(DataLocation)
def __init__(self, buf_size: int):
assert buf_size >= 0
self.buf_size: int = ceil32(buf_size)
super().__init__(members=None)
@property
def size_in_bytes(self):
return self.buf_size
def get_size_in(sel... | _InternalBufferT |
python | lepture__mistune | src/mistune/directives/_fenced.py | {
"start": 533,
"end": 883
} | class ____(DirectiveParser):
name = "fenced_directive"
@staticmethod
def parse_type(m: Match[str]) -> str:
return m.group("type")
@staticmethod
def parse_title(m: Match[str]) -> str:
return m.group("title")
@staticmethod
def parse_content(m: Match[str]) -> str:
ret... | FencedParser |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/dataplex.py | {
"start": 168126,
"end": 172698
} | class ____(DataplexCatalogBaseOperator):
"""
Search for Entries matching the given query and scope.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:DataplexCatalogSearchEntriesOperator`
:param query: Required. The query agai... | DataplexCatalogSearchEntriesOperator |
python | kamyu104__LeetCode-Solutions | Python/check-if-string-is-a-prefix-of-array.py | {
"start": 461,
"end": 869
} | class ____(object):
def isPrefixString(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: bool
"""
i = 0
for word in words:
for c in word:
if i == len(s) or s[i] != c:
return False
i... | Solution2 |
python | django__django | tests/i18n/patterns/tests.py | {
"start": 9463,
"end": 12017
} | class ____(URLTestCaseBase):
"""
Tests if the user gets redirected to the right URL when there is no
language-prefix in the request URL.
"""
def test_no_prefix_response(self):
response = self.client.get("/not-prefixed/")
self.assertEqual(response.status_code, 200)
def test_en_r... | URLRedirectTests |
python | jazzband__django-pipeline | pipeline/compressors/uglifyjs.py | {
"start": 91,
"end": 354
} | class ____(SubProcessCompressor):
def compress_js(self, js):
command = (settings.UGLIFYJS_BINARY, settings.UGLIFYJS_ARGUMENTS)
if self.verbose:
command += " --verbose"
return self.execute_command(command, js)
| UglifyJSCompressor |
python | django__django | django/core/files/uploadhandler.py | {
"start": 1397,
"end": 1615
} | class ____(UploadFileException):
"""
Upload handlers that have handled a file and do not want future handlers to
run should raise this exception instead of returning None.
"""
pass
| StopFutureHandlers |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pyupgrade/UP046_0.py | {
"start": 1546,
"end": 1698
} | class ____(Base1, Generic[T], Base2):
var: T
# runtime `TypeError` to inherit from `Generic` multiple times, but we still
# emit a diagnostic
| Sandwich |
python | pytorch__pytorch | torch/_inductor/shape_propagation.py | {
"start": 2241,
"end": 4565
} | class ____:
"""
Propagate shape from args to output
"""
@staticmethod
def constant(value: torch.types.Number, dtype: torch.dtype) -> BlockShapeType:
# See implementation of constant for triton for the reason
from torch._inductor.codegen.triton import triton_compute_type, TritonKerne... | ShapePropagationOpsHandler |
python | tensorflow__tensorflow | tensorflow/python/training/adadelta.py | {
"start": 1008,
"end": 7315
} | class ____(optimizer.Optimizer):
"""Optimizer that implements the Adadelta algorithm.
References:
ADADELTA - An Adaptive Learning Rate Method:
[Zeiler, 2012](http://arxiv.org/abs/1212.5701)
([pdf](http://arxiv.org/pdf/1212.5701v1.pdf))
@compatibility(TF2)
tf.compat.v1.train.AdadeltaOptimizer i... | AdadeltaOptimizer |
python | wandb__wandb | wandb/vendor/pygments/lexers/templates.py | {
"start": 55338,
"end": 55979
} | class ____(DelegatingLexer):
"""
Subclass of the `LassoLexer` which highlights unhandled data with the
`XmlLexer`.
.. versionadded:: 1.6
"""
name = 'XML+Lasso'
aliases = ['xml+lasso']
alias_filenames = ['*.xml', '*.lasso', '*.lasso[89]',
'*.incl', '*.inc', '*.las... | LassoXmlLexer |
python | dask__dask | dask/dataframe/dask_expr/_merge.py | {
"start": 24040,
"end": 28397
} | class ____(Merge, PartitionsFiltered):
_parameters = [
"left",
"right",
"how",
"left_on",
"right_on",
"left_index",
"right_index",
"suffixes",
"indicator",
"_partitions",
]
_defaults = {
"how": "inner",
"left_on"... | BroadcastJoin |
python | PyCQA__pylint | tests/functional/ext/docparams/return/missing_return_doc_Google.py | {
"start": 1806,
"end": 2169
} | class ____:
"""test_finds_annotation_property_return_type_google
Example of a property having return documentation in
a Google style docstring
"""
@property
def foo_method(self) -> int:
"""docstring ...
Raises:
RuntimeError: Always
"""
raise RuntimeE... | Foo |
python | sqlalchemy__sqlalchemy | test/typing/plain_files/orm/session.py | {
"start": 975,
"end": 4362
} | class ____(Base):
__tablename__ = "address"
id: Mapped[int] = mapped_column(primary_key=True)
user_id = mapped_column(ForeignKey("user.id"))
email: Mapped[str]
user: Mapped[User] = relationship(back_populates="addresses")
e = create_engine("sqlite://")
Base.metadata.create_all(e)
with Session(e... | Address |
python | kamyu104__LeetCode-Solutions | Python/number-of-substrings-containing-all-three-characters.py | {
"start": 354,
"end": 793
} | class ____(object):
def numberOfSubstrings(self, s):
"""
:type s: str
:rtype: int
"""
result, left, count = 0, 0, [0]*3
for right, c in enumerate(s):
count[ord(s[right])-ord('a')] += 1
while all(count):
count[ord(s[left])-ord('a... | Solution2 |
python | django-haystack__django-haystack | haystack/admin.py | {
"start": 6290,
"end": 6358
} | class ____(SearchModelAdminMixin, ModelAdmin):
pass
| SearchModelAdmin |
python | modin-project__modin | modin/core/dataframe/pandas/interchange/dataframe_protocol/exception.py | {
"start": 1035,
"end": 1172
} | class ____(Exception):
"""Exception to be raised if there is no offsets buffer for ``PandasProtocolColumn``."""
pass
| NoOffsetsBuffer |
python | walkccc__LeetCode | solutions/1332. Remove Palindromic Subsequences/1332.py | {
"start": 0,
"end": 100
} | class ____:
def removePalindromeSub(self, s: str) -> int:
return 1 if s == s[::-1] else 2
| Solution |
python | pallets__werkzeug | src/werkzeug/routing/exceptions.py | {
"start": 1769,
"end": 4401
} | class ____(RoutingException, LookupError):
"""Raised if the build system cannot find a URL for an endpoint with the
values provided.
"""
def __init__(
self,
endpoint: t.Any,
values: t.Mapping[str, t.Any],
method: str | None,
adapter: MapAdapter | None = None,
... | BuildError |
python | redis__redis-py | redis/commands/search/reducers.py | {
"start": 908,
"end": 1119
} | class ____(FieldOnlyReducer):
"""
Calculates the largest value in the given field within the group
"""
NAME = "MAX"
def __init__(self, field: str) -> None:
super().__init__(field)
| max |
python | python-pillow__Pillow | src/PIL/PcdImagePlugin.py | {
"start": 539,
"end": 1774
} | class ____(ImageFile.ImageFile):
format = "PCD"
format_description = "Kodak PhotoCD"
def _open(self) -> None:
# rough
assert self.fp is not None
self.fp.seek(2048)
s = self.fp.read(1539)
if not s.startswith(b"PCD_"):
msg = "not a PCD file"
r... | PcdImageFile |
python | walkccc__LeetCode | solutions/2708. Maximum Strength of a Group/2708.py | {
"start": 0,
"end": 665
} | class ____:
def maxStrength(self, nums: list[int]) -> int:
posProd = 1
negProd = 1
maxNeg = -math.inf
negCount = 0
hasPos = False
hasZero = False
for num in nums:
if num > 0:
posProd *= num
hasPos = True
elif num < 0:
negProd *= num
maxNeg = max... | Solution |
python | getsentry__sentry | tests/sentry_plugins/victorops/test_plugin.py | {
"start": 457,
"end": 712
} | class ____(Interface):
def to_string(self, event: Event) -> str:
return self.body
def get_title(self) -> str:
return self.title
def test_conf_key() -> None:
assert VictorOpsPlugin().conf_key == "victorops"
| UnicodeTestInterface |
python | geekcomputers__Python | venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py | {
"start": 662,
"end": 926
} | class ____(Exception):
"""Will be raised if the backend is invalid."""
def __init__(self, backend_name, backend_path, message):
super().__init__(message)
self.backend_name = backend_name
self.backend_path = backend_path
| BackendInvalid |
python | django__django | tests/admin_views/models.py | {
"start": 11548,
"end": 11684
} | class ____(Doodad):
owner = models.ForeignKey(Collector, models.CASCADE)
expensive = models.BooleanField(default=True)
| FancyDoodad |
python | geekcomputers__Python | venv/Lib/site-packages/pip/_vendor/rich/segment.py | {
"start": 1206,
"end": 21383
} | class ____(NamedTuple):
"""A piece of text with associated style. Segments are produced by the Console render process and
are ultimately converted in to strings to be written to the terminal.
Args:
text (str): A piece of text.
style (:class:`~rich.style.Style`, optional): An optional style ... | Segment |
python | Lightning-AI__lightning | tests/tests_pytorch/accelerators/test_xla.py | {
"start": 4046,
"end": 7646
} | class ____(BoringModel):
count = 0
called = collections.defaultdict(int)
def __init__(self):
super().__init__()
self.automatic_optimization = False
@property
def should_update(self):
return self.count % 2 == 0
def on_train_batch_start(self, batch, batch_idx):
s... | ManualOptimizationModel |
python | django__django | django/db/models/lookups.py | {
"start": 26996,
"end": 27114
} | class ____(YearLookup, LessThanOrEqual):
def get_bound_params(self, start, finish):
return (finish,)
| YearLte |
python | tornadoweb__tornado | tornado/test/web_test.py | {
"start": 1447,
"end": 1931
} | class ____(AsyncHTTPTestCase):
"""Base class for web tests that also supports WSGI mode.
Override get_handlers and get_app_kwargs instead of get_app.
This class is deprecated since WSGI mode is no longer supported.
"""
def get_app(self):
self.app = Application(self.get_handlers(), **self.g... | WebTestCase |
python | python__mypy | mypyc/ir/ops.py | {
"start": 14715,
"end": 15572
} | class ____(ControlOp):
"""Return a value from a function."""
error_kind = ERR_NEVER
def __init__(
self, value: Value, line: int = -1, *, yield_target: BasicBlock | None = None
) -> None:
super().__init__(line)
self.value = value
# If this return is created by a yield, k... | Return |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/pool/impl.py | {
"start": 16895,
"end": 19107
} | class ____(Pool):
"""A :class:`_pool.Pool` that allows at most one checked out connection at
any given time.
This will raise an exception if more than one connection is checked out
at a time. Useful for debugging code that is using more connections
than desired.
The :class:`.AssertionPool` cl... | AssertionPool |
python | google__jax | jax/experimental/pallas/ops/tpu/flash_attention.py | {
"start": 1517,
"end": 49855
} | class ____:
"""Tile sizes parameterizing FlashAttention kernels.
Those parameters have negligible effect on numerics, but affect performance
greatly.
"""
block_q: int
block_k_major: int
block_k: int
block_b: int
block_q_major_dkv: int | None = None
block_k_major_dkv: int | None = None
block_k_dk... | BlockSizes |
python | getsentry__sentry | src/sentry/api/bases/team.py | {
"start": 1442,
"end": 2504
} | class ____(Endpoint):
permission_classes: tuple[type[BasePermission], ...] = (TeamPermission,)
def convert_args(
self,
request: Request,
organization_id_or_slug: str | int,
team_id_or_slug: str | int,
*args: Any,
**kwargs: Any,
) -> tuple[tuple[Any, ...], dic... | TeamEndpoint |
python | getsentry__sentry | src/sentry/templatetags/sentry_assets.py | {
"start": 2008,
"end": 3431
} | class ____(template.Node):
def __init__(self, nodelist, **kwargs):
self.nodelist = nodelist
self.attrs = kwargs
def _get_value(self, token, context):
if isinstance(token, str):
return token
if isinstance(token, template.base.FilterExpression):
return toke... | ScriptNode |
python | walkccc__LeetCode | solutions/399. Evaluate Division/399.py | {
"start": 0,
"end": 929
} | class ____:
def calcEquation(
self,
equations: list[list[str]],
values: list[float],
queries: list[list[str]],
) -> list[float]:
ans = []
# graph[A][B] := A / B
graph = collections.defaultdict(dict)
for (A, B), value in zip(equations, values):
graph[A][B] = value
... | Solution |
python | python__mypy | mypy/checkexpr.py | {
"start": 288281,
"end": 292003
} | class ____(types.BoolTypeQuery):
def __init__(self, ignore_in_type_obj: bool) -> None:
super().__init__(types.ANY_STRATEGY)
self.ignore_in_type_obj = ignore_in_type_obj
def visit_any(self, t: AnyType) -> bool:
return t.type_of_any != TypeOfAny.special_form # special forms are not real ... | HasAnyType |
python | tensorflow__tensorflow | tensorflow/python/ops/numpy_ops/np_random_test.py | {
"start": 3069,
"end": 3889
} | class ____(RandomTestBase):
def setUp(self):
self.np_func = np_random.uniform
self.onp_func = onp.random.uniform
super(UniformTest, self).setUp()
@parameterized.parameters(
((), (), None),
(1, (), None),
((), 1, None),
(1, 1, None),
((1, 2), (2, 1), None),
((1, 2, 1... | UniformTest |
python | getsentry__sentry-python | tests/integrations/django/myapp/settings.py | {
"start": 1401,
"end": 5053
} | class ____(MiddlewareMixin):
def process_request(self, request):
# https://github.com/getsentry/sentry-python/issues/837 -- We should
# not touch the resolver_match because apparently people rely on it.
if request.resolver_match:
assert not getattr(request.resolver_match.callback... | TestMiddleware |
python | pytorch__pytorch | torch/_inductor/ir.py | {
"start": 80146,
"end": 87392
} | class ____(Loops):
scan_ranges: list[Integer]
size: list[Integer]
combine_fn: Callable[[tuple[Any, ...], tuple[Any, ...]], tuple[Any, ...]]
reindex: Callable[[Sequence[_IntLike], Sequence[_IntLike]], Sequence[_IntLike]]
reduction_hint: ReductionHint
output_index: int
# output_index indexes t... | Scan |
python | kamyu104__LeetCode-Solutions | Python/minimum-consecutive-cards-to-pick-up.py | {
"start": 42,
"end": 431
} | class ____(object):
def minimumCardPickup(self, cards):
"""
:type cards: List[int]
:rtype: int
"""
lookup = {}
result = float("inf")
for i, x in enumerate(cards):
if x in lookup:
result = min(result, i-lookup[x]+1)
looku... | Solution |
python | lepture__authlib | authlib/oidc/core/claims.py | {
"start": 7699,
"end": 9060
} | class ____(ImplicitIDToken):
RESPONSE_TYPES = ("code id_token", "code token", "code id_token token")
REGISTERED_CLAIMS = _REGISTERED_CLAIMS + ["c_hash"]
def validate(self, now=None, leeway=0):
super().validate(now=now, leeway=leeway)
self.validate_c_hash()
def validate_c_hash(self):
... | HybridIDToken |
python | PrefectHQ__prefect | src/prefect/server/schemas/filters.py | {
"start": 7366,
"end": 8084
} | class ____(PrefectFilterBaseModel):
"""Filter by `FlowRun.id`."""
any_: Optional[list[UUID]] = Field(
default=None, description="A list of flow run ids to include"
)
not_any_: Optional[list[UUID]] = Field(
default=None, description="A list of flow run ids to exclude"
)
def _get... | FlowRunFilterId |
python | django__django | tests/staticfiles_tests/test_forms.py | {
"start": 697,
"end": 1629
} | class ____(SimpleTestCase):
def test_absolute_url(self):
m = Media(
css={"all": ("path/to/css1", "/path/to/css2")},
js=(
"/path/to/js1",
"http://media.other.com/path/to/js2",
"https://secure.other.com/path/to/js3",
stati... | StaticFilesFormsMediaTestCase |
python | pandas-dev__pandas | pandas/tests/tslibs/test_npy_units.py | {
"start": 244,
"end": 922
} | class ____:
def test_is_date_array_normalized_day(self):
arr = day_arr
abbrev = "D"
unit = abbrev_to_npy_unit(abbrev)
result = is_date_array_normalized(arr.view("i8"), None, unit)
assert result is True
def test_is_date_array_normalized_seconds(self):
abbrev = "s"... | TestIsDateArrayNormalized |
python | openai__openai-python | src/openai/types/beta/realtime/session_create_response.py | {
"start": 797,
"end": 919
} | class ____(BaseModel):
model: Optional[str] = None
"""The model to use for transcription."""
| InputAudioTranscription |
python | readthedocs__readthedocs.org | readthedocs/organizations/migrations/0003_team_auto_join_email_users.py | {
"start": 149,
"end": 621
} | class ____(migrations.Migration):
safe = Safe.after_deploy()
dependencies = [
("organizations", "0002_update_meta_options"),
]
operations = [
migrations.AddField(
model_name="team",
name="auto_join_email_users",
field=models.BooleanField(
... | Migration |
python | eventlet__eventlet | eventlet/db_pool.py | {
"start": 9557,
"end": 10243
} | class ____(BaseConnectionPool):
"""A pool which gives out :class:`~eventlet.tpool.Proxy`-based database
connections.
"""
def create(self):
now = time.time()
return now, now, self.connect(
self._db_module, self.connect_timeout, *self._args, **self._kwargs)
@classmethod
... | TpooledConnectionPool |
python | tensorflow__tensorflow | tensorflow/python/eager/summary_optimizer_test.py | {
"start": 1461,
"end": 8072
} | class ____(test.TestCase):
def setUp(self):
super().setUp()
self.summary_dir = os.path.join(FLAGS.test_tmpdir, 'mylogs')
# Clean up any summary directories before starting the test so we can
# validate that summaries are only written when enabled.
try:
gfile.DeleteRecursively(self.summary_... | SummaryOpsTransformationTest |
python | celery__celery | t/unit/utils/test_saferepr.py | {
"start": 1927,
"end": 2005
} | class ____(set):
def __repr__(self):
return super().__repr__()
| set3 |
python | bokeh__bokeh | tests/unit/bokeh/document/test_events__document.py | {
"start": 4055,
"end": 5170
} | class ____:
def test_init(self) -> None:
doc = Document()
e = bde.DocumentPatchedEvent(doc, "setter", "invoker")
assert e.document == doc
assert e.setter == "setter"
assert e.callback_invoker == "invoker"
def test_to_serializable(self) -> None:
doc = Document()
... | TestDocumentPatchedEvent |
python | celery__celery | celery/utils/collections.py | {
"start": 20871,
"end": 22623
} | class ____(Evictable):
"""A buffer of pending messages."""
Empty = Empty
def __init__(self, maxsize, iterable=None, deque=deque):
# type: (int, Iterable, Any) -> None
self.maxsize = maxsize
self.data = deque(iterable or [])
self._append = self.data.append
self._pop ... | Messagebuffer |
python | getsentry__sentry | src/sentry/workflow_engine/endpoints/serializers/action_handler_serializer.py | {
"start": 757,
"end": 3238
} | class ____(Serializer):
def transform_title(self, title: str) -> str:
if title in PLUGINS_WITH_FIRST_PARTY_EQUIVALENTS:
return f"(Legacy) {title}"
return title
def serialize(
self,
obj: ActionHandler,
attrs: Mapping[str, Any],
user: Any,
**kwa... | ActionHandlerSerializer |
python | PrefectHQ__prefect | src/prefect/client/schemas/filters.py | {
"start": 15408,
"end": 15697
} | class ____(PrefectBaseModel):
"""Filter by `Deployment.work_queue_name`."""
any_: Optional[List[str]] = Field(
default=None,
description="A list of work queue names to include",
examples=[["work_queue_1", "work_queue_2"]],
)
| DeploymentFilterWorkQueueName |
python | openai__openai-python | tests/api_resources/test_images.py | {
"start": 376,
"end": 9806
} | class ____:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
@parametrize
def test_method_create_variation(self, client: OpenAI) -> None:
image = client.images.create_variation(
image=b"raw file contents",
)
assert_ma... | TestImages |
python | falconry__falcon | tests/test_media_urlencoded.py | {
"start": 1050,
"end": 1142
} | class ____:
def on_post(self, req, resp):
resp.media = req.get_media()
| MediaMirror |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 296700,
"end": 298224
} | class ____(sgqlc.types.Input):
"""Autogenerated input type of SetEnterpriseIdentityProvider"""
__schema__ = github_schema
__field_names__ = ("enterprise_id", "sso_url", "issuer", "idp_certificate", "signature_method", "digest_method", "client_mutation_id")
enterprise_id = sgqlc.types.Field(sgqlc.types.... | SetEnterpriseIdentityProviderInput |
python | jazzband__django-waffle | waffle/management/commands/waffle_flag.py | {
"start": 345,
"end": 7249
} | class ____(BaseCommand):
def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument(
'name',
nargs='?',
help='The name of the flag.')
parser.add_argument(
'-l', '--list',
action='store_true',
dest='list_flags',
... | Command |
python | dagster-io__dagster | python_modules/automation/python_modules/automation/automation_tests/dagster_dev_tests/ai_review_tests/python_modules/automation/automation_tests/dagster_dev_tests/ai_review_tests/test_smoke.py | {
"start": 98,
"end": 2784
} | class ____:
"""Basic smoke tests for all ai-review commands."""
def test_cache_import(self):
"""Test ai-review-cache import."""
from automation.dagster_dev.commands.ai_review_cache import ai_review_cache
assert ai_review_cache is not None
assert ai_review_cache.name == "ai-revi... | TestAiReviewSmoke |
python | vyperlang__vyper | vyper/venom/memory_location.py | {
"start": 4754,
"end": 20258
} | class ____(MemoryLocation):
"""Represents a memory location that can be analyzed for aliasing"""
offset: Optional[int] = None
size: Optional[int] = None
_is_volatile: bool = False
# Locations that should be considered volatile. Example usages of this would
# be locations that are accessed outsi... | MemoryLocationSegment |
python | sympy__sympy | sympy/polys/numberfields/galois_resolvents.py | {
"start": 1661,
"end": 25006
} | class ____:
r"""
If $G$ is a subgroup of the symmetric group $S_n$,
$F$ a multivariate polynomial in $\mathbb{Z}[X_1, \ldots, X_n]$,
$H$ the stabilizer of $F$ in $G$ (i.e. the permutations $\sigma$ such that
$F(X_{\sigma(1)}, \ldots, X_{\sigma(n)}) = F(X_1, \ldots, X_n)$), and $s$
a set of left ... | Resolvent |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-dashscope/llama_index/readers/dashscope/domain/base_domains.py | {
"start": 22,
"end": 113
} | class ____(ABC):
@classmethod
def from_dict(cls, data: dict):
pass
| DictToObject |
python | wandb__wandb | wandb/vendor/pygments/lexers/lisp.py | {
"start": 84464,
"end": 122449
} | class ____(RegexLexer):
"""
An ELisp lexer, parsing a stream and outputting the tokens
needed to highlight elisp code.
.. versionadded:: 2.1
"""
name = 'EmacsLisp'
aliases = ['emacs', 'elisp', 'emacs-lisp']
filenames = ['*.el']
mimetypes = ['text/x-elisp', 'application/x-elisp']
... | EmacsLispLexer |
python | sphinx-doc__sphinx | sphinx/addnodes.py | {
"start": 16689,
"end": 16884
} | class ____(nodes.emphasis, not_smartquotable):
"""Node that behaves like `emphasis`, but further text processors are not
applied (e.g. smartypants for HTML output).
"""
| literal_emphasis |
python | pypa__pip | src/pip/_vendor/rich/prompt.py | {
"start": 9687,
"end": 9854
} | class ____(PromptBase[str]):
"""A prompt that returns a str.
Example:
>>> name = Prompt.ask("Enter your name")
"""
response_type = str
| Prompt |
python | sympy__sympy | sympy/integrals/manualintegrate.py | {
"start": 12660,
"end": 13238
} | class ____(Rule):
harg: Expr
ibnd: Expr
substep: Rule
def eval(self) -> Expr:
# If we are integrating over x and the integrand has the form
# Heaviside(m*x+b)*g(x) == Heaviside(harg)*g(symbol)
# then there needs to be continuity at -b/m == ibnd,
# so we subtract th... | HeavisideRule |
python | altair-viz__altair | altair/vegalite/v6/schema/_config.py | {
"start": 262232,
"end": 282805
} | class ____(TypedDict, total=False):
"""
:class:`altair.TickConfig` ``TypedDict`` wrapper.
Parameters
----------
align
The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule).
One of ``"left"``, ``"right"``, ``"center"``.
**Note:** Expression refe... | TickConfigKwds |
python | huggingface__transformers | src/transformers/models/speecht5/configuration_speecht5.py | {
"start": 864,
"end": 19002
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`SpeechT5Model`]. It is used to instantiate a
SpeechT5 model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar con... | SpeechT5Config |
python | gevent__gevent | src/gevent/tests/test__local.py | {
"start": 1601,
"end": 1804
} | class ____(local, Mapping):
def __getitem__(self, name):
return self.d[name]
def __iter__(self):
return iter(self.d)
def __len__(self):
return len(self.d)
| LocalWithABC |
python | prabhupant__python-ds | data_structures/linked_list/odd_even_arrangement.py | {
"start": 77,
"end": 462
} | class ____():
def __init__(self, val):
self.val = val
self.next = None
def arrange(head):
if not head:
return None
odd = head
even = head.next
even_head = even
while even and even.next:
odd.next = even.next
odd = odd.next
even.next = odd.next
... | Node |
python | getsentry__sentry | tests/sentry/rules/processing/test_delayed_processing.py | {
"start": 62073,
"end": 64766
} | class ____(CreateEventTestCase):
def setUp(self) -> None:
super().setUp()
self.project = self.create_project()
self.group = self.create_group(self.project)
self.rule = self.create_alert_rule()
self.log_config = LogConfig(num_events_issue_debugging=True)
def test_cleanup... | CleanupRedisBufferTest |
python | kamyu104__LeetCode-Solutions | Python/minimum-window-subsequence.py | {
"start": 33,
"end": 936
} | class ____(object):
def minWindow(self, S, T):
"""
:type S: str
:type T: str
:rtype: str
"""
lookup = [[None for _ in xrange(26)] for _ in xrange(len(S)+1)]
find_char_next_pos = [None]*26
for i in reversed(xrange(len(S))):
find_char_next_po... | Solution |
python | PyCQA__pylint | tests/functional/r/regression/regression_property_no_member_3269.py | {
"start": 204,
"end": 441
} | class ____:
"""A child class"""
@property
def test(self):
"""Overriding implementation of prop which calls the parent"""
return A.test.fget(self) + " overridden"
if __name__ == "__main__":
print(B().test)
| B |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.