mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-28 22:36:24 +02:00
Moved mock to top
This commit is contained in:
parent
f208b49c36
commit
b73245e1de
1 changed files with 25 additions and 26 deletions
51
doc/conf.py
51
doc/conf.py
|
|
@ -15,6 +15,31 @@ import sys, os, exceptions
|
|||
|
||||
#Mocking uninstalled modules: https://read-the-docs.readthedocs.org/en/latest/faq.html
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Mock out imports with C dependencies because ReadTheDocs can't build them.
|
||||
class Mock(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return Mock()
|
||||
|
||||
@classmethod
|
||||
def __getattr__(cls, name):
|
||||
if name in ('__file__', '__path__'):
|
||||
return '/dev/null'
|
||||
elif name[0] == name[0].upper():
|
||||
mockType = type(name, (), {})
|
||||
mockType.__module__ = __name__
|
||||
return mockType
|
||||
else:
|
||||
return Mock()
|
||||
|
||||
MOCK_MODULES = ['matplotlib', 'matplotlib.pyplot', 'pylab' ]
|
||||
for mod_name in MOCK_MODULES:
|
||||
sys.modules[mod_name] = Mock()
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
|
|
@ -323,29 +348,3 @@ epub_copyright = u'2013, Author'
|
|||
#app.connect("autodoc-skip-member", skip)
|
||||
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Mock out imports with C dependencies because ReadTheDocs can't build them.
|
||||
class Mock(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return Mock()
|
||||
|
||||
@classmethod
|
||||
def __getattr__(cls, name):
|
||||
if name in ('__file__', '__path__'):
|
||||
return '/dev/null'
|
||||
elif name[0] == name[0].upper():
|
||||
mockType = type(name, (), {})
|
||||
mockType.__module__ = __name__
|
||||
return mockType
|
||||
else:
|
||||
return Mock()
|
||||
|
||||
MOCK_MODULES = ['matplotlib', 'matplotlib.pyplot',
|
||||
'pylab'
|
||||
]
|
||||
for mod_name in MOCK_MODULES:
|
||||
sys.modules[mod_name] = Mock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue