mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
future first: switch the order of some if statements (#5206)
Since we're adding this to our contribution guidelines in https://github.com/python/typeshed/pull/5205
This commit is contained in:
@@ -6,12 +6,12 @@ from typing import Any, Callable, Dict, Optional, Text, Tuple, Union
|
||||
_Handler = Callable[[Exception], Tuple[Text, int]]
|
||||
_String = Union[bytes, str]
|
||||
_Errors = Union[str, Text, None]
|
||||
if sys.version_info < (3, 0):
|
||||
_Decodable = Union[bytes, Text]
|
||||
_Encodable = Union[bytes, Text]
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
_Decodable = bytes
|
||||
_Encodable = str
|
||||
else:
|
||||
_Decodable = Union[bytes, Text]
|
||||
_Encodable = Union[bytes, Text]
|
||||
|
||||
# This type is not exposed; it is defined in unicodeobject.c
|
||||
class _EncodingMap(object):
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import sys
|
||||
from typing import IO, Optional, Union
|
||||
|
||||
if sys.version_info < (3,):
|
||||
_encodable = Union[bytes, unicode]
|
||||
_decodable = Union[bytes, unicode]
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
_encodable = bytes
|
||||
_decodable = Union[bytes, str]
|
||||
else:
|
||||
_encodable = Union[bytes, unicode]
|
||||
_decodable = Union[bytes, unicode]
|
||||
|
||||
def b64encode(s: _encodable, altchars: Optional[bytes] = ...) -> bytes: ...
|
||||
def b64decode(s: _decodable, altchars: Optional[bytes] = ..., validate: bool = ...) -> bytes: ...
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import sys
|
||||
from typing import Text, Union
|
||||
|
||||
if sys.version_info < (3,):
|
||||
# Python 2 accepts unicode ascii pretty much everywhere.
|
||||
_Bytes = Text
|
||||
_Ascii = Text
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
# But since Python 3.3 ASCII-only unicode strings are accepted by the
|
||||
# a2b_* functions.
|
||||
_Bytes = bytes
|
||||
_Ascii = Union[bytes, str]
|
||||
else:
|
||||
# Python 2 accepts unicode ascii pretty much everywhere.
|
||||
_Bytes = Text
|
||||
_Ascii = Text
|
||||
|
||||
def a2b_uu(__data: _Ascii) -> bytes: ...
|
||||
|
||||
|
||||
@@ -76,14 +76,14 @@ class HTMLCalendar(Calendar):
|
||||
cssclass_year: str
|
||||
cssclass_year_head: str
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
class TimeEncoding:
|
||||
if sys.version_info >= (3, 0):
|
||||
class different_locale:
|
||||
def __init__(self, locale: _LocaleType) -> None: ...
|
||||
def __enter__(self) -> _LocaleType: ...
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
|
||||
else:
|
||||
class different_locale:
|
||||
class TimeEncoding:
|
||||
def __init__(self, locale: _LocaleType) -> None: ...
|
||||
def __enter__(self) -> _LocaleType: ...
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import sys
|
||||
from typing import Any, Dict, Generic, List, Optional, Tuple, Type, TypeVar, Union, overload
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
from _collections_abc import *
|
||||
else:
|
||||
if sys.version_info >= (3, 10):
|
||||
from typing import (
|
||||
Callable,
|
||||
ItemsView,
|
||||
@@ -17,6 +15,8 @@ else:
|
||||
Sequence,
|
||||
ValuesView,
|
||||
)
|
||||
else:
|
||||
from _collections_abc import *
|
||||
|
||||
_S = TypeVar("_S")
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -3,10 +3,10 @@ from decimal import Decimal
|
||||
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union
|
||||
|
||||
# workaround for mypy#2010
|
||||
if sys.version_info < (3,):
|
||||
from __builtin__ import str as _str
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from builtins import str as _str
|
||||
else:
|
||||
from __builtin__ import str as _str
|
||||
|
||||
CODESET: int
|
||||
D_T_FMT: int
|
||||
|
||||
@@ -228,16 +228,16 @@ class _ASN1Object(NamedTuple):
|
||||
longname: str
|
||||
oid: str
|
||||
|
||||
if sys.version_info < (3,):
|
||||
class Purpose(_ASN1Object):
|
||||
SERVER_AUTH: ClassVar[Purpose]
|
||||
CLIENT_AUTH: ClassVar[Purpose]
|
||||
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
class Purpose(_ASN1Object, enum.Enum):
|
||||
SERVER_AUTH: _ASN1Object
|
||||
CLIENT_AUTH: _ASN1Object
|
||||
|
||||
else:
|
||||
class Purpose(_ASN1Object):
|
||||
SERVER_AUTH: ClassVar[Purpose]
|
||||
CLIENT_AUTH: ClassVar[Purpose]
|
||||
|
||||
class SSLSocket(socket.socket):
|
||||
context: SSLContext
|
||||
server_side: bool
|
||||
|
||||
@@ -23,12 +23,12 @@ if sys.version_info >= (3, 9):
|
||||
# reveal_type(e.cmd) # Any, but morally is _CMD
|
||||
_FILE = Union[None, int, IO[Any]]
|
||||
_TXT = Union[bytes, str]
|
||||
if sys.version_info < (3, 8):
|
||||
if sys.version_info >= (3, 8):
|
||||
_CMD = Union[AnyPath, Sequence[AnyPath]]
|
||||
else:
|
||||
# Python 3.6 doesn't support _CMD being a single PathLike.
|
||||
# See: https://bugs.python.org/issue31961
|
||||
_CMD = Union[_TXT, Sequence[AnyPath]]
|
||||
else:
|
||||
_CMD = Union[AnyPath, Sequence[AnyPath]]
|
||||
if sys.platform == "win32":
|
||||
_ENV = Mapping[str, str]
|
||||
else:
|
||||
|
||||
@@ -20,9 +20,7 @@ AUDIO_FILE_ENCODING_ADPCM_G723_5: int
|
||||
AUDIO_FILE_ENCODING_ALAW_8: int
|
||||
AUDIO_UNKNOWN_SIZE: int
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
_sunau_params = Tuple[int, int, int, int, str, str]
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
class _sunau_params(NamedTuple):
|
||||
nchannels: int
|
||||
sampwidth: int
|
||||
@@ -31,6 +29,9 @@ else:
|
||||
comptype: str
|
||||
compname: str
|
||||
|
||||
else:
|
||||
_sunau_params = Tuple[int, int, int, int, str, str]
|
||||
|
||||
class Au_read:
|
||||
def __init__(self, f: _File) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
|
||||
@@ -7,9 +7,7 @@ class Error(Exception): ...
|
||||
|
||||
WAVE_FORMAT_PCM: int
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
_wave_params = Tuple[int, int, int, int, str, str]
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
class _wave_params(NamedTuple):
|
||||
nchannels: int
|
||||
sampwidth: int
|
||||
@@ -18,6 +16,9 @@ else:
|
||||
comptype: str
|
||||
compname: str
|
||||
|
||||
else:
|
||||
_wave_params = Tuple[int, int, int, int, str, str]
|
||||
|
||||
class Wave_read:
|
||||
def __init__(self, f: _File) -> None: ...
|
||||
if sys.version_info >= (3, 0):
|
||||
|
||||
@@ -59,18 +59,18 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def copy(self) -> WeakValueDictionary[_KT, _VT]: ...
|
||||
if sys.version_info < (3, 0):
|
||||
if sys.version_info >= (3, 0):
|
||||
# These are incompatible with Mapping
|
||||
def keys(self) -> Iterator[_KT]: ... # type: ignore
|
||||
def values(self) -> Iterator[_VT]: ... # type: ignore
|
||||
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
|
||||
else:
|
||||
def keys(self) -> List[_KT]: ...
|
||||
def values(self) -> List[_VT]: ...
|
||||
def items(self) -> List[Tuple[_KT, _VT]]: ...
|
||||
def iterkeys(self) -> Iterator[_KT]: ...
|
||||
def itervalues(self) -> Iterator[_VT]: ...
|
||||
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
|
||||
else:
|
||||
# These are incompatible with Mapping
|
||||
def keys(self) -> Iterator[_KT]: ... # type: ignore
|
||||
def values(self) -> Iterator[_VT]: ... # type: ignore
|
||||
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
|
||||
def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ...
|
||||
def valuerefs(self) -> List[KeyedRef[_KT, _VT]]: ...
|
||||
|
||||
@@ -95,7 +95,12 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def copy(self) -> WeakKeyDictionary[_KT, _VT]: ...
|
||||
if sys.version_info < (3, 0):
|
||||
if sys.version_info >= (3, 0):
|
||||
# These are incompatible with Mapping
|
||||
def keys(self) -> Iterator[_KT]: ... # type: ignore
|
||||
def values(self) -> Iterator[_VT]: ... # type: ignore
|
||||
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
|
||||
else:
|
||||
def keys(self) -> List[_KT]: ...
|
||||
def values(self) -> List[_VT]: ...
|
||||
def items(self) -> List[Tuple[_KT, _VT]]: ...
|
||||
@@ -103,11 +108,6 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
|
||||
def itervalues(self) -> Iterator[_VT]: ...
|
||||
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
|
||||
def iterkeyrefs(self) -> Iterator[ref[_KT]]: ...
|
||||
else:
|
||||
# These are incompatible with Mapping
|
||||
def keys(self) -> Iterator[_KT]: ... # type: ignore
|
||||
def values(self) -> Iterator[_VT]: ... # type: ignore
|
||||
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
|
||||
def keyrefs(self) -> List[ref[_KT]]: ...
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
|
||||
@@ -4,10 +4,10 @@ from typing import List, Optional, Type, TypeVar, overload
|
||||
from .handlers import SimpleHandler
|
||||
from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment
|
||||
|
||||
if sys.version_info < (3,):
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
else:
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||
|
||||
server_version: str # undocumented
|
||||
sys_version: str # undocumented
|
||||
|
||||
@@ -10,10 +10,10 @@ class FileWrapper:
|
||||
def __init__(self, filelike: IO[bytes], blksize: int = ...) -> None: ...
|
||||
def __getitem__(self, key: Any) -> bytes: ...
|
||||
def __iter__(self) -> FileWrapper: ...
|
||||
if sys.version_info < (3,):
|
||||
def next(self) -> bytes: ...
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
def __next__(self) -> bytes: ...
|
||||
else:
|
||||
def next(self) -> bytes: ...
|
||||
|
||||
def guess_scheme(environ: WSGIEnvironment) -> str: ...
|
||||
def application_uri(environ: WSGIEnvironment) -> str: ...
|
||||
|
||||
@@ -9,12 +9,12 @@ def validator(application: WSGIApplication) -> WSGIApplication: ...
|
||||
class InputWrapper:
|
||||
input: InputStream
|
||||
def __init__(self, wsgi_input: InputStream) -> None: ...
|
||||
if sys.version_info < (3,):
|
||||
def read(self, size: int = ...) -> bytes: ...
|
||||
def readline(self) -> bytes: ...
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
def read(self, size: int) -> bytes: ...
|
||||
def readline(self, size: int = ...) -> bytes: ...
|
||||
else:
|
||||
def read(self, size: int = ...) -> bytes: ...
|
||||
def readline(self) -> bytes: ...
|
||||
def readlines(self, hint: int = ...) -> bytes: ...
|
||||
def __iter__(self) -> Iterable[bytes]: ...
|
||||
def close(self) -> NoReturn: ...
|
||||
@@ -44,9 +44,9 @@ class IteratorWrapper:
|
||||
check_start_response: Optional[bool]
|
||||
def __init__(self, wsgi_iterator: Iterator[bytes], check_start_response: Optional[bool]) -> None: ...
|
||||
def __iter__(self) -> IteratorWrapper: ...
|
||||
if sys.version_info < (3,):
|
||||
def next(self) -> bytes: ...
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
def __next__(self) -> bytes: ...
|
||||
else:
|
||||
def next(self) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
@@ -11,10 +11,10 @@ from yaml.tokens import * # noqa: F403
|
||||
from . import resolver as resolver # Help mypy a bit; this is implied by loader and dumper
|
||||
from .cyaml import *
|
||||
|
||||
if sys.version_info < (3,):
|
||||
_Str = Union[Text, str]
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
_Str = str
|
||||
else:
|
||||
_Str = Union[Text, str]
|
||||
# FIXME: the functions really return py2:unicode/py3:str if encoding is None, otherwise py2:str/py3:bytes. Waiting for python/mypy#5621
|
||||
_Yaml = Any
|
||||
|
||||
|
||||
@@ -32,14 +32,14 @@ from .datastructures import (
|
||||
WWWAuthenticate,
|
||||
)
|
||||
|
||||
if sys.version_info < (3,):
|
||||
_Str = TypeVar("_Str", str, unicode)
|
||||
_ToBytes = Union[bytes, bytearray, buffer, unicode]
|
||||
_ETagData = Union[str, unicode, bytearray, buffer, memoryview]
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
_Str = str
|
||||
_ToBytes = Union[bytes, bytearray, memoryview, str]
|
||||
_ETagData = Union[bytes, bytearray, memoryview]
|
||||
else:
|
||||
_Str = TypeVar("_Str", str, unicode)
|
||||
_ToBytes = Union[bytes, bytearray, buffer, unicode]
|
||||
_ETagData = Union[str, unicode, bytearray, buffer, memoryview]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_U = TypeVar("_U")
|
||||
|
||||
@@ -45,10 +45,10 @@ class GuardedIterator(object):
|
||||
chunks: List[int]
|
||||
def __init__(self, iterator: Iterable[str], headers_set: bool, chunks: List[int]) -> None: ...
|
||||
def __iter__(self) -> GuardedIterator: ...
|
||||
if sys.version_info < (3,):
|
||||
def next(self) -> str: ...
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
def __next__(self) -> str: ...
|
||||
else:
|
||||
def next(self) -> str: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class LintMiddleware(object):
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import sys
|
||||
from typing import Any, Optional
|
||||
|
||||
if sys.version_info < (3,):
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||
from SocketServer import ThreadingMixIn
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from socketserver import ThreadingMixIn
|
||||
else:
|
||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||
from SocketServer import ThreadingMixIn
|
||||
|
||||
if sys.platform == "win32":
|
||||
class ForkingMixIn(object): ...
|
||||
|
||||
else:
|
||||
if sys.version_info < (3,):
|
||||
from SocketServer import ForkingMixIn as ForkingMixIn
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from socketserver import ForkingMixIn as ForkingMixIn
|
||||
else:
|
||||
from SocketServer import ForkingMixIn as ForkingMixIn
|
||||
|
||||
class _SslDummy:
|
||||
def __getattr__(self, name): ...
|
||||
|
||||
@@ -3,12 +3,12 @@ from _typeshed.wsgi import WSGIEnvironment
|
||||
from typing import Any, Generic, Optional, Text, Tuple, Type, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info < (3,):
|
||||
from cookielib import CookieJar
|
||||
from urllib2 import Request as U2Request
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from http.cookiejar import CookieJar
|
||||
from urllib.request import Request as U2Request
|
||||
else:
|
||||
from cookielib import CookieJar
|
||||
from urllib2 import Request as U2Request
|
||||
|
||||
def stream_encode_multipart(
|
||||
values, use_tempfile: int = ..., threshold=..., boundary: Optional[Any] = ..., charset: Text = ...
|
||||
|
||||
@@ -14,15 +14,15 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
||||
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
|
||||
def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore
|
||||
def update(self: _T, __m: _T) -> None: ...
|
||||
if sys.version_info < (3, 0):
|
||||
if sys.version_info >= (3, 0):
|
||||
def items(self) -> ItemsView[str, object]: ...
|
||||
def keys(self) -> KeysView[str]: ...
|
||||
def values(self) -> ValuesView[object]: ...
|
||||
else:
|
||||
def has_key(self, k: str) -> bool: ...
|
||||
def viewitems(self) -> ItemsView[str, object]: ...
|
||||
def viewkeys(self) -> KeysView[str]: ...
|
||||
def viewvalues(self) -> ValuesView[object]: ...
|
||||
else:
|
||||
def items(self) -> ItemsView[str, object]: ...
|
||||
def keys(self) -> KeysView[str]: ...
|
||||
def values(self) -> ValuesView[object]: ...
|
||||
def __delitem__(self, k: NoReturn) -> None: ...
|
||||
|
||||
def TypedDict(typename: str, fields: Dict[str, Type[Any]], total: bool = ...) -> Type[Dict[str, Any]]: ...
|
||||
|
||||
@@ -99,12 +99,12 @@ max_byte: bytes
|
||||
cr_byte: bytes
|
||||
linefeed_byte: bytes
|
||||
crlf: bytes
|
||||
if sys.version_info < (3, 0):
|
||||
cr_byte_value: bytes
|
||||
linefeed_byte_value: bytes
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
cr_byte_value: int
|
||||
linefeed_byte_value: int
|
||||
else:
|
||||
cr_byte_value: bytes
|
||||
linefeed_byte_value: bytes
|
||||
|
||||
class _SupportsAsBytes(Protocol):
|
||||
def asbytes(self) -> bytes: ...
|
||||
|
||||
@@ -6,10 +6,10 @@ from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey
|
||||
from paramiko.message import Message
|
||||
from paramiko.transport import Transport
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from hashlib import _hash as _Hash
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
c_MSG_KEXECDH_INIT: bytes
|
||||
c_MSG_KEXECDH_REPLY: bytes
|
||||
|
||||
@@ -6,10 +6,10 @@ from cryptography.hazmat.primitives.asymmetric.ec2 import EllipticCurve, Ellipti
|
||||
from paramiko.message import Message
|
||||
from paramiko.transport import Transport
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from hashlib import _hash as _Hash
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
c_MSG_KEXECDH_INIT: bytes
|
||||
c_MSG_KEXECDH_REPLY: bytes
|
||||
|
||||
@@ -5,10 +5,10 @@ from typing import Callable, Optional
|
||||
from paramiko.message import Message
|
||||
from paramiko.transport import Transport
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from hashlib import _hash as _Hash
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
c_MSG_KEXDH_GEX_REQUEST_OLD: bytes
|
||||
c_MSG_KEXDH_GEX_GROUP: bytes
|
||||
|
||||
@@ -5,10 +5,10 @@ from typing import Callable
|
||||
from paramiko.message import Message
|
||||
from paramiko.transport import Transport
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from hashlib import _hash as _Hash
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
c_MSG_KEXDH_INIT: bytes
|
||||
c_MSG_KEXDH_REPLY: bytes
|
||||
|
||||
@@ -4,10 +4,10 @@ from typing import Callable
|
||||
|
||||
from paramiko.kex_group1 import KexGroup1 as KexGroup1
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from hashlib import _hash as _Hash
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
class KexGroup14(KexGroup1):
|
||||
P: int
|
||||
|
||||
@@ -4,10 +4,10 @@ from typing import Callable
|
||||
|
||||
from paramiko.kex_group1 import KexGroup1 as KexGroup1
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from hashlib import _hash as _Hash
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
class KexGroup16SHA512(KexGroup1):
|
||||
name: str
|
||||
|
||||
@@ -3,12 +3,12 @@ from typing import Any, Iterable, List, Optional, Text
|
||||
|
||||
from .common import _LikeBytes
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
if sys.version_info >= (3, 0):
|
||||
from io import BytesIO
|
||||
else:
|
||||
from StringIO import StringIO
|
||||
|
||||
BytesIO = StringIO[bytes]
|
||||
else:
|
||||
from io import BytesIO
|
||||
|
||||
class Message:
|
||||
big_int: int
|
||||
|
||||
@@ -7,10 +7,10 @@ from cryptography.hazmat.primitives.ciphers import Cipher
|
||||
from paramiko.compress import ZlibCompressor, ZlibDecompressor
|
||||
from paramiko.message import Message
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from hashlib import _hash as _Hash
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
def compute_hmac(key: bytes, message: bytes, digest_class: _Hash) -> bytes: ...
|
||||
|
||||
|
||||
@@ -16,18 +16,18 @@ def input(prompt: Any) -> str: ...
|
||||
def decodebytes(s: bytes) -> bytes: ...
|
||||
def encodebytes(s: bytes) -> bytes: ...
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
import __builtin__ as builtins
|
||||
import cStringIO
|
||||
|
||||
StringIO = cStringIO.StringIO
|
||||
BytesIO = StringIO
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
import builtins as builtins
|
||||
import io
|
||||
|
||||
StringIO = io.StringIO
|
||||
BytesIO = io.BytesIO
|
||||
else:
|
||||
import __builtin__ as builtins
|
||||
import cStringIO
|
||||
|
||||
StringIO = cStringIO.StringIO
|
||||
BytesIO = StringIO
|
||||
|
||||
def byte_ord(c: Union[int, str]) -> int: ...
|
||||
def byte_chr(c: int) -> bytes: ...
|
||||
|
||||
@@ -6,10 +6,10 @@ from typing import IO, AnyStr, Callable, Generic, List, Optional, Protocol, Text
|
||||
from paramiko.config import SSHConfig, SSHConfigDict
|
||||
from paramiko.hostkeys import HostKeys
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from hashlib import _hash as _Hash
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
class SupportsClose(Protocol):
|
||||
def close(self) -> None: ...
|
||||
|
||||
@@ -10,10 +10,10 @@ class EncodeError(Error): ...
|
||||
|
||||
_M = TypeVar("_M", bound=Message) # message type (of self)
|
||||
|
||||
if sys.version_info < (3,):
|
||||
_Serialized = Union[bytes, buffer, unicode]
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
_Serialized = ByteString
|
||||
else:
|
||||
_Serialized = Union[bytes, buffer, unicode]
|
||||
|
||||
class Message:
|
||||
DESCRIPTOR: Descriptor
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import sys
|
||||
from typing import Any, MutableMapping
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from cookielib import CookieJar
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from http.cookiejar import CookieJar
|
||||
else:
|
||||
from cookielib import CookieJar
|
||||
|
||||
class MockRequest:
|
||||
type: Any
|
||||
|
||||
@@ -6,13 +6,12 @@ from . import exceptions, util
|
||||
from .packages import ssl_match_hostname
|
||||
from .util import ssl_
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from httplib import HTTPConnection as _HTTPConnection, HTTPException as HTTPException
|
||||
class ConnectionError(Exception): ...
|
||||
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from builtins import ConnectionError as ConnectionError
|
||||
from http.client import HTTPConnection as _HTTPConnection, HTTPException as HTTPException
|
||||
else:
|
||||
from httplib import HTTPConnection as _HTTPConnection, HTTPException as HTTPException
|
||||
class ConnectionError(Exception): ...
|
||||
|
||||
class DummyConnection: ...
|
||||
|
||||
|
||||
@@ -53,15 +53,15 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
||||
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
|
||||
def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore
|
||||
def update(self: _T, __m: _T) -> None: ...
|
||||
if sys.version_info < (3, 0):
|
||||
if sys.version_info >= (3, 0):
|
||||
def items(self) -> ItemsView[str, object]: ...
|
||||
def keys(self) -> KeysView[str]: ...
|
||||
def values(self) -> ValuesView[object]: ...
|
||||
else:
|
||||
def has_key(self, k: str) -> bool: ...
|
||||
def viewitems(self) -> ItemsView[str, object]: ...
|
||||
def viewkeys(self) -> KeysView[str]: ...
|
||||
def viewvalues(self) -> ValuesView[object]: ...
|
||||
else:
|
||||
def items(self) -> ItemsView[str, object]: ...
|
||||
def keys(self) -> KeysView[str]: ...
|
||||
def values(self) -> ValuesView[object]: ...
|
||||
def __delitem__(self, k: NoReturn) -> None: ...
|
||||
|
||||
# TypedDict is a (non-subscriptable) special form.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
|
||||
if sys.version_info < (3,):
|
||||
from hashlib import _hash as _Hash
|
||||
else:
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
VERSION: str
|
||||
XXHASH_VERSION: str
|
||||
|
||||
Reference in New Issue
Block a user