Skip to content

Commit dbb31bb

Browse files
committed
FIX: More
1 parent 37f6a7f commit dbb31bb

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

numpydoc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88

99
def setup(app, *args, **kwargs):
10-
from .numpydoc import setup
10+
from .numpydoc import setup # noqa: PLC0415
1111

1212
return setup(app, *args, **kwargs)

numpydoc/docscrape.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ def __init__(self, cls, doc=None, modulename="", func_doc=FunctionDoc, config=No
627627
self._cls = cls
628628

629629
if "sphinx" in sys.modules:
630-
from sphinx.ext.autodoc import ALL
630+
from sphinx.ext.autodoc import ALL # noqa: PLC0415
631631
else:
632632
ALL = object()
633633

numpydoc/tests/test_docscrape.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import textwrap
33
import warnings
44
from collections import namedtuple
5+
from collections.abc import Callable
56
from copy import deepcopy
7+
from functools import cached_property
68

79
import jinja2
810
import pytest
@@ -1623,7 +1625,6 @@ def test__error_location_no_name_attr():
16231625
16241626
See gh-362
16251627
"""
1626-
from collections.abc import Callable
16271628

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

16491649
class Foo:
16501650
_x = [1, 2, 3]
@@ -1664,8 +1664,6 @@ def test_namedtuple_no_duplicate_attributes():
16641664
16651665
See gh-257
16661666
"""
1667-
from collections import namedtuple
1668-
16691667
foo = namedtuple("Foo", ("bar", "baz"))
16701668

16711669
# Create the SphinxClassDoc object via get_doc_object
@@ -1678,8 +1676,6 @@ def test_namedtuple_class_docstring():
16781676
16791677
See gh-257
16801678
"""
1681-
from collections import namedtuple
1682-
16831679
foo = namedtuple("Foo", ("bar", "baz"))
16841680

16851681
class MyFoo(foo):

numpydoc/tests/test_validate.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,12 +1390,9 @@ def test_bad_class(self, capsys):
13901390
"too_short_header_underline",
13911391
],
13921392
)
1393-
def test_bad_generic_functions(self, capsys, func):
1394-
with pytest.warns(UserWarning):
1395-
errors = validate_one(
1396-
self._import_path(klass="WarnGenericFormat", func=func)
1397-
)
1398-
assert "is too short" in w.msg
1393+
def test_bad_generic_functions_new(self, capsys, func):
1394+
with pytest.warns(UserWarning, match="is too short"):
1395+
validate_one(self._import_path(klass="WarnGenericFormat", func=func))
13991396

14001397
@pytest.mark.parametrize(
14011398
"func",

0 commit comments

Comments
 (0)