Skip to content

Commit 6333f47

Browse files
committed
chore(ruff): ruff check --fix && ruff format [git-blame-ignore-rev]
1 parent bdda660 commit 6333f47

File tree

2 files changed

+104
-99
lines changed

2 files changed

+104
-99
lines changed

docs/conf.py

Lines changed: 78 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,31 @@
1212
#
1313
import os
1414
import sys
15+
1516
from packaging.version import Version
1617

18+
from smriprep import (
19+
__copyright__ as _copyright,
20+
)
1721
from smriprep import (
1822
__package__ as _package,
23+
)
24+
from smriprep import (
1925
__version__ as _version,
20-
__copyright__ as _copyright,
2126
)
2227

23-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "sphinxext")))
28+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'sphinxext')))
2429

2530
from github_link import make_linkcode_resolve # noqa: E402
2631

2732
os.environ['NO_ET'] = '1'
2833

29-
sys.path.insert(0, os.path.abspath("../wrapper"))
34+
sys.path.insert(0, os.path.abspath('../wrapper'))
3035

3136
# -- Project information -----------------------------------------------------
3237
project = _package
33-
copyright = _copyright
34-
author = "The sMRIPrep Developers"
38+
copyright = _copyright # noqa: A001
39+
author = 'The sMRIPrep Developers'
3540

3641
# The short X.Y version
3742
version = Version(_version).public
@@ -41,29 +46,29 @@
4146

4247
# -- General configuration ---------------------------------------------------
4348
extensions = [
44-
"sphinx.ext.autodoc",
45-
"sphinx.ext.doctest",
46-
"sphinx.ext.intersphinx",
47-
"sphinx.ext.coverage",
48-
"sphinx.ext.mathjax",
49-
"sphinx.ext.ifconfig",
50-
"sphinx.ext.viewcode",
51-
"sphinx.ext.githubpages",
52-
"sphinxarg.ext", # argparse extension
53-
"sphinxcontrib.apidoc",
54-
"nipype.sphinxext.plot_workflow",
55-
"nipype.sphinxext.apidoc",
49+
'sphinx.ext.autodoc',
50+
'sphinx.ext.doctest',
51+
'sphinx.ext.intersphinx',
52+
'sphinx.ext.coverage',
53+
'sphinx.ext.mathjax',
54+
'sphinx.ext.ifconfig',
55+
'sphinx.ext.viewcode',
56+
'sphinx.ext.githubpages',
57+
'sphinxarg.ext', # argparse extension
58+
'sphinxcontrib.apidoc',
59+
'nipype.sphinxext.plot_workflow',
60+
'nipype.sphinxext.apidoc',
5661
]
5762

5863
autodoc_mock_imports = [
59-
"matplotlib",
60-
"nilearn",
61-
"nitime",
62-
"pandas",
63-
"seaborn",
64-
"skimage",
65-
"svgutils",
66-
"transforms3d",
64+
'matplotlib',
65+
'nilearn',
66+
'nitime',
67+
'pandas',
68+
'seaborn',
69+
'skimage',
70+
'svgutils',
71+
'transforms3d',
6772
]
6873

6974
# Accept custom section names to be parsed for numpy-style docstrings
@@ -72,41 +77,41 @@
7277
# https://github.com/sphinx-contrib/napoleon/pull/10 is merged.
7378
napoleon_use_param = False
7479
napoleon_custom_sections = [
75-
("Inputs", "Parameters"),
76-
("Outputs", "Parameters"),
77-
("Attributes", "Parameters"),
78-
("Mandatory Inputs", "Parameters"),
79-
("Optional Inputs", "Parameters"),
80+
('Inputs', 'Parameters'),
81+
('Outputs', 'Parameters'),
82+
('Attributes', 'Parameters'),
83+
('Mandatory Inputs', 'Parameters'),
84+
('Optional Inputs', 'Parameters'),
8085
]
8186

