Literal: always import from typing_extensions for simplicity (#4219)

This commit is contained in:
Jelle Zijlstra
2020-06-10 21:23:58 -07:00
committed by GitHub
parent 43e93f803f
commit 44a852dff5
22 changed files with 31 additions and 139 deletions

View File

@@ -1,9 +1,5 @@
from datetime import date
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from typing_extensions import Literal
EASTER_JULIAN: Literal[1]
EASTER_ORTHODOX: Literal[2]

View File

@@ -1,5 +1,5 @@
import sys
from typing import Any, Callable, IO, Iterable, Optional, Protocol, Text, TypeVar, Union
from typing_extensions import Literal
from _typeshed import AnyPath
from markupsafe import Markup as Markup, escape as escape, soft_unicode as soft_unicode
@@ -8,24 +8,18 @@ missing: Any
internal_code: Any
concat: Any
if sys.version_info >= (3, 8):
from typing import Literal
_True = Literal[True]
else:
_True = bool
_CallableT = TypeVar("_CallableT", bound=Callable[..., Any])
class _ContextFunction(Protocol[_CallableT]):
contextfunction: _True
contextfunction: Literal[True]
__call__: _CallableT
class _EvalContextFunction(Protocol[_CallableT]):
evalcontextfunction: _True
evalcontextfunction: Literal[True]
__call__: _CallableT
class _EnvironmentFunction(Protocol[_CallableT]):
environmentfunction: _True
environmentfunction: Literal[True]
__call__: _CallableT
def contextfunction(f: _CallableT) -> _ContextFunction[_CallableT]: ...

View File

@@ -3,6 +3,7 @@ from datetime import datetime
from typing import (
Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Optional, Sequence, Text, Tuple, Type, TypeVar, Union, overload
)
from typing_extensions import Literal
from _typeshed.wsgi import WSGIEnvironment, InputStream
from .datastructures import (
@@ -12,11 +13,6 @@ from .datastructures import (
)
from .useragents import UserAgent
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
class BaseRequest:
charset: str
encoding_errors: str