3
3
from __future__ import annotations
4
4
5
5
import ast
6
- from typing import TYPE_CHECKING
6
+ from typing import TYPE_CHECKING , Any
7
7
import textwrap
8
8
9
- from griffe import Docstring , Extension
10
- from griffe .docstrings .dataclasses import DocstringSectionAdmonition , DocstringSectionText
9
+ from griffe import Docstring , Extension , DocstringSectionAdmonition , DocstringSectionText , Visitor , Inspector
11
10
12
11
if TYPE_CHECKING :
13
12
from griffe import Class , Function , ObjectNode
@@ -29,13 +28,13 @@ def _insert_message(self, obj: Function | Class, message: str) -> None:
29
28
sections = obj .docstring .parsed
30
29
sections .insert (0 , DocstringSectionAdmonition (kind = "warning" , text = message , title = "Deprecated" ))
31
30
32
- def on_class_instance (self , node : ast .AST | ObjectNode , cls : Class ) -> None : # noqa: ARG002
31
+ def on_class_instance (self , node : ast .AST | ObjectNode , cls : Class , agent : Visitor | Inspector , ** kwargs : Any ) -> None : # noqa: ARG002
33
32
"""Add section to docstrings of deprecated classes."""
34
33
if message := _deprecated (cls ):
35
34
self ._insert_message (cls , message )
36
35
cls .labels .add ("deprecated" )
37
36
38
- def on_function_instance (self , node : ast .AST | ObjectNode , func : Function ) -> None : # noqa: ARG002
37
+ def on_function_instance (self , node : ast .AST | ObjectNode , func : Function , agent : Visitor | Inspector , ** kwargs : Any ) -> None : # noqa: ARG002
39
38
"""Add section to docstrings of deprecated functions."""
40
39
if message := _deprecated (func ):
41
40
self ._insert_message (func , message )
@@ -53,7 +52,7 @@ def linked_obj(self, value: str, path: str) -> str:
53
52
""" Wrap object name in reference link. """
54
53
return f'[`{ value } `][{ path } .{ value } ]'
55
54
56
- def on_function_instance (self , node : ast .AST | ObjectNode , func : Function ) -> None : # noqa: ARG002
55
+ def on_function_instance (self , node : ast .AST | ObjectNode , func : Function , agent : Visitor | Inspector , ** kwargs : Any ) -> None : # noqa: ARG002
57
56
"""Add table to specified function docstrings."""
58
57
if self .paths and func .path not in self .paths :
59
58
return # skip objects that were not selected
0 commit comments