upgrade black version (#4486)

Manually removed a number of trailing commas to prevent black from unnecessarily
exploding some collections.
This commit is contained in:
Jelle Zijlstra
2020-08-26 09:36:01 -07:00
committed by GitHub
parent e3e395b28c
commit 5f9fd3d127
61 changed files with 165 additions and 181 deletions

View File

@@ -93,5 +93,5 @@ class SafeConfigParser(ConfigParser):
_interpvar_re: Any
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
def _interpolate_some(
self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int,
self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int
) -> None: ...

View File

@@ -641,7 +641,7 @@ if sys.version_info >= (3,):
def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ...
def splitlines(self, keepends: bool = ...) -> List[bytes]: ...
def startswith(
self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ...,
self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ...
) -> bool: ...
def strip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
def swapcase(self) -> bytes: ...
@@ -759,7 +759,7 @@ class bytearray(MutableSequence[int], ByteString):
def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
def startswith(
self, __prefix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...,
self, __prefix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def strip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def swapcase(self) -> bytearray: ...

View File

@@ -11,6 +11,6 @@ def compile_dir(
quiet: int = ...,
) -> int: ...
def compile_file(
fullname: AnyPath, ddir: Optional[AnyPath] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...,
fullname: AnyPath, ddir: Optional[AnyPath] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...
) -> int: ...
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...

View File

@@ -456,7 +456,7 @@ class Pattern(Generic[AnyStr]):
# Functions
def get_type_hints(
obj: Callable[..., Any], globalns: Optional[Dict[Text, Any]] = ..., localns: Optional[Dict[Text, Any]] = ...,
obj: Callable[..., Any], globalns: Optional[Dict[Text, Any]] = ..., localns: Optional[Dict[Text, Any]] = ...
) -> None: ...
@overload
def cast(tp: Type[_T], obj: Any) -> _T: ...

View File

@@ -34,9 +34,7 @@ _FT = TypeVar("_FT")
_ExceptionType = Union[Type[BaseException], Tuple[Type[BaseException], ...]]
_Regexp = Union[Text, Pattern[Text]]
_SysExcInfoType = Union[
Tuple[Type[BaseException], BaseException, types.TracebackType], Tuple[None, None, None],
]
_SysExcInfoType = Union[Tuple[Type[BaseException], BaseException, types.TracebackType], Tuple[None, None, None]]
class Testable(metaclass=ABCMeta):
@abstractmethod

View File

@@ -121,7 +121,7 @@ class Marshaller:
Mapping[Any, Any],
datetime,
InstanceType,
],
]
],
Fault,
],

View File

@@ -136,12 +136,8 @@ OpenBinaryModeUpdating = Literal[
"b+x",
"+bx",
]
OpenBinaryModeWriting = Literal[
"wb", "bw", "ab", "ba", "xb", "bx",
]
OpenBinaryModeReading = Literal[
"rb", "br", "rbU", "rUb", "Urb", "brU", "bUr", "Ubr",
]
OpenBinaryModeWriting = Literal["wb", "bw", "ab", "ba", "xb", "bx"]
OpenBinaryModeReading = Literal["rb", "br", "rbU", "rUb", "Urb", "brU", "bUr", "Ubr"]
OpenBinaryMode = Union[OpenBinaryModeUpdating, OpenBinaryModeReading, OpenBinaryModeWriting]
class HasFileno(Protocol):

View File

@@ -641,7 +641,7 @@ if sys.version_info >= (3,):
def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ...
def splitlines(self, keepends: bool = ...) -> List[bytes]: ...
def startswith(
self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ...,
self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ...
) -> bool: ...
def strip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
def swapcase(self) -> bytes: ...
@@ -759,7 +759,7 @@ class bytearray(MutableSequence[int], ByteString):
def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytearray]: ...
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
def startswith(
self, __prefix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...,
self, __prefix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ...
) -> bool: ...
def strip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def swapcase(self) -> bytearray: ...

View File

@@ -57,7 +57,7 @@ class SequenceMatcher(Generic[_T]):
# mypy thinks the signatures of the overloads overlap, but the types still work fine
@overload
def get_close_matches( # type: ignore
word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ...,
word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ...
) -> List[AnyStr]: ...
@overload
def get_close_matches(

View File

@@ -49,7 +49,7 @@ def wrap_socket(
ciphers: Optional[str] = ...,
) -> SSLSocket: ...
def create_default_context(
purpose: Any = ..., *, cafile: Optional[str] = ..., capath: Optional[str] = ..., cadata: Union[Text, bytes, None] = ...,
purpose: Any = ..., *, cafile: Optional[str] = ..., capath: Optional[str] = ..., cadata: Union[Text, bytes, None] = ...
) -> SSLContext: ...
if sys.version_info >= (3, 7):
@@ -300,7 +300,7 @@ class SSLContext:
) -> None: ...
def load_default_certs(self, purpose: Purpose = ...) -> None: ...
def load_verify_locations(
self, cafile: Optional[StrPath] = ..., capath: Optional[StrPath] = ..., cadata: Union[Text, bytes, None] = ...,
self, cafile: Optional[StrPath] = ..., capath: Optional[StrPath] = ..., cadata: Union[Text, bytes, None] = ...
) -> None: ...
def get_ca_certs(self, binary_form: bool = ...) -> Union[List[_PeerCertRetDictType], List[bytes]]: ...
def set_default_verify_paths(self) -> None: ...

View File

@@ -28,6 +28,6 @@ if sys.version_info >= (3, 8):
else:
def make_parser(parser_list: List[str] = ...) -> XMLReader: ...
def parse(source: Union[str, IO[str], IO[bytes]], handler: ContentHandler, errorHandler: ErrorHandler = ...,) -> None: ...
def parseString(string: Union[bytes, Text], handler: ContentHandler, errorHandler: Optional[ErrorHandler] = ...,) -> None: ...
def parse(source: Union[str, IO[str], IO[bytes]], handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ...
def parseString(string: Union[bytes, Text], handler: ContentHandler, errorHandler: Optional[ErrorHandler] = ...) -> None: ...
def _create_parser(parser_name: str) -> XMLReader: ...

View File

@@ -48,7 +48,7 @@ class ZipExtFile(io.BufferedIOBase):
name: str
if sys.version_info >= (3, 7):
def __init__(
self, fileobj: IO[bytes], mode: str, zipinfo: ZipInfo, pwd: Optional[bytes] = ..., close_fileobj: bool = ...,
self, fileobj: IO[bytes], mode: str, zipinfo: ZipInfo, pwd: Optional[bytes] = ..., close_fileobj: bool = ...
) -> None: ...
else:
def __init__(

View File

@@ -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: ...

View File

@@ -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(

View File

@@ -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]: ...

View File

@@ -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]]: ...

View File

@@ -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]):

View File

@@ -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]: ...

View File

@@ -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:

View File

@@ -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: ...

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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):

View File

@@ -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])

View File

@@ -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

View File

@@ -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: ...