All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
Only black_primer needs the disallowal - means we'll
get better typing everywhere else.
warn_no_return=True
warn_redundant_casts=True
warn_unused_ignores=True
warn_no_return=True
warn_redundant_casts=True
warn_unused_ignores=True
-# Until we're not supporting 3.6 primer needs this
-disallow_any_generics=False
+disallow_any_generics=True
# The following are off by default. Flip them on if you feel
# adventurous.
# The following are off by default. Flip them on if you feel
# adventurous.
[mypy-aiohttp.*]
follow_imports=skip
[mypy-aiohttp.*]
follow_imports=skip
+
+[mypy-black_primer.*]
+# Until we're not supporting 3.6 primer needs this
+disallow_any_generics=False
+
[mypy-black]
# The following is because of `patch_click()`. Remove when
# we drop Python 3.6 support.
[mypy-black]
# The following is because of `patch_click()`. Remove when
# we drop Python 3.6 support.
ctx: click.Context,
param: click.Parameter,
value: Optional[str],
ctx: click.Context,
param: click.Parameter,
value: Optional[str],
+) -> Optional[Pattern[str]]:
try:
return re_compile_maybe_verbose(value) if value is not None else None
except re.error:
try:
return re_compile_maybe_verbose(value) if value is not None else None
except re.error:
quiet: bool,
verbose: bool,
required_version: str,
quiet: bool,
verbose: bool,
required_version: str,
- include: Pattern,
- exclude: Optional[Pattern],
- extend_exclude: Optional[Pattern],
- force_exclude: Optional[Pattern],
+ include: Pattern[str],
+ exclude: Optional[Pattern[str]],
+ extend_exclude: Optional[Pattern[str]],
+ force_exclude: Optional[Pattern[str]],
stdin_filename: Optional[str],
workers: int,
src: Tuple[str, ...],
stdin_filename: Optional[str],
workers: int,
src: Tuple[str, ...],
def handle_PermissionError(
def handle_PermissionError(
- func: Callable, path: Path, exc: Tuple[Any, Any, Any]
+ func: Callable[..., None], path: Path, exc: Tuple[Any, Any, Any]
) -> None:
"""
Handle PermissionError during shutil.rmtree.
) -> None:
"""
Handle PermissionError during shutil.rmtree.
black_source_lines = _bf.readlines()
black_source_lines = _bf.readlines()
-def tracefunc(frame: types.FrameType, event: str, arg: Any) -> Callable:
+def tracefunc(
+ frame: types.FrameType, event: str, arg: Any
+) -> Callable[[types.FrameType, str, Any], Any]:
"""Show function calls `from black/__init__.py` as they happen.
Register this with `sys.settrace()` in a test you're debugging.
"""Show function calls `from black/__init__.py` as they happen.
Register this with `sys.settrace()` in a test you're debugging.
from platform import system
from subprocess import CalledProcessError
from tempfile import TemporaryDirectory, gettempdir
from platform import system
from subprocess import CalledProcessError
from tempfile import TemporaryDirectory, gettempdir
-from typing import Any, Callable, Generator, Iterator, Tuple
+from typing import Any, Callable, Iterator, Tuple
from unittest.mock import Mock, patch
from click.testing import CliRunner
from unittest.mock import Mock, patch
from click.testing import CliRunner
-def capture_stdout(command: Callable, *args: Any, **kwargs: Any) -> Generator:
+def capture_stdout(
+ command: Callable[..., Any], *args: Any, **kwargs: Any
+) -> Iterator[str]:
old_stdout, sys.stdout = sys.stdout, StringIO()
try:
command(*args, **kwargs)
old_stdout, sys.stdout = sys.stdout, StringIO()
try:
command(*args, **kwargs)