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

Skip to content

Commit 99d07bc

Browse files
Recursively eval cycler kwargs
1 parent bb6eb29 commit 99d07bc

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
@@ -851,7 +851,7 @@ def _eval_cycler_expr(node):
851851
"only the 'cycler()' and 'concat()' functions are allowed")
852852
func = cycler if node.func.id == 'cycler' else cconcat
853853
args = [_eval_cycler_expr(a) for a in node.args]
854-
kwargs = {kw.arg: ast.literal_eval(kw.value) for kw in node.keywords}
854+
kwargs = {kw.arg: _eval_cycler_expr(kw.value) for kw in node.keywords}
855855
return func(*args, **kwargs)
856856
if isinstance(node, ast.Subscript):
857857
sl = node.slice

lib/matplotlib/tests/test_rcparams.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ def generate_validator_testcases(valid):
277277
cycler('markeredgewidth', [2, 5])),
278278
("2 * cycler('color', 'rgb')", 2 * cycler('color', 'rgb')),
279279
("2 * cycler('color', 'r' + 'gb')", 2 * cycler('color', 'rgb')),
280+
("cycler(c='r' + 'gb', lw=[1, 2, 3])",
281+
cycler('color', 'rgb') + cycler('linewidth', [1, 2, 3])),
280282
("cycler('color', 'rgb') * 2", cycler('color', 'rgb') * 2),
281283
("concat(cycler('color', 'rgb'), cycler('color', 'cmk'))",
282284
cycler('color', list('rgbcmk'))),

0 commit comments

Comments
 (0)