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
pydata__xarray
xarray/groupers.py
{ "start": 28357, "end": 31006 }
class ____(Grouper): """Allows grouping using a custom definition of seasons. Parameters ---------- seasons: sequence of str List of strings representing seasons. E.g. ``"JF"`` or ``"JJA"`` etc. Overlapping seasons are allowed (e.g. ``["DJFM", "MAMJ", "JJAS", "SOND"]``) Examples ...
SeasonGrouper
python
getsentry__sentry
tests/sentry/notifications/notification_action/test_issue_alert_registry_handlers.py
{ "start": 13174, "end": 14188 }
class ____(BaseWorkflowTest): def setUp(self) -> None: super().setUp() self.handler = MSTeamsIssueAlertHandler() self.detector = self.create_detector(project=self.project) self.action = self.create_action( type=Action.Type.MSTEAMS, integration_id="1234567890",...
TestMSTeamsIssueAlertHandler
python
optuna__optuna
optuna/testing/storages.py
{ "start": 1767, "end": 7071 }
class ____(AbstractContextManager): def __init__(self, storage_specifier: str, **kwargs: Any) -> None: self.storage_specifier = storage_specifier self.extra_args = kwargs self.tempfile: IO[Any] | None = None self.server: grpc.Server | None = None self.thread: threading.Thread...
StorageSupplier
python
kamyu104__LeetCode-Solutions
Python/critical-connections-in-a-network.py
{ "start": 128, "end": 1209 }
class ____(object): def criticalConnections(self, n, connections): """ :type n: int :type connections: List[List[int]] :rtype: List[List[int]] """ def dfs(edges, parent, u, idx, lowlinks, lookup, result): if lookup[u]: return ...
Solution
python
pytorch__pytorch
torch/testing/_internal/common_quantization.py
{ "start": 90838, "end": 91142 }
class ____(nn.Module): def __init__(self) -> None: super().__init__() self.conv = nn.Conv2d(2, 2, 1, bias=None).to(dtype=torch.float) self.relu = nn.ReLU(inplace=False).to(dtype=torch.float) def forward(self, x): return self.relu(self.conv(x))
SubModelWithoutFusion
python
pandas-dev__pandas
pandas/tests/series/indexing/test_setitem.py
{ "start": 44092, "end": 44487 }
class ____(CoercionTest): # previously test_setitem_series_int64 in tests.indexing.test_coercion @pytest.fixture def obj(self): return Series([1, 2, 3, 4]) @pytest.mark.parametrize( "val,exp_dtype,raises", [ (1, np.float64, False), (1.1, np.float64, False), (1 + 1j,...
TestCoercionInt64
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/errors.py
{ "start": 255, "end": 383 }
class ____(graphene.Interface): message = graphene.String(required=True) class Meta: name = "Error"
GrapheneError
python
pallets__werkzeug
src/werkzeug/routing/exceptions.py
{ "start": 1437, "end": 1769 }
class ____(RoutingException): # noqa: B903 """This rule is an alias and wants to redirect to the canonical URL.""" def __init__(self, matched_values: t.Mapping[str, t.Any], endpoint: t.Any) -> None: super().__init__() self.matched_values = matched_values self.endpoint = endpoint
RequestAliasRedirect
python
openai__openai-python
src/openai/resources/batches.py
{ "start": 19451, "end": 20008 }
class ____: def __init__(self, batches: AsyncBatches) -> None: self._batches = batches self.create = _legacy_response.async_to_raw_response_wrapper( batches.create, ) self.retrieve = _legacy_response.async_to_raw_response_wrapper( batches.retrieve, ) ...
AsyncBatchesWithRawResponse
python
apache__airflow
providers/openlineage/src/airflow/providers/openlineage/utils/sql.py
{ "start": 1764, "end": 9634 }
class ____: """Temporary object used to construct OpenLineage Dataset.""" table: str schema: str | None database: str | None fields: list[schema_dataset.SchemaDatasetFacetFields] def to_dataset(self, namespace: str, database: str | None = None, schema: str | None = None) -> Dataset: # ...
TableSchema
python
run-llama__llama_index
llama-index-packs/llama-index-packs-agent-search-retriever/llama_index/packs/agent_search_retriever/base.py
{ "start": 2141, "end": 2991 }
class ____(BaseLlamaPack): """AgentSearchRetrieverPack for running an agent-search retriever.""" def __init__( self, similarity_top_k: int = 2, search_provider: str = "agent-search", api_key: Optional[str] = None, api_base: Optional[str] = None, ) -> None: se...
AgentSearchRetrieverPack
python
PyCQA__pylint
pylint/checkers/misc.py
{ "start": 1799, "end": 7059 }
class ____(BaseTokenChecker, BaseRawFileChecker): """BaseChecker for encoding issues and fixme notes. Checks for: * warning notes in the code like FIXME, XXX * encoding issues. """ # configuration section name name = "miscellaneous" msgs = { "W0511": ( "%s", ...
EncodingChecker
python
prabhupant__python-ds
data_structures/hash/hash_table.py
{ "start": 75, "end": 348 }
class ____: def __init__(self): self.hash_table = def check_collision(self): pass def add_to_linked_list(self): pass def insert(self): pass def delete(self): pass def get(self): pass
HashTable
python
spack__spack
lib/spack/spack/cmd/create.py
{ "start": 11671, "end": 16415 }
class ____(PackageTemplate): """Provides appropriate overrides for python extensions""" base_class_name = "PythonPackage" package_class_import = "from spack_repo.builtin.build_systems.python import PythonPackage" dependencies = """\ # FIXME: Only add the python/pip/wheel dependencies if you need s...
PythonPackageTemplate
python
ray-project__ray
rllib/algorithms/impala/impala_tf_policy.py
{ "start": 1195, "end": 6181 }
class ____: def __init__( self, actions, actions_logp, actions_entropy, dones, behaviour_action_logp, behaviour_logits, target_logits, discount, rewards, values, bootstrap_value, dist_class, model, ...
VTraceLoss
python
django__django
django/core/mail/utils.py
{ "start": 260, "end": 506 }
class ____: def __str__(self): return self.get_fqdn() def get_fqdn(self): if not hasattr(self, "_fqdn"): self._fqdn = punycode(socket.getfqdn()) return self._fqdn DNS_NAME = CachedDnsName()
CachedDnsName
python
doocs__leetcode
solution/3200-3299/3263.Convert Doubly Linked List to Array I/Solution.py
{ "start": 171, "end": 365 }
class ____: def toArray(self, root: "Optional[Node]") -> List[int]: ans = [] while root: ans.append(root.val) root = root.next return ans
Solution
python
euske__pdfminer
pdfminer/pdfdevice.py
{ "start": 227, "end": 1096 }
class ____: def __init__(self, rsrcmgr): self.rsrcmgr = rsrcmgr self.ctm = None return def __repr__(self): return '<PDFDevice>' def close(self): return def set_ctm(self, ctm): self.ctm = ctm return def begin_tag(self, tag, props=None): ...
PDFDevice
python
airbytehq__airbyte
airbyte-integrations/connectors/source-shopify/source_shopify/auth.py
{ "start": 629, "end": 1537 }
class ____(TokenAuthenticator): """ Making Authenticator to be able to accept Header-Based authentication. """ def __init__(self, config: Mapping[str, Any]): self.config = config def get_auth_header(self) -> Mapping[str, Any]: auth_header: str = "X-Shopify-Access-Token" cre...
ShopifyAuthenticator
python
django__django
tests/invalid_models_tests/test_deprecated_fields.py
{ "start": 244, "end": 5683 }
class ____(SimpleTestCase): def test_IPAddressField_deprecated(self): class IPAddressModel(models.Model): ip = models.IPAddressField() model = IPAddressModel() self.assertEqual( model.check(), [ checks.Error( "IPAddress...
DeprecatedFieldsTests
python
ray-project__ray
python/ray/data/_internal/execution/operators/map_transformer.py
{ "start": 911, "end": 4354 }
class ____(ABC): """Represents a single transform function in a MapTransformer.""" def __init__( self, input_type: MapTransformFnDataType, *, is_udf: bool = False, output_block_size_option: Optional[OutputBlockSizeOption] = None, ): """ Args: ...
MapTransformFn
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/engine/base.py
{ "start": 100571, "end": 104782 }
class ____(Transaction): """Represent a 'nested', or SAVEPOINT transaction. The :class:`.NestedTransaction` object is created by calling the :meth:`_engine.Connection.begin_nested` method of :class:`_engine.Connection`. When using :class:`.NestedTransaction`, the semantics of "begin" / "commit...
NestedTransaction
python
django__django
tests/i18n/test_extraction.py
{ "start": 29758, "end": 32972 }
class ____(ExtractorTests): PO_FILE = "locale/%s/LC_MESSAGES/djangojs.po" % LOCALE def test_javascript_literals(self): _, po_contents = self._run_makemessages(domain="djangojs") self.assertMsgId("This literal should be included.", po_contents) self.assertMsgId("gettext_noop should, too....
JavaScriptExtractorTests
python
kamyu104__LeetCode-Solutions
Python/length-of-the-longest-increasing-path.py
{ "start": 108, "end": 997 }
class ____(object): def maxPathLength(self, coordinates, k): """ :type coordinates: List[List[int]] :type k: int :rtype: int """ def longest_increasing_subsequence(arr): result = [] for x in arr: i = bisect.bisect_left(result, x...
Solution
python
google__python-fire
fire/test_components.py
{ "start": 3787, "end": 4213 }
class ____: """Test class for testing Python Fire with a property with varargs.""" def cumsums(self, *items): total = None sums = [] for item in items: if total is None: total = item else: total += item sums.append(total) return sums def varchars(self, alpha=0, ...
VarArgs
python
pydantic__pydantic
tests/test_discriminated_union.py
{ "start": 13891, "end": 13931 }
class ____(int, Enum): pass
FooIntEnum
python
python__mypy
mypyc/irbuild/for_helpers.py
{ "start": 37911, "end": 38476 }
class ____(ForDictionaryCommon): """Generate optimized IR for a for loop over dictionary keys.""" dict_next_op = dict_next_key_op dict_iter_op = dict_key_iter_op def begin_body(self) -> None: builder = self.builder line = self.line # Key is stored at the third place in the tup...
ForDictionaryKeys
python
ApeWorX__ape
src/ape/plugins/network.py
{ "start": 1813, "end": 2835 }
class ____(PluginType): """ A plugin representing a network provider, which is the main API responsible for making requests against a blockchain. Example provider plugins projects include `ape-infura <https://github.com/ApeWorX/ape-infura>`__ as well as `ape-alchemy <https://github.com/ApeWorX/ape-a...
ProviderPlugin
python
sanic-org__sanic
sanic/http/stream.py
{ "start": 262, "end": 689 }
class ____: stage: Stage response: Optional[BaseHTTPResponse] protocol: HttpProtocol url: Optional[str] request_body: Optional[bytes] request_max_size: Union[int, float] __touchup__: tuple[str, ...] = tuple() __slots__ = ("request_max_size",) def respond( self, response: Ba...
Stream
python
doocs__leetcode
solution/1400-1499/1482.Minimum Number of Days to Make m Bouquets/Solution.py
{ "start": 0, "end": 460 }
class ____: def minDays(self, bloomDay: List[int], m: int, k: int) -> int: def check(days: int) -> int: cnt = cur = 0 for x in bloomDay: cur = cur + 1 if x <= days else 0 if cur == k: cnt += 1 cur = 0 ...
Solution
python
vyperlang__vyper
vyper/ast/nodes.py
{ "start": 30593, "end": 30658 }
class ____(ExprNode): __slots__ = ("left", "op", "right")
BinOp
python
bokeh__bokeh
src/bokeh/events.py
{ "start": 22244, "end": 22726 }
class ____(PointEvent): ''' Announce the start of a pinch event on a Bokeh plot. Attributes: sx (float) : x-coordinate of the event in *screen* space sy (float) : y-coordinate of the event in *screen* space x (float) : x-coordinate of the event in *data* space y (float) : y-coor...
PinchStart
python
pytorch__pytorch
torch/ao/quantization/__init__.py
{ "start": 6359, "end": 7613 }
class ____(ObserverBase): r"""This observer is used to describe an observer whose quantization parameters are derived from other observers """ def __init__( self, dtype: torch.dtype, obs_or_fqs: list[ObserverOrFakeQuantize], derive_qparams_fn: Callable[ [list...
_DerivedObserverOrFakeQuantize
python
huggingface__transformers
src/transformers/models/mvp/modeling_mvp.py
{ "start": 10588, "end": 13652 }
class ____(GradientCheckpointingLayer): def __init__(self, config: MvpConfig): super().__init__() self.embed_dim = config.d_model self.self_attn = MvpAttention( embed_dim=self.embed_dim, num_heads=config.encoder_attention_heads, dropout=config.attention_dr...
MvpEncoderLayer
python
pytorch__pytorch
torch/_inductor/cache.py
{ "start": 1015, "end": 1813 }
class ____(ABC, Generic[Key, Value]): """ Abstract base class for cache implementations. Provides the interface for cache operations. """ @abstractmethod def get(self: Self, key: Key) -> Value | None: """ Retrieve a value from the cache. Args: key (Key): The ...
Cache
python
paramiko__paramiko
paramiko/ssh_exception.py
{ "start": 2735, "end": 3181 }
class ____(SSHException): """ Exception raised when an attempt to open a new `.Channel` fails. :param int code: the error code returned by the server .. versionadded:: 1.6 """ def __init__(self, code, text): SSHException.__init__(self, code, text) self.code = code self...
ChannelException
python
lepture__authlib
authlib/oauth2/rfc7009/revocation.py
{ "start": 217, "end": 4171 }
class ____(TokenEndpoint): """Implementation of revocation endpoint which is described in `RFC7009`_. .. _RFC7009: https://tools.ietf.org/html/rfc7009 """ #: Endpoint name to be registered ENDPOINT_NAME = "revocation" def authenticate_token(self, request, client): """The client co...
RevocationEndpoint
python
FactoryBoy__factory_boy
tests/test_django.py
{ "start": 29759, "end": 36494 }
class ____(django_test.TestCase): def setUp(self): self.handlers = mock.MagicMock() signals.pre_init.connect(self.handlers.pre_init) signals.pre_save.connect(self.handlers.pre_save) signals.post_save.connect(self.handlers.post_save) def tearDown(self): signals.pre_init....
PreventSignalsTestCase
python
walkccc__LeetCode
solutions/1765. Map of Highest Peak/1765.py
{ "start": 0, "end": 666 }
class ____: def highestPeak(self, isWater: list[list[int]]) -> list[list[int]]: DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0)) m = len(isWater) n = len(isWater[0]) ans = [[-1] * n for _ in range(m)] q = collections.deque() for i in range(m): for j in range(n): if isWater[i][j] == 1: ...
Solution
python
has2k1__plotnine
plotnine/geoms/geom_boxplot.py
{ "start": 883, "end": 9869 }
class ____(geom): """ Box and whiskers plot {usage} Parameters ---------- {common_parameters} width : float, default=None Box width. If `None`{.py}, the width is set to `90%` of the resolution of the data. Note that if the stat has a width parameter, that takes prec...
geom_boxplot
python
python-poetry__poetry
src/poetry/packages/dependency_package.py
{ "start": 245, "end": 1343 }
class ____: def __init__(self, dependency: Dependency, package: Package) -> None: self._dependency = dependency self._package = package @property def dependency(self) -> Dependency: return self._dependency @property def package(self) -> Package: return self._package...
DependencyPackage
python
dask__dask
dask/dataframe/dask_expr/_expr.py
{ "start": 38110, "end": 38243 }
class ____(Blockwise): _parameters = ["frame"] operation = M.dropna _preserves_partitioning_information = True
DropnaSeries
python
dagster-io__dagster
python_modules/libraries/dagster-cloud-cli/dagster_cloud_cli/core/pex_builder/deps.py
{ "start": 852, "end": 1728 }
class ____: requirements_txt: str python_version: version.Version pex_flags: list[str] @property def hash(self) -> str: # The hash uniquely identifies the list of requirements used to build a deps.pex. # This is used as part of the cache key to reuse a cached deps.pex. # Not...
DepsRequirements
python
patrick-kidger__equinox
equinox/nn/_pool.py
{ "start": 16239, "end": 18386 }
class ____(Module): """General N dimensional adaptive downsampling to a target shape.""" target_shape: Sequence[int] = field(static=True) operation: Callable[[Array], Array] def __init__( self, target_shape: int | Sequence[int], num_spatial_dims: int, operation: Callabl...
AdaptivePool
python
wntrblm__nox
nox/command.py
{ "start": 1202, "end": 6570 }
class ____(Exception): """Raised when an executed command returns a non-success status code.""" def __init__(self, reason: str | None = None) -> None: super().__init__(reason) self.reason = reason def which( program: str | os.PathLike[str], paths: Sequence[str | os.PathLike[str]] | None )...
CommandFailed
python
has2k1__plotnine
plotnine/geoms/geom_spoke.py
{ "start": 204, "end": 977 }
class ____(geom_segment): """ Line segment parameterised by location, direction and distance {usage} Parameters ---------- {common_parameters} See Also -------- plotnine.geom_segment : For documentation of extra parameters. """ REQUIRED_AES = {"x", "y", "angle", "...
geom_spoke
python
pytorch__pytorch
torch/ao/quantization/fx/tracer.py
{ "start": 477, "end": 1697 }
class ____(Tracer): def __init__( self, skipped_module_names: list[str], skipped_module_classes: list[Callable] ): super().__init__() self.skipped_module_names = skipped_module_names self.skipped_module_classes = skipped_module_classes # NB: initialized the module_type of...
QuantizationTracer
python
streamlit__streamlit
lib/streamlit/elements/metric.py
{ "start": 1736, "end": 1867 }
class ____: color: MetricProto.MetricColor.ValueType direction: MetricProto.MetricDirection.ValueType
MetricColorAndDirection
python
python-visualization__folium
folium/plugins/measure_control.py
{ "start": 161, "end": 2541 }
class ____(JSCSSMixin, MacroElement): """Add a measurement widget on the map. Parameters ---------- position: str, default 'topright' Location of the widget. primary_length_unit: str, default 'meters' secondary_length_unit: str, default 'miles' primary_area_unit: str, default 'sqmet...
MeasureControl
python
numpy__numpy
numpy/random/tests/test_direct.py
{ "start": 13096, "end": 14628 }
class ____(Base): @classmethod def setup_class(cls): cls.bit_generator = PCG64 cls.bits = 64 cls.dtype = np.uint64 cls.data1 = cls._read_csv(join(pwd, './data/pcg64-testset-1.csv')) cls.data2 = cls._read_csv(join(pwd, './data/pcg64-testset-2.csv')) cls.seed_error_...
TestPCG64
python
sqlalchemy__sqlalchemy
test/orm/test_dataclasses.py
{ "start": 8844, "end": 11790 }
class ____( fixtures.DeclarativeMappedTest, DataclassesTest ): @classmethod def setup_classes(cls): declarative = cls.DeclarativeBasic.registry.mapped @declarative @dataclasses.dataclass class Widget: __tablename__ = "widgets" __sa_dataclass_metadata_...
FieldEmbeddedDeclarativeDataclassesTest
python
scikit-learn__scikit-learn
sklearn/utils/_set_output.py
{ "start": 5629, "end": 10975 }
class ____: def __init__(self): self.adapters = {} @property def supported_outputs(self): return {"default"} | set(self.adapters) def register(self, adapter): self.adapters[adapter.container_lib] = adapter ADAPTERS_MANAGER = ContainerAdaptersManager() ADAPTERS_MANAGER.registe...
ContainerAdaptersManager
python
docker__docker-py
tests/integration/api_container_test.py
{ "start": 56612, "end": 57948 }
class ____(BaseAPIIntegrationTest): def test_container_cpu_shares(self): cpu_shares = 512 container = self.client.create_container( TEST_IMG, 'ls', host_config=self.client.create_host_config( cpu_shares=cpu_shares ) ) self.tmp_containers.append...
ContainerCPUTest
python
getsentry__sentry
tests/sentry/core/endpoints/test_organization_user_teams.py
{ "start": 49, "end": 2406 }
class ____(APITestCase): endpoint = "sentry-api-0-organization-user-teams" def setUp(self) -> None: self.foo = self.create_user("foo@example.com") self.bar = self.create_user("bar@example.com", is_superuser=True) self.org = self.create_organization(owner=self.user) self.team1 = ...
OrganizationUserTeamsTest
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1503042, "end": 1505851 }
class ____(DataFormat): """ TopoDataFormat schema wrapper. Parameters ---------- feature : str The name of the TopoJSON object set to convert to a GeoJSON feature collection. For example, in a map of the world, there may be an object set named ``"countries"``. Using the feat...
TopoDataFormat
python
django-haystack__django-haystack
test_haystack/test_views.py
{ "start": 965, "end": 5912 }
class ____(TestCase): fixtures = ["base_data"] def setUp(self): super().setUp() # Stow. self.old_unified_index = connections["default"]._index self.ui = UnifiedIndex() self.bmmsi = BasicMockModelSearchIndex() self.bammsi = BasicAnotherMockModelSearchIndex() ...
SearchViewTestCase
python
getsentry__sentry
tests/sentry/buffer/test_base.py
{ "start": 519, "end": 3654 }
class ____(TestCase): def setUp(self) -> None: create_default_projects() self.buf = Buffer() @mock.patch("sentry.buffer.base.process_incr") def test_incr_delays_task(self, process_incr: mock.MagicMock) -> None: model = Group columns = {"times_seen": 1} filters: dict[...
BufferTest
python
allegroai__clearml
clearml/backend_api/services/v2_13/queues.py
{ "start": 79962, "end": 82567 }
class ____(Response): """ Response of queues.update endpoint. :param updated: Number of queues updated (0 or 1) :type updated: int :param fields: Updated fields names and values :type fields: dict """ _service = "queues" _action = "update" _version = "2.13" _schema = { ...
UpdateResponse
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_set.py
{ "start": 26443, "end": 27900 }
class ____(TestSet): thetype = SetSubclass basetype = set def test_keywords_in_subclass(self): with torch._dynamo.error_on_graph_break(False): class subclass(set): pass u = subclass([1, 2]) self.assertIs(type(u), subclass) self.assertEqual(set(u),...
TestSetSubclass
python
Lightning-AI__lightning
tests/tests_pytorch/checkpointing/test_model_checkpoint.py
{ "start": 36077, "end": 36245 }
class ____(BoringModel): def on_train_epoch_start(self): if self.current_epoch == 1: raise RuntimeError("Trouble!")
TroubledModelOnTrainEpochStart
python
airbytehq__airbyte
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/async_job.py
{ "start": 2582, "end": 2896 }
class ____(str, Enum): """Async job statuses""" COMPLETED = "Job Completed" FAILED = "Job Failed" SKIPPED = "Job Skipped" STARTED = "Job Started" RUNNING = "Job Running" NOT_STARTED = "Job Not Started" # ------------------------------- base ---------------------------------------
Status
python
huggingface__transformers
tests/models/deepseek_vl/test_modeling_deepseek_vl.py
{ "start": 8954, "end": 14784 }
class ____(unittest.TestCase): def setUp(self): self.model_id = "deepseek-community/deepseek-vl-1.3b-chat" def test_model_text_generation(self): model = DeepseekVLForConditionalGeneration.from_pretrained(self.model_id, dtype="auto", device_map="auto") model.to(torch_device) mode...
DeepseekVLIntegrationTest
python
google__jax
jax/experimental/mosaic/gpu/launch_context.py
{ "start": 1643, "end": 2568 }
class ____: def apply(self, ref: ir.Value) -> ir.Value: raise NotImplementedError("Subclasses should override this method") def transform_index(self, idx: Sequence[ir.Value]) -> tuple[ir.Value, ...]: raise NotImplementedError("Subclasses should override this method") def transform_shape(self, shape: Seq...
MemRefTransform
python
readthedocs__readthedocs.org
readthedocs/builds/managers.py
{ "start": 2813, "end": 3155 }
class ____(VersionManager): """ Version manager that only includes internal version. It will exclude pull request/merge request versions from the queries and only include BRANCH, TAG, UNKNOWN type Versions. """ def get_queryset(self): return super().get_queryset().exclude(type=EXTERNAL...
InternalVersionManager
python
PyCQA__pylint
doc/data/messages/m/method-hidden/good.py
{ "start": 0, "end": 122 }
class ____: def __init__(self, vitamins): self.vitamins = vitamins def antioxidants(self): pass
Fruit
python
ray-project__ray
rllib/core/distribution/torch/torch_distribution.py
{ "start": 11924, "end": 14036 }
class ____(Distribution): """The distribution that returns the input values directly. This is similar to DiagGaussian with standard deviation zero (thus only requiring the "mean" values as NN output). Note: entropy is always zero, ang logp and kl are not implemented. .. testcode:: :skipif...
TorchDeterministic
python
tensorflow__tensorflow
tensorflow/python/ops/weak_tensor_special_math_ops_test.py
{ "start": 11694, "end": 22954 }
class ____(test.TestCase, parameterized.TestCase): @test_util.run_in_graph_and_eager_modes def test_besseli_boundary(self): self.assertAllClose(1., special_math_ops.bessel_i0(0.)) self.assertAllClose(1., special_math_ops.bessel_i0e(0.)) self.assertAllClose(0., special_math_ops.bessel_i1(0.)) self.a...
BesselTest
python
joke2k__faker
faker/providers/ssn/en_GB/__init__.py
{ "start": 68, "end": 1303 }
class ____(BaseProvider): # Source: # https://en.wikipedia.org/wiki/National_Insurance_number # UK National Insurance numbers (NINO) follow a specific format # To avoid generating real NINOs, the prefix and suffix letters # remain static using values reserved by HMRC (never to be used). # Exampl...
Provider
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 15258, "end": 15442 }
class ____(sgqlc.types.Enum): """ See source code for more info. """ __schema__ = graphql_schema __choices__ = ("CONFLICTING", "MERGEABLE", "UNKNOWN")
MergeableState
python
pypa__pip
src/pip/_internal/cli/spinners.py
{ "start": 809, "end": 2650 }
class ____(SpinnerInterface): def __init__( self, message: str, file: IO[str] | None = None, spin_chars: str = SPINNER_CHARS, # Empirically, 8 updates/second looks nice min_update_interval_seconds: float = 1 / SPINS_PER_SECOND, ): self._message = message ...
InteractiveSpinner
python
pytorch__pytorch
torch/distributed/elastic/rendezvous/dynamic_rendezvous.py
{ "start": 18074, "end": 27489 }
class ____(_RendezvousOpExecutor): """Execute rendezvous operations using a shared state. Args: node: The node descriptor associated with the current rendezvous handler instance. state_holder: The ``RendezvousStateHolder`` to use to sync the rendezvous state ...
_DistributedRendezvousOpExecutor
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_annotations/mypy_init_return.py
{ "start": 192, "end": 259 }
class ____: def __init__(self, foo) -> None: ... # OK
Foo
python
getsentry__sentry
tests/sentry/models/test_releaseprojectenvironment.py
{ "start": 283, "end": 3408 }
class ____(TestCase): def setUp(self) -> None: self.project = self.create_project(name="foo") self.datetime_now = timezone.now() self.release = Release.objects.create( organization_id=self.project.organization_id, version="42" ) self.release.add_project(self.proj...
GetOrCreateTest
python
Pylons__pyramid
src/pyramid/interfaces.py
{ "start": 37127, "end": 37202 }
class ____(Interface): """Localizer for a specific language"""
ILocalizer
python
Netflix__metaflow
metaflow/cli_components/utils.py
{ "start": 4566, "end": 6057 }
class ____(click.Group): def __init__(self, *args, lazy_subcommands=None, **kwargs): super().__init__(*args, **kwargs) # lazy_subcommands is a list of strings in the form # "{command} -> "{module-name}.{command-object-name}" self.lazy_subcommands = lazy_subcommands or {} self...
LazyGroup
python
tensorflow__tensorflow
tensorflow/python/framework/ops_test.py
{ "start": 17884, "end": 23511 }
class ____(test_util.TensorFlowTestCase, parameterized.TestCase): def assertAllTensorsEqual(self, list1, list2): self.assertLen(list1, len(list2)) for (t1, t2) in zip(list1, list2): self.assertAllEqual(t1, t2) def testConstruction(self): spec1 = indexed_slices.Indexed...
IndexedSlicesSpecTest
python
openai__openai-python
src/openai/types/realtime/output_audio_buffer_clear_event_param.py
{ "start": 232, "end": 504 }
class ____(TypedDict, total=False): type: Required[Literal["output_audio_buffer.clear"]] """The event type, must be `output_audio_buffer.clear`.""" event_id: str """The unique ID of the client event used for error handling."""
OutputAudioBufferClearEventParam
python
pypa__setuptools
setuptools/tests/test_setopt.py
{ "start": 61, "end": 1351 }
class ____: @staticmethod def parse_config(filename): parser = configparser.ConfigParser() with open(filename, encoding='utf-8') as reader: parser.read_file(reader) return parser @staticmethod def write_text(file, content): with open(file, 'wb') as strm: ...
TestEdit
python
google__jax
jax/_src/core.py
{ "start": 57911, "end": 59118 }
class ____: __slots__: list[str] = [] is_high = False has_qdd = False def to_tangent_aval(self): raise NotImplementedError("must override") # TODO(dougalm): deprecate this alias def at_least_vspace(self): return self.to_tangent_aval() def __repr__(self): try: kv_pairs = (f'{k}={v}' fo...
AbstractValue
python
pytorch__pytorch
test/test_autocast.py
{ "start": 6534, "end": 7016 }
class ____(torch.autograd.Function): @staticmethod def forward(ctx, x, w_t): ctx.save_for_backward(x, w_t) return torch.nn.functional.linear(x, w_t) @staticmethod def backward(ctx, grad_output): x, w_t = ctx.saved_tensors with torch.autocast(device_type="cuda"): ...
CustomLinear
python
sympy__sympy
doc/ext/docscrape_sphinx.py
{ "start": 131, "end": 8299 }
class ____(NumpyDocString): def __init__(self, docstring, config={}): NumpyDocString.__init__(self, docstring, config=config) self.load_config(config) def load_config(self, config): self.use_plots = config.get('use_plots', False) self.class_members_toctree = config.get('class_me...
SphinxDocString
python
getsentry__sentry
tests/sentry/deletions/test_alert_rule_trigger_action.py
{ "start": 423, "end": 1571 }
class ____(BaseWorkflowTest, HybridCloudTestMixin): def test_simple(self) -> None: incident = self.create_incident() alert_rule_trigger_action = self.create_alert_rule_trigger_action() notification_message = NotificationMessage( message_identifier="s3iojewd90j23eqw", ...
DeleteAlertRuleTriggerActionTest
python
readthedocs__readthedocs.org
readthedocs/projects/exceptions.py
{ "start": 391, "end": 479 }
class ____(BuildUserError): FILE_NOT_FOUND = "project:file:not-found"
UserFileNotFound
python
readthedocs__readthedocs.org
readthedocs/builds/tests/test_tasks.py
{ "start": 4385, "end": 12852 }
class ____(TestCase): def setUp(self): self.user = get(User) self.github_app_installation = get( GitHubAppInstallation, installation_id=1111, target_id=1111, target_type=GitHubAccountType.USER, ) self.remote_repository = get( ...
TestPostBuildOverview
python
google__jax
tests/pallas/pallas_test.py
{ "start": 76611, "end": 76717 }
class ____(PallasCallAutodifferentiationTest): INTERPRET = True
PallasCallAutodifferentiationInterpretTest
python
falconry__falcon
tests/test_cookies.py
{ "start": 485, "end": 1295 }
class ____: def on_get(self, req, resp): resp.set_cookie('foo', 'bar', domain='example.com', path='/') def on_head(self, req, resp): resp.set_cookie('foo', 'bar', max_age=300) resp.set_cookie('bar', 'baz', http_only=False) resp.set_cookie('bad', 'cookie') resp.unset_cook...
CookieResource
python
google__pytype
pytype/directors/directors.py
{ "start": 1192, "end": 4208 }
class ____: """A set of line numbers. The data structure is optimized to represent the union of a sparse set of integers and ranges of non-negative integers. This supports the two styles of directives: those after a statement apply only to that line and those on their own line apply until countered by the o...
_LineSet
python
bokeh__bokeh
src/bokeh/server/server.py
{ "start": 2940, "end": 11232 }
class ____: ''' Explicitly coordinate the level Tornado components required to run a Bokeh server: * A Tornado ``IOLoop`` to run the Bokeh server machinery. * a ``BokehTornado`` Tornado application that defines the Bokeh server machinery. * a Tornado ``HTTPServer`` to direct HTTP requests ...
BaseServer
python
matplotlib__matplotlib
lib/matplotlib/backend_tools.py
{ "start": 18755, "end": 19173 }
class ____(ToolBase): """Base class for `ToolHome`, `ToolBack` and `ToolForward`.""" _on_trigger = None def trigger(self, sender, event, data=None): self.toolmanager.get_tool(_views_positions).add_figure(self.figure) getattr(self.toolmanager.get_tool(_views_positions), self...
ViewsPositionsBase
python
walkccc__LeetCode
solutions/3265. Count Almost Equal Pairs I/3265.py
{ "start": 0, "end": 681 }
class ____: def countPairs(self, nums: list[int]) -> int: ans = 0 count = collections.Counter() maxLen = len(str(max(nums))) for num in nums: digits = list(str(num).zfill(maxLen)) for swap in self._getSwaps(digits): ans += count[swap] count[num] += 1 return ans def _...
Solution
python
ApeWorX__ape
src/ape/managers/project.py
{ "start": 66075, "end": 78500 }
class ____(ProjectManager): """ Base class for projects. Projects can come from either manifests or local source-paths. """ def __init__(self, manifest: PackageManifest, config_override: Optional[dict] = None): self._manifest = manifest self._config_override = config_override or {} ...
Project
python
django__django
tests/model_regress/models.py
{ "start": 1065, "end": 1251 }
class ____(models.Model): department = models.ForeignKey(Department, models.CASCADE) name = models.CharField(max_length=200) def __str__(self): return self.name
Worker
python
PrefectHQ__prefect
tests/runner/test_storage.py
{ "start": 788, "end": 3119 }
class ____: @pytest.mark.parametrize( "url, expected_type", [ ("git://github.com/user/repo.git", "GitRepository"), ("https://github.com/user/repo.git", "GitRepository"), ], ) def test_create_git_storage(self, url, expected_type): storage = create_stora...
TestCreateStorageFromSource
python
jazzband__django-polymorphic
src/polymorphic/tests/models.py
{ "start": 2861, "end": 2940 }
class ____(RelationBase): field_a = models.CharField(max_length=30)
RelationA
python
pytorch__pytorch
test/inductor/test_custom_op_autotune.py
{ "start": 732, "end": 16961 }
class ____(TestCase): """Test custom operation autotuning functionality.""" def setUp(self) -> None: """Set up test environment with appropriate device and dtype.""" super().setUp() self.device = "cuda" if HAS_GPU else "cpu" self.dtype = torch.float16 if self.device == "cuda" el...
TestCustomOpAutoTune
python
google__pytype
pytype/tests/test_super1.py
{ "start": 99, "end": 7225 }
class ____(test_base.BaseTest): """Tests for super().""" def test_set_attr(self): self.Check(""" class Foo: def foo(self, name, value): super(Foo, self).__setattr__(name, value) """) def test_str(self): self.Check(""" class Foo: def foo(self, name, value): ...
SuperTest
python
google__pytype
pytype/tests/test_operators1.py
{ "start": 8062, "end": 10923 }
class ____(test_base.BaseTest, test_utils.OperatorsTestMixin): """Tests for reverse operators.""" def test_add(self): self.check_reverse("add", "+") def test_and(self): self.check_reverse("and", "&") def test_floordiv(self): self.check_reverse("floordiv", "//") def test_lshift(self): self....
ReverseTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1033261, "end": 1034063 }
class ____(sgqlc.types.Type): """Autogenerated return type of UpdateOrganizationAllowPrivateRepositoryForkingSetting """ __schema__ = github_schema __field_names__ = ("client_mutation_id", "message", "organization") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId")...
UpdateOrganizationAllowPrivateRepositoryForkingSettingPayload
python
chardet__chardet
chardet/gb2312prober.py
{ "start": 1297, "end": 1693 }
class ____(MultiByteCharSetProber): def __init__(self) -> None: super().__init__() self.coding_sm = CodingStateMachine(GB2312_SM_MODEL) self.distribution_analyzer = GB2312DistributionAnalysis() self.reset() @property def charset_name(self) -> str: return "GB2312" ...
GB2312Prober
python
Netflix__metaflow
metaflow/system/system_utils.py
{ "start": 27, "end": 657 }
class ____(object): def __init__(self, name="not_a_real_flow"): self.name = name # This function is used to initialize the environment outside a flow. def init_environment_outside_flow( flow: Union["metaflow.flowspec.FlowSpec", "metaflow.sidecar.DummyFlow"] ) -> "metaflow.metaflow_environment.Metaflow...
DummyFlow