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

Skip to content

Commit 69a631b

Browse files
scottshambaughksunden
authored andcommitted
Recursively eval cycler kwargs
1 parent 874497f commit 69a631b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ def _eval_cycler_expr(node):
795795
"only the 'cycler()' and 'concat()' functions are allowed")
796796
func = cycler if node.func.id == 'cycler' else cconcat
797797
args = [_eval_cycler_expr(a) for a in node.args]
798-
kwargs = {kw.arg: ast.literal_eval(kw.value) for kw in node.keywords}
798+
kwargs = {kw.arg: _eval_cycler_expr(kw.value) for kw in node.keywords}
799799
return func(*args, **kwargs)
800800
if isinstance(node, ast.Subscript):
801801
sl = node.slice

lib/matplotlib/tests/test_rcparams.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ def generate_validator_testcases(valid):
274274
cycler('markeredgewidth', [2, 5])),
275275
("2 * cycler('color', 'rgb')", 2 * cycler('color', 'rgb')),
276276
("2 * cycler('color', 'r' + 'gb')", 2 * cycler('color', 'rgb')),
277+
("cycler(c='r' + 'gb', lw=[1, 2, 3])",
278+
cycler('color', 'rgb') + cycler('linewidth', [1, 2, 3])),
277279
("cycler('color', 'rgb') * 2", cycler('color', 'rgb') * 2),
278280
("concat(cycler('color', 'rgb'), cycler('color', 'cmk'))",
279281
cycler('color', list('rgbcmk'))),

0 commit comments

Comments
 (0)