Skip to content

Commit 83a46be

Browse files
committed
Fix NameError & reformat everything
1 parent 02cf71f commit 83a46be

File tree

8 files changed

+16
-36
lines changed

8 files changed

+16
-36
lines changed

src/griffe/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@
181181
ast_siblings,
182182
)
183183
from griffe._internal.agents.nodes.docstrings import get_docstring
184-
185184
from griffe._internal.agents.nodes.exports import get__all__, safe_get__all__
186185
from griffe._internal.agents.nodes.imports import relative_to_absolute
187186
from griffe._internal.agents.nodes.parameters import ParametersType, get_parameters
@@ -382,10 +381,6 @@
382381
vtree,
383382
)
384383

385-
386-
387-
388-
389384
# Regenerate this list with the following Python snippet:
390385
# import griffe
391386
# names = sorted(n for n in dir(griffe) if not n.startswith("_") and n not in ("Any", "annotations", "lazy_importing", "warnings"))

src/griffe/_internal/agents/nodes/exports.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import ast
66
from contextlib import suppress
7-
from dataclasses import dataclass
87
from typing import TYPE_CHECKING, Any, Callable
98

109
from griffe._internal.agents.nodes.values import get_value
@@ -16,8 +15,6 @@
1615
from griffe._internal.models import Module
1716

1817

19-
20-
2118
def _extract_attribute(node: ast.Attribute, parent: Module) -> list[str | ExprName]:
2219
return [ExprName(name=node.attr, parent=_extract(node.value, parent)[0])]
2320

src/griffe/_internal/docstrings/auto.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from __future__ import annotations
44

55
import re
6-
from typing import TYPE_CHECKING, Any, Literal, TypedDict
7-
from warnings import warn
6+
from typing import TYPE_CHECKING, Literal, TypedDict
87

98
from griffe._internal.enumerations import Parser
109

src/griffe/_internal/docstrings/google.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import re
66
from contextlib import suppress
77
from typing import TYPE_CHECKING, TypedDict
8-
from warnings import warn
98

109
from griffe._internal.docstrings.models import (
1110
DocstringAttribute,
@@ -930,7 +929,6 @@ def parse_google(
930929
in_code_block = False
931930
lines = docstring.lines
932931

933-
934932
options = {
935933
"ignore_init_summary": ignore_init_summary,
936934
"trim_doctest_flags": trim_doctest_flags,

src/griffe/_internal/docstrings/numpy.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from contextlib import suppress
2424
from textwrap import dedent
2525
from typing import TYPE_CHECKING, TypedDict
26-
from warnings import warn
2726

2827
from griffe._internal.docstrings.models import (
2928
DocstringAttribute,
@@ -941,7 +940,6 @@ def parse_numpy(
941940
in_code_block = False
942941
lines = docstring.lines
943942

944-
945943
options = {
946944
"trim_doctest_flags": trim_doctest_flags,
947945
"ignore_init_summary": ignore_init_summary,

src/griffe/_internal/docstrings/sphinx.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from contextlib import suppress
1010
from dataclasses import dataclass, field
1111
from typing import TYPE_CHECKING, Any, Callable, TypedDict
12-
from warnings import warn
1312

1413
from griffe._internal.docstrings.models import (
1514
DocstringAttribute,
@@ -112,7 +111,6 @@ def parse_sphinx(
112111
"""
113112
parsed_values = _ParsedValues()
114113

115-
116114
options = {
117115
"warn_unknown_params": warn_unknown_params,
118116
"warnings": warnings,

src/griffe/_internal/extensions/base.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33

44
from __future__ import annotations
55

6-
import inspect
76
import os
87
import sys
9-
import warnings
10-
from contextlib import suppress
118
from importlib.util import module_from_spec, spec_from_file_location
129
from inspect import isclass
1310
from pathlib import Path
@@ -25,12 +22,18 @@
2522
from griffe._internal.agents.nodes.runtime import ObjectNode
2623
from griffe._internal.agents.visitor import Visitor
2724
from griffe._internal.loader import GriffeLoader
28-
from griffe._internal.models import Alias, Attribute, Class, Function, Module, Object, TypeAlias
29-
30-
31-
32-
33-
class Extension(metaclass=_ExtensionMetaclass):
25+
from griffe._internal.models import (
26+
Alias,
27+
Attribute,
28+
Class,
29+
Function,
30+
Module,
31+
Object,
32+
TypeAlias,
33+
)
34+
35+
36+
class Extension:
3437
"""Base class for Griffe extensions."""
3538

3639
def visit(self, node: ast.AST) -> None:
@@ -608,7 +611,9 @@ def load_extensions(*exts: LoadableExtensionType) -> Extensions:
608611

609612
# TODO: Deprecate and remove at some point?
610613
# Always add our built-in dataclasses extension.
611-
from griffe._internal.extensions.dataclasses import DataclassesExtension # noqa: PLC0415
614+
from griffe._internal.extensions.dataclasses import (
615+
DataclassesExtension,
616+
)
612617

613618
for ext in extensions._extensions:
614619
if type(ext) is DataclassesExtension:

tests/test_extensions/test_base.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
Alias,
1313
Extension,
1414
GriffeLoader,
15-
Inspector,
1615
ObjectNode,
17-
Visitor,
1816
load_extensions,
1917
temporary_visited_module,
2018
temporary_visited_package,
@@ -197,14 +195,6 @@ def method(self): ...
197195
assert set(events) == set(extension.records)
198196

199197

200-
201-
202-
203-
204-
205-
206-
207-
208198
class LoadEventsTest(Extension): # noqa: D101
209199
def __init__(self, *args: Any, **kwargs: Any) -> None: # noqa: D107
210200
super().__init__()

0 commit comments

Comments
 (0)