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
tensorflow__tensorflow
tensorflow/python/eager/memory_tests/remote_memory_test.py
{ "start": 1132, "end": 2174 }
class ____(test.TestCase): def __init__(self, method): super(RemoteWorkerMemoryTest, self).__init__(method) # used for remote worker tests self._cached_server = server_lib.Server.create_local_server() self._cached_server_target = self._cached_server.target[len("grpc://"):] def testMemoryLeakInLoc...
RemoteWorkerMemoryTest
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_gap05.py
{ "start": 315, "end": 1365 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_gap05.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_f...
TestCompareXLSXFiles
python
networkx__networkx
networkx/algorithms/tree/coding.py
{ "start": 694, "end": 13445 }
class ____(nx.NetworkXException): """Raised when a function expects a tree (that is, a connected undirected graph with no cycles) but gets a non-tree graph as input instead. """ @not_implemented_for("directed") @nx._dispatchable(graphs="T") def to_nested_tuple(T, root, canonical_form=False): """R...
NotATree
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 256718, "end": 257057 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("client_mutation_id", "project") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") project = sgqlc.types.Field("Project", graphql_name="project")...
CreateProjectPayload
python
scrapy__scrapy
scrapy/spiders/crawl.py
{ "start": 3161, "end": 7850 }
class ____(Spider): rules: Sequence[Rule] = () _rules: list[Rule] _follow_links: bool def __init__(self, *a: Any, **kw: Any): super().__init__(*a, **kw) self._compile_rules() if method_is_overridden(self.__class__, CrawlSpider, "_parse_response"): warnings.warn( ...
CrawlSpider
python
encode__django-rest-framework
tests/test_views.py
{ "start": 1931, "end": 2389 }
class ____(TestCase): def setUp(self): self.view = BasicView.as_view() def test_400_parse_error(self): request = factory.post('/', 'f00bar', content_type='application/json') response = self.view(request) expected = { 'detail': JSON_ERROR } assert resp...
ClassBasedViewIntegrationTests
python
django__django
tests/schema/models.py
{ "start": 2498, "end": 2763 }
class ____(models.Model): author = models.OneToOneField(Author, models.CASCADE) title = models.CharField(max_length=100, db_index=True) pub_date = models.DateTimeField() class Meta: apps = new_apps db_table = "schema_book"
BookWithO2O
python
django__django
tests/multiple_database/tests.py
{ "start": 97724, "end": 98424 }
class ____(SimpleTestCase): """allow_relation() is called with unsaved model instances.""" databases = {"default", "other"} router_prevents_msg = "the current database router prevents this relation" def test_foreign_key_relation(self): person = Person(name="Someone") pet = Pet() ...
RelationAssignmentTests
python
pandas-dev__pandas
pandas/tests/test_common.py
{ "start": 337, "end": 1048 }
class ____: def fn(self, x): return x partial1 = partial(fn) partial2 = partial(partial1) lambda_ = lambda x: x class SomeCall: def __call__(self): # This shouldn't actually get called below; SomeCall.__init__ # should. raise NotImplementedError...
TestGetCallableName
python
airbytehq__airbyte
airbyte-integrations/connectors/source-braintree/source_braintree/schemas/dispute.py
{ "start": 373, "end": 465 }
class ____(CatalogModel): message: str send_at: datetime sender: str
PaypalMessage
python
Textualize__textual
docs/examples/guide/layout/grid_layout5_col_span.py
{ "start": 80, "end": 560 }
class ____(App): CSS_PATH = "grid_layout5_col_span.tcss" def compose(self) -> ComposeResult: yield Static("One", classes="box") yield Static("Two [b](column-span: 2)", classes="box", id="two") yield Static("Three", classes="box") yield Static("Four", classes="box") yield...
GridLayoutExample
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/engine/result.py
{ "start": 2508, "end": 6031 }
class ____: """Base for metadata about result rows.""" __slots__ = () _tuplefilter: Optional[_TupleGetterType] = None _translated_indexes: Optional[Sequence[int]] = None _unique_filters: Optional[Sequence[Callable[[Any], Any]]] = None _keymap: _KeyMapType _keys: Sequence[str] _processo...
ResultMetaData
python
matplotlib__matplotlib
lib/matplotlib/backends/backend_pgf.py
{ "start": 13573, "end": 29488 }
class ____(RendererBase): def __init__(self, figure, fh): """ Create a new PGF renderer that translates any drawing instruction into text commands to be interpreted in a latex pgfpicture environment. Attributes ---------- figure : `~matplotlib.figure.Figure` ...
RendererPgf
python
tensorflow__tensorflow
tensorflow/python/autograph/pyct/static_analysis/type_inference.py
{ "start": 1620, "end": 4936 }
class ____(object): """Resolver objects handle the process of looking up actual names and types. Unless noted otherwise, all resolve_* methods: * have a first namespace argument, mapping string to actual values * have a second types_namespace argument, mapping string to actual inferred types * sp...
Resolver
python
sqlalchemy__sqlalchemy
test/sql/test_resultset.py
{ "start": 123815, "end": 127585 }
class ____(fixtures.TablesTest): __sparse_driver_backend__ = True @classmethod def define_tables(cls, metadata): Table( "users", metadata, Column("user_id", INT, primary_key=True, autoincrement=False), Column("user_name", VARCHAR(20)), Col...
GenerativeResultTest
python
scipy__scipy
scipy/stats/tests/test_multivariate.py
{ "start": 120471, "end": 122715 }
class ____: @pytest.mark.parametrize("dim", [1, 3]) @pytest.mark.parametrize("size", [None, 1, 5, (5, 4)]) def test_samples(self, dim, size): # test that samples have correct shape and norm 1 rng = np.random.default_rng(2777937887058094419) uniform_direction_dist = uniform_direction(...
TestUniformDirection
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/migrate_to_manifest_only/declarative_component_schema.py
{ "start": 1479, "end": 1874 }
class ____(BaseModel): type: Literal["BearerAuthenticator"] api_token: str = Field( ..., description="Token to inject as request header for authenticating with the API.", examples=["{{ config['api_key'] }}", "{{ config['token'] }}"], title="Bearer Token", ) parameters: Op...
BearerAuthenticator
python
keras-team__keras
keras/src/trainers/trainer_test.py
{ "start": 4282, "end": 4549 }
class ____(Trainer, layers.Layer): def __init__(self, **kwargs): layers.Layer.__init__(self, **kwargs) Trainer.__init__(self) def call(self, x, training=False): if training: return x return x * 0
TrainingTestingLayer
python
sqlalchemy__sqlalchemy
test/orm/test_dataclasses.py
{ "start": 15714, "end": 21159 }
class ____(fixtures.DeclarativeMappedTest): @classmethod def setup_classes(cls): declarative = cls.DeclarativeBasic.registry.mapped @dataclasses.dataclass class WidgetDC: __sa_dataclass_metadata_key__ = "sa" widget_id: int = dataclasses.field( in...
FieldEmbeddedMixinWLambdaTest
python
mlflow__mlflow
mlflow/spacy/__init__.py
{ "start": 10826, "end": 13749 }
class ____: def __init__(self, spacy_model): self.spacy_model = spacy_model def get_raw_model(self): """ Returns the underlying model. """ return self.spacy_model def predict( self, dataframe, params: dict[str, Any] | None = None, ): ...
_SpacyModelWrapper
python
fluentpython__example-code-2e
09-closure-deco/clock/clockdeco_cls.py
{ "start": 366, "end": 1037 }
class ____: # <1> def __init__(self, fmt=DEFAULT_FMT): # <2> self.fmt = fmt def __call__(self, func): # <3> def clocked(*_args): t0 = time.perf_counter() _result = func(*_args) # <4> elapsed = time.perf_counter() - t0 name = func.__name__ ...
clock
python
PrefectHQ__prefect
src/integrations/prefect-github/tests/test_graphql.py
{ "start": 912, "end": 1645 }
class ____: def __init__(self, error_key=None): self.result = ( {error_key: "Errors encountered:"} if error_key else {"data": "success"} ) def get_endpoint(self): return lambda op, vars: self.result def get_client(self): return lambda op, vars: self.result @py...
MockCredentials
python
huggingface__transformers
src/transformers/models/x_clip/modeling_x_clip.py
{ "start": 43192, "end": 44758 }
class ____(nn.Module): """ This corresponds to the `MultiframeIntegrationTransformer` class in the original implementation. """ def __init__(self, config: XCLIPVisionConfig): super().__init__() self.position_embedding = nn.Parameter(torch.empty(1, config.num_frames, config.hidden_size)...
XCLIPMultiframeIntegrationTransformer
python
getsentry__sentry
src/sentry/identity/github/provider.py
{ "start": 881, "end": 1963 }
class ____(OAuth2Provider): key = IntegrationProviderSlug.GITHUB.value name = "GitHub" oauth_access_token_url = "https://github.com/login/oauth/access_token" oauth_authorize_url = "https://github.com/login/oauth/authorize" oauth_scopes = () def get_oauth_client_id(self): return option...
GitHubIdentityProvider
python
Textualize__textual
tests/command_palette/test_declare_sources.py
{ "start": 712, "end": 1080 }
class ____(AppWithActiveCommandPalette): pass async def test_no_app_command_sources() -> None: """An app with no sources declared should work fine.""" async with AppWithNoSources().run_test() as pilot: assert isinstance(pilot.app.screen, CommandPalette) assert pilot.app.screen._provider_cl...
AppWithNoSources
python
pytorch__pytorch
torchgen/api/autograd.py
{ "start": 9746, "end": 38959 }
class ____: func: NativeFunction info: dict[str, DifferentiabilityInfo] | None fw_derivatives: dict[str, Sequence[ForwardDerivative]] | None # TODO: Update comment below since it is out of date. def dispatch_strategy(fn: NativeFunctionWithDifferentiabilityInfo) -> str: """How are we going to call the ...
NativeFunctionWithDifferentiabilityInfo
python
joke2k__faker
tests/providers/test_job.py
{ "start": 3589, "end": 3840 }
class ____: """Test ka_GE job provider""" def test_job(self, faker, num_samples): for _ in range(num_samples): job = faker.job() assert isinstance(job, str) assert job in KaGeJobProvider.jobs
TestKaGe
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/constructor20.py
{ "start": 266, "end": 929 }
class ____(Generic[T]): def add(self, a: T, b: T) -> T: return a + b int_adder: Adder[int] = Adder() int_adder.add(1, 2) # This should be an error because "adder" # should be of type Adder[int]. int_adder.add("1", 2) def requires_str_adder(str_adder: Adder[str]): return str_adder a = requires_str...
Adder
python
google__jax
examples/ffi/tests/cpu_examples_test.py
{ "start": 771, "end": 2166 }
class ____(jtu.JaxTestCase): def setUp(self): super().setUp() if not jtu.test_device_matches(["cpu"]): self.skipTest("Unsupported platform") def test_array_attr(self): self.assertEqual(cpu_examples.array_attr(5), jnp.arange(5).sum().astype(jnp.int32)) self.assertEqual(cpu_examples.array_attr...
AttrsTests
python
joke2k__faker
faker/providers/phone_number/ro_RO/__init__.py
{ "start": 49, "end": 2484 }
class ____(PhoneNumberProvider): formats = ( "021 ### ####", "0231 ### ###", "0232 ### ###", "0233 ### ###", "0234 ### ###", "0235 ### ###", "0236 ### ###", "0237 ### ###", "0238 ### ###", "0239 ### ###", "0240 ### ###", ...
Provider
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_quote_name01.py
{ "start": 315, "end": 1920 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("quote_name01.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_...
TestCompareXLSXFiles
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_W.py
{ "start": 3118, "end": 4229 }
class ____(Benchmark): r""" Wayburn and Seader 1 objective function. This class defines the Wayburn and Seader 1 [1]_ global optimization problem. This is a unimodal minimization problem defined as follows: .. math:: f_{\text{WayburnSeader01}}(x) = (x_1^6 + x_2^4 - 17)^2 ...
WayburnSeader01
python
pytorch__pytorch
torch/_dynamo/variables/lists.py
{ "start": 29780, "end": 36232 }
class ____(CommonListMethodsVariable): def python_type(self) -> type: return list def __repr__(self) -> str: return f"{self.__class__.__name__}(length={len(self.items)})" def debug_repr(self) -> str: return self.debug_repr_helper("[", "]") def reconstruct(self, codegen: "PyCod...
ListVariable
python
pytorch__pytorch
test/torch_np/numpy_tests/core/test_shape_base.py
{ "start": 15959, "end": 20268 }
class ____(TestCase): @skipif(numpy.__version__ < "1.24", reason="NP_VER: fails on NumPy 1.23.x") def test_stack(self): # non-iterable input assert_raises(TypeError, stack, 1) # 0d input for input_ in [ (1, 2, 3), [np.int32(1), np.int32(2), np.int32(3)], ...
TestStackMisc
python
ray-project__ray
rllib/utils/tests/test_tf_utils.py
{ "start": 1707, "end": 2422 }
class ____: def __init__(self): # Uses a separate graph for each network. with tf.Graph().as_default(): # Create the network. loss, init, _, _ = make_linear_network() sess = tf.Session() # Additional code for setting and getting the weights. ...
NetActor
python
pytorch__pytorch
test/dynamo/test_higher_order_ops.py
{ "start": 194220, "end": 197055 }
class ____(torch.nn.Module): def forward(self, L_x_: "f32[3, 3, 3]"): l_x_ = L_x_ _saved_tensors_hooks_disable = torch._C._autograd._saved_tensors_hooks_disable("torch.func.{grad, vjp, jacrev, hessian} don't yet support saved tensor hooks. Please open an issue with your use case."); _saved_tensors...
GraphModule
python
pypa__warehouse
tests/common/db/oidc.py
{ "start": 3371, "end": 3852 }
class ____(WarehouseFactory): class Meta: model = PendingActiveStatePublisher id = factory.Faker("uuid4", cast_to=None) project_name = factory.Faker("pystr", max_chars=12) organization = factory.Faker("pystr", max_chars=12) activestate_project_name = factory.Faker("pystr", max_chars=12) ...
PendingActiveStatePublisherFactory
python
celery__celery
celery/backends/cassandra.py
{ "start": 1572, "end": 9014 }
class ____(BaseBackend): """Cassandra/AstraDB backend utilizing DataStax driver. Raises: celery.exceptions.ImproperlyConfigured: if module :pypi:`cassandra-driver` is not available, or not-exactly-one of the :setting:`cassandra_servers` and the :setting:`cassandra_se...
CassandraBackend
python
tensorflow__tensorflow
tensorflow/python/data/experimental/kernel_tests/map_defun_op_test.py
{ "start": 1799, "end": 14116 }
class ____(test_base.DatasetTestBase, parameterized.TestCase): @combinations.generate(_test_combinations()) def testNoIntraOpLimit(self): @def_function.function( input_signature=[tensor_spec.TensorSpec([2], dtypes.int32)]) def simple_fn(x): return x * 2 + 3 nums = [[1, 2], [3, 4], [5, 6...
MapDefunTest
python
fluentpython__example-code-2e
08-def-type-hints/coordinates/coordinates_named.py
{ "start": 270, "end": 817 }
class ____(NamedTuple): lat: float lon: float def geohash(lat_lon: Coordinate) -> str: return gh.encode(*lat_lon, PRECISION) # end::GEOHASH[] # tag::DISPLAY[] def display(lat_lon: tuple[float, float]) -> str: lat, lon = lat_lon ns = 'N' if lat >= 0 else 'S' ew = 'E' if lon >= 0 else 'W' re...
Coordinate
python
weaviate__weaviate-python-client
weaviate/collections/queries/fetch_objects/query/executor.py
{ "start": 769, "end": 7933 }
class ____( Generic[ConnectionType, Properties, References], _BaseExecutor[ConnectionType] ): @overload def fetch_objects( self, *, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, filters: Optional[_Filters] = None, ...
_FetchObjectsQueryExecutor
python
pytorch__pytorch
torch/_inductor/codegen/cuda/cuda_kernel.py
{ "start": 1619, "end": 1850 }
class ____: node: IRNode symbol: ValidLayoutSymbols attr: ValidLayoutAttrs dim: int def matches(self, node, attr, dim) -> bool: return self.node == node and self.attr == attr and self.dim == dim
LayoutArg
python
huggingface__transformers
tests/models/qwen3_next/test_modeling_qwen3_next.py
{ "start": 1768, "end": 8821 }
class ____(CausalLMModelTest, unittest.TestCase): model_tester_class = Qwen3NextModelTester def _check_past_key_values_for_generate(self, batch_size, past_key_values, seq_length, config): "Qwen3-Next has a special Cache as it alternates with gated deltanet layers" self.assertIsInstance(past_key...
Qwen3NextModelTest
python
apache__airflow
airflow-core/tests/unit/api_fastapi/execution_api/versions/v2025_09_23/test_task_instances.py
{ "start": 1201, "end": 3237 }
class ____: """Test that API version 2025-09-23 does NOT include triggering_user_name field.""" def setup_method(self): clear_db_runs() def teardown_method(self): clear_db_runs() def test_ti_run_excludes_triggering_user_name( self, ver_client, session, ...
TestTIRunStateV20250923
python
wandb__wandb
wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor.py
{ "start": 258, "end": 3941 }
class ____(object): __slots__ = 'in_array', 'index', 'keys', 'edits', 'prev' def __init__(self, in_array, index, keys, edits, prev): self.in_array = in_array self.index = index self.keys = keys self.edits = edits self.prev = prev def visit(root, visitor, key_map=None):...
Stack
python
huggingface__transformers
src/transformers/pipelines/base.py
{ "start": 14974, "end": 19002 }
class ____: """ Base class for all the pipeline supported data format both for reading and writing. Supported data formats currently includes: - JSON - CSV - stdin/stdout (pipe) `PipelineDataFormat` also includes some utilities to work with multi-columns like mapping from datasets columns ...
PipelineDataFormat
python
doocs__leetcode
solution/0000-0099/0075.Sort Colors/Solution.py
{ "start": 0, "end": 397 }
class ____: def sortColors(self, nums: List[int]) -> None: i, j, k = -1, len(nums), 0 while k < j: if nums[k] == 0: i += 1 nums[i], nums[k] = nums[k], nums[i] k += 1 elif nums[k] == 2: j -= 1 nums...
Solution
python
optuna__optuna
optuna/storages/_heartbeat.py
{ "start": 2711, "end": 2891 }
class ____(BaseHeartbeatThread): def __init__(self) -> None: pass def start(self) -> None: pass def join(self) -> None: pass
NullHeartbeatThread
python
davidhalter__parso
parso/python/parser.py
{ "start": 213, "end": 8108 }
class ____(BaseParser): """ This class is used to parse a Python file, it then divides them into a class structure of different scopes. :param pgen_grammar: The grammar object of pgen2. Loaded by load_grammar. """ node_map = { 'expr_stmt': tree.ExprStmt, 'classdef': tree.Class,...
Parser
python
huggingface__transformers
src/transformers/models/bamba/modeling_bamba.py
{ "start": 22902, "end": 46141 }
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 ...
BambaMixer
python
Delgan__loguru
loguru/_better_exceptions.py
{ "start": 523, "end": 3797 }
class ____: _default_style = frozenset( { "comment": "\x1b[30m\x1b[1m{}\x1b[0m", "keyword": "\x1b[35m\x1b[1m{}\x1b[0m", "builtin": "\x1b[1m{}\x1b[0m", "string": "\x1b[36m{}\x1b[0m", "number": "\x1b[34m\x1b[1m{}\x1b[0m", "operator": "\x1...
SyntaxHighlighter
python
pytorch__pytorch
torch/testing/_internal/distributed/distributed_test.py
{ "start": 3024, "end": 3357 }
class ____(nn.Module): def __init__(self) -> None: super().__init__() self.a = nn.Linear(10, 10, bias=False) self.b = nn.Linear(10, 1, bias=False) self.register_buffer("buffer", torch.randn(1, 2)) def forward(self, x): self.buffer.add_(1) return self.b(self.a(x))...
NetWithBuffers
python
PyCQA__pylint
doc/data/messages/s/super-without-brackets/bad.py
{ "start": 78, "end": 234 }
class ____(Soup): @staticmethod def temp(): super.temp() # [super-without-brackets] print("But tomato soup is even hotter!")
TomatoSoup
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 839069, "end": 839805 }
class ____(sgqlc.types.relay.Connection): """The connection type for ProjectCard.""" __schema__ = github_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("ProjectCardEdge"), graphql_name="edges") """A list of edges.""" nodes ...
ProjectCardConnection
python
kamyu104__LeetCode-Solutions
Python/latest-time-you-can-obtain-after-replacing-characters.py
{ "start": 38, "end": 524 }
class ____(object): def findLatestTime(self, s): """ :type s: str :rtype: str """ result = list(s) if result[0] == '?': result[0] = '1' if result[1] == '?' or result[1] <= '1' else '0' if result[1] == '?': result[1] = '1' if result[0]...
Solution
python
mlflow__mlflow
tests/pyfunc/test_scoring_server.py
{ "start": 1846, "end": 3092 }
class ____(PythonModel): def predict(self, context, model_input, params=None): # If (and only-if) we define model signature, input is converted # to pandas DataFrame in _enforce_schema applied in Pyfunc.predict. # TODO: Confirm if this is ok, for me it sounds confusing. if isinstance...
MyChatLLM
python
PrefectHQ__prefect
tests/client/test_base_client.py
{ "start": 27748, "end": 36600 }
class ____: """Test custom headers functionality in HTTP clients.""" async def test_default_no_custom_headers(self): """Test that no custom headers are added by default.""" async with PrefectHttpxAsyncClient(base_url="http://localhost:4200") as client: # Should only have standard he...
TestCustomHeaders
python
getsentry__sentry
src/sentry/replays/usecases/ingest/event_parser.py
{ "start": 1170, "end": 1246 }
class ____: timestamp: float url: str | None @dataclass
HydrationError
python
tensorflow__tensorflow
tensorflow/python/feature_column/serialization_test.py
{ "start": 929, "end": 4073 }
class ____(test.TestCase): """Tests for serialization, deserialization helpers.""" def test_serialize_non_feature_column(self): class NotAFeatureColumn(object): pass with self.assertRaisesRegex(ValueError, 'is not a FeatureColumn'): serialization.serialize_feature_column(NotAFeatureColumn()) ...
FeatureColumnSerializationTest
python
altair-viz__altair
tests/utils/test_core.py
{ "start": 1630, "end": 11863 }
class ____(ValueChannel, schemapi.SchemaBase): _schema = {json_schema_dict_str} _encoding_name = "strokeWidth" ''' @pytest.fixture(params=[False, True]) def pd_data(request) -> pd.DataFrame: data = pd.DataFrame( { "x": [1, 2, 3, 4, 5], "y": ["A", "B", "C", "D", "E"], ...
StrokeWidthValue
python
great-expectations__great_expectations
great_expectations/metrics/column_pair/column_pair.py
{ "start": 266, "end": 622 }
class ____(Metric[_MetricResult], kw_only=True): column_A: NonEmptyString column_B: NonEmptyString ignore_row_if: Literal["both_values_are_missing", "either_value_is_missing", "neither"] = ( "both_values_are_missing" ) row_condition: Optional[StrictStr] = None condition_parser: Optional[...
ColumnPairMetric
python
spack__spack
lib/spack/spack/repo.py
{ "start": 78576, "end": 80367 }
class ____(UnknownEntityError): """Raised when we encounter a package spack doesn't have.""" def __init__( self, name, repo: Optional[Union[Repo, RepoPath, str]] = None, *, get_close_matches=difflib.get_close_matches, ): msg = "Attempting to retrieve anonymou...
UnknownPackageError
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/utils/waiter_with_logging.py
{ "start": 6008, "end": 6782 }
class ____: """ Contains the info necessary to extract the status from a response; only computes the value when necessary. Used to avoid computations if the logs are disabled at the given level. """ def __init__(self, jmespath_queries: list[str], response: dict[str, Any]): self.jmespath_qu...
_LazyStatusFormatter
python
tensorflow__tensorflow
tensorflow/python/distribute/distribute_lib_test.py
{ "start": 2315, "end": 5672 }
class ____(distribute_lib.StrategyExtendedV1): def __init__(self, distribute): super(_TestExtended, self).__init__(distribute) worker_device_pairs = [("", ["/device:CPU:0"])] self._input_workers = input_lib.InputWorkers(worker_device_pairs) def _call_for_each_replica(self, fn, args, kwargs): with ...
_TestExtended
python
catalyst-team__catalyst
examples/detection/models/yolo_x.py
{ "start": 17542, "end": 40711 }
class ____(nn.Module): def __init__( self, num_classes, width=1.0, strides=[8, 16, 32], in_channels=[256, 512, 1024], act="silu", depthwise=False, ): """ Args: act (str): activation type of conv. Default is `"sil...
YOLOXHead
python
langchain-ai__langchain
libs/core/tests/unit_tests/example_selectors/test_base.py
{ "start": 107, "end": 816 }
class ____(BaseExampleSelector): def __init__(self) -> None: self.example: dict[str, str] | None = None def add_example(self, example: dict[str, str]) -> None: self.example = example @override def select_examples(self, input_variables: dict[str, str]) -> list[dict]: return [inp...
DummyExampleSelector
python
sqlalchemy__sqlalchemy
examples/sharding/separate_schema_translates.py
{ "start": 1684, "end": 2124 }
class ____(DeclarativeBase): pass # table setup. we'll store a lead table of continents/cities, and a secondary # table storing locations. a particular row will be placed in the database # whose shard id corresponds to the 'continent'. in this setup, secondary rows # in 'weather_reports' will be placed in the s...
Base
python
conda__conda
conda/plugins/types.py
{ "start": 15616, "end": 16907 }
class ____(ABC): """ **EXPERIMENTAL** Base class for all environment specifications. Environment specs parse different types of environment definition files (environment.yml, requirements.txt, pyproject.toml, etc.) into a common Environment object model. """ # Determines if the EnvSpe...
EnvironmentSpecBase
python
huggingface__transformers
src/transformers/models/pix2struct/modeling_pix2struct.py
{ "start": 58633, "end": 67175 }
class ____(Pix2StructPreTrainedModel, GenerationMixin): config: Pix2StructConfig main_input_name = "flattened_patches" def __init__(self, config: Pix2StructConfig): super().__init__(config) self.encoder = Pix2StructVisionModel(config.vision_config) self.decoder = Pix2StructTextMode...
Pix2StructForConditionalGeneration
python
ray-project__ray
rllib/core/models/configs.py
{ "start": 1537, "end": 3136 }
class ____(abc.ABC): """Base class for configuring a `Model` instance. ModelConfigs are DL framework-agnostic. A `Model` (as a sub-component of an `RLModule`) is built via calling the respective ModelConfig's `build()` method. RLModules build their sub-components this way after receiving one or mor...
ModelConfig
python
run-llama__llama_index
llama-index-core/llama_index/core/graph_stores/types.py
{ "start": 3271, "end": 6627 }
class ____(BaseModel): """In memory labelled property graph containing entities and relations.""" nodes: SerializeAsAny[Dict[str, LabelledNode]] = Field(default_factory=dict) relations: SerializeAsAny[Dict[str, Relation]] = Field(default_factory=dict) triplets: Set[Tuple[str, str, str]] = Field( ...
LabelledPropertyGraph
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_django/DJ008.py
{ "start": 947, "end": 1295 }
class ____(Model): new_field = models.CharField(max_length=10) class Meta: verbose_name = "test model" verbose_name_plural = "test models" def __str__(self): return self.new_field @property def my_brand_new_property(self): return 1 def my_beautiful_method(self...
TestModel4
python
doocs__leetcode
solution/3500-3599/3584.Maximum Product of First and Last Elements of a Subsequence/Solution.py
{ "start": 0, "end": 335 }
class ____: def maximumProduct(self, nums: List[int], m: int) -> int: ans = mx = -inf mi = inf for i in range(m - 1, len(nums)): x = nums[i] y = nums[i - m + 1] mi = min(mi, y) mx = max(mx, y) ans = max(ans, x * mi, x * mx) ...
Solution
python
sympy__sympy
sympy/functions/special/elliptic_integrals.py
{ "start": 9806, "end": 14921 }
class ____(DefinedFunction): r""" Called with three arguments $n$, $z$ and $m$, evaluates the Legendre incomplete elliptic integral of the third kind, defined by .. math:: \Pi\left(n; z\middle| m\right) = \int_0^z \frac{dt} {\left(1 - n \sin^2 t\right) \sqrt{1 - m \sin^2 t}} Called w...
elliptic_pi
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeAlias2.py
{ "start": 99, "end": 197 }
class ____: @staticmethod def create(data: dict[str, Any]) -> "Mix": return A()
Base
python
Textualize__textual
docs/examples/guide/screens/modes01.py
{ "start": 269, "end": 409 }
class ____(Screen): def compose(self) -> ComposeResult: yield Placeholder("Settings Screen") yield Footer()
SettingsScreen
python
huggingface__transformers
tests/models/roformer/test_modeling_roformer.py
{ "start": 18956, "end": 19769 }
class ____(unittest.TestCase): @slow def test_inference_masked_lm(self): model = RoFormerForMaskedLM.from_pretrained("junnyu/roformer_chinese_base") input_ids = torch.tensor([[0, 1, 2, 3, 4, 5]]) with torch.no_grad(): output = model(input_ids)[0] # TODO Replace vocab...
RoFormerModelIntegrationTest
python
getsentry__sentry
src/sentry/api/serializers/models/incidentactivity.py
{ "start": 757, "end": 1887 }
class ____(Serializer): def get_attrs(self, item_list, user, **kwargs): prefetch_related_objects(item_list, "incident__organization") serialized_users = user_service.serialize_many( filter={"user_ids": [i.user_id for i in item_list if i.user_id]}, as_user=serialize_generic_us...
IncidentActivitySerializer
python
kubernetes-client__python
kubernetes/client/models/v1_node_daemon_endpoints.py
{ "start": 383, "end": 3618 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1NodeDaemonEndpoints
python
catalyst-team__catalyst
examples/detection/models/yolo_x.py
{ "start": 40711, "end": 44214 }
class ____(nn.Module): """ YOLOX model module. The network returns loss values from three YOLO layers during training and detection results during test. NOTE: - model predicts bounding boxes in image size ranges - bounding boxes format is [x_center, y_center, width, height] - out...
YOLOX
python
doocs__leetcode
solution/0700-0799/0768.Max Chunks To Make Sorted II/Solution.py
{ "start": 0, "end": 358 }
class ____: def maxChunksToSorted(self, arr: List[int]) -> int: stk = [] for v in arr: if not stk or v >= stk[-1]: stk.append(v) else: mx = stk.pop() while stk and stk[-1] > v: stk.pop() stk.a...
Solution
python
django__django
tests/utils_tests/test_module_loading.py
{ "start": 2852, "end": 5391 }
class ____(unittest.TestCase): def setUp(self): self.egg_dir = "%s/eggs" % os.path.dirname(__file__) def tearDown(self): sys.path_importer_cache.clear() sys.modules.pop("egg_module.sub1.sub2.bad_module", None) sys.modules.pop("egg_module.sub1.sub2.good_module", None) sy...
EggLoader
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/overrides.py
{ "start": 1092, "end": 2426 }
class ____(C): def __init__(self, arg): super(C, self).__init__(arg) def methodA(self, arg): _test_sink(arg) def methodB(self): return _test_source() def testBase(o: Base, cls: Type[Base]): y = o.methodB() o.methodA(y) cls.classMethod(y) def testStaticBase(o: Base):...
D
python
PyCQA__isort
isort/format.py
{ "start": 3007, "end": 3631 }
class ____: ERROR = "ERROR" SUCCESS = "SUCCESS" def __init__(self, error: str, success: str, output: TextIO | None = None): self.output = output or sys.stdout self.success_message = success self.error_message = error def success(self, message: str) -> None: print(self.s...
BasicPrinter
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 1053592, "end": 1053749 }
class ____(sgqlc.types.Union): """ See source code for more info. """ __schema__ = graphql_schema __types__ = (Commit, PullRequest)
Closer
python
ray-project__ray
python/ray/train/tests/test_gpu.py
{ "start": 862, "end": 12142 }
class ____(LinearDataset): """Modifies the LinearDataset to also return non-tensor objects.""" def __getitem__(self, index): return {"x": self.x[index, None], "y": 2} def write_rank_data(tmp_path: Path, data: Union[int, List, Dict]): rank = train.get_context().get_world_rank() with open(tmp_p...
NonTensorDataset
python
pytorch__pytorch
torch/testing/_internal/common_nn.py
{ "start": 137863, "end": 142826 }
class ____(TestCase): # _forward is defined in classes inheriting from NNTestCase @abstractmethod def _forward(self, *args, **kwargs): raise NotImplementedError @abstractmethod def _get_parameters(self, module: nn.Module) -> tuple[list[nn.Parameter], list[nn.Parameter]]: raise NotI...
NNTestCase
python
matplotlib__matplotlib
lib/matplotlib/backends/backend_wxagg.py
{ "start": 1398, "end": 1468 }
class ____(_BackendWx): FigureCanvas = FigureCanvasWxAgg
_BackendWxAgg
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/representer.py
{ "start": 8562, "end": 14615 }
class ____(BaseRepresenter): def ignore_aliases(self, data): # type: (Any) -> bool # https://docs.python.org/3/reference/expressions.html#parenthesized-forms : # "i.e. two occurrences of the empty tuple may or may not yield the same object" # so "data is ()" should not be used ...
SafeRepresenter
python
ray-project__ray
python/ray/serve/_private/common.py
{ "start": 7982, "end": 23779 }
class ____: name: str status: DeploymentStatus status_trigger: DeploymentStatusTrigger message: str = "" @property def rank(self) -> int: """Get priority of state based on ranking_order(). The ranked order indicates what the status should be of a hierarchically "higher"...
DeploymentStatusInfo
python
astropy__astropy
astropy/io/votable/converters.py
{ "start": 14420, "end": 15272 }
class ____(Converter): """ Handles both fixed and variable-lengths arrays. """ def __init__(self, field, config=None, pos=None): if config is None: config = {} Converter.__init__(self, field, config, pos) if config.get("verify", "ignore") == "exception": ...
Array
python
tensorflow__tensorflow
tensorflow/python/distribute/device_util.py
{ "start": 4265, "end": 5612 }
class ____(object): """A fake Operation object to pass to device functions.""" def __init__(self): self.device = "" self.type = "" self.name = "" self.node_def = _FakeNodeDef() def _set_device(self, device): self.device = ops._device_string(device) # pylint: disable=protected-access def ...
_FakeOperation
python
huggingface__transformers
src/transformers/models/data2vec/modeling_data2vec_audio.py
{ "start": 47809, "end": 49430 }
class ____(nn.Module): def __init__(self, config, layer_id=0): super().__init__() self.in_conv_dim = config.tdnn_dim[layer_id - 1] if layer_id > 0 else config.tdnn_dim[layer_id] self.out_conv_dim = config.tdnn_dim[layer_id] self.kernel_size = config.tdnn_kernel[layer_id] self...
TDNNLayer
python
getsentry__sentry
tests/sentry/workflow_engine/service/test_action_service.py
{ "start": 545, "end": 13377 }
class ____(TestCase): def setUp(self) -> None: self.organization = self.create_organization(owner=self.user) self.organization_2 = self.create_organization(owner=self.user) self.integration = self.create_integration( organization=self.organization, provider="slack", ...
TestActionService
python
pytorch__pytorch
torch/fx/passes/infra/partitioner.py
{ "start": 1496, "end": 2031 }
class ____: def __init__(self, graph_module: GraphModule): self.downstreams = collections.defaultdict(set) for node in reversed(graph_module.graph.nodes): for output_node in node.users: # add output_node and output_node's downstream dependency self.downst...
_DependencyViewer
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/simple_inheritance/package.py
{ "start": 683, "end": 1062 }
class ____(BaseWithDirectives): """Simple package which acts as a build dependency""" homepage = "http://www.example.com" url = "http://www.example.com/simple-1.0.tar.gz" version("1.0", md5="0123456789abcdef0123456789abcdef") depends_on("openblas", when="+openblas") provides("lapack", when="+...
SimpleInheritance
python
scipy__scipy
scipy/stats/_continuous_distns.py
{ "start": 248582, "end": 252001 }
class ____(rv_continuous): r"""A Student's t continuous random variable. For the noncentral t distribution, see `nct`. %(before_notes)s See Also -------- nct Notes ----- The probability density function for `t` is: .. math:: f(x, \nu) = \frac{\Gamma((\nu+1)/2)} ...
t_gen
python
kamyu104__LeetCode-Solutions
Python/minimum-incompatibility.py
{ "start": 12843, "end": 14466 }
class ____(object): def minimumIncompatibility(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ def greedy(nums, k, is_reversed): count = collections.Counter(nums) if max(count.itervalues()) > k: return -1 ...
Solution_Wrong_Greedy
python
py-pdf__pypdf
pypdf/annotations/_markup_annotations.py
{ "start": 2371, "end": 4647 }
class ____(MarkupAnnotation): """A FreeText annotation""" def __init__( self, *, text: str, rect: Union[RectangleObject, tuple[float, float, float, float]], font: str = "Helvetica", bold: bool = False, italic: bool = False, font_size: str = "14pt"...
FreeText
python
nryoung__algorithms
tests/test_data_structures.py
{ "start": 16574, "end": 17215 }
class ____(unittest.TestCase): """ Test Singly Linked List Implementation """ def test_singly_linked_list(self): self.sl = singly_linked_list.SinglyLinkedList() self.sl.add(10) self.sl.add(5) self.sl.add(30) self.sl.remove(30) self.assertEqual(self.sl.si...
TestSinglyLinkedList