X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/ac7402cbf6a0deb5c74e9abcffc5bd7b1148fda5..e9681a40dcb3d38b56b301d811bb1c55201fd97e:/src/black/__init__.py?ds=sidebyside diff --git a/src/black/__init__.py b/src/black/__init__.py index a82cf6a..e9d3c1b 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -1427,13 +1427,21 @@ def patch_click() -> None: file paths is minimal since it's Python source code. Moreover, this crash was spurious on Python 3.7 thanks to PEP 538 and PEP 540. """ + modules: List[Any] = [] try: from click import core + except ImportError: + pass + else: + modules.append(core) + try: from click import _unicodefun - except ModuleNotFoundError: - return + except ImportError: + pass + else: + modules.append(_unicodefun) - for module in (core, _unicodefun): + for module in modules: if hasattr(module, "_verify_python3_env"): module._verify_python3_env = lambda: None # type: ignore if hasattr(module, "_verify_python_env"):