##// END OF EJS Templates
Lint fix
Melissa Weber Mendonça -
Show More
@@ -22,10 +22,10 from pathlib import Path
22 config = toml.load("./sphinx.toml")
22 config = toml.load("./sphinx.toml")
23
23
24 # https://read-the-docs.readthedocs.io/en/latest/faq.html
24 # https://read-the-docs.readthedocs.io/en/latest/faq.html
25 ON_RTD = os.environ.get('READTHEDOCS', None) == 'True'
25 ON_RTD = os.environ.get("READTHEDOCS", None) == "True"
26
26
27 if ON_RTD:
27 if ON_RTD:
28 tags.add('rtd')
28 tags.add("rtd")
29
29
30 # RTD doesn't use the Makefile, so re-run autogen_{things}.py here.
30 # RTD doesn't use the Makefile, so re-run autogen_{things}.py here.
31 for name in ("config", "api", "magics", "shortcuts"):
31 for name in ("config", "api", "magics", "shortcuts"):
@@ -52,7 +52,7 autodoc_type_aliases = {
52 # If your extensions are in another directory, add it here. If the directory
52 # If your extensions are in another directory, add it here. If the directory
53 # is relative to the documentation root, use os.path.abspath to make it
53 # is relative to the documentation root, use os.path.abspath to make it
54 # absolute, like shown here.
54 # absolute, like shown here.
55 sys.path.insert(0, os.path.abspath('../sphinxext'))
55 sys.path.insert(0, os.path.abspath("../sphinxext"))
56
56
57 # We load the ipython release info into a dict by explicit execution
57 # We load the ipython release info into a dict by explicit execution
58 iprelease = {}
58 iprelease = {}
@@ -94,10 +94,7 modindex_common_prefix = config["sphinx"]["modindex_common_prefix"]
94 intersphinx_mapping = config["intersphinx_mapping"]
94 intersphinx_mapping = config["intersphinx_mapping"]
95 for k, v in intersphinx_mapping.items():
95 for k, v in intersphinx_mapping.items():
96 intersphinx_mapping[k] = tuple(
96 intersphinx_mapping[k] = tuple(
97 [
97 [intersphinx_mapping[k]["url"], intersphinx_mapping[k]["fallback"]]
98 intersphinx_mapping[k]['url'],
99 intersphinx_mapping[k]['fallback']
100 ]
101 )
98 )
102
99
103 # numpydoc config
100 # numpydoc config
@@ -164,30 +161,32 texinfo_documents = [
164 # other places throughout the built documents.
161 # other places throughout the built documents.
165 #
162 #
166 # The full version, including alpha/beta/rc tags.
163 # The full version, including alpha/beta/rc tags.
167 release = "%s" % iprelease['version']
164 release = "%s" % iprelease["version"]
168 # Just the X.Y.Z part, no '-dev'
165 # Just the X.Y.Z part, no '-dev'
169 version = iprelease['version'].split('-', 1)[0]
166 version = iprelease["version"].split("-", 1)[0]
170
167
171 # There are two options for replacing |today|: either, you set today to some
168 # There are two options for replacing |today|: either, you set today to some
172 # non-false value, then it is used:
169 # non-false value, then it is used:
173 #today = ''
170 # today = ''
174 # Else, today_fmt is used as the format for a strftime call.
171 # Else, today_fmt is used as the format for a strftime call.
175 today_fmt = '%B %d, %Y'
172 today_fmt = "%B %d, %Y"
176
173
177 rst_prolog = ""
174 rst_prolog = ""
178
175
176
179 def is_stable(extra):
177 def is_stable(extra):
180 for ext in {'dev', 'b', 'rc'}:
178 for ext in {"dev", "b", "rc"}:
181 if ext in extra:
179 if ext in extra:
182 return False
180 return False
183 return True
181 return True
184
182
185 if is_stable(iprelease['_version_extra']):
183
186 tags.add('ipystable')
184 if is_stable(iprelease["_version_extra"]):
187 print('Adding Tag: ipystable')
185 tags.add("ipystable")
186 print("Adding Tag: ipystable")
188 else:
187 else:
189 tags.add('ipydev')
188 tags.add("ipydev")
190 print('Adding Tag: ipydev')
189 print("Adding Tag: ipydev")
191 rst_prolog += """
190 rst_prolog += """
192 .. warning::
191 .. warning::
193
192
@@ -210,6 +209,7 rst_prolog += """
210
209
211 import logging
210 import logging
212
211
212
213 class ConfigtraitFilter(logging.Filter):
213 class ConfigtraitFilter(logging.Filter):
214 """
214 """
215 This is a filter to remove in sphinx 3+ the error about config traits being duplicated.
215 This is a filter to remove in sphinx 3+ the error about config traits being duplicated.
@@ -220,14 +220,20 class ConfigtraitFilter(logging.Filter):
220 """
220 """
221
221
222 def filter(self, record):
222 def filter(self, record):
223 if record.args and record.args[0] == 'configtrait' and 'duplicate' in record.msg:
223 if (
224 record.args
225 and record.args[0] == "configtrait"
226 and "duplicate" in record.msg
227 ):
224 return False
228 return False
225 return True
229 return True
226
230
231
227 ct_filter = ConfigtraitFilter()
232 ct_filter = ConfigtraitFilter()
228
233
229 import sphinx.util
234 import sphinx.util
230 logger = sphinx.util.logging.getLogger('sphinx.domains.std').logger
235
236 logger = sphinx.util.logging.getLogger("sphinx.domains.std").logger
231 logger.addFilter(ct_filter)
237 logger.addFilter(ct_filter)
232
238
233
239
General Comments 0
You need to be logged in to leave comments. Login now