8287
# Add any paths that contain templates here, relative to this directory.
83-
templates_path = ["_templates"]
88+
templates_path = ['_templates']
8489

8590
# The suffix(es) of source filenames.
8691
# You can specify multiple suffix as a list of string:
8792
#
8893
# source_suffix = ['.rst', '.md']
89-
source_suffix = ".rst"
94+
source_suffix = '.rst'
9095

9196
# The master toctree document.
92-
master_doc = "index"
97+
master_doc = 'index'
9398

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

101106
# List of patterns, relative to source directory, that match files and
102107
# directories to ignore when looking for source files.
103108
# This pattern also affects html_static_path and html_extra_path.
104109
exclude_patterns = [
105-
"_build",
106-
"Thumbs.db",
107-
".DS_Store",
108-
"api/modules.rst",
109-
"api/smriprep.rst",
110+
'_build',
111+
'Thumbs.db',
112+
'.DS_Store',
113+
'api/modules.rst',
114+
'api/smriprep.rst',
110115
]
111116

112117
# The name of the Pygments (syntax highlighting) style to use.
@@ -118,7 +123,7 @@
118123
# The theme to use for HTML and HTML Help pages. See the documentation for
119124
# a list of builtin themes.
120125
#
121-
html_theme = "sphinx_rtd_theme"
126+
html_theme = 'sphinx_rtd_theme'
122127

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

134139
# Custom sidebar templates, must be a dictionary that maps document names
135140
# to template names.
@@ -145,7 +150,7 @@
145150
# -- Options for HTMLHelp output ---------------------------------------------
146151

147152
# Output file base name for HTML help builder.
148-
htmlhelp_basename = "smriprepdoc"
153+
htmlhelp_basename = 'smriprepdoc'
149154

150155

151156
# -- Options for LaTeX output ------------------------------------------------
@@ -171,10 +176,10 @@
171176
latex_documents = [
172177
(
173178
master_doc,
174-
"smriprep.tex",
175-
"sMRIPrep Documentation",
176-
"The NiPreps Developers",
177-
"manual",
179+
'smriprep.tex',
180+
'sMRIPrep Documentation',
181+
'The NiPreps Developers',
182+
'manual',
178183
),
179184
]
180185

@@ -183,7 +188,7 @@
183188

184189
# One entry per manual page. List of tuples
185190
# (source start file, name, description, authors, manual section).
186-
man_pages = [(master_doc, "smriprep", "sMRIPrep Documentation", [author], 1)]
191+
man_pages = [(master_doc, 'smriprep', 'sMRIPrep Documentation', [author], 1)]
187192

188193

189194
# -- Options for Texinfo output ----------------------------------------------
@@ -194,12 +199,12 @@
194199
texinfo_documents = [
195200
(
196201
master_doc,
197-
"smriprep",
198-
"sMRIPrep Documentation",
202+
'smriprep',
203+
'sMRIPrep Documentation',
199204
author,
200-
"sMRIPrep",
201-
"One line description of project.",
202-
"Miscellaneous",
205+
'sMRIPrep',
206+
'One line description of project.',
207+
'Miscellaneous',
203208
),
204209
]
205210

@@ -219,42 +224,42 @@
219224
# epub_uid = ''
220225

221226
# A list of files that should not be packed into the epub file.
222-
epub_exclude_files = ["search.html"]
227+
epub_exclude_files = ['search.html']
223228

224229

225230
# -- Extension configuration -------------------------------------------------
226231

227-
apidoc_module_dir = "../smriprep"
228-
apidoc_output_dir = "api"
232+
apidoc_module_dir = '../smriprep'
233+
apidoc_output_dir = 'api'
229234
apidoc_excluded_paths = [
230-
"conftest.py",
231-
"*/conftest.py",
232-
"*/tests/*",
233-
"tests/*",
234-
"data/*",
235-
"conf/*",
235+
'conftest.py',
236+
'*/conftest.py',
237+
'*/tests/*',
238+
'tests/*',
239+
'data/*',
240+
'conf/*',
236241
]
237242
apidoc_separate_modules = True
238-
apidoc_extra_args = ["--module-first", "-d 1", "-T"]
243+
apidoc_extra_args = ['--module-first', '-d 1', '-T']
239244

