Skip to content

Commit d96910b

Browse files
author
Jacob Roberts
committed
RF: Fix all remaining flake8 complaints
1 parent ad2cc68 commit d96910b

File tree

9 files changed

+54
-184
lines changed

9 files changed

+54
-184
lines changed

doc/source/conf.py

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@
1919
# All configuration values have a default; values that are commented out
2020
# serve to show the default.
2121

22-
import sys
2322
import os
2423
from runpy import run_path
2524
from configparser import ConfigParser
2625

2726
# Check for external Sphinx extensions we depend on
2827
try:
29-
import numpydoc
28+
import numpydoc # noqa: F401
3029
except ImportError:
3130
raise RuntimeError('Need to install "numpydoc" package for doc build')
3231
try:
33-
import texext
32+
import texext # noqa: F401
3433
except ImportError:
3534
raise RuntimeError('Need to install "texext" package for doc build')
3635

@@ -64,7 +63,6 @@
6463
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
6564
extensions = ['sphinx.ext.autodoc',
6665
'sphinx.ext.doctest',
67-
#'sphinx.ext.intersphinx',
6866
'sphinx.ext.todo',
6967
'sphinx.ext.mathjax',
7068
'sphinx.ext.inheritance_diagram',
@@ -76,7 +74,7 @@
7674

7775
# the following doesn't work with sphinx < 1.0, but will make a separate
7876
# sphinx-autogen run obsolete in the future
79-
#autosummary_generate = True
77+
# autosummary_generate = True
8078

8179
# Add any paths that contain templates here, relative to this directory.
8280
templates_path = ['_templates']
@@ -85,7 +83,7 @@
8583
source_suffix = '.rst'
8684

8785
# The encoding of source files.
88-
#source_encoding = 'utf-8'
86+
# source_encoding = 'utf-8'
8987

9088
# The master toctree document.
9189
master_doc = 'index'
@@ -105,11 +103,11 @@
105103

106104
# The language for content autogenerated by Sphinx. Refer to documentation
107105
# for a list of supported languages.
108-
#language = None
106+
# language = None
109107

110108
# There are two options for replacing |today|: either, you set today to some
111109
# non-false value, then it is used:
112-
#today = ''
110+
# today = ''
113111
# Else, today_fmt is used as the format for a strftime call.
114112
today_fmt = '%B %d, %Y, %H:%M PDT'
115113

@@ -124,24 +122,24 @@
124122
exclude_trees = ['_build']
125123

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

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

132130
# If true, the current module name will be prepended to all description
133131
# unit titles (such as .. function::).
134-
#add_module_names = True
132+
# add_module_names = True
135133

136134
# If true, sectionauthor and moduleauthor directives will be shown in the
137135
# output. They are ignored by default.
138-
#show_authors = False
136+
# show_authors = False
139137

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

143141
# A list of ignored prefixes for module index sorting.
144-
#modindex_common_prefix = []
142+
# modindex_common_prefix = []
145143

146144
# -- Sphinxext configuration --------------------------------------------------
147145

@@ -168,26 +166,26 @@
168166
# Theme options are theme-specific and customize the look and feel of a theme
169167
# further. For a list of options available for each theme, see the
170168
# documentation.
171-
#html_theme_options = {}
169+
# html_theme_options = {}
172170

173171
# Add any paths that contain custom themes here, relative to this directory.
174-
#html_theme_path = []
172+
# html_theme_path = []
175173

176174
# The name for this set of Sphinx documents. If None, it defaults to
177175
# "<project> v<release> documentation".
178-
#html_title = ''
176+
# html_title = ''
179177

180178
# A shorter title for the navigation bar. Default is the same as html_title.
181-
#html_short_title = None
179+
# html_short_title = None
182180

183181
# The name of an image file (relative to this directory) to place at the top
184182
# of the sidebar.
185-
#html_logo = None
183+
# html_logo = None
186184

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

192190
# Add any paths that contain custom static files (such as style sheets) here,
193191
# relative to this directory. They are copied after the builtin static files,
@@ -196,42 +194,42 @@
196194

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

201199
# Content template for the index page.
202200
html_index = 'index.html'
203201

204202
# If true, SmartyPants will be used to convert quotes and dashes to
205203
# typographically correct entities.
206-
#html_use_smartypants = True
204+
# html_use_smartypants = True
207205

208206
# Custom sidebar templates, maps document names to template names.
209207
html_sidebars = {'index': ['localtoc.html', 'relations.html', 'sourcelink.html',
210208
'indexsidebar.html', 'searchbox.html', 'reggie.html']}
211209

212210
# Additional templates that should be rendered to pages, maps page names to
213211
# template names.
214-
#html_additional_pages = {'index': 'index.html'}
212+
# html_additional_pages = {'index': 'index.html'}
215213

216214
# If false, no module index is generated.
217-
#html_use_modindex = True
215+
# html_use_modindex = True
218216

219217
# If false, no index is generated.
220-
#html_use_index = True
218+
# html_use_index = True
221219

222220
# If true, the index is split into individual pages for each letter.
223-
#html_split_index = False
221+
# html_split_index = False
224222

225223
# If true, links to the reST sources are added to the pages.
226224
html_show_sourcelink = True
227225

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

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

236234
# Output file base name for HTML help builder.
237235
htmlhelp_basename = 'nibabeldoc'
@@ -241,34 +239,34 @@
241239
# -- Options for LaTeX output -------------------------------------------------
242240

243241
# The paper size ('letter' or 'a4').
244-
#latex_paper_size = 'letter'
242+
# latex_paper_size = 'letter'
245243

246244
# The font size ('10pt', '11pt' or '12pt').
247-
#latex_font_size = '10pt'
245+
# latex_font_size = '10pt'
248246

249247
# Grouping the document tree into LaTeX files. List of tuples
250248
# (source start file, target name, title, author,
251-
# documentclass [howto/manual]).
249+
# documentclass [howto/manual]).
252250
latex_documents = [
253251
('index', 'nibabel.tex', u'NiBabel Documentation', u'NiBabel Authors',
254252
'manual')]
255253

256254
# The name of an image file (relative to this directory) to place at the top of
257255
# the title page.
258-
#latex_logo = None
256+
# latex_logo = None
259257

260258
# For "manual" documents, if this is true, then toplevel headings are parts,
261259
# not chapters.
262-
#latex_use_parts = False
260+
# latex_use_parts = False
263261

264262
# Additional stuff for the LaTeX preamble.
265-
#latex_preamble = ''
263+
# latex_preamble = ''
266264

267265
# Documents to append as an appendix to all manuals.
268-
#latex_appendices = []
266+
# latex_appendices = []
269267

270268
# If false, no module index is generated.
271-
#latex_use_modindex = True
269+
# latex_use_modindex = True
272270

273271

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

doc/tools/apigen.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ def discover_modules(self):
407407

408408
def write_modules_api(self, modules, outdir):
409409
# upper-level modules
410-
main_module = modules[0].split('.')[0]
411410
ulms = ['.'.join(m.split('.')[:2]) if m.count('.') >= 1
412411
else m.split('.')[0] for m in modules]
413412

nisext/py3builder.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
except ImportError:
77
# 2.x - no parsing of code
88
from distutils.command.build_py import build_py
9-
else: # Python 3
9+
else: # Python 3
1010
# Command to also apply 2to3 to doctests
1111
from distutils import log
12+
1213
class build_py(build_py_2to3):
1314
def run_2to3(self, files):
1415
# Add doctest parsing; this stuff copied from distutils.utils in
1516
# python 3.2 source
1617
if not files:
1718
return
18-
fixer_names, options, explicit = (self.fixer_names,
19-
self.options,
20-
self.explicit)
19+
fixer_names, options, _ = (self.fixer_names,
20+
self.options,
21+
self.explicit)
2122
# Make this class local, to delay import of 2to3
2223
from lib2to3.refactor import RefactoringTool, get_fixers_from_package
24+
2325
class DistutilsRefactoringTool(RefactoringTool):
2426
def log_error(self, msg, *args, **kw):
2527
log.error(msg, *args)

nisext/sexts.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def package_check(pkg_name, version=None,
131131
dependencies. If dict fill key values ``install_requires`` and
132132
``extras_require`` for non-optional and optional dependencies.
133133
"""
134-
setuptools_mode = not setuptools_args is None
134+
setuptools_mode = setuptools_args is not None
135135
optional_tf = bool(optional)
136136
if version_getter is None:
137137
def version_getter(pkg_name):
@@ -169,7 +169,7 @@ def version_getter(pkg_name):
169169
log.warn(msgs['version too old'] % (have_version,
170170
pkg_name,
171171
version)
172-
+ msgs['opt suffix'])
172+
+ msgs['opt suffix'])
173173
return
174174
# setuptools mode
175175
if optional_tf and not isinstance(optional, str):
@@ -178,7 +178,7 @@ def version_getter(pkg_name):
178178
if version:
179179
dependency += '>=' + version
180180
if optional_tf:
181-
if not 'extras_require' in setuptools_args:
181+
if 'extras_require' not in setuptools_args:
182182
setuptools_args['extras_require'] = {}
183183
_add_append_key(setuptools_args['extras_require'],
184184
optional,
@@ -205,7 +205,7 @@ def _package_status(pkg_name, version, version_getter, checker):
205205

206206

207207
BAT_TEMPLATE = \
208-
r"""@echo off
208+
r"""@echo off # noqa: E122
209209
REM wrapper to use shebang first line of {FNAME}
210210
set mypath=%~dp0
211211
set pyscript="%mypath%{FNAME}"
@@ -218,6 +218,7 @@ def _package_status(pkg_name, version, version_getter, checker):
218218
call "%py_exe%" %pyscript% %*
219219
"""
220220

221+
221222
class install_scripts_bat(install_scripts):
222223
""" Make scripts executable on Windows
223224
@@ -247,7 +248,7 @@ def run(self):
247248
if not (first_line.startswith('#!') and
248249
'python' in first_line.lower()):
249250
log.info("No #!python executable found, skipping .bat "
250-
"wrapper")
251+
"wrapper")
251252
continue
252253
pth, fname = psplit(filepath)
253254
froot, ext = splitext(fname)

setup.cfg

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ exclude =
102102
*sphinx*
103103
nibabel/externals/*
104104
*/__init__.py
105-
# temporary -- should be removed in another PR
106-
./doc/source/conf.py
107-
./doc/tools/apigen.py
108-
./nisext
109-
./tools
110105

111106
[versioneer]
112107
VCS = git

0 commit comments

Comments
 (0)