py3compat.pyi 837 B

123456789101112131415161718192021222324252627282930313233
  1. from typing import Union, Any, Optional, IO
  2. Buffer = Union[bytes, bytearray, memoryview]
  3. import sys
  4. def b(s: str) -> bytes: ...
  5. def bchr(s: int) -> bytes: ...
  6. def bord(s: bytes) -> int: ...
  7. def tobytes(s: Union[bytes, str]) -> bytes: ...
  8. def tostr(b: bytes) -> str: ...
  9. def bytestring(x: Any) -> bool: ...
  10. def is_native_int(s: Any) -> bool: ...
  11. def is_string(x: Any) -> bool: ...
  12. def is_bytes(x: Any) -> bool: ...
  13. def BytesIO(b: bytes) -> IO[bytes]: ...
  14. def StringIO(s: str) -> IO[str]: ...
  15. if sys.version_info[0] == 2:
  16. from sys import maxint
  17. iter_range = xrange
  18. else:
  19. from sys import maxsize as maxint
  20. iter_range = range
  21. class FileNotFoundError:
  22. def __init__(self, err: int, msg: str, filename: str) -> None:
  23. pass
  24. def _copy_bytes(start: Optional[int], end: Optional[int], seq: Buffer) -> bytes: ...