language
stringclasses
1 value
repo
stringclasses
346 values
path
stringlengths
6
201
class_span
dict
source
stringlengths
21
2.38M
target
stringlengths
1
96
python
openai__openai-python
src/openai/types/realtime/audio_transcription.py
{ "start": 223, "end": 1332 }
class ____(BaseModel): language: Optional[str] = None """The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency. """ model: Optional[ Literal["whisper-1...
AudioTranscription
python
pytorch__pytorch
torch/_inductor/runtime/triton_heuristics.py
{ "start": 143412, "end": 143860 }
class ____(ComboKernelGrid): def combo_x_grid( self, xnumels: list[int | str], no_x_dims: list[bool], meta: dict[str, int], ) -> str | int: assert len(xnumels) == len(no_x_dims) return self.summation( [ self.ceildiv(x, 1 if no_x_dim els...
SequentialComboKernelGrid
python
doocs__leetcode
solution/3300-3399/3320.Count The Number of Winning Sequences/Solution.py
{ "start": 0, "end": 803 }
class ____: def countWinningSequences(self, s: str) -> int: def calc(x: int, y: int) -> int: if x == y: return 0 if x < y: return 1 if x == 0 and y == 2 else -1 return -1 if x == 2 and y == 0 else 1 @cache def dfs(i: int, j...
Solution
python
eth-brownie__brownie
brownie/typing.py
{ "start": 1791, "end": 1876 }
class ____(TypedDict): statements: StatementMap branches: BranchMap
CoverageMap
python
keras-team__keras
keras/src/backend/common/backend_utils_test.py
{ "start": 6647, "end": 8883 }
class ____(test_case.TestCase): def test_valid_padding_without_output_padding(self): """Test computation with 'valid' padding and no output padding.""" output_shape = _get_output_shape_given_tf_padding( input_size=5, kernel_size=3, strides=2, padding="...
GetOutputShapeGivenTFPaddingTest
python
astropy__astropy
astropy/modeling/optimizers.py
{ "start": 2195, "end": 5047 }
class ____(Optimization): """ Sequential Least Squares Programming optimization algorithm. The algorithm is described in [1]_. It supports tied and fixed parameters, as well as bounded constraints. Uses `scipy.optimize.fmin_slsqp`. References ---------- .. [1] http://www.netlib.org/tom...
SLSQP
python
getsentry__sentry
tests/sentry/workflow_engine/endpoints/test_organization_detector_workflow_index.py
{ "start": 275, "end": 1918 }
class ____(APITestCase): endpoint = "sentry-api-0-organization-detector-workflow-index" def setUp(self) -> None: super().setUp() self.login_as(user=self.user) self.unconnected_workflow = self.create_workflow(organization_id=self.organization.id) self.unconnected_detector = self...
OrganizationDetectorWorkflowAPITestCase
python
gevent__gevent
src/greentest/3.14/test__interpreters.py
{ "start": 4749, "end": 5481 }
class ____(TestBase): def test_main(self): main, *_ = _interpreters.get_main() cur, *_ = _interpreters.get_current() self.assertEqual(cur, main) self.assertIsInstance(cur, int) def test_subinterpreter(self): main, *_ = _interpreters.get_main() interp = _interpre...
GetCurrentTests
python
pytorch__pytorch
torch/nn/modules/activation.py
{ "start": 22470, "end": 23671 }
class ____(Module): r"""Applies the Hard Shrinkage (Hardshrink) function element-wise. Hardshrink is defined as: .. math:: \text{HardShrink}(x) = \begin{cases} x, & \text{ if } x > \lambda \\ x, & \text{ if } x < -\lambda \\ 0, & \text{ otherwise } \end{case...
Hardshrink
python
great-expectations__great_expectations
great_expectations/metrics/column/null_count.py
{ "start": 182, "end": 324 }
class ____(ColumnMetric[ColumnNullCountResult]): """Count of null values in a column""" name = "column_values.null.count"
ColumnNullCount
python
doocs__leetcode
solution/1400-1499/1463.Cherry Pickup II/Solution2.py
{ "start": 0, "end": 774 }
class ____: def cherryPickup(self, grid: List[List[int]]) -> int: m, n = len(grid), len(grid[0]) f = [[-1] * n for _ in range(n)] g = [[-1] * n for _ in range(n)] f[0][n - 1] = grid[0][0] + grid[0][n - 1] for i in range(1, m): for j1 in range(n): f...
Solution
python
python-attrs__attrs
tests/test_dunders.py
{ "start": 1076, "end": 2830 }
class ____: a = attr.ib(eq=True, order=str.lower) b = attr.ib(order=True) # HashC is hashable by explicit definition while HashCSlots is hashable # implicitly. The "Cached" versions are the same, except with hash code # caching enabled HashC = simple_class(unsafe_hash=True) HashCSlots = simple_class(unsafe_h...
OrderCallableCSlots
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/asset_graph.py
{ "start": 7530, "end": 7947 }
class ____(graphene.ObjectType): id = graphene.NonNull(graphene.ID) assetKey = graphene.NonNull(GrapheneAssetKey) latestMaterialization = graphene.Field(GrapheneMaterializationEvent) unstartedRunIds = non_null_list(graphene.String) inProgressRunIds = non_null_list(graphene.String) latestRun = gr...
GrapheneAssetLatestInfo
python
great-expectations__great_expectations
great_expectations/metrics/query/data_source_table.py
{ "start": 211, "end": 270 }
class ____(MetricResult[Any]): ...
QueryDataSourceTableResult
python
getsentry__sentry
src/sentry/tagstore/types.py
{ "start": 3099, "end": 3605 }
class ____(TagType): __slots__ = ("group_id", "key", "value", "times_seen", "first_seen", "last_seen") _sort_key = "value" def __init__( self, group_id: int, key: str, value: str | None, times_seen: int, first_seen, last_seen, ): self.grou...
GroupTagValue
python
joke2k__faker
faker/providers/color/hu_HU/__init__.py
{ "start": 43, "end": 430 }
class ____(ColorProvider): """Implement color provider for ``hu_HU`` locale.""" safe_colors = ( "fekete", "bordó", "zöld", "királykék", "oliva", "bíbor", "kékeszöld", "citromzöld", "kék", "ezüst", "szürke", "sárga",...
Provider
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_pretty.py
{ "start": 2884, "end": 3374 }
class ____: def __init__(self, content): self.content = content def _repr_pretty_(self, p, cycle): if cycle: p.text("MyList(...)") else: with p.group(3, "MyList(", ")"): for i, child in enumerate(self.content): if i: ...
MyList
python
django__django
tests/forms_tests/widget_tests/test_multiplehiddeninput.py
{ "start": 159, "end": 4032 }
class ____(WidgetTest): widget = MultipleHiddenInput() def test_render_single(self): self.check_html( self.widget, "email", ["test@example.com"], html='<input type="hidden" name="email" value="test@example.com">', ) def test_render_multiple(s...
MultipleHiddenInputTest
python
django-extensions__django-extensions
tests/management/commands/test_delete_squashed_migrations.py
{ "start": 4067, "end": 8037 }
class ____(BaseDeleteSquashedMigrationsTestCase): """Tests for delete_squashed_migrations command.""" @patch( "django_extensions.management.commands.delete_squashed_migrations.six.moves.input" ) def test_should_delete_squashed_migrations(self, m_input): m_input.return_value = "y" ...
DeleteSquashedMigrationsTests
python
django-haystack__django-haystack
test_haystack/simple_tests/search_indexes.py
{ "start": 379, "end": 618 }
class ____(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) score = indexes.CharField(model_attr="score") def get_model(self): return ScoreMockModel
SimpleMockScoreIndex
python
pytorch__pytorch
torch/_inductor/compile_worker/subproc_pool.py
{ "start": 2710, "end": 3152 }
class ____(Exception): """ Thrown when a job in a subprocess raises an Exception. """ def __init__(self, details: str, name: str = "<unknown>") -> None: self.details = details super().__init__( f"An exception occurred in a subprocess:\n\nName={name}\n{details}" ) ...
SubprocException
python
kamyu104__LeetCode-Solutions
Python/number-of-unique-categories.py
{ "start": 158, "end": 454 }
class ____(object): def numberOfCategories(self, n, categoryHandler): """ :type n: int :type categoryHandler: CategoryHandler :rtype: int """ return sum(all(not categoryHandler.haveSameCategory(j, i) for j in xrange(i)) for i in xrange(n))
Solution
python
pytorch__pytorch
torch/ao/pruning/_experimental/data_scheduler/base_data_scheduler.py
{ "start": 212, "end": 7733 }
class ____: r""" The BaseDataScheduler is the abstract scheduler class specifically for the BaseDataSparsifier class. This class controls a specific hyperparameter of the sparsifier class and varies it across the training process (or across time). Args: data_sparsifier (instance of BaseData...
BaseDataScheduler
python
run-llama__llama_index
llama-index-core/llama_index/core/base/embeddings/base.py
{ "start": 2014, "end": 22646 }
class ____(TransformComponent, DispatcherSpanMixin): """Base class for embeddings.""" model_config = ConfigDict( protected_namespaces=("pydantic_model_",), arbitrary_types_allowed=True ) model_name: str = Field( default="unknown", description="The name of the embedding model." ) ...
BaseEmbedding
python
dask__dask
dask/dataframe/dask_expr/_repartition.py
{ "start": 14601, "end": 18038 }
class ____(Repartition): @functools.cached_property def _size(self): size = self.operand("partition_size") if isinstance(size, str): size = parse_bytes(size) return int(size) @functools.cached_property def _mem_usage(self): return _get_mem_usages(self.frame)...
RepartitionSize
python
pytorch__pytorch
test/dynamo/test_backward_higher_order_ops.py
{ "start": 585, "end": 1957 }
class ____(torch._dynamo.test_case.TestCase): def test_invoke_in_eager(self): x = torch.tensor([0.5, 0.5], requires_grad=True) y = torch.tensor([0.5, 0.5], requires_grad=True) def fn(x, y): x.register_hook(_multiply_invoke) return x * y out = fn(x, y) ...
BackwardHigherOrderOpTests
python
apache__airflow
providers/google/tests/unit/google/test_go_module.py
{ "start": 939, "end": 1687 }
class ____: @mock.patch("airflow.providers.google.go_module_utils._execute_in_subprocess") def test_should_init_go_module(self, mock_execute_in_subprocess): init_module(go_module_name="example.com/main", go_module_path="/home/example/go") mock_execute_in_subprocess.assert_called_once_with( ...
TestGoModule
python
ray-project__ray
python/ray/autoscaler/_private/kuberay/autoscaling_config.py
{ "start": 1130, "end": 20847 }
class ____: """Produces an autoscaling config by reading data from the RayCluster CR. Used to fetch the autoscaling config at the beginning of each autoscaler iteration. In the context of Ray deployment on Kubernetes, the autoscaling config is an internal interface. The autoscaling config carries...
AutoscalingConfigProducer
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/instigation.py
{ "start": 6854, "end": 8461 }
class ____(DynamicPartitionsRequestMixin, graphene.ObjectType): class Meta: # pyright: ignore[reportIncompatibleVariableOverride] name = "DynamicPartitionsRequestResult" skippedPartitionKeys = non_null_list(graphene.String) def __init__(self, dynamic_partitions_request_result: DynamicPartitionsRe...
GrapheneDynamicPartitionsRequestResult
python
ray-project__ray
python/ray/experimental/channel/torch_tensor_type.py
{ "start": 550, "end": 7424 }
class ____(ChannelOutputType): AUTO = "auto" CPU = "cpu" ACCELERATOR = "accelerator" def __init__( self, transport: Optional[Union[str, Communicator]] = AUTO, device: Device = Device.DEFAULT, _static_shape: bool = False, _direct_return: Optional[bool] = False, ...
TorchTensorType
python
astropy__astropy
astropy/coordinates/representation/spherical.py
{ "start": 51892, "end": 54918 }
class ____(BaseSphericalCosLatDifferential): """Differential(s) of points in 3D spherical coordinates. Parameters ---------- d_lon_coslat, d_lat : `~astropy.units.Quantity` The differential longitude (with cos(lat) included) and latitude. d_distance : `~astropy.units.Quantity` The d...
SphericalCosLatDifferential
python
google__python-fire
fire/console/platforms.py
{ "start": 4934, "end": 8218 }
class ____(object): """An enum representing the system architecture you are running on.""" class _ARCH(object): """A single architecture.""" # pylint: disable=redefined-builtin def __init__(self, id, name, file_name): self.id = id self.name = name self.file_name = file_name def ...
Architecture
python
huggingface__transformers
tests/models/blip/test_modeling_blip.py
{ "start": 7443, "end": 10890 }
class ____: def __init__( self, parent, batch_size=12, seq_length=7, is_training=True, use_input_mask=True, use_labels=True, vocab_size=99, hidden_size=32, projection_dim=32, num_hidden_layers=2, num_attention_heads=4, ...
BlipTextModelTester
python
huggingface__transformers
tests/models/layoutlm/test_modeling_layoutlm.py
{ "start": 13837, "end": 17617 }
class ____(unittest.TestCase): @slow def test_forward_pass_no_head(self): model = LayoutLMModel.from_pretrained("microsoft/layoutlm-base-uncased").to(torch_device) input_ids, attention_mask, bbox, token_type_ids, labels = prepare_layoutlm_batch_inputs() # forward pass outputs =...
LayoutLMModelIntegrationTest
python
apache__airflow
providers/apache/hive/tests/unit/apache/hive/operators/test_hive_stats.py
{ "start": 1837, "end": 14910 }
class ____(TestHiveEnvironment): def setup_method(self, method): self.kwargs = dict( table="table", partition=dict(col="col", value="value"), metastore_conn_id="metastore_conn_id", presto_conn_id="presto_conn_id", mysql_conn_id="mysql_conn_id", ...
TestHiveStatsCollectionOperator
python
doocs__leetcode
solution/1500-1599/1592.Rearrange Spaces Between Words/Solution.py
{ "start": 0, "end": 297 }
class ____: def reorderSpaces(self, text: str) -> str: spaces = text.count(" ") words = text.split() if len(words) == 1: return words[0] + " " * spaces cnt, mod = divmod(spaces, len(words) - 1) return (" " * cnt).join(words) + " " * mod
Solution
python
scipy__scipy
scipy/stats/_multivariate.py
{ "start": 53946, "end": 69787 }
class ____(multi_rv_generic): r"""A matrix t-random variable. The `mean` keyword specifies the mean. The `row_spread` keyword specifies the row-wise spread matrix. The `col_spread` keyword specifies the column-wise spread matrix. Methods ------- pdf(x, mean=None, row_spread=None, col_sprea...
matrix_t_gen
python
google__jax
jax/_src/debugger/colab_debugger.py
{ "start": 6866, "end": 7854 }
class ____(cli_debugger.CliDebugger): """A JAX debugger for a Colab environment.""" def __init__(self, frames: list[debugger_core.DebuggerFrame], thread_id: int): super().__init__(frames, thread_id) self._debugger_view = DebuggerView(self.current_frame()) self.stdout = sel...
ColabDebugger
python
allegroai__clearml
clearml/backend_api/services/v2_13/workers.py
{ "start": 66588, "end": 70612 }
class ____(Response): """ Response of workers.get_stats endpoint. :param workers: List of the requested workers with their statistics :type workers: Sequence[WorkerStats] """ _service = "workers" _action = "get_stats" _version = "2.13" _schema = { "definitions": { ...
GetStatsResponse
python
pyqtgraph__pyqtgraph
pyqtgraph/examples/CustomGraphItem.py
{ "start": 338, "end": 3408 }
class ____(pg.GraphItem): def __init__(self): self.dragPoint = None self.dragOffset = None self.textItems = [] pg.GraphItem.__init__(self) self.scatter.sigClicked.connect(self.clicked) def setData(self, **kwds): self.text = kwds.pop('text', []) se...
Graph
python
automl__auto-sklearn
autosklearn/metalearning/metalearning/meta_base.py
{ "start": 658, "end": 782 }
class ____(object): def __init__(self, name, features): self.name = name self.features = features
Instance
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/log/stackdriver_task_handler.py
{ "start": 2332, "end": 15940 }
class ____(logging.Handler): """ Handler that directly makes Stackdriver logging API calls. This is a Python standard ``logging`` handler using that can be used to route Python standard logging messages directly to the Stackdriver Logging API. It can also be used to save logs for executing tas...
StackdriverTaskHandler
python
great-expectations__great_expectations
great_expectations/expectations/core/expect_column_value_z_scores_to_be_less_than.py
{ "start": 2113, "end": 12605 }
class ____(ColumnMapExpectation): __doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION} ExpectColumnValueZScoresToBeLessThan is a \ Column Map Expectation \ for typed-column backends, and also for PandasExecutionEngine where the column \ dtype and provided type_ are unambiguous constraints \ (any dtype...
ExpectColumnValueZScoresToBeLessThan
python
keras-team__keras
keras/src/callbacks/remote_monitor_test.py
{ "start": 373, "end": 3900 }
class ____(testing.TestCase): def test_RemoteMonitor(self): if requests is None: self.skipTest("`requests` required to run this test") monitor = callbacks.RemoteMonitor() # This will raise a warning since the default address in unreachable: warning_msg = "Could not reach...
TerminateOnNaNTest
python
getsentry__sentry
src/sentry/integrations/bitbucket_server/repository.py
{ "start": 539, "end": 6171 }
class ____(IntegrationRepositoryProvider): name = "Bitbucket Server" repo_provider = IntegrationProviderSlug.BITBUCKET_SERVER.value def get_repository_data(self, organization, config): installation = self.get_installation(config.get("installation"), organization.id) client = installation.ge...
BitbucketServerRepositoryProvider
python
vyperlang__vyper
vyper/ast/nodes.py
{ "start": 20829, "end": 21110 }
class ____(VyperNode): """ Inherited class for Module and FunctionDef nodes. Class attributes ---------------- doc_string : Expr Expression node representing the docstring within this node. """ __slots__ = ("body", "name", "doc_string")
TopLevel
python
rapidsai__cudf
python/cudf/cudf/core/column/column.py
{ "start": 4204, "end": 5013 }
class ____: # A wrapper that exposes the __cuda_array_interface__ of a buffer as read-only to # avoid copy-on-write issues. def __init__(self, buffer: Buffer, mode: Literal["read", "write"]) -> None: self._buffer = buffer self._mode = mode @property def owner(self) -> Buffer: ...
ROCAIWrapper
python
Pylons__pyramid
tests/test_path.py
{ "start": 3972, "end": 4527 }
class ____(unittest.TestCase): def _callFUT(self, package): from pyramid.path import package_of return package_of(package) def test_it_package(self): import tests package = DummyPackageOrModule(tests) result = self._callFUT(package) self.assertEqual(result, tes...
TestPackageOf
python
altair-viz__altair
altair/utils/selection.py
{ "start": 2833, "end": 3928 }
class ____: """ Represents the state of an alt.selection_interval(). The value field is a dict of the form: {"dim1": [0, 10], "dim2": ["A", "BB", "CCC"]} where "dim1" and "dim2" are dataset columns and the dict values correspond to the selected range. """ name: str value: dict...
IntervalSelection
python
pytorch__pytorch
torch/distributed/checkpoint/filesystem.py
{ "start": 2611, "end": 3299 }
class ____(_TensorLoader): def __init__(self, resolve_fun: Callable) -> None: self.resolve_fun = resolve_fun self.items: list[tuple[int, object]] = [] def add(self, size: int, obj: object) -> None: self.items.append((size, obj)) def start_loading(self) -> None: pass de...
_SerialCpuLoader
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/attributes.py
{ "start": 27768, "end": 39995 }
class ____: """internal implementation for instrumented attributes.""" collection: bool default_accepts_scalar_loader: bool uses_objects: bool supports_population: bool dynamic: bool _is_has_collection_adapter = False _replace_token: AttributeEventToken _remove_token: AttributeEve...
_AttributeImpl
python
wandb__wandb
wandb/apis/importers/wandb.py
{ "start": 1957, "end": 2738 }
class ____: artifacts: Iterable[wandb.Artifact] entity: str project: str type_: str name: str def __iter__(self) -> Iterator: return iter(self.artifacts) def __repr__(self) -> str: return f"ArtifactSequence({self.identifier})" @property def identifier(self) -> str:...
ArtifactSequence
python
conda__conda
conda/gateways/repodata/__init__.py
{ "start": 1819, "end": 2022 }
class ____(UnavailableInvalidChannel): """ Subclass used to determine when empty repodata should be cached, e.g. for a channel that doesn't provide current_repodata.json """
RepodataIsEmpty
python
altair-viz__altair
altair/vegalite/v6/schema/mixins.py
{ "start": 620, "end": 42104 }
class ____(SchemaBase): """ MarkDef schema wrapper. Parameters ---------- align : dict, :class:`Align`, :class:`ExprRef`, Literal['left', 'center', 'right'] The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of ``"left"``, ``"right"``, ``"center...
_MarkDef
python
numba__numba
numba/tests/test_numpyadapt.py
{ "start": 448, "end": 1307 }
class ____(unittest.TestCase): def test_array_adaptor(self): arystruct = ArrayStruct3D() adaptorptr = _helperlib.c_helpers['adapt_ndarray'] adaptor = PYFUNCTYPE(c_int, py_object, c_void_p)(adaptorptr) ary = np.arange(60).reshape(2, 3, 10) status = adaptor(ary, byref(arystru...
TestArrayAdaptor
python
celery__celery
t/unit/utils/test_time.py
{ "start": 12364, "end": 13615 }
class ____: @patch('random.randrange', lambda n: n - 2) def test_with_jitter(self): assert get_exponential_backoff_interval( factor=4, retries=3, maximum=100, full_jitter=True ) == 4 * (2 ** 3) - 1 def test_without_jitter(self): asser...
test_get_exponential_backoff_interval
python
django__django
django/core/serializers/base.py
{ "start": 201, "end": 303 }
class ____(KeyError): """The requested serializer was not found.""" pass
SerializerDoesNotExist
python
neetcode-gh__leetcode
python/0516-longest-palindromic-subsequence.py
{ "start": 1347, "end": 1883 }
class ____: def longestPalindromeSubseq(self, s: str) -> int: return self.longestCommonSubsequence(s, s[::-1]) def longestCommonSubsequence(self, s1: str, s2: str) -> int: N, M = len(s1), len(s2) dp = [[0] * (M+1) for _ in range(N+1)] for i in range(N): ...
Solution
python
scipy__scipy
benchmarks/benchmarks/special.py
{ "start": 1098, "end": 1346 }
class ____(Benchmark): def setup(self): x, y = np.logspace(3, 5, 10), np.logspace(3, 5, 10) x, y = np.meshgrid(x, y) self.large_z = x + 1j*y def time_loggamma_asymptotic(self): loggamma(self.large_z)
Loggamma
python
huggingface__transformers
src/transformers/models/qwen3_omni_moe/modular_qwen3_omni_moe.py
{ "start": 96032, "end": 99314 }
class ____(GradientCheckpointingLayer): def __init__(self, config: Qwen3OmniMoeCode2WavConfig, layer_idx): super().__init__() self.hidden_size = config.hidden_size self.self_attn = Qwen3OmniMoeCode2WavAttention(config, layer_idx) self.mlp = Qwen3OmniMoeCode2WavMlp(config) sel...
Qwen3OmniMoeCode2WavTransformerLayer
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/functions.py
{ "start": 13755, "end": 16947 }
class ____(GoogleCloudBaseOperator): """ Deletes the specified function from Google Cloud Functions. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudFunctionDeleteFunctionOperator` :param name: A fully-qualified functio...
CloudFunctionDeleteFunctionOperator
python
openai__openai-python
src/openai/resources/evals/runs/runs.py
{ "start": 11320, "end": 21377 }
class ____(AsyncAPIResource): @cached_property def output_items(self) -> AsyncOutputItems: return AsyncOutputItems(self._client) @cached_property def with_raw_response(self) -> AsyncRunsWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return...
AsyncRuns
python
scipy__scipy
benchmarks/benchmarks/stats.py
{ "start": 25960, "end": 26696 }
class ____(Benchmark): param_names = ['n_size'] params = [ [10, 4000] ] def setup(self, n_size): rng = np.random.default_rng(12345678) self.u_values = rng.random(n_size) * 10 self.u_weights = rng.random(n_size) * 10 self.v_values = rng.random(n_size // 2) * 10 ...
DistanceFunctions
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/operators/bedrock.py
{ "start": 28148, "end": 34105 }
class ____(AwsBaseOperator[BedrockAgentHook]): """ Begin an ingestion job, in which an Amazon Bedrock data source is added to an Amazon Bedrock knowledge base. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:BedrockIngestDataOper...
BedrockIngestDataOperator
python
huggingface__transformers
tests/models/fastspeech2_conformer/test_modeling_fastspeech2_conformer.py
{ "start": 34184, "end": 36421 }
class ____(unittest.TestCase): def test_inference_integration(self): model = FastSpeech2ConformerWithHifiGan.from_pretrained("espnet/fastspeech2_conformer_with_hifigan") model.to(torch_device) model.eval() tokenizer = FastSpeech2ConformerTokenizer.from_pretrained("espnet/fastspeech2...
FastSpeech2ConformerWithHifiGanIntegrationTest
python
django__django
django/contrib/gis/db/models/fields.py
{ "start": 11333, "end": 11488 }
class ____(GeometryField): geom_type = "POLYGON" geom_class = Polygon form_class = forms.PolygonField description = _("Polygon")
PolygonField
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-dashscope/llama_index/embeddings/dashscope/base.py
{ "start": 531, "end": 755 }
class ____(str, Enum): """DashScope TextEmbedding models.""" TEXT_EMBEDDING_V1 = "text-embedding-v1" TEXT_EMBEDDING_V2 = "text-embedding-v2" TEXT_EMBEDDING_V3 = "text-embedding-v3"
DashScopeTextEmbeddingModels
python
sqlalchemy__sqlalchemy
test/dialect/oracle/test_reflection.py
{ "start": 40821, "end": 42215 }
class ____(fixtures.TestBase): __requires__ = ("oracle_test_dblink",) __only_on__ = "oracle" __sparse_driver_backend__ = True @classmethod def setup_test_class(cls): cls.dblink = config.file_config.get("sqla_testing", "oracle_db_link") # note that the synonym here is still not tota...
DBLinkReflectionTest
python
pallets__werkzeug
src/werkzeug/middleware/lint.py
{ "start": 3876, "end": 6952 }
class ____: def __init__( self, iterator: t.Iterable[bytes], headers_set: tuple[int, Headers], chunks: list[int], ) -> None: self._iterator = iterator self._next = iter(iterator).__next__ self.closed = False self.headers_set = headers_set s...
GuardedIterator
python
scikit-learn__scikit-learn
sklearn/utils/_metadata_requests.py
{ "start": 49167, "end": 59941 }
class ____: """Mixin class for adding metadata request functionality. ``BaseEstimator`` inherits from this Mixin. .. versionadded:: 1.3 """ if TYPE_CHECKING: # pragma: no cover # This code is never run in runtime, but it's here for type checking. # Type checkers fail to understan...
_MetadataRequester
python
getsentry__sentry
src/sentry/shared_integrations/client/proxy.py
{ "start": 3863, "end": 9995 }
class ____(ApiClient): """ Universal Client to access third-party resources safely in Hybrid Cloud. Requests to third parties must always exit the Sentry subnet via the Control Silo, and only add sensitive credentials at that stage. When testing, client requests will always go to the base_url unles...
IntegrationProxyClient
python
python-openxml__python-docx
tests/image/test_png.py
{ "start": 7530, "end": 10602 }
class ____: def it_can_construct_from_a_stream( self, stream_, StreamReader_, stream_rdr_, _ChunkParser__init_ ): chunk_parser = _ChunkParser.from_stream(stream_) StreamReader_.assert_called_once_with(stream_, BIG_ENDIAN) _ChunkParser__init_.assert_called_once_with(ANY, stream_r...
Describe_ChunkParser
python
django__django
tests/utils_tests/test_module_loading.py
{ "start": 5391, "end": 5968 }
class ____(SimpleTestCase): def test_import_string(self): cls = import_string("django.utils.module_loading.import_string") self.assertEqual(cls, import_string) # Test exceptions raised with self.assertRaises(ImportError): import_string("no_dots_in_path") msg = 'M...
ModuleImportTests
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/layout/processors.py
{ "start": 7701, "end": 8583 }
class ____(HighlightSearchProcessor): """ Highlight the search terms that are used for highlighting the incremental search. The style class 'incsearch' will be applied to the content. Important: this requires the `preview_search=True` flag to be set for the `BufferControl`. Otherwise, the cursor po...
HighlightIncrementalSearchProcessor
python
bokeh__bokeh
src/bokeh/models/widgets/tables.py
{ "start": 23054, "end": 29667 }
class ____(TableWidget): ''' Two-dimensional grid for visualization and editing large amounts of data. ''' # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) autosize_mode = Enum(AutosizeMode, default...
DataTable
python
google__jax
jax/_src/pallas/fuser/block_spec.py
{ "start": 20139, "end": 20633 }
class ____(Protocol): def __call__( self, ctx: UsageRuleContext, used_outs: Sequence[set[Usage]] | set[Usage], **params: Any, ) -> Sequence[set[Usage]]: ... usage_rules: dict[core.Primitive, UsageRuleFn] = {} def register_usage_rule( prim: core.Primitive, ) -> Callable[[UsageRul...
UsageRuleFn
python
pypa__warehouse
warehouse/oidc/models/gitlab.py
{ "start": 15525, "end": 17132 }
class ____(GitLabPublisherMixin, PendingOIDCPublisher): __tablename__ = "pending_gitlab_oidc_publishers" __mapper_args__ = {"polymorphic_identity": "pending_gitlab_oidc_publishers"} __table_args__ = ( # type: ignore[assignment] UniqueConstraint( "namespace", "project", ...
PendingGitLabPublisher
python
ansible__ansible
lib/ansible/_internal/_templating/_lazy_containers.py
{ "start": 2452, "end": 2645 }
class ____: """Wrapper around values to indicate lazy behavior has not yet been applied.""" value: t.Any @t.final @dataclasses.dataclass(frozen=True, kw_only=True, slots=True)
_LazyValue
python
google__pytype
pytype/compare.py
{ "start": 499, "end": 10441 }
class ____(Exception): """Comparing incompatible primitive constants.""" def _incompatible(left_name, right_name): """Incompatible primitive types can never be equal.""" if left_name == right_name: return False for group in NUMERIC, STRING: if left_name in group and right_name in group: return F...
CmpTypeError
python
plotly__plotly.py
plotly/graph_objs/mesh3d/_lightposition.py
{ "start": 233, "end": 3489 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "mesh3d" _path_str = "mesh3d.lightposition" _valid_props = {"x", "y", "z"} @property def x(self): """ Numeric vector, representing the X coordinate for each vertex. The 'x' property is a number and may be specified as:...
Lightposition
python
doocs__leetcode
solution/3300-3399/3353.Minimum Total Operations/Solution.py
{ "start": 0, "end": 123 }
class ____: def minOperations(self, nums: List[int]) -> int: return sum(x != y for x, y in pairwise(nums))
Solution
python
pytorch__pytorch
test/distributed/_composable/fsdp/test_fully_shard_comm.py
{ "start": 23632, "end": 63747 }
class ____(FSDPTest): @property def world_size(self) -> int: return min(4, torch.get_device_module(device_type).device_count()) @skip_if_lt_x_gpu(2) def test_fully_shard_backward_prefetch(self): # Activation checkpointing should not affect the expected FSDP events self.run_subte...
TestFullyShardPrefetch
python
PrefectHQ__prefect
tests/events/server/test_in_memory_ordering.py
{ "start": 12114, "end": 15394 }
class ____: async def test_ordering_is_correct( self, causal_ordering: CausalOrdering, in_proper_order: Sequence[ReceivedEvent], example: Sequence[ReceivedEvent], ): processed: list[ReceivedEvent] = [] async def evaluate(event: ReceivedEvent, depth: int = 0) -> N...
TestCausalOrderingFlow
python
getsentry__sentry
tests/sentry/api/endpoints/test_project_overview.py
{ "start": 143, "end": 2242 }
class ____(APITestCase): endpoint = "sentry-api-0-project-overview" def setUp(self) -> None: super().setUp() self.login_as(user=self.user) def test_simple(self) -> None: response = self.get_success_response(self.project.organization.slug, self.project.slug) assert response....
ProjectOverviewTest
python
django__django
tests/migrations/test_multidb.py
{ "start": 532, "end": 698 }
class ____: """ A router that always allows migrating. """ def allow_migrate(self, db, app_label, **hints): return True
MigrateEverythingRouter
python
getsentry__sentry
tests/sentry/workflow_engine/handlers/detector/test_stateful.py
{ "start": 5992, "end": 18498 }
class ____(TestCase): def setUp(self) -> None: self.group_key: DetectorGroupKey = None self.detector = self.create_detector( name="Stateful Detector", project=self.project, ) self.detector.workflow_condition_group = self.create_data_condition_group() ...
TestStatefulDetectorHandlerEvaluate
python
scipy__scipy
scipy/optimize/tests/test_least_squares.py
{ "start": 14325, "end": 18951 }
class ____: def test_inconsistent(self): assert_raises(ValueError, least_squares, fun_trivial, 2.0, bounds=(10.0, 0.0), method=self.method) def test_infeasible(self): assert_raises(ValueError, least_squares, fun_trivial, 2.0, bounds=(3., 4), method=se...
BoundsMixin
python
astropy__astropy
astropy/io/ascii/core.py
{ "start": 46075, "end": 56049 }
class ____(metaclass=MetaBaseReader): """Class providing methods to read and write an ASCII table using the specified header, data, inputter, and outputter instances. Typical usage is to instantiate a Reader() object and customize the ``header``, ``data``, ``inputter``, and ``outputter`` attributes. E...
BaseReader
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-bitbucket/llama_index/readers/bitbucket/base.py
{ "start": 200, "end": 5204 }
class ____(BaseReader): """ Bitbucket reader. Reads the content of files in Bitbucket repositories. """ def __init__( self, base_url: Optional[str] = None, project_key: Optional[str] = None, branch: Optional[str] = "refs/heads/develop", repository: Optional...
BitbucketReader
python
getsentry__sentry
tests/sentry/utils/test_exceptions.py
{ "start": 643, "end": 12061 }
class ____: def test_with_task_state_and_single_exception_mapping(self) -> None: """Test exception_grouping_context with a single exception type mapping.""" mock_task_state = CurrentTaskState( id="test_id", namespace="test_namespace", taskname="test_task", ...
TestExceptionGroupingContext
python
kamyu104__LeetCode-Solutions
Python/maximum-points-in-an-archery-competition.py
{ "start": 46, "end": 1034 }
class ____(object): def maximumBobPoints(self, numArrows, aliceArrows): """ :type numArrows: int :type aliceArrows: List[int] :rtype: List[int] """ def check(mask, numArrows): score = 0 cnt = [0]*len(aliceArrows) i, base = 0, 1 ...
Solution
python
geekcomputers__Python
venv/Lib/site-packages/pip/_internal/build_env.py
{ "start": 2625, "end": 9757 }
class ____: """Creates and manages an isolated environment to install build deps""" def __init__(self) -> None: temp_dir = TempDirectory(kind=tempdir_kinds.BUILD_ENV, globally_managed=True) self._prefixes = OrderedDict( (name, _Prefix(os.path.join(temp_dir.path, name))) ...
BuildEnvironment
python
jina-ai__jina
tests/integration/deployment_http_composite/test_deployment_http_composite.py
{ "start": 186, "end": 7681 }
class ____(Executor): def __init__(self, init_sleep_time=0, *args, **kwargs): super().__init__(*args, **kwargs) time.sleep(init_sleep_time) @requests(on='/foo') async def foo(self, docs, **kwargs): for doc in docs: doc.text += f'return foo {os.getpid()}' doc....
SingleExecutorDeployment
python
Textualize__textual
src/textual/events.py
{ "start": 19830, "end": 20464 }
class ____(Event, bubble=True, verbose=True): """Sent when the mouse is moved over a widget. Note that this event bubbles, so a widget may receive this event when the mouse moves over a child widget. Check the `node` attribute for the widget directly under the mouse. - [X] Bubbles - [X] Verbos...
Enter
python
spack__spack
lib/spack/spack/test/llnl/util/lock.py
{ "start": 8818, "end": 9319 }
class ____: def __init__(self, lock_path, start=0, length=0): self.lock_path = lock_path self.start = start self.length = length @property def __name__(self): return self.__class__.__name__ def __call__(self, barrier): lock = lk.Lock(self.lock_path, start=self.s...
AcquireWrite
python
tensorflow__tensorflow
tensorflow/python/util/function_utils_test.py
{ "start": 4330, "end": 7353 }
class ____(test.TestCase): def test_simple_function(self): fn_has_kwargs = lambda **x: x self.assertTrue(function_utils.has_kwargs(fn_has_kwargs)) fn_has_no_kwargs = lambda x: x self.assertFalse(function_utils.has_kwargs(fn_has_no_kwargs)) def test_callable(self): class FooHasKwargs(object)...
HasKwargsTest
python
pytorch__pytorch
torch/_functorch/_aot_autograd/schemas.py
{ "start": 53127, "end": 53214 }
class ____(Protocol): def __call__(self, *args: FxValue) -> list[FxValue]: ...
FlatFn
python
gevent__gevent
src/greentest/3.10/test_asyncore.py
{ "start": 26182, "end": 26346 }
class ____(TestAPI_UseIPv6Sockets, unittest.TestCase): use_poll = False @unittest.skipUnless(hasattr(select, 'poll'), 'select.poll required')
TestAPI_UseIPv6Select
python
django__django
tests/queryset_pickle/models.py
{ "start": 251, "end": 444 }
class ____(models.QuerySet): def __getstate__(self): state = super().__getstate__() state[DJANGO_VERSION_PICKLE_KEY] = "1.0" return state
PreviousDjangoVersionQuerySet
python
PyCQA__pylint
doc/data/messages/s/self-cls-assignment/bad.py
{ "start": 0, "end": 233 }
class ____: @classmethod def list_fruits(cls): cls = "apple" # [self-cls-assignment] def print_color(self, *colors): self = "red" # [self-cls-assignment] color = colors[1] print(color)
Fruit