8000 PEP8 : convert lambdas to functions · matplotlib/matplotlib@74b4313 · GitHub
[go: up one dir, main page]

Skip to content

Commit 74b4313

Browse files
committed
PEP8 : convert lambdas to functions
1 parent 80712dc commit 74b4313

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

lib/matplotlib/axes/_subplots.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@ def __init__(self, fig, *args, **kwargs):
7373
self._axes_class.__init__(self, fig, self.figbox, **kwargs)
7474

7575
def __reduce__(self):
76-
# get the first axes class which does not inherit from a subplotbase
77-
not_subplotbase = lambda c: issubclass(c, Axes) and \
78-
not issubclass(c, SubplotBase)
79-
axes_class = [c for c in self.__class__.mro() if not_subplotbase(c)][0]
76+
# get the first axes class which does not
77+
# inherit from a subplotbase
78+
79+
def not_subplotbase(c):
80+
return issubclass(c, Axes) and not issubclass(c, SubplotBase)
81+
82+
axes_class = [c for c in self.__class__.mro()
83+
if not_subplotbase(c)][0]
8084
r = [_PicklableSubplotClassConstructor(),
8185
(axes_class,),
8286
self.__getstate__()]

lib/matplotlib/testing/compare.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ def convert(old, new):
123123
def _update_converter():
124124
gs, gs_v = matplotlib.checkdep_ghostscript()
125125
if gs_v is not None:
126-
cmd = lambda old, new: \
127-
[gs, '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
126+
def cmd(old, new):
127+
return [gs, '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
128128
'-sOutputFile=' + new, old]
129129
converter['pdf'] = make_external_conversion_command(cmd)
130130
converter['eps'] = make_external_conversion_command(cmd)
131131

132132
if matplotlib.checkdep_inkscape() is not None:
133-
cmd = lambda old, new: \
134-
['inkscape', '-z', old, '--export-png', new]
133+
def cmd(old, new):
134+
return ['inkscape', '-z', old, '--export-png', new]
135135
converter['svg'] = make_external_conversion_command(cmd)
136136

137137

0 commit comments

Comments
 (0)
0