Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b0c808d

Browse files
authored
Merge pull request #14205 from anntzer/e731
Obey flake8 "don't assign a lambda, use a def".
2 parents 4bef510 + 1be9535 commit b0c808d

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

.flake8

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ per-file-ignores =
4141
lib/matplotlib/backends/backend_agg.py: E302
4242
lib/matplotlib/backends/backend_cairo.py: E203, E221, E402
4343
lib/matplotlib/backends/backend_gtk3.py: E203, E221, E225, E251, E501
44-
lib/matplotlib/backends/backend_pgf.py: E731
4544
lib/matplotlib/backends/qt_editor/_formlayout.py: E501
4645
lib/matplotlib/font_manager.py: E203, E221, E251, E501
4746
lib/matplotlib/fontconfig_pattern.py: E201, E203, E221, E222, E225
@@ -52,7 +51,6 @@ per-file-ignores =
5251
lib/matplotlib/tests/test_mathtext.py: E501
5352
lib/matplotlib/transforms.py: E201, E202, E203, E501
5453
lib/matplotlib/tri/triinterpolate.py: E201, E221
55-
lib/matplotlib/type1font.py: E731
5654

5755
lib/mpl_toolkits/axes_grid1/axes_divider.py: E402, E501
5856
lib/mpl_toolkits/axes_grid1/axes_size.py: E272

lib/matplotlib/backends/backend_pgf.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,15 @@ def get_preamble():
7777
NO_ESCAPE = r"(?<!\\)(?:\\\\)*"
7878
re_mathsep = re.compile(NO_ESCAPE + r"\$")
7979
re_escapetext = re.compile(NO_ESCAPE + "([_^$%])")
80-
repl_escapetext = lambda m: "\\" + m.group(1)
8180
re_mathdefault = re.compile(NO_ESCAPE + r"(\\mathdefault)")
82-
repl_mathdefault = lambda m: m.group(0)[:-len(m.group(1))]
81+
82+
83+
def repl_escapetext(m):
84+
return "\\" + m.group(1)
85+
86+
87+
def repl_mathdefault(m):
88+
return m.group(0)[:-len(m.group(1))]
8389

8490

8591
def common_texification(text):
@@ -398,10 +404,9 @@ def __init__(self, figure, fh, dummy=False):
398404

399405
if dummy:
400406
# dummy==True deactivate all methods
401-
nop = lambda *args, **kwargs: None
402407
for m in RendererPgf.__dict__:
403408
if m.startswith("draw_"):
404-
self.__dict__[m] = nop
409+
self.__dict__[m] = lambda *args, **kwargs: None
405410
else:
406411
# if fh does not belong to a filename, deactivate draw_image
407412
if not hasattr(fh, 'name') or not os.path.exists(fh.name):

lib/matplotlib/type1font.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def _parse(self):
202202
# The spec calls this an ASCII format; in Python 2.x we could
203203
# just treat the strings and names as opaque bytes but let's
204204
# turn them into proper Unicode, and be lenient in case of high bytes.
205-
convert = lambda x: x.decode('ascii', 'replace')
205+
def convert(x): return x.decode('ascii', 'replace')
206206
for token, value in filtered:
207207
if token is _TokenType.name and value.startswith(b'/'):
208208
key = convert(value[1:])

0 commit comments

Comments
 (0)