Skip to content

[pre-commit.ci] pre-commit autoupdate #639

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
args: [--prose-wrap=preserve]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "971923581912ef60a6b70dbf0c3e9a39563c9d47" # frozen: v0.11.4
rev: "0b19ef1fd6ad680ed7752d6daba883ce1265a6de" # frozen: v0.12.2
hooks:
- id: ruff
args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"]
Expand Down
2 changes: 1 addition & 1 deletion numpydoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@


def setup(app, *args, **kwargs):
from .numpydoc import setup
from .numpydoc import setup # noqa: PLC0415

return setup(app, *args, **kwargs)
2 changes: 1 addition & 1 deletion numpydoc/docscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def __init__(self, cls, doc=None, modulename="", func_doc=FunctionDoc, config=No
self._cls = cls

if "sphinx" in sys.modules:
from sphinx.ext.autodoc import ALL
from sphinx.ext.autodoc import ALL # noqa: PLC0415
else:
ALL = object()

Expand Down
8 changes: 2 additions & 6 deletions numpydoc/tests/test_docscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import textwrap
import warnings
from collections import namedtuple
from collections.abc import Callable
from copy import deepcopy
from functools import cached_property

import jinja2
import pytest
Expand Down Expand Up @@ -1623,7 +1625,6 @@ def test__error_location_no_name_attr():

See gh-362
"""
from collections.abc import Callable

# Create a Callable that doesn't have a __name__ attribute
class Foo:
Expand All @@ -1644,7 +1645,6 @@ def __call__(self):
def test_class_docstring_cached_property():
"""Ensure that properties marked with the `cached_property` decorator
are listed in the Methods section. See gh-432."""
from functools import cached_property

class Foo:
_x = [1, 2, 3]
Expand All @@ -1664,8 +1664,6 @@ def test_namedtuple_no_duplicate_attributes():

See gh-257
"""
from collections import namedtuple

foo = namedtuple("Foo", ("bar", "baz"))

# Create the SphinxClassDoc object via get_doc_object
Expand All @@ -1678,8 +1676,6 @@ def test_namedtuple_class_docstring():

See gh-257
"""
from collections import namedtuple

foo = namedtuple("Foo", ("bar", "baz"))

class MyFoo(foo):
Expand Down
9 changes: 3 additions & 6 deletions numpydoc/tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1390,12 +1390,9 @@ def test_bad_class(self, capsys):
"too_short_header_underline",
],
)
def test_bad_generic_functions(self, capsys, func):
with pytest.warns(UserWarning):
errors = validate_one(
self._import_path(klass="WarnGenericFormat", func=func)
)
assert "is too short" in w.msg
def test_bad_generic_functions_new(self, capsys, func):
with pytest.warns(UserWarning, match="is too short"):
validate_one(self._import_path(klass="WarnGenericFormat", func=func))

@pytest.mark.parametrize(
"func",
Expand Down
Loading