Get click
types from main repo (#2344)
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
This commit is contained in:
parent
3980b4b176
commit
be16cfa035
@ -27,7 +27,7 @@ repos:
|
||||
- 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
|
||||
|
3
Pipfile
3
Pipfile
@ -10,7 +10,6 @@ docutils = "==0.15" # not a direct dependency, see https://github.com/pypa/pipe
|
||||
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"
|
||||
@ -29,7 +28,7 @@ black = {editable = true, extras = ["d"], path = "."}
|
||||
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"
|
||||
|
10
Pipfile.lock
generated
10
Pipfile.lock
generated
@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "18ff16725509d6d14f44e3a96fe620730c9adfdaa87cbeee74aa397913dedaab"
|
||||
"sha256": "0c126694d1a1cd1c4dc875a99f330f6b9a5994e51a1f870a98dbacd0185dae53"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {},
|
||||
@ -1188,14 +1188,6 @@
|
||||
"index": "pypi",
|
||||
"version": "==3.4.1"
|
||||
},
|
||||
"types-click": {
|
||||
"hashes": [
|
||||
"sha256:040897284e4f9466825c3865f708a985a8e7ba4d8e22cb9198ffb7b522160850",
|
||||
"sha256:4722746f1ec9fd3fc8b1d7fb8c840604dc22f9e32bcc7a31a36d6d85cc2bce24"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==7.1.2"
|
||||
},
|
||||
"types-dataclasses": {
|
||||
"hashes": [
|
||||
"sha256:7b5f4099fb21c209f2df3a83c2b64308c29955769d610a457244dc0eebe1cafc",
|
||||
|
@ -119,6 +119,8 @@ def invokeBlack(
|
||||
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,
|
||||
@ -465,6 +467,7 @@ def test_python2_should_fail_without_optional_install(self) -> None:
|
||||
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", "")
|
||||
@ -1892,7 +1895,7 @@ def test_symlink_out_of_root_directory(self) -> None:
|
||||
|
||||
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"):
|
||||
@ -1901,14 +1904,14 @@ def test_shhh_click(self) -> None:
|
||||
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:
|
||||
_unicodefun._verify_python3_env()
|
||||
_unicodefun._verify_python3_env() # type: ignore
|
||||
except RuntimeError as re:
|
||||
self.fail(f"`patch_click()` failed, exception still raised: {re}")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user