Skip to content

Commit 8aed22d

Browse files
committed
Fix PEP8 coding style violations
`pep8 *.py --ignore=E501` gives no output anymore. TODO: Fix long lines As part of http://24pullrequests.com
1 parent ceb595c commit 8aed22d

File tree

5 files changed

+40
-41
lines changed

5 files changed

+40
-41
lines changed

boilerplate.py

+28-29
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
# appended
3737
PYPLOT_MAGIC_HEADER = '################# REMAINING CONTENT GENERATED BY boilerplate.py ##############\n'
3838

39-
PYPLOT_PATH = os.path.join(os.path.dirname(__file__), 'lib',
40-
'matplotlib', 'pyplot.py')
39+
PYPLOT_PATH = os.path.join(os.path.dirname(__file__), 'lib', 'matplotlib',
40+
'pyplot.py')
4141

4242

4343
AUTOGEN_MSG = """
@@ -150,7 +150,7 @@ def boilerplate_gen():
150150
'vlines',
151151
'xcorr',
152152
'barbs',
153-
)
153+
)
154154

155155
_misccommands = (
156156
'cla',
@@ -164,25 +164,24 @@ def boilerplate_gen():
164164
'tick_params',
165165
'margins',
166166
'autoscale',
167-
)
167+
)
168168

169169
cmappable = {
170-
'contour' : 'if %(ret)s._A is not None: sci(%(ret)s)',
170+
'contour': 'if %(ret)s._A is not None: sci(%(ret)s)',
171171
'contourf': 'if %(ret)s._A is not None: sci(%(ret)s)',
172-
'hexbin' : 'sci(%(ret)s)',
173-
'scatter' : 'sci(%(ret)s)',
174-
'pcolor' : 'sci(%(ret)s)',
172+
'hexbin': 'sci(%(ret)s)',
173+
'scatter': 'sci(%(ret)s)',
174+
'pcolor': 'sci(%(ret)s)',
175175
'pcolormesh': 'sci(%(ret)s)',
176-
'hist2d' : 'sci(%(ret)s[-1])',
177-
'imshow' : 'sci(%(ret)s)',
176+
'hist2d': 'sci(%(ret)s[-1])',
177+
'imshow': 'sci(%(ret)s)',
178178
#'spy' : 'sci(%(ret)s)', ### may return image or Line2D
179-
'quiver' : 'sci(%(ret)s)',
180-
'specgram' : 'sci(%(ret)s[-1])',
181-
'streamplot' : 'sci(%(ret)s.lines)',
182-
'tricontour' : 'if %(ret)s._A is not None: sci(%(ret)s)',
179+
'quiver': 'sci(%(ret)s)',
180+
'specgram': 'sci(%(ret)s[-1])',
181+
'streamplot': 'sci(%(ret)s.lines)',
182+
'tricontour': 'if %(ret)s._A is not None: sci(%(ret)s)',
183183
'tricontourf': 'if %(ret)s._A is not None: sci(%(ret)s)',
184-
'tripcolor' : 'sci(%(ret)s)',
185-
184+
'tripcolor': 'sci(%(ret)s)',
186185
}
187186

188187
def format_value(value):
@@ -196,9 +195,9 @@ def format_value(value):
196195
return '=mlab.' + value.__name__
197196
if value.__name__ == 'mean':
198197
return '=np.' + value.__name__
199-
raise ValueError(('default value %s unknown to boilerplate.' + \
198+
raise ValueError(('default value %s unknown to boilerplate.' +
200199
'formatvalue') % value)
201-
return '='+repr(value)
200+
return '=' + repr(value)
202201

203202
text_wrapper = textwrap.TextWrapper(break_long_words=False)
204203

@@ -214,7 +213,7 @@ def format_value(value):
214213

215214
# Get argspec of wrapped function
216215
args, varargs, varkw, defaults = inspect.getargspec(getattr(Axes, func))
217-
args.pop(0) # remove 'self' argument
216+
args.pop(0) # remove 'self' argument
218217
if defaults is None:
219218
defaults = ()
220219
else:
@@ -234,9 +233,9 @@ def format_value(value):
234233
call.append('%s=%s' % (arg, arg))
235234

236235
if varargs is not None:
237-
call.append('*'+varargs)
236+
call.append('*' + varargs)
238237
if varkw is not None:
239-
call.append('**'+varkw)
238+
call.append('**' + varkw)
240239
call = ', '.join(call)
241240

242241
text_wrapper.width = 80 - 19 - len(func)
@@ -257,7 +256,7 @@ def format_value(value):
257256
# Now we can build the argspec for defining the wrapper
258257
argspec = inspect.formatargspec(args, varargs, varkw, defaults,
259258
formatvalue=format_value)
260-
argspec = argspec[1:-1] # remove parens
259+
argspec = argspec[1:-1] # remove parens
261260

262261
text_wrapper.width = 80 - 5 - len(func)
263262
join_with = '\n' + ' ' * (5 + len(func))
@@ -268,9 +267,9 @@ def format_value(value):
268267
washold, ret, ax = 'washold', 'ret', 'ax'
269268
bad = set(args) | set((varargs, varkw))
270269
while washold in bad or ret in bad or ax in bad:
271-
washold = 'washold' + str(random.randrange(10**12))
272-
ret = 'ret' + str(random.randrange(10**12))
273-
ax = 'ax' + str(random.randrange(10**12))
270+
washold = 'washold' + str(random.randrange(10 ** 12))
271+
ret = 'ret' + str(random.randrange(10 ** 12))
272+
ax = 'ax' + str(random.randrange(10 ** 12))
274273

275274
# Since we can't avoid using some function names,
276275
# bail out if they are used as argument names
@@ -287,10 +286,10 @@ def format_value(value):
287286
'cool',
288287
'copper',
289288
'flag',
290-
'gray' ,
289+
'gray',
291290
'hot',
292291
'hsv',
293-
'jet' ,
292+
'jet',
294293
'pink',
295294
'prism',
296295
'spring',
@@ -305,15 +304,15 @@ def format_value(value):
305304
yield ''
306305
yield '_setup_pyplot_info_docstrings()'
307306

307+
308308
def build_pyplot():
309309
pyplot_path = os.path.join(os.path.dirname(__file__), 'lib',
310310
'matplotlib', 'pyplot.py')
311311

312312
pyplot_orig = open(pyplot_path, 'r').readlines()
313313

314-
315314
try:
316-
pyplot_orig = pyplot_orig[:pyplot_orig.index(PYPLOT_MAGIC_HEADER)+1]
315+
pyplot_orig = pyplot_orig[:pyplot_orig.index(PYPLOT_MAGIC_HEADER) + 1]
317316
except IndexError:
318317
raise ValueError('The pyplot.py file *must* have the exact line: %s' % PYPLOT_MAGIC_HEADER)
319318

distribute_setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ def _build_install_args(options):
531531
install_args.append('--user')
532532
return install_args
533533

534+
534535
def _parse_args():
535536
"""
536537
Parse the command line for options
@@ -547,6 +548,7 @@ def _parse_args():
547548
# positional arguments are ignored
548549
return options
549550

