All instance attributes on memoryview are read-only (#6878)

* All instance attributes on `memoryview` are read-only

* [pre-commit.ci] auto fixes from pre-commit.com hooks

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Alex Waygood
2022-01-09 20:07:09 +00:00
committed by GitHub
parent e743ea9ca7
commit a0b5deda40

View File

@@ -649,19 +649,30 @@ class bytearray(MutableSequence[int], ByteString):
@final
class memoryview(Sized, Sequence[int]):
format: str
itemsize: int
shape: tuple[int, ...] | None
strides: tuple[int, ...] | None
suboffsets: tuple[int, ...] | None
readonly: bool
ndim: int
obj: bytes | bytearray
c_contiguous: bool
f_contiguous: bool
contiguous: bool
nbytes: int
@property
def format(self) -> str: ...
@property
def itemsize(self) -> int: ...
@property
def shape(self) -> tuple[int, ...] | None: ...
@property
def strides(self) -> tuple[int, ...] | None: ...
@property
def suboffsets(self) -> tuple[int, ...] | None: ...
@property
def readonly(self) -> bool: ...
@property
def ndim(self) -> int: ...
@property
def obj(self) -> bytes | bytearray: ...
@property
def c_contiguous(self) -> bool: ...
@property
def f_contiguous(self) -> bool: ...
@property
def contiguous(self) -> bool: ...
@property
def nbytes(self) -> int: ...
def __init__(self, obj: ReadableBuffer) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(