from typing import final

from mypy_extensions import i64, u8

@final
class BytesWriter:
    def append(self, /, x: int) -> None: ...
    def write(self, /, b: bytes | bytearray) -> None: ...
    def getvalue(self) -> bytes: ...
    def truncate(self, /, size: i64) -> None: ...
    def __len__(self) -> i64: ...
    def __getitem__(self, /, i: i64) -> u8: ...
    def __setitem__(self, /, i: i64, x: u8) -> None: ...
