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

Skip to content

Commit 3154b90

Browse files
committed
Resolved build errors
1 parent 3a71055 commit 3154b90

3 files changed

Lines changed: 38 additions & 39 deletions

File tree

examples/lines_bars_and_markers/markevery_prop_cycle.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
Renders a plot with shifted-sine curves along each column with
1212
a unique markevery value for each sine curve.
1313
"""
14-
from __future__ import division
1514
from cycler import cycler
1615
import numpy as np
1716
import matplotlib as mpl
1817
import matplotlib.pyplot as plt
19-
import matplotlib.patches as mpatches
2018

2119
# Define a list of markevery cases and color cases to plot
2220
cases = [None,

lib/matplotlib/rcsetup.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -552,28 +552,28 @@ def validate_markevery(s):
552552
# Validate s against type slice
553553
if isinstance(s, slice):
554554
return s
555-
# Validate s against type tuple and list
556-
if isinstance(s, Iterable):
557-
if isinstance(s, tuple):
558-
tupMaxLength = 2
559-
tupType = type(s[0])
560-
if len(s) != tupMaxLength:
561-
raise ValueError("'markevery' tuple must have a length "
562-
"of %d" % (tupMaxLength))
563-
if tupType is int and not all(isinstance(e, int) for e in s):
564-
raise ValueError("'markevery' tuple with first element of "
565-
"type int must have all elements of type "
566-
"int")
567-
if tupType is float and not all(isinstance(e, float) for e in s):
568-
raise ValueError("'markevery' tuple with first element of "
569-
"type float must have all elements of type "
570-
"float")
571-
if tupType is not float and tupType is not int:
572-
raise TypeError("'markevery' tuple is of an invalid type")
573-
if isinstance(s, list):
574-
if not all(isinstance(e, int) for e in s):
575-
raise ValueError("'markevery' list must have all elements "
576-
"of type int")
555+
# Validate s against type tuple
556+
if isinstance(s, tuple):
557+
tupMaxLength = 2
558+
tupType = type(s[0])
559+
if len(s) != tupMaxLength:
560+
raise TypeError("'markevery' tuple must have a length of "
561+
"%d" % (tupMaxLength))
562+
if tupType is int and not all(isinstance(e, int) for e in s):
563+
raise TypeError("'markevery' tuple with first element of "
564+
"type int must have all elements of type "
565+
"int")
566+
if tupType is float and not all(isinstance(e, float) for e in s):
567+
raise TypeError("'markevery' tuple with first element of "
568+
"type float must have all elements of type "
569+
"float")
570+
if tupType is not float and tupType is not int:
571+
raise TypeError("'markevery' tuple contains an invalid type")
572+
# Validate s against type list
573+
elif isinstance(s, list):
574+
if not all(isinstance(e, int) for e in s):
575+
raise TypeError("'markevery' list must have all elements of "
576+
"type int")
577577
# Validate s against type float int and None
578578
elif not isinstance(s, (float, int)):
579579
if s is not None:

lib/matplotlib/tests/test_rcparams.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -338,22 +338,23 @@ def generate_validator_testcases(valid):
338338
(slice(2), slice(None, 2, None)),
339339
(slice(1, 2, 3), slice(1, 2, 3))
340340
),
341-
'fail': (((1, 2, 3), ValueError),
342-
([1, 2, 0.3], ValueError),
343-
(['a', 2, 3], ValueError),
344-
([1, 2, 'a'], ValueError),
345-
((0.1, 0.2, 0.3), ValueError),
346-
((0.1, 2, 3), ValueError),
347-
((1, 0.2, 0.3), ValueError),
348-
((1, 0.1), ValueError),
349-
((0.1, 1), ValueError),
350-
(('abc'), ValueError),
351-
((1, 'a'), ValueError),
352-
((0.1, 'b'), ValueError),
353-
(('a', 1), ValueError),
354-
(('a', 0.1), ValueError),
341+
'fail': (((1, 2, 3), TypeError),
342+
([1, 2, 0.3], TypeError),
343+
(['a', 2, 3], TypeError),
344+
([1, 2, 'a'], TypeError),
345+
((0.1, 0.2, 0.3), TypeError),
346+
((0.1, 2, 3), TypeError),
347+
((1, 0.2, 0.3), TypeError),
348+
((1, 0.1), TypeError),
349+
((0.1, 1), TypeError),
350+
(('abc'), TypeError),
351+
((1, 'a'), TypeError),
352+
((0.1, 'b'), TypeError),
353+
(('a', 1), TypeError),
354+
(('a', 0.1), TypeError),
355355
('abc', TypeError),
356-
('a', TypeError)
356+
('a', TypeError),
357+
(object(), TypeError)
357358
)
358359
}
359360
)

0 commit comments

Comments
 (0)