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/matchSequence1.py | {
"start": 1983,
"end": 10209
} | class ____(Protocol[_T_co]):
def __reversed__(self) -> Iterator[_T_co]: ...
def test_protocol(value_to_match: SeqProto[str]):
match value_to_match:
case [*a1]:
reveal_type(a1, expected_text="list[str]")
case b1:
reveal_type(b1, expected_text="SeqProto[str]")
def test_... | SeqProto |
python | xlwings__xlwings | xlwings/constants.py | {
"start": 75824,
"end": 75915
} | class ____:
xlPart = 2 # from enum XlLookAt
xlWhole = 1 # from enum XlLookAt
| LookAt |
python | sqlalchemy__sqlalchemy | test/orm/test_core_compilation.py | {
"start": 64503,
"end": 68512
} | class ____(
_poly_fixtures._PolymorphicUnions, AssertsCompiledSQL
):
__dialect__ = "default"
default_punion = (
"(SELECT pjoin.person_id AS person_id, "
"pjoin.company_id AS company_id, "
"pjoin.name AS name, pjoin.type AS type, "
"pjoin.status AS status, pjoin.engineer_name... | ExplicitWithPolymorphicTest |
python | apache__airflow | providers/microsoft/azure/src/airflow/providers/microsoft/azure/transfers/s3_to_wasb.py | {
"start": 1901,
"end": 2189
} | class ____(Exception):
"""Custom exception raised when neither a full_path or file_name + prefix are provided to _create_key."""
def __init__(self):
message = "Either full_path of prefix and file_name must not be None"
super().__init__(message)
| InvalidKeyComponents |
python | langchain-ai__langchain | libs/core/langchain_core/agents.py | {
"start": 4455,
"end": 4879
} | class ____(Serializable):
"""Result of running an `AgentAction`."""
action: AgentAction
"""The `AgentAction` that was executed."""
observation: Any
"""The result of the `AgentAction`."""
@property
def messages(self) -> Sequence[BaseMessage]:
"""Messages that correspond to this obse... | AgentStep |
python | kamyu104__LeetCode-Solutions | Python/number-of-substrings-with-fixed-ratio.py | {
"start": 54,
"end": 475
} | class ____(object):
def fixedRatio(self, s, num1, num2):
"""
:type s: str
:type num1: int
:type num2: int
:rtype: int
"""
lookup = collections.Counter()
lookup[0] = 1
result = curr = 0
for c in s:
curr += -num2 if c == '0' e... | Solution |
python | pytorch__pytorch | torch/_export/serde/schema.py | {
"start": 11218,
"end": 11936
} | class ____:
graph: Annotated[Graph, 10]
signature: Annotated[GraphSignature, 50]
# This is used for unflattening, by tracking the calling structure of all of
# the modules in order to unflatten the modules back to the eager calling
# conventions.
module_call_graph: Annotated[list[ModuleCallEntry... | GraphModule |
python | huggingface__transformers | src/transformers/models/rembert/modeling_rembert.py | {
"start": 27438,
"end": 31710
} | class ____(RemBertPreTrainedModel):
def __init__(self, config):
super().__init__(config)
if config.is_decoder:
logger.warning(
"If you want to use `RemBertForMaskedLM` make sure `config.is_decoder=False` for "
"bi-directional self-attention."
... | RemBertForMaskedLM |
python | astropy__astropy | astropy/units/tests/test_quantity_non_ufuncs.py | {
"start": 28428,
"end": 32390
} | class ____(InvariantUnitTestSetup):
def test_ptp(self):
self.check(np.ptp)
self.check(np.ptp, axis=0)
def test_round(self):
self.check(np.round)
@pytest.mark.skipif(not NUMPY_LT_2_0, reason="np.round_ is removed in NumPy 2.0")
@pytest.mark.filterwarnings("ignore:`round_` is dep... | TestUfuncLike |
python | aimacode__aima-python | nlp.py | {
"start": 20882,
"end": 22011
} | class ____(object):
def __init__(self, address, inLinks=None, outLinks=None, hub=0, authority=0):
self.address = address
self.hub = hub
self.authority = authority
self.inlinks = inLinks
self.outlinks = outLinks
pagesContent = {} # maps Page relative or absolute URL/locatio... | Page |
python | pytorch__pytorch | test/distributed/test_cupy_as_tensor.py | {
"start": 1204,
"end": 3571
} | class ____(MultiProcContinuousTest):
@classmethod
def backend_str(cls):
return "gloo"
def _init_device(self) -> None:
# need to use vmm api to test it,
# see https://forums.developer.nvidia.com/t/inconsistent-behavior-of-cudapointergetattributes-between-cudamalloc-ipc-and-vmm-based-... | CupyAsTensorTest |
python | getsentry__sentry-python | sentry_sdk/profiler/transaction_profiler.py | {
"start": 21851,
"end": 24752
} | class ____(Scheduler):
"""
This scheduler is based on running a daemon thread that will call
the sampler at a regular interval.
"""
mode = "thread" # type: ProfilerMode
name = "sentry.profiler.ThreadScheduler"
def __init__(self, frequency):
# type: (int) -> None
super().__... | ThreadScheduler |
python | facebook__pyre-check | source/interprocedural_analyses/taint/test/integration/lists.py | {
"start": 996,
"end": 2318
} | class ____:
def taint_self(self, item):
...
def push_pop_no_taint() -> List[int]:
x = []
x.append(_test_source())
x.pop()
return x
def push_pop_taint() -> List[int]:
x = []
x.append(_test_source())
x.append(1)
x.pop()
return x
def test_setitem() -> None:
x = [""... | Woot |
python | ray-project__ray | doc/source/serve/doc_code/local_dev.py | {
"start": 287,
"end": 1020
} | class ____:
def __init__(self, doubler: DeploymentHandle):
self.doubler = doubler
async def say_hello_twice(self, name: str):
return await self.doubler.double.remote(f"Hello, {name}!")
async def __call__(self, request: Request):
return await self.say_hello_twice(request.query_param... | HelloDeployment |
python | weaviate__weaviate-python-client | weaviate/collections/classes/grpc.py | {
"start": 7917,
"end": 8087
} | class ____(BM25OperatorOptions):
"""Define the 'And' operator for keyword queries."""
operator = base_search_pb2.SearchOperatorOptions.OPERATOR_AND
| BM25OperatorAnd |
python | cython__cython | Cython/Compiler/ExprNodes.py | {
"start": 456259,
"end": 457420
} | class ____(AwaitExprNode):
# 'await' expression node as part of 'async for' iteration
#
# Breaks out of loop on StopAsyncIteration exception.
def _generate_break(self, code):
code.putln("PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();")
code.putln("if (unlikely(exc_type && (exc... | AwaitIterNextExprNode |
python | pallets__click | src/click/testing.py | {
"start": 1601,
"end": 2050
} | class ____(io.BytesIO):
"""Patch ``io.BytesIO`` to let the written stream be copied to another.
.. versionadded:: 8.2
"""
def __init__(self, copy_to: io.BytesIO) -> None:
super().__init__()
self.copy_to = copy_to
def flush(self) -> None:
super().flush()
self.copy_t... | BytesIOCopy |
python | Netflix__metaflow | metaflow/_vendor/zipp.py | {
"start": 1427,
"end": 2873
} | class ____(zipfile.ZipFile):
"""
A ZipFile subclass that ensures that implied directories
are always included in the namelist.
"""
@staticmethod
def _implied_dirs(names):
parents = itertools.chain.from_iterable(map(_parents, names))
as_dirs = (p + posixpath.sep for p in parents)... | CompleteDirs |
python | run-llama__llama_index | llama-index-integrations/graph_stores/llama-index-graph-stores-neptune/llama_index/graph_stores/neptune/analytics.py | {
"start": 293,
"end": 2544
} | class ____(NeptuneBaseGraphStore):
def __init__(
self,
graph_identifier: str,
client: Any = None,
credentials_profile_name: Optional[str] = None,
region_name: Optional[str] = None,
node_label: str = "Entity",
**kwargs: Any,
) -> None:
"""Create a n... | NeptuneAnalyticsGraphStore |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/ruff/RUF033.py | {
"start": 2359,
"end": 2446
} | class ____:
def __post_init__(self, x: int = """
""") -> None:
self.x = x
| D |
python | getsentry__sentry | src/sentry/api/serializers/models/project.py | {
"start": 25362,
"end": 25664
} | class ____(
_OrganizationProjectOptionalResponse, ProjectSerializerBaseResponse
):
team: TeamResponseDict | None
teams: list[TeamResponseDict]
platforms: list[str]
hasUserReports: bool
environments: list[str]
latestRelease: LatestReleaseDict | None
| OrganizationProjectResponse |
python | getsentry__sentry | src/sentry/preprod/analytics.py | {
"start": 2731,
"end": 2969
} | class ____(analytics.Event):
organization_id: int
project_id: int
user_id: int | None = None
artifact_id: str
@analytics.eventclass("preprod_artifact.api.size_analysis_compare_download")
| PreprodArtifactApiInstallDetailsEvent |
python | django__django | tests/migrations/test_commands.py | {
"start": 139055,
"end": 142320
} | class ____(TestCase):
"""
This class inherits TestCase because MigrationTestBase uses
`available_apps = ['migrations']` which means that it's the only installed
app. 'django.contrib.auth' must be in INSTALLED_APPS for some of these
tests.
"""
nonexistent_app_error = "No installed app with l... | AppLabelErrorTests |
python | huggingface__transformers | tests/models/sam2/test_modeling_sam2.py | {
"start": 10832,
"end": 11884
} | class ____:
def __init__(
self,
hidden_size=32,
input_image_size=128,
patch_size=16,
mask_input_channels=8,
num_point_embeddings=4,
hidden_act="gelu",
):
self.hidden_size = hidden_size
self.input_image_size = input_image_size
self.p... | Sam2PromptEncoderTester |
python | numba__numba | numba/core/ir.py | {
"start": 8529,
"end": 9487
} | class ____(object):
def __init__(self):
self._con = {}
def define(self, name, var):
if name in self._con:
raise RedefinedError(name)
else:
self._con[name] = var
def get(self, name):
try:
return self._con[name]
except KeyError:
... | VarMap |
python | getsentry__sentry | src/sentry/monitors/processing_errors/errors.py | {
"start": 5702,
"end": 5852
} | class ____(TypedDict):
id: str
checkin: CheckinItemData
errors: Sequence[ProcessingError]
@dataclass(frozen=True)
| CheckinProcessingErrorData |
python | matplotlib__matplotlib | lib/matplotlib/_api/deprecation.py | {
"start": 8223,
"end": 11530
} | class ____:
"""
Helper to deprecate public access to an attribute (or method).
This helper should only be used at class scope, as follows::
class Foo:
attr = _deprecate_privatize_attribute(*args, **kwargs)
where *all* parameters are forwarded to `deprecated`. This form makes
... | deprecate_privatize_attribute |
python | tensorflow__tensorflow | tensorflow/python/checkpoint/checkpoint.py | {
"start": 29107,
"end": 31427
} | class ____:
"""Abstract base for load status callbacks."""
@abc.abstractmethod
def assert_consumed(self):
"""Raises an exception unless a non-trivial restoration has completed."""
pass
@abc.abstractmethod
def assert_existing_objects_matched(self):
"""Raises an exception unless existing Python ob... | _LoadStatus |
python | pytorch__pytorch | test/distributed/checkpoint/test_utils.py | {
"start": 7042,
"end": 10530
} | class ____(DTensorTestBase):
@property
def world_size(self):
return min(4, torch.accelerator.device_count())
@with_comms
@skip_if_lt_x_gpu(4)
def test_gather_object(self):
mesh_2d = dist.init_device_mesh(self.device_type, (2, self.world_size // 2))
torch.random.manual_seed(d... | TestDistWrapper |
python | airbytehq__airbyte | airbyte-ci/connectors/connectors_qa/src/connectors_qa/checks/metadata.py | {
"start": 1572,
"end": 4237
} | class ____(MetadataCheck):
name = "Connector must have a language tag in metadata"
description = f"Connectors must have a language tag in their metadata. It must be set in the `tags` field in {consts.METADATA_FILE_NAME}. The values can be `language:python` or `language:java`. This checks infers the correct lang... | CheckConnectorLanguageTag |
python | RobertCraigie__pyright-python | src/pyright/node.py | {
"start": 2889,
"end": 2968
} | class ____(NamedTuple):
type: Literal['global']
path: Path
| GlobalStrategy |
python | getsentry__sentry | src/sentry/integrations/gitlab/client.py | {
"start": 1270,
"end": 2509
} | class ____(IntegrationProxyClient):
"""
API Client that doesn't require an installation.
This client is used during integration setup to fetch data
needed to build installation metadata
"""
integration_name = "gitlab_setup"
def __init__(self, base_url: str, access_token: str, verify_ssl: b... | GitLabSetupApiClient |
python | ray-project__ray | rllib/utils/lambda_defaultdict.py | {
"start": 71,
"end": 1998
} | class ____(defaultdict):
"""A defaultdict that creates default values based on the associated key.
Note that the standard defaultdict can only produce default values (via its factory)
that are independent of the key under which they are stored.
As opposed to that, the lambda functions used as factories... | LambdaDefaultDict |
python | pytorch__pytorch | torch/nn/modules/batchnorm.py | {
"start": 13971,
"end": 15640
} | class ____(_LazyNormBase, _BatchNorm):
r"""A :class:`torch.nn.BatchNorm1d` module with lazy initialization.
Lazy initialization based on the ``num_features`` argument of the :class:`BatchNorm1d` that is inferred
from the ``input.size(1)``.
The attributes that will be lazily initialized are `weight`, `b... | LazyBatchNorm1d |
python | SmileyChris__easy-thumbnails | easy_thumbnails/tests/models.py | {
"start": 320,
"end": 510
} | class ____(models.Model):
avatar = ThumbnailerField(upload_to='avatars')
logo = models.FileField(upload_to='avatars')
class Meta:
app_label = 'easy_thumbnails_tests'
| Profile |
python | getsentry__sentry | tests/sentry/issues/test_issue_search.py | {
"start": 20551,
"end": 21247
} | class ____(TestCase):
def test(self) -> None:
assert convert_type_value(["error"], [self.project], self.user, None) == [1]
assert convert_type_value(
["performance_n_plus_one_db_queries"], [self.project], self.user, None
) == [1006]
assert convert_type_value(
... | ConvertTypeValueTest |
python | huggingface__transformers | src/transformers/generation/logits_process.py | {
"start": 73660,
"end": 81101
} | class ____(LogitsProcessor):
r"""
[`LogitsProcessor`] that enforces diverse beam search.
Note that this logits processor is only effective for [`PreTrainedModel.group_beam_search`]. See [Diverse Beam
Search: Decoding Diverse Solutions from Neural Sequence Models](https://huggingface.co/papers/1610.02424... | HammingDiversityLogitsProcessor |
python | getsentry__sentry | tests/sentry/integrations/tasks/test_sync_status_inbound.py | {
"start": 1138,
"end": 15381
} | class ____(TestCase):
def setUp(self) -> None:
self.organization = self.create_organization(owner=self.create_user())
self.project = self.create_project(organization=self.organization)
self.group = self.create_group(
project=self.project,
status=GroupStatus.UNRESOLVED... | TestSyncStatusInbound |
python | huggingface__transformers | src/transformers/models/perceiver/modeling_perceiver.py | {
"start": 75938,
"end": 85065
} | class ____(PerceiverAbstractDecoder):
"""
Cross-attention-based decoder. This class can be used to decode the final hidden states of the latents using a
cross-attention operation, in which the latents produce keys and values.
The shape of the output of this class depends on how one defines the output q... | PerceiverBasicDecoder |
python | sphinx-doc__sphinx | tests/roots/test-ext-coverage/grog/coverage_ignored.py | {
"start": 0,
"end": 201
} | class ____:
"""Documented"""
def ignored1(self):
pass
def ignored2(self):
pass
def not_ignored1(self):
pass
def not_ignored2(self):
pass
| Documented |
python | xlwings__xlwings | xlwings/_xlwindows.py | {
"start": 28016,
"end": 29539
} | class ____(base_classes.Sheets):
def __init__(self, xl):
self.xl = xl
@property
def api(self):
return self.xl
@property
def active(self):
return Sheet(self.xl.Parent.ActiveSheet)
def __call__(self, name_or_index):
return Sheet(xl=self.xl(name_or_index))
de... | Sheets |
python | pennersr__django-allauth | allauth/socialaccount/providers/naver/views.py | {
"start": 181,
"end": 984
} | class ____(OAuth2Adapter):
provider_id = "naver"
access_token_url = "https://nid.naver.com/oauth2.0/token" # nosec
authorize_url = "https://nid.naver.com/oauth2.0/authorize"
profile_url = "https://openapi.naver.com/v1/nid/me"
def complete_login(self, request, app, token, **kwargs):
headers... | NaverOAuth2Adapter |
python | django-haystack__django-haystack | haystack/backends/elasticsearch_backend.py | {
"start": 31027,
"end": 39158
} | class ____(BaseSearchQuery):
def matching_all_fragment(self):
return "*:*"
def build_query_fragment(self, field, filter_type, value):
from haystack import connections
query_frag = ""
if not hasattr(value, "input_type_name"):
# Handle when we've got a ``ValuesListQu... | ElasticsearchSearchQuery |
python | pytorch__pytorch | test/test_cpp_extensions_aot.py | {
"start": 1373,
"end": 7034
} | class ____(common.TestCase):
"""Tests ahead-of-time cpp extensions
NOTE: run_test.py's test_cpp_extensions_aot_ninja target
also runs this test case, but with ninja enabled. If you are debugging
a test failure here from the CI, check the logs for which target
(test_cpp_extensions_aot_no_ninja vs te... | TestCppExtensionAOT |
python | gevent__gevent | src/gevent/tests/test__backdoor.py | {
"start": 1697,
"end": 5833
} | class ____(greentest.TestCase):
__timeout__ = 10
def tearDown(self):
gevent.sleep() # let spawned greenlets die
super(Test, self).tearDown()
def _server_listen_argument(self):
return DEFAULT_BIND_ADDR_TUPLE
def _make_and_start_server(self, *args, **kwargs):
server = b... | Test |
python | kamyu104__LeetCode-Solutions | Python/maximum-path-quality-of-a-graph.py | {
"start": 1811,
"end": 2957
} | class ____(object):
def maximalPathQuality(self, values, edges, maxTime):
"""
:type values: List[int]
:type edges: List[List[int]]
:type maxTime: int
:rtype: int
"""
def dfs(values, adj, u, time, total, lookup, lookup2, result):
lookup[u] += 1
... | Solution2 |
python | kamyu104__LeetCode-Solutions | Python/string-matching-in-an-array.py | {
"start": 525,
"end": 2397
} | class ____(object):
def step(self, letter):
while self.__node and letter not in self.__node.children:
self.__node = self.__node.suffix
self.__node = self.__node.children[letter] if self.__node else self.__root
return self.__get_ac_node_outputs(self.__node)
def reset(sel... | AhoTrie |
python | pytorch__pytorch | torch/_inductor/metrics.py | {
"start": 1001,
"end": 2331
} | class ____:
inner_kernel_number: int
local_buffer_number: int = 0
# The length counts the number of outer loop fusions.
cpp_outer_loop_fused_inner_counts: list[CppOuterLoopFusedCount] = []
num_comprehensive_padding = 0
num_matches_for_scatter_upon_const_tensor = 0
num_loop_reordering = 0
# counter for para... | CppOuterLoopFusedCount |
python | ansible__ansible | test/units/executor/test_play_iterator.py | {
"start": 1152,
"end": 17149
} | class ____(unittest.TestCase):
def test_host_state(self):
hs = HostState(blocks=list(range(0, 10)))
hs.tasks_child_state = HostState(blocks=[0])
hs.rescue_child_state = HostState(blocks=[1])
hs.always_child_state = HostState(blocks=[2])
repr(hs)
hs.run_state = 100
... | TestPlayIterator |
python | numba__numba | numba/core/typeinfer.py | {
"start": 34126,
"end": 34811
} | class ____(object):
def __init__(self, args, vararg, loc):
self.args = args
self.vararg = vararg
self.loc = loc
def __call__(self, typeinfer):
typevars = typeinfer.typevars
r = fold_arg_vars(typevars, self.args, self.vararg, {})
if r is None:
# Canno... | PrintConstraint |
python | allegroai__clearml | clearml/backend_api/services/v2_20/events.py | {
"start": 14832,
"end": 20614
} | class ____(NonStrictDataModel):
"""
An entire plot (not single datapoint) and it's layout.
Used for plotting ROC curves, confidence matrices, etc. when evaluating the net.
:param timestamp: Epoch milliseconds UTC, will be set by the server if not set.
:type timestamp: float
:param task: Task ... | MetricsPlotEvent |
python | pytorch__pytorch | torch/_export/serde/schema_check.py | {
"start": 15057,
"end": 19375
} | class ____ {{
public:
double get() const {{
return value_;
}}
void set(double value) {{
value_ = value;
}}
private:
double value_;
}};
inline void to_json(nlohmann::json& j, const F64& f) {{
if (std::isinf(f.get())) {{
j = "Infinity";
}} else if (std::isinf(-f.get())) {{
j = "-Infinit... | F64 |
python | tensorflow__tensorflow | tensorflow/python/ops/tensor_array_ops.py | {
"start": 51638,
"end": 56544
} | class ____(type_spec.TypeSpec):
"""Type specification for a `tf.TensorArray`."""
__slots__ = ["_element_shape", "_dtype", "_dynamic_size", "_infer_shape"]
value_type = property(lambda self: TensorArray)
def __init__(self,
element_shape=None,
dtype=dtypes.float32,
... | TensorArraySpec |
python | kamyu104__LeetCode-Solutions | Python/minimum-changes-to-make-k-semi-palindromes.py | {
"start": 1595,
"end": 2879
} | class ____(object):
def minimumChanges(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
divisors = [[] for _ in xrange(len(s)+1)]
for i in xrange(1, len(divisors)): # Time: O(nlogn), Space: O(nlogn)
for j in xrange(i, len(divisors), i):
... | Solution2 |
python | pytorch__pytorch | torch/monitor/__init__.py | {
"start": 255,
"end": 1278
} | class ____:
"""
TensorboardEventHandler is an event handler that will write known events to
the provided SummaryWriter.
This currently only supports ``torch.monitor.Stat`` events which are logged
as scalars.
Example:
>>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_MONITOR)
>>> # xd... | TensorboardEventHandler |
python | dagster-io__dagster | python_modules/dagster-graphql/dagster_graphql/schema/partition_sets.py | {
"start": 3676,
"end": 3860
} | class ____(graphene.Union):
class Meta:
types = (GraphenePartitionRunConfig, GraphenePythonError)
name = "PartitionRunConfigOrError"
| GraphenePartitionRunConfigOrError |
python | justquick__django-activity-stream | actstream/feeds.py | {
"start": 8485,
"end": 8925
} | class ____:
def get_object(self, request):
if request.user.is_authenticated:
return request.user
def get_stream(self):
return user_stream
def get_stream_kwargs(self, request):
stream_kwargs = {}
if 'with_user_activity' in request.GET:
stream_kwargs[... | UserActivityMixin |
python | geekcomputers__Python | venv/Lib/site-packages/pip/_vendor/distlib/database.py | {
"start": 11675,
"end": 16711
} | class ____(object):
"""
A base class for distributions, whether installed or from indexes.
Either way, it must have some metadata, so that's all that's needed
for construction.
"""
build_time_dependency = False
"""
Set to True if it's known to be only a build-time dependency (i.e.
n... | Distribution |
python | gevent__gevent | src/gevent/tests/test__pywsgi.py | {
"start": 48703,
"end": 49489
} | class ____(TestCase):
validator = None
error_raised = None
def application(self, env, start_response):
write = start_response('304 Not modified', [])
self.error_raised = False
try:
write('body')
except AssertionError as ex:
self.error_raised = True
... | TestWrite304 |
python | python-openxml__python-docx | src/docx/oxml/table.py | {
"start": 9378,
"end": 9686
} | class ____(BaseOxmlElement):
"""`w:tblLayout` element.
Specifies whether column widths are fixed or can be automatically adjusted based on
content.
"""
type: str | None = OptionalAttribute( # pyright: ignore[reportAssignmentType]
"w:type", ST_TblLayoutType
)
| CT_TblLayoutType |
python | pytorch__pytorch | torch/utils/show_pickle.py | {
"start": 1937,
"end": 5459
} | class ____(pickle._Unpickler): # type: ignore[name-defined]
def __init__(
self,
file,
*,
catch_invalid_utf8=False,
**kwargs) -> None:
super().__init__(file, **kwargs)
self.catch_invalid_utf8 = catch_invalid_utf8
def find_class(self, m... | DumpUnpickler |
python | getsentry__sentry | src/sentry/issues/auto_source_code_config/utils/platform.py | {
"start": 914,
"end": 1510
} | class ____:
def __init__(self, platform: str) -> None:
self.platform = platform
self.config = get_platform_config(platform)
def is_supported(self) -> bool:
return self.config is not None
def is_dry_run_platform(self, org: Organization) -> bool:
return self.config.get("dry_r... | PlatformConfig |
python | kamyu104__LeetCode-Solutions | Python/minimize-result-by-adding-parentheses-to-expression.py | {
"start": 2316,
"end": 3051
} | class ____(object):
def minimizeResult(self, expression):
"""
:type expression: str
:rtype: str
"""
best = None
min_val = float("inf")
pos = expression.index('+')
for i in xrange(pos):
for j in xrange(pos+1, len(expression)):
... | Solution3 |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeVarTuple13.py | {
"start": 560,
"end": 1032
} | class ____(Protocol[Unpack[Ts]]):
def __call__(self, *args: *Ts, keyed: bool) -> tuple[Unpack[Ts]]: ...
def invoke_keyed(fn: CallbackKeyed[Unpack[Ts]], *args: *Ts) -> tuple[Unpack[Ts]]:
return fn(*args, keyed=True)
def invoke_keyed_should_fail(
fn: CallbackKeyed[Unpack[Ts]], *args: *Ts
) -> tuple[Unpack... | CallbackKeyed |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 357449,
"end": 357853
} | class ____(sgqlc.types.Input):
"""Only allow users with bypass permission to update matching refs."""
__schema__ = github_schema
__field_names__ = ("update_allows_fetch_and_merge",)
update_allows_fetch_and_merge = sgqlc.types.Field(sgqlc.types.non_null(Boolean), graphql_name="updateAllowsFetchAndMerge"... | UpdateParametersInput |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/video_intelligence.py | {
"start": 1453,
"end": 5678
} | class ____(GoogleCloudBaseOperator):
"""
Performs video annotation, annotating video labels.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:CloudVideoIntelligenceDetectVideoLabelsOperator`.
:param input_uri: Input video loc... | CloudVideoIntelligenceDetectVideoLabelsOperator |
python | langchain-ai__langchain | libs/langchain/langchain_classic/chains/query_constructor/schema.py | {
"start": 45,
"end": 277
} | class ____(BaseModel):
"""Information about a data source attribute."""
name: str
description: str
type: str
model_config = ConfigDict(
arbitrary_types_allowed=True,
frozen=True,
)
| AttributeInfo |
python | huggingface__transformers | src/transformers/models/pixtral/modeling_pixtral.py | {
"start": 11357,
"end": 12118
} | class ____(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
self.up_... | PixtralMLP |
python | google__pytype | pytype/tests/test_protocols2.py | {
"start": 24730,
"end": 32820
} | class ____(test_base.BaseTest):
"""Tests for non-method protocol attributes."""
def test_basic(self):
errors = self.CheckWithErrors("""
from typing import Protocol
class Foo(Protocol):
x: int
class Bar:
x: int
class Baz:
x: str
def f(foo: Foo):
pass... | ProtocolAttributesTest |
python | huggingface__transformers | tests/models/edgetam/test_modeling_edgetam.py | {
"start": 4094,
"end": 7514
} | class ____:
def __init__(
self,
parent,
num_channels=3,
image_size=128,
hidden_size=12,
patch_kernel_size=7,
patch_stride=4,
patch_padding=3,
dim_mul=2.0,
backbone_channel_list=[96, 48, 24, 12],
backbone_feature_sizes=[[32, 32],... | EdgeTamModelTester |
python | plotly__plotly.py | plotly/graph_objs/scattergl/_legendgrouptitle.py | {
"start": 233,
"end": 2953
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "scattergl"
_path_str = "scattergl.legendgrouptitle"
_valid_props = {"font", "text"}
@property
def font(self):
"""
Sets this legend group's title font.
The 'font' property is an instance of Font
that may be spe... | Legendgrouptitle |
python | allegroai__clearml | clearml/backend_api/services/v2_23/tasks.py | {
"start": 332532,
"end": 335444
} | class ____(Request):
"""
Indicates that task has failed
:param force: Allows forcing state change even if transition is not supported
:type force: bool
:param task: Task ID
:type task: str
:param status_reason: Reason for status change
:type status_reason: str
:param status_message:... | FailedRequest |
python | jazzband__django-oauth-toolkit | oauth2_provider/views/introspect.py | {
"start": 481,
"end": 2729
} | class ____(ClientProtectedScopedResourceView):
"""
Implements an endpoint for token introspection based
on RFC 7662 https://rfc-editor.org/rfc/rfc7662.html
To access this view the request must pass a OAuth2 Bearer Token
which is allowed to access the scope `introspection`.
"""
required_sco... | IntrospectTokenView |
python | django-import-export__django-import-export | import_export/results.py | {
"start": 6081,
"end": 8988
} | class ____:
def __init__(self, *args, **kwargs):
super().__init__()
self.base_errors = []
self.diff_headers = []
#: The rows associated with the result.
self.rows = []
#: The collection of rows which had validation errors.
self.invalid_rows = []
#: The... | Result |
python | getsentry__sentry | src/sentry/search/events/types.py | {
"start": 2122,
"end": 2544
} | class ____(TypedDict):
datasetReason: NotRequired[str]
fields: dict[str, str]
tips: NotRequired[dict[str, str | None]]
isMetricsData: NotRequired[bool]
isMetricsExtractedData: NotRequired[bool]
discoverSplitDecision: NotRequired[str]
# only returned when debug=True
debug_info: NotRequire... | EventsMeta |
python | apache__airflow | providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py | {
"start": 983,
"end": 2519
} | class ____:
"""Static defaults for Pods."""
XCOM_MOUNT_PATH = "/airflow/xcom"
SIDECAR_CONTAINER_NAME = "airflow-xcom-sidecar"
XCOM_CMD = 'trap "exit 0" INT; while true; do sleep 1; done;'
VOLUME_MOUNT = k8s.V1VolumeMount(name="xcom", mount_path=XCOM_MOUNT_PATH)
VOLUME = k8s.V1Volume(name="xcom"... | PodDefaults |
python | django__django | django/core/mail/message.py | {
"start": 6229,
"end": 6556
} | class ____(MIMEMixin, MIMEMessage):
def __setitem__(self, name, val):
# Per RFC 2046 Section 5.2.1, message/rfc822 attachment headers must be
# ASCII.
name, val = forbid_multi_line_headers(name, val, "ascii")
MIMEMessage.__setitem__(self, name, val)
# RemovedInDjango70Warning.
| SafeMIMEMessage |
python | django__django | django/contrib/admin/widgets.py | {
"start": 20179,
"end": 20263
} | class ____(AutocompleteMixin, forms.SelectMultiple):
pass
| AutocompleteSelectMultiple |
python | apache__airflow | providers/google/tests/unit/google/cloud/triggers/test_dataflow.py | {
"start": 7865,
"end": 13711
} | class ____:
def test_serialize(self, dataflow_job_autoscaling_event_trigger):
expected_data = (
"airflow.providers.google.cloud.triggers.dataflow.DataflowJobAutoScalingEventTrigger",
{
"project_id": PROJECT_ID,
"job_id": JOB_ID,
"locati... | TestDataflowJobAutoScalingEventTrigger |
python | google__pytype | pytype/tools/merge_pyi/test_data/enum_annot.pep484.py | {
"start": 95,
"end": 169
} | class ____(enum.Enum):
PEN = 1
PINEAPPLE = 2
APPLE = 3
PEN_2 = 4
| Fruit |
python | sympy__sympy | sympy/codegen/cnodes.py | {
"start": 2466,
"end": 2753
} | class ____(Basic):
""" Represents the pre-increment operator
Examples
========
>>> from sympy.abc import x
>>> from sympy.codegen.cnodes import PreIncrement
>>> from sympy import ccode
>>> ccode(PreIncrement(x))
'++(x)'
"""
nargs = 1
| PreIncrement |
python | pypa__pip | src/pip/_vendor/pkg_resources/__init__.py | {
"start": 9720,
"end": 10388
} | class ____(ResolutionError):
"""A requested distribution was not found"""
_template = (
"The '{self.req}' distribution was not found "
"and is required by {self.requirers_str}"
)
@property
def req(self) -> Requirement:
return self.args[0]
@property
def requirers(se... | DistributionNotFound |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/tabular/base.py | {
"start": 3972,
"end": 8836
} | class ____(BaseReader):
"""
Custom Excel parser that includes header names in each row.
Parses Excel files using Pandas' `read_excel` function, but formats
each row to include the header name, for example: "name: joao, position: analyst".
The first row (header) is not included in the generated docu... | PandasExcelReader |
python | pyqtgraph__pyqtgraph | pyqtgraph/flowchart/library/Operators.py | {
"start": 2397,
"end": 2588
} | class ____(BinOpNode):
"""Returns A - B. Does not check input types."""
nodeName = 'Subtract'
def __init__(self, name):
BinOpNode.__init__(self, name, '__sub__')
| SubtractNode |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/data_structures/fifo_queue_test.py | {
"start": 61782,
"end": 63789
} | class ____(test.TestCase):
def testConstructor(self):
with ops.Graph().as_default():
q = data_flow_ops.FIFOQueue(
5, (dtypes_lib.int32, dtypes_lib.float32),
names=("i", "j"),
shared_name="foo",
name="Q")
self.assertTrue(isinstance(q.queue_ref, tensor.Tensor))
... | FIFOQueueDictTest |
python | pallets__jinja | src/jinja2/nodes.py | {
"start": 12040,
"end": 12363
} | class ____(Stmt):
"""Specific node for with statements. In older versions of Jinja the
with statement was implemented on the base of the `Scope` node instead.
.. versionadded:: 2.9.3
"""
fields = ("targets", "values", "body")
targets: list["Expr"]
values: list["Expr"]
body: list[Node]... | With |
python | pypa__pip | src/pip/_vendor/rich/segment.py | {
"start": 610,
"end": 1206
} | class ____(IntEnum):
"""Non-printable control codes which typically translate to ANSI codes."""
BELL = 1
CARRIAGE_RETURN = 2
HOME = 3
CLEAR = 4
SHOW_CURSOR = 5
HIDE_CURSOR = 6
ENABLE_ALT_SCREEN = 7
DISABLE_ALT_SCREEN = 8
CURSOR_UP = 9
CURSOR_DOWN = 10
CURSOR_FORWARD = 11... | ControlType |
python | django__django | tests/validation/models.py | {
"start": 346,
"end": 1390
} | class ____(models.Model):
name = models.CharField(max_length=100)
created = models.DateTimeField(default=datetime.now)
number = models.IntegerField(db_column="number_val")
parent = models.ForeignKey(
"self",
models.SET_NULL,
blank=True,
null=True,
limit_choices_to... | ModelToValidate |
python | getsentry__sentry | src/sentry/replays/endpoints/project_replay_video_details.py | {
"start": 1187,
"end": 4781
} | class ____(ProjectEndpoint):
owner = ApiOwner.REPLAY
publish_status = {
"GET": ApiPublishStatus.EXPERIMENTAL,
}
@extend_schema(
operation_id="Fetch Replay Video",
parameters=[
GlobalParams.ORG_ID_OR_SLUG,
GlobalParams.PROJECT_ID_OR_SLUG,
Repla... | ProjectReplayVideoDetailsEndpoint |
python | ansible__ansible | test/lib/ansible_test/_internal/cli/actions.py | {
"start": 2223,
"end": 2508
} | class ____(CompositeAction):
"""Composite action parser for a units target."""
def create_parser(self) -> NamespaceParser:
"""Return a namespace parser to parse the argument associated with this action."""
return UnitsPythonTargetParser()
| UnitsPythonTargetAction |
python | django__django | tests/forms_tests/tests/test_media.py | {
"start": 2989,
"end": 3657
} | class ____(SimpleTestCase):
def test_init_with_src_kwarg(self):
self.assertEqual(
Script(src="path/to/js").path, "http://media.example.com/static/path/to/js"
)
def test_str(self):
self.assertHTMLEqual(
str(Script("path/to/js")),
'<script src="http://m... | ScriptTestCase |
python | encode__django-rest-framework | tests/test_validators.py | {
"start": 22874,
"end": 23256
} | class ____(models.Model):
title = models.CharField(max_length=100)
age = models.IntegerField(null=True)
tag = models.CharField(max_length=100, null=True)
class Meta:
constraints = [
# Unique constraint on 2 nullable fields
models.UniqueConstraint(name='unique_constraint'... | UniqueConstraintNullableModel |
python | facebook__pyre-check | source/interprocedural_analyses/taint/test/integration/properties.py | {
"start": 272,
"end": 806
} | class ____:
def __init__(self):
self.tainted = ""
self.untainted = ""
@property
def my_property(self) -> str:
return self.tainted
def uses_property(self):
self.tainted = _test_source()
return self.my_property
def uses_property_but_no_tito_taint(self):
... | Class |
python | tornadoweb__tornado | tornado/test/util_test.py | {
"start": 1518,
"end": 1787
} | class ____(TestConfigurable):
# TestConfig3 is a configuration option that is itself configurable.
@classmethod
def configurable_base(cls):
return TestConfig3
@classmethod
def configurable_default(cls):
return TestConfig3A
| TestConfig3 |
python | pypa__pip | src/pip/_vendor/resolvelib/structs.py | {
"start": 4556,
"end": 5517
} | class ____(Iterable[RT]):
"""Wrap an iterator factory returned by `find_matches()`.
Calling `iter()` on this class would invoke the underlying iterator
factory, making it a "collection with ordering" that can be iterated
through multiple times, but lacks random access methods presented in
built-in ... | _FactoryIterableView |
python | pandas-dev__pandas | pandas/tests/dtypes/test_generic.py | {
"start": 142,
"end": 4794
} | class ____:
tuples = [[1, 2, 2], ["red", "blue", "red"]]
multi_index = pd.MultiIndex.from_arrays(tuples, names=("number", "color"))
datetime_index = pd.to_datetime(["2000/1/1", "2010/1/1"])
timedelta_index = pd.to_timedelta(np.arange(5), unit="s")
period_index = pd.period_range("2000/1/1", "2010/1/1... | TestABCClasses |
python | ray-project__ray | python/ray/data/tests/test_state_export.py | {
"start": 1692,
"end": 2217
} | class ____:
"""A test dataclass for testing dataclass serialization."""
list_field: list = None
dict_field: dict = None
string_field: str = "test"
int_field: int = 1
float_field: float = 1.0
set_field: set = None
tuple_field: Tuple[int] = None
bool_field: bool = True
none_field:... | TestDataclass |
python | kamyu104__LeetCode-Solutions | Python/number-of-1-bits.py | {
"start": 728,
"end": 1722
} | class ____(object):
def __init__(self):
self.__popcount_tab = \
[ \
0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5, \
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6, \
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,... | Solution2 |
python | python__mypy | mypyc/ir/ops.py | {
"start": 53820,
"end": 55307
} | class ____(RegisterOp):
"""A no-op op to create a regular reference from a borrowed one.
Borrowed references can only be used temporarily and the reference
counts won't be managed. This value will be refcounted normally.
This is mainly useful if you split an aggregate value, such as
a tuple, into ... | Unborrow |
python | apache__airflow | airflow-core/tests/unit/models/test_connection.py | {
"start": 1319,
"end": 14301
} | class ____:
@pytest.fixture(autouse=True)
def clear_fernet_cache(self):
"""Clear the fernet cache before each test to avoid encryption issues."""
from airflow.models.crypto import get_fernet
get_fernet.cache_clear()
yield
get_fernet.cache_clear()
@pytest.mark.parame... | TestConnection |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.