@@ -1297,7 +1297,7 @@ def can_document_member(cls, member: Any, membername: str, isattr: bool, parent:
12971297 def format_args (self , ** kwargs : Any ) -> str :
12981298 if self .config .autodoc_typehints in ('none' , 'description' ):
12991299 kwargs .setdefault ('show_annotation' , False )
1300- if self .config .autodoc_unqualified_typehints :
1300+ if self .config .autodoc_typehints_format == "short" :
13011301 kwargs .setdefault ('unqualified_typehints' , True )
13021302
13031303 try :
@@ -1327,7 +1327,7 @@ def add_directive_header(self, sig: str) -> None:
13271327 self .add_line (' :async:' , sourcename )
13281328
13291329 def format_signature (self , ** kwargs : Any ) -> str :
1330- if self .config .autodoc_unqualified_typehints :
1330+ if self .config .autodoc_typehints_format == "short" :
13311331 kwargs .setdefault ('unqualified_typehints' , True )
13321332
13331333 sigs = []
@@ -1568,7 +1568,7 @@ def get_user_defined_function_or_method(obj: Any, attr: str) -> Any:
15681568 def format_args (self , ** kwargs : Any ) -> str :
15691569 if self .config .autodoc_typehints in ('none' , 'description' ):
15701570 kwargs .setdefault ('show_annotation' , False )
1571- if self .config .autodoc_unqualified_typehints :
1571+ if self .config .autodoc_typehints_format == "short" :
15721572 kwargs .setdefault ('unqualified_typehints' , True )
15731573
15741574 try :
@@ -1591,7 +1591,7 @@ def format_signature(self, **kwargs: Any) -> str:
15911591 # do not show signatures
15921592 return ''
15931593
1594- if self .config .autodoc_unqualified_typehints :
1594+ if self .config .autodoc_typehints_format == "short" :
15951595 kwargs .setdefault ('unqualified_typehints' , True )
15961596
15971597 sig = super ().format_signature ()
@@ -2122,7 +2122,7 @@ def import_object(self, raiseerror: bool = False) -> bool:
21222122 def format_args (self , ** kwargs : Any ) -> str :
21232123 if self .config .autodoc_typehints in ('none' , 'description' ):
21242124 kwargs .setdefault ('show_annotation' , False )
2125- if self .config .autodoc_unqualified_typehints :
2125+ if self .config .autodoc_typehints_format == "short" :
21262126 kwargs .setdefault ('unqualified_typehints' , True )
21272127
21282128 try :
@@ -2174,7 +2174,7 @@ def document_members(self, all_members: bool = False) -> None:
21742174 pass
21752175
21762176 def format_signature (self , ** kwargs : Any ) -> str :
2177- if self .config .autodoc_unqualified_typehints :
2177+ if self .config .autodoc_typehints_format == "short" :
21782178 kwargs .setdefault ('unqualified_typehints' , True )
21792179
21802180 sigs = []
@@ -2850,7 +2850,8 @@ def setup(app: Sphinx) -> Dict[str, Any]:
28502850 app .add_config_value ('autodoc_typehints_description_target' , 'all' , True ,
28512851 ENUM ('all' , 'documented' ))
28522852 app .add_config_value ('autodoc_type_aliases' , {}, True )
2853- app .add_config_value ('autodoc_unqualified_typehints' , False , 'env' )
2853+ app .add_config_value ('autodoc_typehints_format' , "fully-qualified" , 'env' ,
2854+ ENUM ("fully-qualified" , "short" ))
28542855 app .add_config_value ('autodoc_warningiserror' , True , True )
28552856 app .add_config_value ('autodoc_inherit_docstrings' , True , True )
28562857 app .add_event ('autodoc-before-process-signature' )
0 commit comments