Skip to content

Commit b6d7bd9

Browse files
committed
build: Depend on Griffe 0.49
1 parent f063178 commit b6d7bd9

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ classifiers = [
3030
"Typing :: Typed",
3131
]
3232
dependencies = [
33-
"griffe>=0.38",
33+
"griffe>=0.49",
3434
"typing-extensions>=4.7",
3535
]
3636

src/griffe_typingdoc/_docstrings.py

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

55
from typing import TYPE_CHECKING, Any, Iterator
66

7-
from griffe.docstrings.dataclasses import (
7+
from griffe import (
88
DocstringParameter,
99
DocstringRaise,
1010
DocstringReceive,
@@ -22,8 +22,7 @@
2222
)
2323

2424
if TYPE_CHECKING:
25-
from griffe import Function
26-
from griffe.dataclasses import Parameter
25+
from griffe import Function, Parameter
2726

2827

2928
def _no_self_params(func: Function) -> list[Parameter]:

src/griffe_typingdoc/_extension.py

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

33
from __future__ import annotations
44

5-
from typing import TYPE_CHECKING
5+
from typing import TYPE_CHECKING, Any
66

77
from griffe import Docstring, Extension, Function, ObjectNode
88

@@ -107,11 +107,11 @@ def _handle_object(self, obj: Object) -> None:
107107
return
108108
if obj.is_module or obj.is_class:
109109
for member in obj.members.values():
110-
self._handle_object(member) # type: ignore[arg-type]
110+
self._handle_object(member)
111111
elif obj.is_function:
112-
self._handle_function(obj) # type: ignore[arg-type]
112+
self._handle_function(obj)
113113
elif obj.is_attribute:
114-
self._handle_attribute(obj) # type: ignore[arg-type]
114+
self._handle_attribute(obj)
115115

116116
def on_package_loaded(
117117
self,
@@ -120,6 +120,7 @@ def on_package_loaded(
120120
Module,
121121
Doc("The top-level module representing a package."),
122122
],
123+
**kwargs: Any, # noqa: ARG002
123124
) -> None:
124125
"""Post-process Griffe packages recursively (non-yet handled objects only)."""
125126
self._handle_object(pkg)
@@ -135,6 +136,7 @@ def on_function_instance(
135136
Function,
136137
Doc("""The Griffe function just instantiated."""),
137138
],
139+
**kwargs: Any, # noqa: ARG002
138140
) -> None:
139141
"""Post-process Griffe functions to add a parameters section.
140142
@@ -154,6 +156,7 @@ def on_attribute_instance(
154156
Attribute,
155157
Doc("The Griffe attribute just instantiated."),
156158
],
159+
**kwargs: Any, # noqa: ARG002
157160
) -> None:
158161
"""Post-process Griffe attributes to create their docstring.
159162

src/griffe_typingdoc/_static.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
from collections import defaultdict
88
from typing import TYPE_CHECKING, Any, Sequence
99

10-
from griffe.enumerations import ParameterKind
11-
from griffe.expressions import Expr, ExprCall, ExprSubscript, ExprTuple
10+
from griffe import Expr, ExprCall, ExprSubscript, ExprTuple, ParameterKind
1211

1312
from griffe_typingdoc._docstrings import (
1413
_no_self_params,
@@ -213,7 +212,7 @@ def _warns_docs(attr_or_func: Attribute | Function, **kwargs: Any) -> DocstringS
213212
if attr_or_func.is_attribute:
214213
annotation = attr_or_func.annotation
215214
elif attr_or_func.is_function:
216-
annotation = attr_or_func.returns # type: ignore[union-attr]
215+
annotation = attr_or_func.returns
217216
metadata = _metadata(annotation)
218217
if metadata["warns"]:
219218
return _to_warns_section({"annotation": warned[0], "description": warned[1]} for warned in metadata["warns"])
@@ -224,7 +223,7 @@ def _raises_docs(attr_or_func: Attribute | Function, **kwargs: Any) -> Docstring
224223
if attr_or_func.is_attribute:
225224
annotation = attr_or_func.annotation
226225
elif attr_or_func.is_function:
227-
annotation = attr_or_func.returns # type: ignore[union-attr]
226+
annotation = attr_or_func.returns
228227
metadata = _metadata(annotation)
229228
if metadata["raises"]:
230229
return _to_raises_section({"annotation": raised[0], "description": raised[1]} for raised in metadata["raises"])
@@ -238,7 +237,7 @@ def _deprecated_docs(
238237
if attr_or_func.is_attribute:
239238
annotation = attr_or_func.annotation
240239
elif attr_or_func.is_function:
241-
annotation = attr_or_func.returns # type: ignore[union-attr]
240+
annotation = attr_or_func.returns
242241
metadata = _metadata(annotation)
243242
if "deprecated" in metadata:
244243
return _to_deprecated_section({"description": metadata["deprecated"]})

tests/test_extension.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
"""Tests for the Griffe extension."""
22

3-
from griffe.docstrings.dataclasses import DocstringSectionKind
4-
from griffe.extensions import Extensions
5-
from griffe.loader import GriffeLoader
6-
from griffe.tests import temporary_visited_package
3+
from griffe import DocstringSectionKind, Extensions, GriffeLoader, temporary_visited_package
74

85
from griffe_typingdoc import TypingDocExtension
96

10-
typing_imports = "from typing import Annotated, Doc, Generator, Iterator, Name, NotRequired, Raises, TypedDict, Unpack, Warns"
7+
typing_imports = (
8+
"from typing import Annotated, Doc, Generator, Iterator, Name, NotRequired, Raises, TypedDict, Unpack, Warns"
9+
)
1110
warning_imports = "from warnings import deprecated"
1211

1312

@@ -41,7 +40,6 @@ def test_parameter_doc() -> None:
4140
assert package["f"].docstring.parsed[1].value[0].description == "Hello."
4241

4342

44-
4543
def test_other_parameter_doc() -> None:
4644
"""Read documentation for other parameters, in unpack/typeddict annotations."""
4745
with temporary_visited_package(

0 commit comments

Comments
 (0)