mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 20:01:29 +08:00
Delete python 2 branches from third-party stubs (#7741)
Since #7703, we no longer have third-party stubs that support Python 2, so code like `if sys.version_info >= (3, 0)` can be simplified.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import sys
|
||||
from typing import Protocol
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
@@ -100,12 +99,8 @@ max_byte: bytes
|
||||
cr_byte: bytes
|
||||
linefeed_byte: bytes
|
||||
crlf: bytes
|
||||
if sys.version_info >= (3, 0):
|
||||
cr_byte_value: int
|
||||
linefeed_byte_value: int
|
||||
else:
|
||||
cr_byte_value: bytes
|
||||
linefeed_byte_value: bytes
|
||||
cr_byte_value: int
|
||||
linefeed_byte_value: int
|
||||
|
||||
class _SupportsAsBytes(Protocol):
|
||||
def asbytes(self) -> bytes: ...
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer as ReadableBuffer
|
||||
from collections.abc import Callable
|
||||
from hashlib import _Hash
|
||||
|
||||
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
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
c_MSG_KEXECDH_INIT: bytes
|
||||
c_MSG_KEXECDH_REPLY: bytes
|
||||
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Callable
|
||||
from hashlib import _Hash
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve, EllipticCurvePrivateKey, EllipticCurvePublicKey
|
||||
from paramiko.message import Message
|
||||
from paramiko.transport import Transport
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Callable
|
||||
from hashlib import _Hash
|
||||
|
||||
from paramiko.message import Message
|
||||
from paramiko.transport import Transport
|
||||
|
||||
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
|
||||
c_MSG_KEXDH_GEX_INIT: bytes
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Callable
|
||||
from hashlib import _Hash
|
||||
|
||||
from paramiko.message import Message
|
||||
from paramiko.transport import Transport
|
||||
|
||||
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
|
||||
b7fffffffffffffff: bytes
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Callable
|
||||
from hashlib import _Hash
|
||||
|
||||
from paramiko.kex_group1 import KexGroup1 as KexGroup1
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
class KexGroup14(KexGroup1):
|
||||
P: int
|
||||
G: int
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Callable
|
||||
from hashlib import _Hash
|
||||
|
||||
from paramiko.kex_group1 import KexGroup1 as KexGroup1
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
class KexGroup16SHA512(KexGroup1):
|
||||
name: str
|
||||
P: int
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
import sys
|
||||
from collections.abc import Iterable
|
||||
from io import BytesIO
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .common import _LikeBytes
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
from io import BytesIO
|
||||
else:
|
||||
from StringIO import StringIO
|
||||
|
||||
BytesIO: TypeAlias = StringIO[bytes]
|
||||
|
||||
class Message:
|
||||
big_int: int
|
||||
packet: BytesIO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from collections.abc import Callable
|
||||
from hashlib import _Hash
|
||||
from logging import Logger
|
||||
from socket import socket
|
||||
from typing import Any
|
||||
@@ -8,11 +8,6 @@ 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
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
def compute_hmac(key: bytes, message: bytes, digest_class: _Hash) -> bytes: ...
|
||||
|
||||
class NeedRekeyException(Exception): ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import builtins as builtins
|
||||
from collections.abc import Iterable, Sequence
|
||||
from io import BytesIO as BytesIO, StringIO as StringIO
|
||||
from typing import Any, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
@@ -16,19 +17,6 @@ def input(prompt: Any) -> str: ...
|
||||
def decodebytes(s: bytes) -> bytes: ...
|
||||
def encodebytes(s: bytes) -> bytes: ...
|
||||
|
||||
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
|
||||
|
||||
bytes = builtins.bytes
|
||||
|
||||
def byte_ord(c: int | str) -> int: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from collections.abc import Callable
|
||||
from hashlib import _Hash
|
||||
from logging import Logger, LogRecord
|
||||
from types import TracebackType
|
||||
from typing import IO, AnyStr, Protocol, TypeVar
|
||||
@@ -8,11 +8,6 @@ from typing import IO, AnyStr, Protocol, TypeVar
|
||||
from paramiko.config import SSHConfig, SSHConfigDict
|
||||
from paramiko.hostkeys import HostKeys
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
from hashlib import _Hash
|
||||
else:
|
||||
from hashlib import _hash as _Hash
|
||||
|
||||
class SupportsClose(Protocol):
|
||||
def close(self) -> None: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user