33from __future__ import annotations
44
55import ast
6- from typing import TYPE_CHECKING
6+ from typing import TYPE_CHECKING , Any
77import textwrap
88
9- from griffe import Docstring , Extension
10- from griffe .docstrings .dataclasses import DocstringSectionAdmonition , DocstringSectionText
9+ from griffe import Docstring , Extension , DocstringSectionAdmonition , DocstringSectionText , Visitor , Inspector
1110
1211if TYPE_CHECKING :
1312 from griffe import Class , Function , ObjectNode
@@ -29,13 +28,13 @@ def _insert_message(self, obj: Function | Class, message: str) -> None:
2928 sections = obj .docstring .parsed
3029 sections .insert (0 , DocstringSectionAdmonition (kind = "warning" , text = message , title = "Deprecated" ))
3130
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
3332 """Add section to docstrings of deprecated classes."""
3433 if message := _deprecated (cls ):
3534 self ._insert_message (cls , message )
3635 cls .labels .add ("deprecated" )
3736
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
3938 """Add section to docstrings of deprecated functions."""
4039 if message := _deprecated (func ):
4140 self ._insert_message (func , message )
@@ -53,7 +52,7 @@ def linked_obj(self, value: str, path: str) -> str:
5352 """ Wrap object name in reference link. """
5453 return f'[`{ value } `][{ path } .{ value } ]'
5554
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
5756 """Add table to specified function docstrings."""
5857 if self .paths and func .path not in self .paths :
5958 return # skip objects that were not selected
0 commit comments