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
getsentry__sentry
tests/sentry/incidents/models/test_alert_rule.py
{ "start": 11082, "end": 11201 }
class ____(AlertRuleTriggerActionActivateBaseTest, unittest.TestCase): method = "fire"
AlertRuleTriggerActionFireTest
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI049.py
{ "start": 153, "end": 203 }
class ____(TypedDict): foo: bytes
_UsedTypedDict
python
numba__numba
numba/core/codegen.py
{ "start": 39621, "end": 41706 }
class ____(object): """ For tracking unresolved symbols generated at runtime due to recursion. """ PREFIX = '.numba.unresolved$' def __init__(self): self._unresolved = utils.UniqueDict() self._defined = set() self._resolved = [] def scan_unresolved_symbols(self, module,...
RuntimeLinker
python
doocs__leetcode
solution/3200-3299/3210.Find the Encrypted String/Solution.py
{ "start": 0, "end": 202 }
class ____: def getEncryptedString(self, s: str, k: int) -> str: cs = list(s) n = len(s) for i in range(n): cs[i] = s[(i + k) % n] return "".join(cs)
Solution
python
numpy__numpy
numpy/_core/tests/test_multiarray.py
{ "start": 178014, "end": 178197 }
class ____: def test_test_zero_rank(self): x = np.array([1, 2, 3]) assert_(isinstance(x[0], np.int_)) assert_(type(x[0, ...]) is np.ndarray)
TestSubscripting
python
pytorch__pytorch
test/test_testing.py
{ "start": 41017, "end": 44030 }
class ____(TestCase): def test_matching_coalesced(self): indices = ( (0, 1), (1, 0), ) values = (1, 2) actual = torch.sparse_coo_tensor(indices, values, size=(2, 2)).coalesce() expected = actual.clone() for fn in assert_close_with_inputs(actua...
TestAssertCloseSparseCOO
python
pytorch__pytorch
test/inductor/test_lookup_table.py
{ "start": 33483, "end": 42104 }
class ____(BaseE2ELookupTableTest): """E2E tests for lookup table functionality""" @parametrize("max_autotune", [True, False]) @fresh_cache() def test_no_lookup_table_entry_autotune_modes(self, max_autotune): """Test when there's no lookup table entry with different autotune modes""" te...
TestLookupTableE2E
python
apache__airflow
airflow-core/src/airflow/utils/file.py
{ "start": 2843, "end": 13855 }
class ____(NamedTuple): """Typed namedtuple with utility functions for glob ignore rules.""" wild_match_pattern: GitWildMatchPattern relative_to: Path | None = None @staticmethod def compile(pattern: str, base_dir: Path, definition_file: Path) -> _IgnoreRule | None: """Build an ignore rule...
_GlobIgnoreRule
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 105025, "end": 105477 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("field", "direction") field = sgqlc.types.Field( sgqlc.types.non_null(EnterpriseServerUserAccountsUploadOrderField), graphql_name="field", ) direction = s...
EnterpriseServerUserAccountsUploadOrder
python
Textualize__textual
src/textual/app.py
{ "start": 6342, "end": 6431 }
class ____(Exception): """Base class for exceptions relating to actions."""
ActionError
python
marshmallow-code__marshmallow
tests/test_serialization.py
{ "start": 694, "end": 35621 }
class ____: @pytest.fixture def user(self): return User("Foo", email="foo@bar.com", age=42) def test_function_field_passed_func(self, user): field = fields.Function(lambda obj: obj.name.upper()) assert field.serialize("key", user) == "FOO" def test_function_field_passed_seriali...
TestFieldSerialization
python
django__django
tests/staticfiles_tests/test_management.py
{ "start": 918, "end": 1139 }
class ____: def test_no_files_created(self): """ Make sure no files were create in the destination directory. """ self.assertEqual(os.listdir(settings.STATIC_ROOT), [])
TestNoFilesCreated
python
kubernetes-client__python
kubernetes/client/models/v1_device_claim_configuration.py
{ "start": 383, "end": 4941 }
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...
V1DeviceClaimConfiguration
python
Farama-Foundation__Gymnasium
gymnasium/envs/mujoco/hopper_v5.py
{ "start": 305, "end": 19804 }
class ____(MujocoEnv, utils.EzPickle): r""" ## Description This environment is based on the work of Erez, Tassa, and Todorov in ["Infinite Horizon Model Predictive Control for Nonlinear Periodic Tasks"](http://www.roboticsproceedings.org/rss07/p10.pdf). The environment aims to increase the number of ind...
HopperEnv
python
google__jax
jax/_src/pallas/mosaic_gpu/core.py
{ "start": 5192, "end": 6982 }
class ____(enum.Enum): #: Global memory. GMEM = "gmem" #: Shared memory. SMEM = "smem" #: Tensor memory. New addition to Blackwell. Not available on Hopper. TMEM = "tmem" #: Registers. REGS = "regs" def __str__(self) -> str: return self.value def __call__( self, shape: Sequence[int...
MemorySpace
python
doocs__leetcode
solution/2800-2899/2830.Maximize the Profit as the Salesman/Solution.py
{ "start": 0, "end": 348 }
class ____: def maximizeTheProfit(self, n: int, offers: List[List[int]]) -> int: offers.sort(key=lambda x: x[1]) f = [0] * (len(offers) + 1) g = [x[1] for x in offers] for i, (s, _, v) in enumerate(offers, 1): j = bisect_left(g, s) f[i] = max(f[i - 1], f[j] + ...
Solution
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/transfers/presto_to_gcs.py
{ "start": 4957, "end": 7193 }
class ____(BaseSQLToGCSOperator): """ Copy data from PrestoDB to Google Cloud Storage in JSON, CSV or Parquet format. :param presto_conn_id: Reference to a specific Presto hook. """ ui_color = "#a0e08c" type_map = { "BOOLEAN": "BOOL", "TINYINT": "INT64", "SMALLINT": "I...
PrestoToGCSOperator
python
mlflow__mlflow
tests/store/tracking/__init__.py
{ "start": 155, "end": 2562 }
class ____: def create_test_run(self): raise Exception("this should be overridden") def get_store(self): raise Exception("this should be overridden") def test_record_logged_model(self): store = self.get_store() run_id = self.create_test_run().info.run_id m = Model(a...
AbstractStoreTest
python
pytorch__pytorch
torch/_inductor/template_heuristics/triton.py
{ "start": 31703, "end": 39707 }
class ____(BaseConfigHeuristic): """ Child class for CUDA device specific gemm/flex attention/conv/ configs. """ def __init__(self) -> None: super().__init__() self.sm_120_default_flex_config = { (torch.float32, 64): FlexConfig(128, 32, 2, 4), (torch.float32, 12...
CUDAConfigHeuristic
python
aio-libs__aiohttp
examples/token_refresh_middleware.py
{ "start": 4203, "end": 12264 }
class ____: """Test server with JWT-like token authentication.""" def __init__(self) -> None: self.tokens_db: dict[str, dict[str, str | float]] = {} self.refresh_tokens_db: dict[str, dict[str, str | float]] = { # Hash of refresh token -> user data hashlib.sha256(b"demo_r...
TestServer
python
huggingface__transformers
src/transformers/models/clip/modeling_clip.py
{ "start": 24835, "end": 26547 }
class ____(CLIPPreTrainedModel): config: CLIPTextConfig input_modalities = ("text",) _no_split_modules = ["CLIPTextEmbeddings", "CLIPEncoderLayer"] def __init__(self, config: CLIPTextConfig): super().__init__(config) self.text_model = CLIPTextTransformer(config) # Initialize we...
CLIPTextModel
python
encode__django-rest-framework
tests/authentication/test_authentication.py
{ "start": 19572, "end": 20949 }
class ____(TestCase): def setUp(self): class AuthAccessingRenderer(renderers.BaseRenderer): media_type = 'text/plain' format = 'txt' def render(self, data, media_type=None, renderer_context=None): request = renderer_context['request'] if r...
FailingAuthAccessedInRenderer
python
pypa__pipenv
pipenv/patched/pip/_internal/commands/download.py
{ "start": 745, "end": 5393 }
class ____(RequirementCommand): """ Download packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports downloading from "requirements files", which provide an easy way to...
DownloadCommand
python
pypa__warehouse
tests/common/db/accounts.py
{ "start": 2482, "end": 2858 }
class ____(WarehouseFactory): class Meta: model = UserTermsOfServiceEngagement revision = "initial" engagement = TermsOfServiceEngagement.Agreed created = factory.Faker( "date_time_between_dates", datetime_start=datetime.datetime(2025, 1, 1), datetime_end=datetime.dateti...
UserTermsOfServiceEngagementFactory
python
joke2k__faker
faker/providers/person/de_LI/__init__.py
{ "start": 81, "end": 17973 }
class ____(PersonProvider): # Top 50 surnames in Liechtenstein # Weighted by number of occurrences # Source: https://de.wikipedia.org/wiki/Familiennamen_in_Liechtenstein#Die_h%C3%A4ufigsten_50_Familiennamen # on 2024-10-31 last_names = OrderedDict( ( ("Banzer", 0.011916111), ...
Provider
python
celery__celery
celery/bin/base.py
{ "start": 883, "end": 4079 }
class ____: """Context Object for the CLI.""" def __init__(self, app, no_color, workdir, quiet=False): """Initialize the CLI context.""" self.app = app or get_current_app() self.no_color = no_color self.quiet = quiet self.workdir = workdir @cached_property def O...
CLIContext
python
numba__numba
numba/tests/test_gil.py
{ "start": 1788, "end": 5966 }
class ____(TestCase): def make_test_array(self, n_members): return np.arange(n_members, dtype=np.int64) def run_in_threads(self, func, n_threads): # Run the function in parallel over an array and collect results. threads = [] # Warm up compilation, since we don't want that to i...
TestGILRelease
python
scrapy__scrapy
tests/test_scheduler_base.py
{ "start": 1173, "end": 1463 }
class ____(MinimalScheduler): def open(self, spider: Spider) -> defer.Deferred: return defer.succeed("open") def close(self, reason: str) -> defer.Deferred: return defer.succeed("close") def __len__(self) -> int: return len(self.requests)
SimpleScheduler
python
django__django
django/contrib/gis/db/models/lookups.py
{ "start": 7496, "end": 8272 }
class ____(GISLookup): lookup_name = "relate" sql_template = "%(func)s(%(lhs)s, %(rhs)s, %%s)" pattern_regex = _lazy_re_compile(r"^[012TF*]{9}$") def process_rhs(self, compiler, connection): # Check the pattern argument pattern = self.rhs_params[0] backend_op = connection.ops.gi...
RelateLookup
python
pytorch__pytorch
torch/_higher_order_ops/_invoke_quant.py
{ "start": 629, "end": 826 }
class ____(BaseHOP): def __init__(self) -> None: super().__init__("invoke_quant") invoke_quant = InvokeQuantUnpacked() @dataclasses.dataclass(frozen=True, repr=True)
InvokeQuantUnpacked
python
getsentry__sentry
src/sentry/workflow_engine/migrations/0102_cleanup_failed_safe_deletes.py
{ "start": 207, "end": 1717 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
ray-project__ray
doc/source/serve/doc_code/custom_request_router_app.py
{ "start": 534, "end": 1520 }
class ____: def __init__(self): context = _get_internal_replica_context() self.replica_id: ReplicaID = context.replica_id async def __call__(self): return self.replica_id handle = serve.run(UniformRequestRouterApp.bind()) response = handle.remote().result() print(f"Response from Unifo...
UniformRequestRouterApp
python
huggingface__transformers
src/transformers/models/doge/modeling_doge.py
{ "start": 23363, "end": 24485 }
class ____(PreTrainedModel): config: DogeConfig base_model_prefix = "model" supports_gradient_checkpointing = True _no_split_modules = ["DogeDecoderLayer"] _skip_keys_device_placement = ["past_key_values"] _supports_flash_attn = False _supports_sdpa = True _supports_flex_attn = True ...
DogePreTrainedModel
python
plotly__plotly.py
plotly/graph_objs/isosurface/_surface.py
{ "start": 233, "end": 6708 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "isosurface" _path_str = "isosurface.surface" _valid_props = {"count", "fill", "pattern", "show"} @property def count(self): """ Sets the number of iso-surfaces between minimum and maximum iso-values. By default this va...
Surface
python
pytorch__pytorch
torch/distributed/elastic/rendezvous/api.py
{ "start": 893, "end": 987 }
class ____(Exception): """Represents the base type for rendezvous errors."""
RendezvousError
python
doocs__leetcode
solution/0600-0699/0674.Longest Continuous Increasing Subsequence/Solution2.py
{ "start": 0, "end": 304 }
class ____: def findLengthOfLCIS(self, nums: List[int]) -> int: ans, n = 1, len(nums) i = 0 while i < n: j = i + 1 while j < n and nums[j - 1] < nums[j]: j += 1 ans = max(ans, j - i) i = j return ans
Solution
python
openai__openai-python
src/openai/resources/fine_tuning/jobs/checkpoints.py
{ "start": 6713, "end": 6966 }
class ____: def __init__(self, checkpoints: AsyncCheckpoints) -> None: self._checkpoints = checkpoints self.list = _legacy_response.async_to_raw_response_wrapper( checkpoints.list, )
AsyncCheckpointsWithRawResponse
python
ApeWorX__ape
src/ape/plugins/project.py
{ "start": 198, "end": 852 }
class ____(PluginType): """ A plugin for converting files to a ``PackageManifest``. The default project plugin is the :class:`~ape.api.projects.ApeProject`. Otherwise, you can define your own project implementation for converting a set of files to a ``PackageManifest``, such as one that resolves dep...
ProjectPlugin
python
doocs__leetcode
solution/0200-0299/0265.Paint House II/Solution.py
{ "start": 0, "end": 350 }
class ____: def minCostII(self, costs: List[List[int]]) -> int: n, k = len(costs), len(costs[0]) f = costs[0][:] for i in range(1, n): g = costs[i][:] for j in range(k): t = min(f[h] for h in range(k) if h != j) g[j] += t f ...
Solution
python
mlflow__mlflow
mlflow/genai/scorers/base.py
{ "start": 904, "end": 1214 }
class ____(Enum): CLASS = "class" BUILTIN = "builtin" DECORATOR = "decorator" INSTRUCTIONS = "instructions" GUIDELINES = "guidelines" _ALLOWED_SCORERS_FOR_REGISTRATION = [ ScorerKind.BUILTIN, ScorerKind.DECORATOR, ScorerKind.INSTRUCTIONS, ScorerKind.GUIDELINES, ]
ScorerKind
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/data_structures/lookup_ops_test.py
{ "start": 42937, "end": 58790 }
class ____(BaseLookupTableTest): def _createVocabFile(self, basename, values=("brain", "salad", "surgery")): vocabulary_file = os.path.join(self.get_temp_dir(), basename) with open(vocabulary_file, "w") as f: f.write("\n".join(values) + "\n") return vocabulary_file def testStringStaticVocabulary...
StaticVocabularyTableTest
python
keras-team__keras
keras/src/layers/reshaping/cropping3d_test.py
{ "start": 190, "end": 7172 }
class ____(testing.TestCase): @parameterized.product( ( {"dim1_cropping": (1, 2), "dim1_expected": (1, 5)}, # both {"dim1_cropping": (0, 2), "dim1_expected": (0, 5)}, # left only {"dim1_cropping": (1, 0), "dim1_expected": (1, 7)}, # right only ), ( ...
Cropping3DTest
python
ray-project__ray
python/ray/serve/config.py
{ "start": 24234, "end": 27633 }
class ____(BaseModel): """HTTP options for the proxies. Supported fields: - host: Host that the proxies listens for HTTP on. Defaults to "127.0.0.1". To expose Serve publicly, you probably want to set this to "0.0.0.0". - port: Port that the proxies listen for HTTP on. Defaults to 8000. - r...
HTTPOptions
python
sqlalchemy__sqlalchemy
test/sql/test_compare.py
{ "start": 78108, "end": 78713 }
class ____(fixtures.TestBase): @testing.combinations( (select(column("a")),), (table("q", column("a")).insert(),), (table("q", column("a")).update(),), (table("q", column("a")).delete(),), (lambda_stmt(lambda: select(column("a"))),), ) def test_is_select(self, case): ...
ExecutableFlagsTest
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/metrics_test.py
{ "start": 112589, "end": 118584 }
class ____(test.TestCase): def setUp(self): self._predictions = (((0.5, 0.1, 0.6, 0.3, 0.8, 0.0, 0.7, 0.2, 0.4, 0.9), (0.3, 0.0, 0.7, 0.2, 0.4, 0.9, 0.5, 0.8, 0.1, 0.6)), ((0.3, 0.0, 0.7, 0.2, 0.4, 0.9, 0.5, 0.8, 0.1, 0.6), (0.5, 0.1, 0...
MultiLabel3dRecallAtKTest
python
kamyu104__LeetCode-Solutions
Python/maximum-font-to-fit-a-sentence-in-a-screen.py
{ "start": 403, "end": 1216 }
class ____(object): def maxFont(self, text, w, h, fonts, fontInfo): """ :type text: str :type w: int :type h: int :type fonts: List[int] :type fontInfo: FontInfo :rtype: int """ def check(count, w, h, fonts, fontInfo, x): # Time: O(1) ...
Solution
python
pola-rs__polars
py-polars/src/polars/_typing.py
{ "start": 10105, "end": 13856 }
class ____(BasicCursor): def fetchall(self, *args: Any, **kwargs: Any) -> Any: """Fetch all results.""" def fetchmany(self, *args: Any, **kwargs: Any) -> Any: """Fetch results in batches.""" AlchemyConnection: TypeAlias = Union["Connection", "Engine", "Session"] AlchemyAsyncConnection: TypeAl...
Cursor
python
PyCQA__pylint
tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_test_all.py
{ "start": 732, "end": 867 }
class ____: def __init__(self, my_param: int) -> None: # [missing-param-doc] """ My init docstring """
MyClass
python
ray-project__ray
python/ray/dashboard/modules/reporter/tests/test_gpu_providers.py
{ "start": 763, "end": 3232 }
class ____(unittest.TestCase): """Test GpuUtilizationInfo TypedDict.""" def test_creation_with_processes(self): """Test GpuUtilizationInfo with process information.""" process1 = ProcessGPUInfo(pid=1234, gpu_memory_usage=256, gpu_utilization=None) process2 = ProcessGPUInfo(pid=5678, gpu...
TestGpuUtilizationInfo
python
astropy__astropy
astropy/utils/metadata/exceptions.py
{ "start": 265, "end": 318 }
class ____(AstropyWarning): pass
MergeConflictWarning
python
airbytehq__airbyte
airbyte-integrations/connectors/source-okta/source_okta/config_migration.py
{ "start": 419, "end": 3109 }
class ____: """ This class stands for migrating the config at runtime, while providing the backward compatibility when falling back to the previous source version. """ message_repository: MessageRepository = InMemoryMessageRepository() @classmethod def should_migrate(cls, config: Mapping[s...
OktaConfigMigration
python
apache__airflow
providers/alibaba/src/airflow/providers/alibaba/cloud/sensors/analyticdb_spark.py
{ "start": 1168, "end": 2325 }
class ____(BaseSensorOperator): """ Monitor a AnalyticDB Spark session for termination. :param app_id: identifier of the monitored app depends on the option that's being modified. :param adb_spark_conn_id: reference to a pre-defined ADB Spark connection. :param region: AnalyticDB MySQL region you w...
AnalyticDBSparkSensor
python
huggingface__transformers
src/transformers/models/llava_next/modeling_llava_next.py
{ "start": 6978, "end": 8551 }
class ____(ModelOutput): r""" loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss (for next-token prediction). logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): Prediction scores of the lan...
LlavaNextCausalLMOutputWithPast
python
neetcode-gh__leetcode
python/0740-delete-and-earn.py
{ "start": 68, "end": 506 }
class ____(object): def deleteAndEarn(self, nums): """ :type nums: List[int] :rtype: int """ upperLimit = max(nums) + 1 store = [0] * upperLimit for num in nums: store[num] += num dp = [0] * upperLimit dp[1] = 1 * store[1] ...
Solution
python
getsentry__sentry
src/sentry/tasks/summaries/metrics.py
{ "start": 768, "end": 1230 }
class ____(EventLifecycleMetric): operation_type: WeeklyReportOperationType dry_run: bool def get_metric_key(self, outcome: EventLifecycleOutcome) -> str: tokens = ("weekly_report", self.operation_type, str(outcome)) return ".".join(tokens) def get_metric_tags(self) -> Mapping[str, str...
WeeklyReportSLO
python
huggingface__transformers
src/transformers/models/metaclip_2/modular_metaclip_2.py
{ "start": 33176, "end": 33576 }
class ____(CLIPForImageClassification): pass __all__ = [ "MetaClip2Config", "MetaClip2TextConfig", "MetaClip2VisionConfig", "MetaClip2Model", "MetaClip2PreTrainedModel", "MetaClip2TextModel", "MetaClip2TextModelWithProjection", "MetaClip2VisionModel", "MetaClip2VisionModelWithP...
MetaClip2ForImageClassification
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pycodestyle/E21.py
{ "start": 195, "end": 620 }
class ____ (Bar, Baz): pass def fetch_name () -> Union[str, None]: """Fetch name from --person-name in sys.argv. Returns: name of the person if available, otherwise None """ test = len(5) Logger.info(test) # test commented code # Logger.info("test code") for i in range (0, ...
Foo
python
getsentry__sentry
src/sentry/codecov/endpoints/sync_repos/sync_repos.py
{ "start": 1109, "end": 3349 }
class ____(CodecovEndpoint): owner = ApiOwner.CODECOV publish_status = { "POST": ApiPublishStatus.PUBLIC, "GET": ApiPublishStatus.PUBLIC, } permission_classes = (SyncReposPermission,) @extend_schema( operation_id="Syncs repositories from an integrated org with GitHub", ...
SyncReposEndpoint
python
pytorch__pytorch
torch/_numpy/_dtypes.py
{ "start": 2216, "end": 2315 }
class ____(floating): name = "float16" typecode = "e" torch_dtype = torch.float16
float16
python
optuna__optuna
optuna/testing/pruners.py
{ "start": 52, "end": 318 }
class ____(optuna.pruners.BasePruner): def __init__(self, is_pruning: bool) -> None: self.is_pruning = is_pruning def prune(self, study: "optuna.study.Study", trial: "optuna.trial.FrozenTrial") -> bool: return self.is_pruning
DeterministicPruner
python
airbytehq__airbyte
airbyte-integrations/connectors/source-amazon-seller-partner/unit_tests/integration/test_vendor_orders_status.py
{ "start": 2075, "end": 6189 }
class ____: @staticmethod def _read(config_: ConfigBuilder, expecting_exception: bool = False) -> EntrypointOutput: return read_output( config_builder=config_, stream_name=_STREAM_NAME, sync_mode=SyncMode.full_refresh, expecting_exception=expecting_excepti...
TestFullRefresh
python
modin-project__modin
modin/core/execution/unidist/generic/partitioning/partition_manager.py
{ "start": 1053, "end": 2293 }
class ____(PandasDataframePartitionManager): """The class implements the interface in `PandasDataframePartitionManager`.""" @classmethod def to_numpy(cls, partitions, **kwargs): """ Convert `partitions` into a NumPy array. Parameters ---------- partitions : NumPy ar...
GenericUnidistDataframePartitionManager
python
huggingface__transformers
src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py
{ "start": 27432, "end": 31871 }
class ____(nn.Module): """ Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer and "Generating Long Sequences with Sparse Transformers". """ def __init__(self, config: Qwen2_5_VLTextConfig, layer_idx: Optional[int] = None): sup...
Qwen2_5_VLAttention
python
streamlit__streamlit
lib/streamlit/elements/lib/column_config_utils.py
{ "start": 1692, "end": 16754 }
class ____(str, Enum): INTEGER = "integer" FLOAT = "float" DATE = "date" TIME = "time" DATETIME = "datetime" BOOLEAN = "boolean" STRING = "string" TIMEDELTA = "timedelta" PERIOD = "period" INTERVAL = "interval" BYTES = "bytes" DECIMAL = "decimal" COMPLEX = "complex" ...
ColumnDataKind
python
apache__airflow
providers/fab/tests/unit/fab/auth_manager/api_endpoints/test_user_endpoint.py
{ "start": 2860, "end": 4153 }
class ____: @pytest.fixture(autouse=True) def setup_attrs(self, configured_app, request) -> None: self.app = configured_app self.client = self.app.test_client() self.session = self.app.appbuilder.session # Logout the user after each request @request.addfinalizer ...
TestUserEndpoint
python
apache__airflow
task-sdk/src/airflow/sdk/definitions/callback.py
{ "start": 1045, "end": 4801 }
class ____(ABC): """ Base class for Deadline Alert callbacks. Callbacks are used to execute custom logic when a deadline is missed. The `callback_callable` can be a Python callable type or a string containing the path to the callable that can be used to import the callable. It must be a top-level ...
Callback
python
getsentry__sentry
src/sentry/api/endpoints/release_thresholds/release_threshold_details.py
{ "start": 1102, "end": 2049 }
class ____(serializers.Serializer[ReleaseThresholdPUTData]): threshold_type = serializers.ChoiceField(choices=ReleaseThresholdType.as_str_choices()) trigger_type = serializers.ChoiceField(choices=ReleaseThresholdTriggerType.as_str_choices()) value = serializers.IntegerField(required=True, min_value=0) w...
ReleaseThresholdPUTSerializer
python
doocs__leetcode
solution/0000-0099/0053.Maximum Subarray/Solution.py
{ "start": 0, "end": 199 }
class ____: def maxSubArray(self, nums: List[int]) -> int: ans = f = nums[0] for x in nums[1:]: f = max(f, 0) + x ans = max(ans, f) return ans
Solution
python
lazyprogrammer__machine_learning_examples
ann_class2/dropout_tensorflow.py
{ "start": 552, "end": 961 }
class ____(object): def __init__(self, M1, M2): self.M1 = M1 self.M2 = M2 W = np.random.randn(M1, M2) * np.sqrt(2.0 / M1) b = np.zeros(M2) self.W = tf.Variable(W.astype(np.float32)) self.b = tf.Variable(b.astype(np.float32)) self.params = [self.W, self.b] ...
HiddenLayer
python
arrow-py__arrow
arrow/locales.py
{ "start": 47573, "end": 47899 }
class ____(GermanBaseLocale, Locale): names = ["de-at"] month_names = [ "", "Jänner", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ]
AustrianLocale
python
jmcnamara__XlsxWriter
xlsxwriter/exceptions.py
{ "start": 1203, "end": 1287 }
class ____(XlsxFileError): """IO error when creating xlsx file."""
FileCreateError
python
numba__numba
numba/core/typeinfer.py
{ "start": 7930, "end": 8989 }
class ____(object): def __init__(self, target, items, loc): self.target = target self.items = items self.loc = loc def __call__(self, typeinfer): with new_error_context("typing of {container_type} at {loc}", container_type=self.container_type, ...
_BuildContainerConstraint
python
doocs__leetcode
solution/0000-0099/0067.Add Binary/Solution.py
{ "start": 0, "end": 110 }
class ____: def addBinary(self, a: str, b: str) -> str: return bin(int(a, 2) + int(b, 2))[2:]
Solution
python
ansible__ansible
hacking/create-bulk-issues.py
{ "start": 6551, "end": 6700 }
class ____(Args): tests: list[str] def run(self) -> None: deprecated_command(self) @dataclasses.dataclass(frozen=True)
DeprecationArgs
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/matchLiteral2.py
{ "start": 218, "end": 264 }
class ____: tag: Literal["b"] num: int
B
python
django__django
tests/get_or_create/models.py
{ "start": 282, "end": 390 }
class ____(models.Model): first_name = models.CharField(max_length=100, default="Anonymous")
DefaultPerson
python
walkccc__LeetCode
solutions/1736. Latest Time by Replacing Hidden Digits/1736.py
{ "start": 0, "end": 342 }
class ____: def maximumTime(self, time: str) -> str: ans = list(time) if time[0] == '?': ans[0] = '2' if time[1] == '?' or time[1] < '4' else '1' if time[1] == '?': ans[1] = '3' if ans[0] == '2' else '9' if time[3] == '?': ans[3] = '5' if time[4] == '?': ans[4] = '9' re...
Solution
python
ansible__ansible
test/integration/targets/strategy-external/ansible_collections/ns/col/plugins/strategy/external.py
{ "start": 115, "end": 161 }
class ____(LinearStrategy): ...
StrategyModule
python
sqlalchemy__sqlalchemy
test/orm/dml/test_bulk_statements.py
{ "start": 77797, "end": 81566 }
class ____(fixtures.DeclarativeMappedTest): __requires__ = ("insert_returning", "ctes_on_dml") __sparse_driver_backend__ = True @classmethod def setup_classes(cls): decl_base = cls.DeclarativeBasic class User(ComparableEntity, decl_base): __tablename__ = "users" ...
CTETest
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/operators/test_redshift_cluster.py
{ "start": 9184, "end": 11219 }
class ____: @mock.patch( "airflow.providers.amazon.aws.hooks.redshift_cluster.RedshiftHook.get_cluster_snapshot_status" ) @mock.patch.object(RedshiftHook, "conn") def test_delete_cluster_snapshot_wait(self, mock_conn, mock_get_cluster_snapshot_status): mock_get_cluster_snapshot_status.re...
TestRedshiftDeleteClusterSnapshotOperator
python
great-expectations__great_expectations
great_expectations/core/batch_spec.py
{ "start": 2037, "end": 2913 }
class ____(SerializableDotDict, BatchSpec, PandasBatchSpecProtocol): @property @override def reader_method(self) -> str: return self["reader_method"] @property @override def reader_options(self) -> dict: return self.get("reader_options", {}) @override def to_json_dict(s...
PandasBatchSpec
python
django__django
django/db/models/lookups.py
{ "start": 28166, "end": 28249 }
class ____(UUIDTextMixin, EndsWith): pass @UUIDField.register_lookup
UUIDEndsWith
python
sqlalchemy__sqlalchemy
test/aaa_profiling/test_pool.py
{ "start": 218, "end": 1367 }
class ____(fixtures.TestBase, AssertsExecutionResults): __requires__ = ("cpython", "python_profiling_backend") class Connection: def rollback(self): pass def close(self): pass def setup_test(self): # create a throwaway pool which # has the effect of...
QueuePoolTest
python
Pylons__pyramid
tests/test_wsgi.py
{ "start": 18, "end": 748 }
class ____(unittest.TestCase): def _callFUT(self, app): from pyramid.wsgi import wsgiapp return wsgiapp(app) def test_wsgiapp_none(self): self.assertRaises(ValueError, self._callFUT, None) def test_decorator(self): context = DummyContext() request = DummyRequest() ...
WSGIAppTests
python
django__django
tests/check_framework/template_test_apps/same_tags_app_1/apps.py
{ "start": 36, "end": 140 }
class ____(AppConfig): name = "check_framework.template_test_apps.same_tags_app_1"
SameTagsApp1AppConfig
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/mlengine.py
{ "start": 1504, "end": 1705 }
class ____(BaseGoogleLink): """Helper class for constructing ML Engine link.""" name = "MLEngine Model" key = "ml_engine_model" format_str = MLENGINE_MODEL_DETAILS_LINK
MLEngineModelLink
python
numpy__numpy
tools/swig/test/testTensor.py
{ "start": 324, "end": 11639 }
class ____(unittest.TestCase): def __init__(self, methodName="runTests"): unittest.TestCase.__init__(self, methodName) self.typeStr = "double" self.typeCode = "d" self.result = sqrt(28.0 / 8) # Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap def testNorm(self): "Test n...
TensorTestCase
python
weaviate__weaviate-python-client
weaviate/collections/classes/config_vector_index.py
{ "start": 9297, "end": 10452 }
class ____: Encoding = _VectorIndexMultivectorEncoding @deprecated( 'Using the "encoding" argument is deprecated. Instead, specify it at the top-level when creating your `vector_config`' ) @overload @staticmethod def multi_vector( encoding: _MultiVectorEncodingConfigCreate, ...
_VectorIndexMultiVector
python
getsentry__sentry-python
sentry_sdk/integrations/pydantic_ai/__init__.py
{ "start": 308, "end": 1232 }
class ____(Integration): identifier = "pydantic_ai" origin = f"auto.ai.{identifier}" def __init__(self, include_prompts=True): # type: (bool) -> None """ Initialize the Pydantic AI integration. Args: include_prompts: Whether to include prompts and messages in sp...
PydanticAIIntegration
python
getsentry__sentry
src/sentry/web/frontend/debug/debug_sso_link_email.py
{ "start": 889, "end": 1307 }
class ____(View): def get(self, request: HttpRequest) -> HttpResponse: context = get_context(request) context["has_password"] = True return MailPreview( text_template="sentry/emails/auth-sso-disabled.txt", html_template="sentry/emails/auth-sso-disabled.html", ...
DebugSsoUnlinkedEmailView
python
sqlalchemy__sqlalchemy
test/orm/test_relationships.py
{ "start": 13444, "end": 19811 }
class ____(fixtures.MappedTest, AssertsCompiledSQL): """Tests the ultimate join condition, a single column that points to itself, e.g. within a SQL function or similar. The test is against a materialized path setup. this is an **extremely** unusual case: .. sourcecode:: text Entity ...
DirectSelfRefFKTest
python
keras-team__keras
keras/src/distillation/distillation_loss_test.py
{ "start": 328, "end": 1248 }
class ____(TestCase): """Test cases for LogitsDistillation distillation_loss.""" def test_logits_distillation_basic(self): """Test basic logits distillation structure validation.""" # Create dummy logits teacher_logits = keras.ops.convert_to_tensor( np.array([[1.0, 2.0, 3.0]...
TestLogitsDistillation
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/diamond_link_bottom/package.py
{ "start": 217, "end": 479 }
class ____(Package): """Part of diamond-link-{top,left,right,bottom} group""" homepage = "http://www.example.com" url = "http://www.example.com/diamond-link-bottom-1.0.tar.gz" version("1.0", md5="0123456789abcdef0123456789abcdef")
DiamondLinkBottom
python
kamyu104__LeetCode-Solutions
Python/longest-strictly-increasing-or-strictly-decreasing-subarray.py
{ "start": 524, "end": 958 }
class ____(object): def longestMonotonicSubarray(self, nums): """ :type nums: List[int] :rtype: int """ result = cnt1 = cnt2 = 1 for i in xrange(1, len(nums)): cnt1 = cnt1+1 if nums[i-1] < nums[i] else 1 cnt2 = cnt2+1 if nums[i-1] > nums[i] els...
Solution2
python
openai__openai-python
src/openai/resources/beta/realtime/realtime.py
{ "start": 27581, "end": 31415 }
class ____(BaseRealtimeConnectionResource): def delete(self, *, item_id: str, event_id: str | NotGiven = NOT_GIVEN) -> None: """Send this event when you want to remove any item from the conversation history. The server will respond with a `conversation.item.deleted` event, unless th...
RealtimeConversationItemResource
python
numpy__numpy
numpy/lib/tests/test_nanfunctions.py
{ "start": 3250, "end": 9433 }
class ____: nanfuncs = [np.nanmin, np.nanmax] stdfuncs = [np.min, np.max] def test_mutation(self): # Check that passed array is not modified. ndat = _ndat.copy() for f in self.nanfuncs: f(ndat) assert_equal(ndat, _ndat) def test_keepdims(self): ...
TestNanFunctions_MinMax
python
PrefectHQ__prefect
src/prefect/settings/models/client.py
{ "start": 1230, "end": 3609 }
class ____(PrefectBaseSettings): """ Settings for controlling API client behavior """ model_config: ClassVar[SettingsConfigDict] = build_settings_config(("client",)) max_retries: int = Field( default=5, ge=0, description=""" The maximum number of retries to perform ...
ClientSettings
python
davidhalter__jedi
test/completion/usages.py
{ "start": 3101, "end": 3400 }
class ____(): def a(self): #< 13 (4,13), (0,13) self._instance_var = 3 def b(self): #< (-4,13), (0,13) self._instance_var # A call to self used to trigger an error, because it's also a trailer # with two children. self()
TestInstanceVar
python
run-llama__llama_index
llama-index-core/llama_index/core/chat_engine/condense_question.py
{ "start": 1458, "end": 14138 }
class ____(BaseChatEngine): """ Condense Question Chat Engine. First generate a standalone question from conversation context and last message, then query the query engine for a response. """ def __init__( self, query_engine: BaseQueryEngine, condense_question_prompt: B...
CondenseQuestionChatEngine
python
pytorch__pytorch
test/test_dynamic_shapes.py
{ "start": 74835, "end": 109734 }
class ____(TestCase): @skipIfTorchDynamo("mark_dynamic not supported") def test_simplify_max_1_0(self): x = torch.rand(10) torch._dynamo.mark_dynamic(x, 0, max=20, min=5) @torch.compile(fullgraph=True) def func(x, v): # test that statically_known_true if ...
TestDimConstraints