dkirkby / bossdata

Tools for accessing SDSS BOSS data
MIT License
1 stars 3 forks source link

Incomplete API docs #92

Closed dkirkby closed 8 years ago

dkirkby commented 9 years ago

The API documentation at bossdata.readthedocs.org is empty for the meta, path, plate, and spec modules. However, these build fine locally with:

cd docs
make html

Issue #13 was a similar problem that was fixed by adding external imports to the napoleon config file. In this case the RTD logs indicate a new problem:

/home/docs/checkouts/readthedocs.org/user_builds/bossdata/checkouts/latest/docs/src/bossdata.spec.rst:4: WARNING: autodoc: failed to import module u'bossdata.spec'; the following exception was raised:
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/bossdata/envs/latest/local/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 385, in import_object
    __import__(self.modname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/bossdata/checkouts/latest/bossdata/spec.py", line 75, in <module>
    _fiducial_coef * np.arange(*fiducial_pixel_index_range))
TypeError: unsupported operand type(s) for +: 'Mock' and 'Mock'

All of the affected modules import spec, which is raising an exception when imported by sphinx.

dkirkby commented 8 years ago

The Mock being referred to here is defined in docs/conf.py:

from mock import Mock as MagicMock

class Mock(MagicMock):
    @classmethod
    def __getattr__(cls, name):
        return Mock()
    def __mul__(self, other):
        return Mock()
    def __rmul__(self, other):
        return Mock()
    def __pow__(self, other):
        return Mock()
    def __div__(self, other):
        return Mock()

I'm not sure why these arithmetic operators are defined in the first place, but it looks like adding support for + might fix this problem:

    def __add__(self, other):
        return Mock()
    def __radd__(self, other):
        return Mock()