mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 14:46:55 +08:00
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:
committed by
Matthias Kramm
parent
0aa7138c4e
commit
6f6fa428ce
@@ -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__
|
||||
|
||||
@@ -14,6 +14,7 @@ if sys.version_info >= (3,):
|
||||
BadZipfile = BadZipFile
|
||||
else:
|
||||
class BadZipfile(Exception): ...
|
||||
error = BadZipfile
|
||||
|
||||
class LargeZipFile(Exception): ...
|
||||
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user