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
bokeh__bokeh
src/bokeh/colors/util.py
{ "start": 2883, "end": 3013 }
class ____(metaclass=_ColorGroupMeta): ''' Collect a group of named colors into an iterable, indexable group. '''
ColorGroup
python
numba__numba
numba/core/errors.py
{ "start": 2704, "end": 2887 }
class ____(NumbaWarning): """ Warning category for an issue with the system configuration. """ # These are needed in the color formatting of errors setup
NumbaSystemWarning
python
modin-project__modin
asv_bench/benchmarks/benchmarks.py
{ "start": 16479, "end": 16816 }
class ____: param_names = ["shape"] params = [ get_benchmark_shapes("TimeExplode"), ] def setup(self, shape): self.df = generate_dataframe( "int", *shape, RAND_LOW, RAND_HIGH, gen_unique_key=True ) def time_explode(self, shape): execute(self.df.explode("...
TimeExplode
python
pypa__warehouse
warehouse/organizations/models.py
{ "start": 24646, "end": 24840 }
class ____(enum.StrEnum): none = "" solo = "1" smol = "2-5" small = "6-10" mid = "11-25" medium = "26-50" lorge = "51-100" large = "100+"
OrganizationMembershipSize
python
python__mypy
mypy/checker.py
{ "start": 419521, "end": 423770 }
class ____(TraverserVisitor): def __init__(self, v: Var) -> None: self.last_line = -1 self.lvalue = False self.var_node = v def visit_assignment_stmt(self, s: AssignmentStmt) -> None: self.lvalue = True for lv in s.lvalues: lv.accept(self) self.lvalue...
VarAssignVisitor
python
pytorch__pytorch
torch/_dynamo/variables/misc.py
{ "start": 44982, "end": 45353 }
class ____(VariableTracker): def __init__(self, fn, **kwargs) -> None: super().__init__(**kwargs) self.fn = fn def call_function( self, tx: "InstructionTranslator", args: "list[VariableTracker]", kwargs: "dict[str, VariableTracker]", ) -> "VariableTracker": ...
LambdaVariable
python
great-expectations__great_expectations
tests/integration/test_utils/data_source_config/snowflake.py
{ "start": 1639, "end": 3578 }
class ____(BaseSettings): """This class retrieves these values from the environment. If you're testing locally, you can use your Snowflake creds and test against your own Snowflake account. Supports both password and key-pair authentication: - For password auth: Set SNOWFLAKE_USER and SNOWFLAKE_PW ...
SnowflakeConnectionConfig
python
rapidsai__cudf
python/cudf/cudf/core/dataframe.py
{ "start": 14690, "end": 14750 }
class ____(_DataFrameLocIndexer): pass
_DataFrameAtIndexer
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 27106, "end": 27170 }
class ____(str, Enum): DATETIME = "datetime"
DatetimeIndexType
python
getsentry__sentry
tests/sentry/issues/endpoints/test_organization_group_search_view_visit.py
{ "start": 322, "end": 4141 }
class ____(GroupSearchViewAPITestCase): endpoint = "sentry-api-0-organization-group-search-view-visit" method = "post" def setUp(self) -> None: self.login_as(user=self.user) self.view = self.create_view(self.user) self.url = reverse( "sentry-api-0-organization-group-sea...
OrganizationGroupSearchViewVisitTest
python
getsentry__sentry
src/sentry/replays/usecases/query/conditions/activity.py
{ "start": 164, "end": 2132 }
class ____(ComputedBase): """Activity scalar condition class.""" @staticmethod def visit_eq(value: int) -> Condition: return Condition(aggregate_activity(), Op.EQ, value) @staticmethod def visit_neq(value: int) -> Condition: return Condition(aggregate_activity(), Op.NEQ, value) ...
AggregateActivityScalar
python
jazzband__django-simple-history
simple_history/registry_tests/migration_test_app/models.py
{ "start": 1449, "end": 1706 }
class ____(models.Model): what_i_mean = CustomAttrNameOneToOneField( WhatIMean, models.CASCADE, attr_name="custom_attr_name" ) history = HistoricalRecords(excluded_field_kwargs={"what_i_mean": {"attr_name"}})
ModelWithCustomAttrOneToOneField
python
pallets__werkzeug
src/werkzeug/datastructures/structures.py
{ "start": 3595, "end": 4212 }
class ____(ImmutableDictMixin[K, V], TypeConversionDict[K, V]): # type: ignore[misc] """Works like a :class:`TypeConversionDict` but does not support modifications. .. versionadded:: 0.5 """ def copy(self) -> TypeConversionDict[K, V]: """Return a shallow mutable copy of this object. Keep...
ImmutableTypeConversionDict
python
jazzband__tablib
src/tablib/_vendor/dbfpy/dbf.py
{ "start": 2144, "end": 9220 }
class ____: """DBF accessor. FIXME: docs and examples needed (dont' forget to tell about problems adding new fields on the fly) Implementation notes: ``_new`` field is used to indicate whether this is a new data table. `addField` could be used only for the new table...
Dbf
python
google__jax
tests/metadata_test.py
{ "start": 1053, "end": 4169 }
class ____(jtu.JaxTestCase): def test_jit_metadata(self): hlo = module_to_string(jax.jit(jnp.sin).lower(1.).compiler_ir()) self.assertRegex(hlo, r'loc\("jit\(sin\)/sin"') def foo(x): return jnp.sin(x) hlo = module_to_string(jax.jit(foo).lower(1.).compiler_ir()) self.assertRegex(hlo, r'loc\(...
MetadataTest
python
google__pytype
pytype/pytd/pytd.py
{ "start": 3596, "end": 3963 }
class ____(Node): """An alias (symbolic link) for a class implemented in some other module. Unlike Constant, the Alias is the same type, as opposed to an instance of that type. It's generated, among others, from imports - e.g. "from x import y as z" will create a local alias "z" for "x.y". """ name: str ...
Alias
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pie/PIE794.py
{ "start": 561, "end": 679 }
class ____: bar: str = StringField() foo: bool = BooleanField() # ... bar = StringField() # PIE794
User
python
OmkarPathak__pygorithm
tests/test_pathing.py
{ "start": 138, "end": 465 }
class ____(unittest.TestCase): # https://hackernoon.com/timing-tests-in-python-for-fun-and-profit-1663144571 def setUp(self): self._started_at = time.time() def tearDown(self): elapsed = time.time() - self._started_at print('{} ({}s)'.format(self.id(), round(elapsed, 2)))
TimedTestCase
python
spack__spack
lib/spack/spack/repo.py
{ "start": 17198, "end": 17978 }
class ____(Indexer): """Lifecycle methods for patch cache.""" def _create(self) -> spack.patch.PatchCache: return spack.patch.PatchCache(repository=self.repository) def needs_update(self): # TODO: patches can change under a package and we should handle # TODO: it, but we currently ...
PatchIndexer
python
pyqtgraph__pyqtgraph
pyqtgraph/parametertree/parameterTypes/checklist.py
{ "start": 320, "end": 3691 }
class ____(GroupParameterItem): """ Wraps a :class:`GroupParameterItem` to manage ``bool`` parameter children. Also provides convenience buttons to select or clear all values at once. Note these conveniences are disabled when ``exclusive`` is *True*. """ def __init__(self, param, depth): sel...
ChecklistParameterItem
python
getsentry__sentry
tests/sentry/workflow_engine/test_transformers.py
{ "start": 280, "end": 935 }
class ____(TestCase): def test_action_target_strings(self) -> None: targets = [ActionTarget.USER, ActionTarget.TEAM, ActionTarget.ISSUE_OWNERS] result = action_target_strings(targets) expected = ["user", "team", "issue_owners"] assert result == expected def test_action_target_s...
TestActionTargetStrings
python
pydantic__pydantic
tests/mypy/modules/from_orm_v1_noconflict.py
{ "start": 506, "end": 653 }
class ____(BaseModelV1): class Config: orm_mode = True strict = True x: int cmv1 = CustomModelV1.from_orm(obj)
CustomModelV1
python
huggingface__transformers
src/transformers/models/qwen3_vl/modeling_qwen3_vl.py
{ "start": 7341, "end": 10690 }
class ____(nn.Module): def __init__(self, config: Qwen3VLVisionConfig) -> None: super().__init__() self.dim = config.hidden_size self.num_heads = config.num_heads self.head_dim = self.dim // self.num_heads self.num_key_value_groups = 1 # needed for eager attention se...
Qwen3VLVisionAttention
python
realpython__materials
python-closure/roots.py
{ "start": 303, "end": 668 }
class ____: def __init__(self, root_degree, precision=2): self.root_degree = root_degree self.precision = precision def __call__(self, number): return round(pow(number, 1 / self.root_degree), self.precision) square_root = RootCalculator(2, 4) print(square_root(42)) cubic_root = RootC...
RootCalculator
python
getsentry__sentry
src/sentry/models/debugfile.py
{ "start": 14235, "end": 22615 }
class ____(enum.Enum): """The different kind of DIF files we can handle.""" Object = enum.auto() BcSymbolMap = enum.auto() UuidMap = enum.auto() Il2Cpp = enum.auto() DartSymbolMap = enum.auto() # TODO(flub): should we include proguard? The tradeoff is that we'd be matching the # regex ...
DifKind
python
numba__numba
numba/cpython/listobj.py
{ "start": 4809, "end": 15058 }
class ____(_ListPayloadMixin): def __init__(self, context, builder, list_type, list_val): self._context = context self._builder = builder self._ty = list_type self._list = context.make_helper(builder, list_type, list_val) self._itemsize = get_itemsize(context, list_type) ...
ListInstance
python
mitmproxy__pdoc
test/testdata/demo_long.py
{ "start": 5523, "end": 5759 }
class ____(Foo, Bar.Baz, abc.ABC): """This is an example of a class that inherits from multiple parent classes.""" CONST_B = "yes" """A constant without type annotation""" CONST_NO_DOC = "SHOULD NOT APPEAR" @dataclass
DoubleInherit
python
mitmproxy__pdoc
pdoc/web.py
{ "start": 603, "end": 3765 }
class ____(http.server.BaseHTTPRequestHandler): """A handler for individual requests.""" server: DocServer """A reference to the main web server.""" def do_HEAD(self): try: return self.handle_request() except ConnectionError: # pragma: no cover pass def do...
DocHandler
python
dagster-io__dagster
python_modules/dagster/dagster/_core/pipes/utils.py
{ "start": 2499, "end": 3650 }
class ____(PipesContextInjector): """Context injector that injects context data into the external process by writing it to an automatically-generated temporary file. """ @contextmanager def inject_context(self, context: "PipesContextData") -> Iterator[PipesParams]: # pyright: ignore[reportIncompat...
PipesTempFileContextInjector
python
doocs__leetcode
solution/2800-2899/2892.Minimizing Array After Replacing Pairs With Their Product/Solution.py
{ "start": 0, "end": 315 }
class ____: def minArrayLength(self, nums: List[int], k: int) -> int: ans, y = 1, nums[0] for x in nums[1:]: if x == 0: return 1 if x * y <= k: y *= x else: y = x ans += 1 return ans
Solution
python
apache__airflow
airflow-core/tests/unit/jobs/test_scheduler_job.py
{ "start": 323847, "end": 332997 }
class ____: """ These tests are designed to detect changes in the number of queries for different DAG files. These tests allow easy detection when a change is made that affects the performance of the SchedulerJob. """ scheduler_job: Job | None @staticmethod def clean_db(): clea...
TestSchedulerJobQueriesCount
python
apache__airflow
dev/breeze/src/airflow_breeze/utils/packages.py
{ "start": 2304, "end": 2392 }
class ____(NamedTuple): name: str package_name: str class_name: str
PluginInfo
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 373144, "end": 373457 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") node = sgqlc.types.Field("Milestone", graphql_name="node")
MilestoneEdge
python
davidhalter__jedi
test/completion/classes.py
{ "start": 172, "end": 588 }
class ____(): #? [] TestClass.ret if a: #? [] TestClass.ret def find_class(self): #? ['ret'] TestClass.ret if 1: #? ['ret'] TestClass.ret #? [] FindClass().find_class.self #? [] FindClass().find_class.self.find_class # set variables, whi...
FindClass
python
facebook__pyre-check
client/commands/tests/statistics_test.py
{ "start": 616, "end": 2941 }
class ____(testslide.TestCase): def assert_counts( self, source: str, expected_codes: Dict[int, List[int]], expected_no_codes: List[int], ) -> None: source_module = parse_code(source.replace("FIXME", "pyre-fixme")) result = statistics.FixmeCountCollector().collect...
FixmeCountCollectorTest
python
pyparsing__pyparsing
examples/tiny/tiny_ast.py
{ "start": 16944, "end": 17628 }
class ____(TinyNode): """Return statement node. Evaluates the optional expression and raises `ReturnPropagate` to unwind to the nearest function/main boundary with the computed value (or None). """ statement_type: ClassVar[str] = "return_stmt" expr: Optional[object] = None @classmethod ...
ReturnStmtNode
python
Delgan__loguru
tests/test_add_option_enqueue.py
{ "start": 308, "end": 471 }
class ____: def __getstate__(self): raise TypeError("You shall not serialize me!") def __setstate__(self, state): pass
NotPicklableTypeError
python
django__django
tests/multiple_database/tests.py
{ "start": 86354, "end": 86614 }
class ____: "A router to ensure model arguments are real model classes" def db_for_write(self, model, **hints): if not hasattr(model, "_meta"): raise ValueError @override_settings(DATABASE_ROUTERS=[ModelMetaRouter()])
ModelMetaRouter
python
getsentry__sentry
src/sentry/users/api/parsers/userrole.py
{ "start": 74, "end": 554 }
class ____(serializers.Serializer[None]): name = serializers.CharField() permissions = serializers.ListField(child=serializers.CharField(), required=False) def validate_permissions(self, value: str) -> str: if not value: return value for name in value: if name not i...
UserRoleValidator
python
django__django
tests/queries/test_contains.py
{ "start": 99, "end": 2532 }
class ____(TestCase): @classmethod def setUpTestData(cls): cls.category = DumbCategory.objects.create() cls.proxy_category = ProxyCategory.objects.create() def test_unsaved_obj(self): msg = "QuerySet.contains() cannot be used on unsaved objects." with self.assertRaisesMessag...
ContainsTests
python
getsentry__sentry
src/sentry/preprod/api/models/project_preprod_build_details_models.py
{ "start": 2641, "end": 8629 }
class ____(BaseModel): id: str state: PreprodArtifact.ArtifactState app_info: BuildDetailsAppInfo vcs_info: BuildDetailsVcsInfo size_info: SizeInfo | None = None def platform_from_artifact_type(artifact_type: PreprodArtifact.ArtifactType) -> Platform: match artifact_type: case PreprodA...
BuildDetailsApiResponse
python
pytorch__pytorch
tools/experimental/torchfuzz/operators/layout.py
{ "start": 12621, "end": 15904 }
class ____(LayoutOperatorBase): """Operator for torch.unsqueeze() operation.""" def __init__(self): """Initialize UnsqueezeOperator.""" super().__init__("unsqueeze") @property def torch_op_name(self) -> str | None: """Return the torch operation name.""" return "torch.un...
UnsqueezeOperator
python
getsentry__sentry
src/sentry/digests/types.py
{ "start": 1536, "end": 1757 }
class ____(NamedTuple): key: str value: NotificationWithRuleObjects timestamp: float @property def datetime(self) -> datetime_mod.datetime: return to_datetime(self.timestamp)
RecordWithRuleObjects
python
huggingface__transformers
src/transformers/models/led/modeling_led.py
{ "start": 32128, "end": 33317 }
class ____(nn.Module): def __init__(self, config, layer_id): super().__init__() self.longformer_self_attn = LEDEncoderSelfAttention(config, layer_id=layer_id) self.output = nn.Linear(config.d_model, config.d_model) def forward( self, hidden_states: torch.Tensor, ...
LEDEncoderAttention
python
apache__airflow
providers/atlassian/jira/tests/unit/atlassian/jira/hooks/test_jira.py
{ "start": 2780, "end": 6602 }
class ____: @pytest.fixture def setup_connections(self, create_connection_without_db): create_connection_without_db( Connection( conn_id="jira_default", conn_type="jira", host="http://test.atlassian.net", login="login", ...
TestJiraAsyncHook
python
huggingface__transformers
src/transformers/models/bit/modeling_bit.py
{ "start": 21012, "end": 22028 }
class ____(PreTrainedModel): config: BitConfig base_model_prefix = "bit" input_modalities = ("image",) main_input_name = "pixel_values" _no_split_modules = ["BitEmbeddings"] @torch.no_grad() def _init_weights(self, module): if isinstance(module, nn.Conv2d): init.kaiming_...
BitPreTrainedModel
python
kamyu104__LeetCode-Solutions
Python/shortest-palindrome.py
{ "start": 56, "end": 694 }
class ____(object): def shortestPalindrome(self, s): """ :type s: str :rtype: str """ def getPrefix(pattern): prefix = [-1] * len(pattern) j = -1 for i in xrange(1, len(pattern)): while j > -1 and pattern[j+1] != pattern[i]:...
Solution
python
django__django
tests/bulk_create/models.py
{ "start": 1034, "end": 1073 }
class ____(Restaurant): pass
Pizzeria
python
huggingface__transformers
src/transformers/models/aya_vision/modular_aya_vision.py
{ "start": 3790, "end": 9509 }
class ____(LlavaModel): # Unlike LLaVA, the model doesn't have to deal with Pixtral-style image states def get_image_features( self, pixel_values: torch.FloatTensor, vision_feature_layer: Optional[Union[int, list[int]]] = None, vision_feature_select_strategy: Optional[str] = None...
AyaVisionModel
python
crytic__slither
slither/detectors/statements/assert_state_change.py
{ "start": 1775, "end": 3484 }
class ____(AbstractDetector): """ Assert state change """ ARGUMENT = "assert-state-change" HELP = "Assert state change" IMPACT = DetectorClassification.INFORMATIONAL CONFIDENCE = DetectorClassification.HIGH WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#assert-st...
AssertStateChange
python
pandas-dev__pandas
pandas/tests/series/indexing/test_setitem.py
{ "start": 14962, "end": 15566 }
class ____: def test_setitem_callable_key(self): # GH#12533 ser = Series([1, 2, 3, 4], index=list("ABCD")) ser[lambda x: "A"] = -1 expected = Series([-1, 2, 3, 4], index=list("ABCD")) tm.assert_series_equal(ser, expected) def test_setitem_callable_other(self): #...
TestSetitemCallable
python
getsentry__sentry
src/sentry/integrations/discord/message_builder/base/base.py
{ "start": 440, "end": 638 }
class ____(TypedDict): content: str components: NotRequired[list[DiscordMessageComponentDict]] embeds: NotRequired[list[DiscordMessageEmbedDict]] flags: NotRequired[int]
DiscordMessage
python
ansible__ansible
test/lib/ansible_test/_internal/util_common.py
{ "start": 2930, "end": 4126 }
class ____: """Test result type.""" BOT: ResultType = None COVERAGE: ResultType = None DATA: ResultType = None JUNIT: ResultType = None LOGS: ResultType = None REPORTS: ResultType = None TMP: ResultType = None @staticmethod def _populate() -> None: ResultType.BOT = Resu...
ResultType
python
joblib__joblib
joblib/compressor.py
{ "start": 5514, "end": 5648 }
class ____(LZMACompressorWrapper): prefix = _XZ_PREFIX extension = ".xz" _lzma_format_name = "FORMAT_XZ"
XZCompressorWrapper
python
django__django
tests/admin_checks/tests.py
{ "start": 726, "end": 1076 }
class ____(admin.ModelAdmin): def get_form(self, request, obj=None, **kwargs): class ExtraFieldForm(SongForm): name = forms.CharField(max_length=50) return ExtraFieldForm fieldsets = ( ( None, { "fields": ("name",), }, ...
ValidFormFieldsets
python
sympy__sympy
sympy/assumptions/predicates/matrices.py
{ "start": 844, "end": 1787 }
class ____(Predicate): """ Symmetric matrix predicate. Explanation =========== ``Q.symmetric(x)`` is true iff ``x`` is a square matrix and is equal to its transpose. Every square diagonal matrix is a symmetric matrix. Examples ======== >>> from sympy import Q, ask, MatrixSymbol ...
SymmetricPredicate
python
nedbat__coveragepy
tests/test_process.py
{ "start": 48267, "end": 49568 }
class ____(CoverageTest): """Tests of what happens when the current directory is deleted.""" BUG_806 = """\ import os import sys import tempfile tmpdir = tempfile.mkdtemp() os.chdir(tmpdir) os.rmdir(tmpdir) print(sys.argv[1]) """ def test_re...
YankedDirectoryTest
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/constrainedTypeVar15.py
{ "start": 209, "end": 282 }
class ____: ... _T = TypeVar("_T", int | float, ClassA) @dataclass
ClassA
python
ansible__ansible
test/integration/targets/collections/collections/ansible_collections/testns/content_adj/plugins/vars/custom_adj_vars.py
{ "start": 1249, "end": 1471 }
class ____(BaseVarsPlugin): def get_vars(self, loader, path, entities, cache=True): super(VarsModule, self).get_vars(loader, path, entities) return {'collection': 'adjacent', 'adj_var': 'value'}
VarsModule
python
django__django
tests/migrations/test_migrations_squashed_replaced_order/app1/0001_squashed_initial.py
{ "start": 35, "end": 195 }
class ____(migrations.Migration): initial = True replaces = [ ("app1", "0001_initial"), ] dependencies = [] operations = []
Migration
python
aio-libs__aiohttp
tests/test_cookiejar.py
{ "start": 14710, "end": 62304 }
class ____: @pytest.fixture(autouse=True) def setup_cookies( self, cookies_to_send_with_expired: SimpleCookie, cookies_to_receive: SimpleCookie, ) -> None: self.cookies_to_send = cookies_to_send_with_expired self.cookies_to_receive = cookies_to_receive def reques...
TestCookieJarSafe
python
django__django
tests/admin_widgets/models.py
{ "start": 2031, "end": 2166 }
class ____(models.Manager): def get_queryset(self): return super().get_queryset().filter(hidden=False)
HiddenInventoryManager
python
has2k1__plotnine
plotnine/themes/themeable.py
{ "start": 62390, "end": 62578 }
class ____(themeable): """ Vertical spacing between two entries in a legend Parameters ---------- theme_element : int Size in points """
legend_key_spacing_y
python
apache__airflow
providers/apache/livy/src/airflow/providers/apache/livy/hooks/livy.py
{ "start": 1752, "end": 16783 }
class ____(HttpHook): """ Hook for Apache Livy through the REST API. :param livy_conn_id: reference to a pre-defined Livy Connection. :param extra_options: A dictionary of options passed to Livy. :param extra_headers: A dictionary of headers passed to the HTTP request to livy. :param auth_type:...
LivyHook
python
pypa__pip
src/pip/_vendor/packaging/markers.py
{ "start": 1339, "end": 8462 }
class ____(TypedDict): implementation_name: str """The implementation's identifier, e.g. ``'cpython'``.""" implementation_version: str """ The implementation's version, e.g. ``'3.13.0a2'`` for CPython 3.13.0a2, or ``'7.3.13'`` for PyPy3.10 v7.3.13. """ os_name: str """ The valu...
Environment
python
h5py__h5py
h5py/tests/test_dataset_swmr.py
{ "start": 1614, "end": 4060 }
class ____(TestCase): """ Testing SWMR functions when reading a dataset. Skip this test if the HDF5 library does not have the SWMR features. """ def setUp(self): """ First setup a file with a small chunked and empty dataset. No data written yet. """ # Note that when cre...
TestDatasetSwmrWrite
python
langchain-ai__langchain
libs/core/langchain_core/prompts/chat.py
{ "start": 22090, "end": 22290 }
class ____(_StringImageMessagePromptTemplate): """Human message prompt template. This is a message sent from the user.""" _msg_class: type[BaseMessage] = HumanMessage
HumanMessagePromptTemplate
python
numba__numba
numba/core/typing/npdatetime.py
{ "start": 4611, "end": 5156 }
class ____(TimedeltaDivOp): key = operator.floordiv if numpy_version >= (1, 25): @infer_global(operator.eq) class TimedeltaCmpEq(TimedeltaOrderedCmpOp): key = operator.eq @infer_global(operator.ne) class TimedeltaCmpNe(TimedeltaOrderedCmpOp): key = operator.ne else: @infer_glob...
TimedeltaFloorDiv
python
tensorflow__tensorflow
tensorflow/python/tpu/tests/tpu_embedding_v2_correctness_hd_ragged_training_test.py
{ "start": 954, "end": 1440 }
class ____( tpu_embedding_v2_correctness_base_test.TPUEmbeddingCorrectnessBaseTest): @parameterized.parameters( ['sgd', 'adagrad', 'adam', 'ftrl', 'adagrad_momentum']) def test_embedding(self, optimizer_name): if optimizer_name != 'sgd': self.skip_if_oss() self._test_embedding( opti...
TPUEmbeddingCorrectnessTest
python
wandb__wandb
wandb/sdk/artifacts/_generated/registry_collections.py
{ "start": 1034, "end": 1464 }
class ____(GQLResult): node: Optional[RegistryCollectionFragment] RegistryCollections.model_rebuild() RegistryCollectionsOrganization.model_rebuild() RegistryCollectionsOrganizationOrgEntity.model_rebuild() RegistryCollectionsOrganizationOrgEntityArtifactCollections.model_rebuild() RegistryCollectionsOrganization...
RegistryCollectionsOrganizationOrgEntityArtifactCollectionsEdges
python
django__django
tests/field_defaults/models.py
{ "start": 520, "end": 738 }
class ____(models.Model): headline = models.CharField(max_length=100, default="Default headline") pub_date = models.DateTimeField(default=datetime.now) def __str__(self): return self.headline
Article
python
scikit-image__scikit-image
src/skimage/measure/fit.py
{ "start": 1192, "end": 5842 }
class ____: """Implement common methods for model classes. This class can be removed when we expire deprecations of ``estimate`` method, and `params` arguments to ``predict*`` methods. Note that each inheriting class will need to implement ``_params2init_values``, that breaks up the ``params`` vec...
_BaseModel
python
kamyu104__LeetCode-Solutions
Python/count-number-of-rectangles-containing-each-point.py
{ "start": 135, "end": 691 }
class ____(object): def countRectangles(self, rectangles, points): """ :type rectangles: List[List[int]] :type points: List[List[int]] :rtype: List[int] """ max_y = max(y for _, y in rectangles) buckets = [[] for _ in xrange(max_y+1)] for x, y in recta...
Solution
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/slots3.py
{ "start": 337, "end": 500 }
class ____: foo = MyDescriptor(slot="_foo_descriptor") __slots__ = "_foo_descriptor" def __init__(self, foo: int) -> None: self.foo = foo
ClassA
python
getsentry__sentry
src/sentry/api/endpoints/organization_events.py
{ "start": 3293, "end": 3439 }
class ____(TypedDict): data: list[dict[str, Any]] meta: EventsMeta @extend_schema(tags=["Discover"]) @region_silo_endpoint
EventsApiResponse
python
PyCQA__pylint
tests/functional/t/too/too_few_public_methods.py
{ "start": 380, "end": 477 }
class ____(Klass): """We shouldn't emit too-few-public-methods for this."""
EnoughPublicMethods
python
donnemartin__interactive-coding-challenges
arrays_strings/unique_chars/test_unique_chars.py
{ "start": 18, "end": 849 }
class ____(unittest.TestCase): def test_unique_chars(self, func): self.assertEqual(func(None), False) self.assertEqual(func(''), True) self.assertEqual(func('foo'), False) self.assertEqual(func('bar'), True) print('Success: test_unique_chars') def main(): test = TestUn...
TestUniqueChars
python
spyder-ide__spyder
spyder/plugins/editor/panels/utils.py
{ "start": 423, "end": 2446 }
class ____: """Internal representation of a code folding region.""" def __init__(self, text, fold_range): self.text = text self.fold_range = fold_range self.id = str(uuid.uuid4()) self.index = None self.nesting = 0 self.children = [] self.status = False ...
FoldingRegion
python
openai__openai-python
src/openai/lib/streaming/_assistants.py
{ "start": 17702, "end": 33977 }
class ____: text_deltas: AsyncIterable[str] """Iterator over just the text deltas in the stream. This corresponds to the `thread.message.delta` event in the API. ```py async for text in stream.text_deltas: print(text, end="", flush=True) print() ``` """ def __init__(se...
AsyncAssistantEventHandler
python
getsentry__sentry
tests/snuba/api/endpoints/test_organization_events_stats_span_metrics.py
{ "start": 13243, "end": 14244 }
class ____( OrganizationEventsStatsSpansMetricsEndpointTest ): def setUp(self) -> None: super().setUp() self.features["organizations:use-metrics-layer"] = True @patch("sentry.snuba.metrics.datasource") def test_metrics_layer_is_not_used(self, get_series: MagicMock) -> None: self...
OrganizationEventsStatsSpansMetricsEndpointTestWithMetricLayer
python
pytorch__pytorch
test/inductor/test_custom_post_grad_passes.py
{ "start": 842, "end": 2079 }
class ____(TestCase): def _clone_inputs(self, inputs): def clone(x): if not isinstance(x, torch.Tensor): return x return x.clone() return tuple(clone(x) for x in inputs) def _test_common( self, mod, inputs, matcher_count, ...
TestCustomPassBase
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-mbox/llama_index/readers/mbox/base.py
{ "start": 278, "end": 1236 }
class ____(BaseReader): """ Mbox e-mail reader. Reads a set of e-mails saved in the mbox format. """ def __init__(self) -> None: """Initialize.""" def load_data(self, input_dir: str, **load_kwargs: Any) -> List[Document]: """ Load data from the input directory. ...
MboxReader
python
getsentry__sentry
src/sentry/plugins/providers/integration_repository.py
{ "start": 1223, "end": 1359 }
class ____(TypedDict): name: str external_id: str url: str config: dict[str, Any] integration_id: int
RepositoryConfig
python
chroma-core__chroma
chromadb/quota/__init__.py
{ "start": 317, "end": 632 }
class ____(str, Enum): CREATE_DATABASE = "create_database" CREATE_COLLECTION = "create_collection" LIST_COLLECTIONS = "list_collections" UPDATE_COLLECTION = "update_collection" ADD = "add" GET = "get" DELETE = "delete" UPDATE = "update" UPSERT = "upsert" QUERY = "query"
Action
python
django__django
tests/model_forms/models.py
{ "start": 10717, "end": 10839 }
class ____(models.Model): name = models.CharField(max_length=50) colors = models.ManyToManyField(Color)
ColorfulItem
python
fastai__fastai
fastai/callback/core.py
{ "start": 8209, "end": 9406 }
class ____(Callback): "A callback to fetch predictions during the training loop" remove_on_fetch = True def __init__(self, ds_idx:int=1, # Index of dataset, 0 for train, 1 for valid, used if `dl` is not present dl:DataLoader=None, # `DataLoader` used for fetching `Learner` predictions ...
FetchPredsCallback
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1062135, "end": 1062911 }
class ____(sgqlc.types.Type, Node): """Represents a 'auto_rebase_enabled' event on a given pull request.""" __schema__ = github_schema __field_names__ = ("actor", "created_at", "enabler", "pull_request") actor = sgqlc.types.Field(Actor, graphql_name="actor") """Identifies the actor who performed th...
AutoRebaseEnabledEvent
python
google__jax
tests/multiprocess/key_value_store_test.py
{ "start": 727, "end": 5028 }
class ____(jt_multiprocess.MultiProcessTest): def testBlockingKeyValueGet(self): client = distributed.global_state.client key = 'test_key' expected_value = 'JAX is great!' timeout_in_ms = 1000 if jax.process_index() == 0: client.key_value_set(key, expected_value) actual_value = client.b...
KeyValueStoreTest
python
ethereum__web3.py
web3/tools/benchmark/node.py
{ "start": 406, "end": 3258 }
class ____: def __init__(self) -> None: self.rpc_port = self._rpc_port() self.endpoint_uri = self._endpoint_uri() self.geth_binary = self._geth_binary() def build(self) -> Generator[Any, None, None]: with TemporaryDirectory() as base_dir: zipfile_path = os.path.abspa...
GethBenchmarkFixture
python
PyCQA__pylint
tests/functional/u/unexpected_special_method_signature.py
{ "start": 1020, "end": 1183 }
class ____: def __enter__(self): return self def __exit__(self, exc_type): # [unexpected-special-method-signature] pass
FirstBadContextManager
python
rapidsai__cudf
python/cudf/cudf/core/udf/strings_typing.py
{ "start": 4519, "end": 6423 }
class ____(AbstractTemplate): def generic(self, args, kws): if isinstance(args[0], ManagedUDFString): return nb_signature(types.void, managed_udf_string) def register_stringview_binaryop(op, retty): """ Helper function wrapping numba's low level extension API. Provides the boilerpl...
NRT_decref_typing
python
django-extensions__django-extensions
tests/management/commands/shell_plus_tests/test_collision_resolver.py
{ "start": 1414, "end": 18506 }
class ____(AutomaticShellPlusImportsTestCase): def _assert_models_present_under_names( self, group, group_col, name, name_col, note, note_col, system_user, unique_model, permission, test_app_permission, unique_test_app_m...
CRTestCase
python
django__django
tests/test_utils/tests.py
{ "start": 68193, "end": 68277 }
class ____: urlpatterns = [path("first/", empty_response, name="first")]
FirstUrls
python
pytorch__pytorch
test/dynamo/test_optimizers.py
{ "start": 867, "end": 3393 }
class ____(torch._dynamo.test_case.TestCase): # https://github.com/pytorch/torchdynamo/issues/1604 def test_optimizing_over_tensor_with_requires_grad(self): class Net(torch.nn.Module): def forward(self, x, y): z = torch.bmm(x, y) z = torch.flatten(z, 1) ...
End2EndTests
python
getsentry__sentry
tests/sentry/utils/test_event_frames.py
{ "start": 10337, "end": 13288 }
class ____(unittest.TestCase): def test_simple(self) -> None: exception_frame = { "function": "main", "symbol": "main", "package": "SampleProject", "filename": "AppDelegate.swift", "abs_path": "/Users/gszeto/code/SwiftySampleProject/SampleProject/C...
CocoaFilenameMungingTestCase
python
gevent__gevent
src/greentest/3.13/test_threading.py
{ "start": 53368, "end": 59690 }
class ____(BaseTestCase): def pipe(self): r, w = os.pipe() self.addCleanup(os.close, r) self.addCleanup(os.close, w) if hasattr(os, 'set_blocking'): os.set_blocking(r, False) return (r, w) def test_threads_join(self): # Non-daemon threads should be jo...
SubinterpThreadingTests
python
huggingface__transformers
tests/models/vjepa2/test_modeling_vjepa2.py
{ "start": 1521, "end": 4662 }
class ____: def __init__( self, parent, batch_size=2, image_size=16, patch_size=16, num_channels=3, hidden_size=32, num_hidden_layers=2, num_attention_heads=2, num_frames=2, mlp_ratio=1, pred_hidden_size=32, pred...
VJEPA2ModelTester
python
ray-project__ray
rllib/evaluation/rollout_worker.py
{ "start": 5032, "end": 80405 }
class ____(ParallelIteratorWorker, EnvRunner): """Common experience collection class. This class wraps a policy instance and an environment class to collect experiences from the environment. You can create many replicas of this class as Ray actors to scale RL training. This class supports vectoriz...
RolloutWorker
python
astropy__astropy
astropy/time/formats.py
{ "start": 33165, "end": 33534 }
class ____(TimeFromEpoch): """ Chandra X-ray Center seconds from 1998-01-01 00:00:00 TT. For example, 63072064.184 is midnight on January 1, 2000. """ name = "cxcsec" unit = 1.0 / erfa.DAYSEC # in days (1 day == 86400 seconds) epoch_val = "1998-01-01 00:00:00" epoch_val2 = None epo...
TimeCxcSec
python
mkdocs__mkdocs
mkdocs/tests/config/config_options_tests.py
{ "start": 26357, "end": 30397 }
class ____(TestCase): def test_int_type(self) -> None: class Schema(Config): option = c.DictOfItems(c.Type(int)) conf = self.get_config(Schema, {'option': {"a": 1, "b": 2}}) assert_type(conf.option, Dict[str, int]) self.assertEqual(conf.option, {"a": 1, "b": 2}) ...
DictOfItemsTest