diff --git a/CHANGES.rst b/CHANGES.rst index 53ce7e7d1..f72bc612e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,6 +12,7 @@ Added - Terminate with an error if non-existing files or directories are passed on the command line. This also improves the error from misquoted parameters like ``"--lint pylint"``. - Allow Git test case to run slower when checking file timestamps. CI can be slow. +- Fix compatibility with Black >= 21.7b1.dev9 Fixed ----- diff --git a/src/darker/black_diff.py b/src/darker/black_diff.py index cd9073819..a9d2cdbc7 100644 --- a/src/darker/black_diff.py +++ b/src/darker/black_diff.py @@ -32,7 +32,7 @@ based on whether reformats touch user-edited lines """ - +import inspect import logging import sys from pathlib import Path @@ -131,6 +131,9 @@ def apply_black_excludes( :return: Absolute paths of files which should be reformatted using Black """ + sig = inspect.signature(gen_python_files) + # those two exist and are required in black>=21.7b1.dev9 + kwargs = dict(verbose=False, quiet=False) if "verbose" in sig.parameters else {} return set( gen_python_files( (root / path for path in paths), @@ -141,6 +144,7 @@ def apply_black_excludes( force_exclude=black_config.get("force_exclude"), report=Report(), gitignore=None, + **kwargs, ) )