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
openai__gym
gym/error.py
{ "start": 125, "end": 250 }
class ____(Error): """Raised when the user requests an item from the registry that does not actually exist."""
Unregistered
python
google__pytype
pytype/constant_folding.py
{ "start": 3020, "end": 3187 }
class ____: """A linear collection (e.g. list, tuple, set).""" types: frozenset[Any] values: tuple[Any, ...] elements: tuple[Any, ...] @attrs.define
_Collection
python
huggingface__transformers
src/transformers/integrations/integration_utils.py
{ "start": 89003, "end": 91487 }
class ____(TrainerCallback): """A [`TrainerCallback`] that sends the logs to [Flyte](https://flyte.org/). NOTE: This callback only works within a Flyte task. Args: save_log_history (`bool`, *optional*, defaults to `True`): When set to True, the training logs are saved as a Flyte Deck. ...
FlyteCallback
python
mkdocs__mkdocs
mkdocs/tests/plugin_tests.py
{ "start": 600, "end": 761 }
class ____(base.Config): foo = c.Type(str, default='default foo') bar = c.Type(int, default=0) dir = c.Optional(c.Dir(exists=False))
_DummyPluginConfig
python
dagster-io__dagster
python_modules/dagster/dagster/_config/pythonic_config/io_manager.py
{ "start": 1178, "end": 3336 }
class ____( # pyright: ignore[reportIncompatibleMethodOverride] NestedResourcesResourceDefinition, IOManagerDefinition, ): def __init__( self, configurable_resource_cls: type, resource_fn: ResourceFunction, config_schema: Any, description: Optional[str], nest...
ConfigurableIOManagerFactoryResourceDefinition
python
pytorch__pytorch
torchgen/_autoheuristic/train_decision.py
{ "start": 25383, "end": 25754 }
class ____: accuracy: AccuracyMetrics speedup: WrongSpeedupMetrics ranking: RankingMetrics default_comparison: DefaultComparisonMetrics def to_map(self): return { **self.accuracy.to_map(), **self.speedup.to_map(), **self.ranking.to_map(), **se...
EvalResults
python
django-import-export__django-import-export
tests/core/migrations/0005_addparentchild.py
{ "start": 76, "end": 1357 }
class ____(migrations.Migration): dependencies = [ ("core", "0004_bookwithchapters"), ] operations = [ migrations.CreateModel( name="Child", fields=[ ( "id", models.AutoField( auto_create...
Migration
python
PyCQA__pylint
tests/functional/a/arguments_differ.py
{ "start": 1666, "end": 1966 }
class ____(Super): # pylint: disable=unused-argument def __init__(self, arg): super().__init__() def __private(self, arg): pass def __private2_(self, arg): pass def ___private3(self, arg): pass def method(self, param='abc'): pass
Sub
python
django__django
tests/generic_relations/models.py
{ "start": 3105, "end": 3254 }
class ____(models.Model): id = models.IntegerField(primary_key=True) tags = GenericRelation(TaggedItem, related_query_name="manualpk")
ManualPK
python
PyCQA__pylint
pylint/pyreverse/diagrams.py
{ "start": 1113, "end": 1646 }
class ____(Figure): """A diagram object, i.e. a label associated to an astroid node.""" default_shape = "" def __init__( self, title: str = "No name", node: nodes.NodeNG | None = None ) -> None: super().__init__() self.title = title self.node: nodes.NodeNG = node or nod...
DiagramEntity
python
Unity-Technologies__ml-agents
ml-agents-envs/mlagents_envs/side_channel/environment_parameters_channel.py
{ "start": 219, "end": 3874 }
class ____(SideChannel): """ This is the SideChannel for sending environment parameters to Unity. You can send parameters to an environment with the command set_float_parameter. """ class EnvironmentDataTypes(IntEnum): FLOAT = 0 SAMPLER = 1 class SamplerTypes(IntEnum): ...
EnvironmentParametersChannel
python
sympy__sympy
sympy/tensor/array/expressions/array_expressions.py
{ "start": 27862, "end": 36629 }
class ____(_CodegenArrayAbstract): r""" Class to represent the diagonal operator. Explanation =========== In a 2-dimensional array it returns the diagonal, this looks like the operation: `A_{ij} \rightarrow A_{ii}` The diagonal over axes 1 and 2 (the second and third) of the tensor p...
ArrayDiagonal
python
run-llama__llama_index
llama-index-packs/llama-index-packs-self-rag/llama_index/packs/self_rag/base.py
{ "start": 4784, "end": 9493 }
class ____(CustomQueryEngine): """Simple short form self RAG query engine.""" llm: Any = Field(default=None, description="llm") retriever: BaseRetriever = Field(default=None, description="retriever") generate_kwargs: Dict = Field(default=None, description="llm generation arguments") verbose: bool =...
SelfRAGQueryEngine
python
pypa__pip
src/pip/_vendor/rich/rule.py
{ "start": 276, "end": 4598 }
class ____(JupyterMixin): """A console renderable to draw a horizontal rule (line). Args: title (Union[str, Text], optional): Text to render in the rule. Defaults to "". characters (str, optional): Character(s) used to draw the line. Defaults to "─". style (StyleType, optional): Style o...
Rule
python
tensorflow__tensorflow
tensorflow/python/platform/benchmark.py
{ "start": 7417, "end": 10411 }
class ____(metaclass=_BenchmarkRegistrar): """Abstract class that provides helper functions for running benchmarks. Any class subclassing this one is immediately registered in the global benchmark registry. Only methods whose names start with the word "benchmark" will be run during benchmarking. """ @c...
Benchmark
python
getsentry__sentry
tests/sentry/workflow_engine/endpoints/validators/test_base_data_condition.py
{ "start": 2271, "end": 2963 }
class ____(DataConditionHandler[dict[str, Any]]): comparison_json_schema = { "type": "object", "properties": { "foo": { "type": ["string"], }, }, "required": ["foo"], "additionalProperties": False, } condition_result_schema = {...
MockComplexDataConditionHandler
python
numba__numba
numba/core/typing/builtins.py
{ "start": 16602, "end": 16933 }
class ____(AbstractTemplate): def generic(self, args, kws): assert not kws (val,) = args if isinstance(val, (types.Buffer, types.BaseTuple)): return signature(types.intp, val) elif isinstance(val, (types.RangeType)): return signature(val.dtype, val) @infer_gl...
Len
python
PrefectHQ__prefect
src/prefect/settings/models/tasks.py
{ "start": 1978, "end": 4005 }
class ____(PrefectBaseSettings): model_config: ClassVar[SettingsConfigDict] = build_settings_config(("tasks",)) refresh_cache: bool = Field( default=False, description="If `True`, enables a refresh of cached results: re-executing the task will refresh the cached results.", ) default_no...
TasksSettings
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1477682, "end": 1478503 }
class ____(sgqlc.types.Type, Node): """A Saved Reply is text a user can use to reply quickly.""" __schema__ = github_schema __field_names__ = ("body", "body_html", "database_id", "title", "user") body = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="body") """The body of the saved re...
SavedReply
python
doocs__leetcode
solution/3600-3699/3667.Sort Array By Absolute Value/Solution.py
{ "start": 0, "end": 131 }
class ____: def sortByAbsoluteValue(self, nums: List[int]) -> List[int]: return sorted(nums, key=lambda x: abs(x))
Solution
python
django__django
tests/urlpatterns_reverse/tests.py
{ "start": 59240, "end": 63304 }
class ____(SimpleTestCase): def test_urlpattern_resolve(self): for ( path_, url_name, app_name, namespace, view_name, func, args, kwargs, ) in resolve_test_data: with self.subTest(path=path_):...
ResolverMatchTests
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_D.py
{ "start": 15583, "end": 16874 }
class ____(Benchmark): r""" Dolan objective function. This class defines the Dolan [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{Dolan}}(x) = \lvert (x_1 + 1.7 x_2)\sin(x_1) - 1.5 x_3 - 0.1 x_4\cos(x_5 + x_5 - x_...
Dolan
python
walkccc__LeetCode
solutions/642. Design Search Autocomplete System/642.py
{ "start": 455, "end": 1365 }
class ____: def __init__(self, sentences: list[str], times: list[int]): self.root = TrieNode() self.curr = self.root self.s: list[str] = [] for sentence, time in zip(sentences, times): self._insert(sentence, time) def input(self, c: str) -> list[str]: if c == '#': self._insert(''.j...
AutocompleteSystem
python
tensorflow__tensorflow
tensorflow/python/ops/ragged/row_partition_test.py
{ "start": 1953, "end": 37707 }
class ____(test_util.TensorFlowTestCase, parameterized.TestCase): # ============================================================================= # RowPartition class docstring examples # ============================================================================= def testClassDocStringExamples(self): # F...
RowPartitionTest
python
getsentry__sentry
src/sentry/workflow_engine/processors/delayed_workflow.py
{ "start": 4812, "end": 8180 }
class ____: """ Immutable container for all data from Redis. Any lookups or summaries or other processing that can be purely derived from the data should be done on this object so that it's obvious where we're operating based on parameter data. """ events: Mapping[EventKey, EventInstance] ...
EventRedisData
python
pytorch__pytorch
torch/_lazy/extract_compiled_graph.py
{ "start": 470, "end": 1853 }
class ____: """ The GraphInputMatcher class setup the graph inputs for future calls after lazy tracing. Specifically, those graph inputs corresponding to method parameters should be replaced with the arguments for the current call. tensor_id_to_arg_idx maps the tensor id to the parameter index. ...
GraphInputMatcher
python
zostera__django-bootstrap4
tests/test_paginator.py
{ "start": 163, "end": 1817 }
class ____(TestCase): def test_url_replace_param(self): self.assertEqual(url_replace_param("/foo/bar?baz=foo", "baz", "yohoo"), "/foo/bar?baz=yohoo") self.assertEqual(url_replace_param("/foo/bar?baz=foo", "baz", None), "/foo/bar") self.assertEqual(url_replace_param("/foo/bar#id", "baz", "foo...
PaginatorTest
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 153091, "end": 156916 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "branch_protection_rule_id", "pattern", "requires_approving_reviews", "required_approving_review_count", "requires_commit_signatures", ...
UpdateBranchProtectionRuleInput
python
patrick-kidger__equinox
equinox/internal/_primitive.py
{ "start": 2235, "end": 16418 }
class ____: __slots__ = ("treedef_out", "static_out", "__weakref__") def called(self): return hasattr(self, "treedef_out") def get(self): return self.treedef_out, self.static_out def __call__(self, out, like=_like_sentinel): if like is _like_sentinel: dynamic_out, ...
Flatten
python
chroma-core__chroma
chromadb/api/types.py
{ "start": 59700, "end": 59795 }
class ____: int_inverted_index: Optional[IntInvertedIndexType] = None @dataclass
IntValueType
python
tensorflow__tensorflow
tensorflow/python/training/monitored_session_test.py
{ "start": 10368, "end": 11188 }
class ____(session_run_hook.SessionRunHook): def __init__(self): self.should_stop = False self.request = None self.call_counter = collections.Counter() self.last_run_context = None self.last_run_values = None def begin(self): self.call_counter['begin'] += 1 def after_create_session(self...
FakeHook
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/partition_keys.py
{ "start": 769, "end": 960 }
class ____(graphene.Union): class Meta: types = (GraphenePartitionKeys, GraphenePartitionSubsetDeserializationError) name = "PartitionKeysOrError"
GraphenePartitionKeysOrError
python
realpython__materials
python-built-in-functions/point.py
{ "start": 14, "end": 297 }
class ____: def __init__(self, x, y): self.x = x self.y = y @classmethod def from_polar(cls, distance, angle): return cls( x=distance * math.cos(math.radians(angle)), y=distance * math.sin(math.radians(angle)), )
Point
python
huggingface__transformers
tests/models/roberta/test_modeling_roberta.py
{ "start": 14069, "end": 26142 }
class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = ( ( RobertaForCausalLM, RobertaForMaskedLM, RobertaModel, RobertaForSequenceClassification, RobertaForTokenClassification, ...
RobertaModelTest
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-ragie/destination_ragie/client.py
{ "start": 2690, "end": 20133 }
class ____: # --- Constants --- DEFAULT_API_URL = "https://api.ragie.ai" # Endpoint for JSON data uploads (assuming this is correct, based on previous impl) DOCUMENTS_RAW_ENDPOINT = "/documents/raw" # Endpoint for Listing/Deleting/Querying (based on previous impl and connection check) DOCUMENTS_...
RagieClient
python
python__mypy
mypy/join.py
{ "start": 10295, "end": 38962 }
class ____(TypeVisitor[ProperType]): """Implementation of the least upper bound algorithm. Attributes: s: The other (left) type operand. """ def __init__(self, s: ProperType, instance_joiner: InstanceJoiner | None = None) -> None: self.s = s self.instance_joiner = instance_joiner...
TypeJoinVisitor
python
tiangolo__fastapi
tests/test_duplicate_models_openapi.py
{ "start": 155, "end": 195 }
class ____(BaseModel): a: Model
Model2
python
pypa__pipenv
pipenv/patched/pip/_vendor/distlib/locators.py
{ "start": 1679, "end": 2945 }
class ____(BaseRedirectHandler): """ A class to work around a bug in some Python 3.2.x releases. """ # There's a bug in the base version for some 3.2.x # (e.g. 3.2.2 on Ubuntu Oneiric). If a Location header # returns e.g. /abc, it bails because it says the scheme '' # is bogus, when actuall...
RedirectHandler
python
dagster-io__dagster
python_modules/libraries/dagster-shared/dagster_shared/libraries/__init__.py
{ "start": 209, "end": 3586 }
class ____: _libraries: dict[str, str] = {"dagster-shared": __version__} @classmethod def register(cls, name: str, version: str, *, is_dagster_package: bool = True): if is_dagster_package: check_dagster_package_version(name, version) cls._libraries[name] = version @classme...
DagsterLibraryRegistry
python
mlflow__mlflow
tests/tracking/test_mlflow_artifacts.py
{ "start": 1027, "end": 15475 }
class ____(NamedTuple): backend_store_uri: str default_artifact_root: str artifacts_destination: str url: str process: subprocess.Popen @pytest.fixture(scope="module") def artifacts_server(): with tempfile.TemporaryDirectory() as tmpdir: port = get_safe_port() backend_store_uri...
ArtifactsServer
python
sympy__sympy
sympy/assumptions/predicates/calculus.py
{ "start": 1646, "end": 1903 }
class ____(Predicate): """ Positive infinity predicate. ``Q.positive_infinite(x)`` is true iff ``x`` is positive infinity ``oo``. """ name = 'positive_infinite' handler = Dispatcher("PositiveInfiniteHandler")
PositiveInfinitePredicate
python
PyCQA__pylint
pylint/pyreverse/inspector.py
{ "start": 1719, "end": 2642 }
class ____: """A project handle a set of modules / packages.""" def __init__(self, name: str = ""): self.name = name self.uid: int | None = None self.path: str = "" self.modules: list[nodes.Module] = [] self.locals: dict[str, nodes.Module] = {} self.__getitem__ =...
Project
python
realpython__materials
python-serialize/http-payload/fastapi-rest-api/main.py
{ "start": 187, "end": 612 }
class ____(UserIn): id: UUID = Field(default_factory=uuid4) created_at: datetime = Field(default_factory=datetime.now) users = [ UserOut(name="Alice"), UserOut(name="Bob"), ] @app.get("/users") async def get_users(): return users @app.post("/users", status_code=201) async def create_user(user_...
UserOut
python
pyqtgraph__pyqtgraph
pyqtgraph/flowchart/library/Data.py
{ "start": 12801, "end": 13164 }
class ____(CtrlNode): """Calculate the minimum of an array across an axis. """ nodeName = 'Min' uiTemplate = [ ('axis', 'intSpin', {'value': 0, 'min': -1, 'max': 1000000}), ] def processData(self, data): s = self.stateGroup.state() ax = None if s['axis'] == -1 else s...
Min
python
kamyu104__LeetCode-Solutions
Python/find-the-maximum-length-of-a-good-subsequence-i.py
{ "start": 63, "end": 665 }
class ____(object): def maximumLength(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ lookup = {x:i for i, x in enumerate(set(nums))} dp = [[0]*len(lookup) for _ in xrange(k+1)] result = [0]*(k+1) for x in nums: ...
Solution
python
tensorflow__tensorflow
tensorflow/python/ops/math_ops_test.py
{ "start": 49967, "end": 51418 }
class ____(test_util.TensorFlowTestCase, parameterized.TestCase): @test_util.run_all_in_graph_and_eager_modes def testEqualityNone(self): x = constant_op.constant([1.0, 2.0, 0.0, 4.0], dtype=dtypes.float32) self.assertNotEqual(x, None) self.assertNotEqual(None, x) self.assertFalse(math_ops.tensor_e...
EqualityTest
python
kamyu104__LeetCode-Solutions
Python/shortest-matching-substring.py
{ "start": 1777, "end": 3112 }
class ____(object): def shortestMatchingSubstring(self, s, p): """ :type s: str :type p: str :rtype: int """ INF = float("inf") def getPrefix(pattern): prefix = [-1]*len(pattern) j = -1 for i in xrange(1, len(pattern)): ...
Solution2
python
huggingface__transformers
src/transformers/models/qwen2/modular_qwen2.py
{ "start": 5542, "end": 5770 }
class ____(LlamaDecoderLayer): def __init__(self, config: Qwen2Config, layer_idx: int): super().__init__(config=config, layer_idx=layer_idx) self.attention_type = config.layer_types[layer_idx]
Qwen2DecoderLayer
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/no_self_use.py
{ "start": 703, "end": 891 }
class ____(abc.ABC): """abstract class""" @abstractmethod def abstract_method(self): """abstract method could not be a function""" raise NotImplementedError
Base
python
ansible__ansible
lib/ansible/modules/service.py
{ "start": 54413, "end": 61981 }
class ____(Service): """ This is the AIX Service (SRC) manipulation class - it uses lssrc, startsrc, stopsrc and refresh for service control. Enabling a service is currently not supported. Would require to add an entry in the /etc/inittab file (mkitab, chitab and rmitab commands) """ platfo...
AIX
python
spyder-ide__spyder
spyder/plugins/profiler/widgets/main_widget.py
{ "start": 847, "end": 1309 }
class ____: # Triggers Clear = 'clear_action' Collapse = 'collapse_action' Expand = 'expand_action' CallersOrCallees = "callers_or_callees_action" ToggleBuiltins = "toggle_builtins_action" Home = "HomeAction" SlowLocal = 'slow_local_action' LoadData = 'load_data_action' SaveData ...
ProfilerWidgetActions
python
pyinstaller__pyinstaller
PyInstaller/lib/modulegraph/modulegraph.py
{ "start": 23279, "end": 23473 }
class ____(Node): def __init__(self, filename): super(Script, self).__init__(filename) self.filename = filename def infoTuple(self): return (self.filename,)
Script
python
great-expectations__great_expectations
great_expectations/metrics/metric.py
{ "start": 517, "end": 755 }
class ____(TypeError): def __init__(self, class_name: str, mixin_superclass_name: str) -> None: super().__init__( f"`{class_name}` must use a single `{mixin_superclass_name}` subclass mixin." )
MixinTypeError
python
astropy__astropy
astropy/table/tests/test_init_table.py
{ "start": 10922, "end": 12500 }
class ____(BaseInitFromDictLike): def _setup(self, table_type): self.data = np.array( [(1, 2, 3), (3, 4, 5)], dtype=[("x", "i8"), ("y", "i4"), ("z", "i8")] ) def test_ndarray_ref(self, table_type): """Init with ndarray and copy=False and show that table uses reference ...
TestInitFromNdarrayStruct
python
pypa__setuptools
setuptools/_vendor/wheel/vendored/packaging/specifiers.py
{ "start": 2843, "end": 26453 }
class ____(BaseSpecifier): """This class abstracts handling of version specifiers. .. tip:: It is generally not required to instantiate this manually. You should instead prefer to work with :class:`SpecifierSet` instead, which can parse comma-separated version specifiers (which is what...
Specifier
python
aio-libs__aiohttp
aiohttp/web_exceptions.py
{ "start": 6285, "end": 6424 }
class ____(HTTPMove): status_code = 302 # This one is safe after a POST (the redirected location will be # retrieved with GET):
HTTPFound
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/linear_operator_addition_test.py
{ "start": 1121, "end": 1442 }
class ____(linear_operator_addition._Adder): """Adder that will fail if used.""" def can_add(self, op1, op2): raise AssertionError("BadAdder.can_add called!") def _add(self, op1, op2, operator_name, hints): raise AssertionError("This line should not be reached") # pylint: enable=unused-argument
_BadAdder
python
Pylons__pyramid
src/pyramid/authentication.py
{ "start": 42497, "end": 43451 }
class ____: """A helper for use with a :term:`security policy` which stores user data in the configured :term:`session`. Constructor Arguments ``prefix`` A prefix used when storing the authentication parameters in the session. Defaults to 'auth.'. Optional. """ def __init__(se...
SessionAuthenticationHelper
python
pytorch__pytorch
benchmarks/tensorexpr/elementwise.py
{ "start": 5619, "end": 6981 }
class ____(benchmark.Benchmark): def __init__(self, mode, device, dtype, N): super().__init__(mode, device, dtype) self.N = N self.data = self.rand( [N], device=device, dtype=dtype, requires_grad=self.requires_grad ) self.inputs = [self.data] def forward(self...
SimpleElementBench
python
spack__spack
lib/spack/spack/test/util/package_hash.py
{ "start": 11398, "end": 11816 }
class ____: def foo(self): print("ONE") @when("@1.0") def foo(self): print("TWO") @when("@2.0") @when(sys.platform == "darwin") def foo(self): print("THREE") @when("@3.0") def foo(self): print("FOUR") # this one should always stay @run_after("i...
Pkg
python
instagram__MonkeyType
tests/util.py
{ "start": 1487, "end": 2127 }
class ____: class Inner: def f(self) -> None: pass def transform_path(path: str) -> str: """Transform tests/test_foo.py to monkeytype.foo""" path = 'monkeytype/' + path[len('tests/'):] *basepath, file_name = path.split('/') basename, _ext = os.path.splitext(file_name[len('test_...
Outer
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/steps/python_registry.py
{ "start": 653, "end": 8585 }
class ____(Step): context: PythonRegistryPublishContext title = "Publish package to python registry" max_retries = 3 def _get_base_container(self) -> Container: return with_poetry(self.context) async def _get_package_metadata_from_pyproject_toml(self, package_dir_to_publish: Directory) -> ...
PublishToPythonRegistry
python
realpython__materials
dwitter-part-1/source_code_step_02/dwitter/models.py
{ "start": 75, "end": 344 }
class ____(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) follows = models.ManyToManyField( "self", related_name="followed_by", symmetrical=False, blank=True ) def __str__(self): return self.user.username
Profile
python
rapidsai__cudf
python/cudf_polars/cudf_polars/dsl/translate.py
{ "start": 6676, "end": 37698 }
class ____(AbstractContextManager[None]): __slots__ = ("_prev", "ctx", "translator") def __init__(self, translator: Translator, ctx: ExecutionContext) -> None: self.translator = translator self.ctx = ctx self._prev: ExecutionContext | None = None def __enter__(self) -> None: ...
set_expr_context
python
numba__numba
numba/core/cgutils.py
{ "start": 7039, "end": 7419 }
class ____(_StructProxy): """ Create a StructProxy suitable for accessing regular values (e.g. LLVM values or alloca slots). """ def _get_be_type(self, datamodel): return datamodel.get_value_type() def _cast_member_to_value(self, index, val): return val def _cast_member_fro...
ValueStructProxy
python
openai__openai-python
tests/api_resources/fine_tuning/jobs/test_checkpoints.py
{ "start": 2577, "end": 4907 }
class ____: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_list(self, async_client: AsyncOpenAI) -> None: checkpoint = await async_client.fine_tuning...
TestAsyncCheckpoints
python
tensorflow__tensorflow
tensorflow/python/keras/optimizer_v1.py
{ "start": 12940, "end": 16411 }
class ____(Optimizer): """Adadelta optimizer. Adadelta is a more robust extension of Adagrad that adapts learning rates based on a moving window of gradient updates, instead of accumulating all past gradients. This way, Adadelta continues learning even when many updates have been done. Compared to Adagrad, i...
Adadelta
python
sympy__sympy
sympy/solvers/diophantine/diophantine.py
{ "start": 13785, "end": 21970 }
class ____(DiophantineEquationType): """ Representation of a binary quadratic diophantine equation. A binary quadratic diophantine equation is an equation of the form `Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0`, where `A, B, C, D, E, F` are integer constants and `x` and `y` are integer variables. Ex...
BinaryQuadratic
python
getsentry__sentry
src/sentry/issues/ingest.py
{ "start": 4256, "end": 5513 }
class ____(TypedDict): platform: str | None message: str level: int | None culprit: str | None last_seen: datetime first_seen: datetime active_at: datetime type: int data: OccurrenceMetadata first_release: Release | None priority: int | None @sentry_sdk.tracing.trace def _c...
IssueArgs
python
sqlalchemy__sqlalchemy
test/sql/test_defaults.py
{ "start": 1235, "end": 4132 }
class ____(fixtures.TestBase, AssertsCompiledSQL): __dialect__ = "default" def test_string(self): # note: that the datatype is an Integer here doesn't matter, # the server_default is interpreted independently of the # column's datatype. m = MetaData() t = Table("t", m, C...
DDLTest
python
pytorch__pytorch
test/test_nestedtensor.py
{ "start": 32268, "end": 122449 }
class ____(NestedTensorTestCase): # Helper function to generate a pair of random nested tensors # the 2 nested tensors have same shapes def random_nt_pair(self, device, dtype, num_tensors, max_dims): ts1 = [] ts2 = [] for _ in range(num_tensors): tensor_dims = tuple( ...
TestNestedTensorDeviceType
python
cython__cython
Cython/Compiler/Nodes.py
{ "start": 19819, "end": 20422 }
class ____(CDeclaratorNode): # base CDeclaratorNode child_attrs = ["base"] def declared_name(self): return self.base.declared_name() def analyse_templates(self): return self.base.analyse_templates() def analyse(self, base_type, env, nonempty=0, visibility=None, in_pxd=False):...
CPtrDeclaratorNode
python
huggingface__transformers
src/transformers/models/speecht5/modeling_speecht5.py
{ "start": 43397, "end": 45734 }
class ____(GradientCheckpointingLayer): def __init__(self, config: SpeechT5Config): super().__init__() self.attention = SpeechT5Attention( embed_dim=config.hidden_size, num_heads=config.encoder_attention_heads, dropout=config.attention_dropout, is_deco...
SpeechT5EncoderLayer
python
kamyu104__LeetCode-Solutions
Python/fill-a-special-grid.py
{ "start": 746, "end": 1345 }
class ____(object): def specialGrid(self, n): """ :type n: int :rtype: List[List[int]] """ def divide_and_conquer(l, r, c): if l == 1: result[r][c] = idx[0] idx[0] += 1 return l >>= 1 for dr, ...
Solution2
python
psf__black
scripts/release_tests.py
{ "start": 257, "end": 600 }
class ____: """Used to mock the date to test generating next calver function""" def today(*args: Any, **kwargs: Any) -> "FakeDateTime": # noqa: B902 return FakeDateTime() # Add leading 0 on purpose to ensure we remove it def strftime(*args: Any, **kwargs: Any) -> str: # noqa: B902 re...
FakeDateTime
python
pytorch__pytorch
torch/_inductor/ir.py
{ "start": 175720, "end": 179032 }
class ____(TemplateBuffer): def __init__( self, layout: Layout, inputs: Sequence[IRNode], make_kernel_render: Optional[Callable[_P, _T]], mutated_inputs: Optional[Iterable[IRNode]] = None, allowed_prologue_inps: Optional[OrderedSet[str]] = None, ) -> None: ...
TritonTemplateBuffer
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/operators/test_emr_notebook_execution.py
{ "start": 9319, "end": 14342 }
class ____: @mock.patch("airflow.providers.amazon.aws.hooks.emr.EmrHook.conn") def test_stop_notebook_execution(self, mock_conn): mock_conn.stop_notebook_execution.return_value = None test_execution_id = "test-execution-id" op = EmrStopNotebookExecutionOperator( task_id="tes...
TestStopEmrNotebookExecutionOperator
python
PrefectHQ__prefect
src/integrations/prefect-databricks/prefect_databricks/models/jobs.py
{ "start": 14385, "end": 15385 }
class ____(str, Enum): """ * PENDING: Indicates that a cluster is in the process of being created. * RUNNING: Indicates that a cluster has been started and is ready for use. * RESTARTING: Indicates that a cluster is in the process of restarting. * RESIZING: Indicates that a cluster is in the pro...
ClusterState
python
huggingface__transformers
src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
{ "start": 51373, "end": 54953 }
class ____(GradientCheckpointingLayer): def __init__(self, config: SeamlessM4Tv2Config, decoder_ffn_dim=None, decoder_attention_heads=None): super().__init__() decoder_ffn_dim = config.decoder_ffn_dim if decoder_ffn_dim is None else decoder_ffn_dim decoder_attention_heads = ( con...
SeamlessM4Tv2TextToUnitDecoderLayer
python
prabhupant__python-ds
data_structures/graphs/number_of_triangles.py
{ "start": 315, "end": 986 }
class ____: def __init__(self, vertices, is_directed): self.V = vertices self.graph = [[] for i in range(vertices)] self.is_directed = is_directed def add_edge(self, u, v): self.graph[u].append(v) self.graph[v].append(u) def count_triangles(self): nodes =...
Graph
python
mwaskom__seaborn
seaborn/axisgrid.py
{ "start": 845, "end": 3106 }
class ____: """Base class for grids of subplots.""" def set(self, **kwargs): """Set attributes on each subplot Axes.""" for ax in self.axes.flat: if ax is not None: # Handle removed axes ax.set(**kwargs) return self @property def fig(self): ...
_BaseGrid
python
pytorch__pytorch
test/dynamo/cpython/3_13/typinganndata/ann_module.py
{ "start": 548, "end": 615 }
class ____(): z: int = 5 def __init__(self, x): pass
F
python
tox-dev__tox
src/tox/execute/local_sub_process/read_via_thread.py
{ "start": 603, "end": 1602 }
class ____(ABC): def __init__(self, file_no: int, handler: Callable[[bytes], None], name: str, drain: bool) -> None: # noqa: FBT001 self.file_no = file_no self.stop = Event() self.thread = Thread(target=self._read_stream, name=f"tox-r-{name}-{file_no}") self.handler = handler ...
ReadViaThread
python
Pylons__pyramid
docs/quick_tutorial/databases/tutorial/tests.py
{ "start": 478, "end": 946 }
class ____(unittest.TestCase): def setUp(self): self.session = _initTestingDB() self.config = testing.setUp() def tearDown(self): self.session.remove() testing.tearDown() def test_wiki_view(self): from tutorial.views import WikiViews request = testing.Dummy...
WikiViewTests
python
tensorflow__tensorflow
tensorflow/python/data/ops/iterator_ops.py
{ "start": 37742, "end": 39256 }
class ____(type_spec.TypeSpec): """Type specification for `tf.data.Iterator`. For instance, `tf.data.IteratorSpec` can be used to define a tf.function that takes `tf.data.Iterator` as an input argument: >>> @tf.function(input_signature=[tf.data.IteratorSpec( ... tf.TensorSpec(shape=(), dtype=tf.int32, nam...
IteratorSpec
python
sympy__sympy
sympy/liealgebras/weyl_group.py
{ "start": 178, "end": 14524 }
class ____(Atom): """ For each semisimple Lie group, we have a Weyl group. It is a subgroup of the isometry group of the root system. Specifically, it's the subgroup that is generated by reflections through the hyperplanes orthogonal to the roots. Therefore, Weyl groups are reflection groups, an...
WeylGroup
python
pytorch__pytorch
torch/nn/modules/rnn.py
{ "start": 62713, "end": 66931 }
class ____(RNNCellBase): r"""An Elman RNN cell with tanh or ReLU non-linearity. .. math:: h' = \tanh(W_{ih} x + b_{ih} + W_{hh} h + b_{hh}) If :attr:`nonlinearity` is `'relu'`, then ReLU is used in place of tanh. Args: input_size: The number of expected features in the input `x` ...
RNNCell
python
pytorch__pytorch
test/distributed/checkpoint/test_fsspec.py
{ "start": 2554, "end": 6239 }
class ____(ShardedTensorTestBase): @property def world_size(self) -> int: return 2 @with_comms(backend=BACKEND, init_rpc=False) @requires_accelerator_dist_backend() @skip_if_lt_x_gpu(2) @with_temp_dir def test_fsspec(self): CHECKPOINT_DIR = self.temp_dir model = FSD...
TestFSSpec
python
openai__openai-python
src/openai/types/evals/create_eval_completions_run_data_source.py
{ "start": 4783, "end": 5304 }
class ____(BaseModel): item_reference: str """A reference to a variable in the `item` namespace. Ie, "item.input_trajectory" """ type: Literal["item_reference"] """The type of input messages. Always `item_reference`.""" InputMessages: TypeAlias = Annotated[ Union[InputMessagesTemplate, InputMessa...
InputMessagesItemReference
python
ApeWorX__ape
src/ape/exceptions.py
{ "start": 14932, "end": 15198 }
class ____(ProjectError, AttributeError): """ Raised when trying to access items via ``.`` access. """ def __init__(self, msg: str, base_err: Optional[Exception] = None): self.base_err = base_err super().__init__(msg)
ApeAttributeError
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 673166, "end": 673527 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("client_mutation_id", "project_next") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") project_next = sgqlc.types.Field("ProjectNext", graphql_n...
UpdateProjectNextPayload
python
skorch-dev__skorch
skorch/callbacks/training.py
{ "start": 22553, "end": 23039 }
class ____(ParamMapper): """Freeze matching parameters at the start of the first epoch. You may specify a specific point in time (either by epoch number or using a callable) when the parameters are frozen using the ``at`` parameter. See :class:`.ParamMapper` for details. """ def __init__(self, ...
Freezer
python
ray-project__ray
doc/source/serve/doc_code/monitoring/request_id.py
{ "start": 59, "end": 265 }
class ____: def __call__(self) -> int: return 1 serve.run(Model.bind()) resp = requests.get("http://localhost:8000", headers={"X-Request-ID": "123-234"}) print(resp.headers["X-Request-ID"])
Model
python
weaviate__weaviate-python-client
weaviate/collections/classes/config.py
{ "start": 57101, "end": 57251 }
class ____: skip: bool vectorize_property_name: bool PropertyVectorizerConfig = _PropertyVectorizerConfig @dataclass
_PropertyVectorizerConfig
python
redis__redis-py
redis/cache.py
{ "start": 1564, "end": 2086 }
class ____(ABC): @property @abstractmethod def cache(self): pass @cache.setter @abstractmethod def cache(self, value): pass @property @abstractmethod def type(self) -> EvictionPolicyType: pass @abstractmethod def evict_next(self) -> CacheKey: ...
EvictionPolicyInterface
python
eventlet__eventlet
eventlet/green/zmq.py
{ "start": 7058, "end": 18018 }
class ____(_Socket): """Green version of :class:``zmq.core.socket.Socket``. The following three methods are always overridden: * send * recv * getsockopt To ensure that the ``zmq.NOBLOCK`` flag is set and that sending or receiving is deferred to the hub (using :func:``eventlet.h...
Socket
python
PyCQA__pylint
tests/functional/u/unsupported/unsupported_binary_operation.py
{ "start": 1738, "end": 1780 }
class ____(Unknown): pass Base() * 23
Base
python
spyder-ide__spyder
spyder/plugins/editor/widgets/splitter.py
{ "start": 819, "end": 11682 }
class ____(QSplitter, SpyderWidgetMixin): """QSplitter for editor windows.""" CONF_SECTION = "editor" def __init__(self, parent, main_widget, menu_actions, first=False, register_editorstack_cb=None, unregister_editorstack_cb=None, use_switcher=True): """Create a s...
EditorSplitter
python
gevent__gevent
src/gevent/ssl.py
{ "start": 2727, "end": 2974 }
class ____(socket._gevent_sock_class): __slots__ = ('_sslsock',) def __init__(self, family, type, proto, fileno, sslsocket_wref): super().__init__(family, type, proto, fileno) self._sslsock = sslsocket_wref
_contextawaresock
python
getsentry__sentry
src/sentry/replays/post_process.py
{ "start": 856, "end": 1049 }
class ____(TypedDict, total=False): id: str | None username: str | None email: str | None ip: str | None display_name: str | None geo: UserGeoResponseType
UserResponseType