Skip to content

Commit aee4f6b

Browse files
authored
Merge pull request #49 from phausamann/develop
PEP8 compliance
2 parents 8b9bbae + 17c2fa4 commit aee4f6b

File tree

14 files changed

+140
-122
lines changed

14 files changed

+140
-122
lines changed

doc/conf.py

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@
1515
import sys
1616
import os
1717

18+
# pngmath / imgmath compatibility layer for different sphinx versions
19+
import sphinx
20+
import sklearn_xarray
21+
from distutils.version import LooseVersion
22+
1823
import sphinx_rtd_theme
1924

2025
# If extensions (or modules to document with autodoc) are in another directory,
2126
# add these directories to sys.path here. If the directory is relative to the
2227
# documentation root, use os.path.abspath to make it absolute, like shown here.
23-
#sys.path.insert(0, os.path.abspath('.'))
28+
# sys.path.insert(0, os.path.abspath('.'))
2429

2530
# -- General configuration ---------------------------------------------------
2631

@@ -32,7 +37,7 @@
3237
# -- General configuration ------------------------------------------------
3338

3439
# If your documentation needs a minimal Sphinx version, state it here.
35-
#needs_sphinx = '1.0'
40+
# needs_sphinx = '1.0'
3641

3742
sys.path.append(os.path.join(os.path.dirname(__name__), '..'))
3843

@@ -51,20 +56,16 @@
5156
'sphinx.ext.autosummary'
5257
]
5358

54-
# pngmath / imgmath compatibility layer for different sphinx versions
55-
import sphinx
56-
import sklearn_xarray
57-
from distutils.version import LooseVersion
5859
if LooseVersion(sphinx.__version__) < LooseVersion('1.4'):
5960
extensions.append('sphinx.ext.pngmath')
6061
else:
6162
extensions.append('sphinx.ext.imgmath')
6263

6364
sphinx_gallery_conf = {
6465
# path to your examples scripts
65-
'examples_dirs' : '../examples',
66+
'examples_dirs': '../examples',
6667
# path where to save gallery generated examples
67-
'gallery_dirs' : 'auto_examples'}
68+
'gallery_dirs': 'auto_examples'}
6869

6970
# Add any paths that contain templates here, relative to this directory.
7071
templates_path = ['_templates']
@@ -73,7 +74,7 @@
7374
source_suffix = '.rst'
7475

7576
# The encoding of source files.
76-
#source_encoding = 'utf-8-sig'
77+
# source_encoding = 'utf-8-sig'
7778

7879
# Generate the plots for the gallery
7980
plot_gallery = True
@@ -96,41 +97,41 @@
9697

9798
# The language for content autogenerated by Sphinx. Refer to documentation
9899
# for a list of supported languages.
99-
#language = None
100+
# language = None
100101

101102
# There are two options for replacing |today|: either, you set today to some
102103
# non-false value, then it is used:
103-
#today = ''
104+
# today = ''
104105
# Else, today_fmt is used as the format for a strftime call.
105-
#today_fmt = '%B %d, %Y'
106+
# today_fmt = '%B %d, %Y'
106107

107108
# List of patterns, relative to source directory, that match files and
108109
# directories to ignore when looking for source files.
109110
exclude_patterns = ['_build']
110111

111112
# The reST default role (used for this markup: `text`) to use for all
112113
# documents.
113-
#default_role = None
114+
# default_role = None
114115

115116
# If true, '()' will be appended to :func: etc. cross-reference text.
116-
#add_function_parentheses = True
117+
# add_function_parentheses = True
117118

118119
# If true, the current module name will be prepended to all description
119120
# unit titles (such as .. function::).
120121
add_module_names = False
121122

122123
# If true, sectionauthor and moduleauthor directives will be shown in the
123124
# output. They are ignored by default.
124-
#show_authors = False
125+
# show_authors = False
125126

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

129130
# A list of ignored prefixes for module index sorting.
130-
#modindex_common_prefix = []
131+
# modindex_common_prefix = []
131132

132133
# If true, keep warnings as "system message" paragraphs in the built documents.
133-
#keep_warnings = False
134+
# keep_warnings = False
134135

135136

136137
# -- Options for HTML output ----------------------------------------------
@@ -142,26 +143,26 @@
142143
# Theme options are theme-specific and customize the look and feel of a theme
143144
# further. For a list of options available for each theme, see the
144145
# documentation.
145-
#html_theme_options = {}
146+
# html_theme_options = {}
146147

147148
# Add any paths that contain custom themes here, relative to this directory.
148149
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
149150

150151
# The name for this set of Sphinx documents. If None, it defaults to
151152
# "<project> v<release> documentation".
152-
#html_title = None
153+
# html_title = None
153154

154155
# A shorter title for the navigation bar. Default is the same as html_title.
155-
#html_short_title = None
156+
# html_short_title = None
156157

157158
# The name of an image file (relative to this directory) to place at the top
158159
# of the sidebar.
159-
#html_logo = None
160+
# html_logo = None
160161

