Skip to content

Commit

Permalink
Run black.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed May 5, 2024
1 parent f84af43 commit 2e4d4e4
Show file tree
Hide file tree
Showing 11 changed files with 237 additions and 228 deletions.
120 changes: 60 additions & 60 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,89 +19,89 @@
# 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.
sys.path.append(os.path.abspath('sphinxext'))
sys.path.insert(0, os.path.abspath('../wrapper'))
sys.path.append(os.path.abspath("sphinxext"))
sys.path.insert(0, os.path.abspath("../wrapper"))

from github_link import make_linkcode_resolve # noqa: E402

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = '1.5.3'
needs_sphinx = "1.5.3"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.linkcode',
'sphinx.ext.napoleon',
'sphinxarg.ext', # argparse extension
'nipype.sphinxext.plot_workflow',
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.linkcode",
"sphinx.ext.napoleon",
"sphinxarg.ext", # argparse extension
"nipype.sphinxext.plot_workflow",
]

# Mock modules in autodoc:
autodoc_mock_imports = [
'numpy',
'nitime',
'matplotlib',
"numpy",
"nitime",
"matplotlib",
]

if pver.parse(sphinxversion) >= pver.parse('1.7.0'):
if pver.parse(sphinxversion) >= pver.parse("1.7.0"):
autodoc_mock_imports += [
'pandas',
'nilearn',
'seaborn',
"pandas",
"nilearn",
"seaborn",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# Accept custom section names to be parsed for numpy-style docstrings
# of parameters.
# Requires pinning sphinxcontrib-napoleon to a specific commit while
# https://github.com/sphinx-contrib/napoleon/pull/10 is merged.
napoleon_use_param = False
napoleon_custom_sections = [
('Inputs', 'Parameters'),
('Outputs', 'Parameters'),
("Inputs", "Parameters"),
("Outputs", "Parameters"),
]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = [".rst", ".md"]
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# source_encoding = "utf-8-sig"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'fMRIPost-AROMA'
author = 'The fMRIPost-AROMA developers'
copyright = f'2016-, {author}'
project = "fMRIPost-AROMA"
author = "The fMRIPost-AROMA developers"
copyright = f"2016-, {author}"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = 'version'
version = "version"
# The full version, including alpha/beta/rc tags.
release = 'version'
release = "version"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand All @@ -112,7 +112,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -130,7 +130,7 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -146,7 +146,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -175,7 +175,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down Expand Up @@ -240,7 +240,7 @@
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'fmripost_aroma_doc'
htmlhelp_basename = "fmripost_aroma_doc"

# -- Options for LaTeX output ---------------------------------------------

Expand All @@ -259,7 +259,7 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'fmripost_aroma.tex', 'fMRIPost-AROMA Documentation', author, 'manual'),
(master_doc, "fmripost_aroma.tex", "fMRIPost-AROMA Documentation", author, "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -287,7 +287,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, 'fmripost-aroma', 'fMRIPost-AROMA Documentation', [author], 1)]
man_pages = [(master_doc, "fmripost-aroma", "fMRIPost-AROMA Documentation", [author], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -301,12 +301,12 @@
texinfo_documents = [
(
master_doc,
'fMRIPost-AROMA',
'fMRIPost-AROMA Documentation',
"fMRIPost-AROMA",
"fMRIPost-AROMA Documentation",
author,
'fMRIPost-AROMA',
'One line description of project.',
'Miscellaneous',
"fMRIPost-AROMA",
"One line description of project.",
"Miscellaneous",
),
]

Expand All @@ -324,31 +324,31 @@

# The following is used by sphinx.ext.linkcode to provide links to github
linkcode_resolve = make_linkcode_resolve(
'fmripost_aroma',
'https://github.com/nipreps/fMRIPost-AROMA/blob/{revision}/{package}/{path}#L{lineno}',
"fmripost_aroma",
"https://github.com/nipreps/fMRIPost-AROMA/blob/{revision}/{package}/{path}#L{lineno}",
)

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
'matplotlib': ('https://matplotlib.org/stable/', None),
'bids': ('https://bids-standard.github.io/pybids/', None),
'nibabel': ('https://nipy.org/nibabel/', None),
'nipype': ('https://nipype.readthedocs.io/en/latest/', None),
'niworkflows': ('https://www.nipreps.org/niworkflows/', None),
'fmriprep': ('https://fmriprep.org/en/stable/', None),
'sdcflows': ('https://www.nipreps.org/sdcflows/', None),
'smriprep': ('https://www.nipreps.org/smriprep/', None),
'templateflow': ('https://www.templateflow.org/python-client', None),
'tedana': ('https://tedana.readthedocs.io/en/latest/', None),
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"bids": ("https://bids-standard.github.io/pybids/", None),
"nibabel": ("https://nipy.org/nibabel/", None),
"nipype": ("https://nipype.readthedocs.io/en/latest/", None),
"niworkflows": ("https://www.nipreps.org/niworkflows/", None),
"fmriprep": ("https://fmriprep.org/en/stable/", None),
"sdcflows": ("https://www.nipreps.org/sdcflows/", None),
"smriprep": ("https://www.nipreps.org/smriprep/", None),
"templateflow": ("https://www.templateflow.org/python-client", None),
"tedana": ("https://tedana.readthedocs.io/en/latest/", None),
}

suppress_warnings = ['image.nonlocal_uri']
suppress_warnings = ["image.nonlocal_uri"]


def setup(app):
app.add_css_file('theme_overrides.css')
app.add_css_file("theme_overrides.css")
# We need this for the boilerplate script
app.add_js_file('https://cdn.rawgit.com/chrisfilo/zenodo.js/v0.1/zenodo.js')
app.add_js_file("https://cdn.rawgit.com/chrisfilo/zenodo.js/v0.1/zenodo.js")
18 changes: 9 additions & 9 deletions docs/sphinxext/github_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
from functools import partial
from operator import attrgetter

REVISION_CMD = 'git rev-parse --short HEAD'
REVISION_CMD = "git rev-parse --short HEAD"


def _get_git_revision():
try:
revision = subprocess.check_output(REVISION_CMD.split()).strip()
except (subprocess.CalledProcessError, OSError):
print('Failed to execute git to get revision')
print("Failed to execute git to get revision")
return None
return revision.decode('utf-8')
return revision.decode("utf-8")


def _linkcode_resolve(domain, info, package, url_fmt, revision):
Expand All @@ -39,14 +39,14 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):

if revision is None:
return
if domain not in ('py', 'pyx'):
if domain not in ("py", "pyx"):
return
if not info.get('module') or not info.get('fullname'):
if not info.get("module") or not info.get("fullname"):
return

class_name = info['fullname'].split('.')[0]
module = __import__(info['module'], fromlist=[class_name])
obj = attrgetter(info['fullname'])(module)
class_name = info["fullname"].split(".")[0]
module = __import__(info["module"], fromlist=[class_name])
obj = attrgetter(info["fullname"])(module)

# Unwrap the object to get the correct source
# file in case that is wrapped by a decorator
Expand All @@ -68,7 +68,7 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
try:
lineno = inspect.getsourcelines(obj)[1]
except Exception:
lineno = ''
lineno = ""
return url_fmt.format(revision=revision, package=package, path=fn, lineno=lineno)


Expand Down
Loading

0 comments on commit 2e4d4e4

Please sign in to comment.