Truncate long type names in autodoc

When it autodoc

lists a type in the documentation it generates, for example, Bases

which class inherits, or enter hints for function parameters, it adds a type module. For example, the function getting the Tensorflow optimizer would be specified as

f(opt: tensorflow.python.training.optimizer.Optimizer = <tensorflow.python.training.adam.AdamOptimizer object>)

      

It's really hard to read and redundant. Is there a way to suppress adding the module name? Or another way to control how this type is specified?

Edit: This answer helps fix this feature in one go. Is there a way to fix this for all functions?

+3
python python-sphinx autodoc


source to share


No one has answered this question yet

See similar questions:

8
Override function declaration in autodoc for sphinx

or similar:

1623
Determine the type of object?
1531
Calling a function of a module using its name (string)
1293
How do I determine the type of a Python variable?
1093
What is the canonical way of type checking in Python?
1092
What are the differences between types () and isinstance ()?
1028
Pythonic way to create long multi-line string
994
How do I return multiple values ​​from a function?
932
Getting the class name of an instance in Python
0
How can I register my main function with Sphinx SODF code?
0
Autodoc a __init __ (self) method: getting an "autodoc member" to work



All Articles
Loading...
X
Show
Funny
Dev
Pics