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
ansible__ansible
test/units/mock/custom_types.py
{ "start": 1026, "end": 1058 }
class ____(float): ...
CustomFloat
python
ray-project__ray
rllib/algorithms/ppo/torch/default_ppo_torch_rl_module.py
{ "start": 722, "end": 3126 }
class ____(TorchRLModule, DefaultPPORLModule): def __init__(self, *args, **kwargs): catalog_class = kwargs.pop("catalog_class", None) if catalog_class is None: catalog_class = PPOCatalog super().__init__(*args, **kwargs, catalog_class=catalog_class) @override(RLModule) d...
DefaultPPOTorchRLModule
python
facelessuser__pymdown-extensions
tests/test_extensions/test_magiclink.py
{ "start": 86, "end": 2372 }
class ____(util.MdCase): """Test cases for repo link shortening.""" extension = [ 'pymdownx.magiclink', ] extension_configs = { 'pymdownx.magiclink': { 'repo_url_shortener': True } } def test_user(self): """Test user shortening.""" # Test #...
TestMagicLinkShortner
python
google__jax
tests/pjit_test.py
{ "start": 44770, "end": 52170 }
class ____(jtu.JaxTestCase): @parameterized.named_parameters( ('2d_array', (4, 2), (4, 2), ('x', 'y')), # TODO(b/226977360): Support 3D mesh shape for example (2, 2, 2). ('3d_array', (1, 4, 2), (2, 4, 8, 4), ('x', 'y', 'z')), ('1d_array', (8,), (8, 2), ('x')), ) def test_pjit_arr_auto_sharding_ar...
AutoShardingPjitTest
python
pytorch__pytorch
test/test_cuda.py
{ "start": 227582, "end": 242125 }
class ____(TestCase): # These tests will be instantiate with instantiate_device_type_tests # to apply the new OptimizerInfo structure. @onlyCUDA @unittest.skipIf( not TEST_CUDA_GRAPH, "CUDA >= 11.0 or ROCM >=5.3 required for graphs" ) @optims( [optim for optim in optim_db if opt...
TestCudaOptims
python
scipy__scipy
scipy/stats/_multivariate.py
{ "start": 211953, "end": 214427 }
class ____(multi_rv_frozen): __class_getitem__ = None def __init__(self, row, col, *, seed=None): self._dist = random_table_gen(seed) self._params = self._dist._process_parameters(row, col) # monkey patch self._dist def _process_parameters(r, c): return self._params...
random_table_frozen
python
huggingface__transformers
src/transformers/models/depth_anything/modeling_depth_anything.py
{ "start": 7950, "end": 9802 }
class ____(nn.Module): """ DepthAnythingNeck. A neck is a module that is normally used between the backbone and the head. It takes a list of tensors as input and produces another list of tensors as output. For DepthAnything, it includes 2 stages: * DepthAnythingReassembleStage * DepthAnythingFeatur...
DepthAnythingNeck
python
dagster-io__dagster
python_modules/libraries/dagster-shared/dagster_shared/serdes/objects/package_entry.py
{ "start": 2419, "end": 4119 }
class ____: key: EnvRegistryKey aliases: Sequence[EnvRegistryKey] summary: Optional[str] description: Optional[str] owners: Optional[Sequence[str]] tags: Optional[Sequence[str]] feature_data: Sequence[EnvRegistryObjectFeatureData] @property def features(self) -> Sequence[EnvRegistry...
EnvRegistryObjectSnap
python
huggingface__transformers
tests/models/smolvlm/test_video_processing_smolvlm.py
{ "start": 1054, "end": 3114 }
class ____: def __init__( self, parent, batch_size=5, num_frames=8, num_channels=3, min_resolution=30, max_resolution=80, do_resize=True, size=None, do_normalize=True, image_mean=IMAGENET_STANDARD_MEAN, image_std=IMAGENE...
SmolVLMVideoProcessingTester
python
pytorch__pytorch
test/distributed/test_c10d_spawn.py
{ "start": 3033, "end": 9229 }
class ____(MultiProcessTestCase): def setUp(self): super().setUp() self._spawn_processes() def tearDown(self): super().tearDown() try: os.remove(self.file_name) except OSError: pass @property def op_timeout_sec(self): return 1 ...
TestDistributedNNFunctions
python
pennersr__django-allauth
allauth/usersessions/forms.py
{ "start": 76, "end": 341 }
class ____(forms.Form): def __init__(self, *args, **kwargs): self.request = kwargs.pop("request") super().__init__(*args, **kwargs) def save(self, request): flows.sessions.end_other_sessions(request, request.user)
ManageUserSessionsForm
python
celery__celery
t/unit/worker/test_strategy.py
{ "start": 10389, "end": 10524 }
class ____(test_default_strategy_proto2): def get_message_class(self): return self.TaskMessage1
test_default_strategy_proto1
python
ray-project__ray
rllib/policy/torch_mixins.py
{ "start": 3416, "end": 4693 }
class ____: """Assigns the `update_kl()` method to a TorchPolicy. This is used by Algorithms to update the KL coefficient after each learning step based on `config.kl_target` and the measured KL value (from the train_batch). """ def __init__(self, config): # The current KL value (as py...
KLCoeffMixin
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_crypto_ticker.py
{ "start": 1687, "end": 3950 }
class ____(ColumnMapExpectation): """Expect column values to be valid cryptocurrency tickers.""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "well_formed_crypto_ticker...
ExpectColumnValuesToBeValidCryptoTicker
python
numba__numba
numba/cuda/tests/cudapy/test_compiler.py
{ "start": 9967, "end": 10821 }
class ____(unittest.TestCase): '''For tests where we can only check correctness by examining the compiler output rather than observing the effects of execution.''' def test_nanosleep(self): def use_nanosleep(x): # Sleep for a constant time cuda.nanosleep(32) # Sl...
TestCompileOnlyTests
python
huggingface__transformers
src/transformers/models/regnet/modeling_regnet.py
{ "start": 12189, "end": 14120 }
class ____(RegNetPreTrainedModel): def __init__(self, config): super().__init__(config) self.num_labels = config.num_labels self.regnet = RegNetModel(config) # classification head self.classifier = nn.Sequential( nn.Flatten(), nn.Linear(config.hidden_s...
RegNetForImageClassification
python
dask__distributed
distributed/tests/test_scheduler.py
{ "start": 99474, "end": 168658 }
class ____(ConnectionPool): def __init__(self, *args, failing_connections=0, **kwargs): self.cnn_count = 0 self.failing_connections = failing_connections super().__init__(*args, **kwargs) async def connect(self, *args, **kwargs): self.cnn_count += 1 if self.cnn_count > s...
FlakyConnectionPool
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/util/langhelpers.py
{ "start": 33341, "end": 34608 }
class ____(Generic[_T_co]): """Descriptor which proxies a function when the attribute is not present in dict This superclass is organized in a particular way with "memoized" and "non-memoized" implementation classes that are hidden from type checkers, as Mypy seems to not be able to handle seeing m...
generic_fn_descriptor
python
spack__spack
lib/spack/spack/audit.py
{ "start": 1831, "end": 2431 }
class ____: """Information on an error reported in a test.""" def __init__(self, summary, details): self.summary = summary self.details = tuple(details) def __str__(self): if self.details: return f"{self.summary}\n" + "\n".join(f" {detail}" for detail in self.details...
Error
python
huggingface__transformers
src/transformers/models/granite_speech/modeling_granite_speech.py
{ "start": 4127, "end": 5032 }
class ____(nn.Module): """Feedforward module for conformer encoder blocks.""" def __init__(self, config: GraniteSpeechEncoderConfig): super().__init__() self.pre_norm = nn.LayerNorm(config.hidden_dim) self.up_proj = nn.Linear(config.hidden_dim, config.hidden_dim * config.feedforward_mul...
GraniteSpeechConformerFeedForward
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/invalid_return_type_hash.py
{ "start": 664, "end": 737 }
class ____: def __hash__(self): x = 7741 return x
Hash2
python
django__django
django/contrib/gis/gdal/field.py
{ "start": 4552, "end": 4735 }
class ____(Field): @property def value(self): "Return a float contained in this field." return self.as_double() # String & Binary fields, just subclasses
OFTReal
python
langchain-ai__langchain
libs/core/langchain_core/utils/function_calling.py
{ "start": 1100, "end": 1383 }
class ____(TypedDict): """Representation of a callable function to send to an LLM.""" name: str """The name of the function.""" description: str """A description of the function.""" parameters: dict """The parameters of the function."""
FunctionDescription
python
huggingface__transformers
src/transformers/models/yoso/modeling_yoso.py
{ "start": 30694, "end": 31572 }
class ____(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.dropout = nn.Dropout(config.hidden_dropout_prob) self.out_proj = nn.Linear(config.hidden_...
YosoClassificationHead
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 159043, "end": 159502 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("comment_id", "body", "client_mutation_id") comment_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="commentId") body = sgqlc.types.Field(sgqlc.types.non_null(S...
UpdateDiscussionCommentInput
python
langchain-ai__langchain
libs/langchain/langchain_classic/agents/agent.py
{ "start": 32886, "end": 62129 }
class ____(Chain): """Agent that is using tools.""" agent: BaseSingleActionAgent | BaseMultiActionAgent | Runnable """The agent to run for creating a plan and determining actions to take at each step of the execution loop.""" tools: Sequence[BaseTool] """The valid tools the agent can call.""" ...
AgentExecutor
python
Textualize__textual
src/textual/worker.py
{ "start": 794, "end": 860 }
class ____(Exception): """A worker related error."""
WorkerError
python
pytorch__pytorch
test/distributed/test_c10d_common.py
{ "start": 40142, "end": 51631 }
class ____: @property def op_timeout_sec(self): return 1 @property def world_size(self): return 2 @property def device(self): self.fail("test subclass didn't override device") def _verify_sequence_number_across_pg(self, pg, verify_pg): seq_num = pg._get_seq...
AbstractCommTest
python
django-extensions__django-extensions
tests/management/commands/test_create_jobs.py
{ "start": 1109, "end": 2730 }
class ____(CreateJobsTestsMixin, TestCase): def test_should_create_jobs_directory_structure_silently(self): call_command("create_jobs", "testapp_with_no_models_file") self.assertTrue(os.path.exists(JOBS_DIR)) @patch("sys.stdout", new_callable=StringIO) def test_should_create_jobs_directory...
CreateJobsTests
python
huggingface__transformers
src/transformers/models/whisper/english_normalizer.py
{ "start": 2078, "end": 2783 }
class ____: def __init__(self, remove_diacritics: bool = False, split_letters: bool = False): self.clean = remove_symbols_and_diacritics if remove_diacritics else remove_symbols self.split_letters = split_letters def __call__(self, s: str): s = s.lower() s = re.sub(r"[<\[][^>\]]...
BasicTextNormalizer
python
huggingface__transformers
src/transformers/models/seamless_m4t/modeling_seamless_m4t.py
{ "start": 92030, "end": 94162 }
class ____(nn.Module): def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5), leaky_relu_slope=0.1): super().__init__() self.leaky_relu_slope = leaky_relu_slope self.convs1 = nn.ModuleList( [ nn.Conv1d( channels, c...
HifiGanResidualBlock
python
pandas-dev__pandas
pandas/tests/util/test_assert_produces_warning.py
{ "start": 8296, "end": 10123 }
class ____: def test_raise_on_warning(self, false_or_none): msg = r"Caused unexpected warning\(s\)" with pytest.raises(AssertionError, match=msg): with tm.assert_produces_warning(false_or_none): f() def test_no_raise_without_warning(self, false_or_none): with...
TestFalseOrNoneExpectedWarning
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_retry_execution.py
{ "start": 2078, "end": 3389 }
class ____(ReadonlyGraphQLContextTestMatrix): def test_retry_execution_permission_failure(self, graphql_context: WorkspaceRequestContext): selector = infer_job_selector(graphql_context, "eventually_successful") code_location = graphql_context.get_code_location(main_repo_location_name()) rep...
TestRetryExecutionReadonly
python
huggingface__transformers
examples/modular-transformers/modeling_test_detr.py
{ "start": 17053, "end": 21800 }
class ____(nn.Module): """ Multiscale deformable attention as proposed in Deformable DETR. """ def __init__(self, config: TestDetrConfig, num_heads: int, n_points: int): super().__init__() self.attn = MultiScaleDeformableAttention() if config.d_model % num_heads != 0: ...
TestDetrMultiscaleDeformableAttention
python
milvus-io__pymilvus
pymilvus/client/asynch.py
{ "start": 5179, "end": 5331 }
class ____(Future): def on_response(self, response: Any): check_status(response.status) return MutationResult(response)
MutationFuture
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 66064, "end": 66505 }
class ____(sgqlc.types.Enum): """Properties by which project workflows can be ordered. Enumeration Choices: * `CREATED_AT`: The workflows' date and time of creation * `NAME`: The workflows' name * `NUMBER`: The workflows' number * `UPDATED_AT`: The workflows' date and time of update """ ...
ProjectV2WorkflowsOrderField
python
google__jax
tests/state_test.py
{ "start": 24661, "end": 37070 }
class ____(jtu.JaxTestCase): def test_discharge_get(self): def f(a_ref): a = ref_get(a_ref, ()) return [a + 1] in_avals = [shaped_array_ref((), jnp.dtype('float32'))] stateful_jaxpr, _, consts = pe.trace_to_jaxpr_dynamic(wrap_init(f, 1), ...
StateDischargeTest
python
python__mypy
mypy/nodes.py
{ "start": 72999, "end": 73332 }
class ____(Expression): __slots__ = ("expr",) __match_args__ = ("expr",) expr: Expression | None def __init__(self, expr: Expression | None) -> None: super().__init__() self.expr = expr def accept(self, visitor: ExpressionVisitor[T]) -> T: return visitor.visit_yield_expr(...
YieldExpr
python
Farama-Foundation__Gymnasium
gymnasium/spaces/tuple.py
{ "start": 262, "end": 7598 }
class ____(Space[tuple[Any, ...]], typing.Sequence[Any]): """A tuple (more precisely: the cartesian product) of :class:`Space` instances. Elements of this space are tuples of elements of the constituent spaces. Example: >>> from gymnasium.spaces import Tuple, Box, Discrete >>> observation_...
Tuple
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/property17.py
{ "start": 477, "end": 602 }
class ____(Generic[T]): @property def prop(self: RootProto[T]) -> T: return self.root.prop @dataclass
RootMixin
python
doocs__leetcode
solution/0800-0899/0875.Koko Eating Bananas/Solution.py
{ "start": 0, "end": 250 }
class ____: def minEatingSpeed(self, piles: List[int], h: int) -> int: def check(k: int) -> bool: return sum((x + k - 1) // k for x in piles) <= h return 1 + bisect_left(range(1, max(piles) + 1), True, key=check)
Solution
python
dagster-io__dagster
python_modules/dagster/dagster/_config/errors.py
{ "start": 1700, "end": 2603 }
class ____(IHaveNew): config_type_snap: ConfigTypeSnap incoming_fields: Sequence[str] def __new__( cls, *, config_type_snap: ConfigTypeSnap, incoming_fields: Sequence[str], ): check.inst_param(config_type_snap, "config_type_snap", ConfigTypeSnap) check.pa...
SelectorTypeErrorData
python
lepture__authlib
authlib/oauth1/rfc5849/wrapper.py
{ "start": 481, "end": 4073 }
class ____: def __init__(self, method, uri, body=None, headers=None): InsecureTransportError.check(uri) self.method = method self.uri = uri self.body = body self.headers = headers or {} # states namespaces self.client = None self.credential = None ...
OAuth1Request
python
prabhupant__python-ds
data_structures/graphs/all_paths_between_two_vertices.py
{ "start": 208, "end": 1148 }
class ____: def __init__(self, vertices): self.vertices = vertices self.graph = [[] for i in range(vertices)] def add_edge(self, u, v): self.graph[u].append(v) def count_paths_util(self, u, v, visited, counter): visited[u] = True # If the destination ver...
Graph
python
pypa__setuptools
setuptools/_vendor/backports/tarfile/__init__.py
{ "start": 9951, "end": 10033 }
class ____(TarError): """Base exception for header errors.""" pass
HeaderError
python
huggingface__transformers
src/transformers/models/voxtral/modular_voxtral.py
{ "start": 1459, "end": 1876 }
class ____(Qwen2AudioPreTrainedModel): _supports_flex_attn = True _supports_cache_class = True _supports_attention_backend = True _can_compile_fullgraph = True _no_split_modules = None # TODO: @eustlb, I would really prefer to use WhisperEncoder but it's messing with modular @auto_docstring( c...
VoxtralPreTrainedModel
python
huggingface__transformers
src/transformers/models/marian/modeling_marian.py
{ "start": 56810, "end": 61482 }
class ____(MarianPreTrainedModel, GenerationMixin): _tied_weights_keys = { "lm_head.weight": "model.decoder.embed_tokens.weight", } def __init__(self, config): config.is_decoder = True config.is_encoder_decoder = False super().__init__(config) self.model = MarianDeco...
MarianForCausalLM
python
networkx__networkx
networkx/exception.py
{ "start": 1495, "end": 1658 }
class ____(NetworkXAlgorithmError): """Exception raised by algorithms trying to solve a problem instance that has no feasible solution."""
NetworkXUnfeasible
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/newType1.py
{ "start": 1982, "end": 2066 }
class ____(ABC): @abstractmethod def method1(self, /) -> int: ...
AbstractBase
python
sqlalchemy__sqlalchemy
test/typing/plain_files/orm/relationship.py
{ "start": 5220, "end": 5565 }
class ____: __tablename__ = "a" id: Mapped[int] = mapped_column(primary_key=True) b_id: Mapped[int] = mapped_column(ForeignKey("b.id")) number: Mapped[int] = mapped_column(primary_key=True) number2: Mapped[int] = mapped_column(primary_key=True) if TYPE_CHECKING: __table__: ClassVar[Table...
A
python
pypa__hatch
backend/src/hatchling/bridge/app.py
{ "start": 82, "end": 3242 }
class ____: """ The way output is displayed can be [configured](../config/hatch.md#terminal) by users. !!! important Never import this directly; Hatch judiciously decides if a type of plugin requires the capabilities herein and will grant access via an attribute. """ def __init__(s...
Application
python
jazzband__django-formtools
tests/wizard/namedwizardtests/forms.py
{ "start": 1485, "end": 1599 }
class ____(ContactWizard): storage_name = 'formtools.wizard.storage.session.SessionStorage'
SessionContactWizard
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 211458, "end": 212920 }
class ____(Operation): def call(self, xs): return backend.numpy.vstack(xs) def compute_output_spec(self, xs): first_shape = xs[0].shape total_size_on_axis = 0 dtypes_to_resolve = [] for x in xs: if not shape_equal(x.shape, first_shape, axis=[0], allow_none=Tr...
Vstack
python
getsentry__sentry
tests/sentry/db/test_router.py
{ "start": 343, "end": 5206 }
class ____(TestCase): """Simulated mode can resolve both silos to separate connections""" @override_settings(SILO_MODE=None) def test_simulated_no_silo(self) -> None: # Simulated silo mode should work the same as with a silo mode defined.. router = SiloRouter() router.use_simulated(...
SiloRouterSimulatedTest
python
pallets__werkzeug
examples/coolmagic/application.py
{ "start": 619, "end": 2468 }
class ____: """ The application class. It's passed a directory with configuration values. """ def __init__(self, config): self.config = config for fn in listdir(path.join(path.dirname(__file__), "views")): if fn.endswith(".py") and fn != "__init__.py": __imp...
CoolMagicApplication
python
walkccc__LeetCode
solutions/3424. Minimum Cost to Make Arrays Identical/3424.py
{ "start": 0, "end": 259 }
class ____: def minCost(self, arr: list[int], brr: list[int], k: int) -> int: def cost(arr: list[int], brr: list[int]) -> int: return sum(abs(a - b) for a, b in zip(arr, brr)) return min(cost(arr, brr), cost(sorted(arr), sorted(brr)) + k)
Solution
python
tensorflow__tensorflow
tensorflow/python/ops/nn_grad_test.py
{ "start": 4720, "end": 6750 }
class ____(test.TestCase): def run_test(self, x, y): with self.test_session(): error = gradient_checker.compute_gradient_error(x, x.get_shape().as_list(), y, ...
DepthwiseConv2dTest
python
getsentry__sentry
tests/snuba/api/endpoints/test_organization_trace_item_attributes.py
{ "start": 28577, "end": 33662 }
class ____( OrganizationTraceItemAttributesEndpointTestBase, TraceMetricsTestCase ): feature_flags = {"organizations:tracemetrics-enabled": True} item_type = SupportedTraceItemType.TRACEMETRICS def test_no_feature(self) -> None: response = self.do_request(features={}) assert response.st...
OrganizationTraceItemAttributesEndpointTraceMetricsTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 30138, "end": 30514 }
class ____(sgqlc.types.Enum): """Properties by which issue connections can be ordered. Enumeration Choices: * `COMMENTS`: Order issues by comment count * `CREATED_AT`: Order issues by creation time * `UPDATED_AT`: Order issues by update time """ __schema__ = github_schema __choices__ ...
IssueOrderField
python
jazzband__django-polymorphic
src/polymorphic/tests/models.py
{ "start": 5728, "end": 5787 }
class ____(PolymorphicModel): pass
ParentModelWithManager
python
spack__spack
lib/spack/spack/multimethod.py
{ "start": 11655, "end": 12039 }
class ____(spack.error.SpackError): """Raised when we can't find a version of a multi-method.""" def __init__(self, cls, method_name, spec, possible_specs): super().__init__( "Package %s does not support %s called with %s. Options are: %s" % (cls.__name__, method_name, spec, ",...
NoSuchMethodError
python
huggingface__transformers
src/transformers/models/mra/modeling_mra.py
{ "start": 9088, "end": 18228 }
class ____: @staticmethod def operator_call(sparse_query, indices, query_num_block, key_num_block): batch_size, num_block, block_size, _ = sparse_query.size() if len(sparse_query.size()) != 4: raise ValueError("sparse_query must be a 4-dimensional tensor.") if len(indices.s...
MraReduceSum
python
ray-project__ray
python/ray/data/_internal/datasource/json_datasource.py
{ "start": 6390, "end": 9730 }
class ____(FileBasedDatasource): # Buffer size in bytes for reading files. Default is 1MB. # # pandas reads data in small chunks (~8 KiB), which leads to many costly # small read requests when accessing cloud storage. To reduce overhead and # improve performance, we wrap the file in a larger buffer...
PandasJSONDatasource
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/attributes.py
{ "start": 338, "end": 373 }
class ____: token: str = ""
Token
python
sanic-org__sanic
sanic/request/types.py
{ "start": 2405, "end": 37161 }
class ____(Generic[sanic_type, ctx_type]): """State of HTTP request. Args: url_bytes (bytes): Raw URL bytes. headers (Header): Request headers. version (str): HTTP version. method (str): HTTP method. transport (TransportProtocol): Transport protocol. app (Sanic):...
Request
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/conditional_constrained_dependencies/package.py
{ "start": 216, "end": 664 }
class ____(Package): """Package that has a variant which adds a dependency forced to use non default values. """ homepage = "https://dev.null" version("1.0") # This variant is on by default and attaches a dependency # with a lot of variants set at their non-default values variant("dep...
ConditionalConstrainedDependencies
python
pytorch__pytorch
test/distributed/_composable/test_composability/test_2d_composability.py
{ "start": 21246, "end": 25607 }
class ____(DTensorTestBase): def _compare_params(self, m1, m2): with FSDP.summon_full_params(m1): with FSDP.summon_full_params(m2): for n_p1, n_p2 in zip(m1.named_parameters(), m2.named_parameters()): p1 = n_p1[1] p2 = n_p2[1] ...
TestNew2dParallelTraining
python
pydantic__pydantic
tests/mypy/modules/plugin_fail.py
{ "start": 1387, "end": 1455 }
class ____(BaseModel, from_attributes=list): pass
KwargsBadConfig2
python
PyCQA__pylint
tests/functional/p/property_affectation_py26.py
{ "start": 104, "end": 447 }
class ____: """Smallest test case for reported issue.""" def __init__(self): self._thing = None @property def myattr(self): """Getter for myattr""" return self._thing @myattr.setter def myattr(self, value): """Setter for myattr.""" self._thing = value ...
Test
python
ray-project__ray
python/ray/tune/tests/test_function_api.py
{ "start": 695, "end": 3602 }
class ____(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.TemporaryDirectory() self.logger_creator = creator_generator( os.path.join(self.tmpdir.name, "logdir") ) def create_trainable(self, train_fn): return wrap_function(train_fn)( logger_cr...
FunctionCheckpointingTest
python
huggingface__transformers
src/transformers/models/gpt_neox_japanese/modeling_gpt_neox_japanese.py
{ "start": 14781, "end": 17069 }
class ____(nn.Module): def __init__(self, config, layer_number): super().__init__() self.layer_number = layer_number self.input_layernorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.post_attention_layernorm = nn.LayerNorm(config.hidden_size, eps=config.layer_no...
GPTNeoXJapaneseLayer
python
pydata__xarray
xarray/tests/test_combine.py
{ "start": 12246, "end": 12882 }
class ____: def test_check_depths(self): ds = create_test_data(0) combined_tile_ids = {(0,): ds, (0, 1): ds} with pytest.raises( ValueError, match=r"sub-lists do not have consistent depths" ): _check_shape_tile_ids(combined_tile_ids) def test_check_length...
TestCheckShapeTileIDs
python
modin-project__modin
modin/tests/pandas/native_df_interoperability/test_compiler_caster.py
{ "start": 4165, "end": 4354 }
class ____(CloudQC): def get_backend(self): return "Cloud_High_Self" def stay_cost(self, api_cls_name, op, arguments): return QCCoercionCost.COST_HIGH
CloudQCHighSelf
python
pytest-dev__pytest-xdist
testing/test_remote.py
{ "start": 791, "end": 2502 }
class ____: def __init__( self, request: pytest.FixtureRequest, pytester: pytest.Pytester ) -> None: self.request = request self.pytester = pytester self.use_callback = False self.events = Queue() # type: ignore[var-annotated] def setup(self) -> None: self.p...
WorkerSetup
python
oauthlib__oauthlib
oauthlib/oauth2/rfc6749/errors.py
{ "start": 296, "end": 3933 }
class ____(Exception): error = None status_code = 400 description = '' def __init__(self, description=None, uri=None, state=None, status_code=None, request=None): """ :param description: A human-readable ASCII [USASCII] text providing additio...
OAuth2Error
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-vertex/tests/test_embeddings_vertex.py
{ "start": 4500, "end": 6620 }
class ____(unittest.IsolatedAsyncioTestCase): @patch("vertexai.init") @patch("vertexai.language_models.TextEmbeddingModel.from_pretrained") async def test_get_embedding_retrieval( self, model_mock: AsyncMock, init_mock: AsyncMock ): model = MagicMock() model.get_embeddings_async ...
VertexTextEmbeddingTestAsync
python
PyCQA__pydocstyle
src/pydocstyle/parser.py
{ "start": 6838, "end": 6943 }
class ____(Function): """A Python source code nested function.""" is_public = False
NestedFunction
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/graphql.py
{ "start": 10984, "end": 11625 }
class ____: def __init__(self, typenames): self.typename_to_prio = {o: prio for prio, o in enumerate(reversed(typenames))} self.count = itertools.count() self.storage = [] def add_cursor(self, typename, cursor, total_count, parent_id=None): priority = self.typename_to_prio[typen...
CursorStorage
python
ray-project__ray
python/ray/_private/thirdparty/pynvml/pynvml.py
{ "start": 93603, "end": 94101 }
class ____(_PrintableStructure): _fields_ = [ ('version', c_uint), # input ('engineId', c_uint), # input. One of NVML_ENGINE_TYPE* ('schedulerPolicy', c_uint), # output ('arrMode', c_uint), ...
c_nvmlVgpuSchedulerStateInfo_v1_t
python
astropy__astropy
astropy/io/votable/exceptions.py
{ "start": 9967, "end": 12565 }
class ____(VOTableChangeWarning): """Implicitly generating an ID from a name. The VOTable 1.1 spec says the following about ``name`` vs. ``ID`` on ``FIELD`` and ``VALUE`` elements: ``ID`` and ``name`` attributes have a different role in VOTable: the ``ID`` is meant as a *unique identifier*...
W03
python
facelessuser__pymdown-extensions
tests/test_extensions/test_slugs.py
{ "start": 1666, "end": 2280 }
class ____(util.MdCase): """Test Unicode cased, encoded slugs.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.slugify(percent_encode=True) } } def test_slug(self): """Test the slug output.""" ...
TestUslugifyCasedEncoded
python
Lightning-AI__lightning
src/lightning/fabric/utilities/data.py
{ "start": 1292, "end": 21615 }
class ____(LightningEnum): SET = "set" DEL = "del" def __call__(self, *args: Any) -> None: fn: Union[Callable[[object, str], None], Callable[[object, str, Any], None]] fn = setattr if self == self.SET else delattr return fn(*args) def has_iterable_dataset(dataloader: object) -> bo...
_WrapAttrTag
python
wandb__wandb
tests/system_tests/test_core/test_torch_full.py
{ "start": 1493, "end": 1825 }
class ____(nn.Module): def __init__(self, num_outputs=2): super().__init__() self.linear1 = nn.Linear(1, 10) self.linear2 = nn.Linear(10, num_outputs) self.dist = Discrete() def forward(self, x): x = self.linear1(x) x = self.linear2(x) return self.dist(x)...
DiscreteModel
python
coleifer__peewee
peewee.py
{ "start": 12927, "end": 13673 }
class ____(Proxy): """ Proxy implementation specifically for proxying `Database` objects. """ __slots__ = ('obj', '_callbacks', '_Model') def connection_context(self): return ConnectionContext(self) def atomic(self, *args, **kwargs): return _atomic(self, *args, **kwargs) def...
DatabaseProxy
python
getsentry__sentry
tests/sentry/workflow_engine/handlers/condition/test_first_seen_event_handler.py
{ "start": 427, "end": 2974 }
class ____(ConditionTestCase): condition = Condition.FIRST_SEEN_EVENT payload = {"id": FirstSeenEventCondition.id} def setUp(self) -> None: super().setUp() self.event_data = WorkflowEventData( event=self.group_event, group=self.group_event.group, group_st...
TestFirstSeenEventCondition
python
apache__airflow
airflow-core/src/airflow/utils/db.py
{ "start": 44587, "end": 52121 }
class ____(enum.IntEnum): """ Cross-db Identifiers for advisory global database locks. Postgres uses int64 lock ids so we use the integer value, MySQL uses names, so we call ``str()`, which is implemented using the ``_name_`` field. """ MIGRATIONS = enum.auto() SCHEDULER_CRITICAL_SECTION =...
DBLocks
python
scrapy__scrapy
scrapy/spidermiddlewares/referer.py
{ "start": 5974, "end": 6944 }
class ____(ReferrerPolicy): """ https://www.w3.org/TR/referrer-policy/#referrer-policy-strict-origin The "strict-origin" policy sends the ASCII serialization of the origin of the request client when making requests: - from a TLS-protected environment settings object to a potentially trustworthy URL...
StrictOriginPolicy
python
allegroai__clearml
clearml/backend_api/services/v2_23/projects.py
{ "start": 125693, "end": 129515 }
class ____(Request): """ Get user and system tags used for the tasks under the specified projects :param include_system: If set to 'true' then the list of the system tags is also returned. The default value is 'false' :type include_system: bool :param projects: The list of projects under wh...
GetTaskTagsRequest
python
encode__django-rest-framework
tests/test_filters.py
{ "start": 2415, "end": 2544 }
class ____(models.Model): title = models.CharField(max_length=20) text = models.CharField(max_length=100)
SearchFilterModel
python
ApeWorX__ape
src/ape/plugins/config.py
{ "start": 146, "end": 1075 }
class ____(PluginType): """ A registered config item. Plugins register config implementations when they allow additional user-configuration, set in the ``ape-config.yaml``. See the :class:`~ape.managers.config.ConfigManager` documentation for more information on the ``ape-config.yaml``. """ ...
Config
python
altair-viz__altair
tools/datasets/models.py
{ "start": 1141, "end": 1252 }
class ____(TypedDict, total=False): title: str path: Required[str] email: str version: str
Source
python
crytic__slither
slither/detectors/attributes/constant_pragma.py
{ "start": 431, "end": 2179 }
class ____(AbstractDetector): """ Check that the same pragma is used in all the files """ ARGUMENT = "pragma" HELP = "If different pragma directives are used" IMPACT = DetectorClassification.INFORMATIONAL CONFIDENCE = DetectorClassification.HIGH WIKI = "https://github.com/crytic/slithe...
ConstantPragma
python
django-extensions__django-extensions
django_extensions/management/commands/dumpscript.py
{ "start": 28992, "end": 29125 }
class ____: def __init__(self, string): self.repr = string def __repr__(self): return self.repr
StrToCodeChanger
python
pytorch__pytorch
torch/_inductor/codegen/common.py
{ "start": 65643, "end": 72535 }
class ____(Generic[CSEVariableType, AugmentedKeyT]): """Common subexpression elimination""" def __init__( self, prefix: str = "", suffix: str = "", name_prefix: str = "tmp", iter_buffers: Optional[itertools.count[int]] = None, store_cache: Optional[MutableMapping...
CSE
python
huggingface__transformers
src/transformers/models/zamba2/modeling_zamba2.py
{ "start": 25309, "end": 47701 }
class ____(nn.Module): """ Compute ∆, A, B, C, and D the state space parameters and compute the `contextualized_states`. A, D are input independent (see Mamba paper [1] Section 3.5.2 "Interpretation of A" for why A isn't selective) ∆, B, C are input-dependent (this is a key difference between Mamba and ...
Zamba2MambaMixer
python
ansible__ansible
lib/ansible/utils/encrypt.py
{ "start": 2865, "end": 3478 }
class ____(object): algorithms = { 'md5_crypt': _Algo(crypt_id='1', salt_size=8), 'bcrypt': _Algo(crypt_id='2b', salt_size=22, implicit_rounds=12, salt_exact=True, implicit_ident='2b', rounds_format='cost'), 'sha256_crypt': _Algo(crypt_id='5', salt_size=16, implicit_rounds=535000, rounds_for...
BaseHash
python
scipy__scipy
benchmarks/benchmarks/spatial.py
{ "start": 10497, "end": 11021 }
class ____(Benchmark): params = [10, 100, 1000, 5000, 10000] param_names = ['num_points'] def setup(self, num_points): self.points = generate_spherical_points(num_points) self.sv = SphericalVoronoi(self.points, radius=1, center=np.zeros(3)) def time_s...
SphericalVorSort
python
PyCQA__pylint
tests/functional/ext/private_import/private_import.py
{ "start": 4483, "end": 4721 }
class ____: def save(self): return self # Treat relative imports as internal from .other_file import _private from ..parent import _private from _private_module_x import some_name # [import-private-name] VAR = some_name
Example
python
scipy__scipy
scipy/sparse/linalg/_dsolve/tests/test_linsolve.py
{ "start": 16639, "end": 26645 }
class ____: def setup_method(self): use_solver(useUmfpack=False) n = 40 d = arange(n) + 1 self.n = n self.A = dia_array(((d, 2*d, d[::-1]), (-3, 0, 5)), shape=(n, n)).tocsc() def _smoketest(self, spxlu, check, dtype, idx_dtype): if np.issubdtype(dtype, np.complex...
TestSplu
python
Lightning-AI__lightning
src/lightning/pytorch/accelerators/cpu.py
{ "start": 1061, "end": 3313 }
class ____(Accelerator): """Accelerator for CPU devices.""" @override def setup_device(self, device: torch.device) -> None: """ Raises: MisconfigurationException: If the selected device is not CPU. """ if device.type != "cpu": raise Mi...
CPUAccelerator