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
cython__cython
Cython/Plex/Regexps.py
{ "start": 9998, "end": 10606 }
class ____(RE): """Rep1(re) is an RE which matches one or more repetitions of |re|.""" def __init__(self, re): self.check_re(1, re) self.re = re self.nullable = re.nullable self.match_nl = re.match_nl def build_machine(self, m, initial_state, final_state, match_bol, nocase)...
Rep1
python
tensorflow__tensorflow
tensorflow/lite/toco/logging/gen_html.py
{ "start": 2758, "end": 11025 }
class ____: """Utility class to generate an HTML report.""" def __init__(self, html_template_path, export_report_path): """Reads the HTML template content. Args: html_template_path: A string, path to the template HTML file. export_report_path: A string, path to the generated HTML report. This ...
HTMLGenerator
python
huggingface__transformers
src/transformers/models/qwen2_5_omni/modeling_qwen2_5_omni.py
{ "start": 47861, "end": 48767 }
class ____(GradientCheckpointingLayer): def __init__(self, config: Qwen2_5OmniVisionEncoderConfig) -> None: super().__init__() self.norm1 = Qwen2RMSNorm(config.hidden_size, eps=1e-6) self.norm2 = Qwen2RMSNorm(config.hidden_size, eps=1e-6) self.attn = Qwen2_5OmniVisionAttention(config...
Qwen2_5OmniVisionBlock
python
keras-team__keras
keras/src/trainers/data_adapters/data_adapter.py
{ "start": 0, "end": 3871 }
class ____: """Base class for input data adapters. The purpose of a DataAdapter is to provide a unified interface to iterate over input data provided in a variety of formats -- such as NumPy arrays, tf.Tensors, tf.data.Datasets, Keras PyDatasets, etc. """ def get_numpy_iterator(self): ...
DataAdapter
python
redis__redis-py
tests/test_search.py
{ "start": 147832, "end": 198468 }
class ____(SearchTestsBase): def _create_hybrid_search_index(self, client, dim=4): client.ft().create_index( ( TextField("description"), NumericField("price"), TagField("color"), TagField("item_type"), NumericField("...
TestHybridSearch
python
readthedocs__readthedocs.org
readthedocs/core/resolver.py
{ "start": 635, "end": 13798 }
class ____: """ Read the Docs URL Resolver. Url Types: - Subdomain - CNAME Path Types: - Subproject - Single Version - Normal All possible URL's:: Subdomain or CNAME: # Default /<lang>/<version>/<filename> # Single Version /<filename...
Resolver
python
huggingface__transformers
src/transformers/models/funnel/modeling_funnel.py
{ "start": 23980, "end": 27672 }
class ____(nn.Module): def __init__(self, config: FunnelConfig) -> None: super().__init__() self.config = config self.attention_structure = FunnelAttentionStructure(config) self.blocks = nn.ModuleList( [ nn.ModuleList([FunnelLayer(config, block_index) for ...
FunnelEncoder
python
kubernetes-client__python
kubernetes/client/models/v1_volume_mount.py
{ "start": 383, "end": 11879 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1VolumeMount
python
kamyu104__LeetCode-Solutions
Python/minimum-swaps-to-sort-by-digit-sum.py
{ "start": 48, "end": 833 }
class ____(object): def minSwaps(self, nums): """ :type nums: List[int] :rtype: int """ def total(x): result = 0 while x: result += x%10 x //= 10 return result totals = map(total, nums) idxs ...
Solution
python
jazzband__prettytable
tests/test_prettytable.py
{ "start": 8242, "end": 10196 }
class ____: """Make sure that building and stringing a table with no fieldnames works fine""" def test_can_string_ascii(self, field_name_less_table: PrettyTable) -> None: output = field_name_less_table.get_string() assert "| Field 1 | Field 2 | Field 3 | Field 4 |" in output assert "|...
TestFieldNameLessTable
python
ansible__ansible
test/lib/ansible_test/_internal/host_configs.py
{ "start": 1881, "end": 2223 }
class ____: """Context used when getting and applying defaults for host configurations.""" controller_config: t.Optional['PosixConfig'] @property def controller(self) -> bool: """True if the context is for the controller, otherwise False.""" return not self.controller_config @datacla...
HostContext
python
pytorch__pytorch
torch/distributed/tensor/_dispatch.py
{ "start": 3919, "end": 28672 }
class ____: """ Op dispatching class instance to handle args/kwargs pre-processing (un-wrapping), sharding propagation, redistribute local args, local compute, and post-processing (re-wrapping). It also handles any op specific logic if necessary. NOTE: Given the runtime overhead of Tensor subclass ...
OpDispatcher
python
django__django
tests/admin_views/admin.py
{ "start": 26737, "end": 26850 }
class ____(admin.TabularInline): model = DependentChild form = DependentChildAdminForm
DependentChildInline
python
streamlit__streamlit
lib/tests/streamlit/runtime/secrets_test.py
{ "start": 19782, "end": 23847 }
class ____(DeltaGeneratorTestCase): """Test that secrets falls back gracefully in various error scenarios.""" def setUp(self) -> None: super().setUp() self._orig_environ = dict(os.environ) st.secrets._reset() # Keep track of the original config self._orig_secrets_files ...
SecretsFallbackTest
python
kubernetes-client__python
kubernetes/base/dynamic/exceptions.py
{ "start": 1462, "end": 2600 }
class ____(ApiException): """ Generic API Error for the dynamic client """ def __init__(self, e, tb=None): self.status = e.status self.reason = e.reason self.body = e.body self.headers = e.headers self.original_traceback = tb def __str__(self): error_message ...
DynamicApiError
python
huggingface__transformers
src/transformers/models/layoutlm/modeling_layoutlm.py
{ "start": 15813, "end": 16520 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.transform = LayoutLMPredictionHeadTransform(config) # The output weights are the same as the input embeddings, but there is # an output-only bias for each token. self.decoder = nn.Linear(config.hidden...
LayoutLMLMPredictionHead
python
PrefectHQ__prefect
src/prefect/exceptions.py
{ "start": 11543, "end": 11768 }
class ____(ImportError): """ An error raised when a Prefect object cannot be imported due to a move or removal. """ def __init__(self, message: str) -> None: super().__init__(message)
PrefectImportError
python
apache__airflow
airflow-core/src/airflow/models/dag.py
{ "start": 10409, "end": 10897 }
class ____(Base): """A tag name per dag, to allow quick filtering in the DAG view.""" __tablename__ = "dag_tag" name: Mapped[str] = mapped_column(String(TAG_MAX_LEN), primary_key=True) dag_id: Mapped[str] = mapped_column( StringID(), ForeignKey("dag.dag_id", name="dag_tag_dag_id_fkey", ...
DagTag
python
tensorflow__tensorflow
tensorflow/python/data/experimental/ops/random_ops.py
{ "start": 1222, "end": 1472 }
class ____(random_op._RandomDataset): # pylint: disable=protected-access """A `Dataset` of pseudorandom values.""" @deprecation.deprecated(None, "Use `tf.data.Dataset.random(...)`.") @tf_export(v1=["data.experimental.RandomDataset"])
RandomDatasetV2
python
dagster-io__dagster
examples/development_to_production/development_to_production/resources.py
{ "start": 447, "end": 1293 }
class ____(HNClient): """Hacker News client that fetches live data.""" def fetch_item_by_id(self, item_id: int) -> Optional[dict[str, Any]]: """Fetches a single item from the Hacker News API by item id.""" item_url = f"https://hacker-news.firebaseio.com/v0/item/{item_id}.json" item = re...
HNAPIClient
python
spyder-ide__spyder
spyder/plugins/editor/widgets/editorstack/editorstack.py
{ "start": 3190, "end": 3492 }
class ____: GivenSection = "given_section" SwitcherSection = "switcher_path_section" CloseOrderSection = "close_order_section" SplitCloseSection = "split_close_section" WindowSection = "window_section" NewWindowCloseSection = "new_window_and_close_section"
EditorStackMenuSections
python
numba__numba
numba/cuda/deviceufunc.py
{ "start": 1523, "end": 10835 }
class ____(object): """ Prepare ufunc arguments for vectorize. """ DEFAULT_STREAM = None SUPPORT_DEVICE_SLICING = False def __init__(self, typemap, args): """Never used directly by user. Invoke by UFuncMechanism.call(). """ self.typemap = typemap self.args = args...
UFuncMechanism
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/msgpack/ext.py
{ "start": 513, "end": 5629 }
class ____: """Timestamp represents the Timestamp extension type in msgpack. When built with Cython, msgpack uses C methods to pack and unpack `Timestamp`. When using pure-Python msgpack, :func:`to_bytes` and :func:`from_bytes` are used to pack and unpack `Timestamp`. This class is immutable: Do n...
Timestamp
python
Netflix__metaflow
metaflow/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.py
{ "start": 753, "end": 1515 }
class ____(MetaflowException): """Raised when the SecretString response from AWS Secrets Manager is not valid JSON object (dictionary)""" def _sanitize_key_as_env_var(key): """ Sanitize a key as an environment variable name. This is purely a convenience trade-off to cover common cases well, vs. introd...
MetaflowAWSSecretsManagerNotJSONObject
python
pypa__hatch
tests/backend/metadata/test_core.py
{ "start": 31672, "end": 35337 }
class ____: def test_dynamic(self, isolation): metadata = ProjectMetadata(str(isolation), None, {"project": {"maintainers": 9000, "dynamic": ["maintainers"]}}) with pytest.raises( ValueError, match=( "Metadata field `maintainers` cannot be both statically def...
TestMaintainers
python
apache__airflow
task-sdk/src/airflow/sdk/execution_time/comms.py
{ "start": 12614, "end": 13718 }
class ____(AssetEventsResponse): """Response to GetAssetEvent request.""" type: Literal["AssetEventsResult"] = "AssetEventsResult" @classmethod def from_asset_events_response(cls, asset_events_response: AssetEventsResponse) -> AssetEventsResult: """ Get AssetEventsResult from AssetEven...
AssetEventsResult
python
huggingface__transformers
tests/quantization/mxfp4/test_mxfp4.py
{ "start": 12457, "end": 14713 }
class ____(unittest.TestCase): """Test mxfp4 integration functions""" def test_should_convert_module(self): """Test module conversion decision logic""" from transformers.integrations.mxfp4 import should_convert_module # Should convert by default self.assertTrue(should_convert_m...
Mxfp4IntegrationTest
python
marshmallow-code__marshmallow
tests/test_schema.py
{ "start": 75399, "end": 77331 }
class ____: def test_generates_schema(self): MySchema = Schema.from_dict({"foo": fields.Str()}) assert issubclass(MySchema, Schema) def test_name(self): MySchema = Schema.from_dict({"foo": fields.Str()}) assert "GeneratedSchema" in repr(MySchema) SchemaWithName = Schema....
TestFromDict
python
kamyu104__LeetCode-Solutions
Python/minimum-operations-to-equalize-binary-string.py
{ "start": 862, "end": 1711 }
class ____(object): def minOperations(self, s, k): """ :type s: str :type k: int :rtype: int """ def ceil_divide(a, b): return (a+b-1)//b zero = s.count('0') if len(s) == k: return 0 if zero == 0 else 1 if zero == len(s) else -...
Solution2
python
pytorch__pytorch
test/distributed/_composable/fsdp/test_fully_shard_ignore_params.py
{ "start": 1309, "end": 1697 }
class ____(nn.Module): def __init__(self, dim: int, subtrahend: torch.Tensor) -> None: super().__init__() self.lin_b = nn.Linear(dim, dim) self.module_c = C(dim) self.subtrahend = nn.Parameter(subtrahend) def forward(self, x: torch.Tensor) -> torch.Tensor: c_result = se...
B
python
huggingface__transformers
src/transformers/integrations/integration_utils.py
{ "start": 62416, "end": 62864 }
class ____(Exception): def __init__(self): super().__init__( """ ------ Unsupported ---- We were not able to create new runs. You provided a custom Neptune run to `NeptuneCallback` with the `run` argument. For the integration to work fully, provide your `api_token` and `p...
NeptuneMissingConfiguration
python
ray-project__ray
doc/source/ray-observability/doc_code/app_logging.py
{ "start": 127, "end": 239 }
class ____: def ready(self): print("actor") actor = Actor.remote() ray.get(actor.ready.remote())
Actor
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/upgrade_cdk/pipeline.py
{ "start": 770, "end": 7732 }
class ____(Step): context: ConnectorContext title = "Set CDK Version" def __init__( self, context: ConnectorContext, new_version: str, ) -> None: super().__init__(context) self.new_version = new_version async def _run(self) -> StepResult: context = s...
SetCDKVersion
python
getsentry__sentry
src/sentry/api/serializers/models/commit.py
{ "start": 650, "end": 929 }
class ____(TypedDict): id: str message: str | None dateCreated: datetime pullRequest: PullRequestSerializerResponse | None suspectCommitType: str repository: NotRequired[RepositorySerializerResponse] author: NotRequired[Author]
CommitSerializerResponse
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 145176, "end": 146619 }
class ____(Operation): def __init__(self, axis=None, keepdims=False, initial=None, *, name=None): super().__init__(name=name) if isinstance(axis, int): self.axis = [axis] else: self.axis = axis self.keepdims = keepdims self.initial = initial def c...
Max
python
huggingface__transformers
src/transformers/models/tapas/modeling_tapas.py
{ "start": 57985, "end": 59186 }
class ____: """Index grouping entries within a tensor.""" def __init__(self, indices, num_segments, batch_dims=0): """ Creates an index Args: indices (`torch.LongTensor`, same shape as a *values* Tensor to which the indices refer): Tensor containing the indi...
IndexMap
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol34.py
{ "start": 275, "end": 442 }
class ____(Generic[T]): def f(self) -> T: raise NotImplementedError def g(self) -> X: # This should generate a type error. return Y[T]()
Y
python
vyperlang__vyper
vyper/builtins/functions.py
{ "start": 27209, "end": 28064 }
class ____(BuiltinFunctionT): @process_inputs def build_IR(self, expr, _args, kwargs, context): args_tuple = ir_tuple_from_args(_args) args_t = args_tuple.typ input_buf = context.new_internal_variable(args_t) ret_t = self._return_type ret = ["seq"] ret.append(ma...
_ECArith
python
huggingface__transformers
src/transformers/models/gemma3n/modeling_gemma3n.py
{ "start": 41200, "end": 42581 }
class ____(nn.Module): def __init__(self, config: Gemma3nAudioConfig): super().__init__() self.config = config self.ffw_layer_start = Gemma3nAudioConformerFeedForward(self.config) self.attention = Gemma3nAudioConformerAttention(self.config) self.lconv1d = Gemma3nAudioConform...
Gemma3nAudioConformerBlock
python
langchain-ai__langchain
libs/standard-tests/tests/unit_tests/test_in_memory_vectorstore.py
{ "start": 226, "end": 450 }
class ____(VectorStoreIntegrationTests): @pytest.fixture def vectorstore(self) -> VectorStore: embeddings = self.get_embeddings() return InMemoryVectorStore(embedding=embeddings)
TestInMemoryVectorStore
python
google__jax
jax/_src/sharding_impls.py
{ "start": 25975, "end": 46521 }
class ____(ValueError): """Raised when sharding is not uniform across processes.""" @util.cache(max_size=4096, trace_context_in_key=False) def get_process_index_and_count( tensor_sharding: jsharding.Sharding, dim: int, ndims: int) -> tuple[int, int]: """Get current process index and number of unique processes...
NonUniformShardingError
python
gevent__gevent
src/gevent/tests/test__event.py
{ "start": 12539, "end": 12587 }
class ____(TestWait): count = 2
TestWait_count2
python
optuna__optuna
optuna/visualization/_intermediate_values.py
{ "start": 439, "end": 568 }
class ____(NamedTuple): trial_number: int sorted_intermediate_values: list[tuple[int, float]] feasible: bool
_TrialInfo
python
PrefectHQ__prefect
tests/server/models/test_artifacts.py
{ "start": 20147, "end": 25163 }
class ____: async def test_reading_artifacts_by_ids(self, artifacts, session): artifact_ids = [artifact.id for artifact in artifacts] artifact_filter = schemas.filters.ArtifactFilter( id=schemas.filters.ArtifactFilterId( any_=[artifact_ids[0], artifact_ids[1], artifact_id...
TestReadingMultipleArtifacts
python
sympy__sympy
sympy/stats/stochastic_process_types.py
{ "start": 10854, "end": 11397 }
class ____(Boolean): """ Assumes that the matrix is the transition matrix of the process. """ def __new__(cls, process, matrix): if not isinstance(process, DiscreteMarkovChain): raise ValueError("Currently only DiscreteMarkovChain " "support Trans...
TransitionMatrixOf
python
PrefectHQ__prefect
src/prefect/server/events/actions.py
{ "start": 15531, "end": 24450 }
class ____(ExternalDataAction): """Base class for Actions that use Jinja templates supplied by the user and are rendered with a context containing data from the triggered action, and the orchestration API.""" _object_cache: Dict[str, TemplateContextObject] = PrivateAttr(default_factory=dict) _regi...
JinjaTemplateAction
python
apache__airflow
providers/apache/cassandra/src/airflow/providers/apache/cassandra/hooks/cassandra.py
{ "start": 1400, "end": 8235 }
class ____(BaseHook, LoggingMixin): """ Hook used to interact with Cassandra. Contact points can be specified as a comma-separated string in the 'hosts' field of the connection. Port can be specified in the port field of the connection. If SSL is enabled in Cassandra, pass in a dict in the ex...
CassandraHook
python
vyperlang__vyper
vyper/ast/nodes.py
{ "start": 47396, "end": 47457 }
class ____(Stmt): __slots__ = ("test", "body", "orelse")
If
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 533988, "end": 534637 }
class ____(sgqlc.types.relay.Connection): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field( sgqlc.types.list_of("PullRequestCommitEdge"), graphql_name="edges" ) nodes = s...
PullRequestCommitConnection
python
walkccc__LeetCode
solutions/2483. Minimum Penalty for a Shop/2483.py
{ "start": 0, "end": 379 }
class ____: def bestClosingTime(self, customers: str) -> int: # Instead of computing the minimum penalty, we can compute the maximum profit. ans = 0 profit = 0 maxProfit = 0 for i, customer in enumerate(customers): profit += 1 if customer == 'Y' else -1 if profit > maxProfit: ...
Solution
python
huggingface__transformers
src/transformers/models/deepseek_vl/modular_deepseek_vl.py
{ "start": 6562, "end": 6792 }
class ____(JanusImageProcessorFast): def __init__(self, **super_kwargs): super().__init__(**super_kwargs) def postprocess(self): raise AttributeError("Not needed for DeepseekVL")
DeepseekVLImageProcessorFast
python
bokeh__bokeh
tests/unit/bokeh/embed/test_bundle.py
{ "start": 3522, "end": 5519 }
class ____: @classmethod def setup_class(cls): base_dir = dirname(__file__) build(join(base_dir, "latex_label"), rebuild=True) @classmethod def teardown_class(cls): from latex_label import LatexLabel _default_resolver.remove(LatexLabel) extension_dirs.clear() ...
Test_bundle_custom_extensions
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_types.py
{ "start": 224820, "end": 226773 }
class ____(testing.AssertsCompiledSQL, fixtures.TablesTest): __requires__ = ("citext",) __only_on__ = "postgresql" __backend__ = True @classmethod def define_tables(cls, metadata): Table( "ci_test_table", metadata, Column("id", Integer, primary_key=True),...
CITextTest
python
huggingface__transformers
src/transformers/models/siglip/configuration_siglip.py
{ "start": 5416, "end": 8979 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`SiglipVisionModel`]. It is used to instantiate a Siglip vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a ...
SiglipVisionConfig
python
neetcode-gh__leetcode
python/0104-maximum-depth-of-binary-tree.py
{ "start": 577, "end": 999 }
class ____: def maxDepth(self, root: TreeNode) -> int: q = deque() if root: q.append(root) level = 0 while q: for i in range(len(q)): node = q.popleft() if node.left: q.append(node.left) if...
Solution
python
huggingface__transformers
src/transformers/models/visual_bert/modeling_visual_bert.py
{ "start": 37120, "end": 45984 }
class ____(VisualBertPreTrainedModel): def __init__(self, config): super().__init__(config) self.visual_bert = VisualBertModel(config) self.dropout = nn.Dropout(config.hidden_dropout_prob) self.cls = nn.Linear(config.hidden_size, 1) # Initialize weights and apply final proc...
VisualBertForMultipleChoice
python
spack__spack
lib/spack/spack/vendor/attr/_make.py
{ "start": 95758, "end": 97582 }
class ____: """ Compose many validators to a single one. """ _validators = attrib() def __call__(self, inst, attr, value): for v in self._validators: v(inst, attr, value) def and_(*validators): """ A validator that composes multiple validators into one. When call...
_AndValidator
python
great-expectations__great_expectations
contrib/experimental/great_expectations_experimental/expectations/expect_multicolumn_datetime_difference_in_months.py
{ "start": 611, "end": 1905 }
class ____(MulticolumnMapMetricProvider): condition_metric_name = "multicolumn_values.column_datetime_difference_in_months" # These point your metric at the provided keys to facilitate calculation condition_domain_keys = ( "batch_id", "table", "column_list", "row_condition", ...
MulticolumnDatetimeDifferenceInMonths
python
conda__conda
conda/plugins/types.py
{ "start": 16907, "end": 17383 }
class ____(CondaPlugin): """ **EXPERIMENTAL** Return type to use when defining a conda env spec plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_environment_specifiers`. :param name: name of the spec (e.g., ``environment_yaml``) :param envi...
CondaEnvironmentSpecifier
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-nebius/llama_index/embeddings/nebius/base.py
{ "start": 475, "end": 2495 }
class ____(OpenAIEmbedding): """ Nebius class for embeddings. Args: model (str): Model for embedding. Defaults to "BAAI/bge-en-icl" """ additional_kwargs: Dict[str, Any] = Field( default_factory=dict, description="Additional kwargs for the OpenAI API." ) api_key: str = Fi...
NebiusEmbedding
python
google__flatbuffers
python/flatbuffers/reflection/SchemaFile.py
{ "start": 334, "end": 3057 }
class ____(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) x = SchemaFile() x.Init(buf, n + offset) return x @classmethod def GetRootAsSchemaFile(cls, buf, offset=0): ...
SchemaFile
python
tox-dev__tox
src/tox/tox_env/python/virtual_env/package/cmd_builder.py
{ "start": 1220, "end": 6101 }
class ____(PythonPackageToxEnv, ABC): def __init__(self, create_args: ToxEnvCreateArgs) -> None: super().__init__(create_args) self._sdist_meta_tox_env: Pep517VirtualEnvPackager | None = None def register_config(self) -> None: super().register_config() root = self.core["toxinidi...
VenvCmdBuilder
python
ipython__ipython
IPython/core/display.py
{ "start": 13524, "end": 14592 }
class ____(TextDisplayObject): def __init__(self, data=None, url=None, filename=None, metadata=None): def warn(): if not data: return False # # Avoid calling lower() on the entire data, because it could be a # long string and we're only inter...
HTML
python
jina-ai__jina
tests/integration/docarray_v2/csp/SampleColbertExecutor/executor.py
{ "start": 595, "end": 667 }
class ____(BaseDoc): results: DocList[RankedObjectOutput]
RankedOutput
python
doocs__leetcode
solution/0300-0399/0328.Odd Even Linked List/Solution.py
{ "start": 151, "end": 503 }
class ____: def oddEvenList(self, head: Optional[ListNode]) -> Optional[ListNode]: if head is None: return None a = head b = c = head.next while b and b.next: a.next = b.next a = a.next b.next = a.next b = b.next a.n...
Solution
python
tensorflow__tensorflow
tensorflow/python/ops/collective_ops_xla_test.py
{ "start": 1126, "end": 3014 }
class ____(test.TestCase): def testScopedAllocatorWithXla(self): group_size = 2 group_key = 1 instance_key1 = 1 instance_key2 = 2 tensor_size = 10 graph_options = config_pb2.GraphOptions( optimizer_options=config_pb2.OptimizerOptions( do_constant_folding=False)) cfg =...
CollectiveOpXlaTest
python
getsentry__sentry
src/sentry/sentry_metrics/indexer/cache.py
{ "start": 8651, "end": 12975 }
class ____(StringIndexer): def __init__(self, cache: StringIndexerCache, indexer: StringIndexer) -> None: self.cache = cache self.indexer = indexer def bulk_record( self, strings: Mapping[UseCaseID, Mapping[OrgId, set[str]]] ) -> UseCaseKeyResults: cache_keys = UseCaseKeyCol...
CachingIndexer
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/sensors/bedrock.py
{ "start": 6178, "end": 9177 }
class ____(BedrockBaseSensor[BedrockHook]): """ Poll the provisioned model throughput job until it reaches a terminal state; fails if the job fails. .. seealso:: For more information on how to use this sensor, take a look at the guide: :ref:`howto/sensor:BedrockProvisionModelThroughputCompl...
BedrockProvisionModelThroughputCompletedSensor
python
pytorch__pytorch
torch/testing/_internal/logging_tensor.py
{ "start": 3303, "end": 5095 }
class ____(logging.Handler): def __init__( self, log_list: list[str], use_shortid_for_all_tensors: bool, with_type: bool, tracebacks_list: Optional[list]) -> None: logging.Handler.__init__(self) self.log_list = log_list self.use_shortid_for_all_tensors = use_shortid_f...
LoggingTensorHandler
python
modin-project__modin
modin/core/storage_formats/pandas/parsers.py
{ "start": 30699, "end": 32072 }
class ____(PandasParser): @staticmethod @doc( _doc_parse_func, parameters="""fname : str, path object or file-like object Name of the file, path or file-like object to read.""", ) def parse(fname, **kwargs): from pyarrow import feather num_splits = kwargs.pop("num_sp...
PandasFeatherParser
python
pypa__warehouse
warehouse/captcha/hcaptcha.py
{ "start": 353, "end": 399 }
class ____(CaptchaError): pass
HCaptchaError
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/roles.py
{ "start": 7202, "end": 7325 }
class ____(StructuralRole): __slots__ = () _role_name = "SQL expression element for DDL constraint"
DDLExpressionRole
python
pytorch__pytorch
torch/cuda/__init__.py
{ "start": 58092, "end": 58865 }
class ____(_CudaLegacyStorage): @classproperty def dtype(self): _warn_typed_storage_removal() return self._dtype @classproperty def _dtype(self): return torch.cfloat del _LegacyStorage del _CudaLegacyStorage torch._storage_classes.add(DoubleStorage) torch._storage_classes.add...
ComplexFloatStorage
python
readthedocs__readthedocs.org
readthedocs/api/v3/serializers.py
{ "start": 21445, "end": 22844 }
class ____(TaggitSerializer, serializers.ModelSerializer): """Serializer used to modify a Project once imported.""" repository = RepositorySerializer(source="*") homepage = serializers.URLField( source="project_url", required=False, ) tags = TagListSerializerField(required=False) ...
ProjectUpdateSerializerBase
python
kamyu104__LeetCode-Solutions
Python/minimum-operations-to-make-a-special-number.py
{ "start": 44, "end": 458 }
class ____(object): def minimumOperations(self, num): """ :type num: str :rtype: int """ lookup = [0]*10 for i in reversed(xrange(len(num))): if ((num[i] in "05" and lookup[0]) or (num[i] in "27" and lookup[5])): return (len...
Solution
python
readthedocs__readthedocs.org
readthedocs/subscriptions/tests/test_signals.py
{ "start": 302, "end": 2624 }
class ____(PaymentMixin, TestCase): def setUp(self): super().setUp() email = "test@example.com" self.user = get(User) self.stripe_customer = get( djstripe.Customer, email=email, name="org", ) self.organization = get( Or...
TestSignals
python
django__django
tests/postgres_tests/array_index_migrations/0001_initial.py
{ "start": 81, "end": 1162 }
class ____(migrations.Migration): dependencies = [] operations = [ migrations.CreateModel( name="CharTextArrayIndexModel", fields=[ ( "id", models.BigAutoField( verbose_name="ID", ...
Migration
python
huggingface__transformers
src/transformers/models/owlvit/modeling_owlvit.py
{ "start": 49664, "end": 50305 }
class ____(nn.Module): def __init__(self, config: OwlViTConfig, out_dim: int = 4): super().__init__() width = config.vision_config.hidden_size self.dense0 = nn.Linear(width, width) self.dense1 = nn.Linear(width, width) self.gelu = nn.GELU() self.dense2 = nn.Linear(wi...
OwlViTBoxPredictionHead
python
nedbat__coveragepy
tests/test_xml.py
{ "start": 21094, "end": 22818 }
class ____(CoverageTest): """Tests of XML reporting that use gold files.""" def test_a_xml_1(self) -> None: self.make_file( "a.py", """\ if 1 < 2: # Needed a < to look at HTML entities. a = 3 else: a = 4 ...
XmlGoldTest
python
pytorch__pytorch
test/inductor/test_b2b_gemm.py
{ "start": 424, "end": 14583 }
class ____(TestCase): device = GPU_TYPE @torch._dynamo.config.patch(recompile_limit=32) @torch._inductor.config.patch(b2b_gemm_pass=True) def test_b2b_gemm_left_assoc_good_shape(self): """ left_assoc means the pattern is (subgraph(A @ B) @ C) good_shape means the sizes are good ...
B2BGEMMTest
python
readthedocs__readthedocs.org
readthedocs/api/v3/views.py
{ "start": 10366, "end": 10456 }
class ____(SettingsOverrideObject): _default_class = ProjectsViewSetBase
ProjectsViewSet
python
ray-project__ray
python/ray/data/_internal/execution/interfaces/op_runtime_metrics.py
{ "start": 1501, "end": 1600 }
class ____(Enum): Counter = 0 Gauge = 1 Histogram = 2 @dataclass(frozen=True)
MetricsType
python
getsentry__sentry
tests/sentry/integrations/slack/webhooks/commands/test_link_user.py
{ "start": 795, "end": 1337 }
class ____(SlackCommandsTest): """Slack Linking Views are returned on Control Silo""" def test_link_user_identity(self) -> None: linking_url = build_linking_url( self.integration, self.external_id, self.channel_id, self.response_url ) response = self.client.post(linking_url...
SlackLinkIdentityViewTest
python
dask__dask
dask/dataframe/io/demo.py
{ "start": 862, "end": 2709 }
class ____: """Encapsulates properties of a family of columns with the same dtype. Different method can be specified for integer dtype ("poisson", "uniform", "binomial", etc.) Notes ----- This API is still experimental, and will likely change in the future""" prefix: str | None = None ...
ColumnSpec
python
doocs__leetcode
solution/2500-2599/2543.Check if Point Is Reachable/Solution.py
{ "start": 0, "end": 145 }
class ____: def isReachable(self, targetX: int, targetY: int) -> bool: x = gcd(targetX, targetY) return x & (x - 1) == 0
Solution
python
scikit-learn__scikit-learn
sklearn/utils/tests/test_array_api.py
{ "start": 16256, "end": 32100 }
class ____(BaseEstimator): def fit(self, X, y=None): self.X_ = X self.n_features_ = X.shape[0] return self @skip_if_array_api_compat_not_configured @pytest.mark.parametrize( "array_namespace, converter", [ ("torch", lambda array: array.cpu().numpy()), ("array_api_st...
SimpleEstimator
python
bottlepy__bottle
bottle.py
{ "start": 6891, "end": 7466 }
class ____: """ A property that caches itself to the class object. """ def __init__(self, func): functools.update_wrapper(self, func, updated=[]) self.getter = func def __get__(self, obj, cls): value = self.getter(cls) setattr(cls, self.__name__, value) return value...
lazy_attribute
python
sqlalchemy__sqlalchemy
test/typing/plain_files/orm/dynamic_rel.py
{ "start": 673, "end": 1980 }
class ____(Base): __tablename__ = "user" id: Mapped[int] = mapped_column(primary_key=True) addresses: DynamicMapped[Address] = relationship( cascade="all,delete-orphan" ) with Session() as session: u = User() session.add(u) session.commit() if typing.TYPE_CHECKING: ass...
User
python
run-llama__llama_index
llama-index-experimental/llama_index/experimental/query_engine/polars/output_parser.py
{ "start": 3133, "end": 3750 }
class ____(BaseOutputParser): """ Polars instruction parser. This 'output parser' takes in polars instructions (in Python code) and executes them to return an output. """ def __init__( self, df: pl.DataFrame, output_kwargs: Optional[Dict[str, Any]] = None ) -> None: """Ini...
PolarsInstructionParser
python
python__mypy
mypy/test/data.py
{ "start": 29542, "end": 30174 }
class ____: # option fields - class variables files: list[str] base_path = test_temp_dir # Allow external users of the test code to override the data prefix data_prefix = test_data_prefix required_out_section = False native_sep = False # Name suffix automatically added to each test ...
DataSuite
python
allegroai__clearml
clearml/storage/cache.py
{ "start": 510, "end": 16559 }
class ____(object): __cache_managers = {} _default_cache_file_limit = deferred_config("storage.cache.default_cache_manager_size", 100) _storage_manager_folder = "storage_manager" _default_context = "global" _local_to_remote_url_lookup = OrderedDict() __local_to_remote_url_lookup_max_size = 1024 ...
CacheManager
python
GoogleCloudPlatform__python-docs-samples
appengine/standard/ndb/properties/snippets.py
{ "start": 1629, "end": 2350 }
class ____(ndb.Model): name = ndb.StringProperty() addresses = ndb.LocalStructuredProperty(Address, repeated=True) def create_contact(): guido = Contact( name="Guido", addresses=[ Address(type="home", city="Amsterdam"), Address(type="work", street="Spear St", city="...
ContactWithLocalStructuredProperty
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/skills/version_create_response.py
{ "start": 160, "end": 1187 }
class ____(BaseModel): id: str """Unique identifier for the skill version. The format and length of IDs may change over time. """ created_at: str """ISO 8601 timestamp of when the skill version was created.""" description: str """Description of the skill version. This is extracte...
VersionCreateResponse
python
numpy__numpy
numpy/distutils/log.py
{ "start": 470, "end": 2879 }
class ____(old_Log): def _log(self, level, msg, args): if level >= self.threshold: if args: msg = msg % _fix_args(args) if 0: if msg.startswith('copying ') and msg.find(' -> ') != -1: return if msg.startswith('byte-c...
Log
python
eth-brownie__brownie
brownie/utils/docopt.py
{ "start": 12237, "end": 12727 }
class ____(_BranchPattern): def match(self, left: list[_Pattern], collected: list[_Pattern] | None = None) -> Any: collected = [] if collected is None else collected original_collected = collected original_left = left for pattern in self.children: matched, left, collected...
_Required
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVarDefaultClass2.py
{ "start": 3230, "end": 3385 }
class ____(Generic[P4, T1]): ... Ts1 = TypeVarTuple("Ts1", default=Unpack[tuple[T1, T2]]) Ts2 = TypeVarTuple("Ts2", default=Unpack[tuple[T1, ...]])
ClassPD
python
pypa__setuptools
setuptools/command/egg_info.py
{ "start": 25751, "end": 25888 }
class ____(SetuptoolsDeprecationWarning): """Deprecated behavior warning for EggInfo, bypassing suppression."""
EggInfoDeprecationWarning
python
doocs__leetcode
solution/0100-0199/0113.Path Sum II/Solution.py
{ "start": 192, "end": 690 }
class ____: def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]: def dfs(root, s): if root is None: return s += root.val t.append(root.val) if root.left is None and root.right is None and s == targetSum: ...
Solution
python
Pylons__pyramid
tests/test_config/test_views.py
{ "start": 148521, "end": 148667 }
class ____: def __init__(self, val, config): self.val = val def text(self): return 'dummy' phash = text
DummyPredicate
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/operator1.py
{ "start": 1503, "end": 1667 }
class ____: def __init__(self): self.__add__ = lambda x: x d = D() # This should generate an error because __add__ is not a class variable. _ = d + d
D