Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update pre-commit hooks and fix any resulting errors #646

Merged
merged 1 commit into from Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 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,39 +31,39 @@ 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]

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "0.3.3"
rev: "0.3.5"
hooks:
- 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