Skip to content

Commit 417eb1b

Browse files
committed
style: Format
1 parent b4c5c51 commit 417eb1b

File tree

11 files changed

+24
-16
lines changed

11 files changed

+24
-16
lines changed

src/pytkdocs/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
import json
1818
import sys
1919
import traceback
20+
from collections.abc import Iterator
2021
from contextlib import contextmanager
2122
from io import StringIO
22-
from typing import TYPE_CHECKING, Any, Iterator
23+
from typing import TYPE_CHECKING, Any
2324

2425
from pytkdocs import debug
2526
from pytkdocs.loader import Loader

src/pytkdocs/loader.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
import inspect
99
import pkgutil
1010
import re
11+
from collections.abc import Mapping, Sequence
1112
from contextlib import suppress
12-
from functools import lru_cache
13+
from functools import cache
1314
from itertools import chain
1415
from operator import attrgetter
1516
from pathlib import Path
16-
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Set, Tuple, Union
17+
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
1718

1819
from pytkdocs.objects import Attribute, Class, Function, Method, Module, Object, Source
1920
from pytkdocs.parsers.attributes import get_class_attributes, get_instance_attributes, get_module_attributes, merge
@@ -920,7 +921,7 @@ def select(self, name: str, names: Set[str]) -> bool:
920921
return name in names
921922
return not self.filter_name_out(name)
922923

923-
@lru_cache(maxsize=None) # noqa: B019
924+
@cache # noqa: B019
924925
def filter_name_out(self, name: str) -> bool:
925926
"""Filter a name based on the loader's filters.
926927

src/pytkdocs/parsers/attributes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
import ast
44
import inspect
5+
from collections.abc import Iterator
56
from functools import lru_cache
67
from textwrap import dedent
78
from types import ModuleType
8-
from typing import Any, Callable, Iterator, List, get_type_hints
9+
from typing import Any, Callable, List, get_type_hints
910

1011
try:
1112
from ast import unparse # type: ignore[attr-defined]

src/pytkdocs/parsers/docstrings/google.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import inspect
44
import re
5-
from typing import Any, List, Optional, Pattern, Tuple
5+
from re import Pattern
6+
from typing import Any, List, Optional, Tuple
67

78
from pytkdocs.parsers.docstrings.base import AnnotatedObject, Attribute, Parameter, Parser, Section, empty
89

@@ -162,8 +163,8 @@ def read_block_items(self, lines: List[str], start_index: int) -> Tuple[List[str
162163
cont_indent = len(line) - len(line.lstrip())
163164
current_item.append(line[cont_indent:])
164165
self.error(
165-
f"Confusing indentation for continuation line {i+1} in docstring, "
166-
f"should be {indent} * 2 = {indent*2} spaces, not {cont_indent}",
166+
f"Confusing indentation for continuation line {i + 1} in docstring, "
167+
f"should be {indent} * 2 = {indent * 2} spaces, not {cont_indent}",
167168
)
168169

169170
elif line.startswith(indent * " "):

src/pytkdocs/parsers/docstrings/numpy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""This module defines functions and classes to parse docstrings into structured data."""
22

33
import re
4-
from typing import Any, List, Optional, Pattern
4+
from re import Pattern
5+
from typing import Any, List, Optional
56

67
from docstring_parser import parse
78
from docstring_parser.common import Docstring, DocstringMeta

src/pytkdocs/properties.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""This module simply defines regular expressions and their associated predicates."""
22

33
import re
4-
from typing import Callable, Pattern, Tuple
4+
from re import Pattern
5+
from typing import Callable, Tuple
56

67
ApplicableNameProperty = Tuple[str, Callable[[str], bool]]
78

src/pytkdocs/serializer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
import inspect
77
import re
8-
from typing import Any, Match, Optional, Pattern
8+
from re import Match, Pattern
9+
from typing import Any, Optional
910

1011
from pytkdocs.objects import Object, Source
1112
from pytkdocs.parsers.docstrings.base import AnnotatedObject, Attribute, Parameter, Section

tests/test_parsers/test_annotations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Tests for [the `parsers.attributes` module][pytkdocs.parsers.attributes] on annotations."""
22

33
import ast
4-
from typing import Iterator
4+
from collections.abc import Iterator
55

66
import pytest
77

tests/test_parsers/test_docstrings/test_google.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
"""Tests for [the `parsers.docstrings.google` module][pytkdocs.parsers.docstrings.google]."""
22

33
import inspect
4+
from collections.abc import Iterator
45
from textwrap import dedent
5-
from typing import Any, Iterator, List, Optional, Tuple
6+
from typing import Any, List, Optional, Tuple
67

78
from pytkdocs.loader import Loader
89
from pytkdocs.parsers.docstrings.base import Section
910
from pytkdocs.parsers.docstrings.google import Google
1011
from pytkdocs.serializer import serialize_attribute
1112

1213

13-
class DummyObject: # noqa: D101
14+
class DummyObject:
1415
path = "o"
1516

1617

tests/test_parsers/test_docstrings/test_numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pytkdocs.parsers.docstrings.numpy import Numpy
1212

1313

14-
class DummyObject: # noqa: D101
14+
class DummyObject:
1515
path = "o"
1616

1717

0 commit comments

Comments
 (0)