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
wandb__wandb
wandb/sdk/artifacts/storage_policies/_multipart.py
{ "start": 1424, "end": 2211 }
class ____: """Signal the end of the multipart chunk queue. Queue consumers terminate when they receive this item from the queue. Do not instantiate this class directly; use the `END_CHUNK` constant as a pseudo-singleton instead. NOTE: Use this only in multi-threaded (not multi-process) contexts b...
_ChunkSentinel
python
huggingface__transformers
tests/models/sam/test_modeling_sam.py
{ "start": 12308, "end": 18254 }
class ____: def __init__( self, parent, hidden_size=36, intermediate_size=72, projection_dim=62, output_channels=32, num_hidden_layers=2, num_attention_heads=4, num_channels=3, image_size=24, patch_size=2, hidden_act="ge...
SamModelTester
python
tornadoweb__tornado
tornado/test/web_test.py
{ "start": 72977, "end": 73528 }
class ____(SimpleHandlerTestCase): class Handler(RequestHandler): def get(self): self.clear_all_cookies() self.write("ok") def test_clear_all_cookies(self): response = self.fetch("/", headers={"Cookie": "foo=bar; baz=xyzzy"}) set_cookies = sorted(response.headers...
ClearAllCookiesTest
python
huggingface__transformers
tests/models/hunyuan_v1_dense/test_modeling_hunyuan_v1_dense.py
{ "start": 1190, "end": 1596 }
class ____(CausalLMModelTest, unittest.TestCase): model_tester_class = HunYuanDenseV1ModelTester def is_pipeline_test_to_skip( self, pipeline_test_case_name, config_class, model_architecture, tokenizer_name, image_processor_name, feature_extractor_name, ...
HunYuanDenseV1ModelTest
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/super6.py
{ "start": 637, "end": 876 }
class ____(FirstLevelMeta): def __new__(cls, name: str, bases, dct): new_class = super().__new__(cls, name, bases, dct) reveal_type(new_class, expected_text="Self@SecondLevelMeta") return new_class
SecondLevelMeta
python
huggingface__transformers
src/transformers/models/glm/modeling_glm.py
{ "start": 12932, "end": 13651 }
class ____(nn.Module): def __init__(self, hidden_size, eps=1e-6): """ GlmRMSNorm is equivalent to T5LayerNorm """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.variance_epsilon = eps def forward(self, hidden_states): input_dt...
GlmRMSNorm
python
django__django
tests/model_package/tests.py
{ "start": 214, "end": 382 }
class ____(models.Model): customer = models.CharField(max_length=100) publications = models.ManyToManyField("model_package.Publication", blank=True)
Advertisement
python
milvus-io__pymilvus
pymilvus/bulk_writer/constants.py
{ "start": 3569, "end": 3711 }
class ____(IntEnum): NUMPY = 1 NPY = 1 # deprecated JSON = 2 JSON_RB = 2 # deprecated PARQUET = 3 CSV = 4
BulkFileType
python
getsentry__sentry
src/sentry/models/groupowner.py
{ "start": 1185, "end": 1280 }
class ____(Enum): SUSPECT_COMMIT = 0 OWNERSHIP_RULE = 1 CODEOWNERS = 2
GroupOwnerType
python
bokeh__bokeh
src/bokeh/events.py
{ "start": 7587, "end": 8097 }
class ____(Event): ''' Base class for all Bokeh Model events. This base class is not typically useful to instantiate on its own. ''' model: Model | None def __init__(self, model: Model | None) -> None: ''' Create a new base event. Args: model (Model) : a Bokeh model...
ModelEvent
python
falconry__falcon
falcon/testing/resource.py
{ "start": 4349, "end": 7852 }
class ____: """Mock resource for functional testing of framework components. This class implements a simple test resource that can be extended as needed to test middleware, hooks, and the Falcon framework itself. Only noop ``on_get()`` and ``on_post()`` responders are implemented; when overrid...
SimpleTestResource
python
eventlet__eventlet
eventlet/green/http/cookies.py
{ "start": 18623, "end": 23727 }
class ____(dict): """A container class for a set of Morsels.""" def value_decode(self, val): """real_value, coded_value = value_decode(STRING) Called prior to setting a cookie's value from the network representation. The VALUE is the value read from HTTP header. Overrid...
BaseCookie
python
encode__django-rest-framework
tests/test_versioning.py
{ "start": 650, "end": 795 }
class ____(APIView): def get(self, request, *args, **kwargs): return Response({'url': reverse('another', request=request)})
ReverseView
python
pyca__cryptography
src/cryptography/hazmat/decrepit/ciphers/modes.py
{ "start": 368, "end": 795 }
class ____(ModeWithInitializationVector): name = "OFB" def __init__(self, initialization_vector: utils.Buffer): utils._check_byteslike("initialization_vector", initialization_vector) self._initialization_vector = initialization_vector @property def initialization_vector(self) -> utils....
OFB
python
ray-project__ray
python/ray/tests/autoscaler/util.py
{ "start": 122, "end": 2422 }
class ____(unittest.TestCase): def setUp(self): # Create a mock LoadMetricsSummary object with the required attributes lm_summary_mock_data = { "e9919752e5e8d757765d97d8bec910a2e78e8826f20bce46fd58f92e": { "node:172.31.6.57": [0.0, 1.0], "object_store_memo...
TestGetPerNodeBreakdown
python
doocs__leetcode
solution/1800-1899/1815.Maximum Number of Groups Getting Fresh Donuts/Solution.py
{ "start": 0, "end": 616 }
class ____: def maxHappyGroups(self, batchSize: int, groups: List[int]) -> int: @cache def dfs(state, mod): res = 0 x = int(mod == 0) for i in range(1, batchSize): if state >> (i * 5) & 31: t = dfs(state - (1 << (i * 5)), (mod +...
Solution
python
pandas-dev__pandas
pandas/core/arrays/floating.py
{ "start": 1721, "end": 4275 }
class ____(NumericArray): """ Array of floating (optional missing) values. .. warning:: FloatingArray is currently experimental, and its API or internal implementation may change without warning. Especially the behaviour regarding NaN (distinct from NA missing values) is subject to ch...
FloatingArray
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_generators.py
{ "start": 2055, "end": 2654 }
class ____(__TestCase): def generator1(self): return (yield from self.generator2()) def generator2(self): try: yield except KeyboardInterrupt: return "PASSED" else: return "FAILED" def test_raise_and_yield_from(self): gen = self....
SignalAndYieldFromTest
python
PyCQA__pylint
doc/data/messages/i/invalid-metaclass/good.py
{ "start": 24, "end": 53 }
class ____(Plant): pass
Apple
python
spack__spack
lib/spack/spack/modules/lmod.py
{ "start": 15823, "end": 18539 }
class ____(BaseContext): """Context class for lmod module files.""" @tengine.context_property def has_modulepath_modifications(self): """True if this module modifies MODULEPATH, False otherwise.""" return bool(self.conf.provides) @tengine.context_property def has_conditional_modifi...
LmodContext
python
nedbat__coveragepy
tests/modules/plugins/a_plugin.py
{ "start": 182, "end": 358 }
class ____(CoveragePlugin): pass def coverage_init( reg: Plugins, options: Any, # pylint: disable=unused-argument ) -> None: reg.add_file_tracer(Plugin())
Plugin
python
PrefectHQ__prefect
tests/test_tasks.py
{ "start": 19055, "end": 25679 }
class ____: def test_raises_outside_of_flow(self): @task def foo(x): return x with pytest.raises(RuntimeError): foo.submit(1) async def test_sync_task_submitted_inside_sync_flow(self): @task def foo(x): return x @flow ...
TestTaskSubmit
python
h5py__h5py
h5py/tests/test_h5d_direct_chunk.py
{ "start": 1161, "end": 5165 }
class ____(TestCase): def test_read_compressed_offsets(self): filename = self.mktemp().encode() with h5py.File(filename, "w") as filehandle: frame = numpy.arange(16).reshape(4, 4) frame_dataset = filehandle.create_dataset("frame", ...
TestReadDirectChunk
python
huggingface__transformers
src/transformers/models/granitemoehybrid/modeling_granitemoehybrid.py
{ "start": 55965, "end": 57236 }
class ____(PreTrainedModel): config: GraniteMoeHybridConfig base_model_prefix = "model" supports_gradient_checkpointing = True _no_split_modules = ["GraniteMoeHybridDecoderLayer"] _skip_keys_device_placement = ["past_key_values"] _supports_flash_attn = True _supports_sdpa = True _support...
GraniteMoeHybridPreTrainedModel
python
huggingface__transformers
src/transformers/models/edgetam_video/modeling_edgetam_video.py
{ "start": 75431, "end": 85944 }
class ____(nn.Module): def __init__(self, config: EdgeTamVideoMaskDecoderConfig): super().__init__() self.config = config self.hidden_size = config.hidden_size self.num_multimask_outputs = config.num_multimask_outputs self.num_mask_tokens = config.num_multimask_outputs + 1 ...
EdgeTamVideoMaskDecoder
python
getsentry__sentry
tests/sentry/rules/history/endpoints/test_project_rule_stats.py
{ "start": 639, "end": 1048 }
class ____(TestCase): def test(self) -> None: time_series_value = TimeSeriesValue(datetime.now(), 30) result = serialize([time_series_value], self.user, TimeSeriesValueSerializer()) assert result == [ { "date": time_series_value.bucket, "count": ti...
TimeSeriesValueSerializerTest
python
neetcode-gh__leetcode
python/0994-rotting-oranges.py
{ "start": 0, "end": 1120 }
class ____: def orangesRotting(self, grid: List[List[int]]) -> int: q = collections.deque() fresh = 0 time = 0 for r in range(len(grid)): for c in range(len(grid[0])): if grid[r][c] == 1: fresh += 1 if grid[r][c] == 2: ...
Solution
python
scipy__scipy
scipy/sparse/linalg/_special_sparse_arrays.py
{ "start": 25405, "end": 27558 }
class ____(LinearOperator): """ Construct a mass matrix in various formats of Mikota pair. The mass matrix `M` is square real diagonal positive definite with entries that are reciprocal to integers. Parameters ---------- shape : tuple of int The shape of the matrix. dtype : dty...
MikotaM
python
openai__openai-python
src/openai/types/beta/realtime/input_audio_buffer_commit_event_param.py
{ "start": 232, "end": 503 }
class ____(TypedDict, total=False): type: Required[Literal["input_audio_buffer.commit"]] """The event type, must be `input_audio_buffer.commit`.""" event_id: str """Optional client-generated ID used to identify this event."""
InputAudioBufferCommitEventParam
python
pytorch__pytorch
torch/ao/quantization/fx/quantize_handler.py
{ "start": 6956, "end": 7112 }
class ____(QuantizeHandler): pass # TODO: not used, can be removed after torch.ao.quantization namespace is deprecated
GeneralTensorShapeOpQuantizeHandler
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_textbox29.py
{ "start": 315, "end": 848 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("textbox29.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with textbox(s).""" workbook = Workb...
TestCompareXLSXFiles
python
redis__redis-py
tests/test_multidb/test_config.py
{ "start": 5198, "end": 6051 }
class ____: def test_default_config(self): config = DatabaseConfig( client_kwargs={"host": "host1", "port": "port1"}, weight=1.0 ) assert config.client_kwargs == {"host": "host1", "port": "port1"} assert config.weight == 1.0 assert isinstance(config.default_circu...
TestDatabaseConfig
python
joke2k__faker
faker/providers/job/ro_RO/__init__.py
{ "start": 42, "end": 170683 }
class ____(BaseProvider): jobs = [ "Adjunct Al Procurorului General", "Ambasador", "Chestor Parlament", "Comandant Unic Aviatie", "Comisar General", "Comisar General Adjunct", "Senator", "Guvernator", "Presedinte Academie", "Presedinte ...
Provider
python
PrefectHQ__prefect
src/prefect/locking/filesystem.py
{ "start": 394, "end": 716 }
class ____(TypedDict): """ A dictionary containing information about a lock. Attributes: holder: The holder of the lock. expiration: Datetime when the lock expires. path: Path to the lock file. """ holder: str expiration: Optional[datetime.datetime] path: Path
_LockInfo
python
tornadoweb__tornado
tornado/locks.py
{ "start": 1628, "end": 4905 }
class ____(_TimeoutGarbageCollector): """A condition allows one or more coroutines to wait until notified. Like a standard `threading.Condition`, but does not need an underlying lock that is acquired and released. With a `Condition`, coroutines can wait to be notified by other coroutines: .. test...
Condition
python
davidhalter__parso
parso/python/tree.py
{ "start": 3889, "end": 4892 }
class ____(PythonMixin, Leaf): __slots__ = () def _split_prefix(self): return split_prefix(self, self.get_start_pos_of_prefix()) def get_start_pos_of_prefix(self): """ Basically calls :py:meth:`parso.tree.NodeOrLeaf.get_start_pos_of_prefix`. """ # TODO it is really ...
PythonLeaf
python
django__django
tests/model_formsets/models.py
{ "start": 3496, "end": 3837 }
class ____(MexicanRestaurant): the_restaurant = models.OneToOneField( MexicanRestaurant, models.CASCADE, parent_link=True, primary_key=True ) tacos_are_yummy = models.BooleanField(default=False) # models for testing unique_together validation when a fk is involved and # using inlineformset_factory...
ClassyMexicanRestaurant
python
pytorch__pytorch
torch/_export/error.py
{ "start": 1064, "end": 1349 }
class ____(Exception): """ Raised when an internal invariance is violated in EXIR stack. Should hint users to report a bug to dev and expose the original error message. """ def __init__(self, message: str) -> None: super().__init__(message)
InternalError
python
weaviate__weaviate-python-client
weaviate/collections/classes/config_vector_index.py
{ "start": 3167, "end": 3693 }
class ____(_VectorIndexConfigCreate): cleanupIntervalSeconds: Optional[int] dynamicEfMin: Optional[int] dynamicEfMax: Optional[int] dynamicEfFactor: Optional[int] efConstruction: Optional[int] ef: Optional[int] filterStrategy: Optional[VectorFilterStrategy] flatSearchCutoff: Optional[int...
_VectorIndexConfigHNSWCreate
python
pytorch__pytorch
test/dynamo/test_modules.py
{ "start": 19398, "end": 19609 }
class ____(ParametersModule1): def forward(self, x): ones = torch.ones(10, dtype=next(self.parameters(recurse=False)).dtype) return F.relu(self.linear1(x)) * self.scale + ones
ParametersModule4
python
scipy__scipy
scipy/integrate/_quad_vec.py
{ "start": 203, "end": 662 }
class ____(collections.OrderedDict): def __init__(self, max_size): self.__max_size = max_size def __setitem__(self, key, value): existing_key = (key in self) super().__setitem__(key, value) if existing_key: self.move_to_end(key) elif len(self) > self.__max_si...
LRUDict
python
PrefectHQ__prefect
src/prefect/logging/filters.py
{ "start": 690, "end": 1136 }
class ____(logging.Filter): """ A logging filter that obfuscates any string that matches the obfuscate_string function. """ def filter(self, record: logging.LogRecord) -> bool: # Need to import here to avoid circular imports from prefect.settings import PREFECT_API_KEY if PREFE...
ObfuscateApiKeyFilter
python
ray-project__ray
python/ray/util/collective/tests/util.py
{ "start": 4251, "end": 12263 }
class ____: def __init__(self): self.buffer0 = None self.buffer1 = None self.list_buffer0 = None self.list_buffer1 = None def __del__(self): self.buffer0 = None self.buffer1 = None self.list_buffer0 = None self.list_buffer1 = None def init_te...
MultiGPUWorker
python
arrow-py__arrow
tests/test_arrow.py
{ "start": 11745, "end": 13091 }
class ____: def test_add_timedelta(self): result = self.arrow.__add__(timedelta(days=1)) assert result._datetime == datetime(2013, 1, 2, tzinfo=tz.tzutc()) def test_add_other(self): with pytest.raises(TypeError): self.arrow + 1 def test_radd(self): result = sel...
TestArrowMath
python
walkccc__LeetCode
solutions/1644. Lowest Common Ancestor of a Binary Tree II/1644.py
{ "start": 0, "end": 753 }
class ____: def lowestCommonAncestor( self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode', ) -> 'TreeNode': seenP = False seenQ = False def getLCA(root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': nonlocal seenP nonlocal seenQ if not root: ...
Solution
python
google__jax
tests/unary_ops_accuracy_test.py
{ "start": 5019, "end": 12083 }
class ____(jtu.JaxTestCase): def setUp(self): if not jtu.stablehlo_version_at_least("1.10.0"): self.skipTest("Test requires StableHLO v1.10.0 or higher.") if not jtu.is_device_tpu(): self.skipTest("Skipping test on non TPU devices.") # TODO(b/412112097): Enable this test on TPU version 7 and ...
UnaryOpsAccuracyTest
python
doocs__leetcode
lcci/10.10.Rank from Stream/Solution.py
{ "start": 0, "end": 404 }
class ____: __slots__ = "n", "c" def __init__(self, n: int): self.n = n self.c = [0] * (n + 1) def update(self, x: int, delta: int) -> None: while x <= self.n: self.c[x] += delta x += x & -x def query(self, x: int) -> int: s = 0 while x:...
BinaryIndexedTree
python
kubernetes-client__python
kubernetes/client/models/v1_resource_claim_template_list.py
{ "start": 383, "end": 7180 }
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...
V1ResourceClaimTemplateList
python
bokeh__bokeh
src/bokeh/events.py
{ "start": 16211, "end": 16774 }
class ____(PointEvent): ''' Announce a mouse enter event onto a Bokeh plot. Attributes: sx (float) : x-coordinate of the event in *screen* space sy (float) : y-coordinate of the event in *screen* space x (float) : x-coordinate of the event in *data* space y (float) : y-coordinat...
MouseEnter
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/styles/style_transformation.py
{ "start": 2947, "end": 3201 }
class ____(StyleTransformation): """ Swap the 'reverse' attribute. (This is still experimental.) """ def transform_attrs(self, attrs: Attrs) -> Attrs: return attrs._replace(reverse=not attrs.reverse)
ReverseStyleTransformation
python
Textualize__textual
src/textual/widgets/_placeholder.py
{ "start": 1720, "end": 6435 }
class ____(Widget): """A simple placeholder widget to use before you build your custom widgets. This placeholder has a couple of variants that show different data. Clicking the placeholder cycles through the available variants, but a placeholder can also be initialised in a specific variant. The v...
Placeholder
python
django__django
tests/defer_regress/models.py
{ "start": 1950, "end": 2435 }
class ____(models.Model): profile = models.ForeignKey(Profile, models.SET_NULL, null=True, blank=True) location = models.ForeignKey(Location, models.CASCADE) items = models.ManyToManyField(Item) request1 = models.CharField(default="request1", max_length=255) request2 = models.CharField(default="req...
Request
python
huggingface__transformers
src/transformers/models/unispeech/configuration_unispeech.py
{ "start": 844, "end": 17510 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`UniSpeechModel`]. It is used to instantiate an UniSpeech model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar ...
UniSpeechConfig
python
dask__dask
dask/dataframe/dask_expr/_cumulative.py
{ "start": 3628, "end": 3788 }
class ____(CumulativeAggregations): chunk_operation = M.cumsum aggregate_operation = staticmethod(methods.cumsum_aggregate) neutral_element = 0
CumSum
python
allegroai__clearml
clearml/backend_interface/model.py
{ "start": 1470, "end": 22651 }
class ____(IdObjectBase, AsyncManagerMixin, _StorageUriMixin): """Manager for backend model objects""" _EMPTY_MODEL_ID = "empty" _local_model_to_id_uri = {} @property def model_id(self) -> str: return self.id def __init__( self, upload_storage_uri: str, cache_...
Model
python
sympy__sympy
sympy/matrices/expressions/blockmatrix.py
{ "start": 1113, "end": 18864 }
class ____(MatrixExpr): """A BlockMatrix is a Matrix comprised of other matrices. The submatrices are stored in a SymPy Matrix object but accessed as part of a Matrix Expression >>> from sympy import (MatrixSymbol, BlockMatrix, symbols, ... Identity, ZeroMatrix, block_collapse) >>> n,m,l =...
BlockMatrix
python
pandas-dev__pandas
asv_bench/benchmarks/rolling.py
{ "start": 4299, "end": 5215 }
class ____: params = ( ["DataFrame", "Series"], [ ({"halflife": 10}, "mean"), ({"halflife": 10}, "std"), ({"halflife": 1000}, "mean"), ({"halflife": 1000}, "std"), ( { "halflife": "1 Day", ...
EWMMethods
python
getsentry__sentry
src/sentry/integrations/source_code_management/commit_context.py
{ "start": 14903, "end": 19220 }
class ____(ABC): def __init__(self, integration: CommitContextIntegration): self.integration = integration @property @abstractmethod def organization_option_key(self) -> str: raise NotImplementedError @property @abstractmethod def referrer(self) -> Referrer: raise N...
PRCommentWorkflow
python
apache__airflow
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
{ "start": 26317, "end": 29725 }
class ____(TestBackfillEndpoint): def test_cancel_backfill(self, session, test_client): (dag,) = self._create_dag_models() from_date = timezone.utcnow() to_date = timezone.utcnow() backfill = Backfill(dag_id=dag.dag_id, from_date=from_date, to_date=to_date) session.add(backfi...
TestCancelBackfill
python
PrefectHQ__prefect
tests/blocks/test_core.py
{ "start": 1104, "end": 42312 }
class ____: class MyBlock(Block): x: str y: int = 1 @register_type class MyRegisteredBlock(Block): x: str y: int = 1 @register_type class MyOtherRegisteredBlock(Block): x: str y: int = 1 z: int = 2 def test_registration(self): as...
TestAPICompatibility
python
pandas-dev__pandas
pandas/tests/indexes/timedeltas/methods/test_factorize.py
{ "start": 130, "end": 1292 }
class ____: def test_factorize(self): idx1 = TimedeltaIndex(["1 day", "1 day", "2 day", "2 day", "3 day", "3 day"]) exp_arr = np.array([0, 0, 1, 1, 2, 2], dtype=np.intp) exp_idx = TimedeltaIndex(["1 day", "2 day", "3 day"]) arr, idx = idx1.factorize() tm.assert_numpy_array_...
TestTimedeltaIndexFactorize
python
tensorflow__tensorflow
tensorflow/tools/compatibility/ast_edits.py
{ "start": 7054, "end": 28047 }
class ____(ast.NodeVisitor): """AST Visitor that processes function calls. Updates function calls from old API version to new API version using a given change spec. """ def __init__(self, api_change_spec): self._api_change_spec = api_change_spec self._log = [] # Holds 4-tuples: severity, line, col...
_PastaEditVisitor
python
py-pdf__pypdf
pypdf/constants.py
{ "start": 434, "end": 571 }
class ____: SIZE = "/Size" PREV = "/Prev" ROOT = "/Root" ENCRYPT = "/Encrypt" INFO = "/Info" ID = "/ID"
TrailerKeys
python
anthropics__anthropic-sdk-python
src/anthropic/lib/bedrock/_client.py
{ "start": 10172, "end": 15915 }
class ____(BaseBedrockClient[httpx.AsyncClient, AsyncStream[Any]], AsyncAPIClient): messages: AsyncMessages completions: AsyncCompletions beta: AsyncBeta def __init__( self, aws_secret_key: str | None = None, aws_access_key: str | None = None, aws_region: str | None = No...
AsyncAnthropicBedrock
python
mlflow__mlflow
mlflow/genai/judges/tools/list_spans.py
{ "start": 666, "end": 1552 }
class ____: """Result from listing spans with optional pagination.""" spans: list[SpanInfo] next_page_token: str | None = None def _create_span_info(span) -> SpanInfo: """Create SpanInfo from a span object.""" start_time_ms = span.start_time_ns / 1_000_000 end_time_ms = span.end_time_ns / 1_0...
ListSpansResult
python
facebookresearch__faiss
contrib/big_batch_search.py
{ "start": 452, "end": 5556 }
class ____: """ Object that manages all the data related to the computation except the actual within-bucket matching and the organization of the computation (parallel or not) """ def __init__( self, index, xq, k, verbose=0, use_float16=False): ...
BigBatchSearcher
python
openai__openai-python
src/openai/types/evals/create_eval_completions_run_data_source_param.py
{ "start": 5475, "end": 7587 }
class ____(TypedDict, total=False): max_completion_tokens: int """The maximum number of tokens in the generated output.""" reasoning_effort: Optional[ReasoningEffort] """ Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supp...
SamplingParams
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDictClosed4.py
{ "start": 854, "end": 1043 }
class ____(TypedDict, extra_items=int): name: str year: NotRequired[int] details3: MovieDetails3 = {"name": "Kill Bill Vol. 2", "year": 2004} movie3: Movie3 = details3
MovieDetails3
python
fsspec__filesystem_spec
fsspec/implementations/git.py
{ "start": 103, "end": 3731 }
class ____(AbstractFileSystem): """Browse the files of a local git repo at any hash/tag/branch (experimental backend) """ root_marker = "" cachable = True def __init__(self, path=None, fo=None, ref=None, **kwargs): """ Parameters ---------- path: str (optional...
GitFileSystem
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/invalid_return_type_bytes.py
{ "start": 786, "end": 831 }
class ____: def __bytes__(self): ...
Bytes3
python
bokeh__bokeh
tests/unit/bokeh/plotting/test_figure.py
{ "start": 12726, "end": 13527 }
class ____: def test_returns_renderers(self) -> None: fruits = ['Apples', 'Pears', 'Nectarines', 'Plums', 'Grapes', 'Strawberries'] years = ["2015", "2016", "2017"] colors = ["#c9d9d3", "#718dbf", "#e84d60"] data = {'fruits' : fruits, '2015' : [2, 1, 4, 3, 2, 4], ...
Test_hbar_stack
python
pydantic__pydantic
tests/mypy/outputs/mypy-plugin_ini/root_models.py
{ "start": 468, "end": 645 }
class ____(RootModel[list[str]]): pets: list[str] # MYPY: error: Only `root` is allowed as a field of a `RootModel` [pydantic-field] T = TypeVar('T') V = TypeVar('V')
Pets4
python
django-guardian__django-guardian
example_project/articles/views.py
{ "start": 416, "end": 543 }
class ____(PermissionRequiredMixin, DetailView): model = Article permission_required = ["view_article"]
ArticleDetailView
python
redis__redis-py
redis/commands/search/field.py
{ "start": 3214, "end": 3593 }
class ____(Field): """ GeoShapeField is used to enable within/contain indexing/searching """ SPHERICAL = "SPHERICAL" FLAT = "FLAT" def __init__(self, name: str, coord_system=None, **kwargs): args = [Field.GEOSHAPE] if coord_system: args.append(coord_system) ...
GeoShapeField
python
getsentry__sentry
src/sentry/hybridcloud/services/organization_mapping/model.py
{ "start": 883, "end": 1623 }
class ____(RpcModel): name: str = "" status: int = 0 slug: str = "" region_name: str = "" # When not set, no change to customer id performed, # when set with a CustomerId, the customer_id set to either None or string customer_id: CustomerId | None = None requires_2fa: bool = False ea...
RpcOrganizationMappingUpdate
python
getsentry__sentry
src/sentry_plugins/pushover/plugin.py
{ "start": 572, "end": 5174 }
class ____(CorePluginMixin, NotificationPlugin): description = DESCRIPTION slug = "pushover" title = "Pushover" conf_title = "Pushover" conf_key = "pushover" required_field = "apikey" feature_descriptions = [ FeatureDescription( """ Have Pushover notifications...
PushoverPlugin
python
Lightning-AI__lightning
src/lightning/pytorch/loggers/logger.py
{ "start": 1786, "end": 5120 }
class ____(Logger): """Dummy logger for internal use. It is useful if we want to disable user's logger for a feature, but still ensure that user code can run """ def __init__(self) -> None: super().__init__() self._experiment = DummyExperiment() @property def experiment(self)...
DummyLogger
python
keras-team__keras
keras/src/ops/numpy_test.py
{ "start": 216484, "end": 334232 }
class ____(testing.TestCase): """Test the dtype to verify that the behavior matches JAX.""" ALL_DTYPES = [ x for x in dtypes.ALLOWED_DTYPES if x not in ( "string", "complex64", "complex128", # Remove 64-bit dtypes. "flo...
NumpyDtypeTest
python
imageio__imageio
imageio/plugins/_swf.py
{ "start": 11283, "end": 12990 }
class ____(DefinitionTag): def __init__(self, im): DefinitionTag.__init__(self) self.tagtype = 36 # DefineBitsLossless2 # convert image (note that format is ARGB) # even a grayscale image is stored in ARGB, nevertheless, # the fabilous deflate compression will make it that ...
BitmapTag
python
dagster-io__dagster
python_modules/dagster/dagster/_core/execution/plan/step.py
{ "start": 1130, "end": 1690 }
class ____(Enum): COMPUTE = "COMPUTE" UNRESOLVED_MAPPED = "UNRESOLVED_MAPPED" UNRESOLVED_COLLECT = "UNRESOLVED_COLLECT" def is_executable_step( step: Union["ExecutionStep", "UnresolvedMappedExecutionStep"], ) -> TypeGuard["ExecutionStep"]: # This function is set up defensively to ensure new step t...
StepKind
python
kamyu104__LeetCode-Solutions
Python/domino-and-tromino-tiling.py
{ "start": 51, "end": 1034 }
class ____(object): def numTilings(self, N): """ :type N: int :rtype: int """ M = int(1e9+7) def matrix_expo(A, K): result = [[int(i==j) for j in xrange(len(A))] \ for i in xrange(len(A))] while K: if K % ...
Solution
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_types.py
{ "start": 224692, "end": 224820 }
class ____(suite.JSONLegacyStringCastIndexTest): __requires__ = ("postgresql_jsonb",) datatype = JSONB
JSONBCastSuiteTest
python
doocs__leetcode
solution/1900-1999/1969.Minimum Non-Zero Product of the Array Elements/Solution.py
{ "start": 0, "end": 159 }
class ____: def minNonZeroProduct(self, p: int) -> int: mod = 10**9 + 7 return (2**p - 1) * pow(2**p - 2, 2 ** (p - 1) - 1, mod) % mod
Solution
python
realpython__materials
python-parallel-processing/07_image_processing/image_processing_bonus.py
{ "start": 199, "end": 316 }
class ____(enum.StrEnum): PYTHON = "Python" NUMPY = "NumPy" PARALLEL = "Parallel (GIL-Free)"
ProcessingMode
python
tensorflow__tensorflow
tensorflow/python/util/tf_export.py
{ "start": 11397, "end": 11783 }
class ____(Protocol): def __call__( self, *v2: str, v1: Optional[Sequence[str]] = None, allow_multiple_exports: bool = True, # Deprecated, no-op ) -> api_export: ... tf_export: ExportType = functools.partial( api_export, api_name=TENSORFLOW_API_NAME ) keras_export: ExportType = f...
ExportType
python
django__django
tests/admin_views/models.py
{ "start": 26362, "end": 26526 }
class ____(models.Model): iname = models.CharField(max_length=20, unique=True) recipes = models.ManyToManyField(Recipe, through="RecipeIngredient")
Ingredient
python
pytorch__pytorch
torch/_prims_common/__init__.py
{ "start": 71053, "end": 71953 }
class ____: @staticmethod def get_torch_state_as_tuple( fake_mode: AbstractContextManager[Any] = nullcontext(), ): if not torch.cuda.is_available(): raise RuntimeError("CUDA not available") with fake_mode: seed = torch.tensor(torch.cuda.initial_seed()) ...
CUDARngStateHelper
python
apache__airflow
providers/fab/src/airflow/providers/fab/auth_manager/schemas/role_and_permission_schema.py
{ "start": 2144, "end": 2251 }
class ____(NamedTuple): """List of roles.""" roles: list[Role] total_entries: int
RoleCollection
python
doocs__leetcode
solution/0600-0699/0616.Add Bold Tag in String/Solution.py
{ "start": 352, "end": 1524 }
class ____: def addBoldTag(self, s: str, words: List[str]) -> str: trie = Trie() for w in words: trie.insert(w) n = len(s) pairs = [] for i in range(n): node = trie for j in range(i, n): idx = ord(s[j]) if no...
Solution
python
pytorch__pytorch
test/test_mps.py
{ "start": 3141, "end": 6608 }
class ____: def __init__(self, testcase, name=None): self.name = testcase.id() if name is None else name self.testcase = testcase def __enter__(self): # Performs a gc if required (required if any memory is held) caching_allocator_mem_allocated = torch.mps.current_allocated_memor...
MpsMemoryLeakCheck
python
pytorch__pytorch
torch/distributed/checkpoint/planner.py
{ "start": 564, "end": 653 }
class ____(Enum): TENSOR = auto() SHARD = auto() BYTE_IO = auto()
WriteItemType
python
pypa__setuptools
setuptools/_distutils/command/build_clib.py
{ "start": 1023, "end": 7777 }
class ____(Command): description = "build C/C++ libraries used by Python extensions" user_options: ClassVar[list[tuple[str, str, str]]] = [ ('build-clib=', 'b', "directory to build C/C++ libraries to"), ('build-temp=', 't', "directory to put temporary build by-products"), ('debug', 'g',...
build_clib
python
allegroai__clearml
clearml/backend_api/services/v2_20/queues.py
{ "start": 8953, "end": 16329 }
class ____(NonStrictDataModel): """ :param id: Queue id :type id: str :param name: Queue name :type name: str :param user: Associated user id :type user: str :param company: Company id :type company: str :param created: Queue creation time :type created: datetime.datetime ...
Queue
python
django__django
django/utils/translation/__init__.py
{ "start": 723, "end": 1242 }
class ____(SyntaxWarning): pass # Here be dragons, so a short explanation of the logic won't hurt: # We are trying to solve two problems: (1) access settings, in particular # settings.USE_I18N, as late as possible, so that modules can be imported # without having to first configure Django, and (2) if some other c...
TranslatorCommentWarning
python
huggingface__transformers
tests/models/data2vec/test_modeling_data2vec_text.py
{ "start": 13981, "end": 26182 }
class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = ( ( Data2VecTextForCausalLM, Data2VecTextForMaskedLM, Data2VecTextModel, Data2VecTextForSequenceClassification, Data2VecTextForTokenCla...
Data2VecTextModelTest
python
chardet__chardet
chardet/jpcntx.py
{ "start": 22465, "end": 25312 }
class ____: NUM_OF_CATEGORY = 6 DONT_KNOW = -1 ENOUGH_REL_THRESHOLD = 100 MAX_REL_THRESHOLD = 1000 MINIMUM_DATA_THRESHOLD = 4 def __init__(self) -> None: self._total_rel = 0 self._rel_sample: List[int] = [] self._need_to_skip_char_num = 0 self._last_char_order = ...
JapaneseContextAnalysis
python
spyder-ide__spyder
spyder/plugins/remoteclient/widgets/container.py
{ "start": 853, "end": 6818 }
class ____(PluginMainContainer): sig_start_server_requested = Signal(str) """ This signal is used to request starting a remote server. Parameters ---------- id: str Id of the server that will be started. """ sig_stop_server_requested = Signal(str) """ This signal is us...
RemoteClientContainer
python
getsentry__sentry
src/sentry/management/commands/create_sample_event.py
{ "start": 68, "end": 1436 }
class ____(BaseCommand): help = "Creates a sample event in Sentry (if applicable)" def add_arguments(self, parser): parser.add_argument( "--project", dest="project", help="project ID or team-slug/project-slug" ), parser.add_argument("--platform", dest="platform"), def h...
Command
python
pikepdf__pikepdf
tests/test_object.py
{ "start": 14058, "end": 17783 }
class ____: @pytest.fixture(scope="function") def abcxyz_stream(self): with pikepdf.new() as pdf: data = b'abcxyz' stream = Stream(pdf, data) yield stream def test_stream_isinstance(self): pdf = pikepdf.new() stream = Stream(pdf, b'xyz') a...
TestStream
python
wntrblm__nox
nox/_option_set.py
{ "start": 1701, "end": 2930 }
class ____: default_venv_backend: None | str = attrs.field(validator=av_opt_str) download_python: None | Literal["auto", "never", "always"] = attrs.field( default=None, validator=av.optional(av.in_(["auto", "never", "always"])) ) envdir: None | str | os.PathLike[str] = attrs.field(validator=av_o...
NoxOptions