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
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDict18.py
{ "start": 2222, "end": 2258 }
class ____(TypedDict): y: int
TD11
python
openai__openai-python
src/openai/types/beta/assistant_stream_event.py
{ "start": 1982, "end": 2205 }
class ____(BaseModel): data: Run """ Represents an execution run on a [thread](https://platform.openai.com/docs/api-reference/threads). """ event: Literal["thread.run.in_progress"]
ThreadRunInProgress
python
sqlalchemy__sqlalchemy
test/ext/test_mutable.py
{ "start": 13192, "end": 20912 }
class ____(_MutableListTestFixture): run_define_tables = "each" def setup_mappers(cls): foo = cls.tables.foo cls.mapper_registry.map_imperatively(Foo, foo) def test_coerce_none(self): sess = fixture_session() f1 = Foo(data=None) sess.add(f1) sess.commit() ...
_MutableListTestBase
python
apache__airflow
task-sdk/tests/task_sdk/io/test_path.py
{ "start": 3169, "end": 5623 }
class ____: FAKE = "ffs:///fake" MNT = "ffs:///mnt/warehouse" FOO = "ffs:///mnt/warehouse/foo" BAR = FOO @pytest.fixture(autouse=True) def restore_cache(self): cache = _STORE_CACHE.copy() yield _STORE_CACHE.clear() _STORE_CACHE.update(cache) @pytest.fixture ...
TestAttach
python
django-mptt__django-mptt
tests/myapp/models.py
{ "start": 1754, "end": 2007 }
class ____(models.Model): genre = TreeForeignKey(Genre, on_delete=models.CASCADE) genres_m2m = models.ManyToManyField(Genre, related_name="games_m2m") name = models.CharField(max_length=50) def __str__(self): return self.name
Game
python
pypa__warehouse
tests/unit/packaging/test_services.py
{ "start": 15017, "end": 22524 }
class ____: def test_verify_service(self): assert verifyClass(IFileStorage, S3FileStorage) def test_basic_init(self): bucket = pretend.stub() storage = S3FileStorage(bucket) assert storage.bucket is bucket def test_create_service(self): session = boto3.session.Sessi...
TestS3FileStorage
python
graphql-python__graphene
graphene/types/tests/test_subscribe_async.py
{ "start": 87, "end": 202 }
class ____(ObjectType): hello = String() def resolve_hello(root, info): return "Hello, world!"
Query
python
ray-project__ray
rllib/examples/envs/classes/multi_agent/footsies/utils.py
{ "start": 805, "end": 2078 }
class ____: def __init__(self, matchups: list[Matchup]): self.matchups = matchups self.probs = [matchup.prob for matchup in matchups] self.current_matchups = collections.defaultdict(dict) def agent_to_module_mapping_fn( self, agent_id: str, episode: EpisodeType, **kwargs ) -...
Matchmaker
python
ansible__ansible
test/units/inventory/test_data.py
{ "start": 2207, "end": 2419 }
class ____(Exception): """Raised when an object is trusted which should not be.""" def __init__(self, obj: t.Any) -> None: super().__init__(f'TrustedAsTemplate is tagged on {obj}.')
TrustFoundError
python
dask__dask
dask/dataframe/dask_expr/_backends.py
{ "start": 860, "end": 2055 }
class ____(DataFrameBackendEntrypoint): """Pandas-Backend Entrypoint Class for Dask-Expressions Note that all DataFrame-creation functions are defined and registered 'in-place'. """ @classmethod def to_backend(cls, data, **kwargs): from dask.dataframe.dask_expr._collection import new_c...
PandasBackendEntrypoint
python
apache__airflow
airflow-core/tests/unit/api_fastapi/auth/managers/simple/test_simple_auth_manager.py
{ "start": 1224, "end": 9651 }
class ____: def test_get_users(self, auth_manager): with conf_vars( { ("core", "simple_auth_manager_users"): "test1:viewer,test2:viewer", } ): users = auth_manager.get_users() assert users == [{"role": "viewer", "username": "test1"}, {"...
TestSimpleAuthManager
python
pytorch__pytorch
test/torch_np/numpy_tests/linalg/test_linalg.py
{ "start": 23438, "end": 25328 }
class ____(LinalgSquareTestCase, LinalgGeneralizedSquareTestCase): # cond(x, p) for p in (None, 2, -2) def do(self, a, b, tags): c = asarray(a) # a might be a matrix if "size-0" in tags: assert_raises(LinAlgError, linalg.cond, c) return # +-2 norms s = ...
CondCases
python
huggingface__transformers
src/transformers/generation/utils.py
{ "start": 10796, "end": 14042 }
class ____(ModelOutput): """ Outputs of decoder-only generation models, when using beam methods. Args: sequences (`torch.LongTensor` of shape `(batch_size*num_return_sequences, sequence_length)`): The generated sequences. The second dimension (sequence_length) is either equal to `max_le...
GenerateBeamDecoderOnlyOutput
python
dask__dask
dask/dataframe/dask_expr/_expr.py
{ "start": 41021, "end": 41484 }
class ____(Blockwise): _parameters = ["frame", "index", "deep"] _defaults = {"index": True, "deep": False} @staticmethod def operation(*args, **kwargs): if is_series_like(args[0]): return args[0]._constructor([total_mem_usage(*args, **kwargs)]) return args[0]._constructor_sl...
MemoryUsagePerPartition
python
huggingface__transformers
src/transformers/models/qwen2_moe/modular_qwen2_moe.py
{ "start": 6968, "end": 10241 }
class ____(MixtralModel): def __init__(self, config: Qwen2MoeConfig): super().__init__(config) self.layers = nn.ModuleList( [Qwen2MoeDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)] ) self.norm = Qwen2MoeRMSNorm(config.hidden_size, eps=con...
Qwen2MoeModel
python
getlogbook__logbook
src/logbook/base.py
{ "start": 5547, "end": 8108 }
class ____(StackedObject): """An object that can be bound to a context. It is managed by the :class:`ContextStackManager`""" #: subclasses have to instantiate a :class:`ContextStackManager` #: object on this attribute which is then shared for all the #: subclasses of it. stack_manager = None ...
ContextObject
python
ray-project__ray
python/ray/data/_internal/planner/exchange/split_repartition_task_scheduler.py
{ "start": 690, "end": 6640 }
class ____(ExchangeTaskScheduler): """ The split (non-shuffle) repartition scheduler. First, we calculate global splits needed to produce `output_num_blocks` blocks. After the split blocks are generated accordingly, reduce tasks are scheduled to combine split blocks together. """ def execu...
SplitRepartitionTaskScheduler
python
django__django
django/db/migrations/serializer.py
{ "start": 1030, "end": 1265 }
class ____: def __init__(self, value): self.value = value def serialize(self): raise NotImplementedError( "Subclasses of BaseSerializer must implement the serialize() method." )
BaseSerializer
python
pydata__xarray
xarray/indexes/nd_point_index.py
{ "start": 539, "end": 2089 }
class ____(abc.ABC): """Lightweight adapter abstract class for plugging in 3rd-party structures like :py:class:`scipy.spatial.KDTree` or :py:class:`sklearn.neighbors.KDTree` into :py:class:`~xarray.indexes.NDPointIndex`. """ @abc.abstractmethod def __init__(self, points: np.ndarray, *, options...
TreeAdapter
python
ray-project__ray
python/ray/data/block.py
{ "start": 8705, "end": 21692 }
class ____: """Provides accessor methods for a specific block. Ideally, we wouldn't need a separate accessor classes for blocks. However, this is needed if we want to support storing ``pyarrow.Table`` directly as a top-level Ray object, without a wrapping class (issue #17186). """ def num_rows...
BlockAccessor
python
dagster-io__dagster
python_modules/libraries/dagster-aws/dagster_aws_tests/s3_tests/test_compute_log_manager.py
{ "start": 9978, "end": 12312 }
class ____(TestComputeLogManager): __test__ = True @pytest.fixture(name="compute_log_manager") def compute_log_manager(self, mock_s3_bucket): with tempfile.TemporaryDirectory() as temp_dir: yield S3ComputeLogManager( bucket=mock_s3_bucket.name, prefix="my_prefix", local_...
TestS3ComputeLogManager
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_arxiv_id.py
{ "start": 1687, "end": 3951 }
class ____(ColumnMapExpectation): """Expect column values to be valid arXiv identifiers.""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "well_formed_arxiv_id": [ ...
ExpectColumnValuesToBeValidArxivId
python
great-expectations__great_expectations
great_expectations/expectations/metrics/column_aggregate_metrics/column_partition.py
{ "start": 889, "end": 9592 }
class ____(ColumnAggregateMetricProvider): metric_name = "column.partition" value_keys = ("bins", "n_bins", "allow_relative_error") default_kwarg_values = { "bins": "uniform", "n_bins": 10, "allow_relative_error": False, } @metric_value(engine=PandasExecutionEngine) def ...
ColumnPartition
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 879138, "end": 879493 }
class ____(sgqlc.types.Type, ProjectV2FieldCommon, Node): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("configuration",) configuration = sgqlc.types.Field( sgqlc.types.non_null(ProjectV2IterationFieldConfiguration), graphql_name="configur...
ProjectV2IterationField
python
apache__airflow
providers/standard/src/airflow/providers/standard/sensors/time_delta.py
{ "start": 1615, "end": 5591 }
class ____(BaseSensorOperator): """ Waits for a timedelta. The delta will be evaluated against data_interval_end if present for the dag run, otherwise run_after will be used. :param delta: time to wait before succeeding. :param deferrable: Run sensor in deferrable mode. If set to True, task wi...
TimeDeltaSensor
python
Textualize__textual
src/textual/theme.py
{ "start": 8449, "end": 9339 }
class ____(Provider): """A provider for themes.""" @property def commands(self) -> list[tuple[str, Callable[[], None]]]: themes = self.app.available_themes def set_app_theme(name: str) -> None: self.app.theme = name return [ (theme.name, partial(set_app_the...
ThemeProvider
python
fluentpython__example-code
09-pythonic-obj/vector2d_v3.py
{ "start": 1779, "end": 3249 }
class ____: typecode = 'd' def __init__(self, x, y): self.__x = float(x) self.__y = float(y) @property def x(self): return self.__x @property def y(self): return self.__y def __iter__(self): return (i for i in (self.x, self.y)) def __repr__(se...
Vector2d
python
tensorflow__tensorflow
tensorflow/lite/python/interpreter.py
{ "start": 6604, "end": 12011 }
class ____: """SignatureRunner class for running TFLite models using SignatureDef. This class should be instantiated through TFLite Interpreter only using get_signature_runner method on Interpreter. Example, signature = interpreter.get_signature_runner("my_signature") result = signature(input_1=my_input_1,...
SignatureRunner
python
sympy__sympy
sympy/physics/mechanics/loads.py
{ "start": 819, "end": 2301 }
class ____(LoadBase): """Force acting upon a point. Explanation =========== A force is a vector that is bound to a line of action. This class stores both a point, which lies on the line of action, and the vector. A tuple can also be used, with the location as the first entry and the vector as ...
Force
python
coleifer__peewee
peewee.py
{ "start": 53217, "end": 53955 }
class ____(ColumnBase): def __init__(self, predicate, expression_tuples, default=None): self.predicate = predicate self.expression_tuples = expression_tuples self.default = default def __sql__(self, ctx): clauses = [SQL('CASE')] if self.predicate is not None: ...
Case
python
anthropics__anthropic-sdk-python
src/anthropic/resources/beta/files.py
{ "start": 1307, "end": 12668 }
class ____(SyncAPIResource): @cached_property def with_raw_response(self) -> FilesWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com...
Files
python
pypa__pip
src/pip/_vendor/rich/progress.py
{ "start": 21951, "end": 23682 }
class ____(ProgressColumn): """Renders a visual progress bar. Args: bar_width (Optional[int], optional): Width of bar or None for full width. Defaults to 40. style (StyleType, optional): Style for the bar background. Defaults to "bar.back". complete_style (StyleType, optional): Style fo...
BarColumn
python
Pylons__pyramid
tests/test_config/test_views.py
{ "start": 149035, "end": 149125 }
class ____(dict): def get_csrf_token(self): return self['csrf_token']
DummySession
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 23544, "end": 23955 }
class ____(sgqlc.types.Enum): """The possible viewed states of a file . Enumeration Choices: * `DISMISSED`: The file has new changes since last viewed. * `UNVIEWED`: The file has not been marked as viewed. * `VIEWED`: The file has been marked as viewed. """ __schema__ = github_schema ...
FileViewedState
python
doocs__leetcode
solution/2700-2799/2711.Difference of Number of Distinct Values on Diagonals/Solution.py
{ "start": 0, "end": 697 }
class ____: def differenceOfDistinctValues(self, grid: List[List[int]]) -> List[List[int]]: m, n = len(grid), len(grid[0]) ans = [[0] * n for _ in range(m)] for i in range(m): for j in range(n): x, y = i, j s = set() while x and y: ...
Solution
python
PrefectHQ__prefect
tests/utilities/test_pydantic.py
{ "start": 5755, "end": 6324 }
class ____: def test_json_schema(self): class PatchModel(BaseModel): model_config = ConfigDict(arbitrary_types_allowed=True) patch: JsonPatch = Field(default_factory=lambda: JsonPatch([])) schema = PatchModel.model_json_schema() assert schema["properties"]["patch"]...
TestJsonPatch
python
kamyu104__LeetCode-Solutions
Python/longest-increasing-subsequence.py
{ "start": 49, "end": 556 }
class ____(object): def lengthOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ LIS = [] def insert(target): left = bisect.bisect_left(LIS, target) # If not found, append the target. if left == len(LIS): L...
Solution
python
numpy__numpy
numpy/_core/tests/test_simd.py
{ "start": 10928, "end": 11790 }
class ____(_Test_Utility): """ To only test single precision """ def test_conversions(self): """ Round to nearest even integer, assume CPU control register is set to rounding. Test intrinsics: npyv_round_s32_##SFX """ features = self._cpu_features() ...
_SIMD_FP32
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 480625, "end": 481415 }
class ____(sgqlc.types.relay.Connection): """The connection type for BypassForcePushAllowance.""" __schema__ = github_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("BypassForcePushAllowanceEdge"), graphql_name="edges") """A lis...
BypassForcePushAllowanceConnection
python
ray-project__ray
python/ray/_private/runtime_env/utils.py
{ "start": 120, "end": 3989 }
class ____(subprocess.CalledProcessError): """The subprocess.CalledProcessError with stripped stdout.""" LAST_N_LINES = 50 def __init__(self, *args, cmd_index=None, **kwargs): self.cmd_index = cmd_index super().__init__(*args, **kwargs) @staticmethod def _get_last_n_line(str_data:...
SubprocessCalledProcessError
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_ordered_dict.py
{ "start": 39485, "end": 39871 }
class ____(mapping_tests.BasicTestMappingProtocol): @classmethod def setUpClass(cls): cls.type2test = py_coll.OrderedDict super().setUpClass() def test_popitem(self): d = self._empty_mapping() self.assertRaises(KeyError, d.popitem) @unittest.skipUnless(c_coll, 'requires t...
PurePythonGeneralMappingTests
python
PrefectHQ__prefect
tests/client/test_prefect_client.py
{ "start": 2635, "end": 3874 }
class ____: def test_get_client_returns_client(self): assert isinstance(get_client(), PrefectClient) def test_get_client_does_not_cache_client(self): assert get_client() is not get_client() def test_get_client_cache_uses_profile_settings(self): client = get_client() with te...
TestGetClient
python
doocs__leetcode
solution/2800-2899/2814.Minimum Time Takes to Reach Destination Without Drowning/Solution.py
{ "start": 0, "end": 1775 }
class ____: def minimumSeconds(self, land: List[List[str]]) -> int: m, n = len(land), len(land[0]) vis = [[False] * n for _ in range(m)] g = [[inf] * n for _ in range(m)] q = deque() si = sj = 0 for i, row in enumerate(land): for j, c in enumerate(row): ...
Solution
python
getsentry__sentry
src/sentry/integrations/discord/message_builder/base/component/select_menu.py
{ "start": 1333, "end": 2752 }
class ____(DiscordMessageComponent): """ A Discord select menu message component. We are only implementing the string select variation because the other types are not currently required. https://discord.com/developers/docs/interactions/message-components#select-menu-object """ def __init__( ...
DiscordSelectMenu
python
numba__numba
numba/core/dispatcher.py
{ "start": 29121, "end": 38726 }
class ____(serialize.ReduceMixin, _MemoMixin, _DispatcherBase): """ Implementation of user-facing dispatcher objects (i.e. created using the @jit decorator). This is an abstract base class. Subclasses should define the targetdescr class attribute. """ _fold_args = True __numba__ = 'py_f...
Dispatcher
python
airbytehq__airbyte
airbyte-integrations/bases/connector-acceptance-test/unit_tests/test_config.py
{ "start": 9988, "end": 11291 }
class ____: @pytest.mark.parametrize( ("skip_test", "bypass_reason", "unsupported_types", "expectation"), ( (True, None, None, does_not_raise()), (True, None, [config.UnsupportedFileTypeConfig(extension=".csv")], pytest.raises(ValidationError)), (False, None, None...
TestFileTypesConfig
python
huggingface__transformers
src/transformers/models/altclip/modeling_altclip.py
{ "start": 23116, "end": 25093 }
class ____(GradientCheckpointingLayer): def __init__(self, config: AltCLIPConfig): super().__init__() self.embed_dim = config.hidden_size self.self_attn = AltCLIPAttention(config) self.layer_norm1 = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_eps) self.mlp = AltCLIPMLP...
AltCLIPEncoderLayer
python
joke2k__faker
tests/providers/test_job.py
{ "start": 4029, "end": 4218 }
class ____: """Test pt_BR job provider""" def test_job(self, faker, num_samples): for _ in range(num_samples): assert faker.job() in PtBrJobProvider.jobs
TestPtBr
python
openai__openai-python
src/openai/types/beta/threads/run_create_params.py
{ "start": 8097, "end": 8325 }
class ____(TypedDict, total=False): file_id: str """The ID of the file to attach to the message.""" tools: Iterable[AdditionalMessageAttachmentTool] """The tools to add this file to."""
AdditionalMessageAttachment
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 927509, "end": 928819 }
class ____(sgqlc.types.Type, Node): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "content_type", "created_at", "download_count", "download_url", "name", "release", "size", "updated_at", ...
ReleaseAsset
python
modin-project__modin
modin/tests/pandas/utils.py
{ "start": 16317, "end": 30080 }
class ____: """int-like class with non-commutative multiply operation. We need to test that rmul and mul do different things even when multiplication is not commutative, but almost all multiplication is commutative. This class' fake multiplication overloads are not commutative when you multiply an ...
NonCommutativeMultiplyInteger
python
spack__spack
lib/spack/spack/solver/requirements.py
{ "start": 2632, "end": 13634 }
class ____: """Parses requirements from package.py files and configuration, and returns rules.""" def __init__(self, configuration: spack.config.Configuration): self.config = configuration self.runtime_pkgs = spack.repo.PATH.packages_with_tags("runtime") self.compiler_pkgs = spack.repo....
RequirementParser
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/operators/test_rds.py
{ "start": 10613, "end": 15507 }
class ____: @classmethod def setup_class(cls): cls.dag = DAG( dag_id="test_dag", schedule=None, default_args={"owner": "airflow", "start_date": DEFAULT_DATE}, ) cls.hook = RdsHook(aws_conn_id=AWS_CONN, region_name="us-east-1") _patch_hook_get_c...
TestRdsCopyDbSnapshotOperator
python
ray-project__ray
rllib/models/torch/torch_action_dist.py
{ "start": 7038, "end": 8779 }
class ____(TorchCategorical): """MultiCategorical distribution for MultiDiscrete action spaces. The action space must be uniform, meaning all nvec items have the same size, e.g. MultiDiscrete([10, 10, 10]), where 10 is the number of candidates to pick from and 3 is the slate size (pick 3 out of 10). Wh...
TorchSlateMultiCategorical
python
pytorch__pytorch
torch/distributed/fsdp/_fully_shard/_fsdp_collectives.py
{ "start": 3413, "end": 3885 }
class ____(DefaultAllocMixin, ReduceScatter): def __call__( self, output_tensor: torch.Tensor, input_tensor: torch.Tensor, group: dist.ProcessGroup, op: _ReduceOp, async_op: bool = False, ) -> dist.Work: return dist.reduce_scatter_tensor( outpu...
DefaultReduceScatter
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_axis54.py
{ "start": 306, "end": 1726 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_axis54.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got...
TestCompareXLSXFiles
python
kamyu104__LeetCode-Solutions
Python/generate-parentheses.py
{ "start": 81, "end": 1049 }
class ____(object): def generateParenthesis(self, n): """ :type n: int :rtype: List[str] """ result, curr = [], [] stk = [(1, (n, n))] while stk: step, args = stk.pop() if step == 1: left, right = args if...
Solution
python
kamyu104__LeetCode-Solutions
Python/build-an-array-with-stack-operations.py
{ "start": 29, "end": 378 }
class ____(object): def buildArray(self, target, n): """ :type target: List[int] :type n: int :rtype: List[str] """ result, curr = [], 1 for t in target: result.extend(["Push", "Pop"]*(t-curr)) result.append("Push") curr = t...
Solution
python
bokeh__bokeh
tests/unit/bokeh/model/test_util_model.py
{ "start": 4022, "end": 5811 }
class ____: @pytest.mark.parametrize('typ', (int, float, str)) def test_scalar(self, typ) -> None: obj = typ() vals = set() assert bmu.visit_value_and_its_immediate_references(obj, lambda x: vals.add(x)) is None assert vals == set() @pytest.mark.parametrize('typ', (tuple, l...
Test_visit_value_and_its_immediate_references
python
joke2k__faker
faker/providers/lorem/da_DK/__init__.py
{ "start": 68, "end": 18520 }
class ____(LoremProvider): """Implement lorem provider for ``da_DK`` locale. # NOQA""" word_list = ( "område", "verden", "nødvendig", "ligge", "magt", "drøm", "midt", "indeholde", "plads", "viden", "etage", "forst...
Provider
python
uqfoundation__dill
dill/tests/test_nested.py
{ "start": 977, "end": 1188 }
class ____: def __init__(self, augend): self.augend = augend self.zero = [0] def __call__(self, addend): return addend + self.augend + self.zero[0] # some basic class stuff
c2adder
python
doocs__leetcode
solution/3400-3499/3411.Maximum Subarray With Equal Products/Solution.py
{ "start": 0, "end": 486 }
class ____: def maxLength(self, nums: List[int]) -> int: n = len(nums) ans = 0 max_p = lcm(*nums) * max(nums) for i in range(n): p, g, l = 1, 0, 1 for j in range(i, n): p *= nums[j] g = gcd(g, nums[j]) l = lcm(l,...
Solution
python
pyca__cryptography
tests/hazmat/primitives/test_kbkdf.py
{ "start": 685, "end": 14619 }
class ____: def test_invalid_key(self, backend): kdf = KBKDFHMAC( hashes.SHA256(), Mode.CounterMode, 32, 4, 4, CounterLocation.BeforeFixed, b"label", b"context", None, backend=backend, ...
TestKBKDFHMAC
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/partition_sets.py
{ "start": 5928, "end": 6126 }
class ____(graphene.ObjectType): class Meta: name = "PartitionKeyRange" start = graphene.NonNull(graphene.String) end = graphene.NonNull(graphene.String)
GraphenePartitionKeyRange
python
sqlalchemy__sqlalchemy
test/dialect/oracle/test_dialect.py
{ "start": 3929, "end": 5280 }
class ____(fixtures.TestBase): __backend__ = True __only_on__ = "oracle+oracledb" def _run_in_process(self, fn, fn_kw=None): if config.db.dialect.is_async: config.skip_test("thick mode unsupported in async mode") ctx = get_context("spawn") queue = ctx.Queue() pro...
OracledbMode
python
kubernetes-client__python
kubernetes/client/models/v1_network_policy_list.py
{ "start": 383, "end": 6972 }
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...
V1NetworkPolicyList
python
has2k1__plotnine
plotnine/themes/themeable.py
{ "start": 68788, "end": 69213 }
class ____(axis_ticks_pad_major_x, axis_ticks_pad_major_y): """ Axis major-tick padding Parameters ---------- theme_element : float Value in points. Note ---- Padding is not applied when the [](`~plotnine.theme.themeables.axis_ticks_major`) are blank, but it does apply ...
axis_ticks_pad_major
python
keras-team__keras
keras/src/layers/regularization/spatial_dropout_test.py
{ "start": 135, "end": 3851 }
class ____(test_case.TestCase): @pytest.mark.requires_trainable_backend def test_spatial_dropout_1d(self): self.run_layer_test( layers.SpatialDropout1D, init_kwargs={"rate": 0.5}, call_kwargs={"training": True}, input_shape=(2, 3, 4), assert_bu...
SpatialDropoutTest
python
tensorflow__tensorflow
tensorflow/python/keras/engine/base_layer.py
{ "start": 4304, "end": 123419 }
class ____(module.Module, version_utils.LayerVersionSelector): """This is the class from which all layers inherit. A layer is a callable object that takes as input one or more tensors and that outputs one or more tensors. It involves *computation*, defined in the `call()` method, and a *state* (weight variable...
Layer
python
numpy__numpy
numpy/lib/tests/test__datasource.py
{ "start": 4985, "end": 7473 }
class ____: def test_ValidHTTP(self, tmp_path): ds = datasource.DataSource(tmp_path) _, netloc, upath, _, _, _ = urlparse(valid_httpurl()) local_path = os.path.join(tmp_path, netloc, upath.strip(os.sep).strip('/')) assert_equal(local_path, ds.abspath...
TestDataSourceAbspath
python
great-expectations__great_expectations
great_expectations/exceptions/resource_freshness.py
{ "start": 1627, "end": 1939 }
class ____(ResourceFreshnessError): def __init__(self, name: str) -> None: super().__init__( f"ExpectationSuite '{name}' has changed since it has last been saved. " "Please update with `<SUITE_OBJECT>.save()`, then try your action again." )
ExpectationSuiteNotFreshError
python
huggingface__transformers
src/transformers/models/got_ocr2/image_processing_got_ocr2.py
{ "start": 1462, "end": 5437 }
class ____(ImagesKwargs, total=False): """ crop_to_patches (`bool`, *optional*, defaults to `False`): Whether to crop the image to patches. Can be overridden by the `crop_to_patches` parameter in the `preprocess` method. min_patches (`int`, *optional*, defaults to 1): The minimum num...
GotOcr2ImageProcessorKwargs
python
tensorflow__tensorflow
tensorflow/lite/tools/visualize.py
{ "start": 7232, "end": 17766 }
class ____: """Maps a list of tensor indices to a tooltip hoverable indicator of more.""" def __init__(self, subgraph_data): self.data = subgraph_data def __call__(self, x): html = "" if x is None: return html html += "<span class='tooltip'><span class='tooltipcontent'>" for i in x: ...
TensorMapper
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_permissions.py
{ "start": 2152, "end": 2323 }
class ____: @check_permission(Permissions.LAUNCH_PIPELINE_EXECUTION) def mutate(self, graphene_info: ResolveInfo, **_kwargs): pass
FakeEnumPermissionMutation
python
run-llama__llama_index
llama-index-integrations/tools/llama-index-tools-cassandra/llama_index/tools/cassandra/cassandra_database_wrapper.py
{ "start": 17684, "end": 17961 }
class ____(Exception): """ Exception raised for errors in the database schema. Attributes: message -- explanation of the error """ def __init__(self, message: str): self.message = message super().__init__(self.message)
DatabaseError
python
dagster-io__dagster
python_modules/libraries/dagster-dg-cli/dagster_dg_cli_tests/cli_tests/api_tests/deployment_tests/test_business_logic.py
{ "start": 2128, "end": 3554 }
class ____: """Test the deployment formatting functions.""" def _create_sample_deployment_list(self): """Create sample DeploymentList from fixture data.""" # Load from fixture and convert to domain objects response = load_recorded_graphql_responses("deployment", "success_multiple_deploy...
TestFormatDeployments
python
wireservice__csvkit
csvkit/convert/fixed.py
{ "start": 2848, "end": 4092 }
class ____: """ Instantiated with a schema, able to return a sequence of trimmed strings representing fields given a fixed-length line. Flexible about where the columns are, as long as they are headed with the literal names 'column', 'start', and 'length'. """ def __init__(self, schema): ...
FixedWidthRowParser
python
pytorch__pytorch
test/test_overrides.py
{ "start": 49989, "end": 50183 }
class ____(TestCase): # Regression test for gh-55868 def test_rnn(self): model = torch.nn.RNN(10, 20, 2) input = Wrapper(torch.randn(1, 5, 10)) model(input)
TestRNN
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocolExplicit1.py
{ "start": 1201, "end": 1240 }
class ____(Protocol5): pass
Concrete5
python
getsentry__sentry
tests/snuba/api/endpoints/test_organization_events_mep.py
{ "start": 130106, "end": 146434 }
class ____( MetricsEnhancedPerformanceTestCase ): viewname = "sentry-api-0-organization-events" def setUp(self) -> None: super().setUp() self.url = reverse( self.viewname, kwargs={"organization_id_or_slug": self.organization.slug} ) self.features = {"organization...
OrganizationEventsMetricsEnhancedPerformanceEndpointTestWithOnDemandMetrics
python
haoel__leetcode
algorithms/python/firstMissingPositive/firstMissingPositive.py
{ "start": 552, "end": 1070 }
class ____: def firstMissingPositive(self, nums: [int]) -> int: for i in range(len(nums)): while nums[i]>0 and nums[i]<len(nums) and nums[i]-1!=i and nums[i]!=nums[nums[i]-1]: nums[nums[i]-1], nums[i] = nums[i], nums[nums[i]-1] for i in range(len(nums)): if i ...
Solution
python
vyperlang__vyper
vyper/exceptions.py
{ "start": 8371, "end": 8470 }
class ____(VyperException): """Assignment to a name that is already in use."""
NamespaceCollision
python
django__django
tests/serializers/tests.py
{ "start": 19322, "end": 20909 }
class ____: available_apps = ["serializers"] @skipUnlessDBFeature("supports_forward_references") def test_forward_refs(self): """ Objects ids can be referenced before they are defined in the serialization data. """ # The deserialization process needs to run in a tran...
SerializersTransactionTestBase
python
numba__numba
numba/tests/test_dyn_array.py
{ "start": 26269, "end": 27804 }
class ____(object): def mutate_array(self, arr): try: arr.fill(42) except (TypeError, ValueError): # Try something else (e.g. Numpy 1.6 with structured dtypes) fill_value = b'x' * arr.dtype.itemsize arr.fill(fill_value) def check_like(self, pyfun...
ConstructorLikeBaseTest
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-vllm/llama_index/embeddings/vllm/base.py
{ "start": 589, "end": 7600 }
class ____(MultiModalEmbedding): """ Vllm LLM. This class runs a vLLM embedding model locally. """ tensor_parallel_size: Optional[int] = Field( default=1, description="The number of GPUs to use for distributed execution with tensor parallelism.", ) trust_remote_code: Optio...
VllmEmbedding
python
huggingface__transformers
src/transformers/models/qwen2_5_omni/modular_qwen2_5_omni.py
{ "start": 43425, "end": 47358 }
class ____(PreTrainedConfig): """ This is the configuration class to store the configuration of a [`Qwen2_5OmniForConditionalGeneration`]. It is used to instantiate a Qwen2.5Omni model according to the specified sub-models configurations, defining the model architecture. Instantiating a configuration w...
Qwen2_5OmniConfig
python
imageio__imageio
imageio/plugins/_freeimage.py
{ "start": 47466, "end": 51739 }
class ____(FIBaseBitmap): """Wrapper for the multipage FI bitmap object.""" def load_from_filename(self, filename=None): if filename is None: # pragma: no cover filename = self._filename # Prepare create_new = False read_only = True keep_cache_in_memory = F...
FIMultipageBitmap
python
apache__airflow
airflow-core/src/airflow/callbacks/callback_requests.py
{ "start": 1777, "end": 2852 }
class ____(BaseCallbackRequest): """ Task callback status information. A Class with information about the success/failure TI callback to be executed. Currently, only failure callbacks when tasks are externally killed or experience heartbeat timeouts are run via DagFileProcessorProcess. """ ti:...
TaskCallbackRequest
python
django__django
tests/admin_views/admin.py
{ "start": 19197, "end": 19296 }
class ____(forms.ModelForm): class Meta: widgets = {"title": forms.HiddenInput}
StoryForm
python
getsentry__sentry
src/sentry/management/commands/generate_controlsilo_urls.py
{ "start": 1495, "end": 7526 }
class ____(BaseCommand): help = "Generate a list of URL patterns served by control silo endpoints" def add_arguments(self, parser): parser.add_argument( "--format", choices=["text", "js"], dest="format", default="text", help="The format of the...
Command
python
tqdm__tqdm
tests/tests_contrib_logging.py
{ "start": 964, "end": 2123 }
class ____: def test_should_call_tqdm_write(self): CustomTqdm.messages = [] logger = logging.Logger('test') logger.handlers = [TqdmLoggingHandler(CustomTqdm)] logger.info('test') assert CustomTqdm.messages == ['test'] def test_should_call_handle_error_if_exception_was_th...
TestTqdmLoggingHandler
python
Textualize__textual
src/textual/renderables/text_opacity.py
{ "start": 1068, "end": 3674 }
class ____: """Blend foreground into background.""" def __init__(self, renderable: RenderableType, opacity: float = 1.0) -> None: """Wrap a renderable to blend foreground color into the background color. Args: renderable: The RenderableType to manipulate. opacity: The o...
TextOpacity
python
great-expectations__great_expectations
great_expectations/expectations/metrics/column_aggregate_metrics/column_sum.py
{ "start": 580, "end": 1140 }
class ____(ColumnAggregateMetricProvider): metric_name = "column.sum" @column_aggregate_value(engine=PandasExecutionEngine) def _pandas(cls, column, **kwargs): convert_pandas_series_decimal_to_float_dtype(data=column, inplace=True) return column.sum() @column_aggregate_partial(engine=S...
ColumnSum
python
realpython__materials
django-vue-graphql/source_code_final/back_end/blog/schema.py
{ "start": 462, "end": 1860 }
class ____(graphene.ObjectType): all_posts = graphene.List(PostType) author_by_username = graphene.Field(AuthorType, username=graphene.String()) post_by_slug = graphene.Field(PostType, slug=graphene.String()) posts_by_author = graphene.List(PostType, username=graphene.String()) posts_by_tag = graphe...
Query
python
getsentry__sentry
tests/sentry/tasks/test_post_process.py
{ "start": 7376, "end": 13795 }
class ____(BasePostProgressGroupMixin): def _create_event( self, data: dict[str, Any], project_id: int | None = None, ) -> Event: data.setdefault("platform", "javascript") return self.store_event(data=data, project_id=project_id or self.project.id) def _generate_node...
DeriveCodeMappingsProcessGroupTestMixin
python
weaviate__weaviate-python-client
weaviate/collections/classes/config_vector_index.py
{ "start": 3901, "end": 4317 }
class ____(_VectorIndexConfigUpdate): dynamicEfMin: Optional[int] dynamicEfMax: Optional[int] dynamicEfFactor: Optional[int] ef: Optional[int] filterStrategy: Optional[VectorFilterStrategy] flatSearchCutoff: Optional[int] vectorCacheMaxObjects: Optional[int] @staticmethod def vector...
_VectorIndexConfigHNSWUpdate
python
huggingface__transformers
src/transformers/modeling_gguf_pytorch_utils.py
{ "start": 1659, "end": 1748 }
class ____(NamedTuple): weights: np.ndarray name: str metadata: dict
GGUFTensor
python
pytorch__pytorch
test/inductor/test_torchinductor.py
{ "start": 484566, "end": 549111 }
class ____: suffixes: tuple[str, ...] is_skip: bool = False __test__: bool = False def copy_tests(my_cls, other_cls, suffix, test_failures=None, xfail_prop=None): # noqa: B902 for name, value in my_cls.__dict__.items(): if name.startswith("test_"): # You cannot copy functions in P...
TestFailure
python
great-expectations__great_expectations
great_expectations/datasource/fluent/pandas_azure_blob_storage_datasource.py
{ "start": 1108, "end": 1199 }
class ____(PandasDatasourceError): pass @public_api
PandasAzureBlobStorageDatasourceError
python
numba__numba
numba/tests/test_object_mode.py
{ "start": 607, "end": 3257 }
class ____(TestCase): def test_complex_constant(self): pyfunc = complex_constant cfunc = jit((), forceobj=True)(pyfunc) self.assertPreciseEqual(pyfunc(12), cfunc(12)) def test_long_constant(self): pyfunc = long_constant cfunc = jit((), forceobj=True)(pyfunc) sel...
TestObjectMode