161162
# The name of an image file (within the static path) to use as favicon of the
162163
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
163164
# pixels large.
164-
#html_favicon = None
165+
# html_favicon = None
165166

166167
# Add any paths that contain custom static files (such as style sheets) here,
167168
# relative to this directory. They are copied after the builtin static files,
@@ -171,93 +172,92 @@
171172
# Add any extra paths that contain custom files (such as robots.txt or
172173
# .htaccess) here, relative to this directory. These files are copied
173174
# directly to the root of the documentation.
174-
#html_extra_path = []
175+
# html_extra_path = []
175176

176177
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
177178
# using the given strftime format.
178-
#html_last_updated_fmt = '%b %d, %Y'
179+
# html_last_updated_fmt = '%b %d, %Y'
179180

180181
# If true, SmartyPants will be used to convert quotes and dashes to
181182
# typographically correct entities.
182-
#html_use_smartypants = True
183+
# html_use_smartypants = True
183184

184185
# Custom sidebar templates, maps document names to template names.
185-
#html_sidebars = {}
186+
# html_sidebars = {}
186187

187188
# Additional templates that should be rendered to pages, maps page names to
188189
# template names.
189-
#html_additional_pages = {}
190+
# html_additional_pages = {}
190191

191192
# If false, no module index is generated.
192-
#html_domain_indices = True
193+
# html_domain_indices = True
193194

194195
# If false, no index is generated.
195-
#html_use_index = True
196+
# html_use_index = True
196197

197198
# If true, the index is split into individual pages for each letter.
198-
#html_split_index = False
199+
# html_split_index = False
199200

200201
# If true, links to the reST sources are added to the pages.
201-
#html_show_sourcelink = True
202+
# html_show_sourcelink = True
202203

203204
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
204-
#html_show_sphinx = True
205+
# html_show_sphinx = True
205206

206207
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
207-
#html_show_copyright = True
208+
# html_show_copyright = True
208209

209210
# If true, an OpenSearch description file will be output, and all pages will
210211
# contain a <link> tag referring to it. The value of this option must be the
211212
# base URL from which the finished HTML is served.
212-
#html_use_opensearch = ''
213+
# html_use_opensearch = ''
213214

214215
# This is the file name suffix for HTML files (e.g. ".xhtml").
215-
#html_file_suffix = None
216+
# html_file_suffix = None
216217

217218
# Output file base name for HTML help builder.
218219
htmlhelp_basename = 'sklearn-xarraydoc'
219220

220-
221221
# -- Options for LaTeX output ---------------------------------------------
222222

223223
latex_elements = {
224-
# The paper size ('letterpaper' or 'a4paper').
225-
#'papersize': 'letterpaper',
224+
# The paper size ('letterpaper' or 'a4paper').
225+
# 'papersize': 'letterpaper',
226226

227-
# The font size ('10pt', '11pt' or '12pt').
228-
#'pointsize': '10pt',
227+
# The font size ('10pt', '11pt' or '12pt').
228+
# 'pointsize': '10pt',
229229

230-
# Additional stuff for the LaTeX preamble.
231-
#'preamble': '',
230+
# Additional stuff for the LaTeX preamble.
231+
# 'preamble': '',
232232
}
233233

234234
# Grouping the document tree into LaTeX files. List of tuples
235235
# (source start file, target name, title,
236236
# author, documentclass [howto, manual, or own class]).
237237
latex_documents = [
238-
('index', 'sklearn-xarray.tex', u'sklearn-xarray Documentation',
239-
u'Peter Hausamann', 'manual'),
238+
('index', 'sklearn-xarray.tex', u'sklearn-xarray Documentation',
239+
u'Peter Hausamann', 'manual'),
240240
]
241241

242242
# The name of an image file (relative to this directory) to place at the top of
243243
# the title page.
244-
#latex_logo = None
244+
# latex_logo = None
245245

246246
# For "manual" documents, if this is true, then toplevel headings are parts,
247247
# not chapters.
248-
#latex_use_parts = False
248+
# latex_use_parts = False
249249

250250
# If true, show page references after internal links.
251-
#latex_show_pagerefs = False
251+
# latex_show_pagerefs = False
252252

253253
# If true, show URL addresses after external links.
254-
#latex_show_urls = False
254+
# latex_show_urls = False
255255

256256
# Documents to append as an appendix to all manuals.
257-
#latex_appendices = []
257+
# latex_appendices = []
258258

259259
# If false, no module index is generated.
260-
#latex_domain_indices = True
260+
# latex_domain_indices = True
261261

262262

263263
# -- Options for manual page output ---------------------------------------
@@ -270,7 +270,7 @@
270270
]
271271

272272
# If true, show URL addresses after external links.
273-
#man_show_urls = False
273+
# man_show_urls = False
274274

275275

276276
# -- Options for Texinfo output -------------------------------------------
@@ -279,11 +279,12 @@
279279
# (source start file, target name, title, author,
280280
# dir menu entry, description, category)
281281
texinfo_documents = [
282-
('index', 'sklearn-xarray', u'sklearn-xarray Documentation',
283-
u'Peter Hausamann', 'sklearn-xarray', 'Integrate xarray and sklearn.',
284-
'Miscellaneous'),
282+
('index', 'sklearn-xarray', u'sklearn-xarray Documentation',
283+
u'Peter Hausamann', 'sklearn-xarray', 'Integrate xarray and sklearn.',
284+
'Miscellaneous'),
285285
]
286286

