fix some issues found by stubcheck (#1303)

- ThreadError exists (undocumented) on Python 3. It's an alias for _thread.error,
  but making it a separate exception seems fine.
- zipfile.error is an alias for BadZipFile on both Python versions.
- zlib.Compress and Decompress are not actually accessible at runtime.
This commit is contained in:
Jelle Zijlstra
2017-05-23 12:44:35 -07:00
committed by Matthias Kramm
parent 0aa7138c4e
commit 6f6fa428ce
3 changed files with 10 additions and 10 deletions

View File

@@ -37,8 +37,7 @@ def stack_size(size: int = ...) -> int: ...
if sys.version_info >= (3,):
TIMEOUT_MAX = ... # type: int
if sys.version_info < (3,):
class ThreadError(Exception): ...
class ThreadError(Exception): ...
# TODO: Change to a class with __getattr__ and __setattr__

View File

@@ -14,6 +14,7 @@ if sys.version_info >= (3,):
BadZipfile = BadZipFile
else:
class BadZipfile(Exception): ...
error = BadZipfile
class LargeZipFile(Exception): ...

View File

@@ -22,20 +22,20 @@ if sys.version_info >= (3,):
class error(Exception): ...
class Compress:
class _Compress:
def compress(self, data: bytes) -> bytes: ...
def flush(self, mode: int = ...) -> bytes: ...
def copy(self) -> "Compress": ...
def copy(self) -> _Compress: ...
class Decompress:
class _Decompress:
unused_data = ... # type: bytes
unconsumed_tail = ... # type: bytes
if sys.version_info >= (3,):
eof = ... # type: bool
def decompress(self, data: bytes, max_length: int = ...) -> bytes: ...
def flush(self, length: int = ...) -> bytes: ...
def copy(self) -> "Decompress": ...
def copy(self) -> _Decompress: ...
def adler32(data: bytes, value: int = ...) -> int: ...
@@ -43,13 +43,13 @@ def compress(data: bytes, level: int = ...) -> bytes: ...
if sys.version_info >= (3,):
def compressobj(level: int = ..., method: int = ..., wbits: int = ...,
memLevel: int = ..., strategy: int = ...,
zdict: bytes = ...) -> Compress: ...
zdict: bytes = ...) -> _Compress: ...
else:
def compressobj(level: int = ..., method: int = ..., wbits: int = ...,
memlevel: int = ..., strategy: int = ...) -> Compress: ...
memlevel: int = ..., strategy: int = ...) -> _Compress: ...
def crc32(data: bytes, value: int = ...) -> int: ...
def decompress(data: bytes, wbits: int = ..., bufsize: int = ...) -> bytes: ...
if sys.version_info >= (3,):
def decompressobj(wbits: int = ..., zdict: bytes = ...) -> Decompress: ...
def decompressobj(wbits: int = ..., zdict: bytes = ...) -> _Decompress: ...
else:
def decompressobj(wbits: int = ...) -> Decompress: ...
def decompressobj(wbits: int = ...) -> _Decompress: ...