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
Textualize__textual
tests/test_focus.py
{ "start": 380, "end": 470 }
class ____(Widget, can_focus=False, can_focus_children=True): pass
ChildrenFocusableOnly
python
walkccc__LeetCode
solutions/517. Super Washing Machines/517.py
{ "start": 0, "end": 343 }
class ____: def findMinMoves(self, machines: list[int]) -> int: dresses = sum(machines) if dresses % len(machines) != 0: return -1 ans = 0 average = dresses // len(machines) inout = 0 for dress in machines: inout += dress - average ans = max(ans, abs(inout), dress - averag...
Solution
python
google__pytype
pytype/pytd/pytd.py
{ "start": 9427, "end": 9928 }
class ____(Node): """Represents a parameter of a function definition. Attributes: name: The name of the parameter. type: The type of the parameter. kind: The kind of parameter (e.g., ParameterKind.KWONLY). optional: If the parameter is optional. mutated_type: The type the parameter will have af...
Parameter
python
pytorch__pytorch
torch/utils/checkpoint.py
{ "start": 56384, "end": 58069 }
class ____(TorchDispatchMode): @classmethod def ignore_compile_internals(cls): return True # Used together with _CachedTorchDispatchMode to implement SAC. def __init__(self, policy_fn, storage) -> None: self.policy_fn = policy_fn self.storage = storage def __torch_dispatch_...
_CachingTorchDispatchMode
python
dagster-io__dagster
python_modules/dagster/dagster/_core/remote_representation/external_data.py
{ "start": 31002, "end": 32517 }
class ____(IHaveNew): """Serializable data associated with an asset check.""" name: str asset_key: AssetKey description: Optional[str] execution_set_identifier: Optional[str] job_names: Sequence[str] blocking: bool additional_asset_keys: Sequence[AssetKey] automation_condition: Opti...
AssetCheckNodeSnap
python
joke2k__faker
tests/providers/test_company.py
{ "start": 22844, "end": 23568 }
class ____: """Test ko_KR company provider methods""" def test_company_name_word(self, faker, num_samples): for _ in range(num_samples): word = faker.company_name_word() assert isinstance(word, str) assert word in KoKrCompanyProvider.company_name_words def test_...
TestKoKr
python
apache__airflow
airflow-core/tests/unit/cli/commands/test_dag_command.py
{ "start": 2482, "end": 40190 }
class ____: parser: argparse.ArgumentParser @classmethod def setup_class(cls): parse_and_sync_to_db(os.devnull, include_examples=True) cls.parser = cli_parser.get_parser() @classmethod def teardown_class(cls) -> None: clear_db_runs() clear_db_dags() def setup_m...
TestCliDags
python
matplotlib__matplotlib
galleries/examples/user_interfaces/fourier_demo_wx_sgskip.py
{ "start": 3176, "end": 8292 }
class ____(wx.Frame): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) panel = wx.Panel(self) # create the GUI elements self.createCanvas(panel) self.createSliders(panel) # place them in a sizer for the Layout sizer = wx.BoxSizer(wx.VER...
FourierDemoFrame
python
celery__celery
celery/exceptions.py
{ "start": 4346, "end": 4428 }
class ____(CeleryWarning): """Potential security issue found."""
SecurityWarning
python
joke2k__faker
faker/providers/person/ha_NG/__init__.py
{ "start": 232, "end": 1752 }
class ____(PersonProvider): # Male first names first_names_male = [ "Abdullahi", "Musa", "Sani", "Ibrahim", "Aliyu", "Bello", "Kabiru", "Shehu", "Yusuf", "Haruna", "Ismail", "Usman", "Nasiru", "Mahmud...
Provider
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI034.py
{ "start": 11009, "end": 11238 }
class ____(list[PotentialTypeVar]): def __new__(cls: type[Generic5]) -> Generic5: ... def __enter__(self: Generic5) -> Generic5: ... # Test cases based on issue #20781 - metaclasses that triggers IsMetaclass::Maybe
Generic5
python
huggingface__transformers
src/transformers/models/got_ocr2/modeling_got_ocr2.py
{ "start": 20891, "end": 22477 }
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...
GotOcr2CausalLMOutputWithPast
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_types.py
{ "start": 151250, "end": 153085 }
class ____(fixtures.TestBase): @testing.combinations( (Range(2, 7), INT4RANGE), (Range(-10, 7), INT4RANGE), (Range(None, -7), INT4RANGE), (Range(33, None), INT4RANGE), (Range(-2147483648, 2147483647), INT4RANGE), (Range(-2147483648 - 1, 2147483647), INT8RANGE), ...
RangeMiscTests
python
django__django
tests/m2m_through/models.py
{ "start": 4045, "end": 4183 }
class ____(models.Model): iname = models.CharField(max_length=20, unique=True) class Meta: ordering = ("iname",)
Ingredient
python
python-excel__xlrd
xlrd/sheet.py
{ "start": 99063, "end": 101577 }
class ____(BaseObject): """ Contains the data for one cell. .. warning:: You don't call this class yourself. You access :class:`Cell` objects via methods of the :class:`Sheet` object(s) that you found in the :class:`~xlrd.book.Book` object that was returned when you called :func:`~x...
Cell
python
walkccc__LeetCode
solutions/1621. Number of Sets of K Non-Overlapping Line Segments/1621.py
{ "start": 0, "end": 671 }
class ____: def numberOfSets(self, n: int, k: int) -> int: MOD = 1_000_000_007 @functools.lru_cache(None) def dp(i: int, k: int, drawing: bool) -> int: if k == 0: # Find a way to draw k segments. return 1 if i == n: # Reach the end. return 0 if drawing: # 1. Ke...
Solution
python
kubernetes-client__python
kubernetes/client/models/v1_volume_attachment_status.py
{ "start": 383, "end": 7156 }
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...
V1VolumeAttachmentStatus
python
ray-project__ray
python/ray/data/preprocessors/serialization_handlers.py
{ "start": 435, "end": 597 }
class ____(Enum): """Enum for consistent format naming in the factory.""" CLOUDPICKLE = "cloudpickle" PICKLE = "pickle" @DeveloperAPI
HandlerFormatName
python
automl__auto-sklearn
test/test_pipeline/components/feature_preprocessing/test_liblinear.py
{ "start": 435, "end": 2257 }
class ____(PreprocessingTestCase): def test_default_configuration(self): with ignore_warnings(feature_preprocessing_warnings): transformation, original = _test_preprocessing(LibLinear_Preprocessor) self.assertEqual(transformation.shape[0], original.shape[0]) self.assertFalse((tr...
LiblinearComponentTest
python
spyder-ide__spyder
spyder/plugins/layout/widgets/dialog.py
{ "start": 933, "end": 4387 }
class ____(QAbstractTableModel): """ """ def __init__(self, parent, names, ui_names, order, active, read_only): super().__init__(parent) # variables self._parent = parent self.names = names self.ui_names = ui_names self.order = order self.active = active ...
LayoutModel
python
pypa__pip
src/pip/_internal/index/collector.py
{ "start": 12546, "end": 12672 }
class ____(NamedTuple): find_links: Sequence[LinkSource | None] index_urls: Sequence[LinkSource | None]
CollectedSources
python
Textualize__textual
src/textual/css/_style_properties.py
{ "start": 40991, "end": 41761 }
class ____: """Combines the horizontal and vertical alignment properties into a single property.""" def __set_name__(self, owner: StylesBase, name: str) -> None: self.horizontal = f"{name}_horizontal" self.vertical = f"{name}_vertical" def __get__( self, obj: StylesBase, type: type...
AlignProperty
python
sympy__sympy
sympy/codegen/fnodes.py
{ "start": 19410, "end": 19619 }
class ____(Token, Expr): __slots__ = _fields = ('array', 'dim', 'mask') defaults = {'dim': none, 'mask': none} _construct_array = staticmethod(sympify) _construct_dim = staticmethod(sympify)
sum_
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/loop34.py
{ "start": 297, "end": 768 }
class ____(Protocol[_T_contra]): def __lt__(self, __other: _T_contra) -> bool: ... SupportsRichComparison: TypeAlias = SupportsDunderLT[Any] | SupportsDunderGT[Any] SupportsRichComparisonT = TypeVar( "SupportsRichComparisonT", bound=SupportsRichComparison ) def max( __arg1: SupportsRichComparisonT, __a...
SupportsDunderLT
python
kamyu104__LeetCode-Solutions
Python/count-all-valid-pickup-and-delivery-options.py
{ "start": 29, "end": 306 }
class ____(object): def countOrders(self, n): """ :type n: int :rtype: int """ MOD = 10**9+7 result = 1 for i in reversed(xrange(2, 2*n+1, 2)): result = result * i*(i-1)//2 % MOD return result
Solution
python
weaviate__weaviate-python-client
weaviate/collections/classes/tenants.py
{ "start": 4476, "end": 5271 }
class ____(str, Enum): """TenantActivityStatus class used to describe the activity status of a tenant to update in Weaviate. Attributes: ACTIVE: The tenant is fully active and can be used. INACTIVE: The tenant is not active, files stored locally. OFFLOADED: The tenant is not active, fil...
TenantUpdateActivityStatus
python
geekcomputers__Python
venv/Lib/site-packages/pip/_internal/exceptions.py
{ "start": 12938, "end": 13616 }
class ____(InstallationError): """Multiple HashError instances rolled into one for reporting""" def __init__(self) -> None: self.errors: List["HashError"] = [] def append(self, error: "HashError") -> None: self.errors.append(error) def __str__(self) -> str: lines = [] ...
HashErrors
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/missingSuper1.py
{ "start": 328, "end": 436 }
class ____: def __init__(self): pass def __init_subclass__(cls) -> None: pass
ParentD
python
joke2k__faker
faker/providers/company/az_AZ/__init__.py
{ "start": 45, "end": 1243 }
class ____(CompanyProvider): formats = ( "{{last_name}} {{company_suffix}}", "{{last_name}} {{last_name}} {{company_suffix}}", "{{large_company}}", ) large_companies = ( "AZAL", "Azergold", "SOCAR", "Socar Polymer", "Global Export Fruits", ...
Provider
python
openai__openai-python
src/openai/cli/_api/audio.py
{ "start": 1541, "end": 1758 }
class ____(BaseModel): model: str file: str response_format: Optional[str] = None language: Optional[str] = None temperature: Optional[float] = None prompt: Optional[str] = None
CLITranscribeArgs
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/runs_feed.py
{ "start": 1825, "end": 2068 }
class ____(graphene.Union): class Meta: types = (GrapheneRunsFeedCount, GraphenePythonError) name = "RunsFeedCountOrError" types = [GrapheneRunsFeedConnectionOrError, GrapheneRunsFeedCountOrError]
GrapheneRunsFeedCountOrError
python
anthropics__anthropic-sdk-python
src/anthropic/types/signature_delta.py
{ "start": 190, "end": 280 }
class ____(BaseModel): signature: str type: Literal["signature_delta"]
SignatureDelta
python
django__django
tests/model_inheritance_regress/models.py
{ "start": 2306, "end": 2412 }
class ____(Article): quality = models.IntegerField() class Meta: abstract = True
Evaluation
python
pypa__pipenv
pipenv/vendor/pythonfinder/pythonfinder.py
{ "start": 404, "end": 7433 }
class ____: """ Main finder class that orchestrates all the finders. """ def __init__( self, path: str | None = None, system: bool = False, global_search: bool = True, ignore_unsupported: bool = True, sort_by_path: bool = False, ): """ ...
Finder
python
getsentry__sentry
src/sentry/analytics/events/first_user_context_sent.py
{ "start": 80, "end": 240 }
class ____(analytics.Event): user_id: int organization_id: int project_id: int analytics.register(FirstUserContextSentEvent)
FirstUserContextSentEvent
python
ethereum__web3.py
ens/exceptions.py
{ "start": 1523, "end": 1645 }
class ____(ENSException): """ Raised if a resolver does not support a particular method. """
UnsupportedFunction
python
PyCQA__pylint
pylint/extensions/code_style.py
{ "start": 579, "end": 14530 }
class ____(BaseChecker): """Checkers that can improve code consistency. As such they don't necessarily provide a performance benefit and are often times opinionated. Before adding another checker here, consider this: 1. Does the checker provide a clear benefit, i.e. detect a common issue or...
CodeStyleChecker
python
django__django
tests/model_forms/models.py
{ "start": 13153, "end": 13328 }
class ____(models.Model): uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models.CharField(max_length=30) # Models for #24706
UUIDPK
python
ray-project__ray
python/ray/data/_internal/execution/interfaces/ref_bundle.py
{ "start": 430, "end": 741 }
class ____: """A slice of a block.""" # Starting row offset (inclusive) within the block. start_offset: int # Ending row offset (exclusive) within the block. end_offset: int @property def num_rows(self) -> int: return self.end_offset - self.start_offset @dataclass
BlockSlice
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDictReadOnly2.py
{ "start": 582, "end": 1052 }
class ____(TD1[_T]): e: _T f: ReadOnly[str] td1: TD1[float] = {"a": 3, "b": "", "c": [], "d": {}, "e": 0.0} reveal_type(td1.get("a"), expected_text="int") reveal_type(td1.get("b"), expected_text="str") reveal_type(td1.get("c"), expected_text="list[str]") reveal_type(td1.get("d"), expected_text="dict[str, str...
TD2
python
realpython__materials
python-protocol/birds_v2.py
{ "start": 208, "end": 451 }
class ____(QuackingThing): def quack(self): return "The person is imitating a duck quacking!" def make_it_quack(duck: QuackingThing) -> str: return duck.quack() print(make_it_quack(Duck())) print(make_it_quack(Person()))
Person
python
PrefectHQ__prefect
src/prefect/server/orchestration/dependencies.py
{ "start": 565, "end": 4671 }
class ____(TypedDict): task_policy_provider: TaskRunPolicyProvider | None flow_policy_provider: FlowRunPolicyProvider | None task_orchestration_parameters_provider: ParameterProvider | None flow_orchestration_parameters_provider: ParameterProvider | None ORCHESTRATION_DEPENDENCIES: OrchestrationDepend...
OrchestrationDependencies
python
getsentry__sentry
tests/sentry/api/test_paginator.py
{ "start": 15591, "end": 20261 }
class ____(SimpleTestCase): def test_empty_results(self) -> None: paginator: SequencePaginator[None] = SequencePaginator([]) result = paginator.get_result(5) assert list(result) == [] assert result.prev == Cursor(0, 0, True, False) assert result.next == Cursor(0, 0, False, Fa...
SequencePaginatorTestCase
python
airbytehq__airbyte
airbyte-ci/connectors/metadata_service/lib/tests/test_specs_secrets_mask.py
{ "start": 11547, "end": 13185 }
class ____: """Tests for _persist_secrets_to_gcs function.""" @pytest.fixture def mock_bucket(self): """Create a mock GCS bucket.""" return Mock(spec=storage.Bucket) @pytest.fixture def mock_blob(self): """Create a mock GCS blob.""" mock_blob = Mock() mock_b...
TestPersistSecretsToGcs
python
huggingface__transformers
src/transformers/masking_utils.py
{ "start": 27656, "end": 64904 }
class ____(GeneralInterface): # Class instance object, so that a call to `register` can be reflected into all other files correctly, even if # a new instance is created (in order to locally override a given function) _global_mapping = { "sdpa": sdpa_mask, "eager": eager_mask, "flash_...
AttentionMaskInterface
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/final3.py
{ "start": 4223, "end": 4393 }
class ____: def __init__(self): self.x: Final = 1 def method1(self): # This should generate an error because x is Final. self.x += 1
ClassD
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/operators/ecs.py
{ "start": 11622, "end": 13602 }
class ____(EcsBaseOperator): """ Register a task definition on AWS ECS. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:EcsRegisterTaskDefinitionOperator` :param family: The family name of a task definition to create. :p...
EcsRegisterTaskDefinitionOperator
python
pytorch__pytorch
test/higher_order_ops/test_invoke_subgraph.py
{ "start": 34527, "end": 38744 }
class ____(torch.nn.Module): def forward(self, L_x_: "f32[8]", L_y_: "f32[8]"): l_x_ = L_x_ l_y_ = L_y_ subgraph_0 = self.subgraph_0 invoke_subgraph = torch.ops.higher_order.invoke_subgraph(subgraph_0, 'subgraph_0', l_x_, l_y_); subgraph_0 = l_x_ = None a: "f32[8]" = invoke...
GraphModule
python
numpy__numpy
numpy/random/tests/test_smoke.py
{ "start": 27772, "end": 28066 }
class ____(RNG): @classmethod def _create_rng(cls): bit_generator = SFC64 advance = None seed = [12345] rg = Generator(bit_generator(*seed)) seed_vector_bits = 192 return RNGData(bit_generator, advance, seed, rg, seed_vector_bits)
TestSFC64
python
huggingface__transformers
tests/models/fuyu/test_modeling_fuyu.py
{ "start": 5616, "end": 10146 }
class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = ( ( FuyuModel, FuyuForCausalLM, ) if is_torch_available() else () ) pipeline_model_mapping = ( {"text-generation": FuyuForCausalLM,...
FuyuModelTest
python
tensorflow__tensorflow
tensorflow/python/ops/op_selector.py
{ "start": 10414, "end": 14168 }
class ____(Exception): """Raised if a Tensor cannot be lifted from the graph.""" # Prevent autograph from rewriting this error. ag_pass_through = True def _as_operation(op_or_tensor): if isinstance(op_or_tensor, tensor_lib.Tensor): return op_or_tensor.op return op_or_tensor def graph_inputs(op): re...
UnliftableError
python
ApeWorX__ape
src/ape/managers/converters.py
{ "start": 7163, "end": 7796 }
class ____(ConverterAPI): """ Convert string-formatted floating point values to `Decimal` type. """ def is_convertible(self, value: Any) -> bool: # Matches only string-formatted floats with an optional sign character (+/-). # Leading and trailing zeros are required. # NOTE: `re....
StringDecimalConverter
python
walkccc__LeetCode
solutions/320. Generalized Abbreviation/320.py
{ "start": 0, "end": 619 }
class ____: def generateAbbreviations(self, word: str) -> list[str]: ans = [] def getCountString(count: int) -> str: return str(count) if count > 0 else '' def dfs(i: int, count: int, path: list[str]) -> None: if i == len(word): ans.append(''.join(path) + getCountString(count)) ...
Solution
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 211522, "end": 212182 }
class ____(sgqlc.types.relay.Connection): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field( sgqlc.types.list_of("BranchProtectionRuleEdge"), graphql_name="edges" ) nodes ...
BranchProtectionRuleConnection
python
ansible__ansible
test/integration/targets/shell-plugins/action_plugins/test_shell.py
{ "start": 247, "end": 521 }
class ____(ActionBase): def run(self, tmp=None, task_vars=None): result = super(ActionModule, self).run(tmp, task_vars) del tmp # tmp no longer has any effect result['shell'] = self._connection._shell.SHELL_FAMILY return result
ActionModule
python
Textualize__textual
docs/examples/how-to/center07.py
{ "start": 181, "end": 635 }
class ____(App): """How to center things.""" CSS = """ Screen { align: center middle; } #hello { background: blue 50%; border: wide white; width: 40; height: 9; text-align: center; content-align: center middle; } """ def compose(...
CenterApp
python
django__django
tests/forms_tests/tests/tests.py
{ "start": 1167, "end": 1310 }
class ____(ModelForm): class Meta: model = ChoiceModel fields = ["name", "choice_string_w_none"]
EmptyCharLabelNoneChoiceForm
python
scikit-learn__scikit-learn
sklearn/utils/tests/test_estimator_checks.py
{ "start": 5456, "end": 5774 }
class ____(BaseEstimator): # Note that object is an uninitialized class, thus immutable. def __init__(self, p=42, q=np.int32(42), r=object): self.p = p self.q = q self.r = r def fit(self, X, y=None): X, y = validate_data(self, X, y) return self
HasImmutableParameters
python
django-haystack__django-haystack
test_haystack/test_views.py
{ "start": 569, "end": 691 }
class ____(SearchForm): q = forms.CharField(initial="Search for...", required=False, label="Search")
InitialedSearchForm
python
astropy__astropy
astropy/cosmology/_src/tests/io/test_model.py
{ "start": 6436, "end": 6636 }
class ____(ToFromDirectTestBase, ToFromModelTestMixin): """Directly test ``to/from_model``.""" def setup_class(self): self.functions = {"to": to_model, "from": from_model}
TestToFromModel
python
pytorch__pytorch
torch/_subclasses/meta_utils.py
{ "start": 19844, "end": 20424 }
class ____(ViewFunc["FakeTensor"]): @override def apply( self, t: torch.Tensor, new_base: torch.Tensor, symint_visitor_fn: Optional[Callable[[int], int]] = None, tensor_visitor_fn: Optional[Callable[[torch.Tensor], FakeTensor]] = None, ) -> FakeTensor: return ...
_FakeTensorViewFunc
python
pypa__warehouse
warehouse/email/interfaces.py
{ "start": 78, "end": 504 }
class ____(Interface): def create_service(context, request): """ Create the service, given the context and request for which it is being created for. """ def send(recipient, message): """ Sends an EmailMessage to the given recipient. """ def last_sen...
IEmailSender
python
openai__openai-python
tests/test_response.py
{ "start": 1671, "end": 3650 }
class ____(pydantic.BaseModel): ... def test_response_parse_mismatched_basemodel(client: OpenAI) -> None: response = APIResponse( raw=httpx.Response(200, content=b"foo"), client=client, stream=False, stream_cls=None, cast_to=str, options=FinalRequestOptions.construc...
PydanticModel
python
apache__airflow
providers/fab/src/airflow/providers/fab/www/views.py
{ "start": 2375, "end": 5182 }
class ____(IndexView): """ A simple view that inherits from FAB index view. The only goal of this view is to redirect the user to the Airflow 3 UI index page if the user is authenticated. It is impossible to redirect the user directly to the Airflow 3 UI index page before redirecting them to this p...
FabIndexView
python
pytorch__pytorch
test/quantization/core/experimental/test_fake_quantize.py
{ "start": 524, "end": 3793 }
class ____(unittest.TestCase): r""" Tests fake quantize calculate_qparams() method by comparing with result from observer calculate_qparams. Uses hard-coded values: alpha=1.0, b=4, k=2. """ def test_fake_calc_qparams(self): apot_fake = APoTFakeQuantize(b=4, k=2) apot_fake.a...
TestFakeQuantize
python
django__django
tests/queries/test_query.py
{ "start": 6750, "end": 8847 }
class ____(TestCase): def test_rawsql_annotation(self): query = Query(None) sql = "%s = 1" # Wrap with a CASE WHEN expression if a database backend (e.g. Oracle) # doesn't support boolean expression in SELECT list. if not connection.features.supports_boolean_expr_in_select_cl...
TestQueryNoModel
python
pandas-dev__pandas
pandas/tests/indexes/timedeltas/test_constructors.py
{ "start": 313, "end": 9289 }
class ____: def test_array_of_dt64_nat_raises(self): # GH#39462 nat = np.datetime64("NaT", "ns") arr = np.array([nat], dtype=object) msg = "Invalid type for timedelta scalar" with pytest.raises(TypeError, match=msg): TimedeltaIndex(arr) with pytest.raise...
TestTimedeltaIndex
python
huggingface__transformers
src/transformers/models/voxtral/processing_voxtral.py
{ "start": 1354, "end": 1448 }
class ____(AudioKwargs, total=False): max_source_positions: Optional[int]
VoxtralAudioKwargs
python
jazzband__django-model-utils
tests/models.py
{ "start": 13397, "end": 13442 }
class ____(UUIDModel): pass
CustomUUIDModel
python
pytorch__pytorch
torch/testing/_internal/distributed/rpc/jit/rpc_test.py
{ "start": 10509, "end": 10669 }
class ____(torch.nn.Module): def forward(self) -> Tensor: # pyre-ignore[7]: Pyre and torch.jit.interface don't mix well pass
MyModuleInterface
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_axis04.py
{ "start": 315, "end": 1582 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_axis04.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_...
TestCompareXLSXFiles
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pyflakes/F821_5.py
{ "start": 38, "end": 115 }
class ____: def random_func(self) -> "InnerClass": pass
RandomClass
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/specialization1.py
{ "start": 238, "end": 833 }
class ____: def __init__(self) -> None: ... def m1(self, a: Moo[A]) -> None: ... def m2(self, b: Moo[B]) -> None: ... a = Moo[A]() b = Moo[B]() y = Foo() y.m1(a) # This should generate an error: # Argument of type 'Moo[B]' cannot be assigned to parameter of type 'Moo[A]' y.m1(b) # This should genera...
Foo
python
encode__django-rest-framework
tests/test_fields.py
{ "start": 51459, "end": 52481 }
class ____(FieldValues): """ Valid and invalid values for `DateTimeField` when not using UTC as the timezone. """ @classmethod def setup_class(cls): # use class setup method, as class-level attribute will still be evaluated even if test is skipped kolkata = ZoneInfo('Asia/Kolkata') ...
TestTZWithDateTimeField
python
faif__python-patterns
tests/behavioral/test_publish_subscribe.py
{ "start": 139, "end": 2732 }
class ____(unittest.TestCase): """ Integration tests ~ provider class with as little mocking as possible. """ def test_subscriber_shall_be_attachable_to_subscriptions(cls): subscription = "sub msg" pro = Provider() cls.assertEqual(len(pro.subscribers), 0) sub = Subscribe...
TestProvider
python
dagster-io__dagster
python_modules/dagster-pipes/dagster_pipes/__init__.py
{ "start": 52015, "end": 52405 }
class ____(PipesContextLoader): """Context loader that reads context from a JSON file on Unity Catalog Volumes.""" @contextmanager def load_context(self, params: PipesParams) -> Iterator[PipesContextData]: path = _assert_env_param_type(params, "path", str, self.__class__) with open(path) as...
PipesUnityCatalogVolumesContextLoader
python
gevent__gevent
src/gevent/events.py
{ "start": 8448, "end": 9380 }
class ____(Interface): """ The event emitted when the memory usage drops below the threshold after having previously been above it. This event is emitted only the first time memory usage is detected to be below the threshold after having previously been above it. If memory usage climbs again, a...
IMemoryUsageUnderThreshold
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/main.py
{ "start": 58756, "end": 59209 }
class ____(type): """ The metaclass for YAMLObject. """ def __init__(cls, name, bases, kwds): # type: (Any, Any, Any) -> None super().__init__(name, bases, kwds) if 'yaml_tag' in kwds and kwds['yaml_tag'] is not None: cls.yaml_constructor.add_constructor(cls.yaml_tag...
YAMLObjectMetaclass
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 992589, "end": 993970 }
class ____(sgqlc.types.Type): """A pointer to a repository at a specific revision embedded inside another repository. """ __schema__ = github_schema __field_names__ = ("branch", "git_url", "name", "name_raw", "path", "path_raw", "subproject_commit_oid") branch = sgqlc.types.Field(String, graphq...
Submodule
python
PrefectHQ__prefect
tests/cli/test_work_pool.py
{ "start": 1906, "end": 16150 }
class ____: @pytest.mark.usefixtures("mock_collection_registry") async def test_create_work_pool(self, prefect_client): pool_name = "my-pool" res = await run_sync_in_worker_thread( invoke_and_assert, f"work-pool create {pool_name} -t fake", ) assert res.ex...
TestCreate
python
facebook__pyre-check
client/libcst_vendored_visitors/_apply_type_annotations.py
{ "start": 3933, "end": 6348 }
class ____: """ Represents all of the annotation information we might add to a class: - All data is keyed on the qualified name relative to the module root - The ``functions`` field also keys on the signature so that we do not apply stub types where the signature is incompatible. The idea...
Annotations
python
huggingface__transformers
src/transformers/models/mask2former/modeling_mask2former.py
{ "start": 42764, "end": 44842 }
class ____(nn.Module): """ This is a more standard version of the position embedding, very similar to the one used by the Attention is all you need paper, generalized to work on images. """ def __init__( self, num_pos_feats: int = 64, temperature: int = 10000, normalize: bool = False, scale...
Mask2FormerSinePositionEmbedding
python
numba__numba
numba/core/dispatcher.py
{ "start": 45575, "end": 49307 }
class ____(LiftedCode): can_cache = True def _reduce_extras(self): return dict(output_types=self.output_types) @property def _numba_type_(self): return types.Dispatcher(self) def get_call_template(self, args, kws): """ Get a typing.ConcreteTemplate for this dispat...
LiftedWith
python
google__jax
docs/autodidax.py
{ "start": 75181, "end": 87104 }
class ____(Trace): def new_arg(self, pval: PartialVal) -> Any: return PartialEvalTracer(self, pval, LambdaBindingRecipe()) def lift(self, val: Any) -> PartialEvalTracer: return PartialEvalTracer(self, PartialVal.known(val), None) pure = lift def instantiate_const(self, tracer: PartialEvalTracer) -> Pa...
PartialEvalTrace
python
apache__airflow
providers/postgres/tests/unit/postgres/dialects/test_postgres.py
{ "start": 996, "end": 4574 }
class ____: def setup_method(self): def get_records(sql, parameters): assert isinstance(sql, str) assert "hollywood" in parameters, "Missing 'schema' in parameters" assert "actors" in parameters, "Missing 'table' in parameters" if "kcu." in sql: ...
TestPostgresDialect
python
getsentry__sentry
src/sentry/users/services/user/model.py
{ "start": 3958, "end": 4060 }
class ____(IntEnum): # annoying SIMPLE = 0 DETAILED = 1 SELF_DETAILED = 2
UserSerializeType
python
pexpect__pexpect
tests/deprecated_test_filedescriptor.py
{ "start": 1026, "end": 2734 }
class ____(PexpectTestCase.PexpectTestCase): def setUp(self): print(self.id()) PexpectTestCase.PexpectTestCase.setUp(self) def test_fd (self): fd = os.open ('TESTDATA.txt', os.O_RDONLY) s = pexpect.spawn (fd) s.expect ('This is the end of test data:') s.expect (p...
ExpectTestCase
python
donnemartin__interactive-coding-challenges
linked_lists/palindrome/test_palindrome.py
{ "start": 18, "end": 1291 }
class ____(unittest.TestCase): def test_palindrome(self): print('Test: Empty list') linked_list = MyLinkedList() self.assertEqual(linked_list.is_palindrome(), False) print('Test: Single element list') head = Node(1) linked_list = MyLinkedList(head) self.asse...
TestPalindrome
python
huggingface__transformers
src/transformers/models/data2vec/modeling_data2vec_vision.py
{ "start": 13326, "end": 16049 }
class ____(Data2VecVisionSelfAttention): def forward( self, hidden_states: torch.Tensor, output_attentions: bool = False, relative_position_bias: Optional[torch.Tensor] = None, interpolate_pos_encoding: bool = False, resolution: Optional[tuple[int]] = None, ) -> U...
Data2VecVisionSdpaSelfAttention
python
spack__spack
lib/spack/spack/traverse.py
{ "start": 2484, "end": 3095 }
class ____: """A visitor that traverses each node once.""" def __init__(self, visitor, key=id, visited=None): self.visitor = visitor self.key = key self.visited = set() if visited is None else visited def accept(self, item): # Covering nodes means: visit nodes once and only...
CoverNodesVisitor
python
django__django
tests/introspection/models.py
{ "start": 272, "end": 416 }
class ____(models.Model): city = models.ForeignKey(City, models.CASCADE, primary_key=True) name = models.CharField(max_length=50)
District
python
FactoryBoy__factory_boy
examples/flask_alchemy/demoapp_factories.py
{ "start": 370, "end": 537 }
class ____(BaseFactory): class Meta: model = demoapp.UserLog message = factory.fuzzy.FuzzyText() user = factory.SubFactory(UserFactory)
UserLogFactory
python
cython__cython
Cython/Compiler/Code.py
{ "start": 20721, "end": 20856 }
class ____: """Contains parsed declaration of shared utility function""" name: str ret: str params: str
SharedFunctionDecl
python
falconry__falcon
falcon/asgi/request.py
{ "start": 1515, "end": 35852 }
class ____(request.Request): """Represents a client's HTTP request. Note: `Request` is not meant to be instantiated directly by responders. Args: scope (dict): ASGI HTTP connection scope passed in from the server (see also: `Connection Scope`_). receive (awaitable): ASG...
Request
python
getsentry__sentry
tests/sentry/api/endpoints/test_project_servicehook_stats.py
{ "start": 174, "end": 1010 }
class ____(APITestCase): def test_simple(self) -> None: project = self.create_project() hook = ServiceHook.objects.get_or_create( project_id=project.id, actor_id=self.user.id, url="http://example.com" )[0] self.login_as(user=self.user) path = ( f"/api/...
ProjectServiceHookStatsTest
python
scipy__scipy
scipy/cluster/vq.py
{ "start": 3757, "end": 30899 }
class ____(Exception): pass @xp_capabilities() def whiten(obs, check_finite=None): """ Normalize a group of observations on a per feature basis. Before running k-means, it is beneficial to rescale each feature dimension of the observation set by its standard deviation (i.e. "whiten" it - as i...
ClusterError
python
crytic__slither
slither/tools/mutator/mutators/LOR.py
{ "start": 298, "end": 1917 }
class ____(AbstractMutator): # pylint: disable=too-few-public-methods NAME = "LOR" HELP = "Logical Operator Replacement" def _mutate(self) -> Dict: result: Dict = {} for ( # pylint: disable=too-many-nested-blocks function ) in self.contract.functions_and_modifiers_dec...
LOR
python
PrefectHQ__prefect
src/prefect/server/orchestration/core_policy.py
{ "start": 17905, "end": 20965 }
class ____(TaskRunUniversalTransform): """ Releases any concurrency slots held by a run upon exiting a Running or Cancelling state. """ async def after_transition( self, context: OrchestrationContext[orm_models.TaskRun, core.TaskRunPolicy], ) -> None: if self.nullified_t...
ReleaseTaskConcurrencySlots
python
tornadoweb__tornado
tornado/httputil.py
{ "start": 28706, "end": 36138 }
class ____(ObjectDict): """Represents a file uploaded via a form. For backwards compatibility, its instance attributes are also accessible as dictionary keys. * ``filename`` * ``body`` * ``content_type`` """ filename: str body: bytes content_type: str def _parse_request_rang...
HTTPFile
python
getsentry__sentry
src/sentry/snuba/sessions_v2.py
{ "start": 19301, "end": 19388 }
class ____(TypedDict): id: int slug: str stats: list[_CategoryStats]
_Project