FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`memoryview`: remove inheritance from `Sequence` by trim21 · Pull Request #12781 · python/typeshed · GitHub

Repository navigation

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .pyi  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Next Next commit
memoryview doesn't have index and count
  • Loading branch information
trim21 committed Oct 11, 2024
commit 4ffecce35ddf346327f8be44728363c48ff3f60a
16 changes: 15 additions & 1 deletion stdlib/builtins.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ from _typeshed import (
SupportsRichComparisonT,
SupportsWrite,
)
from abc import abstractmethod
from collections.abc import Awaitable, Callable, Iterable, Iterator, MutableSet, Reversible, Set as AbstractSet, Sized
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
from types import CellType, CodeType, TracebackType
Expand All @@ -41,6 +42,7 @@ from typing import ( # noqa: Y022
Any,
BinaryIO,
ClassVar,
Collection,
Generic,
Mapping,
MutableMapping,
Expand Down Expand Up @@ -833,8 +835,20 @@ _IntegerFormats: TypeAlias = Literal[
"b", "B", "@b", "@B", "h", "H", "@h", "@H", "i", "I", "@i", "@I", "l", "L", "@l", "@L", "q", "Q", "@q", "@Q", "P", "@P"
]

# Sequence[T] without index and count
class __memory_view(Collection[_T_co], Reversible[_T_co]):
@overload
@abstractmethod
def __getitem__(self, index: int) -> _T_co: ...
@overload
@abstractmethod
def __getitem__(self, index: slice) -> __memory_view[_T_co]: ...
def __contains__(self, value: object) -> bool: ...
def __iter__(self) -> Iterator[_T_co]: ...
def __reversed__(self) -> Iterator[_T_co]: ...

@final
class memoryview(Sequence[_I]):
class memoryview(__memory_view[_I]):
@property
def format(self) -> str: ...
@property
Expand Down

Back | FazBrowse Home | New Git URL