551+
550552
def main(version=DEFAULT_VERSION):
551553
"""Install or upgrade setuptools and EasyInstall"""
552554
options = _parse_args()

license.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import sys, datetime
1+
import sys
2+
import datetime
23

34
if len(sys.argv) != 3:
45
print >>sys.stderr, 'Usage: license.py version_num filename'
@@ -60,4 +61,3 @@
6061

6162

6263
file(sys.argv[2], 'w').write(s)
63-

setup.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@
136136
setup_requires = []
137137
default_backend = None
138138

139-
140139
# Go through all of the packages and figure out which ones we are
141140
# going to build/install.
142141
print_line()
@@ -169,7 +168,6 @@
169168
default_backend = package.name
170169
print_raw('')
171170

172-
173171
# Abort if any of the required packages can not be built.
174172
if required_failed:
175173
print_line()
@@ -179,7 +177,6 @@
179177
', '.join(x.name for x in required_failed))
180178
sys.exit(1)
181179

182-
183180
# Now collect all of the information we need to build all of the
184181
# packages.
185182
for package in good_packages:
@@ -208,7 +205,6 @@
208205
with open('lib/matplotlib/mpl-data/matplotlibrc', 'w') as fd:
209206
fd.write(template % {'backend': default_backend})
210207

211-
212208
# Build in verbose mode if requested
213209
if setupext.options['verbose']:
214210
for mod in ext_modules:
@@ -245,7 +241,7 @@
245241
""",
246242
license="BSD",
247243
packages=packages,
248-
namespace_packages = namespace_packages,
244+
namespace_packages=namespace_packages,
249245
platforms='any',
250246
py_modules=py_modules,
251247
ext_modules=ext_modules,

setupext.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ def print_line(*args, **kwargs):
201201

202202
# Remove the -Wstrict-prototypesoption, is it's not valid for C++
203203
customize_compiler = sysconfig.customize_compiler
204+
205+
204206
def my_customize_compiler(compiler):
205207
retval = customize_compiler(compiler)
206208
try:
@@ -373,7 +375,6 @@ def get_namespace_packages(self):
373375
"""
374376
return []
375377

376-
377378
def get_py_modules(self):
378379
"""
379380
Get a list of top-level modules to add to the configuration.
@@ -645,7 +646,6 @@ def check(self):
645646
'suite. pip/easy_install may attempt to install it '
646647
'after matplotlib.')
647648

648-
649649
bad_nose = msg_template.format(
650650
package='nose %s or later' % self.nose_min_version
651651
)
@@ -658,7 +658,6 @@ def check(self):
658658
except ImportError:
659659
msgs += [bad_nose]
660660

661-
662661
if sys.version_info >= (3, 3):
663662
msgs += ['using unittest.mock']
664663
else:
@@ -695,6 +694,7 @@ def get_install_requires(self):
695694
requires += ['mock']
696695
return requires
697696

697+
698698
class Toolkits_Tests(Tests):
699699
name = "toolkits_tests"
700700

@@ -929,7 +929,6 @@ def add_flags(self, ext):
929929
default_libraries=['freetype', 'z'])
930930

931931

932-
933932
class FT2Font(SetupPackage):
934933
name = 'ft2font'
935934

@@ -1971,6 +1970,7 @@ def backend_pyside_internal_check(self):
19711970
return ("Qt: %s, PySide: %s" %
19721971
(QtCore.__version__, __version__))
19731972

1973+
19741974
def backend_pyqt4_internal_check(self):
19751975
try:
19761976
from PyQt4 import QtCore
@@ -1986,6 +1986,7 @@ def backend_pyqt4_internal_check(self):
19861986
BackendAgg.force = True
19871987
return ("Qt: %s, PyQt: %s" % (self.convert_qt_version(qt_version), pyqt_version_str))
19881988

1989+
19891990
def backend_qt4_internal_check(self):
19901991
successes = []
19911992
failures = []
@@ -2001,7 +2002,8 @@ def backend_qt4_internal_check(self):
20012002

20022003
if len(successes) == 0:
20032004
raise CheckFailed('; '.join(failures))
2004-
return '; '.join(successes+failures)
2005+
return '; '.join(successes + failures)
2006+
20052007

20062008
class BackendQt4(BackendQtBase):
20072009
name = "qt4agg"

0 commit comments

Comments
 (0)