File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 5252 py_sig_re ,
5353)
5454
55+ _TYPING_ALL = frozenset (typing .__all__ )
56+
5557logger = logging .getLogger (__name__ )
5658
5759pairindextypes = {
@@ -1076,13 +1078,6 @@ def builtin_resolver(
10761078 app : Sphinx , env : BuildEnvironment , node : pending_xref , contnode : Element
10771079) -> Element | None :
10781080 """Do not emit nitpicky warnings for built-in types."""
1079-
1080- def istyping (s : str ) -> bool :
1081- if s .startswith ('typing.' ):
1082- s = s .split ('.' , 1 )[1 ]
1083-
1084- return s in typing .__all__
1085-
10861081 if node .get ('refdomain' ) != 'py' :
10871082 return None
10881083 elif node .get ('reftype' ) in {'class' , 'obj' } and node .get ('reftarget' ) == 'None' :
@@ -1092,13 +1087,17 @@ def istyping(s: str) -> bool:
10921087 if inspect .isclass (getattr (builtins , reftarget , None )):
10931088 # built-in class
10941089 return contnode
1095- if istyping (reftarget ):
1090+ if _is_typing (reftarget ):
10961091 # typing class
10971092 return contnode
10981093
10991094 return None
11001095
11011096
1097+ def _is_typing (s : str , / ) -> bool :
1098+ return s .removeprefix ('typing.' ) in _TYPING_ALL
1099+
1100+
11021101def setup (app : Sphinx ) -> ExtensionMetadata :
11031102 app .setup_extension ('sphinx.directives' )
11041103
You can’t perform that action at this time.
0 commit comments