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
joke2k__faker
tests/providers/test_person.py
{ "start": 15865, "end": 17585 }
class ____(unittest.TestCase): """Tests person in the en-IE locale""" def setUp(self): self.fake = Faker("en-ie") self.provider = EnIEProvider Faker.seed(0) def test_first_name(self): # General first name name = self.fake.first_name() assert name sel...
TestEnIE
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1570929, "end": 1571815 }
class ____(VegaLiteSchema): """ ValueDefnumberwidthheightExprRef schema wrapper. Definition object for a constant value (primitive value or gradient definition) of an encoding channel. Parameters ---------- value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constan...
ValueDefnumberwidthheightExprRef
python
pyca__cryptography
tests/x509/test_x509.py
{ "start": 207238, "end": 216384 }
class ____: @pytest.mark.supported( only_if=lambda backend: backend.signature_hash_supported( hashes.SHA1() ), skip_message="Does not support SHA-1 signature.", ) def test_load_dsa_cert(self, backend): cert = _load_cert( os.path.join("x509", "custom", ...
TestDSACertificate
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/enumGenNextValue1.py
{ "start": 329, "end": 414 }
class ____(EnumC): x = auto() reveal_type(EnumD.x.value, expected_text="str")
EnumD
python
kamyu104__LeetCode-Solutions
Python/course-schedule-ii.py
{ "start": 968, "end": 1782 }
class ____(object): def findOrder(self, numCourses, prerequisites): """ :type numCourses: int :type prerequisites: List[List[int]] :rtype: List[int] """ adj = collections.defaultdict(list) in_degree = collections.Counter() for u, v in prerequisites: ...
Solution2
python
kamyu104__LeetCode-Solutions
Python/double-a-number-represented-as-a-linked-list.py
{ "start": 43, "end": 465 }
class ____(object): def doubleIt(self, head): """ :type head: Optional[ListNode] :rtype: Optional[ListNode] """ if head.val >= 5: head = ListNode(0, head) curr = head while curr: curr.val = (curr.val*2)%10 if curr.next and c...
Solution
python
spyder-ide__spyder
spyder/plugins/profiler/confpage.py
{ "start": 315, "end": 1092 }
class ____(PluginConfigPage): def setup_page(self): switch_to_plugin_cb = self.create_checkbox( _("Open profiler when profiling finishes"), "switch_to_plugin", tip=_( "This option switches to the profiler plugin " "when a profiling has ende...
ProfilerConfigPage
python
cookiecutter__cookiecutter
cookiecutter/main.py
{ "start": 7636, "end": 8046 }
class ____: # noqa: N801 def __init__(self, repo_dir: Path | str) -> None: self._repo_dir = f"{repo_dir}" if isinstance(repo_dir, Path) else repo_dir def __enter__(self) -> None: self._path = copy(sys.path) sys.path.append(self._repo_dir) def __exit__(self, _type, _value, _traceba...
_patch_import_path_for_repo
python
dagster-io__dagster
python_modules/dagster/dagster_tests/storage_tests/test_defs_state_storage.py
{ "start": 333, "end": 663 }
class ____(TestDefsStateStorage): """Tests the default state storage implementation.""" __test__ = True @pytest.fixture(name="storage", scope="function") def state_storage(self): with instance_for_test() as instance: yield check.not_none(instance.defs_state_storage)
TestDefaultDefsStateStorage
python
apache__airflow
providers/tableau/tests/unit/tableau/operators/test_tableau.py
{ "start": 1070, "end": 7754 }
class ____: """ Test class for TableauOperator """ def setup_method(self): self.mocked_workbooks = [] self.mock_datasources = [] for i in range(3): mock_workbook = Mock() mock_workbook.id = i mock_workbook.name = f"wb_{i}" self.mo...
TestTableauOperator
python
kamyu104__LeetCode-Solutions
Python/transformed-array.py
{ "start": 37, "end": 260 }
class ____(object): def constructTransformedArray(self, nums): """ :type nums: List[int] :rtype: List[int] """ return [nums[(i+nums[i])%len(nums)] for i in xrange(len(nums))]
Solution
python
apache__airflow
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_extra_links.py
{ "start": 2146, "end": 11488 }
class ____: dag_id = "TEST_DAG_ID" dag_run_id = "TEST_DAG_RUN_ID" task_single_link = "TEST_SINGLE_LINK" task_multiple_links = "TEST_MULTIPLE_LINKS" task_mapped = "TEST_MAPPED_TASK" default_time = timezone.datetime(2020, 1, 1) plugin_name = "test_plugin" @staticmethod def _clear_db()...
TestGetExtraLinks
python
pytorch__pytorch
test/test_cuda_multigpu.py
{ "start": 967, "end": 50725 }
class ____(TestCase): FIFTY_MIL_CYCLES = 50000000 def _check_memory_stat_consistency(self): snapshot = torch.cuda.memory_snapshot() expected_each_device = collections.defaultdict( lambda: collections.defaultdict(int) ) for segment in snapshot: expandabl...
TestCudaMultiGPU
python
PyCQA__pylint
examples/deprecation_checker.py
{ "start": 1936, "end": 4245 }
class ____(DeprecatedMixin, BaseChecker): """Class implementing deprecation checker.""" # DeprecatedMixin class is Mixin class implementing logic for searching deprecated methods and functions. # The list of deprecated methods/functions is defined by the implementing class via # deprecated_methods call...
DeprecationChecker
python
chroma-core__chroma
chromadb/api/types.py
{ "start": 59033, "end": 59127 }
class ____: enabled: bool config: IntInvertedIndexConfig @dataclass
IntInvertedIndexType
python
rapidsai__cudf
python/cudf/cudf/core/join/_join_helpers.py
{ "start": 1140, "end": 1363 }
class ____(_Indexer): def get(self, obj: DataFrame) -> ColumnBase: return obj._data[self.name] def set(self, obj: DataFrame, value: ColumnBase): obj._data.set_by_label(self.name, value)
_ColumnIndexer
python
altair-viz__altair
altair/vegalite/v6/schema/channels.py
{ "start": 838725, "end": 839464 }
class ____(ValueChannelMixin, core.PositionValueDef): """ ThetaValue schema wrapper. Definition object for a constant value (primitive value or gradient definition) of an encoding channel. Parameters ---------- value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A con...
ThetaValue
python
PyCQA__pyflakes
pyflakes/test/test_imports.py
{ "start": 265, "end": 3814 }
class ____(TestCase): def test_import_basic(self): binding = Importation('a', None, 'a') assert binding.source_statement == 'import a' assert str(binding) == 'a' def test_import_as(self): binding = Importation('c', None, 'a') assert binding.source_statement == 'import a...
TestImportationObject
python
tornadoweb__tornado
tornado/test/httpserver_test.py
{ "start": 9644, "end": 11066 }
class ____(RequestHandler): def prepare(self): self.errors = {} # type: Dict[str, str] fields = [ ("method", str), ("uri", str), ("version", str), ("remote_ip", str), ("protocol", str), ("host", str), ("path", str),...
TypeCheckHandler
python
doocs__leetcode
solution/3300-3399/3319.K-th Largest Perfect Subtree Size in Binary Tree/Solution.py
{ "start": 192, "end": 726 }
class ____: def kthLargestPerfectSubtree(self, root: Optional[TreeNode], k: int) -> int: def dfs(root: Optional[TreeNode]) -> int: if root is None: return 0 l, r = dfs(root.left), dfs(root.right) if l < 0 or l != r: return -1 cn...
Solution
python
pypa__pipenv
pipenv/patched/pip/_internal/req/req_file.py
{ "start": 14931, "end": 20324 }
class ____(Exception): def __init__(self, msg: str) -> None: self.msg = msg def build_parser() -> optparse.OptionParser: """ Return a parser for parsing requirement lines """ parser = optparse.OptionParser(add_help_option=False) option_factories = SUPPORTED_OPTIONS + SUPPORTED_OPTIONS...
OptionParsingError
python
kamyu104__LeetCode-Solutions
Python/lexicographically-smallest-negated-permutation-that-sums-to-target.py
{ "start": 52, "end": 734 }
class ____(object): def lexSmallestNegatedPerm(self, n, target): """ :type n: int :type target: int :rtype: List[int] """ def count(x): return (x+1)*x//2 total = count(n) if abs(target) > total or (target-total)%2: return [] ...
Solution
python
huggingface__transformers
src/transformers/models/idefics/modeling_idefics.py
{ "start": 37644, "end": 48729 }
class ____(IdeficsPreTrainedModel): """ Transformer decoder consisting of `config.num_hidden_layers` layers. Each layer is a [`IdeficsDecoderLayer`] Args: config: IdeficsConfig """ def __init__(self, config: IdeficsConfig): super().__init__(config) self.config = config ...
IdeficsModel
python
nedbat__coveragepy
tests/test_report_common.py
{ "start": 6255, "end": 10598 }
class ____(CoverageTest): """Tests of Jinja-like behavior. Jinja2 compiles a template into Python code, and then runs the Python code to render the template. But during rendering, it uses the template name (for example, "template.j2") as the file name, not the Python code file name. Then during r...
ReportWithJinjaTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 539774, "end": 540212 }
class ____(sgqlc.types.Type): """Autogenerated return type of CreateProject""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "project") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client performing the mutation...
CreateProjectPayload
python
pypa__pipenv
pipenv/vendor/packaging/_elffile.py
{ "start": 673, "end": 3282 }
class ____: """ Representation of an ELF executable. """ def __init__(self, f: IO[bytes]) -> None: self._f = f try: ident = self._read("16B") except struct.error: raise ELFInvalid("unable to parse identification") magic = bytes(ident[:4]) ...
ELFFile
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/decorator1.py
{ "start": 368, "end": 466 }
class ____: @Wrapper def __init__(self, **kwargs): print(f"{kwargs}") Foo(bar=3)
Foo
python
kamyu104__LeetCode-Solutions
Python/rotate-image.py
{ "start": 31, "end": 613 }
class ____(object): # @param matrix, a list of lists of integers # @return a list of lists of integers def rotate(self, matrix): n = len(matrix) # anti-diagonal mirror for i in xrange(n): for j in xrange(n - i): matrix[i][j], matrix[n-1-j][n-1-i] = matrix...
Solution
python
django__django
django/contrib/postgres/operations.py
{ "start": 2805, "end": 2936 }
class ____(CreateExtension): def __init__(self, hints=None): super().__init__("btree_gin", hints=hints)
BtreeGinExtension
python
huggingface__transformers
src/transformers/models/video_llava/modeling_video_llava.py
{ "start": 5855, "end": 6857 }
class ____(PreTrainedModel): config: VideoLlavaConfig base_model_prefix = "model" input_modalities = ("image", "video", "text") supports_gradient_checkpointing = True _no_split_modules = ["VideoLlavaVisionAttention"] _skip_keys_device_placement = "past_key_values" _supports_flash_attn = True...
VideoLlavaPreTrainedModel
python
pandas-dev__pandas
pandas/tests/indexes/interval/test_indexing.py
{ "start": 1747, "end": 2250 }
class ____: def test_where(self, listlike_box): klass = listlike_box idx = IntervalIndex.from_breaks(range(11), closed="right") cond = [True] * len(idx) expected = idx result = expected.where(klass(cond)) tm.assert_index_equal(result, expected) cond = [False...
TestWhere
python
django-crispy-forms__django-crispy-forms
crispy_forms/bootstrap.py
{ "start": 34054, "end": 35471 }
class ____(Field): """ Layout object for rendering fields as Inline in bootstrap. Attributes ---------- template : str The default template which this Layout Object will be rendered with. attrs : dict Attributes to be applied to the field. These are converted into html ...
InlineField
python
redis__redis-py
redis/commands/search/suggestion.py
{ "start": 466, "end": 1612 }
class ____: """ Internal class used to parse results from the `SUGGET` command. This needs to consume either 1, 2, or 3 values at a time from the return value depending on what objects were requested """ def __init__(self, with_scores: bool, with_payloads: bool, ret) -> None: self.with_...
SuggestionParser
python
apache__airflow
task-sdk/src/airflow/sdk/definitions/_internal/templater.py
{ "start": 1879, "end": 8628 }
class ____: """ This renders the template fields of object. :meta private: """ # For derived classes to define which fields will get jinjaified. template_fields: Collection[str] # Defines which files extensions to look for in the templated fields. template_ext: Sequence[str] def g...
Templater
python
geekcomputers__Python
diceV2_dynamic.py
{ "start": 120, "end": 2689 }
class ____: def __init__(self): self.sideCount = 6 def setSides(self, sides): if sides > 3: self.sides = sides else: print( "This absolutely shouldn't ever happen. The programmer sucks or someone " "has tweaked with code they weren...
Dice
python
ansible__ansible
lib/ansible/module_utils/facts/system/caps.py
{ "start": 840, "end": 2409 }
class ____(BaseFactCollector): name = 'caps' _fact_ids = set(['system_capabilities', 'system_capabilities_enforced']) # type: t.Set[str] def collect(self, module=None, collected_facts=None): rc = -1 facts_dict = {'system_capabilities_enforced': 'N/A', ...
SystemCapabilitiesFactCollector
python
encode__django-rest-framework
tests/test_generics.py
{ "start": 14643, "end": 14768 }
class ____(generics.ListCreateAPIView): serializer_class = ClassASerializer queryset = ClassA.objects.all()
ExampleView
python
doocs__leetcode
solution/2600-2699/2662.Minimum Cost of a Path With Special Roads/Solution.py
{ "start": 0, "end": 644 }
class ____: def minimumCost( self, start: List[int], target: List[int], specialRoads: List[List[int]] ) -> int: def dist(x1: int, y1: int, x2: int, y2: int) -> int: return abs(x1 - x2) + abs(y1 - y2) q = [(0, start[0], start[1])] vis = set() ans = inf ...
Solution
python
airbytehq__airbyte
airbyte-integrations/connectors/source-shopify/source_shopify/streams/base_streams.py
{ "start": 7389, "end": 13106 }
class ____(ShopifyStream, ABC): # Setting the check point interval to the limit of the records output state_checkpoint_interval = 250 def __init__(self, config: Dict): super().__init__(config) # _filter_checkpointed_cursor used to checkpoint streams with cursor field - ID in job.get_adjuste...
IncrementalShopifyStream
python
matplotlib__matplotlib
lib/mpl_toolkits/axisartist/floating_axes.py
{ "start": 3829, "end": 4371 }
class ____(ExtremeFinderSimple): # docstring inherited def __init__(self, extremes): """ This subclass always returns the same bounding box. Parameters ---------- extremes : (float, float, float, float) The bounding box that this helper always returns. ...
ExtremeFinderFixed
python
doocs__leetcode
solution/0900-0999/0969.Pancake Sorting/Solution.py
{ "start": 0, "end": 598 }
class ____: def pancakeSort(self, arr: List[int]) -> List[int]: def reverse(arr, j): i = 0 while i < j: arr[i], arr[j] = arr[j], arr[i] i, j = i + 1, j - 1 n = len(arr) ans = [] for i in range(n - 1, 0, -1): j = i ...
Solution
python
dagster-io__dagster
python_modules/libraries/dagster-aws/dagster_aws_tests/athena_tests/test_resources.py
{ "start": 218, "end": 3153 }
class ____(ResourceWithAthenaConfig): def get_client(self) -> FakeAthenaClient: return FakeAthenaClient( client=boto3.client("athena", region_name="us-east-1"), workgroup=self.workgroup, polling_interval=self.polling_interval, max_polls=self.max_polls, ...
TestAthenaClientResource
python
huggingface__transformers
src/transformers/models/d_fine/modular_d_fine.py
{ "start": 54695, "end": 54741 }
class ____(RTDetrEncoder): pass
DFineEncoder
python
pandas-dev__pandas
pandas/tests/resample/test_period_index.py
{ "start": 1369, "end": 39512 }
class ____: @pytest.mark.parametrize("freq", ["2D", "1h", "2h"]) def test_asfreq(self, frame_or_series, freq): # GH 12884, 15944 obj = frame_or_series(range(5), index=period_range("2020-01-01", periods=5)) expected = obj.to_timestamp().resample(freq).asfreq() result = obj.to_ti...
TestPeriodIndex
python
huggingface__transformers
src/transformers/models/megatron_bert/modeling_megatron_bert.py
{ "start": 52019, "end": 56771 }
class ____(MegatronBertPreTrainedModel): def __init__(self, config): super().__init__(config) self.bert = MegatronBertModel(config) self.dropout = nn.Dropout(config.hidden_dropout_prob) self.classifier = nn.Linear(config.hidden_size, 1) # Initialize weights and apply final ...
MegatronBertForMultipleChoice
python
scipy__scipy
scipy/signal/tests/test_signaltools.py
{ "start": 113436, "end": 114619 }
class ____: @skip_xp_backends(np_only=True, reason='list inputs are numpy specific') def test_array_like(self, xp): zi_expected = xp.asarray([5.0, -1.0]) zi = lfilter_zi([1.0, 0.0, 2.0], [1.0, -1.0, 0.5]) assert_array_almost_equal(zi, zi_expected) def test_basic(self, xp): ...
TestLFilterZI
python
wandb__wandb
wandb/vendor/pygments/lexers/templates.py
{ "start": 33402, "end": 34169 }
class ____(DelegatingLexer): """ A lexer that highlights javascript code in genshi text templates. """ name = 'JavaScript+Genshi Text' aliases = ['js+genshitext', 'js+genshi', 'javascript+genshitext', 'javascript+genshi'] alias_filenames = ['*.js'] mimetypes = ['application/x...
JavascriptGenshiLexer
python
pytorch__pytorch
test/dynamo/cpython/3_13/typinganndata/mod_generics_cache.py
{ "start": 262, "end": 508 }
class ____(Generic[T]): class A(Generic[T]): pass my_inner_a1: 'B.A' my_inner_a2: A my_outer_a: 'A' # unless somebody calls get_type_hints with localns=B.__dict__ type Alias = int OldStyle = TypeAliasType("OldStyle", int)
B
python
sympy__sympy
sympy/matrices/kind.py
{ "start": 114, "end": 2843 }
class ____(Kind): """ Kind for all matrices in SymPy. Basic class for this kind is ``MatrixBase`` and ``MatrixExpr``, but any expression representing the matrix can have this. Parameters ========== element_kind : Kind Kind of the element. Default is :class:`sympy.core.kind...
MatrixKind
python
celery__celery
celery/canvas.py
{ "start": 55779, "end": 56072 }
class ____(_basemap): """Map operation for tasks, using star arguments.""" _task_name = 'celery.starmap' def __repr__(self): task, it = self._unpack_args(self.kwargs) return f'[{task.task}(*x) for x in {truncate(repr(it), 100)}]' @Signature.register_type()
xstarmap
python
huggingface__transformers
utils/check_docstrings.py
{ "start": 1672, "end": 58263 }
class ____: """Information about a single @auto_docstring decorated function or class.""" decorator_line: int # 1-based line number of the decorator def_line: int # 1-based line number of the def/class statement kind: str # 'function' or 'class' body_start_line: ( int # 1-based line num...
DecoratedItem
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI034.py
{ "start": 4707, "end": 5100 }
class ____( typing.Iterator[int] ): # Y022 Use "collections.abc.Iterator[T]" instead of "typing.Iterator[T]" (PEP 585 syntax) def __iter__(self) -> Iterator[int]: ... # Y034 "__iter__" methods in classes like "BadIterator2" usually return "self" at runtime. Consider using "typing_extensions.Self" in "...
BadIterator2
python
mlflow__mlflow
mlflow/genai/judges/tools/types.py
{ "start": 747, "end": 1070 }
class ____: """Information about a single span.""" span_id: str name: str span_type: str start_time_ms: float end_time_ms: float duration_ms: float parent_id: str | None status: SpanStatus is_root: bool attribute_names: list[str] @experimental(version="3.5.0") @dataclass
SpanInfo
python
wandb__wandb
wandb/vendor/pygments/lexers/installers.py
{ "start": 9485, "end": 10870 }
class ____(RegexLexer): """ Lexer that highlights debian sources.list files. .. versionadded:: 0.7 """ name = 'Debian Sourcelist' aliases = ['sourceslist', 'sources.list', 'debsources'] filenames = ['sources.list'] mimetype = ['application/x-debian-sourceslist'] tokens = { ...
SourcesListLexer
python
walkccc__LeetCode
solutions/2862. Maximum Element-Sum of a Complete Subset of Indices/2862.py
{ "start": 0, "end": 453 }
class ____: def maximumSum(self, nums: list[int]) -> int: ans = 0 oddPowerToSum = collections.Counter() def divideSquares(val: int) -> int: for num in range(2, val + 1): while val % (num * num) == 0: val //= (num * num) return val for i, num in enumerate(nums): od...
Solution
python
streamlit__streamlit
lib/streamlit/testing/v1/element_tree.py
{ "start": 15068, "end": 15603 }
class ____(Element): proto: ArrowProto = field(repr=False) def __init__(self, proto: ArrowProto, root: ElementTree) -> None: self.key = None self.proto = proto self.root = root self.type = "arrow_data_frame" @property def value(self) -> PandasDataframe: return d...
Dataframe
python
django__django
tests/staticfiles_tests/test_storage.py
{ "start": 26475, "end": 26985 }
class ____(CollectionTestCase): run_collectstatic_in_setUp = False def test_collectstatistic_no_post_process_replaced_paths(self): stdout = StringIO() self.run_collectstatic(verbosity=1, stdout=stdout) self.assertIn("post-processed", stdout.getvalue()) @override_settings( STORAGES...
TestCollectionNoPostProcessReplacedPaths
python
keras-team__keras
keras/src/quantizers/quantizers.py
{ "start": 23319, "end": 33630 }
class ____(Quantizer): """A class that handles the quantization of weights using GPTQ method. This class provides methods to find quantization parameters (scale and zero) for a given tensor and can be used to quantize weights in a GPTQ context. Args: weight_bits: (int) The number of bits to qu...
GPTQQuantizer
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/paramNames1.py
{ "start": 1598, "end": 2116 }
class ____(type): def __new__(mcls): ... # This should not generate a error because the class derives # from type and is assumed to be a metaclass. def foo1(cls): return 3 # This should generate an error. def foo2(mcls): return 3 def foo3(self): return 3 @clas...
Metaclass
python
etianen__django-reversion
tests/test_app/tests/test_commands.py
{ "start": 2669, "end": 3055 }
class ____(TestModelMixin, TestBase): databases = {"default", "postgres"} def testCreateInitialRevisionsModelDb(self): obj = TestModel.objects.db_manager("postgres").create() self.callCommand("createinitialrevisions", model_db="postgres") self.assertSingleRevision((obj,), comment="Initi...
CreateInitialRevisionsModelDbTest
python
getsentry__sentry
src/sentry/statistical_detectors/base.py
{ "start": 543, "end": 1175 }
class ____(ABC): @classmethod @abstractmethod def from_redis_dict(cls, data: Any) -> DetectorState: ... @abstractmethod def to_redis_dict(self) -> Mapping[str | bytes, bytes | float | int | str]: ... @abstractmethod def should_auto_resolve(self, target: float, rel_threshold: float) -> bool...
DetectorState
python
getsentry__sentry
src/sentry/auth/manager.py
{ "start": 378, "end": 1334 }
class ____: def __init__(self) -> None: self.__values: dict[str, type[Provider]] = {} def __iter__(self) -> Iterator[tuple[str, type[Provider]]]: yield from self.__values.items() def get(self, key: str, **kwargs: Any) -> Provider: try: cls = self.__values[key] e...
ProviderManager
python
PyCQA__pylint
tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_ex_returned.py
{ "start": 236, "end": 386 }
class ____: """__getnewargs_ex__ returns <type 'tuple'>""" def __getnewargs_ex__(self): return ((1,), {"2": "2"})
FirstGoodGetNewArgsEx
python
numpy__numpy
numpy/polynomial/tests/test_hermite_e.py
{ "start": 6188, "end": 10115 }
class ____: def test_hermeint(self): # check exceptions assert_raises(TypeError, herme.hermeint, [0], .5) assert_raises(ValueError, herme.hermeint, [0], -1) assert_raises(ValueError, herme.hermeint, [0], 1, [0, 0]) assert_raises(ValueError, herme.hermeint, [0], lbnd=[0]) ...
TestIntegral
python
apache__airflow
providers/apache/pinot/tests/unit/apache/pinot/hooks/test_pinot.py
{ "start": 7452, "end": 10151 }
class ____: def setup_method(self): self.conn = conn = mock.MagicMock() self.conn.host = "host" self.conn.port = "1000" self.conn.login = "" self.conn.password = "" self.conn.conn_type = "http" self.conn.extra_dejson = {"endpoint": "query/sql"} self.cu...
TestPinotDbApiHook
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/coercions.py
{ "start": 20067, "end": 20515 }
class ____(RoleImpl): __slots__ = () def _implicit_coercions( self, element: Any, resolved: Any, argname: Optional[str] = None, **kw: Any, ) -> Any: if isinstance(element, ExecutableOption): return element else: self._raise_for...
ExecutableOptionImpl
python
redis__redis-py
redis/commands/core.py
{ "start": 226391, "end": 226962 }
class ____(ScriptCommands): async def script_debug(self, *args) -> None: return super().script_debug() def register_script( self: "redis.asyncio.client.Redis", script: ScriptTextT, ) -> AsyncScript: """ Register a Lua ``script`` specifying the ``keys`` it will touch....
AsyncScriptCommands
python
matplotlib__matplotlib
lib/matplotlib/dviread.py
{ "start": 48623, "end": 53486 }
class ____: @cache # A singleton. def __new__(cls): self = object.__new__(cls) self._proc = self._new_proc() return self def _new_proc(self): return subprocess.Popen( ["luatex", "--luaonly", str(cbook._get_data_path("kpsewhich.lua"))], # mktexpk logs...
_LuatexKpsewhich
python
crytic__slither
slither/detectors/attributes/locked_ether.py
{ "start": 529, "end": 4861 }
class ____(AbstractDetector): # pylint: disable=too-many-nested-blocks ARGUMENT = "locked-ether" HELP = "Contracts that lock ether" IMPACT = DetectorClassification.MEDIUM CONFIDENCE = DetectorClassification.HIGH WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-...
LockedEther
python
charliermarsh__ruff
python/ruff-ecosystem/ruff_ecosystem/main.py
{ "start": 4571, "end": 5009 }
class ____(json.JSONEncoder): def default(self, o: object): if isinstance(o, Serializable): return o.jsonable() if dataclasses.is_dataclass(o): return dataclasses.asdict(o) if isinstance(o, set): return tuple(o) if isinstance(o, Path): ...
JSONEncoder
python
PrefectHQ__prefect
tests/events/server/test_in_memory_ordering.py
{ "start": 22200, "end": 23044 }
class ____: def test_get_task_run_recorder_causal_ordering(self): """Test that the factory function returns the correct scoped instance.""" from prefect.server.events.ordering import get_task_run_recorder_causal_ordering CausalOrdering.clear_all_scopes() # Get instance from factory...
TestFactoryFunction
python
graphql-python__graphene
graphene/relay/connection.py
{ "start": 2367, "end": 2429 }
class ____(ObjectTypeOptions): node = None
ConnectionOptions
python
pyca__cryptography
src/cryptography/x509/extensions.py
{ "start": 39109, "end": 41006 }
class ____(ExtensionType): oid = ExtensionOID.PRIVATE_KEY_USAGE_PERIOD def __init__( self, not_before: datetime.datetime | None, not_after: datetime.datetime | None, ) -> None: if ( not isinstance(not_before, datetime.datetime) and not_before is not N...
PrivateKeyUsagePeriod
python
getsentry__sentry
src/sentry/issues/run.py
{ "start": 633, "end": 3812 }
class ____(ProcessingStrategyFactory[KafkaPayload]): def __init__( self, max_batch_size: int, max_batch_time: int, # not needed in batched-parallel mode num_processes: int | None = None, input_block_size: int | None = None, output_block_size: int | None = None...
OccurrenceStrategyFactory
python
run-llama__llama_index
llama-index-core/llama_index/core/objects/table_node_mapping.py
{ "start": 402, "end": 549 }
class ____(BaseModel): """Lightweight representation of a SQL table.""" table_name: str context_str: Optional[str] = None
SQLTableSchema
python
getsentry__sentry
src/sentry/hybridcloud/rpc/__init__.py
{ "start": 628, "end": 892 }
class ____(Enum): def __eq__(self, other: Any) -> bool: value = other if isinstance(other, Enum): value = other.value return self.value == value def __hash__(self) -> int: return hash(self.value)
ValueEqualityEnum
python
sympy__sympy
sympy/physics/control/lti.py
{ "start": 144005, "end": 161725 }
class ____(MIMOLinearTimeInvariant): r""" A class for representing closed-loop feedback interconnection between two MIMO input/output systems. Parameters ========== sys1 : MIMOSeries, TransferFunctionMatrix, StateSpaceBase The MIMO system placed on the feedforward path. sys2 : MIMO...
MIMOFeedback
python
huggingface__transformers
src/transformers/models/beit/modeling_beit.py
{ "start": 41714, "end": 43156 }
class ____(nn.Module): """ Pyramid Pooling Module (PPM) used in PSPNet. Args: pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid Module. in_channels (int): Input channels. channels (int): Channels after modules, before conv_seg. align_corners (bool)...
BeitPyramidPoolingModule
python
getsentry__sentry
src/sentry/users/services/user/model.py
{ "start": 4807, "end": 4875 }
class ____(TypedDict): user_id: int email: str
UserIdEmailArgs
python
getsentry__sentry
src/sentry/notifications/utils/actions.py
{ "start": 161, "end": 920 }
class ____: name: str # Optional label. This falls back to name. label: str | None = None type: Literal["button", "select"] = "button" # If this is a button type, a url is required. url: str | None = None # If this is a select type, the selected value. value: str | None = None #...
MessageAction
python
anthropics__anthropic-sdk-python
src/anthropic/types/message_create_params.py
{ "start": 10398, "end": 10675 }
class ____(MessageCreateParamsBase, total=False): stream: Literal[False] """Whether to incrementally stream the response using server-sent events. See [streaming](https://docs.claude.com/en/api/messages-streaming) for details. """
MessageCreateParamsNonStreaming
python
ray-project__ray
python/ray/train/tests/test_iter_torch_batches_gpu.py
{ "start": 6297, "end": 6681 }
class ____(PandasBatchCollateFn): """Collate function that returns id and value as a tuple of tensors.""" def __call__(self, batch: pd.DataFrame) -> Tuple[torch.Tensor, torch.Tensor]: tensor_dict = convert_ndarray_batch_to_torch_tensor_batch( batch.to_dict("series") ) return...
TuplePandasBatchCollateFn
python
pypa__warehouse
tests/unit/metrics/test_event_handlers.py
{ "start": 7283, "end": 7783 }
class ____: @pytest.mark.parametrize( ("matched_route", "route_tag"), [(None, "route:null"), (pretend.stub(name="foo"), "route:foo")], ) def test_emits_metric(self, pyramid_request, metrics, matched_route, route_tag): pyramid_request.matched_route = matched_route on_before_r...
TestOnBeforeRetry
python
streamlit__streamlit
lib/tests/streamlit/elements/button_test.py
{ "start": 3200, "end": 27180 }
class ____(DeltaGeneratorTestCase): """Test ability to marshall button protos.""" def test_button(self): """Test that it can be called.""" st.button("the label") c = self.get_delta_from_queue().new_element.button assert c.label == "the label" assert not c.default ...
ButtonTest
python
GoogleCloudPlatform__python-docs-samples
dataflow/flex-templates/pipeline_with_dependencies/src/my_package/my_transforms.py
{ "start": 719, "end": 925 }
class ____(beam.DoFn): """Parses each line of input text into words.""" def process(self, element: str) -> Iterable[str]: return re.findall(r"[\w\']+", element, re.UNICODE)
WordExtractingDoFn
python
celery__celery
t/smoke/tests/test_tasks.py
{ "start": 594, "end": 4040 }
class ____(SuiteOperations): @pytest.fixture def default_worker_app(self, default_worker_app: Celery) -> Celery: app = default_worker_app app.conf.worker_prefetch_multiplier = 1 app.conf.worker_concurrency = 1 return app @pytest.mark.parametrize( "method,expected_err...
test_task_termination
python
scipy__scipy
scipy/cluster/tests/test_vq.py
{ "start": 6585, "end": 10174 }
class ____: def test_py_vq(self, xp): initc = np.concatenate([[X[0]], [X[1]], [X[2]]]) # label1.dtype varies between int32 and int64 over platforms label1 = py_vq(xp.asarray(X), xp.asarray(initc))[0] xp_assert_equal(label1, xp.asarray(LABEL1, dtype=xp.int64), ...
TestVq
python
astropy__astropy
astropy/units/tests/test_quantity_non_ufuncs.py
{ "start": 85332, "end": 92730 }
class ____: tested_module = np.lib.recfunctions @classmethod def setup_class(cls): cls.pv_dtype = np.dtype([("p", "f8"), ("v", "f8")]) cls.pv_t_dtype = np.dtype( [("pv", np.dtype([("pp", "f8"), ("vv", "f8")])), ("t", "f8")] ) cls.pv = np.array([(1.0, 0.25), (2.0...
TestRecFunctions
python
scikit-learn__scikit-learn
sklearn/svm/_classes.py
{ "start": 52030, "end": 58252 }
class ____(RegressorMixin, BaseLibSVM): """Nu Support Vector Regression. Similar to NuSVC, for regression, uses a parameter nu to control the number of support vectors. However, unlike NuSVC, where nu replaces C, here nu replaces the parameter epsilon of epsilon-SVR. The implementation is based on...
NuSVR
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/triggers/comprehend.py
{ "start": 1100, "end": 2531 }
class ____(AwsBaseWaiterTrigger): """ Trigger when a Comprehend pii entities detection job is complete. :param job_id: The id of the Comprehend pii entities detection job. :param waiter_delay: The amount of time in seconds to wait between attempts. (default: 120) :param waiter_max_attempts: The max...
ComprehendPiiEntitiesDetectionJobCompletedTrigger
python
django-import-export__django-import-export
tests/core/migrations/0010_uuidbook.py
{ "start": 104, "end": 636 }
class ____(migrations.Migration): dependencies = [ ("core", "0009_auto_20211111_0807"), ] operations = [ migrations.CreateModel( name="UUIDBook", fields=[ ( "id", models.UUIDField( primar...
Migration
python
davidhalter__jedi
jedi/inference/gradual/typing.py
{ "start": 13911, "end": 13957 }
class ____(BaseTypingInstance): pass
Generic
python
sympy__sympy
sympy/functions/elementary/miscellaneous.py
{ "start": 9694, "end": 21258 }
class ____(Expr, LatticeOp): def __new__(cls, *args, **assumptions): from sympy.core.parameters import global_parameters evaluate = assumptions.pop('evaluate', global_parameters.evaluate) args = (sympify(arg) for arg in args) # first standard filter, for cls.zero and cls.identity ...
MinMaxBase
python
getsentry__sentry
src/sentry/integrations/bitbucket_server/integration.py
{ "start": 7963, "end": 9315 }
class ____: """ Complete the OAuth dance by exchanging our request token into an access token. """ @method_decorator(csrf_exempt) def dispatch(self, request: HttpRequest, pipeline: IntegrationPipeline) -> HttpResponseBase: with IntegrationPipelineViewEvent( IntegrationPipeli...
OAuthCallbackView
python
plotly__plotly.py
plotly/graph_objs/layout/map/_layer.py
{ "start": 235, "end": 24279 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.map" _path_str = "layout.map.layer" _valid_props = { "below", "circle", "color", "coordinates", "fill", "line", "maxzoom", "minzoom", "name", "opacity", "s...
Layer
python
django__django
tests/admin_changelist/models.py
{ "start": 818, "end": 1014 }
class ____(models.Model): name = models.CharField(max_length=20) file = models.FileField(upload_to="documents/", blank=True, null=True) url = models.URLField(blank=True, null=True)
Genre
python
catalyst-team__catalyst
catalyst/data/sampler.py
{ "start": 3556, "end": 8599 }
class ____(Sampler): """ This kind of sampler can be used for both metric learning and classification task. BatchSampler with the given strategy for the C unique classes dataset: - Selection `num_classes` of C classes for each batch - Selection `num_samples` instances for each class in the batch ...
BatchBalanceClassSampler
python
pypa__pipenv
pipenv/vendor/importlib_metadata/__init__.py
{ "start": 7357, "end": 8967 }
class ____(tuple): """ An immutable collection of selectable EntryPoint objects. """ __slots__ = () def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override] # Work with str instead of int """ Get the EntryPoint in self matching name. """ try: ...
EntryPoints
python
sphinx-doc__sphinx
sphinx/domains/c/_ast.py
{ "start": 20008, "end": 21031 }
class ____(ASTExpression): def __init__(self, typ: ASTType, expr: ASTExpression) -> None: self.typ = typ self.expr = expr def __eq__(self, other: object) -> bool: if not isinstance(other, ASTCastExpr): return NotImplemented return self.typ == other.typ and self.expr ...
ASTCastExpr
python
joke2k__faker
faker/providers/automotive/de_CH/__init__.py
{ "start": 48, "end": 1151 }
class ____(AutomotiveProvider): """Implement automotive provider for ``de_CH`` locale. Sources: - https://de.wikipedia.org/wiki/Kontrollschild_(Schweiz)#Kantone """ __canton = ( ("AG", "%## ###"), ("AR", "%# ###"), ("AI", "%# ###"), ("BL", "%## ###"), ("BS"...
Provider