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
great-expectations__great_expectations
great_expectations/expectations/metrics/multicolumn_map_metrics/compound_columns_unique.py
{ "start": 1263, "end": 11691 }
class ____(MulticolumnMapMetricProvider): """ While the support for "PandasExecutionEngine" and "SparkDFExecutionEngine" is accomplished using a compact implementation, which combines the "map" and "condition" parts in a single step, the support for "SqlAlchemyExecutionEngine" is more detailed. Thus, t...
CompoundColumnsUnique
python
pytorch__pytorch
torch/_dynamo/variables/base.py
{ "start": 4084, "end": 4813 }
class ____(MutationType): """ This case of VariableTracker.mutation_type marker indicates 1. Dynamo allows mutation on the value itself (rather than its attributes). 2. The value is created by the bytecode Dynamo is tracing through. For instance, Dynamo could model a newly created list with this ma...
ValueMutationNew
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI034.py
{ "start": 9089, "end": 9187 }
class ____(AsyncIterator[int]): def __aiter__(self: Self) -> Self: ...
GoodAsyncIterator
python
ray-project__ray
python/ray/cluster_utils.py
{ "start": 550, "end": 4392 }
class ____: """Create a local autoscaling cluster for testing. See test_autoscaler_fake_multinode.py for an end-to-end example. """ def __init__( self, head_resources: dict, worker_node_types: dict, autoscaler_v2: bool = False, **config_kwargs, ): ""...
AutoscalingCluster
python
apache__airflow
providers/papermill/src/airflow/providers/papermill/operators/papermill.py
{ "start": 1645, "end": 5163 }
class ____(BaseOperator): """ Executes a jupyter notebook through papermill that is annotated with parameters. :param input_nb: input notebook, either path or NoteBook inlet. :param output_nb: output notebook, either path or NoteBook outlet. :param parameters: the notebook parameters to set :pa...
PapermillOperator
python
ray-project__ray
python/ray/tests/test_placement_group_5.py
{ "start": 10010, "end": 18881 }
class ____(RuntimeEnvPlugin): name = MyPlugin async def create( self, uri, runtime_env, ctx, logger, # noqa: F821 ) -> float: await asyncio.sleep(PLUGIN_TIMEOUT) @staticmethod def validate(runtime_env_dict: dict) -> str: return 1 @pytest.m...
HangPlugin
python
sphinx-doc__sphinx
tests/roots/test-ext-autodoc/target/bound_method.py
{ "start": 0, "end": 107 }
class ____: def method(self): """Method docstring""" pass bound_method = Cls().method
Cls
python
google__jax
tests/custom_api_test.py
{ "start": 137684, "end": 139075 }
class ____(jtu.JaxTestCase): """Test interactions among the custom_{vmap,jvp,vjp,transpose,*} APIs""" def test_method_forwarding(self): @jax.custom_batching.custom_vmap @jax.custom_jvp @jax.custom_transpose.custom_transpose def f(x): return 2. * x # none of these err: @f.def_vmap def f...
CustomApiTest
python
nedbat__coveragepy
coverage/jsonreport.py
{ "start": 908, "end": 7333 }
class ____: """A reporter for writing JSON coverage results.""" report_type = "JSON report" def __init__(self, coverage: Coverage) -> None: self.coverage = coverage self.config = self.coverage.config self.total = Numbers(self.config.precision) self.report_data: JsonObj = {}...
JsonReporter
python
tensorflow__tensorflow
tensorflow/python/distribute/tpu_strategy.py
{ "start": 9684, "end": 28407 }
class ____(distribute_lib.Strategy): """Synchronous training on TPUs and TPU Pods. To construct a TPUStrategy object, you need to run the initialization code as below: >>> resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu='') >>> tf.config.experimental_connect_to_cluster(resolver) >>> tf.tp...
TPUStrategyV2
python
django__django
tests/check_framework/test_security.py
{ "start": 13542, "end": 14432 }
class ____(SimpleTestCase): @override_settings( MIDDLEWARE=["django.middleware.security.SecurityMiddleware"], SECURE_SSL_REDIRECT=False, ) def test_no_ssl_redirect(self): """ Warn if SECURE_SSL_REDIRECT isn't True. """ self.assertEqual(base.check_ssl_redirect(...
CheckSSLRedirectTest
python
allegroai__clearml
clearml/backend_api/services/v2_23/dataviews.py
{ "start": 141046, "end": 144171 }
class ____(Response): """ Response of dataviews.publish_many endpoint. :param succeeded: :type succeeded: Sequence[dict] :param failed: :type failed: Sequence[dict] """ _service = "dataviews" _action = "publish_many" _version = "2.23" _schema = { "definitions": {},...
PublishManyResponse
python
PrefectHQ__prefect
tests/server/orchestration/api/test_concurrency_limits.py
{ "start": 4213, "end": 12510 }
class ____: @pytest.fixture async def tags_with_limits( self, client: AsyncClient, ) -> List[str]: tags = ["tag1", "tag2"] for tag in tags: await client.post( "/concurrency_limits/", json=ConcurrencyLimitCreate( ...
TestAcquiringAndReleasing
python
great-expectations__great_expectations
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_crc32.py
{ "start": 469, "end": 1566 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.valid_crc32" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _pandas(cls,...
ColumnValuesToBeValidCrc32
python
explosion__spaCy
spacy/schemas.py
{ "start": 6529, "end": 8362 }
class ____(BaseModel): REGEX: Optional[Union[StrictStr, "TokenPatternString"]] = Field(None, alias="regex") IN: Optional[List[StrictStr]] = Field(None, alias="in") NOT_IN: Optional[List[StrictStr]] = Field(None, alias="not_in") IS_SUBSET: Optional[List[StrictStr]] = Field(None, alias="is_subset") IS...
TokenPatternString
python
getsentry__sentry
tests/sentry/workflow_engine/models/test_data_condition.py
{ "start": 1794, "end": 5111 }
class ____(DataConditionHandlerMixin, BaseWorkflowTest): def test(self) -> None: dc = self.create_data_condition( type=Condition.GREATER, comparison=1.0, condition_result=DetectorPriorityLevel.HIGH ) assert dc.evaluate_value(2) == DetectorPriorityLevel.HIGH assert dc.eval...
EvaluateValueTest
python
huggingface__transformers
tests/models/llama4/test_processing_llama4.py
{ "start": 797, "end": 1482 }
class ____(ProcessorTesterMixin, unittest.TestCase): processor_class = Llama4Processor @classmethod def _setup_image_processor(cls): image_processor_class = cls._get_component_class_from_processor("image_processor") return image_processor_class(max_patches=1, size={"height": 20, "width": 20...
Llama4ProcessorTest
python
kamyu104__LeetCode-Solutions
Python/frog-jump.py
{ "start": 33, "end": 576 }
class ____(object): def canCross(self, stones): """ :type stones: List[int] :rtype: bool """ if stones[1] != 1: return False last_jump_units = {s: set() for s in stones} last_jump_units[1].add(1) for s in stones[:-1]: for j in ...
Solution
python
ipython__ipython
tests/test_interactiveshell.py
{ "start": 27436, "end": 28021 }
class ____(unittest.TestCase): def test_transform_only_once(self): cleanup = 0 line_t = 0 def count_cleanup(lines): nonlocal cleanup cleanup += 1 return lines def count_line_t(lines): nonlocal line_t line_t += 1 ...
TestMiscTransform
python
ray-project__ray
rllib/policy/torch_mixins.py
{ "start": 7088, "end": 8682 }
class ____: """Mixin class adding a method for (soft) target net(s) synchronizations. - Adds the `update_target` method to the policy. Calling `update_target` updates all target Q-networks' weights from their respective "main" Q-networks, based on tau (smooth, partial updating). """ def __...
TargetNetworkMixin
python
google__pytype
pytype/constant_folding.py
{ "start": 1600, "end": 2775 }
class ____(Exception): """Errors raised during constant folding.""" def __init__(self, message, op): super().__init__(message) self.lineno = op.line self.message = message # We track constants at three levels: # typ: A typestruct representing the abstract type of the constant # elements: A lis...
ConstantError
python
python-pillow__Pillow
src/PIL/IcoImagePlugin.py
{ "start": 10477, "end": 13068 }
class ____(ImageFile.ImageFile): """ PIL read-only image support for Microsoft Windows .ico files. By default the largest resolution image in the file will be loaded. This can be changed by altering the 'size' attribute before calling 'load'. The info dictionary has a key 'sizes' that is a list of...
IcoImageFile
python
pypa__setuptools
setuptools/_vendor/tomli/_parser.py
{ "start": 1555, "end": 4177 }
class ____(ValueError): """An error raised if a document is not valid TOML.""" def load(__fp: BinaryIO, *, parse_float: ParseFloat = float) -> dict[str, Any]: """Parse TOML from a binary file object.""" b = __fp.read() try: s = b.decode() except AttributeError: raise TypeError( ...
TOMLDecodeError
python
great-expectations__great_expectations
contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_california_zip.py
{ "start": 757, "end": 1767 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.valid_california_zip" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _pa...
ColumnValuesToBeValidCaliforniaZip
python
google__jax
jax/_src/sharding_impls.py
{ "start": 19449, "end": 25975 }
class ____: """A hardware axis context for parallel computations that use the sharding interface. This context also uses the GSPMD partitioner. """ num_devices: int device_assignment: tuple[xc.Device, ...] | None = None abstract_mesh: mesh_lib.AbstractMesh | None = None def __post_init__(self): if...
ShardingContext
python
pandas-dev__pandas
pandas/tests/frame/indexing/test_setitem.py
{ "start": 29644, "end": 31240 }
class ____: @pytest.fixture def idx(self): naive = DatetimeIndex(["2013-1-1 13:00", "2013-1-2 14:00"], name="B") idx = naive.tz_localize("US/Pacific") return idx @pytest.fixture def expected(self, idx): expected = Series(np.array(idx.tolist(), dtype="object"), name="B") ...
TestSetitemTZAwareValues
python
realpython__materials
arcade-platformer/arcade_platformer/11_title_view.py
{ "start": 3292, "end": 15920 }
class ____(arcade.View): def __init__(self) -> None: super().__init__() # These lists will hold different sets of sprites self.coins = None self.background = None self.walls = None self.ladders = None self.goals = None self.enemies = None # O...
PlatformerView
python
fluentpython__example-code-2e
23-descriptor/bulkfood/bulkfood_v5.py
{ "start": 1424, "end": 1775 }
class ____: description = model.NonBlank() # <2> weight = model.Quantity() price = model.Quantity() def __init__(self, description, weight, price): self.description = description self.weight = weight self.price = price def subtotal(self): return self.weight * self....
LineItem
python
getsentry__sentry
tests/apidocs/endpoints/releases/test_organization_release_file_details.py
{ "start": 136, "end": 1461 }
class ____(APIDocsTestCase): def setUp(self) -> None: self.login_as(user=self.user) project = self.create_project(name="foo") release = self.create_release(project=project, version="1") file1 = self.create_file( name="blah.js", size=42, type="rele...
ReleaseFileDetailsDocsTest
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/dependency.py
{ "start": 20769, "end": 20883 }
class ____(Enum): DIRECT = "DIRECT" FAN_IN = "FAN_IN" DYNAMIC_COLLECT = "DYNAMIC_COLLECT"
DependencyType
python
google__jax
jax/_src/export/shape_poly_decision.py
{ "start": 1395, "end": 20476 }
class ____: """A decision procedure based on elimination of terms. Given an expression `e = t*t_k + rest_e` for which we want to compute bounds, and a constraint `c = t*t_c_k + rest_c >= 0`, Let `e0 = e*abs(t_c_k) - c*sgn(t_c_k)*t_k`. (Note that we eliminated `t` from `e0`, since `abs(t_c_k)*t_k = sgn(t_c_k...
_DecisionByElimination
python
euske__pdfminer
pdfminer/layout.py
{ "start": 20735, "end": 21450 }
class ____(LTLayoutContainer): def __init__(self, name, bbox, matrix): self.name = name self.matrix = matrix (x, y, w, h) = bbox bbox = get_bound(apply_matrix_pt(matrix, (p, q)) for (p, q) in ((x, y), (x+w, y), (x, y+h), (x+w, y+h))) LTLayoutContaine...
LTFigure
python
pytorch__pytorch
test/dynamo/test_subclasses.py
{ "start": 93440, "end": 95301 }
class ____(torch.nn.Module): def forward( self, primals_5: "Sym(s47)", # SubclassSizeAOTInput(base=PlainAOTInput(idx=2), idx=0) primals_7: "Sym(s16)", # SubclassStrideAOTInput(base=PlainAOTInput(idx=2), idx=0) tangents_1: "f32[s47, s16]", # SubclassGetAttrAOTInput(base=TangentAOTI...
GraphModule
python
kamyu104__LeetCode-Solutions
Python/bitwise-or-of-all-subsequence-sums.py
{ "start": 365, "end": 710 }
class ____(object): def subsequenceSumOr(self, nums): """ :type nums: List[int] :rtype: int """ result = cnt = 0 for i in xrange(64): cnt >>= 1 for x in nums: cnt += (x>>i)&1 if cnt: result |= 1<<i ...
Solution2
python
huggingface__transformers
src/transformers/models/esm/openfold_utils/rigid_utils.py
{ "start": 24209, "end": 41006 }
class ____: """ A class representing a rigid transformation. Little more than a wrapper around two objects: a Rotation object and a [*, 3] translation Designed to behave approximately like a single torch tensor with the shape of the shared batch dimensions of its component parts. """ def __init...
Rigid
python
protocolbuffers__protobuf
python/google/protobuf/descriptor.py
{ "start": 28758, "end": 32850 }
class ____(_NestedDescriptorBase): """Descriptor for an enum defined in a .proto file. Attributes: name (str): Name of the enum type. full_name (str): Full name of the type, including package name and any enclosing type(s). values (list[EnumValueDescriptor]): List of the values in this enum. ...
EnumDescriptor
python
pallets__flask
tests/test_cli.py
{ "start": 11775, "end": 20377 }
class ____: @pytest.fixture def app(self): app = Flask(__name__) app.add_url_rule( "/get_post/<int:x>/<int:y>", methods=["GET", "POST"], endpoint="yyy_get_post", ) app.add_url_rule("/zzz_post", methods=["POST"], endpoint="aaa_post") ret...
TestRoutes
python
huggingface__transformers
src/transformers/models/phi4_multimodal/modeling_phi4_multimodal.py
{ "start": 11573, "end": 15472 }
class ____(nn.Module): def __init__(self, config: Phi4MultimodalVisionConfig): super().__init__() self.config = config self.patch_size = config.patch_size self.num_patches_per_side = config.image_size // self.patch_size self.patch_embedding = nn.Conv2d( in_channe...
Phi4MultimodalVisionEmbeddings
python
python-pillow__Pillow
Tests/helper.py
{ "start": 6641, "end": 10124 }
class ____: # requires unix/macOS iterations = 100 # count mem_limit = 512 # k def _get_mem_usage(self) -> float: """ Gets the RUSAGE memory usage, returns in K. Encapsulates the difference between macOS and Linux rss reporting :returns: memory usage in kilobytes ...
PillowLeakTestCase
python
Textualize__textual
src/textual/widgets/_directory_tree.py
{ "start": 624, "end": 859 }
class ____: """Attaches directory information to a [`DirectoryTree`][textual.widgets.DirectoryTree] node.""" path: Path """The path of the directory entry.""" loaded: bool = False """Has this been loaded?"""
DirEntry
python
sqlalchemy__sqlalchemy
test/orm/test_joins.py
{ "start": 1564, "end": 7289 }
class ____(InheritedTest, AssertsCompiledSQL): def test_single_prop(self): Company = self.classes.Company sess = fixture_session() self.assert_compile( sess.query(Company).join(Company.employees), "SELECT companies.company_id AS companies_company_id, " "...
InheritedJoinTest
python
tensorflow__tensorflow
tensorflow/cc/saved_model/testdata/generate_saved_models.py
{ "start": 2098, "end": 2338 }
class ____(module.Module): def __init__(self, parent): super(ReferencesParent, self).__init__() self.parent = parent self.my_variable = variables.Variable(3., name="MyVariable") # Creates a cyclic object graph.
ReferencesParent
python
google__jax
jax/_src/named_sharding.py
{ "start": 18274, "end": 21497 }
class ____(Exception): def __init__(self, message, mesh, pspec): super().__init__(message) self.message = message self.mesh = mesh self.pspec = pspec def __str__(self): return f"{self.message}" def _check_unique_resources(pspec: PartitionSpec, arg_name: str, mesh=None ...
DuplicateSpecError
python
huggingface__transformers
tests/models/dinat/test_modeling_dinat.py
{ "start": 1452, "end": 7092 }
class ____: def __init__( self, parent, batch_size=13, image_size=64, patch_size=4, num_channels=3, embed_dim=16, depths=[1, 2, 1], num_heads=[2, 4, 8], kernel_size=3, dilations=[[3], [1, 2], [1]], mlp_ratio=2.0, ...
DinatModelTester
python
PrefectHQ__prefect
tests/runner/test_storage.py
{ "start": 36170, "end": 40799 }
class ____: @pytest.fixture async def test_block(self): class FakeStorageBlock(Block): _block_type_slug = "fake-storage-block" code: str = dedent( """\ from prefect import flow @flow def test_flow(): ...
TestBlockStorageAdapter
python
cython__cython
Cython/Compiler/TreePath.py
{ "start": 6628, "end": 7960 }
class ____: def __init__(self, path): self._tokens = [ (special, text) for (special, text) in path_tokenizer(path) if special or text ] self._tokens.reverse() # allow efficient .pop() def peek(self, default=(None, None)): return self._tokens[...
_LookAheadTokenizer
python
allegroai__clearml
clearml/backend_api/services/v2_13/queues.py
{ "start": 18824, "end": 20049 }
class ____(Response): """ Response of queues.add_or_update_metadata endpoint. :param updated: Number of queues updated (0 or 1) :type updated: int """ _service = "queues" _action = "add_or_update_metadata" _version = "2.13" _schema = { "definitions": {}, "properties...
AddOrUpdateMetadataResponse
python
getsentry__sentry
src/sentry/dynamic_sampling/rules/helpers/latest_releases.py
{ "start": 4442, "end": 11775 }
class ____: """ Class responsible of hiding the complexity of handling boosted releases in the Redis hash. In addition, it provides all the logic to handle an upper bound in the number of boosted releases that can be simultaneously be added to a specific project. """ # Limit of boosted releases...
ProjectBoostedReleases
python
pola-rs__polars
py-polars/src/polars/datatypes/classes.py
{ "start": 9614, "end": 9686 }
class ____(SignedIntegerType): """64-bit signed integer type."""
Int64
python
scikit-learn__scikit-learn
sklearn/utils/tests/test_pprint.py
{ "start": 1627, "end": 1884 }
class ____(BaseEstimator): def __init__(self, estimator, n_features_to_select=None, step=1, verbose=0): self.estimator = estimator self.n_features_to_select = n_features_to_select self.step = step self.verbose = verbose
RFE
python
sqlalchemy__sqlalchemy
test/sql/test_deprecations.py
{ "start": 17550, "end": 18039 }
class ____(fixtures.TestBase, AssertsCompiledSQL): __dialect__ = "default" @testing.fixture def table_fixture(self): table1 = table( "mytable", column("myid", Integer), column("name", String), column("description", String), ) table2 =...
FutureSelectTest
python
PyCQA__pylint
tests/functional/t/try_except_raise.py
{ "start": 544, "end": 1439 }
class ____(AAAException): """BBBException""" pass def ccc(): """try-except-raise test function""" try: raise BBBException("asdf") except BBBException: raise except AAAException: raise BBBException("raised from AAAException") def ddd(): """try-except-raise test fun...
BBBException
python
getsentry__sentry-python
sentry_sdk/profiler/continuous_profiler.py
{ "start": 20175, "end": 23066 }
class ____: def __init__(self): # type: () -> None self.chunk_id = uuid.uuid4().hex self.indexed_frames = {} # type: Dict[FrameId, int] self.indexed_stacks = {} # type: Dict[StackId, int] self.frames = [] # type: List[ProcessedFrame] self.stacks = [] # type: List...
ProfileChunk
python
urllib3__urllib3
src/urllib3/exceptions.py
{ "start": 3271, "end": 3369 }
class ____(HTTPError): """Raised when passing an invalid state to a timeout"""
TimeoutStateError
python
scikit-learn__scikit-learn
sklearn/preprocessing/_data.py
{ "start": 88255, "end": 111426 }
class ____(OneToOneFeatureMixin, TransformerMixin, BaseEstimator): """Transform features using quantiles information. This method transforms the features to follow a uniform or a normal distribution. Therefore, for a given feature, this transformation tends to spread out the most frequent values. It al...
QuantileTransformer
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/sensors/glue.py
{ "start": 11590, "end": 16566 }
class ____(AwsBaseSensor[GlueDataQualityHook]): """ Waits for an AWS Glue data quality recommendation run to reach any of the status below. 'FAILED', 'STOPPED', 'STOPPING', 'TIMEOUT', 'SUCCEEDED' .. seealso:: For more information on how to use this sensor, take a look at the guide: :re...
GlueDataQualityRuleRecommendationRunSensor
python
walkccc__LeetCode
solutions/3082. Find the Sum of the Power of All Subsequences/3082.py
{ "start": 0, "end": 683 }
class ____: def sumOfPower(self, nums: list[int], k: int) -> int: MOD = 1_000_000_007 @functools.lru_cache(None) def dp(i: int, j: int) -> int: """Returns the number of subsequences in nums[i..n) that sums to j.""" if j == 0: # For each of the remaining number, we can either pick it o...
Solution
python
scikit-learn__scikit-learn
sklearn/externals/_arff.py
{ "start": 12097, "end": 12381 }
class ____(ArffException): '''Error raised when some data instance is in an invalid format.''' def __init__(self, value): super().__init__() self.message = ( 'Bad @DATA instance format in line %d: ' + ('%s' % value) )
BadDataFormat
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/skill_create_response.py
{ "start": 186, "end": 1161 }
class ____(BaseModel): id: str """Unique identifier for the skill. The format and length of IDs may change over time. """ created_at: str """ISO 8601 timestamp of when the skill was created.""" display_title: Optional[str] = None """Display title for the skill. This is a human-re...
SkillCreateResponse
python
gevent__gevent
src/gevent/_tracer.py
{ "start": 4426, "end": 4701 }
class ____(GreenletTracer): def __init__(self, hub, max_blocking_time): GreenletTracer.__init__(self) self.max_blocking_time = max_blocking_time self.hub = hub def kill(self): self.hub = None GreenletTracer.kill(self)
_HubTracer
python
google__jax
tests/custom_api_test.py
{ "start": 1460, "end": 44725 }
class ____(jtu.JaxTestCase): def test_basic(self): @jax.custom_jvp def f(x): return jnp.sin(x) def f_jvp(primals, tangents): x, = primals g, = tangents return f(x), 2 * jnp.cos(x) * g f.defjvp(f_jvp) x = 3. self.assertAllClose(f(x), jnp.sin(x)) self.assertAllClose...
CustomJVPTest
python
pydantic__pydantic
tests/mypy/outputs/mypy-plugin_ini/plugin_fail_baseConfig.py
{ "start": 5929, "end": 6175 }
class ____(BaseModel): x: int = Field(..., alias='y') class Config: # type: ignore[pydantic-alias] # MYPY: error: Unused "type: ignore" comment [unused-ignore] alias_generator = lambda x: x + '_' # noqa E731
AliasGeneratorModel2
python
realpython__materials
python-iterators-iterables/resettable_iter.py
{ "start": 0, "end": 556 }
class ____: def __init__(self, start=0, end=None, step=1, *, resettable=False): if end is None: end, start = start, 0 self._start = start self._end = end self._step = step self._resettable = resettable def __iter__(self): return self def __next__...
ResettableRange
python
PrefectHQ__prefect
src/prefect/flows.py
{ "start": 86353, "end": 127757 }
class ____(Flow[P, R]): """ EXPERIMENTAL: This class is experimental and may be removed or changed in future releases. A flow that is bound to running on a specific infrastructure. Attributes: work_pool: The name of the work pool to run the flow on. The base job configurati...
InfrastructureBoundFlow
python
zarr-developers__zarr-python
src/zarr/core/chunk_grids.py
{ "start": 5270, "end": 10439 }
class ____(ChunkGrid): chunk_shape: tuple[int, ...] def __init__(self, *, chunk_shape: ShapeLike) -> None: chunk_shape_parsed = parse_shapelike(chunk_shape) object.__setattr__(self, "chunk_shape", chunk_shape_parsed) @classmethod def _from_dict(cls, data: dict[str, JSON] | NamedConfig...
RegularChunkGrid
python
coleifer__peewee
tests/regressions.py
{ "start": 27006, "end": 27121 }
class ____(TestModel): key = TextField() value = IntegerField() rs = ForeignKeyField(RS, backref='rds')
RD
python
scikit-image__scikit-image
benchmarks/benchmark_restoration.py
{ "start": 573, "end": 3535 }
class ____: """Benchmark for restoration routines in scikit image.""" timeout = 120 def setup(self): nz = 32 self.volume_f64 = ( np.stack( [ camera()[::2, ::2], ] * nz, axis=-1, ).as...
RestorationSuite
python
kubernetes-client__python
kubernetes/client/models/v1_endpoint_conditions.py
{ "start": 383, "end": 6467 }
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...
V1EndpointConditions
python
kamyu104__LeetCode-Solutions
Python/maximum-total-reward-using-operations-i.py
{ "start": 526, "end": 896 }
class ____(object): def maxTotalReward(self, rewardValues): """ :type rewardValues: List[int] :rtype: int """ dp = 1 for v in sorted(set(rewardValues)): x = dp&((1<<v)-1) dp |= x<<v return dp.bit_length()-1 # Time: O(nlogn + r^2), r ...
Solution2
python
pyinstaller__pyinstaller
bootloader/waflib/Tools/lua.py
{ "start": 490, "end": 641 }
class ____(Task.Task): run_str = '${LUAC} -s -o ${TGT} ${SRC}' color = 'PINK' def configure(conf): conf.find_program('luac', var='LUAC')
luac
python
sphinx-doc__sphinx
sphinx/util/logging.py
{ "start": 6892, "end": 11073 }
class ____(logging.handlers.BufferingHandler): """Handler buffering all logs.""" buffer: list[logging.LogRecord] def __init__(self) -> None: super().__init__(-1) def shouldFlush(self, record: logging.LogRecord) -> bool: return False # never flush def flush(self) -> None: ...
MemoryHandler
python
django__django
django/db/backends/dummy/base.py
{ "start": 1407, "end": 2217 }
class ____(BaseDatabaseWrapper): operators = {} # Override the base class implementations with null # implementations. Anything that tries to actually # do something raises complain; anything that tries # to rollback or undo something raises ignore. _cursor = complain ensure_connection = com...
DatabaseWrapper
python
getsentry__sentry
src/sentry/search/eap/columns.py
{ "start": 11694, "end": 13408 }
class ____(FunctionDefinition): internal_function: Function.ValueType """ An optional function that takes in the resolved argument and returns the attribute key to aggregate on. If not provided, assumes the aggregate is on the first argument. """ attribute_resolver: Callable[[ResolvedArgument], ...
AggregateDefinition
python
pypa__packaging
src/packaging/metadata.py
{ "start": 9608, "end": 10135 }
class ____(email.policy.EmailPolicy): """ This is :class:`email.policy.EmailPolicy`, but with a simple ``header_store_parse`` implementation that handles multi-line values, and some nice defaults. """ utf8 = True mangle_from_ = False max_line_length = 0 def header_store_parse(self, nam...
RFC822Policy
python
urllib3__urllib3
src/urllib3/response.py
{ "start": 2356, "end": 2446 }
class ____: FIRST_MEMBER = 0 OTHER_MEMBERS = 1 SWALLOW_DATA = 2
GzipDecoderState
python
tensorflow__tensorflow
tensorflow/python/keras/initializers/initializers_v1.py
{ "start": 2639, "end": 2877 }
class ____(init_ops.VarianceScaling): def __init__(self, seed=None): super(HeUniform, self).__init__( scale=2., mode='fan_in', distribution='uniform', seed=seed) def get_config(self): return {'seed': self.seed}
HeUniform
python
walkccc__LeetCode
solutions/1996. The Number of Weak Characters in the Game/1996-2.py
{ "start": 0, "end": 581 }
class ____: def numberOfWeakCharacters(self, properties: list[list[int]]) -> int: ans = 0 maxAttack = max(attack for attack, _ in properties) # maxDefenses[i] := the maximum defense for the i-th attack maxDefenses = [0] * (maxAttack + 2) for attack, defense in properties: maxDefenses[attack...
Solution
python
PrefectHQ__prefect
src/prefect/workers/process.py
{ "start": 2818, "end": 3404 }
class ____(BaseVariables): stream_output: bool = Field( default=True, description=( "If enabled, workers will stream output from flow run processes to " "local standard output." ), ) working_dir: Optional[Path] = Field( default=None, title="Wor...
ProcessVariables
python
pyparsing__pyparsing
examples/matchPreviousDemo.py
{ "start": 103, "end": 556 }
class ____ ... end d;""" identifier = Word(alphas) classIdent = identifier("classname") # note that this also makes a copy of identifier classHead = "class" + classIdent classBody = "..." classEnd = "end" + match_previous_literal(classIdent) + ";" classDefn = classHead + classBody + classEnd # use this form to cat...
c
python
google__jax
tests/util_test.py
{ "start": 9139, "end": 10942 }
class ____(jtu.JaxTestCase): def test_safe_map(self): def unreachable(*args, **kwargs): raise RuntimeError("unreachable") self.assertEqual([], util.safe_map(unreachable, [])) self.assertEqual([], util.safe_map(unreachable, (), [])) self.assertEqual([], util.safe_map(unreachable, [], [], [])) ...
SafeMapTest
python
MongoEngine__mongoengine
tests/document/test_validation.py
{ "start": 130, "end": 6207 }
class ____(MongoDBTestCase): def test_to_dict(self): """Ensure a ValidationError handles error to_dict correctly.""" error = ValidationError("root") assert error.to_dict() == {} # 1st level error schema error.errors = {"1st": ValidationError("bad 1st")} assert "1st" ...
TestValidatorError
python
pytorch__pytorch
torch/ao/nn/sparse/quantized/linear.py
{ "start": 2904, "end": 8971 }
class ____(torch.nn.Module): r""" A quantized sparse linear module with quantized tensor as inputs and outputs. """ _version = 1 _FLOAT_MODULE = torch.nn.Linear def __init__( self, in_features, out_features, row_block_size, col_block_size, bias=T...
Linear
python
huggingface__transformers
src/transformers/models/pop2piano/modeling_pop2piano.py
{ "start": 4462, "end": 5844 }
class ____(nn.Module): def __init__(self, config: Pop2PianoConfig): super().__init__() self.wi_0 = nn.Linear(config.d_model, config.d_ff, bias=False) self.wi_1 = nn.Linear(config.d_model, config.d_ff, bias=False) self.wo = nn.Linear(config.d_ff, config.d_model, bias=False) se...
Pop2PianoDenseGatedActDense
python
django__django
django/core/paginator.py
{ "start": 7186, "end": 10191 }
class ____(BasePaginator): def __init__( self, object_list, per_page, orphans=0, allow_empty_first_page=True, error_messages=None, ): super().__init__( object_list, per_page, orphans, allow_empty_first_page, error_messages ) sel...
AsyncPaginator
python
huggingface__transformers
src/transformers/models/deepseek_vl/modular_deepseek_vl.py
{ "start": 4474, "end": 4556 }
class ____(IdeficsCausalLMOutputWithPast): pass
DeepseekVLCausalLMOutputWithPast
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/hooks/rds.py
{ "start": 1229, "end": 15238 }
class ____(AwsGenericHook["RDSClient"]): """ Interact with Amazon Relational Database Service (RDS). Provide thin wrapper around :external+boto3:py:class:`boto3.client("rds") <RDS.Client>`. Additional arguments (such as ``aws_conn_id``) may be specified and are passed down to the underlying AwsBas...
RdsHook
python
rapidsai__cudf
python/cudf_polars/cudf_polars/dsl/ir.py
{ "start": 43753, "end": 46146 }
class ____(IR): """ Return a cached plan node. Used for CSE at the plan level. """ __slots__ = ("key", "refcount") _non_child = ("schema", "key", "refcount") key: int """The cache key.""" refcount: int | None """The number of cache hits.""" def __init__(self, schema: Schem...
Cache
python
ray-project__ray
python/ray/data/_internal/util.py
{ "start": 42547, "end": 43661 }
class ____: def __init__( self, f: pyarrow.NativeFile, context: DataContext, max_attempts: int = 10, max_backoff_s: int = 32, ): self._f = f self._data_context = context self._max_attempts = max_attempts self._max_backoff_s = max_backoff_s ...
RetryingContextManager
python
ray-project__ray
rllib/env/wrappers/open_spiel.py
{ "start": 224, "end": 4645 }
class ____(MultiAgentEnv): def __init__(self, env): super().__init__() self.env = env self.agents = self.possible_agents = list(range(self.env.num_players())) # Store the open-spiel game type. self.type = self.env.get_type() # Stores the current open-spiel game state....
OpenSpielEnv
python
plotly__plotly.py
plotly/graph_objs/layout/title/_subtitle.py
{ "start": 235, "end": 2828 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.title" _path_str = "layout.title.subtitle" _valid_props = {"font", "text"} @property def font(self): """ Sets the subtitle font. The 'font' property is an instance of Font that may be specified as: ...
Subtitle
python
huggingface__transformers
src/transformers/models/zoedepth/modeling_zoedepth.py
{ "start": 48886, "end": 49240 }
class ____(PreTrainedModel): config: ZoeDepthConfig base_model_prefix = "zoedepth" main_input_name = "pixel_values" input_modalities = ("image",) supports_gradient_checkpointing = True @auto_docstring( custom_intro=""" ZoeDepth model with one or multiple metric depth estimation head(s) on ...
ZoeDepthPreTrainedModel
python
doocs__leetcode
solution/2900-2999/2958.Length of Longest Subarray With at Most K Frequency/Solution.py
{ "start": 0, "end": 337 }
class ____: def maxSubarrayLength(self, nums: List[int], k: int) -> int: cnt = defaultdict(int) ans = j = 0 for i, x in enumerate(nums): cnt[x] += 1 while cnt[x] > k: cnt[nums[j]] -= 1 j += 1 ans = max(ans, i - j + 1) ...
Solution
python
huggingface__transformers
src/transformers/models/csm/configuration_csm.py
{ "start": 8317, "end": 18355 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`CsmForConditionalGeneration`]. It is used to instantiate an CSM model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a s...
CsmConfig
python
pydata__xarray
xarray/core/indexing.py
{ "start": 17842, "end": 19604 }
class ____(ExplicitIndexer): """Tuple for vectorized indexing. All elements should be slice or N-dimensional np.ndarray objects with an integer dtype and the same number of dimensions. Indexing follows proposed rules for np.ndarray.vindex, which matches NumPy's advanced indexing rules (including br...
VectorizedIndexer
python
apache__airflow
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_config.py
{ "start": 6232, "end": 11515 }
class ____(TestConfigEndpoint): @pytest.mark.parametrize( ("section", "headers", "expected_status_code", "expected_response"), [ ( None, HEADERS_JSON, 200, GET_CONFIG_ALL_JSON_RESPONSE, ), (None, HEAD...
TestGetConfig
python
sympy__sympy
sympy/integrals/manualintegrate.py
{ "start": 18948, "end": 19298 }
class ____(AtomicRule): a: Expr b: Expr c: Expr def eval(self) -> Expr: a, b, c, x = self.a, self.b, self.c, self.variable return sqrt(S.Pi)/sqrt(2*a) * ( cos(b**2/(4*a) - c)*fresnelc((2*a*x + b)/sqrt(2*a*S.Pi)) + sin(b**2/(4*a) - c)*fresnels((2*a*x + b)/sqrt(2*a...
FresnelCRule
python
scrapy__scrapy
tests/test_downloader_handler_twisted_http2.py
{ "start": 1111, "end": 1433 }
class ____: @property def download_handler_cls(self) -> type[DownloadHandlerProtocol]: # the import can fail when H2_ENABLED is False from scrapy.core.downloader.handlers.http2 import ( # noqa: PLC0415 H2DownloadHandler, ) return H2DownloadHandler
H2DownloadHandlerMixin
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/errors.py
{ "start": 8787, "end": 9078 }
class ____(graphene.ObjectType): class Meta: interfaces = (GrapheneError,) name = "InvalidPipelineRunsFilterError" def __init__(self, message): super().__init__() self.message = check.str_param(message, "message")
GrapheneInvalidPipelineRunsFilterError
python
wandb__wandb
wandb/vendor/pygments/lexers/templates.py
{ "start": 34687, "end": 35381 }
class ____(DelegatingLexer): """ Subclass of the ERB lexer that highlights the unlexed data with the html lexer. Nested Javascript and CSS is highlighted too. """ name = 'RHTML' aliases = ['rhtml', 'html+erb', 'html+ruby'] filenames = ['*.rhtml'] alias_filenames = ['*.html', '*.htm...
RhtmlLexer
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-alibabacloud-aisearch/llama_index/embeddings/alibabacloud_aisearch/base.py
{ "start": 1603, "end": 6115 }
class ____(BaseEmbedding): """ For further details, please visit `https://help.aliyun.com/zh/open-search/search-platform/developer-reference/text-embedding-api-details`. """ _client: Client = PrivateAttr() aisearch_api_key: str = Field(default=None, exclude=True) endpoint: str = None serv...
AlibabaCloudAISearchEmbedding