Skip to content

Commit e6b2009

Browse files
committed
STY: Run pre-commit config on all files
[git-blame-ignore-rev]
1 parent 9796eed commit e6b2009

26 files changed

+467
-468
lines changed

bin/nib-ls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ Output a summary table for neuroimaging files (resolution, dimensionality, etc.)
1313

1414
from nibabel.cmdline.ls import main
1515

16-
1716
if __name__ == '__main__':
1817
main()

bin/nib-nifti-dx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# copyright and license terms.
88
#
99
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
10-
""" Print nifti diagnostics for header files """
10+
"""Print nifti diagnostics for header files"""
1111

1212
from nibabel.cmdline.nifti_dx import main
1313

bin/parrec2nii

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44

55
from nibabel.cmdline.parrec2nii import main
66

7-
87
if __name__ == '__main__':
98
main()

doc/source/conf.py

Lines changed: 62 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@
4242
try:
4343
import nibabel
4444
except ImportError:
45-
raise RuntimeError('Need nibabel on Python PATH; consider "make htmldoc" '
46-
'from nibabel root directory')
45+
raise RuntimeError(
46+
'Need nibabel on Python PATH; consider "make htmldoc" from nibabel root directory'
47+
)
4748

4849
# -- General configuration ----------------------------------------------------
4950

@@ -55,23 +56,24 @@
5556
fobj.write(rel['long_description'])
5657

5758
# Load metadata from setup.cfg
58-
with open(Path("../../pyproject.toml"), 'rb') as fobj:
59+
with open(Path('../../pyproject.toml'), 'rb') as fobj:
5960
pyproject = tomllib.load(fobj)
60-
authors = pyproject["project"]["authors"][0]
61+
authors = pyproject['project']['authors'][0]
6162

6263
# Add any Sphinx extension module names here, as strings. They can be
6364
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
64-
extensions = ['sphinx.ext.autodoc',
65-
'sphinx.ext.doctest',
66-
'sphinx.ext.intersphinx',
67-
'sphinx.ext.todo',
68-
'sphinx.ext.mathjax',
69-
'sphinx.ext.inheritance_diagram',
70-
'sphinx.ext.autosummary',
71-
'texext.math_dollar', # has to go before numpydoc
72-
'numpydoc',
73-
'matplotlib.sphinxext.plot_directive',
74-
]
65+
extensions = [
66+
'sphinx.ext.autodoc',
67+
'sphinx.ext.doctest',
68+
'sphinx.ext.intersphinx',
69+
'sphinx.ext.todo',
70+
'sphinx.ext.mathjax',
71+
'sphinx.ext.inheritance_diagram',
72+
'sphinx.ext.autosummary',
73+
'texext.math_dollar', # has to go before numpydoc
74+
'numpydoc',
75+
'matplotlib.sphinxext.plot_directive',
76+
]
7577

7678
# Autosummary always wants to use a `generated/` directory.
7779
# We generate with `make api-stamp`
@@ -85,13 +87,13 @@
8587
source_suffix = '.rst'
8688

8789
# The encoding of source files.
88-
#source_encoding = 'utf-8'
90+
# source_encoding = 'utf-8'
8991

9092
# The master toctree document.
9193
master_doc = 'index'
9294

9395
# General information about the project.
94-
project = u'NiBabel'
96+
project = 'NiBabel'
9597
copyright = f"2006-2022, {authors['name']} <{authors['email']}>"
9698

9799
# The version info for the project you're documenting, acts as replacement for
@@ -105,11 +107,11 @@
105107

106108
# The language for content autogenerated by Sphinx. Refer to documentation
107109
# for a list of supported languages.
108-
#language = None
110+
# language = None
109111

110112
# There are two options for replacing |today|: either, you set today to some
111113
# non-false value, then it is used:
112-
#today = ''
114+
# today = ''
113115
# Else, today_fmt is used as the format for a strftime call.
114116
today_fmt = '%B %d, %Y, %H:%M PDT'
115117

@@ -124,32 +126,32 @@
124126
exclude_trees = ['_build']
125127

126128
# The reST default role (used for this markup: `text`) to use for all documents
127-
#default_role = None
129+
# default_role = None
128130

129131
# If true, '()' will be appended to :func: etc. cross-reference text.
130-
#add_function_parentheses = True
132+
# add_function_parentheses = True
131133

132134
# If true, the current module name will be prepended to all description
133135
# unit titles (such as .. function::).
134-
#add_module_names = True
136+
# add_module_names = True
135137

136138
# If true, sectionauthor and moduleauthor directives will be shown in the
137139
# output. They are ignored by default.
138-
#show_authors = False
140+
# show_authors = False
139141

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

143145
# A list of ignored prefixes for module index sorting.
144-
#modindex_common_prefix = []
146+
# modindex_common_prefix = []
145147

146148
# -- Sphinxext configuration --------------------------------------------------
147149

