Use TypeAlias where possible for type aliases (#7630)

This commit is contained in:
Alex Waygood
2022-04-16 02:01:00 +01:00
committed by GitHub
parent c0e6dd3f3f
commit 740193a8fc
218 changed files with 760 additions and 625 deletions
+8 -7
View File
@@ -5,6 +5,7 @@ import sys
import time
from contextlib import AbstractContextManager
from typing import IO, Any, Callable, Iterable, Mapping, Sequence, TypeVar
from typing_extensions import TypeAlias
import boto.connection
@@ -15,28 +16,28 @@ if sys.version_info >= (3,):
# TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO
import io
_StringIO = io.StringIO
_StringIO: TypeAlias = io.StringIO
from hashlib import _Hash
_HashType = _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 = StringIO.StringIO[Any]
_StringIO: TypeAlias = StringIO.StringIO[Any]
from hashlib import _hash
_HashType = _hash
_HashType: TypeAlias = _hash
# TODO use email.message.Message once stubs exist
_Message = Any
_Message: TypeAlias = Any
_Provider = Any # TODO replace this with boto.provider.Provider once stubs exist
_LockType = Any # TODO replace this with _thread.LockType once stubs exist
_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
JSONDecodeError: type[ValueError]
qsa_of_interest: list[str]