1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
#!/usr/bin/env python3
# coding: utf-8
import os
import re
import sys
import sphinx_rtd_theme
from sphinx.ext import autodoc
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
extensions = [
'sphinx.ext.autodoc',
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'Graphite-API'
copyright = u'2014, Bruno Renié'
version = '1.1.3'
release = '1.1.3'
exclude_patterns = ['_build']
pygments_style = 'sphinx'
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
htmlhelp_basename = 'Graphite-APIdoc'
latex_elements = {
}
latex_documents = [
('index', 'Graphite-API.tex', 'Graphite-API Documentation',
'Bruno Renié', 'manual'),
]
man_pages = [
('index', 'graphite-api', 'Graphite-API Documentation',
['Bruno Renié'], 1)
]
texinfo_documents = [
('index', 'Graphite-API', 'Graphite-API Documentation',
'Bruno Renié', 'Graphite-API', 'One line description of project.',
'Miscellaneous'),
]
class RenderFunctionDocumenter(autodoc.FunctionDocumenter):
priority = 10
@classmethod
def can_document_member(cls, member, membername, isattr, parent):
return autodoc.FunctionDocumenter.can_document_member(
member, membername, isattr, parent
) and parent.name == 'graphite_api.functions'
def format_args(self):
args = super(RenderFunctionDocumenter, self).format_args()
if args is not None:
return re.sub('requestContext, ', '', args)
def setup(app):
app.add_autodocumenter(RenderFunctionDocumenter)
add_module_names = False
class Mock(object):
__all__ = []
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()
for mod_name in ['cairocffi']:
sys.modules[mod_name] = Mock()
|