]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Get `click` types from main repo (#2344)
authorTaneli Hukkinen <3275109+hukkin@users.noreply.github.com>
Tue, 22 Jun 2021 15:58:49 +0000 (18:58 +0300)
committerGitHub <noreply@github.com>
Tue, 22 Jun 2021 15:58:49 +0000 (11:58 -0400)
Click types have been moved to click repo itself. See pallets/click#1856

I've had some issues with typeshed types being outdated in another project
so might be good to avoid that here.

Commit history before merge:

* Get `click` types from main repo
* Fix mypy errors
* Require click v8 for type annotations
* Update Pipfile

.pre-commit-config.yaml
Pipfile
Pipfile.lock
tests/test_black.py

index 920ae669d71c06982b5b4d55e8b871dab83c2fa3..79795d1085f03d9535406979e3148c9930e2cbfa 100644 (file)
@@ -27,7 +27,7 @@ repos:
           - types-dataclasses >= 0.1.3
           - types-toml >= 0.1.1
           - types-typed-ast >= 1.4.1
           - types-dataclasses >= 0.1.3
           - types-toml >= 0.1.1
           - types-typed-ast >= 1.4.1
-          - types-click >= 7.1.2
+          - click >= 8.0.0
 
   - repo: https://github.com/pre-commit/mirrors-prettier
     rev: v2.3.1
 
   - repo: https://github.com/pre-commit/mirrors-prettier
     rev: v2.3.1
diff --git a/Pipfile b/Pipfile
index f617fdc0a674a76016115efff3bd1ffa040c8b3a..a27614c94a9830822d652e7c829121b8fcbe3297 100644 (file)
--- a/Pipfile
+++ b/Pipfile
@@ -10,7 +10,6 @@ docutils = "==0.15"  # not a direct dependency, see https://github.com/pypa/pipe
 flake8 = "*"
 flake8-bugbear = "*"
 mypy = ">=0.812"
 flake8 = "*"
 flake8-bugbear = "*"
 mypy = ">=0.812"
-types-click = ">=7.1.2"
 types-dataclasses = ">=0.1.3"
 types-toml = ">=0.1.1"
 types-typed-ast = ">=1.4.1"
 types-dataclasses = ">=0.1.3"
 types-toml = ">=0.1.1"
 types-typed-ast = ">=1.4.1"
@@ -29,7 +28,7 @@ black = {editable = true, extras = ["d"], path = "."}
 aiohttp = ">=3.6.0"
 aiohttp-cors = ">=0.4.0"
 appdirs = "*"
 aiohttp = ">=3.6.0"
 aiohttp-cors = ">=0.4.0"
 appdirs = "*"
-click = ">=7.1.2"
+click = ">=8.0.0"
 mypy_extensions = ">=0.4.3"
 pathspec = ">=0.8.1"
 regex = ">=2020.1.8"
 mypy_extensions = ">=0.4.3"
 pathspec = ">=0.8.1"
 regex = ">=2020.1.8"
index 17140de2983830dc42de0779c27bc4440b65364f..d22131ee859c5eb4796e8477a15509b1ad8607f8 100644 (file)
@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
 {
     "_meta": {
         "hash": {
-            "sha256": "18ff16725509d6d14f44e3a96fe620730c9adfdaa87cbeee74aa397913dedaab"
+            "sha256": "0c126694d1a1cd1c4dc875a99f330f6b9a5994e51a1f870a98dbacd0185dae53"
         },
         "pipfile-spec": 6,
         "requires": {},
         },
         "pipfile-spec": 6,
         "requires": {},
             "index": "pypi",
             "version": "==3.4.1"
         },
             "index": "pypi",
             "version": "==3.4.1"
         },
-        "types-click": {
-            "hashes": [
-                "sha256:040897284e4f9466825c3865f708a985a8e7ba4d8e22cb9198ffb7b522160850",
-                "sha256:4722746f1ec9fd3fc8b1d7fb8c840604dc22f9e32bcc7a31a36d6d85cc2bce24"
-            ],
-            "index": "pypi",
-            "version": "==7.1.2"
-        },
         "types-dataclasses": {
             "hashes": [
                 "sha256:7b5f4099fb21c209f2df3a83c2b64308c29955769d610a457244dc0eebe1cafc",
         "types-dataclasses": {
             "hashes": [
                 "sha256:7b5f4099fb21c209f2df3a83c2b64308c29955769d610a457244dc0eebe1cafc",
index 455cb33e8276206e595ac3b8ec8d9a16fcce0ccf..5262c0ee44c4e09d2e6f44130179c59a5aa9247b 100644 (file)
@@ -119,6 +119,8 @@ class BlackTestCase(BlackBaseTestCase):
         if ignore_config:
             args = ["--verbose", "--config", str(THIS_DIR / "empty.toml"), *args]
         result = runner.invoke(black.main, args)
         if ignore_config:
             args = ["--verbose", "--config", str(THIS_DIR / "empty.toml"), *args]
         result = runner.invoke(black.main, args)
+        assert result.stdout_bytes is not None
+        assert result.stderr_bytes is not None
         self.assertEqual(
             result.exit_code,
             exit_code,
         self.assertEqual(
             result.exit_code,
             exit_code,
@@ -465,6 +467,7 @@ class BlackTestCase(BlackBaseTestCase):
             self.assertEqual(result.exit_code, 123)
         finally:
             os.unlink(tmp_file)
             self.assertEqual(result.exit_code, 123)
         finally:
             os.unlink(tmp_file)
+        assert result.stderr_bytes is not None
         actual = (
             result.stderr_bytes.decode()
             .replace("\n", "")
         actual = (
             result.stderr_bytes.decode()
             .replace("\n", "")
@@ -1892,7 +1895,7 @@ class BlackTestCase(BlackBaseTestCase):
 
     def test_shhh_click(self) -> None:
         try:
 
     def test_shhh_click(self) -> None:
         try:
-            from click import _unicodefun  # type: ignore
+            from click import _unicodefun
         except ModuleNotFoundError:
             self.skipTest("Incompatible Click version")
         if not hasattr(_unicodefun, "_verify_python3_env"):
         except ModuleNotFoundError:
             self.skipTest("Incompatible Click version")
         if not hasattr(_unicodefun, "_verify_python3_env"):
@@ -1901,14 +1904,14 @@ class BlackTestCase(BlackBaseTestCase):
         with patch("locale.getpreferredencoding") as gpe:
             gpe.return_value = "ASCII"
             with self.assertRaises(RuntimeError):
         with patch("locale.getpreferredencoding") as gpe:
             gpe.return_value = "ASCII"
             with self.assertRaises(RuntimeError):
-                _unicodefun._verify_python3_env()
+                _unicodefun._verify_python3_env()  # type: ignore
         # Now, let's silence Click...
         black.patch_click()
         # ...and confirm it's silent.
         with patch("locale.getpreferredencoding") as gpe:
             gpe.return_value = "ASCII"
             try:
         # Now, let's silence Click...
         black.patch_click()
         # ...and confirm it's silent.
         with patch("locale.getpreferredencoding") as gpe:
             gpe.return_value = "ASCII"
             try:
-                _unicodefun._verify_python3_env()
+                _unicodefun._verify_python3_env()  # type: ignore
             except RuntimeError as re:
                 self.fail(f"`patch_click()` failed, exception still raised: {re}")
 
             except RuntimeError as re:
                 self.fail(f"`patch_click()` failed, exception still raised: {re}")