@@ -295,7 +295,8 @@ def validate_maskedarray(v):
295
295
296
296
class validate_nseq_float (object ):
297
297
def __init__ (self , n = None , allow_none = False ):
298
- self .n , self .allow_none = n , allow_none
298
+ self .n = n
299
+ self .allow_none = allow_none
299
300
300
301
def __call__ (self , s ):
301
302
"""return a seq of n floats or raise"""
@@ -310,8 +311,7 @@ def __call__(self, s):
310
311
311
312
try :
312
313
return [float (val )
313
- if self .allow_none and val is not None
314
- or not self .allow_none
314
+ if not self .allow_none or val is not None
315
315
else val
316
316
for val in s ]
317
317
except ValueError :
@@ -933,6 +933,7 @@ def _validate_linestyle(ls):
933
933
raise ValueError ("linestyle must be a string or " +
934
934
"an even-length sequence of floats." )
935
935
936
+
936
937
# a map from key -> value, converter
937
938
defaultParams = {
938
939
'backend' : ['Agg' , validate_backend ], # agg is certainly
@@ -966,10 +967,10 @@ def _validate_linestyle(ls):
966
967
'lines.solid_joinstyle' : ['round' , validate_joinstyle ],
967
968
'lines.dash_capstyle' : ['butt' , validate_capstyle ],
968
969
'lines.solid_capstyle' : ['projecting' , validate_capstyle ],
969
- 'lines.dashed_pattern' : [[3.7 , 1.6 ], validate_nseq_float ()],
970
+ 'lines.dashed_pattern' : [[3.7 , 1.6 ], validate_nseq_float (allow_none = True )],
970
971
'lines.dashdot_pattern' : [[6.4 , 1.6 , 1 , 1.6 ],
971
- validate_nseq_float ()],
972
- 'lines.dotted_pattern' : [[1 , 1.65 ], validate_nseq_float ()],
972
+ validate_nseq_float (allow_none = True )],
973
+ 'lines.dotted_pattern' : [[1 , 1.65 ], validate_nseq_float (allow_none = True )],
973
974
'lines.scale_dashes' : [True , validate_bool ],
974
975
975
976
# marker props
0 commit comments