mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-30 14:45:23 +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,20 +1,8 @@
|
||||
import sys
|
||||
from base64 import encodebytes as encodebytes
|
||||
from typing import Any
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
from base64 import encodebytes as encodebytes
|
||||
else:
|
||||
from base64 import encodestring
|
||||
|
||||
encodebytes = encodestring
|
||||
|
||||
expanduser: Any
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
StandardError = Exception
|
||||
else:
|
||||
from __builtin__ import StandardError as StandardError
|
||||
|
||||
StandardError = Exception
|
||||
long_type: Any
|
||||
unquote_str: Any
|
||||
parse_qs_safe: Any
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import datetime
|
||||
import io
|
||||
import logging.handlers
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||
from contextlib import AbstractContextManager
|
||||
from email.message import Message
|
||||
from hashlib import _Hash
|
||||
from typing import IO, Any, TypeVar
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
@@ -13,30 +15,6 @@ import boto.connection
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
# TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO
|
||||
import io
|
||||
|
||||
_StringIO: TypeAlias = io.StringIO
|
||||
|
||||
from hashlib import _Hash
|
||||
|
||||
_HashType: TypeAlias = _Hash
|
||||
|
||||
from email.message import Message as _Message
|
||||
else:
|
||||
# TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO
|
||||
import StringIO
|
||||
|
||||
_StringIO: TypeAlias = StringIO.StringIO[Any]
|
||||
|
||||
from hashlib import _hash
|
||||
|
||||
_HashType: TypeAlias = _hash
|
||||
|
||||
# TODO use email.message.Message once stubs exist
|
||||
_Message: TypeAlias = Any
|
||||
|
||||
_Provider: TypeAlias = Any # TODO replace this with boto.provider.Provider once stubs exist
|
||||
_LockType: TypeAlias = Any # TODO replace this with _thread.LockType once stubs exist
|
||||
|
||||
@@ -83,7 +61,7 @@ def fetch_file(
|
||||
class ShellCommand:
|
||||
exit_code: int
|
||||
command: subprocess._CMD
|
||||
log_fp: _StringIO
|
||||
log_fp: io.StringIO
|
||||
wait: bool
|
||||
fail_fast: bool
|
||||
def __init__(
|
||||
@@ -121,9 +99,9 @@ class LRUCache(dict[_KT, _VT]):
|
||||
_str: TypeAlias = str
|
||||
|
||||
class Password:
|
||||
hashfunc: Callable[[bytes], _HashType]
|
||||
hashfunc: Callable[[bytes], _Hash]
|
||||
str: _str | None
|
||||
def __init__(self, str: _str | None = ..., hashfunc: Callable[[bytes], _HashType] | None = ...) -> None: ...
|
||||
def __init__(self, str: _str | None = ..., hashfunc: Callable[[bytes], _Hash] | None = ...) -> None: ...
|
||||
def set(self, value: bytes | _str) -> None: ...
|
||||
def __eq__(self, other: _str | bytes | None) -> bool: ... # type: ignore[override]
|
||||
def __len__(self) -> int: ...
|
||||
@@ -133,7 +111,7 @@ def notify(
|
||||
body: str | None = ...,
|
||||
html_body: Sequence[str] | str | None = ...,
|
||||
to_string: str | None = ...,
|
||||
attachments: Iterable[_Message] | None = ...,
|
||||
attachments: Iterable[Message] | None = ...,
|
||||
append_instance_id: bool = ...,
|
||||
) -> None: ...
|
||||
def get_utf8_value(value: str) -> bytes: ...
|
||||
|
||||
Reference in New Issue
Block a user