mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 06:36:54 +08:00
Literal: always import from typing_extensions for simplicity (#4219)
This commit is contained in:
@@ -3,11 +3,7 @@ from typing import Any, BinaryIO, Callable, Generator, IO, Iterable, Iterator, L
|
||||
|
||||
from abc import abstractmethod
|
||||
import types
|
||||
|
||||
if sys.version_info < (3,) or sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal
|
||||
|
||||
# TODO: this only satisfies the most common interface, where
|
||||
# bytes (py2 str) is the raw form and str (py2 unicode) is the cooked form.
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import imaplib
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from socket import socket as _socket
|
||||
from ssl import SSLSocket, SSLContext
|
||||
from typing import Any, Callable, Dict, IO, List, Optional, Pattern, Text, Tuple, Type, Union
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal
|
||||
|
||||
# TODO: Commands should use their actual return types, not this type alias.
|
||||
# E.g. Tuple[Literal["OK"], List[bytes]]
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
|
||||
import sys
|
||||
from typing import List, Tuple, Union, Set, Optional, Dict, Container, Any, Type, Iterable, Sequence
|
||||
from types import ModuleType
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.platform == 'win32':
|
||||
from _msi import _Database
|
||||
|
||||
@@ -16,11 +16,7 @@ CPython C source: https://github.com/python/cpython/blob/master/Modules/socketmo
|
||||
# adapted for Python 2.7 by Michal Pokorny
|
||||
import sys
|
||||
from typing import Any, BinaryIO, Iterable, List, Optional, Text, TextIO, Tuple, TypeVar, Union, overload
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal
|
||||
|
||||
|
||||
# ----- Constants -----
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
|
||||
import sys
|
||||
from typing import Optional, Union, overload
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.platform == "win32":
|
||||
SND_FILENAME: int
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# Stubs for xml.etree.ElementTree
|
||||
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
@@ -21,13 +19,8 @@ from typing import (
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
import io
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3,) or sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal
|
||||
|
||||
VERSION: str
|
||||
|
||||
|
||||
Reference in New Issue
Block a user