148150
# Set attributes for layout of inheritance diagrams
149-
inheritance_graph_attrs = dict(rankdir="LR", size='"6.0, 8.0"', fontsize=14,
150-
ratio='compress')
151-
inheritance_node_attrs = dict(shape='ellipse', fontsize=14, height=0.75,
152-
color='dodgerblue1', style='filled')
151+
inheritance_graph_attrs = dict(rankdir='LR', size='"6.0, 8.0"', fontsize=14, ratio='compress')
152+
inheritance_node_attrs = dict(
153+
shape='ellipse', fontsize=14, height=0.75, color='dodgerblue1', style='filled'
154+
)
153155

154156
# Flag to show todo items in rendered output
155157
todo_include_todos = True
@@ -168,26 +170,26 @@
168170
# Theme options are theme-specific and customize the look and feel of a theme
169171
# further. For a list of options available for each theme, see the
170172
# documentation.
171-
#html_theme_options = {}
173+
# html_theme_options = {}
172174

173175
# Add any paths that contain custom themes here, relative to this directory.
174-
#html_theme_path = []
176+
# html_theme_path = []
175177

176178
# The name for this set of Sphinx documents. If None, it defaults to
177179
# "<project> v<release> documentation".
178-
#html_title = ''
180+
# html_title = ''
179181

180182
# A shorter title for the navigation bar. Default is the same as html_title.
181-
#html_short_title = None
183+
# html_short_title = None
182184

183185
# The name of an image file (relative to this directory) to place at the top
184186
# of the sidebar.
185-
#html_logo = None
187+
# html_logo = None
186188

187189
# The name of an image file (within the static path) to use as favicon of the
188190
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
189191
# pixels large.
190-
#html_favicon = None
192+
# html_favicon = None
191193

192194
# Add any paths that contain custom static files (such as style sheets) here,
193195
# relative to this directory. They are copied after the builtin static files,
@@ -196,42 +198,50 @@
196198

197199
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
198200
# using the given strftime format.
199-
#html_last_updated_fmt = '%b %d, %Y'
201+
# html_last_updated_fmt = '%b %d, %Y'
200202

201203
# Content template for the index page.
202204
html_index = 'index.html'
203205

204206
# If true, SmartyPants will be used to convert quotes and dashes to
205207
# typographically correct entities.
206-
#html_use_smartypants = True
208+
# html_use_smartypants = True
207209

208210
# Custom sidebar templates, maps document names to template names.
209-
html_sidebars = {'index': ['localtoc.html', 'relations.html', 'sourcelink.html',
210-
'indexsidebar.html', 'searchbox.html', 'reggie.html']}
211+
html_sidebars = {
212+
'index': [
213+
'localtoc.html',
214+
'relations.html',
215+
'sourcelink.html',
216+
'indexsidebar.html',
217+
'searchbox.html',
218+
'reggie.html',
219+
]
220+
}
211221

212222
# Additional templates that should be rendered to pages, maps page names to
213223
# template names.
214-
#html_additional_pages = {'index': 'index.html'}
224+
# html_additional_pages = {'index': 'index.html'}
215225

216226
# If false, no module index is generated.
217-
#html_use_modindex = True
227+
# html_use_modindex = True
218228

219229
# If false, no index is generated.
220-
#html_use_index = True
230+
# html_use_index = True
221231

222232
# If true, the index is split into individual pages for each letter.
223-
#html_split_index = False
233+
# html_split_index = False
224234

225235
# If true, links to the reST sources are added to the pages.
226236
html_show_sourcelink = True
227237

228238
# If true, an OpenSearch description file will be output, and all pages will
229239
# contain a <link> tag referring to it. The value of this option must be the
230240
# base URL from which the finished HTML is served.
231-
#html_use_opensearch = ''
241+
# html_use_opensearch = ''
232242

233243
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
234-
#html_file_suffix = ''
244+
# html_file_suffix = ''
235245

236246
# Output file base name for HTML help builder.
237247
htmlhelp_basename = 'nibabeldoc'
@@ -241,34 +251,32 @@
241251
# -- Options for LaTeX output -------------------------------------------------
242252

243253
# The paper size ('letter' or 'a4').
244-
#latex_paper_size = 'letter'
254+
# latex_paper_size = 'letter'
245255

246256
# The font size ('10pt', '11pt' or '12pt').
247-
#latex_font_size = '10pt'
257+
# latex_font_size = '10pt'
248258

249259
# Grouping the document tree into LaTeX files. List of tuples
250260
# (source start file, target name, title, author,
251261
# documentclass [howto/manual]).
252-
latex_documents = [
253-
('index', 'nibabel.tex', u'NiBabel Documentation', u'NiBabel Authors',
254-
'manual')]
262+
latex_documents = [('index', 'nibabel.tex', 'NiBabel Documentation', 'NiBabel Authors', 'manual')]
255263

