8000 added @timhoffm's suggestion about changing wrap to lambda and implic… · matplotlib/matplotlib@28662f7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 28662f7

Browse files
committed
added @timhoffm's suggestion about changing wrap to lambda and implicit concat on message
1 parent 14f0106 commit 28662f7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/matplotlib/ticker.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -396,18 +396,17 @@ def __init__(self, func):
396396
else:
397397
#finding argcount for other builtins is a mess
398398
nargs = 2
399-
raise warnings.warn(f"""{func.__name__} is not supported
400-
and may not work as expected""")
401-
if nargs == 2:
399+
raise warnings.warn(f"{func.__name__} is not supported "
400+
"and may not work as expected")
401+
402+
if nargs == 1:
403+
self.func = lambda x, pos: func(x)
404+
elif nargs == 2:
402405
self.func = func
403-
elif nargs == 1:
404-
def func_pos(x, pos):
405-
return func(x)
406-
self.func = func_pos
407406
else:
408-
raise TypeError(f"""Number of parameters in function: {nargs}.
409-
FuncFormatter functions take at most 2:
410-
x (required), pos (optional).""")
407+
raise TypeError(f"Number of parameters in function: {nargs}. "
408+
"FuncFormatter functions take at most 2: "
409+
"x (required), pos (optional).")
411410

412411
def __call__(self, x, pos=None):
413412
"""

0 commit comments

Comments
 (0)
0