From c99652230c48cd5a510fbd8bd9ff8089bc3bdb49 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 23 Dec 2021 17:38:33 -0500 Subject: [PATCH] chore: bump linting versions to latests (#528) --- .gitignore | 3 +++ nox/_decorators.py | 4 ++-- nox/_parametrize.py | 2 +- nox/tasks.py | 3 +-- noxfile.py | 20 +++++++++++--------- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 98979c46..93c0b314 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,6 @@ target/ # PyCharm .idea/ + +# Standard venv location +.venv diff --git a/nox/_decorators.py b/nox/_decorators.py index a992f5eb..8466138a 100644 --- a/nox/_decorators.py +++ b/nox/_decorators.py @@ -16,7 +16,7 @@ import functools import inspect import types -from typing import Any, Callable, Dict, Iterable, List, Optional, cast +from typing import Any, Callable, Dict, Iterable, List, Optional from . import _typing @@ -29,7 +29,7 @@ def __new__( cls, func: Callable[..., Any], *args: Any, **kwargs: Any ) -> "FunctionDecorator": obj = super().__new__(cls) - return cast("FunctionDecorator", functools.wraps(func)(obj)) + return functools.wraps(func)(obj) def _copy_func(src: Callable, name: Optional[str] = None) -> Callable: diff --git a/nox/_parametrize.py b/nox/_parametrize.py index 82022402..eb8145d8 100644 --- a/nox/_parametrize.py +++ b/nox/_parametrize.py @@ -155,7 +155,7 @@ def parametrize_decorator( def update_param_specs( - param_specs: Iterable[Param], new_specs: List[Param] + param_specs: Optional[Iterable[Param]], new_specs: List[Param] ) -> List[Param]: """Produces all combinations of the given sets of specs.""" if not param_specs: diff --git a/nox/tasks.py b/nox/tasks.py index e237e4d3..ca0baf69 100644 --- a/nox/tasks.py +++ b/nox/tasks.py @@ -63,8 +63,7 @@ def _load_and_exec_nox_module(global_config: Namespace) -> types.ModuleType: if not loader: # pragma: no cover raise IOError(f"Could not get module loader for {global_config.noxfile}") # See https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly - # unsure why mypy doesn't like this - loader.exec_module(module) # type: ignore + loader.exec_module(module) return module diff --git a/noxfile.py b/noxfile.py index 38781efd..7c013dbd 100644 --- a/noxfile.py +++ b/noxfile.py @@ -90,34 +90,36 @@ def cover(session): session.run("coverage", "erase") -@nox.session(python="3.8") +black_pins = ["black==21.12b0", "isort==5.10.1"] + + +@nox.session(python="3.9") def blacken(session): """Run black code formatter.""" - session.install("black==21.5b2", "isort==5.8.0") + session.install(*black_pins) files = ["nox", "tests", "noxfile.py", "docs/conf.py"] session.run("black", *files) session.run("isort", *files) -@nox.session(python="3.8") +@nox.session(python="3.9") def lint(session): session.install( - "flake8==3.9.2", - "black==21.6b0", - "isort==5.8.0", - "mypy==0.902", + *black_pins, + "flake8==4.0.1", + "mypy==0.930", "types-jinja2", "packaging", "importlib_metadata", ) - session.run("mypy") + session.run("mypy", "--show-error-codes") files = ["nox", "tests", "noxfile.py", "docs/conf.py"] session.run("black", "--check", *files) session.run("isort", "--check", *files) session.run("flake8", *files) -@nox.session(python="3.8") +@nox.session(python="3.9") def docs(session): """Build the documentation.""" output_dir = os.path.join(session.create_tmp(), "output")