287+
287288
def generate_example_rst(app, what, name, obj, options, lines):
288289
# generate empty examples files, so that we don't get
289290
# inclusion errors if there are no examples for a class / module
@@ -297,17 +298,18 @@ def generate_example_rst(app, what, name, obj, options, lines):
297298
def setup(app):
298299
app.connect('autodoc-process-docstring', generate_example_rst)
299300

301+
300302
# Documents to append as an appendix to all manuals.
301-
#texinfo_appendices = []
303+
# texinfo_appendices = []
302304

303305
# If false, no module index is generated.
304-
#texinfo_domain_indices = True
306+
# texinfo_domain_indices = True
305307

306308
# How to display URL addresses: 'footnote', 'no', or 'inline'.
307-
#texinfo_show_urls = 'footnote'
309+
# texinfo_show_urls = 'footnote'
308310

309311
# If true, do not generate a @detailmenu in the "Top" node's menu.
310-
#texinfo_no_detailmenu = False
312+
# texinfo_no_detailmenu = False
311313

312314

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

examples/plot_activity_recognition.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
1414
The example performs activity recognition from raw accelerometer data with a
1515
Gaussian naive Bayes classifier. It uses the
16-
`WISDM activity prediction dataset`_ which contains the activities
16+
`WISDM`_ activity prediction dataset which contains the activities
1717
walking, jogging, walking upstairs, walking downstairs, sitting and standing
1818
from 36 different subjects.
1919
20-
.. _WISDM activity prediction dataset: http://www.cis.fordham.edu/wisdm/dataset.php
20+
.. _WISDM: http://www.cis.fordham.edu/wisdm/dataset.php
2121
"""
2222

2323
from __future__ import print_function
@@ -72,7 +72,7 @@
7272
# The preprocessing consists of splitting the data into segments, removing
7373
# segments with `nan` values and standardizing. Since the accelerometer data is
7474
# three-dimensional but the standardizer and classifier expect a one-dimensional
75-
# feature vector, we have to vectorize the samples.
75+
# feature vector, we have to vectorize the samples.
7676
#
7777
# Finally, we use PCA and a naive Bayes classifier for classification.
7878

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ pandas>=0.20
44
cython>=0.25
55
numpy>=1.12
66
scipy>=1.0
7+
six

sklearn_xarray/common/wrappers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def __init__(self, estimator=None, reshapes=None, sample_dim=None,
121121
for p in params:
122122
setattr(self, p, params[p])
123123

124-
self._param_names = self._get_param_names() + \
125-
self.estimator._get_param_names()
124+
self._param_names = \
125+
self._get_param_names() + self.estimator._get_param_names()
126126

127127
self._decorate()
128128

@@ -361,8 +361,8 @@ def set_params(self, **params):
361361

362362

363363
class TransformerWrapper(
364-
EstimatorWrapper, _ImplementsTransformMixin,
365-
_ImplementsFitTransformMixin, _ImplementsInverseTransformMixin):
364+
EstimatorWrapper, _ImplementsTransformMixin,
365+
_ImplementsFitTransformMixin, _ImplementsInverseTransformMixin):
366366
""" A wrapper around sklearn transformers compatible with xarray objects.
367367
368368
Parameters
@@ -376,7 +376,7 @@ class TransformerWrapper(
376376

377377

378378
class RegressorWrapper(
379-
EstimatorWrapper, _ImplementsPredictMixin, _ImplementsScoreMixin):
379+
EstimatorWrapper, _ImplementsPredictMixin, _ImplementsScoreMixin):
380380
""" A wrapper around sklearn regressors compatible with xarray objects.
381381
382382
Parameters
@@ -391,7 +391,7 @@ class RegressorWrapper(
391391

392392

393393
class ClassifierWrapper(
394-
EstimatorWrapper, _ImplementsPredictMixin, _ImplementsScoreMixin):
394+
EstimatorWrapper, _ImplementsPredictMixin, _ImplementsScoreMixin):
395395
""" A wrapper around sklearn classifiers compatible with xarray objects.
396396
397397
Parameters

sklearn_xarray/datasets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def load_dummy_dataset():
1919
""" Load a Dataset for demonstration purposes. """
2020

2121
return xr.Dataset(
22-
{'var_1' : (['sample', 'feature'], np.random.random((100, 10)))},
22+
{'var_1': (['sample', 'feature'], np.random.random((100, 10)))},
2323
coords={'sample': range(100), 'feature': range(10)}
2424
)
2525

sklearn_xarray/externals/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
try:
44
import numpy_groupies
55
except ImportError:
6-
from . import _numpy_groupies_np as numpy_groupies
6+
from . import _numpy_groupies_np as numpy_groupies

0 commit comments

Comments
 (0)