mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
upgrade black version (#4486)
Manually removed a number of trailing commas to prevent black from unnecessarily exploding some collections.
This commit is contained in:
@@ -17,7 +17,7 @@ class LockType:
|
||||
def locked(self) -> bool: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType],
|
||||
self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
|
||||
def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> int: ...
|
||||
|
||||
@@ -40,10 +40,10 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
if sys.version_info >= (3, 7):
|
||||
def call_soon(self, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...) -> Handle: ...
|
||||
def call_later(
|
||||
self, delay: float, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...,
|
||||
self, delay: float, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...
|
||||
) -> TimerHandle: ...
|
||||
def call_at(
|
||||
self, when: float, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...,
|
||||
self, when: float, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...
|
||||
) -> TimerHandle: ...
|
||||
else:
|
||||
def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
||||
@@ -54,9 +54,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
def create_future(self) -> Future[Any]: ...
|
||||
# Tasks methods
|
||||
if sys.version_info >= (3, 8):
|
||||
def create_task(
|
||||
self, coro: Union[Awaitable[_T], Generator[Any, None, _T]], *, name: Optional[str] = ...,
|
||||
) -> Task[_T]: ...
|
||||
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]], *, name: Optional[str] = ...) -> Task[_T]: ...
|
||||
else:
|
||||
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]]) -> Task[_T]: ...
|
||||
def set_task_factory(
|
||||
@@ -68,7 +66,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...) -> Handle: ...
|
||||
else:
|
||||
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
|
||||
def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any,) -> Future[_T]: ...
|
||||
def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Future[_T]: ...
|
||||
def set_default_executor(self, executor: Any) -> None: ...
|
||||
# Network I/O methods returning Futures.
|
||||
async def getaddrinfo(
|
||||
|
||||
@@ -100,9 +100,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
# Tasks methods
|
||||
if sys.version_info >= (3, 8):
|
||||
@abstractmethod
|
||||
def create_task(
|
||||
self, coro: Union[Awaitable[_T], Generator[Any, None, _T]], *, name: Optional[str] = ...,
|
||||
) -> Task[_T]: ...
|
||||
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]], *, name: Optional[str] = ...) -> Task[_T]: ...
|
||||
else:
|
||||
@abstractmethod
|
||||
def create_task(self, coro: Union[Awaitable[_T], Generator[Any, None, _T]]) -> Task[_T]: ...
|
||||
|
||||
@@ -192,7 +192,7 @@ class Task(Future[_T], Generic[_T]):
|
||||
if sys.version_info >= (3, 7):
|
||||
def all_tasks(loop: Optional[AbstractEventLoop] = ...) -> Set[Task[Any]]: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def create_task(coro: Union[Generator[Any, None, _T], Awaitable[_T]], *, name: Optional[str] = ...,) -> Task[_T]: ...
|
||||
def create_task(coro: Union[Generator[Any, None, _T], Awaitable[_T]], *, name: Optional[str] = ...) -> Task[_T]: ...
|
||||
else:
|
||||
def create_task(coro: Union[Generator[Any, None, _T], Awaitable[_T]]) -> Task[_T]: ...
|
||||
def current_task(loop: Optional[AbstractEventLoop] = ...) -> Optional[Task[Any]]: ...
|
||||
|
||||
@@ -67,7 +67,7 @@ elif sys.version_info >= (3, 6):
|
||||
|
||||
else:
|
||||
def namedtuple(
|
||||
typename: str, field_names: Union[str, Iterable[str]], verbose: bool = ..., rename: bool = ...,
|
||||
typename: str, field_names: Union[str, Iterable[str]], verbose: bool = ..., rename: bool = ...
|
||||
) -> Type[Tuple[Any, ...]]: ...
|
||||
|
||||
class UserDict(MutableMapping[_KT, _VT]):
|
||||
|
||||
@@ -52,7 +52,7 @@ class Executor:
|
||||
self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...
|
||||
) -> Iterator[_T]: ...
|
||||
else:
|
||||
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...,) -> Iterator[_T]: ...
|
||||
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ...
|
||||
def shutdown(self, wait: bool = ...) -> None: ...
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Optional[bool]: ...
|
||||
|
||||
@@ -131,7 +131,7 @@ class _HTTPConnectionProtocol(Protocol):
|
||||
) -> HTTPConnection: ...
|
||||
else:
|
||||
def __call__(
|
||||
self, host: str, port: Optional[int] = ..., timeout: float = ..., source_address: Optional[Tuple[str, int]] = ...,
|
||||
self, host: str, port: Optional[int] = ..., timeout: float = ..., source_address: Optional[Tuple[str, int]] = ...
|
||||
) -> HTTPConnection: ...
|
||||
|
||||
class HTTPConnection:
|
||||
|
||||
@@ -56,7 +56,7 @@ if sys.version_info < (3, 6):
|
||||
module_type: int
|
||||
def getmoduleinfo(path: str) -> Optional[ModuleInfo]: ...
|
||||
|
||||
def getmembers(object: object, predicate: Optional[Callable[[Any], bool]] = ...,) -> List[Tuple[str, Any]]: ...
|
||||
def getmembers(object: object, predicate: Optional[Callable[[Any], bool]] = ...) -> List[Tuple[str, Any]]: ...
|
||||
def getmodulename(path: str) -> Optional[str]: ...
|
||||
def ismodule(object: object) -> bool: ...
|
||||
def isclass(object: object) -> bool: ...
|
||||
|
||||
@@ -546,7 +546,7 @@ if sys.platform != "win32":
|
||||
|
||||
def write(__fd: int, __data: bytes) -> int: ...
|
||||
def access(
|
||||
path: _FdOrAnyPath, mode: int, *, dir_fd: Optional[int] = ..., effective_ids: bool = ..., follow_symlinks: bool = ...,
|
||||
path: _FdOrAnyPath, mode: int, *, dir_fd: Optional[int] = ..., effective_ids: bool = ..., follow_symlinks: bool = ...
|
||||
) -> bool: ...
|
||||
def chdir(path: _FdOrAnyPath) -> None: ...
|
||||
|
||||
@@ -571,7 +571,7 @@ if sys.platform != "win32":
|
||||
def lchown(path: AnyPath, uid: int, gid: int) -> None: ...
|
||||
|
||||
def link(
|
||||
src: AnyPath, dst: AnyPath, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ..., follow_symlinks: bool = ...,
|
||||
src: AnyPath, dst: AnyPath, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ..., follow_symlinks: bool = ...
|
||||
) -> None: ...
|
||||
def lstat(path: AnyPath, *, dir_fd: Optional[int] = ...) -> stat_result: ...
|
||||
def mkdir(path: AnyPath, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
@@ -638,7 +638,7 @@ if sys.version_info < (3, 7):
|
||||
if sys.platform != "win32":
|
||||
def statvfs(path: _FdOrAnyPath) -> statvfs_result: ... # Unix only
|
||||
|
||||
def symlink(src: AnyPath, dst: AnyPath, target_is_directory: bool = ..., *, dir_fd: Optional[int] = ...,) -> None: ...
|
||||
def symlink(src: AnyPath, dst: AnyPath, target_is_directory: bool = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def sync() -> None: ... # Unix only
|
||||
|
||||
@@ -100,7 +100,7 @@ class Path(PurePath):
|
||||
# Unbuffered binary mode: returns a FileIO
|
||||
@overload
|
||||
def open(
|
||||
self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = ..., errors: None = ..., newline: None = ...,
|
||||
self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = ..., errors: None = ..., newline: None = ...
|
||||
) -> FileIO: ...
|
||||
# Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
|
||||
@overload
|
||||
@@ -133,7 +133,7 @@ class Path(PurePath):
|
||||
# Buffering cannot be determined: fall back to BinaryIO
|
||||
@overload
|
||||
def open(
|
||||
self, mode: OpenBinaryMode, buffering: int, encoding: None = ..., errors: None = ..., newline: None = ...,
|
||||
self, mode: OpenBinaryMode, buffering: int, encoding: None = ..., errors: None = ..., newline: None = ...
|
||||
) -> BinaryIO: ...
|
||||
# Fallback if mode is not specified
|
||||
@overload
|
||||
|
||||
@@ -11,9 +11,7 @@ def nametofont(name: str) -> Font: ...
|
||||
|
||||
# See 'FONT DESCRIPTIONS' in font man page. This uses str because Literal
|
||||
# inside Tuple doesn't work.
|
||||
_FontDescription = Union[
|
||||
str, Font, Tuple[str, int], Tuple[str, int, str], Tuple[str, int, tkinter._TkinterSequence[str]],
|
||||
]
|
||||
_FontDescription = Union[str, Font, Tuple[str, int], Tuple[str, int, str], Tuple[str, int, tkinter._TkinterSequence[str]]]
|
||||
|
||||
class _FontDict(TypedDict):
|
||||
family: str
|
||||
|
||||
@@ -416,7 +416,7 @@ class ContextManager(Protocol[_T_co]):
|
||||
class AsyncContextManager(Protocol[_T_co]):
|
||||
def __aenter__(self) -> Awaitable[_T_co]: ...
|
||||
def __aexit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType],
|
||||
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType]
|
||||
) -> Awaitable[Optional[bool]]: ...
|
||||
|
||||
class Mapping(_Collection[_KT], Generic[_KT, _VT_co]):
|
||||
@@ -558,7 +558,7 @@ class Match(Generic[AnyStr]):
|
||||
@overload
|
||||
def group(self, __group: Union[str, int] = ...) -> AnyStr: ...
|
||||
@overload
|
||||
def group(self, __group1: Union[str, int], __group2: Union[str, int], *groups: Union[str, int],) -> Tuple[AnyStr, ...]: ...
|
||||
def group(self, __group1: Union[str, int], __group2: Union[str, int], *groups: Union[str, int]) -> Tuple[AnyStr, ...]: ...
|
||||
def groups(self, default: AnyStr = ...) -> Sequence[AnyStr]: ...
|
||||
def groupdict(self, default: AnyStr = ...) -> dict[str, AnyStr]: ...
|
||||
def start(self, __group: Union[int, str] = ...) -> int: ...
|
||||
@@ -602,7 +602,7 @@ if sys.version_info >= (3, 9):
|
||||
|
||||
else:
|
||||
def get_type_hints(
|
||||
obj: Callable[..., Any], globalns: Optional[Dict[str, Any]] = ..., localns: Optional[Dict[str, Any]] = ...,
|
||||
obj: Callable[..., Any], globalns: Optional[Dict[str, Any]] = ..., localns: Optional[Dict[str, Any]] = ...
|
||||
) -> Dict[str, Any]: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
|
||||
@@ -2,9 +2,7 @@ import unittest.case
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, List, Optional, TextIO, Tuple, Type, TypeVar, Union
|
||||
|
||||
_SysExcInfoType = Union[
|
||||
Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None],
|
||||
]
|
||||
_SysExcInfoType = Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]]
|
||||
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
|
||||
|
||||
@@ -95,10 +95,10 @@ if sys.version_info >= (3, 8):
|
||||
|
||||
else:
|
||||
def parse_qs(
|
||||
qs: Optional[AnyStr], keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ...,
|
||||
qs: Optional[AnyStr], keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ...
|
||||
) -> Dict[AnyStr, List[AnyStr]]: ...
|
||||
def parse_qsl(
|
||||
qs: Optional[AnyStr], keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ...,
|
||||
qs: Optional[AnyStr], keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ...
|
||||
) -> List[Tuple[AnyStr, AnyStr]]: ...
|
||||
|
||||
@overload
|
||||
|
||||
@@ -118,7 +118,7 @@ class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr):
|
||||
|
||||
class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm):
|
||||
def add_password(
|
||||
self, realm: Optional[str], uri: Union[str, Sequence[str]], user: str, passwd: str, is_authenticated: bool = ...,
|
||||
self, realm: Optional[str], uri: Union[str, Sequence[str]], user: str, passwd: str, is_authenticated: bool = ...
|
||||
) -> None: ...
|
||||
def update_authenticated(self, uri: Union[str, Sequence[str]], is_authenticated: bool = ...) -> None: ...
|
||||
def is_authenticated(self, authuri: str) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user