1# Ensure we get the local copy of tornado instead of what's on the standard path
2import os
3import sys
4import time
5sys.path.insert(0, os.path.abspath(".."))
6import tornado
7
8master_doc = "index"
9
10project = "Tornado"
11copyright = "2009-%s, The Tornado Authors" % time.strftime("%Y")
12
13version = release = tornado.version
14
15extensions = [
16    "sphinx.ext.autodoc",
17    "sphinx.ext.coverage",
18    "sphinx.ext.doctest",
19    "sphinx.ext.intersphinx",
20    "sphinx.ext.viewcode",
21    ]
22
23primary_domain = 'py'
24default_role = 'py:obj'
25
26autodoc_member_order = "bysource"
27autoclass_content = "both"
28
29# Without this line sphinx includes a copy of object.__init__'s docstring
30# on any class that doesn't define __init__.
31# https://bitbucket.org/birkenfeld/sphinx/issue/1337/autoclass_content-both-uses-object__init__
32autodoc_docstring_signature = False
33
34coverage_skip_undoc_in_source = True
35coverage_ignore_modules = [
36    "tornado.platform.asyncio",
37    "tornado.platform.caresresolver",
38    "tornado.platform.twisted",
39    ]
40# I wish this could go in a per-module file...
41coverage_ignore_classes = [
42    # tornado.concurrent
43    "TracebackFuture",
44
45    # tornado.gen
46    "Runner",
47
48    # tornado.ioloop
49    "PollIOLoop",
50
51    # tornado.web
52    "ChunkedTransferEncoding",
53    "GZipContentEncoding",
54    "OutputTransform",
55    "TemplateModule",
56    "url",
57
58    # tornado.websocket
59    "WebSocketProtocol",
60    "WebSocketProtocol13",
61    "WebSocketProtocol76",
62    ]
63
64coverage_ignore_functions = [
65    # various modules
66    "doctests",
67    "main",
68
69    # tornado.escape
70    # parse_qs_bytes should probably be documented but it's complicated by
71    # having different implementations between py2 and py3.
72    "parse_qs_bytes",
73
74    # tornado.gen
75    "Multi",
76]
77
78html_favicon = 'favicon.ico'
79
80latex_documents = [
81    ('index', 'tornado.tex', 'Tornado Documentation', 'The Tornado Authors', 'manual', False),
82    ]
83
84intersphinx_mapping = {
85    'python': ('https://docs.python.org/3.5/', None),
86    }
87
88on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
89
90# On RTD we can't import sphinx_rtd_theme, but it will be applied by
91# default anyway.  This block will use the same theme when building locally
92# as on RTD.
93if not on_rtd:
94    import sphinx_rtd_theme
95    html_theme = 'sphinx_rtd_theme'
96    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
97