py36+: update the target version of black to py36

This commit is contained in:
Anthony Sottile 2020-10-02 13:09:35 -07:00
parent 6ed07a1c25
commit f295b0267d
16 changed files with 28 additions and 28 deletions

View File

@ -102,4 +102,4 @@ template = "changelog/_template.rst"
showcontent = true showcontent = true
[tool.black] [tool.black]
target-version = ['py35'] target-version = ['py36']

View File

@ -122,7 +122,7 @@ def _pformat_dispatch(
width: int = 80, width: int = 80,
depth: Optional[int] = None, depth: Optional[int] = None,
*, *,
compact: bool = False compact: bool = False,
) -> str: ) -> str:
return AlwaysDispatchingPrettyPrinter( return AlwaysDispatchingPrettyPrinter(
indent=indent, width=width, depth=depth, compact=compact indent=indent, width=width, depth=depth, compact=compact

View File

@ -109,7 +109,7 @@ class TerminalWriter:
sepchar: str, sepchar: str,
title: Optional[str] = None, title: Optional[str] = None,
fullwidth: Optional[int] = None, fullwidth: Optional[int] = None,
**markup: bool **markup: bool,
) -> None: ) -> None:
if fullwidth is None: if fullwidth is None:
fullwidth = self.fullwidth fullwidth = self.fullwidth

View File

@ -116,7 +116,7 @@ def getfuncargnames(
*, *,
name: str = "", name: str = "",
is_method: bool = False, is_method: bool = False,
cls: Optional[type] = None cls: Optional[type] = None,
) -> Tuple[str, ...]: ) -> Tuple[str, ...]:
"""Return the names of a function's mandatory arguments. """Return the names of a function's mandatory arguments.

View File

@ -866,7 +866,7 @@ class Config:
self, self,
pluginmanager: PytestPluginManager, pluginmanager: PytestPluginManager,
*, *,
invocation_params: Optional[InvocationParams] = None invocation_params: Optional[InvocationParams] = None,
) -> None: ) -> None:
from .argparsing import Parser, FILE_OR_DIR from .argparsing import Parser, FILE_OR_DIR

View File

@ -260,7 +260,7 @@ class DoctestItem(pytest.Item):
*, *,
name: str, name: str,
runner: "doctest.DocTestRunner", runner: "doctest.DocTestRunner",
dtest: "doctest.DocTest" dtest: "doctest.DocTest",
): ):
# incompatible signature due to to imposed limits on sublcass # incompatible signature due to to imposed limits on sublcass
"""The public named constructor.""" """The public named constructor."""

View File

@ -1220,7 +1220,7 @@ def fixture(
Callable[[Any], Optional[object]], Callable[[Any], Optional[object]],
] ]
] = ..., ] = ...,
name: Optional[str] = ... name: Optional[str] = ...,
) -> _FixtureFunction: ) -> _FixtureFunction:
... ...
@ -1238,7 +1238,7 @@ def fixture( # noqa: F811
Callable[[Any], Optional[object]], Callable[[Any], Optional[object]],
] ]
] = ..., ] = ...,
name: Optional[str] = None name: Optional[str] = None,
) -> FixtureFunctionMarker: ) -> FixtureFunctionMarker:
... ...
@ -1255,7 +1255,7 @@ def fixture( # noqa: F811
Callable[[Any], Optional[object]], Callable[[Any], Optional[object]],
] ]
] = None, ] = None,
name: Optional[str] = None name: Optional[str] = None,
) -> Union[FixtureFunctionMarker, _FixtureFunction]: ) -> Union[FixtureFunctionMarker, _FixtureFunction]:
"""Decorator to mark a fixture factory function. """Decorator to mark a fixture factory function.
@ -1325,7 +1325,7 @@ def yield_fixture(
params=None, params=None,
autouse=False, autouse=False,
ids=None, ids=None,
name=None name=None,
): ):
"""(Return a) decorator to mark a yield-fixture factory function. """(Return a) decorator to mark a yield-fixture factory function.

View File

