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
PrefectHQ__prefect
src/prefect/client/schemas/actions.py
{ "start": 26711, "end": 27631 }
class ____(ActionBaseModel): """Data used by the Prefect REST API to create a log.""" name: str = Field(default=..., description="The logger name.") level: int = Field(default=..., description="The log level.") message: str = Field(default=..., description="The log message.") timestamp: DateTime = ...
LogCreate
python
astropy__astropy
astropy/io/ascii/qdp.py
{ "start": 15043, "end": 15158 }
class ____(core.DefaultSplitter): """ Split on space for QDP tables. """ delimiter = " "
QDPSplitter
python
Unity-Technologies__ml-agents
ml-agents/mlagents/trainers/torch_entities/model_serialization.py
{ "start": 227, "end": 1128 }
class ____: """ Set this context by calling ``` with exporting_to_onnx(): ``` Within this context, the variable exporting_to_onnx.is_exporting() will be true. This implementation is thread safe. """ # local is_exporting flag for each thread _local_data = threading.local() _l...
exporting_to_onnx
python
readthedocs__readthedocs.org
readthedocs/organizations/migrations/0006_add_assets_cleaned.py
{ "start": 149, "end": 995 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("organizations", "0005_historicalorganization_historicalteam"), ] operations = [ migrations.AddField( model_name="historicalorganization", name="artifacts_cleaned", field=m...
Migration
python
getsentry__responses
responses/__init__.py
{ "start": 19776, "end": 21448 }
class ____(BaseResponse): def __init__( self, method: str, url: "_URLPatternType", callback: Callable[[Any], Any], stream: Optional[bool] = None, content_type: Optional[str] = "text/plain", **kwargs: Any, ) -> None: super().__init__(method, url, **...
CallbackResponse
python
weaviate__weaviate-python-client
weaviate/collections/queries/bm25/generate/sync.py
{ "start": 294, "end": 431 }
class ____( Generic[Properties, References], _BM25GenerateExecutor[ConnectionSync, Properties, References], ): pass
_BM25Generate
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/quantization_ops/quantization_ops_test.py
{ "start": 1973, "end": 3334 }
class ____(test_util.TensorFlowTestCase): @test_util.run_in_graph_and_eager_modes def test_invalid_inputs(self): inputs = constant_op.constant( value=[[1.0], [2.0], [4.0]], dtype=dtypes.float32) with self.assertRaisesRegex((ValueError, errors.InvalidArgumentError), ...
FakeQuantWithMinMaxVarsPerChannelOpTest
python
catalyst-team__catalyst
catalyst/contrib/datasets/mnist.py
{ "start": 8920, "end": 11270 }
class ____(QueryGalleryDataset): """ MNIST for metric learning with query and gallery split. MnistQGDataset should be used for test stage. For this dataset we used only test part of the MNIST and only those images that are labeled as 5, 6, 7, 8, 9. Args: gallery_fraq: gallery size ...
MnistQGDataset
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 34283, "end": 35839 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, domain: str, api_key: str, start_date: str, requests_per_minute: Optional[int] = None, sync_lag_minutes: Optional[int] = None, ): """Airbyte Source for Freshcaller. ...
FreshcallerSource
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/nn_ops/rnn_cell_test.py
{ "start": 2436, "end": 2736 }
class ____(rnn_cell.RNNCell): """RNN Cell generating (output, new_state) = (input + 1, state + 1).""" @property def output_size(self): return 5 @property def state_size(self): return 5 def __call__(self, input_, state, scope=None): return (input_ + 1, state + 1)
Plus1RNNCell
python
huggingface__transformers
src/transformers/models/segformer/configuration_segformer.py
{ "start": 814, "end": 6793 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`SegformerModel`]. It is used to instantiate an SegFormer model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar ...
SegformerConfig
python
pyca__cryptography
src/cryptography/hazmat/primitives/serialization/ssh.py
{ "start": 8404, "end": 10768 }
class ____: """Format for RSA keys. Public: mpint e, n Private: mpint n, e, d, iqmp, p, q """ def get_public( self, data: memoryview ) -> tuple[tuple[int, int], memoryview]: """RSA public fields""" e, data = _get_mpint(data) n, data = _get_mpint(...
_SSHFormatRSA
python
pola-rs__polars
py-polars/src/polars/datatypes/classes.py
{ "start": 914, "end": 1320 }
class ____(Generic[R]): """Decorator that allows a method to be called from the class OR instance.""" def __init__(self, func: Callable[..., R]) -> None: self.func = func def __get__(self, instance: Any, type_: Any) -> Callable[..., R]: if instance is not None: return self.func...
classinstmethod
python
django__django
tests/indexes/models.py
{ "start": 31, "end": 526 }
class ____(models.ForeignObject): """ Creates virtual relation to the translation with model cache enabled. """ # Avoid validation requires_unique_target = False def __init__(self, to, on_delete, from_fields, to_fields, **kwargs): # Disable reverse relation kwargs["related_name...
CurrentTranslation
python
psf__black
src/black/linegen.py
{ "start": 2342, "end": 33281 }
class ____(Visitor[Line]): """Generates reformatted Line objects. Empty lines are not emitted. Note: destroys the tree it's visiting by mutating prefixes of its leaves in ways that will no longer stringify to valid Python code on the tree. """ def __init__(self, mode: Mode, features: Collection[F...
LineGenerator
python
django__django
tests/view_tests/models.py
{ "start": 609, "end": 681 }
class ____(BaseArticle): date_created = models.DateTimeField()
Article
python
huggingface__transformers
src/transformers/integrations/tensor_parallel.py
{ "start": 20747, "end": 22612 }
class ____(TensorParallelLayer): """ Simple class used to define the hooks to add to a layer when we just want to gather the outputs """ def __init__( self, input_layouts: Placement | None = None, output_layouts: Placement | None = None, use_local_output: bool = True, ...
GatherParallel
python
simonw__datasette
datasette/facets.py
{ "start": 11294, "end": 18285 }
class ____(Facet): type = "array" def _is_json_array_of_strings(self, json_string): try: array = json.loads(json_string) except ValueError: return False for item in array: if not isinstance(item, str): return False return True ...
ArrayFacet
python
fastapi__sqlmodel
docs_src/tutorial/fastapi/relationships/tutorial001_py310.py
{ "start": 228, "end": 387 }
class ____(TeamBase, table=True): id: int | None = Field(default=None, primary_key=True) heroes: list["Hero"] = Relationship(back_populates="team")
Team
python
jina-ai__jina
tests/unit/orchestrate/flow/flow-construct/test_flow_except.py
{ "start": 1383, "end": 4189 }
class ____(Executor): @requests def foo(self, **kwargs): raise NotImplementedError @pytest.mark.slow @pytest.mark.parametrize('protocol', ['websocket', 'grpc', 'http']) def test_except_with_shards(mocker, protocol): def validate(req): assert req.status.code == jina_pb2.StatusProto.ERROR ...
NotImplementedExecutor
python
matplotlib__matplotlib
lib/matplotlib/legend_handler.py
{ "start": 1394, "end": 6179 }
class ____: """ A base class for default legend handlers. The derived classes are meant to override *create_artists* method, which has the following signature:: def create_artists(self, legend, orig_handle, xdescent, ydescent, width, height, fontsize, ...
HandlerBase
python
wandb__wandb
tools/cloud_tool.py
{ "start": 495, "end": 1097 }
class ____: instance_name: str = "sdk-compute" num_nodes: int = 1 machine_type: str = "n1-highcpu-4" maintenance_policy: str = "TERMINATE" disk_size: str = "10GB" disk_type: str = "pd-ssd" # accelerator_type: str = "nvidia-tesla-t4" # accelerator_count: int = 1 container_registry: st...
GCEConfig
python
dask__dask
dask/array/tests/test_array_core.py
{ "start": 85972, "end": 183963 }
class ____: def __init__(self, x): self.x = x self.dtype = x.dtype self.shape = x.shape self.ndim = len(x.shape) def __getitem__(self, i): return self.x[i] @pytest.mark.parametrize( "x,chunks", [ (np.arange(25).reshape((5, 5)), (5, 5)), (np.aran...
MyArray
python
astropy__astropy
astropy/table/table.py
{ "start": 6985, "end": 12973 }
class ____(OrderedDict): """OrderedDict subclass for a set of columns. This class enhances item access to provide convenient access to columns by name or index, including slice access. It also handles renaming of columns. The initialization argument ``cols`` can be a list of ``Column`` objects ...
TableColumns
python
scrapy__scrapy
tests/test_webclient.py
{ "start": 1776, "end": 6009 }
class ____: def test_earlyHeaders(self): # basic test stolen from twisted HTTPageGetter factory = client.ScrapyHTTPClientFactory( Request( url="http://foo/bar", body="some data", headers={ "Host": "example.net", ...
TestScrapyHTTPPageGetter
python
django__django
tests/auth_tests/test_management.py
{ "start": 47933, "end": 49789 }
class ____(TestCase): databases = {"default", "other"} def test_createsuperuser_command_with_database_option(self): """ createsuperuser --database should operate on the specified DB. """ new_io = StringIO() call_command( "createsuperuser", interac...
MultiDBCreatesuperuserTestCase
python
ray-project__ray
rllib/examples/envs/classes/multi_agent/footsies/game/footsies_game.py
{ "start": 406, "end": 4780 }
class ____: """Handles gRPC communication with game the server. This class establishes communication between the game server and the Python harness via gRPC. It provides methods to start the game, reset it, get the current state, and step the game by a certain number of frames. """ def __i...
FootsiesGame
python
ray-project__ray
python/ray/llm/_internal/serve/utils/lora_serve_utils.py
{ "start": 4396, "end": 8425 }
class ____: """Download LoRA weights from remote storage and manage disk cache. This class is serve-specific as it depends on DiskMultiplexConfig and other serve-specific concepts. """ def __init__( self, lora_root: Optional[str] = None, download_timeout_s: Optional[float] ...
LoraModelLoader
python
django-import-export__django-import-export
tests/core/tests/test_resources/test_bulk_operations.py
{ "start": 17100, "end": 17966 }
class ____(BulkTest): def setUp(self): super().setUp() self.init_update_test_data(model=UUIDBook) @mock.patch("core.models.UUIDBook.objects.bulk_update") def test_bulk_update_uuid_model(self, mock_bulk_update): """Test update of a Model which defines uuid not pk (issue #1274)""" ...
BulkUUIDBookUpdateTest
python
django-debug-toolbar__django-debug-toolbar
tests/test_checks.py
{ "start": 264, "end": 12194 }
class ____(SimpleTestCase): @override_settings( MIDDLEWARE=[ "django.contrib.messages.middleware.MessageMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.middleware.gzip.GZip...
ChecksTestCase
python
jazzband__django-waffle
waffle/tests/test_waffle.py
{ "start": 31350, "end": 32394 }
class ____(TestCase): @mock.patch.object(random, 'uniform') def test_percent(self, uniform): """If you have no cookie, you get a cookie!""" uniform.return_value = '10' waffle.get_waffle_flag_model().objects.create(name='myflag', percent='50.0') request = get() response = ...
FunctionTests
python
django__django
tests/view_tests/views.py
{ "start": 10210, "end": 10391 }
class ____(ExceptionReporter): custom_traceback_text = "custom traceback text" def get_traceback_html(self): return self.custom_traceback_text
CustomExceptionReporter
python
apache__airflow
airflow-core/tests/unit/api_fastapi/core_api/test_security.py
{ "start": 2096, "end": 19141 }
class ____: @classmethod def setup_class(cls): with conf_vars( { ( "core", "auth_manager", ): "airflow.api_fastapi.auth.managers.simple.simple_auth_manager.SimpleAuthManager", } ): create_...
TestFastApiSecurity
python
PrefectHQ__prefect
src/prefect/exceptions.py
{ "start": 10843, "end": 11002 }
class ____(PrefectException): """ Raised when infrastructure is missing, likely because it has exited or been deleted. """
InfrastructureNotFound
python
great-expectations__great_expectations
great_expectations/data_context/data_context/cloud_data_context.py
{ "start": 2684, "end": 2806 }
class ____(Exception): def __init__(self): super().__init__("No user id in /accounts/me response")
NoUserIdError
python
kubernetes-client__python
kubernetes/client/models/v1_service_status.py
{ "start": 383, "end": 4361 }
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...
V1ServiceStatus
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_pretty.py
{ "start": 13287, "end": 14036 }
class ____: def __init__(self, value): self.value = value def __hash__(self): return 0 def __eq__(self, other): return isinstance(other, HashItAnyway) and self.value == other.value def __ne__(self, other): return not self.__eq__(other) def _repr_pretty_(self, pret...
HashItAnyway
python
ansible__ansible
test/lib/ansible_test/_internal/cgroup.py
{ "start": 351, "end": 527 }
class ____: """Linux filesystem mount type constants.""" TMPFS = 'tmpfs' CGROUP_V1 = 'cgroup' CGROUP_V2 = 'cgroup2' @dataclasses.dataclass(frozen=True)
MountType
python
run-llama__llama_index
llama-index-core/llama_index/core/chat_ui/models/artifact.py
{ "start": 271, "end": 326 }
class ____(BaseModel): id: str
DocumentArtifactSource
python
openai__openai-python
src/openai/types/realtime/response_audio_done_event.py
{ "start": 199, "end": 692 }
class ____(BaseModel): content_index: int """The index of the content part in the item's content array.""" event_id: str """The unique ID of the server event.""" item_id: str """The ID of the item.""" output_index: int """The index of the output item in the response.""" response_...
ResponseAudioDoneEvent
python
matplotlib__matplotlib
lib/matplotlib/backends/backend_pdf.py
{ "start": 14641, "end": 16181 }
class ____(Enum): """PDF operators (not an exhaustive list).""" close_fill_stroke = b'b' fill_stroke = b'B' fill = b'f' closepath = b'h' close_stroke = b's' stroke = b'S' endpath = b'n' begin_text = b'BT' end_text = b'ET' curveto = b'c' rectangle = b're' lineto = b'l...
Op
python
kubernetes-client__python
kubernetes/client/models/v1alpha1_apply_configuration.py
{ "start": 383, "end": 8020 }
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...
V1alpha1ApplyConfiguration
python
python-markdown__markdown
markdown/inlinepatterns.py
{ "start": 20962, "end": 26112 }
class ____(InlineProcessor): """Emphasis processor for handling strong and em matches inside asterisks.""" PATTERNS = [ EmStrongItem(re.compile(EM_STRONG_RE, re.DOTALL | re.UNICODE), 'double', 'strong,em'), EmStrongItem(re.compile(STRONG_EM_RE, re.DOTALL | re.UNICODE), 'double', 'em,strong'), ...
AsteriskProcessor
python
openai__openai-python
src/openai/resources/beta/threads/runs/steps.py
{ "start": 16460, "end": 16981 }
class ____: def __init__(self, steps: AsyncSteps) -> None: self._steps = steps self.retrieve = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( steps.retrieve, # pyright: ignore[reportDeprecated], ) ) self.list = ( ...
AsyncStepsWithStreamingResponse
python
huggingface__transformers
tests/models/falcon/test_modeling_falcon.py
{ "start": 1432, "end": 1993 }
class ____(CausalLMModelTest, unittest.TestCase): model_tester_class = FalconModelTester # TODO (ydshieh): Check this. See https://app.circleci.com/pipelines/github/huggingface/transformers/79245/workflows/9490ef58-79c2-410d-8f51-e3495156cf9c/jobs/1012146 def is_pipeline_test_to_skip( self, ...
FalconModelTest
python
realpython__materials
gemini-cli/todolist/src/todolist/status.py
{ "start": 130, "end": 1114 }
class ____: name: str done: tuple[str, ...] pending: tuple[str, ...] @classmethod def find_all(cls) -> tuple[Self, ...]: return tuple( map(cls.from_model, TaskList.select().order_by(TaskList.name)) ) @classmethod def find_one(cls, list_name: str) -> Self | None:...
TaskListStatus
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/distributions/special_math_test.py
{ "start": 8434, "end": 8844 }
class ____(NdtrTest): _use_log = True _grid32 = GridSpec( min=sm.LOGNDTR_FLOAT32_UPPER, max=12., # Beyond this, log_cdf(x) may be zero. shape=[100]) _grid64 = GridSpec( min=sm.LOGNDTR_FLOAT64_UPPER, max=35., # Beyond this, log_cdf(x) may be zero. shape=[100]) _error32 = Err...
LogNdtrTestUpper
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI036.py
{ "start": 3185, "end": 3419 }
class ____: def __exit__(self, typ, exc, tb, weird_extra_arg) -> None: ... # PYI036: Extra arg must have default async def __aexit__(self, typ, exc, tb, *, weird_extra_arg) -> None: ...# PYI036: Extra arg must have default
BadTwo
python
getsentry__sentry
src/sentry/api/serializers/models/dashboard.py
{ "start": 15072, "end": 15162 }
class ____(TypedDict): displayType: str layout: dict[str, str] | None
_WidgetPreview
python
realpython__materials
python-guitar-synthesizer/source_code_step_6/demo/play_diablo.py
{ "start": 1197, "end": 4157 }
class ____: instant: Time chord: Chord velocity: Velocity def main() -> None: acoustic_guitar = PluckedStringInstrument( tuning=StringTuning.from_notes("E2", "A2", "D3", "G3", "B3", "E4"), vibration=Time(seconds=10), damping=0.498, ) synthesizer = Synthesizer(acoustic_g...
Stroke
python
kamyu104__LeetCode-Solutions
Python/count-number-of-possible-root-nodes.py
{ "start": 67, "end": 1408 }
class ____(object): def rootCount(self, edges, guesses, k): """ :type edges: List[List[int]] :type guesses: List[List[int]] :type k: int :rtype: int """ def iter_dfs(): result = 0 stk = [(0, -1)] while stk: u...
Solution
python
kamyu104__LeetCode-Solutions
Python/count-of-smaller-numbers-after-self.py
{ "start": 33, "end": 1268 }
class ____(object): def countSmaller(self, nums): """ :type nums: List[int] :rtype: List[int] """ def countAndMergeSort(num_idxs, start, end, counts): if end - start <= 0: # The size of range [start, end] less than 2 is always with count 0. return...
Solution
python
oauthlib__oauthlib
oauthlib/oauth1/rfc5849/request_validator.py
{ "start": 200, "end": 30987 }
class ____: """A validator/datastore interaction base class for OAuth 1 providers. OAuth providers should inherit from RequestValidator and implement the methods and properties outlined below. Further details are provided in the documentation for each method and property. Methods used to check th...
RequestValidator
python
PyCQA__pylint
tests/functional/s/super/super_checks.py
{ "start": 1814, "end": 2114 }
class ____(Missing): """Don't emit if we don't know all the bases.""" def __init__(self): super(UnknownBases, self).__init__() super(UnknownBases, self).test() super(Missing, self).test() # [bad-super-call] # Test that we are detecting proper super errors.
UnknownBases
python
numba__numba
numba/core/errors.py
{ "start": 19384, "end": 19472 }
class ____(NumbaError): """ A type inference failure. """ pass
TypingError
python
dagster-io__dagster
python_modules/dagster/dagster/components/lib/shim_components/multi_asset.py
{ "start": 364, "end": 451 }
class ____(BaseModel): asset_key: Optional[list[str]] = None
MultiAssetScaffoldParams
python
pytorch__pytorch
torch/_inductor/ops_handler.py
{ "start": 31389, "end": 31692 }
class ____(WrapperHandler): def _default(self, name: str, args: tuple[Any, ...], kwargs: dict[str, Any]) -> Any: val = getattr(self._inner, name)(*args, **kwargs) if not val or isinstance(val, (sympy.Expr, tuple, list)): return val return f"({val})"
AddParenHandler
python
getsentry__sentry
src/sentry/silo/patches/silo_aware_transaction_patch.py
{ "start": 556, "end": 5137 }
class ____(Exception): pass def _get_db_for_model_if_available(model: type["Model"]) -> str | None: from sentry.db.router import SiloConnectionUnavailableError try: return router.db_for_write(model) except SiloConnectionUnavailableError: return None def siloed_atomic( using: str...
TransactionMissingDBException
python
jazzband__django-simple-history
simple_history/tests/models.py
{ "start": 10821, "end": 11096 }
class ____(models.Model): title = models.CharField(max_length=100) file = models.FileField(upload_to="files") history = HistoricalRecords() # Clear SIMPLE_HISTORY_FILEFIELD_TO_CHARFIELD delattr(settings, "SIMPLE_HISTORY_FILEFIELD_TO_CHARFIELD")
CharFieldFileModel
python
huggingface__transformers
src/transformers/data/processors/glue.py
{ "start": 5999, "end": 7778 }
class ____(DataProcessor): """Processor for the MultiNLI data set (GLUE version).""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn(DEPRECATION_WARNING.format("processor"), FutureWarning) def get_example_from_tensor_dict(self, tensor_dict): """...
MnliProcessor
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/instance.py
{ "start": 1217, "end": 2362 }
class ____(graphene.ObjectType): daemonType = graphene.NonNull(graphene.String) id = graphene.NonNull(graphene.ID) required = graphene.NonNull(graphene.Boolean) healthy = graphene.Boolean() lastHeartbeatTime = graphene.Float() lastHeartbeatErrors = non_null_list(GraphenePythonError) class M...
GrapheneDaemonStatus
python
django__django
tests/model_forms/tests.py
{ "start": 3548, "end": 3657 }
class ____(forms.ModelForm): class Meta: model = Inventory fields = "__all__"
InventoryForm
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/call11.py
{ "start": 649, "end": 1120 }
class ____(Generic[E]): def __init__(self, value: E) -> None: self.value = value def map_left(self, fn: Callable[[Any], Any]) -> Self: return self def map_right(self, fn: Callable[[E], F]) -> Right[F]: return Right(fn(self.value)) def func() -> Either[int, str]: raise NotImpl...
Right
python
facebookresearch__faiss
benchs/bench_hybrid_cpu_gpu.py
{ "start": 4180, "end": 21694 }
class ____: """ Multiple GPU indexes, each on its GPU, with a common coarse quantizer. The Python version of IndexShardsIVF """ def __init__(self, quantizer, index, bs=-1, seq_tiling=False): self.quantizer = quantizer self.cpu_index = index if isinstance(index, faiss.IndexPre...
ShardedGPUIndex
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/messages/beta_deleted_message_batch.py
{ "start": 201, "end": 438 }
class ____(BaseModel): id: str """ID of the Message Batch.""" type: Literal["message_batch_deleted"] """Deleted object type. For Message Batches, this is always `"message_batch_deleted"`. """
BetaDeletedMessageBatch
python
doocs__leetcode
solution/2800-2899/2817.Minimum Absolute Difference Between Elements With Constraint/Solution.py
{ "start": 0, "end": 405 }
class ____: def minAbsoluteDifference(self, nums: List[int], x: int) -> int: sl = SortedList() ans = inf for i in range(x, len(nums)): sl.add(nums[i - x]) j = bisect_left(sl, nums[i]) if j < len(sl): ans = min(ans, sl[j] - nums[i]) ...
Solution
python
huggingface__transformers
tests/models/timm_backbone/test_modeling_timm_backbone.py
{ "start": 1164, "end": 2816 }
class ____: def __init__( self, parent, out_indices=None, out_features=None, stage_names=None, backbone="resnet18", batch_size=3, image_size=32, num_channels=3, is_training=True, use_pretrained_backbone=True, ): self...
TimmBackboneModelTester
python
numba__numba
numba/tests/test_function_type.py
{ "start": 17045, "end": 20392 }
class ____(TestCase): """Test calling external library functions within Numba jit compiled functions. """ def test_wrapper_address_protocol_libm(self): """Call cos and sinf from standard math library. """ import ctypes.util class LibM(types.WrapperAddressProtocol): ...
TestFunctionTypeExtensions
python
scipy__scipy
scipy/interpolate/tests/test_rbfinterp.py
{ "start": 18817, "end": 20046 }
class ____(_TestRBFInterpolator): # RBFInterpolator using 20 nearest neighbors. def build(self, *args, **kwargs): return RBFInterpolator(*args, **kwargs, neighbors=20) def test_equivalent_to_rbf_interpolator(self): seq = Halton(2, scramble=False, seed=np.random.RandomState()) x = s...
TestRBFInterpolatorNeighbors20
python
eth-brownie__brownie
brownie/test/managers/master.py
{ "start": 246, "end": 3243 }
class ____(PytestBrownieBase): """ Brownie plugin xdist master hooks. Hooks in this class are loaded by the master process when using xdist. """ def pytest_configure_node(self, node): """ Configure node information before it gets instantiated. Here we can pass arbitrary in...
PytestBrownieMaster
python
ray-project__ray
rllib/utils/spaces/repeated.py
{ "start": 107, "end": 1110 }
class ____(gym.Space): """Represents a variable-length list of child spaces. Example: self.observation_space = spaces.Repeated(spaces.Box(4,), max_len=10) --> from 0 to 10 boxes of shape (4,) See also: documentation for rllib.models.RepeatedValues, which shows how the lists are...
Repeated
python
dagster-io__dagster
python_modules/libraries/dagster-databricks/dagster_databricks/pipes.py
{ "start": 32588, "end": 35611 }
class ____(PipesBlobStoreMessageReader): """Message reader that reads messages by periodically reading message chunks from an automatically-generated temporary directory in Unity Catalog Volumes. Args: interval (float): interval in seconds between attempts to download a chunk client (Worksp...
PipesUnityCatalogVolumesMessageReader
python
kamyu104__LeetCode-Solutions
Python/fruits-into-baskets-iii.py
{ "start": 63, "end": 1864 }
class ____(object): def numOfUnplacedFruits(self, fruits, baskets): """ :type fruits: List[int] :type baskets: List[int] :rtype: int """ class SegmentTree(object): def __init__(self, N, build_fn=lambda _: 0, ...
Solution
python
kubernetes-client__python
kubernetes/client/models/v1_replica_set_status.py
{ "start": 383, "end": 10908 }
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...
V1ReplicaSetStatus
python
getlogbook__logbook
src/logbook/_fallback.py
{ "start": 1715, "end": 1972 }
class ____: def __init__(self, obj): self.__obj = obj def __enter__(self): self.__obj.push_application() return self.__obj def __exit__(self, exc_type, exc_value, tb): self.__obj.pop_application()
ApplicationBound
python
huggingface__transformers
tests/models/audio_spectrogram_transformer/test_feature_extraction_audio_spectrogram_transformer.py
{ "start": 1470, "end": 3290 }
class ____: def __init__( self, parent, batch_size=7, min_seq_length=400, max_seq_length=2000, feature_size=1, padding_value=0.0, sampling_rate=16000, return_attention_mask=True, do_normalize=True, ): self.parent = parent ...
ASTFeatureExtractionTester
python
tensorflow__tensorflow
tensorflow/dtensor/python/input_util.py
{ "start": 3615, "end": 4060 }
class ____: """Specifies the tf.data service configuration to use. Attributes: dispatcher_address: a string specifying the address of the tf.data service dispatcher server. job_name: a non-empty string identifying the shared job that will be created on tf.data service to process this dataset. ...
TFDataServiceConfig
python
pytorch__pytorch
test/distributed/algorithms/test_join.py
{ "start": 934, "end": 2485 }
class ____(JoinHook): r""" Join hook for :class:`AllReducer`. Arguments: allreducer (AllReducer): the :class:`AllReducer` object using this hook. num_allreduces (int): the number of all-reduces to shadow per iteration. run_post_hook (bool): a flag enabling th...
AllReducerJoinHook
python
openai__openai-python
src/openai/types/responses/response_function_shell_call_output_content_param.py
{ "start": 323, "end": 456 }
class ____(TypedDict, total=False): type: Required[Literal["timeout"]] """The outcome type. Always `timeout`."""
OutcomeTimeout
python
pytorch__pytorch
torch/distributed/elastic/rendezvous/dynamic_rendezvous.py
{ "start": 6779, "end": 7226 }
class ____: """Describe a node in the rendezvous. Attributes: addr: The FQDN of the node or user specified local node address. pid: The id of the process in which the rendezvous handler runs. local_id: A process-wide unique id. """ addr: str ...
_NodeDesc
python
dagster-io__dagster
python_modules/libraries/dagster-sigma/dagster_sigma/translator.py
{ "start": 2069, "end": 2395 }
class ____: """Represents a Sigma dataset, a centralized data definition which can contain aggregations or other manipulations. https://help.sigmacomputing.com/docs/datasets """ properties: dict[str, Any] columns: AbstractSet[str] inputs: AbstractSet[str] @whitelist_for_serdes @record
SigmaDataset
python
astropy__astropy
astropy/io/votable/exceptions.py
{ "start": 17794, "end": 18756 }
class ____(VOTableSpecWarning): """Invalid VOTable datatype. Some VOTable files in the wild use non-standard datatype names. These are mapped to standard ones using the following mapping:: string -> char unicodeString -> unicodeChar int16 -> short int32 ...
W13
python
huggingface__transformers
src/transformers/models/video_llama_3/modular_video_llama_3.py
{ "start": 66306, "end": 66426 }
class ____(Qwen2VLVideoProcessorInitKwargs): use_token_compression: Optional[bool]
VideoLlama3VideoProcessorInitKwargs
python
plotly__plotly.py
plotly/graph_objs/scatterpolar/marker/_colorbar.py
{ "start": 233, "end": 61749 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scatterpolar.marker" _path_str = "scatterpolar.marker.colorbar" _valid_props = { "bgcolor", "bordercolor", "borderwidth", "dtick", "exponentformat", "labelalias", "len", "lenmode", ...
ColorBar
python
dask__dask
dask/array/core.py
{ "start": 198746, "end": 202332 }
class ____: """An array-like interface to the blocks of an array. ``BlockView`` provides an array-like interface to the blocks of a dask array. Numpy-style indexing of a ``BlockView`` returns a selection of blocks as a new dask array. You can index ``BlockView`` like a numpy array of shape e...
BlockView
python
agronholm__apscheduler
tests/test_marshalling.py
{ "start": 270, "end": 569 }
class ____: def meth(self): pass @staticmethod def staticmeth(): pass @classmethod def classmeth(cls): pass def __call__(self): pass class InnerDummyClass: @classmethod def innerclassmeth(cls): pass
DummyClass
python
doocs__leetcode
solution/0300-0399/0337.House Robber III/Solution.py
{ "start": 192, "end": 543 }
class ____: def rob(self, root: Optional[TreeNode]) -> int: def dfs(root: Optional[TreeNode]) -> (int, int): if root is None: return 0, 0 la, lb = dfs(root.left) ra, rb = dfs(root.right) return root.val + lb + rb, max(la, lb) + max(ra, rb) ...
Solution
python
ray-project__ray
python/ray/dashboard/modules/job/common.py
{ "start": 22378, "end": 22481 }
class ____: deleted: bool # TODO(jiaodong): Support log streaming #19415 @dataclass
JobDeleteResponse
python
numpy__numpy
numpy/_core/tests/test_numeric.py
{ "start": 79166, "end": 83869 }
class ____: def test_base3(self): assert_equal(np.base_repr(3**5, 3), '100000') def test_positive(self): assert_equal(np.base_repr(12, 10), '12') assert_equal(np.base_repr(12, 10, 4), '000012') assert_equal(np.base_repr(12, 4), '30') assert_equal(np.base_repr(37316248037...
TestBaseRepr
python
kamyu104__LeetCode-Solutions
Python/meeting-rooms-iii.py
{ "start": 791, "end": 1504 }
class ____(object): def mostBooked(self, n, meetings): """ :type n: int :type meetings: List[List[int]] :rtype: """ meetings.sort() unused, used = range(n), [] result = [0]*n for s, e in meetings: while used and used[0][0] <= s: ...
Solution2
python
wandb__wandb
wandb/automations/actions.py
{ "start": 3330, "end": 4276 }
class ____(NoOpActionFields, frozen=False): action_type: Literal[ActionType.NO_OP] = ActionType.NO_OP no_op: Annotated[ bool, BeforeValidator(default_if_none), Field(repr=False, frozen=True), ] = True """Placeholder field, only needed to conform to schema requirements. Ther...
SavedNoOpAction
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDictReadOnly1.py
{ "start": 302, "end": 637 }
class ____(TypedDict): a: ReadOnly[int] b: Required[ReadOnly[str]] c: ReadOnly[NotRequired[str]] # This should generate an error because nested ReadOnly are not allowed. d: ReadOnly[ReadOnly[str]] TD2 = TypedDict("TD2", {"a": ReadOnly[str]}, total=True) TD3 = TypedDict("TD3", {"a": ReadOnly[str]}...
TD1
python
ray-project__ray
python/ray/dag/class_node.py
{ "start": 4340, "end": 4961 }
class ____: """Represents a class method output in a Ray function DAG.""" def __init__(self, class_method_call: "ClassMethodNode", output_idx: int): # The upstream class method call that returns multiple values. self._class_method_call = class_method_call # The output index of the retur...
_ClassMethodOutput
python
PrefectHQ__prefect
src/integrations/prefect-dbt/tests/cloud/test_jobs.py
{ "start": 1168, "end": 6917 }
class ____: async def test_get_dbt_cloud_job_info(self, dbt_cloud_credentials): with respx.mock(using="httpx", assert_all_called=False) as respx_mock: respx_mock.route(host="127.0.0.1").pass_through() respx_mock.get( "https://cloud.getdbt.com/api/v2/accounts/123456789...
TestTriggerDbtCloudJobRun
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 651540, "end": 652186 }
class ____(sgqlc.types.Type): """An Enterprise Server installation that a user is a member of.""" __schema__ = github_schema __field_names__ = ("cursor", "node", "role") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") """A cursor for use in pagination.""" node =...
EnterpriseServerInstallationMembershipEdge
python
great-expectations__great_expectations
great_expectations/datasource/fluent/data_asset/path/spark/parquet_asset.py
{ "start": 1800, "end": 1896 }
class ____(FileDataAsset, ParquetAssetBase): type: Literal["parquet"] = "parquet"
ParquetAsset
python
pytorch__pytorch
test/torch_np/numpy_tests/core/test_scalar_ctors.py
{ "start": 1706, "end": 2333 }
class ____(TestCase): def test_intp(self): # Ticket #99 assert_equal(1024, np.intp(1024)) def test_uint64_from_negative(self): # NumPy test was asserting a DeprecationWarning assert_equal(np.uint8(-2), np.uint8(254)) int_types = [ subtest(np.byte, name="np_byte"), subt...
TestFromInt
python
keras-team__keras
keras/src/tree/tree_test.py
{ "start": 1382, "end": 1727 }
class ____: def __init__(self, func): self.func = func self.visited_list = [] def __call__(self, x): self.visited_list.append(x) return self.func(x) def visited(self): ret = self.visited_list self.visited_list = [] return ret @parameterized.named_p...
Visitor
python
ApeWorX__ape
src/ape/api/query.py
{ "start": 7879, "end": 9157 }
class ____(BaseInterface): @abstractmethod def estimate_query(self, query: QueryType) -> Optional[int]: """ Estimation of time needed to complete the query. The estimation is returned as an int representing milliseconds. A value of None indicates that the query engine is not avai...
QueryAPI
python
ray-project__ray
python/ray/_common/test_utils.py
{ "start": 1429, "end": 5541 }
class ____: """A Ray actor implementing a semaphore for test coordination. Useful for testing resource limiting, concurrency control, and coordination between multiple actors or tasks. """ def __init__(self, value: int = 1): self._sema = asyncio.Semaphore(value=value) async def acquir...
Semaphore