Loading CHANGES.md +1 −0 Changes for CHANGES.md: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ - Correct max string length calculation when there are string operators (#2292) - Fixed option usage when using the `--code` flag (#2259) - Do not call `uvloop.install()` when _Black_ is used as a library (#2303) ## 21.5b2 Loading src/black/__init__.py +2 −9 Changes for src/black/__init__.py: 2 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ from black.mode import Mode, TargetVersion from black.mode import Feature, supports_feature, VERSION_TO_FEATURES from black.cache import read_cache, write_cache, get_cache_info, filter_cached, Cache from black.concurrency import cancel, shutdown from black.concurrency import cancel, shutdown, maybe_install_uvloop from black.output import dump_to_file, diff, color_diff, out, err from black.report import Report, Changed from black.files import find_project_root, find_pyproject_toml, parse_pyproject_toml Loading @@ -54,14 +54,6 @@ from _black_version import version as __version__ # If our environment has uvloop installed lets use it try: import uvloop uvloop.install() except ImportError: pass # types FileContent = str Encoding = str Loading Loading @@ -1112,6 +1104,7 @@ def patch_click() -> None: def patched_main() -> None: maybe_install_uvloop() freeze_support() patch_click() main() Loading src/black/concurrency.py +15 −0 Changes for src/black/concurrency.py: 15 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,21 @@ from black.output import err def maybe_install_uvloop() -> None: """If our environment has uvloop installed we use it. This is called only from command-line entry points to avoid interfering with the parent process if Black is used as a library. """ try: import uvloop uvloop.install() except ImportError: pass def cancel(tasks: Iterable["asyncio.Task[Any]"]) -> None: """asyncio signal handler that cancels all `tasks` and reports to stderr.""" err("Aborted!") Loading src/blackd/__init__.py +2 −8 Changes for src/blackd/__init__.py: 2 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -20,16 +20,9 @@ sys.exit(-1) import black from black.concurrency import maybe_install_uvloop import click # If our environment has uvloop installed lets use it try: import uvloop uvloop.install() except ImportError: pass from _black_version import version as __version__ # This is used internally by tests to shut down the server prematurely Loading Loading @@ -210,6 +203,7 @@ def parse_python_variant_header(value: str) -> Tuple[bool, Set[black.TargetVersi def patched_main() -> None: maybe_install_uvloop() freeze_support() black.patch_click() main() Loading Loading
CHANGES.md +1 −0 Changes for CHANGES.md: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ - Correct max string length calculation when there are string operators (#2292) - Fixed option usage when using the `--code` flag (#2259) - Do not call `uvloop.install()` when _Black_ is used as a library (#2303) ## 21.5b2 Loading
src/black/__init__.py +2 −9 Changes for src/black/__init__.py: 2 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ from black.mode import Mode, TargetVersion from black.mode import Feature, supports_feature, VERSION_TO_FEATURES from black.cache import read_cache, write_cache, get_cache_info, filter_cached, Cache from black.concurrency import cancel, shutdown from black.concurrency import cancel, shutdown, maybe_install_uvloop from black.output import dump_to_file, diff, color_diff, out, err from black.report import Report, Changed from black.files import find_project_root, find_pyproject_toml, parse_pyproject_toml Loading @@ -54,14 +54,6 @@ from _black_version import version as __version__ # If our environment has uvloop installed lets use it try: import uvloop uvloop.install() except ImportError: pass # types FileContent = str Encoding = str Loading Loading @@ -1112,6 +1104,7 @@ def patch_click() -> None: def patched_main() -> None: maybe_install_uvloop() freeze_support() patch_click() main() Loading
src/black/concurrency.py +15 −0 Changes for src/black/concurrency.py: 15 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,21 @@ from black.output import err def maybe_install_uvloop() -> None: """If our environment has uvloop installed we use it. This is called only from command-line entry points to avoid interfering with the parent process if Black is used as a library. """ try: import uvloop uvloop.install() except ImportError: pass def cancel(tasks: Iterable["asyncio.Task[Any]"]) -> None: """asyncio signal handler that cancels all `tasks` and reports to stderr.""" err("Aborted!") Loading
src/blackd/__init__.py +2 −8 Changes for src/blackd/__init__.py: 2 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -20,16 +20,9 @@ sys.exit(-1) import black from black.concurrency import maybe_install_uvloop import click # If our environment has uvloop installed lets use it try: import uvloop uvloop.install() except ImportError: pass from _black_version import version as __version__ # This is used internally by tests to shut down the server prematurely Loading Loading @@ -210,6 +203,7 @@ def parse_python_variant_header(value: str) -> Tuple[bool, Set[black.TargetVersi def patched_main() -> None: maybe_install_uvloop() freeze_support() black.patch_click() main() Loading