Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8407ffc

Browse filesBrowse files
authored
Merge pull request #8261 from anntzer/name-validators-in-rcsetup
Set __name__ for list validators in rcsetup.
2 parents 296bc4f + b4ee5db commit 8407ffc
Copy full SHA for 8407ffc

File tree

Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed

‎lib/matplotlib/rcsetup.py

Copy file name to clipboardExpand all lines: lib/matplotlib/rcsetup.py
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ def f(s):
9595
return [scalar_validator(v) for v in s
9696
if not isinstance(v, six.string_types) or v]
9797
else:
98-
msg = "{0!r} must be of type: string or non-dictionary iterable.".format(s)
99-
raise ValueError(msg)
98+
raise ValueError("{!r} must be of type: string or non-dictionary "
99+
"iterable".format(s))
100+
# Cast `str` to keep Py2 happy despite `unicode_literals`.
101+
try:
102+
f.__name__ = str("{}list".format(scalar_validator.__name__))
103+
except AttributeError: # class instance.
104+
f.__name__ = str("{}List".format(type(scalar_validator).__name__))
100105
f.__doc__ = scalar_validator.__doc__
101106
return f
102107

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.