@ -47,7 +47,7 @@ old_mark_config_key = StoreKey[Optional[Config]]()
def param( def param(
*values: object, *values: object,
marks: Union[MarkDecorator, Collection[Union[MarkDecorator, Mark]]] = (), marks: Union[MarkDecorator, Collection[Union[MarkDecorator, Mark]]] = (),
id: Optional[str] = None id: Optional[str] = None,
) -> ParameterSet: ) -> ParameterSet:
"""Specify a parameter in `pytest.mark.parametrize`_ calls or """Specify a parameter in `pytest.mark.parametrize`_ calls or
:ref:`parametrized fixtures <fixture-parametrize-marks>`. :ref:`parametrized fixtures <fixture-parametrize-marks>`.

View File

@ -89,7 +89,7 @@ class ParameterSet(
cls, cls,
*values: object, *values: object,
marks: Union["MarkDecorator", Collection[Union["MarkDecorator", "Mark"]]] = (), marks: Union["MarkDecorator", Collection[Union["MarkDecorator", "Mark"]]] = (),
id: Optional[str] = None id: Optional[str] = None,
) -> "ParameterSet": ) -> "ParameterSet":
if isinstance(marks, MarkDecorator): if isinstance(marks, MarkDecorator):
marks = (marks,) marks = (marks,)
@ -138,7 +138,7 @@ class ParameterSet(
argnames: Union[str, List[str], Tuple[str, ...]], argnames: Union[str, List[str], Tuple[str, ...]],
argvalues: Iterable[Union["ParameterSet", Sequence[object], object]], argvalues: Iterable[Union["ParameterSet", Sequence[object], object]],
*args, *args,
**kwargs **kwargs,
) -> Tuple[Union[List[str], Tuple[str, ...]], bool]: ) -> Tuple[Union[List[str], Tuple[str, ...]], bool]:
if not isinstance(argnames, (tuple, list)): if not isinstance(argnames, (tuple, list)):
argnames = [x.strip() for x in argnames.split(",") if x.strip()] argnames = [x.strip() for x in argnames.split(",") if x.strip()]
@ -400,7 +400,7 @@ if TYPE_CHECKING:
self, self,
condition: Union[str, bool] = ..., condition: Union[str, bool] = ...,
*conditions: Union[str, bool], *conditions: Union[str, bool],
reason: str = ... reason: str = ...,
) -> MarkDecorator: ) -> MarkDecorator:
... ...
@ -417,7 +417,7 @@ if TYPE_CHECKING:
reason: str = ..., reason: str = ...,
run: bool = ..., run: bool = ...,
raises: Union[Type[BaseException], Tuple[Type[BaseException], ...]] = ..., raises: Union[Type[BaseException], Tuple[Type[BaseException], ...]] = ...,
strict: bool = ... strict: bool = ...,
) -> MarkDecorator: ) -> MarkDecorator:
... ...
@ -434,7 +434,7 @@ if TYPE_CHECKING:
Callable[[Any], Optional[object]], Callable[[Any], Optional[object]],
] ]
] = ..., ] = ...,
scope: Optional[_Scope] = ... scope: Optional[_Scope] = ...,
) -> MarkDecorator: ) -> MarkDecorator:
... ...

View File

@ -441,7 +441,7 @@ class ImportPathMismatchError(ImportError):
def import_path( def import_path(
p: Union[str, py.path.local, Path], p: Union[str, py.path.local, Path],
*, *,
mode: Union[str, ImportMode] = ImportMode.prepend mode: Union[str, ImportMode] = ImportMode.prepend,
) -> ModuleType: ) -> ModuleType:
"""Import and return a module from the given path, which can be a file (a module) or """Import and return a module from the given path, which can be a file (a module) or
a directory (a package). a directory (a package).

View File

@ -1211,7 +1211,7 @@ class Testdir:
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=CLOSE_STDIN, stdin=CLOSE_STDIN,
**kw **kw,
): ):
"""Invoke subprocess.Popen. """Invoke subprocess.Popen.
@ -1530,7 +1530,7 @@ class LineMatcher:
match_func: Callable[[str, str], bool], match_func: Callable[[str, str], bool],
match_nickname: str, match_nickname: str,
*, *,
consecutive: bool = False consecutive: bool = False,
) -> None: ) -> None:
"""Underlying implementation of ``fnmatch_lines`` and ``re_match_lines``. """Underlying implementation of ``fnmatch_lines`` and ``re_match_lines``.

View File

