Skip to content

Commit

Permalink
chore: Update pre-commit hooks and fix any resulting errors (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
FollowTheProcess committed Aug 18, 2022
1 parent 45f0118 commit ffb4fca
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 17 deletions.
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Expand Up @@ -4,14 +4,14 @@ ci:

repos:
- repo: https://github.com/psf/black
rev: "22.3.0"
rev: "22.6.0"
hooks:
- id: black
args:
- "--preview"

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -31,7 +31,7 @@ repos:
args: ["-a", "from __future__ import annotations"]

- repo: https://github.com/asottile/pyupgrade
rev: v2.32.0
rev: v2.37.3
hooks:
- id: pyupgrade
args: [--py37-plus]
Expand All @@ -42,28 +42,28 @@ repos:
- id: pyproject-fmt

- repo: https://github.com/hadialqattan/pycln
rev: v1.3.2
rev: v2.1.1
hooks:
- id: pycln
args: [--all]
stages: [manual]

- repo: https://github.com/asottile/yesqa
rev: v1.3.0
rev: v1.4.0
hooks:
- id: yesqa
additional_dependencies: &flake8-dependencies
- flake8-bugbear

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 5.0.4
hooks:
- id: flake8
exclude: docs/conf.py
additional_dependencies: *flake8-dependencies

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.950
rev: v0.971
hooks:
- id: mypy
files: ^nox/
Expand Down
2 changes: 2 additions & 0 deletions nox/_option_set.py
Expand Up @@ -37,6 +37,8 @@ class OptionGroup:
kwargs: Passed through to``ArgumentParser.add_argument_group``.
"""

__slots__ = ("name", "args", "kwargs")

def __init__(self, name: str, *args: Any, **kwargs: Any) -> None:
self.name = name
self.args = args
Expand Down
6 changes: 3 additions & 3 deletions nox/_typing.py
Expand Up @@ -22,15 +22,15 @@
from typing import TYPE_CHECKING
except ImportError:
try:
from typing_extensions import TYPE_CHECKING
from typing import TYPE_CHECKING
except ImportError:
TYPE_CHECKING = False

try:
from typing import NoReturn
except ImportError:
try:
from typing_extensions import NoReturn
from typing import NoReturn
except ImportError:
pass

Expand All @@ -39,7 +39,7 @@
from typing import ClassVar
except ImportError:
try:
from typing_extensions import ClassVar
from typing import ClassVar
except ImportError:
pass

Expand Down
2 changes: 1 addition & 1 deletion nox/_version.py
Expand Up @@ -86,7 +86,7 @@ def _check_nox_version_satisfies(needs_version: str) -> None:
with contextlib.suppress(InvalidVersion):
Version(needs_version)
message += f", did you mean '>= {needs_version}'?"
raise InvalidVersionSpecifier(message)
raise InvalidVersionSpecifier(message) from error

if not specifiers.contains(version, prereleases=True):
raise VersionCheckFailed(
Expand Down
1 change: 0 additions & 1 deletion nox/manifest.py
Expand Up @@ -233,7 +233,6 @@ def make_session(
# If the func has the python attribute set to a list, we'll need
# to expand them.
if isinstance(func.python, (list, tuple, set)):

for python in func.python:
single_func = func.copy()
single_func.python = python
Expand Down
8 changes: 5 additions & 3 deletions nox/sessions.py
Expand Up @@ -158,7 +158,8 @@ def env(self) -> dict[str, str]:

@property
def posargs(self) -> list[str]:
"""Any extra arguments from the ``nox`` commandline or :class:`Session.notify`."""
"""Any extra arguments from the ``nox`` commandline or :class:`Session.notify`.
"""
return self._runner.posargs

@property
Expand Down Expand Up @@ -203,7 +204,8 @@ def cache_dir(self) -> pathlib.Path:

@property
def interactive(self) -> bool:
"""Returns True if Nox is being run in an interactive session or False otherwise."""
"""Returns True if Nox is being run in an interactive session or False otherwise.
"""
return not self._runner.global_config.non_interactive and sys.stdin.isatty()

@property
Expand Down Expand Up @@ -246,7 +248,7 @@ def _run_func(
return func(*args, **kwargs)
except Exception as e:
logger.exception(f"Function {func!r} raised {e!r}.")
raise nox.command.CommandFailed()
raise nox.command.CommandFailed() from e

def run(
self, *args: str, env: Mapping[str, str] | None = None, **kwargs: Any
Expand Down
2 changes: 0 additions & 2 deletions tests/test__parametrize.py
Expand Up @@ -166,7 +166,6 @@ def f():


def test_generate_calls_simple():

f = mock.Mock()
f.__name__ = "f"
f.some_prop = 42
Expand Down Expand Up @@ -199,7 +198,6 @@ def test_generate_calls_simple():


def test_generate_calls_multiple_args():

f = mock.Mock()
f.__name__ = "f"

Expand Down

0 comments on commit ffb4fca

Please sign in to comment.