240245
# Options for github links
241246
# The following is used by sphinx.ext.linkcode to provide links to github
242247
linkcode_resolve = make_linkcode_resolve(
243-
"smriprep",
244-
"https://github.com/nipreps/smriprep/blob/{revision}/{package}/{path}#L{lineno}",
248+
'smriprep',
249+
'https://github.com/nipreps/smriprep/blob/{revision}/{package}/{path}#L{lineno}',
245250
)
246251

247252
# -- Options for intersphinx extension ---------------------------------------
248253
intersphinx_mapping = {
249-
"python": ("https://docs.python.org/3/", None),
250-
"numpy": ("https://numpy.org/doc/stable/", None),
251-
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
252-
"matplotlib": ("https://matplotlib.org/", None),
253-
"bids": ("https://bids-standard.github.io/pybids/", None),
254-
"nibabel": ("https://nipy.org/nibabel/", None),
255-
"nipype": ("https://nipype.readthedocs.io/en/latest/", None),
256-
"niworkflows": ("https://www.nipreps.org/niworkflows/", None),
257-
"templateflow": ("https://www.templateflow.org/python-client", None),
254+
'python': ('https://docs.python.org/3/', None),
255+
'numpy': ('https://numpy.org/doc/stable/', None),
256+
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
257+
'matplotlib': ('https://matplotlib.org/', None),
258+
'bids': ('https://bids-standard.github.io/pybids/', None),
259+
'nibabel': ('https://nipy.org/nibabel/', None),
260+
'nipype': ('https://nipype.readthedocs.io/en/latest/', None),
261+
'niworkflows': ('https://www.nipreps.org/niworkflows/', None),
262+
'templateflow': ('https://www.templateflow.org/python-client', None),
258263
}
259264

260265
# -- Options for versioning extension ----------------------------------------

scripts/fetch_templates.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ def fetch_MNI2009():
2323
tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-02_desc-fMRIPrep_boldref.nii.gz
2424
tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-01_label-brain_probseg.nii.gz
2525
"""
26-
template = "MNI152NLin2009cAsym"
26+
template = 'MNI152NLin2009cAsym'
2727

28-
tf.get(template, resolution=(1, 2), desc=None, suffix="T1w")
29-
tf.get(template, resolution=(1, 2), desc="brain", suffix="mask")
30-
tf.get(template, resolution=1, atlas=None, desc="carpet", suffix="dseg")
31-
tf.get(template, resolution=2, desc="fMRIPrep", suffix="boldref")
32-
tf.get(template, resolution=1, label="brain", suffix="probseg")
28+
tf.get(template, resolution=(1, 2), desc=None, suffix='T1w')
29+
tf.get(template, resolution=(1, 2), desc='brain', suffix='mask')
30+
tf.get(template, resolution=1, atlas=None, desc='carpet', suffix='dseg')
31+
tf.get(template, resolution=2, desc='fMRIPrep', suffix='boldref')
32+
tf.get(template, resolution=1, label='brain', suffix='probseg')
3333

3434

3535
def fetch_MNI6():
@@ -42,12 +42,12 @@ def fetch_MNI6():
4242
tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_desc-brain_mask.nii.gz
4343
tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_atlas-HCP_dseg.nii.gz
4444
"""
45-
template = "MNI152NLin6Asym"
45+
template = 'MNI152NLin6Asym'
4646

47-
tf.get(template, resolution=(1, 2), desc=None, suffix="T1w")
48-
tf.get(template, resolution=(1, 2), desc="brain", suffix="mask")
47+
tf.get(template, resolution=(1, 2), desc=None, suffix='T1w')
48+
tf.get(template, resolution=(1, 2), desc='brain', suffix='mask')
4949
# CIFTI
50-
tf.get(template, resolution=2, atlas="HCP", suffix="dseg")
50+
tf.get(template, resolution=2, atlas='HCP', suffix='dseg')
5151

