mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
py nodes, prep for get_signature_prefix change
This commit is contained in:
parent
8cd0847590
commit
edc65e676c
@ -424,11 +424,11 @@ class PyObject(ObjectDescription[Tuple[str, str]]):
|
|||||||
|
|
||||||
allow_nesting = False
|
allow_nesting = False
|
||||||
|
|
||||||
def get_signature_prefix(self, sig: str) -> str:
|
def get_signature_prefix(self, sig: str) -> List[nodes.Node]:
|
||||||
"""May return a prefix to put before the object name in the
|
"""May return a prefix to put before the object name in the
|
||||||
signature.
|
signature.
|
||||||
"""
|
"""
|
||||||
return ''
|
return []
|
||||||
|
|
||||||
def needs_arglist(self) -> bool:
|
def needs_arglist(self) -> bool:
|
||||||
"""May return true if an empty argument list is to be generated even if
|
"""May return true if an empty argument list is to be generated even if
|
||||||
@ -482,7 +482,10 @@ class PyObject(ObjectDescription[Tuple[str, str]]):
|
|||||||
|
|
||||||
sig_prefix = self.get_signature_prefix(sig)
|
sig_prefix = self.get_signature_prefix(sig)
|
||||||
if sig_prefix:
|
if sig_prefix:
|
||||||
signode += addnodes.desc_annotation(sig_prefix, sig_prefix)
|
if isinstance(sig_prefix, str):
|
||||||
|
signode += addnodes.desc_annotation(sig_prefix, sig_prefix)
|
||||||
|
else:
|
||||||
|
signode += addnodes.desc_annotation(str(sig_prefix), '', *sig_prefix)
|
||||||
|
|
||||||
if prefix:
|
if prefix:
|
||||||
signode += addnodes.desc_addname(prefix, prefix)
|
signode += addnodes.desc_addname(prefix, prefix)
|
||||||
|
Loading…
Reference in New Issue
Block a user