From a0b5deda4072c74ff893e7fbb696bba34a089ad1 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 9 Jan 2022 20:07:09 +0000 Subject: [PATCH] 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> --- stdlib/builtins.pyi | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index e648b96c6..b4ca53dd9 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -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__(