apply black and isort (#4287)

* apply black and isort

* move some type ignores
This commit is contained in:
Jelle Zijlstra
2020-06-28 13:31:00 -07:00
committed by GitHub
parent fe58699ca5
commit 5d553c9584
800 changed files with 13875 additions and 10332 deletions

View File

@@ -1,12 +1,8 @@
import sys
import enum
from typing import (AbstractSet, Any, Callable, Dict, Generator, List, Mapping,
NamedTuple, Optional, Sequence, Tuple, Type, Union,
)
from types import (CodeType, FrameType, FunctionType, MethodType, ModuleType,
TracebackType,
)
import sys
from collections import OrderedDict
from types import CodeType, FrameType, FunctionType, MethodType, ModuleType, TracebackType
from typing import AbstractSet, Any, Callable, Dict, Generator, List, Mapping, NamedTuple, Optional, Sequence, Tuple, Type, Union
#
# Types and members
@@ -21,8 +17,7 @@ class BlockFinder:
indecorator: bool
decoratorhasargs: bool
last: int
def tokeneater(self, type: int, token: str, srowcol: Tuple[int, int],
erowcol: Tuple[int, int], line: str) -> None: ...
def tokeneater(self, type: int, token: str, srowcol: Tuple[int, int], erowcol: Tuple[int, int], line: str) -> None: ...
CO_OPTIMIZED: int
CO_NEWLOCALS: int
@@ -45,24 +40,22 @@ 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: ...
def ismethod(object: object) -> bool: ...
def isfunction(object: object) -> bool: ...
def isgeneratorfunction(object: object) -> bool: ...
def isgenerator(object: object) -> bool: ...
def iscoroutinefunction(object: object) -> bool: ...
def iscoroutine(object: object) -> bool: ...
def isawaitable(object: object) -> bool: ...
if sys.version_info >= (3, 6):
def isasyncgenfunction(object: object) -> bool: ...
def isasyncgen(object: object) -> bool: ...
def istraceback(object: object) -> bool: ...
def isframe(object: object) -> bool: ...
def iscode(object: object) -> bool: ...
@@ -74,7 +67,6 @@ def isdatadescriptor(object: object) -> bool: ...
def isgetsetdescriptor(object: object) -> bool: ...
def ismemberdescriptor(object: object) -> bool: ...
#
# Retrieving source code
#
@@ -93,19 +85,13 @@ def getsource(object: _SourceObjectType) -> str: ...
def cleandoc(doc: str) -> str: ...
def indentsize(line: str) -> int: ...
#
# Introspecting callables with the Signature object
#
def signature(obj: Callable[..., Any],
*,
follow_wrapped: bool = ...) -> Signature: ...
def signature(obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ...
class Signature:
def __init__(self,
parameters: Optional[Sequence[Parameter]] = ...,
*,
return_annotation: Any = ...) -> None: ...
def __init__(self, parameters: Optional[Sequence[Parameter]] = ..., *, return_annotation: Any = ...) -> None: ...
# TODO: can we be more specific here?
empty: object = ...
@@ -113,14 +99,9 @@ class Signature:
# TODO: can we be more specific here?
return_annotation: Any
def bind(self, *args: Any, **kwargs: Any) -> BoundArguments: ...
def bind_partial(self, *args: Any, **kwargs: Any) -> BoundArguments: ...
def replace(self,
*,
parameters: Optional[Sequence[Parameter]] = ...,
return_annotation: Any = ...) -> Signature: ...
def replace(self, *, parameters: Optional[Sequence[Parameter]] = ..., return_annotation: Any = ...) -> Signature: ...
@classmethod
def from_callable(cls, obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ...
@@ -130,12 +111,7 @@ class _ParameterKind(enum.IntEnum):
description: str
class Parameter:
def __init__(self,
name: str,
kind: _ParameterKind,
*,
default: Any = ...,
annotation: Any = ...) -> None: ...
def __init__(self, name: str, kind: _ParameterKind, *, default: Any = ..., annotation: Any = ...) -> None: ...
empty: Any = ...
name: str
default: Any
@@ -147,23 +123,17 @@ class Parameter:
VAR_POSITIONAL: _ParameterKind = ...
KEYWORD_ONLY: _ParameterKind = ...
VAR_KEYWORD: _ParameterKind = ...
def replace(self,
*,
name: Optional[str] = ...,
kind: Optional[_ParameterKind] = ...,
default: Any = ...,
annotation: Any = ...) -> Parameter: ...
def replace(
self, *, name: Optional[str] = ..., kind: Optional[_ParameterKind] = ..., default: Any = ..., annotation: Any = ...
) -> Parameter: ...
class BoundArguments:
arguments: OrderedDict[str, Any]
args: Tuple[Any, ...]
kwargs: Dict[str, Any]
signature: Signature
def apply_defaults(self) -> None: ...
#
# Classes and functions
#
@@ -207,46 +177,42 @@ class ArgInfo(NamedTuple):
def getargvalues(frame: FrameType) -> ArgInfo: ...
def formatannotation(annotation: object, base_module: Optional[str] = ...) -> str: ...
def formatannotationrelativeto(object: object) -> Callable[[object], str]: ...
def formatargspec(args: List[str],
varargs: Optional[str] = ...,
varkw: Optional[str] = ...,
defaults: Optional[Tuple[Any, ...]] = ...,
kwonlyargs: Optional[Sequence[str]] = ...,
kwonlydefaults: Optional[Dict[str, Any]] = ...,
annotations: Dict[str, Any] = ...,
formatarg: Callable[[str], str] = ...,
formatvarargs: Callable[[str], str] = ...,
formatvarkw: Callable[[str], str] = ...,
formatvalue: Callable[[Any], str] = ...,
formatreturns: Callable[[Any], str] = ...,
formatannotation: Callable[[Any], str] = ...,
) -> str: ...
def formatargvalues(args: List[str],
varargs: Optional[str],
varkw: Optional[str],
locals: Optional[Dict[str, Any]],
formatarg: Optional[Callable[[str], str]] = ...,
formatvarargs: Optional[Callable[[str], str]] = ...,
formatvarkw: Optional[Callable[[str], str]] = ...,
formatvalue: Optional[Callable[[Any], str]] = ...,
) -> str: ...
def formatargspec(
args: List[str],
varargs: Optional[str] = ...,
varkw: Optional[str] = ...,
defaults: Optional[Tuple[Any, ...]] = ...,
kwonlyargs: Optional[Sequence[str]] = ...,
kwonlydefaults: Optional[Dict[str, Any]] = ...,
annotations: Dict[str, Any] = ...,
formatarg: Callable[[str], str] = ...,
formatvarargs: Callable[[str], str] = ...,
formatvarkw: Callable[[str], str] = ...,
formatvalue: Callable[[Any], str] = ...,
formatreturns: Callable[[Any], str] = ...,
formatannotation: Callable[[Any], str] = ...,
) -> str: ...
def formatargvalues(
args: List[str],
varargs: Optional[str],
varkw: Optional[str],
locals: Optional[Dict[str, Any]],
formatarg: Optional[Callable[[str], str]] = ...,
formatvarargs: Optional[Callable[[str], str]] = ...,
formatvarkw: Optional[Callable[[str], str]] = ...,
formatvalue: Optional[Callable[[Any], str]] = ...,
) -> str: ...
def getmro(cls: type) -> Tuple[type, ...]: ...
def getcallargs(__func: Callable[..., Any],
*args: Any,
**kwds: Any) -> Dict[str, Any]: ...
def getcallargs(__func: Callable[..., Any], *args: Any, **kwds: Any) -> Dict[str, Any]: ...
class ClosureVars(NamedTuple):
nonlocals: Mapping[str, Any]
globals: Mapping[str, Any]
builtins: Mapping[str, Any]
unbound: AbstractSet[str]
def getclosurevars(func: Callable[..., Any]) -> ClosureVars: ...
def unwrap(func: Callable[..., Any],
*,
stop: Optional[Callable[[Any], Any]] = ...) -> Any: ...
def unwrap(func: Callable[..., Any], *, stop: Optional[Callable[[Any], Any]] = ...) -> Any: ...
#
# The interpreter stack
@@ -281,7 +247,6 @@ def trace(context: int = ...) -> List[FrameInfo]: ...
def getattr_static(obj: object, attr: str, default: Optional[Any] = ...) -> Any: ...
#
# Current State of Generators and Coroutines
#
@@ -293,6 +258,7 @@ GEN_CREATED: str
GEN_RUNNING: str
GEN_SUSPENDED: str
GEN_CLOSED: str
def getgeneratorstate(generator: Generator[Any, Any, Any]) -> str: ...
CORO_CREATED: str
@@ -301,7 +267,6 @@ CORO_SUSPENDED: str
CORO_CLOSED: str
# TODO can we be more specific than "object"?
def getcoroutinestate(coroutine: object) -> str: ...
def getgeneratorlocals(generator: Generator[Any, Any, Any]) -> Dict[str, Any]: ...
# TODO can we be more specific than "object"?