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 | imageio__imageio | imageio/core/request.py | {
"start": 24297,
"end": 26767
} | class ____:
"""A readonly wrapper file object that add support for seeking, even if
the wrapped file object does not. The allows us to stream from http and
still use Pillow.
"""
def __init__(self, f):
self.f = f
self._i = 0 # >=0 but can exceed buffer
self._buffer = b""
... | SeekableFileObject |
python | tensorflow__tensorflow | tensorflow/python/ops/parallel_for/control_flow_ops_test.py | {
"start": 3715,
"end": 8451
} | class ____(PForTestCase):
def test_op_conversion_fallback_to_while_loop(self):
# Note that we used top_k op for this test. If a converter gets defined for
# it, we will need to find another op for which a converter has not been
# defined.
x = random_ops.random_uniform([3, 2, 4])
def loop_fn(i):
... | PForTest |
python | buildout__buildout | src/zc/buildout/buildout.py | {
"start": 2383,
"end": 4994
} | class ____(object):
def __init__(self, value, source):
self.history = []
self.value = value
self.addToHistory("SET", value, source)
@property
def source(self):
return self.history[-1].source
def overrideValue(self, sectionkey):
self.value = sectionkey.value
... | SectionKey |
python | getsentry__sentry | tests/sentry/users/api/endpoints/test_user_identity_config.py | {
"start": 11875,
"end": 16220
} | class ____(UserIdentityConfigTest):
endpoint = "sentry-api-0-user-identity-config-details"
method = "delete"
def test_delete(self) -> None:
self.org_provider.flags.allow_unlinked = True
self.org_provider.save()
social_obj, global_obj, org_obj = self._setup_identities()
sel... | UserIdentityConfigDetailsEndpointDeleteTest |
python | django__django | django/db/models/sql/query.py | {
"start": 7712,
"end": 116447
} | class ____(BaseExpression):
"""A single SQL query."""
alias_prefix = "T"
empty_result_set_value = None
subq_aliases = frozenset([alias_prefix])
compiler = "SQLCompiler"
base_table_class = BaseTable
join_class = Join
default_cols = True
default_ordering = True
standard_orderin... | Query |
python | pytorch__pytorch | torch/optim/lr_scheduler.py | {
"start": 12469,
"end": 12703
} | class ____:
def __init__(self, o: LRScheduler) -> None:
self.o = o
def __enter__(self):
self.o._is_initial = True
def __exit__(self, type, value, traceback):
self.o._is_initial = False
| _initial_mode |
python | PyCQA__pylint | tests/functional/i/inherit_non_class.py | {
"start": 1270,
"end": 1322
} | class ____(Good5 if True else Bad1):
pass
| Unknown1 |
python | has2k1__plotnine | plotnine/scales/scale_color.py | {
"start": 14362,
"end": 14456
} | class ____(scale_fill_cmap_d):
pass
# American to British spelling
@alias
| scale_fill_ordinal |
python | allegroai__clearml | clearml/backend_api/services/v2_13/tasks.py | {
"start": 285850,
"end": 306499
} | class ____(Response):
"""
Response of tasks.get_by_id endpoint.
:param task: Task info
:type task: Task
"""
_service = "tasks"
_action = "get_by_id"
_version = "2.13"
_schema = {
"definitions": {
"artifact": {
"properties": {
... | GetByIdResponse |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 230454,
"end": 231008
} | class ____(sgqlc.types.Input):
"""Ordering options for enterprise administrator invitation
connections
"""
__schema__ = github_schema
__field_names__ = ("field", "direction")
field = sgqlc.types.Field(sgqlc.types.non_null(EnterpriseAdministratorInvitationOrderField), graphql_name="field")
"... | EnterpriseAdministratorInvitationOrder |
python | pennersr__django-allauth | allauth/socialaccount/providers/odnoklassniki/provider.py | {
"start": 857,
"end": 1359
} | class ____(OAuth2Provider):
id = "odnoklassniki"
name = "Odnoklassniki"
account_class = OdnoklassnikiAccount
oauth2_adapter_class = OdnoklassnikiOAuth2Adapter
def extract_uid(self, data):
return data["uid"]
def extract_common_fields(self, data):
return dict(
last_na... | OdnoklassnikiProvider |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/stackdriver.py | {
"start": 1535,
"end": 6600
} | class ____(GoogleCloudBaseOperator):
"""
Fetches all the Alert Policies identified by the filter passed as filter parameter.
The desired return type can be specified by the format parameter, the supported
formats are "dict", "json" and None which returns python dictionary, stringified
JSON and prot... | StackdriverListAlertPoliciesOperator |
python | joke2k__faker | tests/providers/test_currency.py | {
"start": 60,
"end": 3152
} | class ____:
"""Test currency provider methods"""
num_samples = 100
@classmethod
def setup_class(cls):
from faker.providers.currency import Provider as CurrencyProvider
cls.provider = CurrencyProvider
cls.currencies = cls.provider.currencies
cls.cryptocurrencies = cls.p... | TestCurrencyProvider |
python | django__django | tests/admin_filters/tests.py | {
"start": 2169,
"end": 2262
} | class ____(DecadeListFilter):
title = "publication decade"
| DecadeListFilterWithoutParameter |
python | apache__airflow | airflow-ctl/src/airflowctl/api/client.py | {
"start": 6639,
"end": 11920
} | class ____(httpx.Client):
"""Client for the Airflow REST API."""
def __init__(
self,
*,
base_url: str,
token: str,
kind: Literal[ClientKind.CLI, ClientKind.AUTH] = ClientKind.CLI,
**kwargs: Any,
) -> None:
auth = BearerAuth(token)
kwargs["base... | Client |
python | getsentry__sentry | src/sentry/snuba/metrics/extraction.py | {
"start": 2042,
"end": 2120
} | class ____(NamedTuple):
version: int
flags: set[str] = set()
| SpecVersion |
python | huggingface__transformers | src/transformers/models/oneformer/modeling_oneformer.py | {
"start": 119520,
"end": 124197
} | class ____(PreTrainedModel):
config: OneFormerConfig
base_model_prefix = "model"
main_input_name = "pixel_values"
input_modalities = ("image",)
@torch.no_grad()
def _init_weights(self, module: nn.Module):
xavier_std = self.config.init_xavier_std
std = self.config.init_std
... | OneFormerPreTrainedModel |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/orm/interfaces.py | {
"start": 6804,
"end": 12442
} | class ____(NamedTuple):
"""define Python-local attribute behavior options common to all
:class:`.MapperProperty` objects.
Currently this includes dataclass-generation arguments.
.. versionadded:: 2.0
"""
dataclasses_init: Union[_NoArg, bool]
dataclasses_repr: Union[_NoArg, bool]
data... | _AttributeOptions |
python | networkx__networkx | networkx/readwrite/gml.py | {
"start": 8910,
"end": 9127
} | class ____(Enum):
"""encodes the index of each token-matching pattern in `tokenize`."""
KEYS = 0
REALS = 1
INTS = 2
STRINGS = 3
DICT_START = 4
DICT_END = 5
COMMENT_WHITESPACE = 6
| Pattern |
python | joke2k__faker | faker/providers/internet/en_AU/__init__.py | {
"start": 46,
"end": 411
} | class ____(InternetProvider):
free_email_domains = (
"gmail.com",
"yahoo.com",
"hotmail.com",
"yahoo.com.au",
"hotmail.com.au",
)
tlds = (
"com",
"com.au",
"org",
"org.au",
"net",
"net.au",
"biz",
"info"... | Provider |
python | scipy__scipy | scipy/stats/_multivariate.py | {
"start": 105822,
"end": 108256
} | class ____(multi_rv_frozen):
"""Create a frozen Wishart distribution.
Parameters
----------
df : array_like
Degrees of freedom of the distribution
scale : array_like
Scale matrix of the distribution
seed : {None, int, `numpy.random.Generator`, `numpy.random.RandomState`}, option... | wishart_frozen |
python | tensorflow__tensorflow | tensorflow/python/module/module_test.py | {
"start": 7080,
"end": 7402
} | class ____(test_util.TensorFlowTestCase):
def test_variable_names(self):
mod = RecursiveModule(3)
self.assertEqual(mod.w.name, "badger/mushroom:0")
self.assertEqual(mod.child.w.name, "badger/badger/mushroom:0")
self.assertEqual(mod.child.child.w.name, "badger/badger/badger/mushroom:0")
| VariableNamingTest |
python | dagster-io__dagster | examples/docs_snippets/docs_snippets/concepts/partitions_schedules_sensors/sensors/sensors.py | {
"start": 132,
"end": 5832
} | class ____(Config):
filename: str
@op
def process_file(context: OpExecutionContext, config: FileConfig):
context.log.info(config.filename)
@job
def log_file_job():
process_file()
# end_sensor_job_marker
MY_DIRECTORY = "./"
# start_directory_sensor_marker
import os
from dagster import sensor, RunRequ... | FileConfig |
python | pytorch__pytorch | torch/distributed/fsdp/api.py | {
"start": 14266,
"end": 16298
} | class ____(StateDictConfig):
"""
``FullStateDictConfig`` is a config class meant to be used with
``StateDictType.FULL_STATE_DICT``. We recommend enabling both
``offload_to_cpu=True`` and ``rank0_only=True`` when saving full state
dicts to save GPU memory and CPU memory, respectively. This config cla... | FullStateDictConfig |
python | PrefectHQ__prefect | tests/test_flows.py | {
"start": 8434,
"end": 9745
} | class ____:
@pytest.mark.parametrize("persist_result", [True, False])
def test_persist_result_set_to_bool(self, persist_result: bool):
@flow(persist_result=persist_result)
def my_flow():
pass
@flow
def base():
pass
new_flow = base.with_options(pe... | TestResultPersistence |
python | PrefectHQ__prefect | src/prefect/events/schemas/automations.py | {
"start": 2783,
"end": 3376
} | class ____(Trigger, abc.ABC):
"""
Base class for triggers that may filter by the labels of resources.
"""
type: str
match: ResourceSpecification = Field(
default_factory=lambda: ResourceSpecification.model_validate({}),
description="Labels for resources which this trigger will matc... | ResourceTrigger |
python | joblib__joblib | joblib/test/test_hashing.py | {
"start": 1336,
"end": 15820
} | class ____(object):
def __init__(self, cachedir):
mem = Memory(location=cachedir)
self.f = mem.cache(self.f)
def f(self, x):
return x
###############################################################################
# Tests
input_list = [
1,
2,
1.0,
2.0,
1 + 1j,
... | KlassWithCachedMethod |
python | getsentry__sentry | src/sentry/workflow_engine/migrations/0092_repair_workflow_cron_conditions.py | {
"start": 2708,
"end": 4196
} | class ____(CheckedMigration):
# This flag is used to mark that a migration shouldn't be automatically run in production.
# This should only be used for operations where it's safe to run the migration after your
# code has deployed. So this should not be used for most operations that alter the schema
# o... | Migration |
python | sqlalchemy__sqlalchemy | test/orm/test_recursive_loaders.py | {
"start": 4845,
"end": 10320
} | class ____(_NodeTest, fixtures.MappedTest):
@classmethod
def insert_data(cls, connection):
nodes = cls.tables.nodes
connection.execute(
nodes.insert(),
[
{"id": i, "parent_id": i - 1 if i > 1 else None}
for i in range(1, 201)
],... | DeepRecursiveTest |
python | google__pytype | pytype/tests/test_attr2.py | {
"start": 20671,
"end": 27838
} | class ____(test_base.BaseTest):
"""Tests for attrs next generation API, added in attrs version 21.1.0.
See: https://www.attrs.org/en/stable/api.html#next-gen
"""
def test_define_auto_detects_auto_attrs_true(self):
"""Test whether @attr.define can detect auto_attrs will default to True.
This is determ... | TestAttrsNextGenApi |
python | google__jax | jax/_src/pallas/mosaic_gpu/core.py | {
"start": 21632,
"end": 22411
} | class ____(pallas_core.MemoryRefTransform, abc.ABC):
@abc.abstractmethod
def to_gpu_transform(self) -> mgpu.MemRefTransform:
pass
@abc.abstractmethod
def to_gpu_transform_attr(self) -> ir.Attribute:
pass
def batch(self, leading_rank: int):
"""Returns a transform that accepts a ref with the extra... | MemoryRefTransform |
python | dask__dask | dask/array/_array_expr/_creation.py | {
"start": 4376,
"end": 4444
} | class ____(BroadcastTrick):
func = staticmethod(np.ones_like)
| Ones |
python | pytest-dev__pytest | src/_pytest/config/argparsing.py | {
"start": 467,
"end": 9810
} | class ____:
"""Parser for command line arguments and config-file values.
:ivar extra_info: Dict of generic param -> value to display in case
there's an error processing the command line arguments.
"""
def __init__(
self,
usage: str | None = None,
processopt: Callable[[A... | Parser |
python | ray-project__ray | rllib/env/wrappers/atari_wrappers.py | {
"start": 3271,
"end": 4019
} | class ____(gym.Wrapper):
def __init__(self, env):
"""Take action on reset.
For environments that are fixed until firing."""
gym.Wrapper.__init__(self, env)
assert env.unwrapped.get_action_meanings()[1] == "FIRE"
assert len(env.unwrapped.get_action_meanings()) >= 3
def r... | FireResetEnv |
python | scipy__scipy | scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py | {
"start": 462,
"end": 1031
} | class ____(TestCase):
# From Example 16.2 Nocedal/Wright "Numerical
# Optimization" p.452.
def test_nocedal_example(self):
H = csc_array([[6, 2, 1],
[2, 5, 2],
[1, 2, 4]])
A = csc_array([[1, 0, 1],
[0, 1, 1]])
c = ... | TestEQPDirectFactorization |
python | oauthlib__oauthlib | oauthlib/oauth2/rfc6749/errors.py | {
"start": 10203,
"end": 10486
} | class ____(OAuth2Error):
"""
The authorization server does not support the hint of the
presented token type. I.e. the client tried to revoke an access token
on a server not supporting this feature.
"""
error = 'unsupported_token_type'
| UnsupportedTokenTypeError |
python | django__django | django/contrib/gis/db/models/lookups.py | {
"start": 6914,
"end": 7008
} | class ____(GISLookup):
lookup_name = "covers"
@BaseSpatialField.register_lookup
| CoversLookup |
python | faif__python-patterns | patterns/creational/factory.py | {
"start": 1397,
"end": 2181
} | class ____:
"""Simply echoes the message"""
def localize(self, msg: str) -> str:
return msg
def get_localizer(language: str = "English") -> Localizer:
"""Factory"""
localizers: Dict[str, Type[Localizer]] = {
"English": EnglishLocalizer,
"Greek": GreekLocalizer,
}
... | EnglishLocalizer |
python | chardet__chardet | chardet/cp949prober.py | {
"start": 1295,
"end": 1794
} | class ____(MultiByteCharSetProber):
def __init__(self) -> None:
super().__init__()
self.coding_sm = CodingStateMachine(CP949_SM_MODEL)
# NOTE: CP949 is a superset of EUC-KR, so the distribution should be
# not different.
self.distribution_analyzer = EUCKRDistributionAna... | CP949Prober |
python | plotly__plotly.py | plotly/graph_objs/indicator/gauge/_bar.py | {
"start": 233,
"end": 4030
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "indicator.gauge"
_path_str = "indicator.gauge.bar"
_valid_props = {"color", "line", "thickness"}
@property
def color(self):
"""
Sets the background color of the arc.
The 'color' property is a color and may be specifie... | Bar |
python | jazzband__django-oauth-toolkit | oauth2_provider/models.py | {
"start": 11201,
"end": 11438
} | class ____(AbstractApplication):
objects = ApplicationManager()
class Meta(AbstractApplication.Meta):
swappable = "OAUTH2_PROVIDER_APPLICATION_MODEL"
def natural_key(self):
return (self.client_id,)
| Application |
python | Lightning-AI__lightning | src/lightning/fabric/utilities/data.py | {
"start": 21615,
"end": 23181
} | class ____(dict):
"""A container to store state variables of your program.
This is a drop-in replacement for a Python dictionary, with the additional functionality to access and modify keys
through attribute lookup for convenience.
Use this to define the state of your program, then pass it to
:met... | AttributeDict |
python | neetcode-gh__leetcode | python/0104-maximum-depth-of-binary-tree.py | {
"start": 16,
"end": 216
} | class ____:
def maxDepth(self, root: TreeNode) -> int:
if not root:
return 0
return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right))
# ITERATIVE DFS
| Solution |
python | pytorch__pytorch | torch/utils/_sympy/functions.py | {
"start": 19305,
"end": 19904
} | class ____(sympy.Function):
is_integer = True
@classmethod
def eval(cls, number):
# assert number.is_integer is not True, number
if number in (sympy.oo, int_oo):
return int_oo
if number in (-sympy.oo, -int_oo):
return -int_oo
if isinstance(number, sym... | CeilToInt |
python | sphinx-doc__sphinx | sphinx/domains/c/_ast.py | {
"start": 53100,
"end": 54267
} | class ____(ASTBase):
def __init__(self, type: ASTType, init: ASTInitializer) -> None:
self.type = type
self.init = init
def __eq__(self, other: object) -> bool:
if not isinstance(other, ASTTypeWithInit):
return NotImplemented
return self.type == other.type and self.i... | ASTTypeWithInit |
python | huggingface__transformers | src/transformers/models/dinov2_with_registers/modular_dinov2_with_registers.py | {
"start": 1368,
"end": 8302
} | class ____(BackboneConfigMixin, PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`Dinov2WithRegistersModel`]. It is used to instantiate an
Dinov2WithRegisters model according to the specified arguments, defining the model architecture. Instantiating a configuration
... | Dinov2WithRegistersConfig |
python | airbytehq__airbyte | airbyte-ci/connectors/connectors_qa/src/connectors_qa/checks/documentation/documentation.py | {
"start": 23710,
"end": 23838
} | class ____(CheckSection):
header = "For Airbyte Open Source:"
expected_section_index = 1
| CheckForAirbyteOpenSectionContent |
python | apache__airflow | providers/standard/tests/unit/standard/operators/test_trigger_dagrun.py | {
"start": 22454,
"end": 54961
} | class ____:
"""Test TriggerDagRunOperator for Airflow 2."""
def setup_method(self):
# Airflow relies on reading the DAG from disk when triggering it.
# Therefore write a temp file holding the DAG to trigger.
with tempfile.NamedTemporaryFile(mode="w", delete=False) as f:
self... | TestDagRunOperatorAF2 |
python | ray-project__ray | release/tune_tests/cloud_tests/workloads/long_running_cloud_storage.py | {
"start": 218,
"end": 2995
} | class ____(Callback):
def __init__(self):
self.last_update = 0
self.update_interval = 60
def on_step_end(self, iteration, trials, **kwargs):
if time.time() - self.last_update > self.update_interval:
now = time.time()
result = {
"last_update": now,... | ProgressCallback |
python | doocs__leetcode | solution/0600-0699/0653.Two Sum IV - Input is a BST/Solution.py | {
"start": 192,
"end": 550
} | class ____:
def findTarget(self, root: Optional[TreeNode], k: int) -> bool:
def dfs(root):
if root is None:
return False
if k - root.val in vis:
return True
vis.add(root.val)
return dfs(root.left) or dfs(root.right)
vis... | Solution |
python | getsentry__sentry | tests/sentry/issue_detection/test_http_overhead_detector.py | {
"start": 2027,
"end": 9798
} | class ____(TestCase):
def setUp(self) -> None:
super().setUp()
self._settings = get_detection_settings()
def find_problems(self, event: dict[str, Any]) -> list[PerformanceProblem]:
return find_problems(self._settings, event)
def test_detects_http_overhead(self) -> None:
eve... | HTTPOverheadDetectorTest |
python | django__django | tests/expressions_window/tests.py | {
"start": 80527,
"end": 83458
} | class ____(SimpleTestCase):
def test_window_repr(self):
self.assertEqual(
repr(Window(expression=Sum("salary"), partition_by="department")),
"<Window: Sum(F(salary)) OVER (PARTITION BY F(department))>",
)
self.assertEqual(
repr(Window(expression=Avg("salar... | NonQueryWindowTests |
python | pytorch__pytorch | test/distributed/test_c10d_ucc.py | {
"start": 11405,
"end": 35071
} | class ____(
test_c10d_common.CommonDistributedDataParallelTest, MultiProcessTestCase
):
def setUp(self):
super().setUp()
self._spawn_processes()
def _get_process_group(self):
store = self._get_store()
c10d.init_process_group(
"ucc", store=store, rank=self.rank, w... | DistributedDataParallelTest |
python | sympy__sympy | sympy/assumptions/predicates/matrices.py | {
"start": 7556,
"end": 8296
} | class ____(Predicate):
"""
Diagonal matrix predicate.
Explanation
===========
``Q.diagonal(x)`` is true iff ``x`` is a diagonal matrix. A diagonal
matrix is a matrix in which the entries outside the main diagonal
are all zero.
Examples
========
>>> from sympy import Q, ask, M... | DiagonalPredicate |
python | kamyu104__LeetCode-Solutions | Python/convert-an-array-into-a-2d-array-with-conditions.py | {
"start": 553,
"end": 896
} | class ____(object):
def findMatrix(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
result = []
cnt = collections.Counter(nums)
while cnt:
result.append(cnt.keys())
cnt = {k:v-1 for k, v in cnt.iteritems() if v-1}
... | Solution2 |
python | lazyprogrammer__machine_learning_examples | bayesian_ml/2/probit.py | {
"start": 191,
"end": 3706
} | class ____:
def fit(self, X, Y, sigma=1.5, lam=1, show_w=set(), Q=None):
# setup
N, D = X.shape
self.w = np.random.randn(D) / np.sqrt(D) # does not work if you don't scale first!
Eq = np.zeros(N)
idx1 = (Y == 1)
idx0 = (Y == 0)
A = lam*np.eye(D) + X.T.dot(X) / sigma**2
costs = []
... | ProbitRegression |
python | scipy__scipy | scipy/optimize/tests/test_minimize_constrained.py | {
"start": 8782,
"end": 12716
} | class ____:
"""Distribution of electrons on a sphere.
Problem no 2 from COPS collection [2]_. Find
the equilibrium state distribution (of minimal
potential) of the electrons positioned on a
conducting sphere.
References
----------
.. [1] E. D. Dolan, J. J. Mor\'{e}, and T. S. Munson,
... | Elec |
python | getsentry__sentry | tests/sentry/utils/test_urls.py | {
"start": 1249,
"end": 2910
} | class ____(TestCase):
def test_parse_link(self) -> None:
assert (
parse_link(
"https://meowlificent.ngrok.io/organizations/sentry/issues/167/?project=2&query=is%3Aunresolved"
)
== "organizations/{organization}/issues/{issue_id}/project=%7Bproject%7D&query=... | ParseLinkTest |
python | wandb__wandb | wandb/sdk/lib/retry.py | {
"start": 12026,
"end": 13093
} | class ____(Backoff):
"""Re-raise any exceptions that fail a predicate; delegate others to another Backoff."""
def __init__(self, filter: Callable[[Exception], bool], wrapped: Backoff) -> None:
self._filter = filter
self._wrapped = wrapped
def next_sleep_or_reraise(self, exc: Exception) -> ... | FilteredBackoff |
python | walkccc__LeetCode | solutions/33. Search in Rotated Sorted Array/33.py | {
"start": 0,
"end": 492
} | class ____:
def search(self, nums: list[int], target: int) -> int:
l = 0
r = len(nums) - 1
while l <= r:
m = (l + r) // 2
if nums[m] == target:
return m
if nums[l] <= nums[m]: # nums[l..m] are sorted.
if nums[l] <= target < nums[m]:
r = m - 1
else:
... | Solution |
python | allegroai__clearml | clearml/backend_api/services/v2_23/datasets.py | {
"start": 226589,
"end": 227526
} | class ____(Response):
"""
Response of datasets.publish_and_create_child_version endpoint.
:param id: ID of the child version
:type id: str
"""
_service = "datasets"
_action = "publish_and_create_child_version"
_version = "2.23"
_schema = {
"definitions": {},
"prope... | PublishAndCreateChildVersionResponse |
python | readthedocs__readthedocs.org | readthedocs/projects/forms.py | {
"start": 42158,
"end": 43066
} | class ____(forms.ModelForm):
"""
Form to add an integration.
This limits the choices of the integration type to webhook integration types
"""
project = forms.CharField(widget=forms.HiddenInput(), required=False)
class Meta:
model = Integration
fields = [
"project",... | IntegrationForm |
python | jina-ai__jina | jina/clients/base/helper.py | {
"start": 9561,
"end": 14920
} | class ____(AioHttpClientlet):
"""Websocket Client to be used with the streamer"""
def __init__(self, url, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.url = url
self.websocket = None
self.response_iter = None
async def send_message(self, request: 'Reques... | WebsocketClientlet |
python | PyCQA__pylint | tests/functional/i/invalid/invalid_length/invalid_length_returned.py | {
"start": 1246,
"end": 1369
} | class ____:
"""Potential uninferable return value"""
def __len__(self):
return int(Missing)
| AnotherAmbiguousLen |
python | getsentry__sentry | src/sentry/replays/usecases/query/conditions/duration.py | {
"start": 164,
"end": 1622
} | class ____(ComputedBase):
"""Duration scalar condition class."""
@staticmethod
def visit_eq(value: int) -> Condition:
return Condition(aggregate_duration(), Op.EQ, value)
@staticmethod
def visit_neq(value: int) -> Condition:
return Condition(aggregate_duration(), Op.NEQ, value)
... | SimpleAggregateDurationScalar |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/abstractClass2.py | {
"start": 426,
"end": 538
} | class ____(InterfaceAB, MixinA):
def b(self) -> None:
print("ClassAB.b")
ab = ClassAB()
ab.a()
| ClassAB |
python | bokeh__bokeh | src/bokeh/models/filters.py | {
"start": 4148,
"end": 4416
} | class ____(CompositeFilter):
""" Computes difference of indices resulting from other filters. """
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
| DifferenceFilter |
python | davidhalter__jedi | jedi/inference/value/function.py | {
"start": 15016,
"end": 17424
} | class ____(FunctionMixin, ValueWrapper):
def __init__(self, function, overloaded_functions):
super().__init__(function)
self._overloaded_functions = overloaded_functions
def py__call__(self, arguments):
debug.dbg("Execute overloaded function %s", self._wrapped_value, color='BLUE')
... | OverloadedFunctionValue |
python | numpy__numpy | numpy/random/tests/test_generator_mt19937.py | {
"start": 108348,
"end": 109779
} | class ____:
# make sure each state produces the same sequence even in threads
seeds = range(4)
def check_function(self, function, sz):
from threading import Thread
out1 = np.empty((len(self.seeds),) + sz)
out2 = np.empty((len(self.seeds),) + sz)
# threaded generation
... | TestThread |
python | ray-project__ray | python/ray/llm/tests/serve/cpu/deployments/llm/test_llm_server.py | {
"start": 17523,
"end": 22129
} | class ____:
def test_placement_group_config(self):
"""Test that placement_group_config is correctly parsed."""
# Test the default resource bundle
llm_config = LLMConfig(
model_loading_config=dict(model_id="test_model"),
engine_kwargs=dict(tensor_parallel_size=3, pipe... | TestGetDeploymentOptions |
python | huggingface__transformers | src/transformers/models/longcat_flash/configuration_longcat_flash.py | {
"start": 813,
"end": 12124
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`LongcatFlashModel`]. It is used to instantiate
a LongCat Flash model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a si... | LongcatFlashConfig |
python | great-expectations__great_expectations | tests/scripts/test_public_api_report.py | {
"start": 4784,
"end": 5740
} | class ____:
def test_retrieve_all_usages_in_files(self, docs_example_parser: DocsExampleParser):
usages = docs_example_parser.get_names_from_usage_in_docs_examples()
assert usages == {
"ExampleClass",
"ExamplePublicAPIClass",
"example_classmethod",
"ex... | TestDocExampleParser |
python | great-expectations__great_expectations | great_expectations/core/batch.py | {
"start": 27565,
"end": 28233
} | class ____(BatchKwargs):
"""A BatchMarkers is a special type of BatchKwargs (so that it has a batch_fingerprint) but it generally does
NOT require specific keys and instead captures information about the OUTPUT of a datasource's fetch
process, such as the timestamp at which a query was executed.""" # noqa:... | BatchMarkers |
python | wandb__wandb | wandb/vendor/pygments/lexers/jvm.py | {
"start": 38305,
"end": 38639
} | class ____(ClojureLexer):
"""
Lexer for `ClojureScript <http://clojure.org/clojurescript>`_
source code.
.. versionadded:: 2.0
"""
name = 'ClojureScript'
aliases = ['clojurescript', 'cljs']
filenames = ['*.cljs']
mimetypes = ['text/x-clojurescript', 'application/x-clojurescript']
| ClojureScriptLexer |
python | apache__airflow | providers/apache/iceberg/src/airflow/providers/apache/iceberg/hooks/iceberg.py | {
"start": 992,
"end": 3244
} | class ____(BaseHook):
"""
This hook acts as a base hook for iceberg services.
It offers the ability to generate temporary, short-lived
session tokens to use within Airflow submitted jobs.
:param iceberg_conn_id: The :ref:`Iceberg connection id<howto/connection:iceberg>`
which refers to the... | IcebergHook |
python | great-expectations__great_expectations | great_expectations/render/renderer/column_section_renderer.py | {
"start": 1097,
"end": 2081
} | class ____(Renderer):
def __init__(self) -> None:
super().__init__()
@classmethod
def _get_column_name(cls, ge_object):
# This is broken out for ease of locating future validation here
if isinstance(ge_object, list):
candidate_object = ge_object[0]
else:
... | ColumnSectionRenderer |
python | joblib__joblib | joblib/test/test_cloudpickle_wrapper.py | {
"start": 252,
"end": 729
} | class ____(object):
def __call__(self, x):
return x
def test_wrap_non_picklable_objects():
# Mostly a smoke test: test that we can use callable in the same way
# with both our implementation of wrap_non_picklable_objects and the
# upstream one
for obj in (a_function, AClass()):
wra... | AClass |
python | numpy__numpy | numpy/f2py/tests/test_crackfortran.py | {
"start": 771,
"end": 2553
} | class ____:
def test_defaultPrivate(self):
fpath = util.getpath("tests", "src", "crackfortran", "privatemod.f90")
mod = crackfortran.crackfortran([str(fpath)])
assert len(mod) == 1
mod = mod[0]
assert "private" in mod["vars"]["a"]["attrspec"]
assert "public" not in mo... | TestPublicPrivate |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/classes10.py | {
"start": 121,
"end": 409
} | class ____:
class InnerA:
pass
def dynamic_subclass1(cls: type[T_A]):
class SubClass(cls):
class SubInnerClass(cls.InnerA):
pass
return SubClass
def dynamic_subclass2(base: type[A] | None):
class SubClass(base or A): ...
return SubClass
| A |
python | django__django | tests/model_formsets/models.py | {
"start": 2183,
"end": 2434
} | class ____(models.Model):
auto_id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100)
place = models.ForeignKey(Place, models.CASCADE)
def __str__(self):
return "%s at %s" % (self.name, self.place)
| Owner |
python | kamyu104__LeetCode-Solutions | Python/encode-number.py | {
"start": 32,
"end": 308
} | class ____(object):
def encode(self, num):
"""
:type num: int
:rtype: str
"""
result = []
while num:
result.append('0' if num%2 else '1')
num = (num-1)//2
return "".join(reversed(result))
| Solution |
python | matplotlib__matplotlib | lib/mpl_toolkits/axes_grid1/axes_size.py | {
"start": 5464,
"end": 6708
} | class ____(_Base):
"""
An instance whose size is a *fraction* of the *ref_size*.
>>> s = Fraction(0.3, AxesX(ax))
"""
def __init__(self, fraction, ref_size):
_api.check_isinstance(Real, fraction=fraction)
self._fraction_ref = ref_size
self._fraction = fraction
def get_... | Fraction |
python | readthedocs__readthedocs.org | readthedocs/invitations/tests/test_querysets.py | {
"start": 379,
"end": 5914
} | class ____(TestCase):
def setUp(self):
self.user = get(User)
self.project = get(Project, users=[self.user])
self.organization = get(
Organization, owners=[self.user], projects=[self.project]
)
self.team = get(Team, organization=self.organization)
self.anot... | TestQuerysets |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/dialects/postgresql/base.py | {
"start": 202175,
"end": 203592
} | class ____:
"""Helper class used for deferred loading of named types (enums, domains)
only when needed.
"""
def __init__(
self, dialect: PGDialect, connection, kw: Dict[str, Any]
) -> None:
self.dialect = dialect
self.connection = connection
self.kw = kw
@util.m... | _NamedTypeLoader |
python | mlflow__mlflow | mlflow/entities/dataset_input.py | {
"start": 222,
"end": 1581
} | class ____(_MlflowObject):
"""DatasetInput object associated with an experiment."""
def __init__(self, dataset: Dataset, tags: list[InputTag] | None = None) -> None:
self._dataset = dataset
self._tags = tags or []
def __eq__(self, other: _MlflowObject) -> bool:
if type(other) is ty... | DatasetInput |
python | apache__airflow | airflow-core/src/airflow/example_dags/plugins/decreasing_priority_weight_strategy.py | {
"start": 1078,
"end": 1335
} | class ____(PriorityWeightStrategy):
"""A priority weight strategy that decreases the priority weight with each attempt of the DAG task."""
def get_weight(self, ti: TaskInstance):
return max(3 - ti.try_number + 1, 1)
| DecreasingPriorityStrategy |
python | pytorch__pytorch | test/inductor/test_mps_basic.py | {
"start": 951,
"end": 4475
} | class ____(TestCase):
is_dtype_supported = CommonTemplate.is_dtype_supported
common = check_model_gpu
device = "mps"
@parametrize("dtype", MPS_DTYPES)
def test_add(self, dtype):
self.common(
lambda a, b: a + b,
(
make_tensor(1024, dtype=dtype, device=... | MPSBasicTests |
python | dask__distributed | distributed/shuffle/tests/test_rechunk.py | {
"start": 1088,
"end": 48560
} | class ____(AbstractShuffleTestPool):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._executor = ThreadPoolExecutor(2)
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
try:
self._executor.shutdown(c... | ArrayRechunkTestPool |
python | django__django | tests/expressions/tests.py | {
"start": 105027,
"end": 106138
} | class ____(SimpleTestCase):
bitwise_msg = (
"Use .bitand(), .bitor(), and .bitxor() for bitwise logical operations."
)
def test_negation(self):
c = Combinable()
self.assertEqual(-c, c * -1)
def test_and(self):
with self.assertRaisesMessage(NotImplementedError, self.bitw... | CombinableTests |
python | pyinstaller__pyinstaller | bootloader/waflib/Tools/c.py | {
"start": 1132,
"end": 1184
} | class ____(cprogram):
inst_to = '${LIBDIR}'
| cshlib |
python | ansible__ansible | test/lib/ansible_test/_internal/test.py | {
"start": 6571,
"end": 12010
} | class ____(TestResult):
"""Test failure."""
def __init__(
self,
command: str,
test: str,
python_version: t.Optional[str] = None,
messages: t.Optional[c.Sequence[TestMessage]] = None,
summary: t.Optional[str] = None,
):
super().__init__(command, test, ... | TestFailure |
python | django__django | django/contrib/gis/db/models/functions.py | {
"start": 17300,
"end": 17431
} | class ____(GeoFuncMixin, Transform):
lookup_name = "num_dimensions"
output_field = IntegerField()
arity = 1
| NumDimensions |
python | ansible__ansible | test/lib/ansible_test/_internal/commands/sanity/__init__.py | {
"start": 47469,
"end": 54251
} | class ____(SanityScript, SanityMultipleVersion):
"""External sanity test script which should run on multiple python versions."""
def test(self, args: SanityConfig, targets: SanityTargets, python: PythonConfig) -> TestResult:
"""Run the sanity test and return the result."""
multi_version = self.... | SanityScriptMultipleVersion |
python | pennersr__django-allauth | tests/apps/socialaccount/providers/amazon/tests.py | {
"start": 240,
"end": 755
} | class ____(OAuth2TestsMixin, TestCase):
provider_id = AmazonProvider.id
def get_mocked_response(self):
return MockedResponse(
HTTPStatus.OK,
"""
{
"Profile":{
"CustomerId":"amzn1.account.K2LI23KL2LK2",
"Name":"Joh... | AmazonTests |
python | jd__tenacity | tenacity/wait.py | {
"start": 1775,
"end": 1933
} | class ____(wait_fixed):
"""Wait strategy that doesn't wait at all before retrying."""
def __init__(self) -> None:
super().__init__(0)
| wait_none |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/exc.py | {
"start": 3325,
"end": 4417
} | class ____(Exception):
"""Serves as the base of the DBAPI ``Error`` class for dialects where
a DBAPI exception hierrchy needs to be emulated.
The current example is the asyncpg dialect.
.. versionadded:: 2.1
"""
orig: Exception | None
def __init__(self, message: str, orig: Exception | N... | EmulatedDBAPIException |
python | spack__spack | lib/spack/spack/binary_distribution.py | {
"start": 94295,
"end": 96171
} | class ____:
def conditional_fetch(self) -> FetchIndexResult:
raise NotImplementedError(f"{self.__class__.__name__} is abstract")
def get_index_manifest(self, manifest_response) -> BlobRecord:
"""Read the response of the manifest request and return a BlobRecord"""
cache_class = get_url_b... | IndexFetcher |
python | plotly__plotly.py | plotly/graph_objs/_scatterpolargl.py | {
"start": 215,
"end": 71164
} | class ____(_BaseTraceType):
_parent_path_str = ""
_path_str = "scatterpolargl"
_valid_props = {
"connectgaps",
"customdata",
"customdatasrc",
"dr",
"dtheta",
"fill",
"fillcolor",
"hoverinfo",
"hoverinfosrc",
"hoverlabel",
... | Scatterpolargl |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-monday/unit_tests/integrations/monday_requests/request_authenticators/api_token_authenticator.py | {
"start": 101,
"end": 356
} | class ____(Authenticator):
def __init__(self, api_token: str) -> None:
super().__init__()
self._api_token = api_token
@property
def client_access_token(self) -> str:
return f"Bearer {self._api_token}"
| ApiTokenAuthenticator |
python | django__django | django/forms/renderers.py | {
"start": 944,
"end": 1354
} | class ____:
def get_template(self, template_name):
return self.engine.get_template(template_name)
@cached_property
def engine(self):
return self.backend(
{
"APP_DIRS": True,
"DIRS": [Path(__file__).parent / self.backend.app_dirname],
... | EngineMixin |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.