Skip to content

Commit

Permalink
Merge branch 'release/0.3.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheider committed Feb 8, 2021
2 parents b8314ce + adfca83 commit 36177e1
Show file tree
Hide file tree
Showing 21 changed files with 416 additions and 602 deletions.
114 changes: 49 additions & 65 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"sphinx.ext.viewcode",
"sphinx.ext.githubpages",
"sphinx.ext.graphviz",
]
]

napoleon_use_ivar = True

Expand Down Expand Up @@ -142,28 +142,20 @@
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
f"{PROJECT_NAME}.tex",
f"{PROJECT_NAME} Documentation",
PROJECT_AUTHOR,
"manual",
)
]
(master_doc, f"{PROJECT_NAME}.tex", f"{PROJECT_NAME} Documentation", PROJECT_AUTHOR, "manual",)
]

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, PROJECT_NAME, f"{PROJECT_NAME} Documentation", [PROJECT_AUTHOR], 1)
]
man_pages = [(master_doc, PROJECT_NAME, f"{PROJECT_NAME} Documentation", [PROJECT_AUTHOR], 1)]

# -- Options for Texinfo output -------------------------------------------

Expand All @@ -179,8 +171,8 @@
PROJECT_NAME,
"One line description of project.",
"Miscellaneous",
)
]
)
]

# -- Options for Epub output ----------------------------------------------

Expand All @@ -206,7 +198,7 @@
intersphinx_mapping = {
"python": ("https://docs.python.org/", None),
"numpy": ("http://docs.scipy.org/doc/numpy/", None),
}
}

# -- A patch that prevents Sphinx from cross-referencing ivar tags -------
# See http://stackoverflow.com/a/41184353/3343043
Expand All @@ -217,56 +209,48 @@


def patched_make_field(self, types, domain, items, **kw):
"""
"""
# `kw` catches `env=None` needed for newer sphinx while maintaining
# backwards compatibility when passed along further down!
# #type: (List, unicode, Tuple) -> nodes.field
def handle_item(fieldarg, content):
"""
"""
par = nodes.paragraph()
par += addnodes.literal_strong("", fieldarg) # Patch: this line added
# par.extend(self.make_xrefs(self.rolename, domain, fieldarg,
# addnodes.literal_strong))
if fieldarg in types:
par += nodes.Text(" (")
# NOTE: using .pop() here to prevent a single type node to be
# inserted twice into the doctree, which leads to
# inconsistencies later when references are resolved
fieldtype = types.pop(fieldarg)
if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):
typename = "".join(n.astext() for n in fieldtype)
typename = typename.replace("int", "python:int")
typename = typename.replace("long", "python:long")
typename = typename.replace("float", "python:float")
typename = typename.replace("type", "python:type")
par.extend(
self.make_xrefs(
self.typerolename,
domain,
typename,
addnodes.literal_emphasis,
**kw,
""""""
# `kw` catches `env=None` needed for newer sphinx while maintaining
# backwards compatibility when passed along further down!
# #type: (List, unicode, Tuple) -> nodes.field
def handle_item(fieldarg, content):
""""""
par = nodes.paragraph()
par += addnodes.literal_strong("", fieldarg) # Patch: this line added
# par.extend(self.make_xrefs(self.rolename, domain, fieldarg,
# addnodes.literal_strong))
if fieldarg in types:
par += nodes.Text(" (")
# NOTE: using .pop() here to prevent a single type node to be
# inserted twice into the doctree, which leads to
# inconsistencies later when references are resolved
fieldtype = types.pop(fieldarg)
if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text):
typename = "".join(n.astext() for n in fieldtype)
typename = typename.replace("int", "python:int")
typename = typename.replace("long", "python:long")
typename = typename.replace("float", "python:float")
typename = typename.replace("type", "python:type")
par.extend(
self.make_xrefs(self.typerolename, domain, typename, addnodes.literal_emphasis, **kw,)
)
)
else:
par += fieldtype
par += nodes.Text(")")
par += nodes.Text(" -- ")
par += content
return par

field_name = nodes.field_name("", self.label)
if len(items) == 1 and self.can_collapse:
field_arg, content = items[0]
body_node = handle_item(field_arg, content)
else:
body_node = self.list_type()
for field_arg, content in items:
body_node += nodes.list_item("", handle_item(field_arg, content))
field_body = nodes.field_body("", body_node)
return nodes.field("", field_name, field_body)
else:
par += fieldtype
par += nodes.Text(")")
par += nodes.Text(" -- ")
par += content
return par

field_name = nodes.field_name("", self.label)
if len(items) == 1 and self.can_collapse:
field_arg, content = items[0]
body_node = handle_item(field_arg, content)
else:
body_node = self.list_type()
for field_arg, content in items:
body_node += nodes.list_item("", handle_item(field_arg, content))
field_body = nodes.field_body("", body_node)
return nodes.field("", field_name, field_body)


TypedField.make_field = patched_make_field
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ numpy
six
sorcery
pytest
cloudpickle
cloudpickle
draugr
3 changes: 2 additions & 1 deletion requirements/requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ twine>=1.13.0
black>=18.9b0
pytest>=4.3.0
pytest-cov>=2.6.1
coveralls>=1.6.0
coveralls>=1.6.0
draugr
3 changes: 2 additions & 1 deletion requirements/requirements_docs.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sphinx==1.8.5 # -e git://github.com/snide/sphinx_rtd_theme.git#egg=sphinx_rtd_theme
m2r2
sphinxcontrib-programoutput
trolls
trolls
draugr
Loading

0 comments on commit 36177e1

Please sign in to comment.