256264
# The name of an image file (relative to this directory) to place at the top of
257265
# the title page.
258-
#latex_logo = None
266+
# latex_logo = None
259267

260268
# For "manual" documents, if this is true, then toplevel headings are parts,
261269
# not chapters.
262-
#latex_use_parts = False
270+
# latex_use_parts = False
263271

264272
# Additional stuff for the LaTeX preamble.
265-
#latex_preamble = ''
273+
# latex_preamble = ''
266274

267275
# Documents to append as an appendix to all manuals.
268-
#latex_appendices = []
276+
# latex_appendices = []
269277

270278
# If false, no module index is generated.
271-
#latex_use_modindex = True
279+
# latex_use_modindex = True
272280

273281

274282
# Example configuration for intersphinx: refer to the Python standard library.

doc/source/devel/register_me.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from os.path import join as pjoin, expanduser, abspath, dirname
2-
import sys
31
import configparser as cfp
4-
2+
import sys
3+
from os.path import abspath, dirname, expanduser
4+
from os.path import join as pjoin
55

66
if sys.platform == 'win32':
77
HOME_INI = pjoin(expanduser('~'), '_dpkg', 'local.dsource')
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
1-
""" Just showing the mosaic simplification """
1+
"""Just showing the mosaic simplification"""
22

3-
from sympy import Matrix, Symbol, symbols, simplify
3+
from sympy import Matrix, Symbol, simplify, symbols
44

55

66
def numbered_matrix(nrows, ncols, symbol_prefix):
7-
return Matrix(nrows, ncols, lambda i, j: Symbol(
8-
symbol_prefix + '_{%d%d}' % (i+1, j+1)))
7+
return Matrix(nrows, ncols, lambda i, j: Symbol(symbol_prefix + '_{%d%d}' % (i + 1, j + 1)))
98

109

1110
def numbered_vector(nrows, symbol_prefix):
12-
return Matrix(nrows, 1, lambda i, j: Symbol(
13-
symbol_prefix + '_{%d}' % (i+1)))
11+
return Matrix(nrows, 1, lambda i, j: Symbol(symbol_prefix + '_{%d}' % (i + 1)))
1412

1513

1614
RS = numbered_matrix(3, 3, 'rs')
1715

18-
mdc, mdr, rdc, rdr = symbols(
19-
'md_{cols} md_{rows} rd_{cols} rd_{rows}')
16+
mdc, mdr, rdc, rdr = symbols('md_{cols} md_{rows} rd_{cols} rd_{rows}')
2017

2118
md_adj = Matrix((mdc - 1, mdr - 1, 0)) / -2
2219
rd_adj = Matrix((rdc - 1, rdr - 1, 0)) / -2
2320

2421
adj = -(RS * md_adj) + RS * rd_adj
2522
adj.simplify()
2623

27-
Q = RS[:, :2] * Matrix((
28-
(mdc - rdc) / 2,
29-
(mdr - rdr) / 2))
24+
Q = RS[:, :2] * Matrix(((mdc - rdc) / 2, (mdr - rdr) / 2))
3025

3126
assert simplify(adj - Q) == Matrix([0, 0, 0])

doc/source/dicom/derivations/spm_dicom_orient.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Symbolic versions of the DICOM orientation mathemeatics.
1+
"""Symbolic versions of the DICOM orientation mathemeatics.
22
33
Notes on the SPM orientation machinery.
44
@@ -8,20 +8,17 @@
88
"""
99

1010
import numpy as np
11-
1211
import sympy
13-
from sympy import Matrix, Symbol, symbols, zeros, ones, eye
12+
from sympy import Matrix, Symbol, eye, ones, symbols, zeros
1413

1514

1615
# The code below is general (independent of SPMs code)
1716
def numbered_matrix(nrows, ncols, symbol_prefix):
18-
return Matrix(nrows, ncols, lambda i, j: Symbol(
19-
symbol_prefix + '_{%d%d}' % (i + 1, j + 1)))
17+
return Matrix(nrows, ncols, lambda i, j: Symbol(symbol_prefix + '_{%d%d}' % (i + 1, j + 1)))
2018

2119

2220
def numbered_vector(nrows, symbol_prefix):
23-
return Matrix(nrows, 1, lambda i, j: Symbol(
24-
symbol_prefix + '_{%d}' % (i + 1)))
21+
return Matrix(nrows, 1, lambda i, j: Symbol(symbol_prefix + '_{%d}' % (i + 1)))
2522

2623

2724
# premultiplication matrix to go from 0 based to 1 based indexing
@@ -46,7 +43,7 @@ def numbered_vector(nrows, symbol_prefix):
4643
R = zeros(4, 2)
4744
R[:3, :] = R3
4845

49-
# The following is specific to the SPM algorithm.
46+
# The following is specific to the SPM algorithm.
5047
x1 = ones(4, 1)
5148
y1 = ones(4, 1)
5249
y1[:3, :] = pos_pat_0

0 commit comments

Comments
 (0)