@ -975,7 +975,7 @@ class Metafunc:
] = None, ] = None,
scope: "Optional[_Scope]" = None, scope: "Optional[_Scope]" = None,
*, *,
_param_mark: Optional[Mark] = None _param_mark: Optional[Mark] = None,
) -> None: ) -> None:
"""Add new invocations to the underlying test function using the list """Add new invocations to the underlying test function using the list
of argvalues for the given argnames. Parametrization is performed of argvalues for the given argnames. Parametrization is performed

View File

@ -559,7 +559,7 @@ _E = TypeVar("_E", bound=BaseException)
def raises( def raises(
expected_exception: Union[Type[_E], Tuple[Type[_E], ...]], expected_exception: Union[Type[_E], Tuple[Type[_E], ...]],
*, *,
match: Optional[Union[str, Pattern[str]]] = ... match: Optional[Union[str, Pattern[str]]] = ...,
) -> "RaisesContext[_E]": ) -> "RaisesContext[_E]":
... ...
@ -569,7 +569,7 @@ def raises( # noqa: F811
expected_exception: Union[Type[_E], Tuple[Type[_E], ...]], expected_exception: Union[Type[_E], Tuple[Type[_E], ...]],
func: Callable[..., Any], func: Callable[..., Any],
*args: Any, *args: Any,
**kwargs: Any **kwargs: Any,
) -> _pytest._code.ExceptionInfo[_E]: ) -> _pytest._code.ExceptionInfo[_E]:
... ...

View File

@ -85,7 +85,7 @@ def deprecated_call( # noqa: F811
def warns( def warns(
expected_warning: Optional[Union[Type[Warning], Tuple[Type[Warning], ...]]], expected_warning: Optional[Union[Type[Warning], Tuple[Type[Warning], ...]]],
*, *,
match: Optional[Union[str, Pattern[str]]] = ... match: Optional[Union[str, Pattern[str]]] = ...,
) -> "WarningsChecker": ) -> "WarningsChecker":
... ...
@ -95,7 +95,7 @@ def warns( # noqa: F811
expected_warning: Optional[Union[Type[Warning], Tuple[Type[Warning], ...]]], expected_warning: Optional[Union[Type[Warning], Tuple[Type[Warning], ...]]],
func: Callable[..., T], func: Callable[..., T],
*args: Any, *args: Any,
**kwargs: Any **kwargs: Any,
) -> T: ) -> T:
... ...
@ -104,7 +104,7 @@ def warns( # noqa: F811
expected_warning: Optional[Union[Type[Warning], Tuple[Type[Warning], ...]]], expected_warning: Optional[Union[Type[Warning], Tuple[Type[Warning], ...]]],
*args: Any, *args: Any,
match: Optional[Union[str, Pattern[str]]] = None, match: Optional[Union[str, Pattern[str]]] = None,
**kwargs: Any **kwargs: Any,
) -> Union["WarningsChecker", Any]: ) -> Union["WarningsChecker", Any]:
r"""Assert that code raises a particular class of warning. r"""Assert that code raises a particular class of warning.

View File

@ -246,7 +246,7 @@ class TestReport(BaseReport):
sections: Iterable[Tuple[str, str]] = (), sections: Iterable[Tuple[str, str]] = (),
duration: float = 0, duration: float = 0,
user_properties: Optional[Iterable[Tuple[str, object]]] = None, user_properties: Optional[Iterable[Tuple[str, object]]] = None,
**extra **extra,
) -> None: ) -> None:
#: Normalized collection nodeid. #: Normalized collection nodeid.
self.nodeid = nodeid self.nodeid = nodeid
@ -348,7 +348,7 @@ class CollectReport(BaseReport):
longrepr, longrepr,
result: Optional[List[Union[Item, Collector]]], result: Optional[List[Union[Item, Collector]]],
sections: Iterable[Tuple[str, str]] = (), sections: Iterable[Tuple[str, str]] = (),
**extra **extra,
) -> None: ) -> None:
#: Normalized collection nodeid. #: Normalized collection nodeid.
self.nodeid = nodeid self.nodeid = nodeid

View File

@ -450,7 +450,7 @@ class TerminalReporter:
sep: str, sep: str,
title: Optional[str] = None, title: Optional[str] = None,
fullwidth: Optional[int] = None, fullwidth: Optional[int] = None,
**markup: bool **markup: bool,
) -> None: ) -> None:
self.ensure_newline() self.ensure_newline()
self._tw.sep(sep, title, fullwidth, **markup) self._tw.sep(sep, title, fullwidth, **markup)