From cd513a9e2db91a53cf8e6a8c97051ceb211ddc09 Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Sat, 3 Oct 2020 19:57:15 -0700 Subject: [PATCH] pep 484: more reexports There are still a couple more, but hopefully this fixes CI. It's a little bit of a chore to track down some of these; it looks like master differs from latest release for a number of them. --- third_party/2and3/boto/compat.pyi | 4 +++- third_party/2and3/click/types.pyi | 4 +++- third_party/2and3/jinja2/_compat.pyi | 8 ++++++-- third_party/2and3/werkzeug/_compat.pyi | 13 +++++++++---- third_party/3/aiofiles/__init__.pyi | 1 - third_party/3/jwt/contrib/algorithms/__init__.pyi | 1 - third_party/3/jwt/contrib/algorithms/py_ecdsa.pyi | 11 +++++------ third_party/3/jwt/contrib/algorithms/pycrypto.pyi | 11 +++++------ third_party/3/waitress/compat.pyi | 5 ----- 9 files changed, 31 insertions(+), 27 deletions(-) diff --git a/third_party/2and3/boto/compat.pyi b/third_party/2and3/boto/compat.pyi index d10c4cbfda20..f9e10d658f18 100644 --- a/third_party/2and3/boto/compat.pyi +++ b/third_party/2and3/boto/compat.pyi @@ -4,7 +4,9 @@ from typing import Any if sys.version_info >= (3,): from base64 import encodebytes as encodebytes else: - from base64 import encodestring as encodebytes + from base64 import encodestring + + encodebytes = encodestring expanduser: Any diff --git a/third_party/2and3/click/types.pyi b/third_party/2and3/click/types.pyi index 923e20275be6..21f8b7b0b358 100644 --- a/third_party/2and3/click/types.pyi +++ b/third_party/2and3/click/types.pyi @@ -2,7 +2,9 @@ import datetime import uuid from typing import IO, Any, Callable, Generic, Iterable, List, Optional, Tuple as _PyTuple, Type, TypeVar, Union -from click.core import Context, Parameter, _ConvertibleType, _ParamType as ParamType +from click.core import Context, Parameter, _ConvertibleType, _ParamType + +ParamType = _ParamType class BoolParamType(ParamType): def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> bool: ... diff --git a/third_party/2and3/jinja2/_compat.pyi b/third_party/2and3/jinja2/_compat.pyi index 5f0eb38d262b..17c061f810c2 100644 --- a/third_party/2and3/jinja2/_compat.pyi +++ b/third_party/2and3/jinja2/_compat.pyi @@ -2,9 +2,13 @@ import sys from typing import Any, Optional if sys.version_info[0] >= 3: - from urllib.parse import quote_from_bytes as url_quote + from urllib.parse import quote_from_bytes + + url_quote = quote_from_bytes else: - from urllib import quote as url_quote + import urllib + + url_quote = urllib.quote PY2: Any PYPY: Any diff --git a/third_party/2and3/werkzeug/_compat.pyi b/third_party/2and3/werkzeug/_compat.pyi index bc4340dcbda2..f8a13f7783da 100644 --- a/third_party/2and3/werkzeug/_compat.pyi +++ b/third_party/2and3/werkzeug/_compat.pyi @@ -1,10 +1,16 @@ import sys from typing import Any, Optional, Text -if sys.version_info < (3,): - import StringIO as BytesIO +if sys.version_info >= (3,): + from io import BytesIO as BytesIO, StringIO as StringIO + + NativeStringIO = StringIO else: - from io import StringIO as BytesIO + import cStringIO + from StringIO import StringIO as StringIO + + BytesIO = cStringIO.StringIO + NativeStringIO = BytesIO PY2: Any WIN: Any @@ -27,7 +33,6 @@ def native_string_result(func): ... def implements_bool(cls): ... range_type: Any -NativeStringIO: Any def make_literal_wrapper(reference): ... def normalize_string_tuple(tup): ... diff --git a/third_party/3/aiofiles/__init__.pyi b/third_party/3/aiofiles/__init__.pyi index f943e7671878..2bbbc29a428f 100644 --- a/third_party/3/aiofiles/__init__.pyi +++ b/third_party/3/aiofiles/__init__.pyi @@ -1,2 +1 @@ -from . import _os as os from .threadpool import open as open diff --git a/third_party/3/jwt/contrib/algorithms/__init__.pyi b/third_party/3/jwt/contrib/algorithms/__init__.pyi index b2bb1f643a3e..e69de29bb2d1 100644 --- a/third_party/3/jwt/contrib/algorithms/__init__.pyi +++ b/third_party/3/jwt/contrib/algorithms/__init__.pyi @@ -1 +0,0 @@ -from hashlib import _Hash as _HashAlg diff --git a/third_party/3/jwt/contrib/algorithms/py_ecdsa.pyi b/third_party/3/jwt/contrib/algorithms/py_ecdsa.pyi index 2a4e2c792797..0f63de0a6cd0 100644 --- a/third_party/3/jwt/contrib/algorithms/py_ecdsa.pyi +++ b/third_party/3/jwt/contrib/algorithms/py_ecdsa.pyi @@ -1,11 +1,10 @@ +import hashlib from typing import Any from jwt.algorithms import Algorithm -from . import _HashAlg - class ECAlgorithm(Algorithm[Any]): - SHA256: _HashAlg - SHA384: _HashAlg - SHA512: _HashAlg - def __init__(self, hash_alg: _HashAlg) -> None: ... + SHA256: hashlib._Hash + SHA384: hashlib._Hash + SHA512: hashlib._Hash + def __init__(self, hash_alg: hashlib._Hash) -> None: ... diff --git a/third_party/3/jwt/contrib/algorithms/pycrypto.pyi b/third_party/3/jwt/contrib/algorithms/pycrypto.pyi index d0cb973f9e41..077684c67734 100644 --- a/third_party/3/jwt/contrib/algorithms/pycrypto.pyi +++ b/third_party/3/jwt/contrib/algorithms/pycrypto.pyi @@ -1,11 +1,10 @@ +import hashlib from typing import Any from jwt.algorithms import Algorithm -from . import _HashAlg - class RSAAlgorithm(Algorithm[Any]): - SHA256: _HashAlg - SHA384: _HashAlg - SHA512: _HashAlg - def __init__(self, hash_alg: _HashAlg) -> None: ... + SHA256: hashlib._Hash + SHA384: hashlib._Hash + SHA512: hashlib._Hash + def __init__(self, hash_alg: hashlib._Hash) -> None: ... diff --git a/third_party/3/waitress/compat.pyi b/third_party/3/waitress/compat.pyi index cb1a09b2b84a..58c9ad356b93 100644 --- a/third_party/3/waitress/compat.pyi +++ b/third_party/3/waitress/compat.pyi @@ -2,11 +2,6 @@ import sys from io import TextIOWrapper from typing import Any, Optional, Text, Tuple -if sys.version_info[0] == 3: - from urllib import parse as urlparse -else: - import urlparse - PY2: bool PY3: bool WIN: bool