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
zarr-developers__zarr-python
src/zarr/core/dtype/common.py
{ "start": 5907, "end": 6331 }
class ____: """ A mix-in class for data types with a length attribute, such as fixed-size collections of unicode strings, or bytes. Attributes ---------- length : int The length of the scalars belonging to this data type. Note that this class does not assign a unit to the length...
HasLength
python
lxml__lxml
src/lxml/html/_difflib.py
{ "start": 69233, "end": 84954 }
class ____(object): """For producing HTML side by side comparison with change highlights. This class can be used to create an HTML table (or a complete HTML file containing the table) showing a side by side, line by line comparison of text with inter-line and intra-line change highlights. The table ca...
HtmlDiff
python
sqlalchemy__sqlalchemy
examples/versioned_rows/versioned_rows_w_versionid.py
{ "start": 3263, "end": 3653 }
class ____(Base): __tablename__ = "parent" id = Column(Integer, primary_key=True) child_id = Column(Integer) child_version_id = Column(Integer) child = relationship("Child", backref=backref("parent", uselist=False)) __table_args__ = ( ForeignKeyConstraint( ["child_id", "chil...
Parent
python
doocs__leetcode
lcci/02.07.Intersection of Two Linked Lists/Solution.py
{ "start": 136, "end": 378 }
class ____: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: a, b = headA, headB while a != b: a = a.next if a else headB b = b.next if b else headA return a
Solution
python
getsentry__sentry
src/sentry/utils/patch_set.py
{ "start": 1039, "end": 2881 }
class ____: added: list[FileModification] removed: list[FileModification] modified: list[FileModification] def patch_to_file_modifications(patch: str) -> FileModifications: try: patch_set = unidiff.PatchSet.from_string(patch) except UnidiffParseError: raise PatchParseError("Failed ...
FileModifications
python
PrefectHQ__prefect
src/integrations/prefect-azure/prefect_azure/container_instance.py
{ "start": 3074, "end": 3701 }
class ____(BaseModel): """ Use a Managed Identity to access Azure Container registry. Requires the user-assigned managed identity be available to the ACI container group. """ registry_url: str = Field( default=..., title="Registry URL", description=( "The URL to ...
ACRManagedIdentity
python
sympy__sympy
sympy/geometry/line.py
{ "start": 70496, "end": 75378 }
class ____(LinearEntity3D, Line): """An infinite 3D line in space. A line is declared with two distinct points or a point and direction_ratio as defined using keyword `direction_ratio`. Parameters ========== p1 : Point3D pt : Point3D direction_ratio : list See Also ======== ...
Line3D
python
sqlalchemy__sqlalchemy
examples/versioned_history/test_versioning.py
{ "start": 1288, "end": 29673 }
class ____(AssertsCompiledSQL): __dialect__ = "default" def setUp(self): self.engine = engine = create_engine("sqlite://") self.session = Session(engine) self.make_base() versioned_session(self.session) def tearDown(self): self.session.close() clear_mappers(...
TestVersioning
python
ipython__ipython
tests/test_completer.py
{ "start": 7117, "end": 95922 }
class ____(unittest.TestCase): def setUp(self): """ We want to silence all PendingDeprecationWarning when testing the completer """ self._assertwarns = self.assertWarns(PendingDeprecationWarning) self._assertwarns.__enter__() def tearDown(self): try: ...
TestCompleter
python
pennersr__django-allauth
allauth/socialaccount/providers/xing/views.py
{ "start": 353, "end": 1029 }
class ____(OAuthAdapter): provider_id = "xing" request_token_url = "https://api.xing.com/v1/request_token" # nosec access_token_url = "https://api.xing.com/v1/access_token" # nosec authorize_url = "https://www.xing.com/v1/authorize" def complete_login(self, request, app, token, response): ...
XingOAuthAdapter
python
django__django
tests/generic_views/forms.py
{ "start": 224, "end": 339 }
class ____(forms.Form): name = forms.CharField() message = forms.CharField(widget=forms.Textarea)
ContactForm
python
pytorch__pytorch
tools/testing/target_determination/heuristics/edited_by_pr.py
{ "start": 985, "end": 2038 }
class ____(HeuristicInterface): def __init__(self, **kwargs: dict[str, Any]) -> None: super().__init__(**kwargs) def get_prediction_confidence(self, tests: list[str]) -> TestPrioritizations: critical_tests = _get_modified_tests() return TestPrioritizations( tests, {TestRun(t...
EditedByPR
python
streamlit__streamlit
lib/streamlit/elements/deck_gl_json_chart.py
{ "start": 3730, "end": 7000 }
class ____(TypedDict, total=False): r""" The schema for the PyDeck chart selection state. The selection state is stored in a dictionary-like object that supports both key and attribute notation. Selection states cannot be programmatically changed or set through Session State. You must define `...
PydeckSelectionState
python
xlwings__xlwings
xlwings/pro/reports/markdown.py
{ "start": 1380, "end": 3180 }
class ____: """ ``MarkdownStyle`` defines how ``Markdown`` objects are being rendered in Excel cells or shapes. Start by instantiating a ``MarkdownStyle`` object. Printing it will show you the current (default) style: >>> style = MarkdownStyle() >>> style <MarkdownStyle> h1.font: .bold:...
MarkdownStyle
python
jazzband__django-formtools
formtools/wizard/views.py
{ "start": 28912, "end": 29114 }
class ____(NamedUrlWizardView): """ A NamedUrlFormWizard with pre-configured CookieStorageBackend. """ storage_name = 'formtools.wizard.storage.cookie.CookieStorage'
NamedUrlCookieWizardView
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_P.py
{ "start": 13559, "end": 14542 }
class ____(Benchmark): r""" Plateau objective function. This class defines the Plateau [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{Plateau}}(x) = 30 + \sum_{i=1}^n \lfloor \lvert x_i \rvert\rfloor Here, ...
Plateau
python
dask__dask
dask/array/_array_expr/_creation.py
{ "start": 4584, "end": 18375 }
class ____(BroadcastTrick): func = staticmethod(np.full_like) def wrap_func_shape_as_first_arg(*args, klass, **kwargs): """ Transform np creation function into blocked version """ if "shape" not in kwargs: shape, args = args[0], args[1:] else: shape = kwargs.pop("shape") i...
Full
python
Pylons__pyramid
tests/test_config/test_actions.py
{ "start": 32635, "end": 32827 }
class ____: def __init__(self): self.registered = [] def register(self, introspector, action_info): self.registered.append((introspector, action_info))
DummyIntrospectable
python
getsentry__sentry
src/sentry/monitors/consumers/monitor_consumer.py
{ "start": 43284, "end": 45445 }
class ____(ProcessingStrategyFactory[KafkaPayload]): parallel_executor: ThreadPoolExecutor | None = None batched_parallel = False """ Does the consumer process unrelated check-ins in parallel? """ max_batch_size = 500 """ How many messages will be batched at once when in parallel mode....
StoreMonitorCheckInStrategyFactory
python
pypa__pipenv
pipenv/patched/pip/_internal/models/search_scope.py
{ "start": 503, "end": 5075 }
class ____: """ Encapsulates the locations that pip is configured to search. """ find_links: List[str] index_urls: List[str] no_index: bool index_lookup: Optional[Dict[str, str]] = None index_restricted: Optional[bool] = None @classmethod def create( cls, find_li...
SearchScope
python
pytorch__pytorch
test/inductor/test_move_constructors_to_gpu.py
{ "start": 543, "end": 3317 }
class ____(TestCase): def _check_fn(self, func, expect_cpu, *args): out_eager = func(*args) out_compiled, code = run_and_get_code(torch.compile(func), *args) self.assertEqual(out_eager, out_compiled) assert len(code) == 1 if expect_cpu: FileCheck().check("cpp_fu...
TestMoveConstructorsToGpu
python
davidhalter__jedi
jedi/inference/value/iterable.py
{ "start": 10864, "end": 14850 }
class ____(Sequence): _TUPLE_LIKE = 'testlist_star_expr', 'testlist', 'subscriptlist' mapping = {'(': 'tuple', '[': 'list', '{': 'set'} def __init__(self, inference_state, defining_context, atom): super().__init__(inference_state) self.atom = atom self....
SequenceLiteralValue
python
explosion__spaCy
spacy/lang/af/__init__.py
{ "start": 153, "end": 255 }
class ____(Language): lang = "af" Defaults = AfrikaansDefaults __all__ = ["Afrikaans"]
Afrikaans
python
walkccc__LeetCode
solutions/1357. Apply Discount Every n Orders/1357.py
{ "start": 0, "end": 538 }
class ____: def __init__( self, n: int, discount: int, products: list[int], prices: list[int], ): self.n = n self.discount = discount self.productToPrice = dict(zip(products, prices)) self.count = 0 def getBill(self, product: list[int], amount: list[int]) -> float: ...
Cashier
python
PyCQA__pydocstyle
src/tests/test_cases/test.py
{ "start": 11888, "end": 12157 }
class ____: # noqa: D203,D213 """A Blah. Parameters ---------- x : int """ def __init__(self, x): pass expect(os.path.normcase(__file__ if __file__[-1] != 'c' else __file__[:-1]), 'D100: Missing docstring in public module')
Blah
python
pydantic__pydantic
pydantic/v1/types.py
{ "start": 25916, "end": 27114 }
class ____(SecretField): min_length: OptionalInt = None max_length: OptionalInt = None @classmethod def __modify_schema__(cls, field_schema: Dict[str, Any]) -> None: update_not_none( field_schema, type='string', writeOnly=True, format='password', ...
SecretStr
python
apache__airflow
airflow-ctl/src/airflowctl/api/operations.py
{ "start": 13468, "end": 14202 }
class ____(BaseOperations): """Config operations.""" def get(self, section: str, option: str) -> Config | ServerResponseError: """Get a config from the API server.""" try: self.response = self.client.get(f"/config/section/{section}/option/{option}") return Config.model_v...
ConfigOperations
python
realpython__materials
inheritance-and-composition/inheritance/employees.py
{ "start": 841, "end": 1056 }
class ____(Employee, FactoryRole, HourlyPolicy): def __init__(self, id, name, hours_worked, hour_rate): HourlyPolicy.__init__(self, hours_worked, hour_rate) super().__init__(id, name)
FactoryWorker
python
getsentry__sentry
tests/sentry/issues/test_group.py
{ "start": 729, "end": 4622 }
class ____(OccurrenceTestMixin, TestCase): def test_simple_fingerprint(self) -> None: group = self.create_group(project=self.project) fingerprint = "test-fingerprint-1" hashed_fingerprint = hash_fingerprint([fingerprint]) GroupHash.objects.create( project=self.project, ...
GetGroupByOccurrenceFingerprintTest
python
great-expectations__great_expectations
contrib/cli/great_expectations_contrib/package.py
{ "start": 1524, "end": 1680 }
class ____(str, Enum): CONCEPT_ONLY = "CONCEPT_ONLY" EXPERIMENTAL = "EXPERIMENTAL" BETA = "BETA" PRODUCTION = "PRODUCTION" @dataclass
Maturity
python
pypa__warehouse
warehouse/oidc/models/_core.py
{ "start": 13500, "end": 14011 }
class ____(OIDCPublisherMixin, db.Model): __tablename__ = "oidc_publishers" projects: Mapped[list[Project]] = orm.relationship( secondary=OIDCPublisherProjectAssociation.__table__, back_populates="oidc_publishers", ) macaroons: Mapped[list[Macaroon]] = orm.relationship( cascade=...
OIDCPublisher
python
numpy__numpy
tools/swig/test/testMatrix.py
{ "start": 12041, "end": 12312 }
class ____(MatrixTestCase): def __init__(self, methodName="runTest"): MatrixTestCase.__init__(self, methodName) self.typeStr = "longLong" self.typeCode = "q" ######################################################################
longLongTestCase
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/super13.py
{ "start": 116, "end": 155 }
class ____: pass func1(ClassA)
ClassA
python
python__mypy
mypy/checker.py
{ "start": 6572, "end": 6866 }
class ____(NamedTuple): node: DeferredNodeType # And its TypeInfo (for semantic analysis self type handling) active_typeinfo: TypeInfo | None # Same as above, but for fine-grained mode targets. Only top-level functions/methods # and module top levels are allowed as such.
DeferredNode
python
pytorch__pytorch
torch/onnx/_internal/fx/passes/type_promotion.py
{ "start": 3477, "end": 7576 }
class ____(TypePromotionRule): """Defines how to perform elementwise type promotion for 'torch.ops.{namespace}.{op_name}'.""" _USE_OPMATH: bool = False """Whether to use opmath to compute the promoted input dtype. If used, upcasts will be inserted everywhere for lower precision models. Set to False...
ElementwiseTypePromotionRule
python
sympy__sympy
sympy/physics/units/unitsystem.py
{ "start": 447, "end": 7593 }
class ____(_QuantityMapper): """ UnitSystem represents a coherent set of units. A unit system is basically a dimension system with notions of scales. Many of the methods are defined in the same way. It is much better if all base units have a symbol. """ _unit_systems: dict[str, UnitSystem...
UnitSystem
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_table15.py
{ "start": 315, "end": 1053 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("table15.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with tables.""" workbook = Workbook(se...
TestCompareXLSXFiles
python
huggingface__transformers
tests/models/speecht5/test_feature_extraction_speecht5.py
{ "start": 1476, "end": 4567 }
class ____: def __init__( self, parent, batch_size=7, min_seq_length=400, max_seq_length=2000, feature_size=1, padding_value=0.0, sampling_rate=16000, do_normalize=True, num_mel_bins=80, hop_length=16, win_length=64, ...
SpeechT5FeatureExtractionTester
python
pikepdf__pikepdf
src/pikepdf/canvas.py
{ "start": 2607, "end": 3448 }
class ____(Font): """Base class for fonts that have dimensional information. Specifically, these fonts can provide leading and ascent/descent values, and encode strings to the encoding used by the font. .. versionadded:: 9.8.1 """ @property @abstractmethod def leading(self) -> Decimal...
DimensionedFont
python
django__django
tests/template_tests/filter_tests/test_timesince.py
{ "start": 265, "end": 6101 }
class ____(TimezoneTestCase): """ #20246 - \xa0 in output avoids line-breaks between value and unit """ # Default compare with datetime.now() @setup({"timesince01": "{{ a|timesince }}"}) def test_timesince01(self): output = self.engine.render_to_string( "timesince01", {"a": ...
TimesinceTests
python
mlflow__mlflow
mlflow/store/_unity_catalog/registry/prompt_info.py
{ "start": 196, "end": 2198 }
class ____: """ Internal entity for prompt information from Unity Catalog. This represents prompt metadata without version-specific details like template. This maps to the Unity Catalog PromptInfo protobuf message. Note: This is an internal implementation detail and not part of the public API. ...
PromptInfo
python
sqlalchemy__sqlalchemy
examples/sharding/separate_databases.py
{ "start": 1224, "end": 2415 }
class ____(DeclarativeBase): pass # we need a way to create identifiers which are unique across all databases. # one easy way would be to just use a composite primary key, where one value # is the shard id. but here, we'll show something more "generic", an id # generation function. we'll use a simplistic "id t...
Base
python
pypa__setuptools
setuptools/_vendor/platformdirs/android.py
{ "start": 190, "end": 9016 }
class ____(PlatformDirsABC): """ Follows the guidance `from here <https://android.stackexchange.com/a/216132>`_. Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`, `version <platformdirs.api.PlatformDirsABC.version>`, `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`....
Android
python
pytest-dev__pytest
src/_pytest/reports.py
{ "start": 1699, "end": 9330 }
class ____: when: str | None location: tuple[str, int | None, str] | None longrepr: ( None | ExceptionInfo[BaseException] | tuple[str, int, str] | str | TerminalRepr ) sections: list[tuple[str, str]] nodeid: str outcome: Literal["passed", "failed", "skipped"] def __init__(self, ...
BaseReport
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/solver31.py
{ "start": 218, "end": 438 }
class ____(Generic[T]): def __init__(self, i: Iterable[T]): ... def func1(i: Iterable[T]) -> T: ... reveal_type(func1([0] + [""]), expected_text="str | int") reveal_type(A([0] + [""]), expected_text="A[str | int]")
A
python
wandb__wandb
wandb/sdk/artifacts/_generated/fetch_registries.py
{ "start": 643, "end": 833 }
class ____(GQLResult): page_info: PageInfoFragment = Field(alias="pageInfo") edges: List[FetchRegistriesOrganizationOrgEntityProjectsEdges]
FetchRegistriesOrganizationOrgEntityProjects
python
doocs__leetcode
solution/3300-3399/3301.Maximize the Total Height of Unique Towers/Solution.py
{ "start": 0, "end": 311 }
class ____: def maximumTotalSum(self, maximumHeight: List[int]) -> int: maximumHeight.sort() ans, mx = 0, inf for x in maximumHeight[::-1]: x = min(x, mx - 1) if x <= 0: return -1 ans += x mx = x return ans
Solution
python
ApeWorX__ape
src/ape/managers/converters.py
{ "start": 2061, "end": 2454 }
class ____(ConverterAPI): """ Convert list of hex values to single concatenated ``HexBytes`` value. """ def is_convertible(self, value: Any) -> bool: return isinstance(value, Iterable) and all(isinstance(v, bytes) or is_hex(v) for v in value) def convert(self, value: Any) -> bytes: ...
HexIterableConverter
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 184967, "end": 186570 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, client_id: str, client_secret: str, refresh_token: str, dc_region: str, environment: str, edition: str, start_datetime: Optional[str] = None, ): """Airby...
ZohoCrmSource
python
run-llama__llama_index
llama-index-packs/llama-index-packs-cohere-citation-chat/llama_index/packs/cohere_citation_chat/citations_context_chat_engine.py
{ "start": 1354, "end": 6259 }
class ____(StreamingAgentChatResponse): """Streaming chat response to user and writing to chat history.""" citations: List[Citation] = field(default_factory=list) documents: List[Document] = field(default_factory=list) citations_settings: CitationsSettings = field( default_factory=lambda: Citat...
StreamingAgentCitationsChatResponse
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 281181, "end": 281829 }
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("DeploymentStatusEdge"), graphql_name="edges" ) nodes = sg...
DeploymentStatusConnection
python
openai__openai-python
src/openai/lib/streaming/responses/_events.py
{ "start": 2636, "end": 2713 }
class ____(RawResponseTextDeltaEvent): snapshot: str
ResponseTextDeltaEvent
python
doocs__leetcode
solution/2400-2499/2447.Number of Subarrays With GCD Equal to K/Solution.py
{ "start": 0, "end": 254 }
class ____: def subarrayGCD(self, nums: List[int], k: int) -> int: ans = 0 for i in range(len(nums)): g = 0 for x in nums[i:]: g = gcd(g, x) ans += g == k return ans
Solution
python
django-haystack__django-haystack
test_haystack/elasticsearch_tests/test_elasticsearch_query.py
{ "start": 324, "end": 8719 }
class ____(TestCase): fixtures = ["base_data"] def setUp(self): super().setUp() self.sq = connections["elasticsearch"].get_query() def test_build_query_all(self): self.assertEqual(self.sq.build_query(), "*:*") def test_build_query_single_word(self): self.sq.add_filter(...
ElasticsearchSearchQueryTestCase
python
getsentry__sentry
src/sentry/analytics/events/codeowners_assignment.py
{ "start": 78, "end": 258 }
class ____(analytics.Event): organization_id: int project_id: int group_id: int updated_assignment: bool analytics.register(CodeOwnersAssignment)
CodeOwnersAssignment
python
getsentry__sentry
src/sentry/replays/usecases/query/conditions/selector.py
{ "start": 6887, "end": 7322 }
class ____(ComputedBase): """Rage selector composite condition class.""" @staticmethod def visit_eq(value: list[QueryType]) -> Condition: return is_rage_click(ClickSelectorComposite.visit_eq(value)) @staticmethod def visit_neq(value: list[QueryType]) -> Condition: return is_rage_cl...
RageClickSelectorComposite
python
huggingface__transformers
src/transformers/models/moshi/modeling_moshi.py
{ "start": 21468, "end": 26950 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config: MoshiConfig, layer_idx: Optional[int] = None, use_flexible_linear=False, use_rope=True): super().__init__() self.config = config self.layer_idx = layer_idx if la...
MoshiAttention
python
tensorflow__tensorflow
tensorflow/python/ops/ragged/dynamic_ragged_shape.py
{ "start": 75115, "end": 79685 }
class ____(abc.ABC): """A broadcaster of a single layer. Although this class does not literally contain a gather_index, the reference implementation is defined through a gather_index. Thus, any subclasses should first define the gather_index property. Other functions can be overridden for optimization, but i...
_LayerBroadcaster
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/partition_sets.py
{ "start": 6126, "end": 6295 }
class ____(graphene.Union): class Meta: types = (GraphenePartitionTags, GraphenePythonError) name = "PartitionTagsOrError"
GraphenePartitionTagsOrError
python
huggingface__transformers
src/transformers/models/sam3_tracker_video/modular_sam3_tracker_video.py
{ "start": 17844, "end": 17918 }
class ____(Sam2VideoInferenceCache): pass
Sam3TrackerVideoInferenceCache
python
PrefectHQ__prefect
src/integrations/prefect-databricks/prefect_databricks/models/jobs.py
{ "start": 21708, "end": 22384 }
class ____(BaseModel): """ See source code for the fields' description. Read-only state of the remote repository at the time the job was run. This field is only included on job runs. """ model_config = ConfigDict(extra="allow", frozen=True) used_commit: Optional[str] = Field( None, ...
GitSnapshot
python
huggingface__transformers
src/transformers/models/autoformer/modeling_autoformer.py
{ "start": 9828, "end": 12407 }
class ____(nn.Module): """ Computes a scaling factor as the weighted average absolute value along the first dimension, and scales the data accordingly. """ def __init__(self, config: AutoformerConfig): super().__init__() self.dim = config.scaling_dim if hasattr(config, "scaling_dim"...
AutoformerMeanScaler
python
dagster-io__dagster
python_modules/libraries/dagster-pandas/dagster_pandas/constraints.py
{ "start": 4607, "end": 5288 }
class ____: """Base constraint object that all constraints inherit from. Args: error_description (Optional[str]): The plain string description that is output in the terminal if the constraint fails. markdown_description (Optional[str]): A markdown supported description that is shown in the Dags...
Constraint
python
pytorch__pytorch
torch/autograd/function.py
{ "start": 13167, "end": 13811 }
class ____(type): """Function metaclass. This metaclass sets up the following properties: _backward_cls: The Function class corresponding to the differentiated version of this function (which is generated on the fly by this metaclass). """ def __init__(cls, name, bases,...
FunctionMeta
python
getsentry__sentry
tests/sentry/issues/auto_source_code_config/test_process_event.py
{ "start": 25859, "end": 27014 }
class ____(LanguageSpecificDeriveCodeMappings): platform = "csharp" def test_auto_source_code_config_csharp_trivial(self) -> None: self._process_and_assert_configuration_changes( repo_trees={REPO1: ["sentry/p/kanga.cs"]}, frames=[self.frame("/sentry/p/kanga.cs", True)], ...
TestCSharpDeriveCodeMappings
python
celery__celery
celery/contrib/sphinx.py
{ "start": 1061, "end": 2265 }
class ____(FunctionDocumenter): """Document task definitions.""" objtype = 'task' member_order = 11 @classmethod def can_document_member(cls, member, membername, isattr, parent): return isinstance(member, BaseTask) and getattr(member, '__wrapped__') def format_args(self): wrap...
TaskDocumenter
python
numba__numba
numba/tests/test_lists.py
{ "start": 37584, "end": 39263 }
class ____(ManagedListTestCase): def make_jitclass_element(self): spec = [ ('many', types.float64[:]), ('scalar', types.float64), ] JCItem = jitclass(spec)(Item) return JCItem def make_jitclass_container(self): spec = { 'data': types.L...
TestListAndJitClasses
python
getsentry__sentry
src/sentry/grouping/strategies/base.py
{ "start": 2947, "end": 7907 }
class ____: """ A key-value store used for passing state between strategy functions and other helpers used during grouping. Has a dictionary-like interface, along with a context manager which allows values to be temporarily overwritten: context = GroupingContext() context["some_key...
GroupingContext
python
sympy__sympy
sympy/polys/numberfields/galoisgroups.py
{ "start": 1041, "end": 20671 }
class ____(GaloisGroupException): ... def tschirnhausen_transformation(T, max_coeff=10, max_tries=30, history=None, fixed_order=True): r""" Given a univariate, monic, irreducible polynomial over the integers, find another such polynomial defining the same number field....
MaxTriesException
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/logs/events.py
{ "start": 4677, "end": 4866 }
class ____(graphene.Interface): stepKey = graphene.Field(graphene.String) solidHandleID = graphene.Field(graphene.String) class Meta: name = "StepEvent"
GrapheneStepEvent
python
doocs__leetcode
solution/2400-2499/2485.Find the Pivot Integer/Solution2.py
{ "start": 0, "end": 152 }
class ____: def pivotInteger(self, n: int) -> int: y = n * (n + 1) // 2 x = int(sqrt(y)) return x if x * x == y else -1
Solution
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/metaclass7.py
{ "start": 1195, "end": 1387 }
class ____(metaclass=MetaClass4): def __new__(cls, *args, **kwargs) -> Self: return super().__new__(cls, *args, **kwargs) v4 = Class4() reveal_type(v4, expected_text="Class4")
Class4
python
Lightning-AI__lightning
tests/tests_pytorch/callbacks/test_finetuning_callback.py
{ "start": 15127, "end": 16659 }
class ____(BoringModel): def __init__(self): super().__init__() self.layer = nn.Linear(32, 2) self.backbone = nn.Linear(32, 32) def forward(self, x): return self.layer(self.backbone(x)) def test_callbacks_restore_backbone(tmp_path): """Test callbacks restore is called afte...
BackboneBoringModel
python
walkccc__LeetCode
solutions/2462. Total Cost to Hire K Workers/2462.py
{ "start": 0, "end": 766 }
class ____: def totalCost(self, costs: list[int], k: int, candidates: int) -> int: ans = 0 i = 0 j = len(costs) - 1 minHeapL = [] # First half minHeapR = [] # Second half for _ in range(k): while len(minHeapL) < candidates and i <= j: heapq.heappush(minHeapL, costs[i]) ...
Solution
python
ray-project__ray
rllib/algorithms/impala/utils.py
{ "start": 65, "end": 3216 }
class ____: def __init__(self): self.L = 0.0 self.H = 0.4 self._recompute_candidates() # Defaultdict mapping. self.results = defaultdict(lambda: deque(maxlen=3)) self.iteration = 0 def _recompute_candidates(self): self.center = (self.L + self.H) / 2 ...
_SleepTimeController
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 858337, "end": 859731 }
class ____(sgqlc.types.Type, Node): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "column", "content", "created_at", "creator", "database_id", "is_archived", "note", "project", "resource...
ProjectCard
python
pytorch__pytorch
torch/_dynamo/source.py
{ "start": 35275, "end": 36100 }
class ____(Source): ind: int def name(self) -> str: return f"___get_torch_function_mode_stack_at({self._get_index()})" def _get_index(self) -> int: from .variables.torch_function import TorchFunctionModeStackVariable return TorchFunctionModeStackVariable.get_mode_index(self.ind) ...
TorchFunctionModeStackSource
python
dask__dask
dask/dataframe/dask_expr/_reductions.py
{ "start": 29327, "end": 29373 }
class ____(Max): reduction_chunk = M.min
Min
python
airbytehq__airbyte
airbyte-integrations/connectors/source-shopify/source_shopify/streams/streams.py
{ "start": 9044, "end": 9127 }
class ____(MetafieldShopifySubstream): parent_stream_class = Pages
MetafieldPages
python
mlflow__mlflow
dev/clint/src/clint/rules/missing_docstring_param.py
{ "start": 36, "end": 247 }
class ____(Rule): def __init__(self, params: set[str]) -> None: self.params = params def _message(self) -> str: return f"Missing parameters in docstring: {self.params}"
MissingDocstringParam
python
pyinstaller__pyinstaller
PyInstaller/lib/modulegraph/modulegraph.py
{ "start": 26740, "end": 28354 }
class ____(BaseModule): def __init__(self, *args, **kwds): warnings.warn( "This class will be removed in a future version of modulegraph", DeprecationWarning) super(FlatPackage, *args, **kwds) # HTML templates for ModuleGraph generator header = """\ <!DOCTYPE html> <html> ...
ArchiveModule
python
pytorch__pytorch
test/torch_np/numpy_tests/core/test_multiarray.py
{ "start": 210516, "end": 211161 }
class ____(TestCase): def test_complex_warning(self): x = np.array([1, 2]) y = np.array([1 - 2j, 1 + 2j]) # np.ComplexWarning moved to np.exceptions in numpy>=2.0.0 # np.exceptions only available in numpy>=1.25.0 has_exceptions_ns = hasattr(np, "exceptions") ComplexW...
TestWarnings
python
cython__cython
Demos/benchmarks/hexiom2.py
{ "start": 6416, "end": 17136 }
class ____(object): def __init__(self, hex, tiles, done = None): self.hex = hex self.tiles = tiles self.done = Done(hex.count) if done is None else done def clone(self): return Pos(self.hex, self.tiles, self.done.clone()) ################################## @cython.locals(pos=P...
Pos
python
facebookresearch__faiss
tests/test_rabitq.py
{ "start": 30995, "end": 48348 }
class ____(unittest.TestCase): def do_comparison_vs_ivfrabitq_test(self, metric_type=faiss.METRIC_L2): """Test IVFRaBitQFastScan produces similar results to IVFRaBitQ""" nlist = 64 nprobe = 8 nq = 500 ds = datasets.SyntheticDataset(128, 2048, 2048, nq) k = 10 ...
TestIVFRaBitQFastScan
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/extra_trace.py
{ "start": 1754, "end": 1826 }
class ____: def transform(self, arg): return arg
TransformBase
python
facebook__pyre-check
client/commands/tests/check_test.py
{ "start": 1857, "end": 11263 }
class ____(testslide.TestCase): def test_create_check_arguments(self) -> None: with tempfile.TemporaryDirectory() as root: root_path = Path(root).resolve() setup.ensure_directories_exists( root_path, [".pyre", "allows", "blocks", "search", "local/src"] ) ...
CheckTest
python
numpy__numpy
numpy/_core/arrayprint.py
{ "start": 52045, "end": 53036 }
class ____(_TimelikeFormat): def __init__(self, x, unit=None, timezone=None, casting='same_kind', legacy=False): # Get the unit from the dtype if unit is None: if x.dtype.kind == 'M': unit = datetime_data(x.dtype)[0] else: unit...
DatetimeFormat
python
getsentry__sentry
tests/sentry/core/endpoints/test_organization_member_team_details.py
{ "start": 10744, "end": 16120 }
class ____(CreateOrganizationMemberTeamTest): @cached_property def org(self): # rerun create org member tests with closed membership return self.create_organization(owner=self.user, flags=0) def test_member_must_request_access_to_join_team(self) -> None: self.login_as(self.member) ...
CreateWithClosedMembershipTest
python
joke2k__faker
faker/providers/person/hi_IN/__init__.py
{ "start": 44, "end": 9815 }
class ____(PersonProvider): formats_male = ( "{{first_name_male}} {{last_name}}", "{{prefix_male}} {{first_name_male}} {{last_name}}", "{{first_name_male}} {{last_name}}{{suffix}}", "{{prefix}} {{first_name_male}} {{last_name}}", ) formats_female = ( "{{first_name_fe...
Provider
python
bottlepy__bottle
test/test_wsgi.py
{ "start": 7443, "end": 8534 }
class ____(ServerTestBase): """ Test that close-able return types are actually closed """ def setUp(self): super().setUp() def closeable(self, body=["OK"]): self.closeable = CloseableBody(body) def assertClosed(self, body, open_args=None): closeable = CloseableBody(body) ...
TestCloseable
python
pandas-dev__pandas
pandas/tests/tslibs/test_conversion.py
{ "start": 3893, "end": 4696 }
class ____(datetime): pass @pytest.mark.parametrize( "dt, expected", [ pytest.param( Timestamp("2000-01-01"), Timestamp("2000-01-01", tz=timezone.utc), id="timestamp", ), pytest.param( datetime(2000, 1, 1), datetime(2000, ...
SubDatetime
python
psf__requests
src/requests/exceptions.py
{ "start": 2671, "end": 2763 }
class ____(RequestException): """A valid URL is required to make a request."""
URLRequired
python
kubernetes-client__python
kubernetes/client/models/v1alpha1_pod_certificate_request_list.py
{ "start": 383, "end": 7334 }
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...
V1alpha1PodCertificateRequestList
python
jazzband__django-simple-history
simple_history/template_utils.py
{ "start": 6325, "end": 9518 }
class ____: """ A class grouping functions and settings related to displaying the textual difference between two (or more) objects. ``common_shorten_repr()`` is the main method for this. The code is based on https://github.com/python/cpython/blob/v3.12.0/Lib/unittest/util.py#L8-L52. """ ...
ObjDiffDisplay
python
streamlit__streamlit
lib/tests/streamlit/elements/video_test.py
{ "start": 1147, "end": 9079 }
class ____(DeltaGeneratorTestCase): def test_st_video_from_bytes(self): """Test st.video using fake bytes data.""" # Make up some bytes to pretend we have a video. The server should not vet # the video before sending it to the browser. fake_video_data = b"\x12\x10\x35\x44\x55\x66" ...
VideoTest
python
crytic__slither
slither/detectors/statements/unary.py
{ "start": 1253, "end": 1766 }
class ____(ExpressionVisitor): def __init__(self, expression: Expression) -> None: self.result: bool = False super().__init__(expression) def _post_unary_operation(self, expression: UnaryOperation) -> None: if expression.type == UnaryOperationType.PLUS_PRE: # This is defined...
InvalidUnaryStateVariableDetector
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 71524, "end": 71868 }
class ____(str, Enum): """ If used, include weight modification, which will be applied to sparse vectors at query time: None - no modification (default) Idf - inverse document frequency, based on statistics of the collection """ def __str__(self) -> str: return str(self.value) NONE = "none...
Modifier
python
pytorch__pytorch
test/export/test_lift_unlift.py
{ "start": 649, "end": 4677 }
class ____: def __init__(self) -> None: self.graph = torch.fx.Graph() self.nodes = {} self.values = {} self.nn_module_stack_key: dict[str, int] = {} self.latest_id = 0 self.input_to_kind: dict[torch.fx.Node, InputKind] = {} def input(self, name: str, value: torch...
GraphBuilder
python
scikit-learn__scikit-learn
asv_benchmarks/benchmarks/common.py
{ "start": 2270, "end": 3064 }
class ____(ABC): """Abstract base class for all the benchmarks""" timer = timeit.default_timer # wall time processes = 1 timeout = 500 ( profile, n_jobs_vals, save_estimators, save_dir, base_commit, bench_predict, bench_transform, ) = ge...
Benchmark
python
sanic-org__sanic
sanic/logging/formatter.py
{ "start": 7027, "end": 7846 }
class ____(AutoFormatter): MESSAGE_FORMAT = ( f"{c.PURPLE}%(host)s " f"{c.BLUE + c.BOLD}%(request)s{c.END} " f"%(right)s%(status)s %(byte)s {c.GREY}%(duration)s{c.END}" ) def format(self, record: logging.LogRecord) -> str: status = len(str(getattr(record, "status", ""))) ...
AutoAccessFormatter