autodoc

Sphinx autodoc gets stuck on random.choice() using mock

回眸只為那壹抹淺笑 提交于 2020-07-09 12:13:08
问题 This is a continuation of a question I originally asked in this post: random.choice error due to np.linspace and np.logspace In this question, I have stripped down the problem to the bare minimum and was able to reproduce the problem where Sphinx is hanging up on the random.choice() function. Here is the Python code in the file randor_test.py; it runs in PyCharm: import random import numpy as np def rand_test(svr_C, svr_gamma): """This is test docstring #. item one #. item two """ ml_params =

Sphinx autodoc gets stuck on random.choice() using mock

冷暖自知 提交于 2020-07-09 12:09:20
问题 This is a continuation of a question I originally asked in this post: random.choice error due to np.linspace and np.logspace In this question, I have stripped down the problem to the bare minimum and was able to reproduce the problem where Sphinx is hanging up on the random.choice() function. Here is the Python code in the file randor_test.py; it runs in PyCharm: import random import numpy as np def rand_test(svr_C, svr_gamma): """This is test docstring #. item one #. item two """ ml_params =

Can Python autodoc tuple/list format be changed?

牧云@^-^@ 提交于 2020-07-06 11:13:48
问题 I have some Python code in a project that I want to document, however I have run into a problem with documenting class constants that are tuples or lists. See code and image below. It's very hard to read the documentation when there are several items on each row and the lines are split randomly. Can the tuple be formatted in another way? Like each element on a new row. I still want to use autodoc (on the whole file), so manually adding the classes is not acceptable. I can change the code,

Sphinx cross referencing breaks for inherited objects imported and documented in a parent module

坚强是说给别人听的谎言 提交于 2020-06-27 08:46:12
问题 I'm trying to get my Sphinx documentation build correctly and have cross-references (including those from inherited relations) work right. In my project, I have a situation which is depicted in the example below, which I replicated for convenience on this github repo: $ tree . . ├── a │ ├── b │ │ └── __init__.py │ └── __init__.py ├── conf.py ├── index.rst └── README.md In a.b.__init__ , I declare classes A and B . B inherits from A . In a.__init__ , I import A and B like: from .b import A, B

Sphinx cross referencing breaks for inherited objects imported and documented in a parent module

爷,独闯天下 提交于 2020-06-27 08:46:09
问题 I'm trying to get my Sphinx documentation build correctly and have cross-references (including those from inherited relations) work right. In my project, I have a situation which is depicted in the example below, which I replicated for convenience on this github repo: $ tree . . ├── a │ ├── b │ │ └── __init__.py │ └── __init__.py ├── conf.py ├── index.rst └── README.md In a.b.__init__ , I declare classes A and B . B inherits from A . In a.__init__ , I import A and B like: from .b import A, B

Human readable iterables in Sphinx documentation

橙三吉。 提交于 2020-06-12 10:44:46
问题 Sphinx-autodoc flattens dicts, lists, and tuples - making long ones barely readable. Pretty-print format isn't always desired either, as some nested containers are better kept flattened than columned. Is there a way to display iterables as typed in source code? 回答1: Get it straight from source, and add an .rst command for it: # conf.py from importlib import import_module from docutils import nodes from sphinx import addnodes from inspect import getsource from docutils.parsers.rst import

Human readable iterables in Sphinx documentation

五迷三道 提交于 2020-06-12 10:43:16
问题 Sphinx-autodoc flattens dicts, lists, and tuples - making long ones barely readable. Pretty-print format isn't always desired either, as some nested containers are better kept flattened than columned. Is there a way to display iterables as typed in source code? 回答1: Get it straight from source, and add an .rst command for it: # conf.py from importlib import import_module from docutils import nodes from sphinx import addnodes from inspect import getsource from docutils.parsers.rst import

Sphinx not removing doctest flags in html output

风流意气都作罢 提交于 2020-05-31 03:04:31
问题 I cannot eliminate the doctest flags (ie. <BLANKLINE> , # doctest: +ELLIPSIS ) for the html output. I am able to generate the documentation as I would like, so no errors there but it includes theses flags which I would like removed. Sphinx documentation here claims this is possible so I must be doing something wrong. My documentation examples are in numpy style and I have tried using both the napoleon and numpydoc extensions. Here are the steps I have taken. run sphinx-quickstart (enabling

Sphinx not documenting complex Enum classes

▼魔方 西西 提交于 2020-05-29 07:28:38
问题 In my code I have some classes that are complex Enum types. For example: class ComplexEnum(SomeOtherClass, Enum): """ Some documentation """ MEMBER1 = SomeOtherClass(1) MEMBER2 = SomeOtherClass(2) def __init__(self, arg): """ more doc """ pass def somemethod(self): """ more doc """ pass @classmethod def someclassmethod(cls, otherparam): """ more doc """ pass When I now create my documentation with Sphinx using autodoc this class is just skipped. I tried adding a custom documenter like this to

Sphinx not documenting complex Enum classes

久未见 提交于 2020-05-29 07:28:25
问题 In my code I have some classes that are complex Enum types. For example: class ComplexEnum(SomeOtherClass, Enum): """ Some documentation """ MEMBER1 = SomeOtherClass(1) MEMBER2 = SomeOtherClass(2) def __init__(self, arg): """ more doc """ pass def somemethod(self): """ more doc """ pass @classmethod def someclassmethod(cls, otherparam): """ more doc """ pass When I now create my documentation with Sphinx using autodoc this class is just skipped. I tried adding a custom documenter like this to