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

@@ -4,6 +4,7 @@ import sys
# internal Bazel integration.
import typing as _typing
from typing import Any, Iterator, Optional, TypeVar, Union, overload
from typing_extensions import Literal
# The same unorthodox Bazel integration causes issues with sys, which
# is imported in both modules. unfortunately we can't just rename sys,
@@ -11,12 +12,6 @@ from typing import Any, Iterator, Optional, TypeVar, Union, overload
# sys.
from _ast import * # type: ignore
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
if sys.version_info >= (3, 8):
class Num(Constant): ...
class Str(Constant): ...