5252

5353
def fetch_OASIS():
@@ -61,14 +61,14 @@ def fetch_OASIS():
6161
tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_desc-brain_mask.nii.gz
6262
tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_desc-BrainCerebellumExtraction_mask.nii.gz
6363
"""
64-
template = "OASIS30ANTs"
64+
template = 'OASIS30ANTs'
6565

66-
tf.get(template, resolution=1, desc=None, label=None, suffix="T1w")
67-
tf.get(template, resolution=1, label="WM", suffix="probseg")
68-
tf.get(template, resolution=1, label="BS", suffix="probseg")
69-
tf.get(template, resolution=1, label="brain", suffix="probseg")
70-
tf.get(template, resolution=1, label="brain", suffix="mask")
71-
tf.get(template, resolution=1, desc="BrainCerebellumExtraction", suffix="mask")
66+
tf.get(template, resolution=1, desc=None, label=None, suffix='T1w')
67+
tf.get(template, resolution=1, label='WM', suffix='probseg')
68+
tf.get(template, resolution=1, label='BS', suffix='probseg')
69+
tf.get(template, resolution=1, label='brain', suffix='probseg')
70+
tf.get(template, resolution=1, label='brain', suffix='mask')
71+
tf.get(template, resolution=1, desc='BrainCerebellumExtraction', suffix='mask')
7272

7373

7474
def fetch_fsaverage():
@@ -82,9 +82,9 @@ def fetch_fsaverage():
8282
tpl-fsaverage/tpl-fsaverage_hemi-L_den-164k_sulc.shape.gii
8383
tpl-fsaverage/tpl-fsaverage_hemi-R_den-164k_sulc.shape.gii
8484
"""
85-
template = "fsaverage"
85+
template = 'fsaverage'
8686

87-
tf.get(template, density="164k", suffix="dseg", extension=".tsv")
87+
tf.get(template, density='164k', suffix='dseg', extension='.tsv')
8888
tf.get(template, density='164k', desc='std', suffix='sphere', extension='.surf.gii')
8989
tf.get(template, density='164k', suffix='sulc', extension='.shape.gii')
9090

@@ -102,7 +102,7 @@ def fetch_fsLR():
102102
tpl-fsLR/tpl-fsLR_space-fsaverage_hemi-L_den-32k_sphere.surf.gii
103103
tpl-fsLR/tpl-fsLR_space-fsaverage_hemi-R_den-32k_sphere.surf.gii
104104
"""
105-
tf.get("fsLR", density="32k")
105+
tf.get('fsLR', density='32k')
106106

107107

108108
def fetch_all():
@@ -113,21 +113,21 @@ def fetch_all():
113113
fetch_fsLR()
114114

115115

116-
if __name__ == "__main__":
116+
if __name__ == '__main__':
117117
parser = argparse.ArgumentParser(
118-
description="Helper script for pre-caching required templates to run fMRIPrep",
118+
description='Helper script for pre-caching required templates to run fMRIPrep',
119119
)
120120
parser.add_argument(
121-
"--tf-dir",
121+
'--tf-dir',
122122
type=os.path.abspath,
123-
help="Directory to save templates in. If not provided, templates will be saved to"
124-
" `${HOME}/.cache/templateflow`.",
123+
help='Directory to save templates in. If not provided, templates will be saved to'
124+
' `${HOME}/.cache/templateflow`.',
125125
)
126126
opts = parser.parse_args()
127127

128128
# set envvar (if necessary) prior to templateflow import
129129
if opts.tf_dir is not None:
130-
os.environ["TEMPLATEFLOW_HOME"] = opts.tf_dir
130+
os.environ['TEMPLATEFLOW_HOME'] = opts.tf_dir
131131

132132
import templateflow.api as tf
133133

0 commit comments

Comments
 (0)