@@ -1660,15 +1660,17 @@ class AngleValidator(BaseValidator):
16601660 "description": "A number (in degree) between -180 and 180.",
16611661 "requiredOpts": [],
16621662 "otherOpts": [
1663- "dflt"
1663+ "dflt",
1664+ "arrayOk"
16641665 ]
16651666 },
16661667 """
16671668
1668- def __init__ (self , plotly_name , parent_name , ** kwargs ):
1669+ def __init__ (self , plotly_name , parent_name , array_ok = False , ** kwargs ):
16691670 super (AngleValidator , self ).__init__ (
16701671 plotly_name = plotly_name , parent_name = parent_name , ** kwargs
16711672 )
1673+ self .array_ok = array_ok
16721674
16731675 def description (self ):
16741676 desc = """\
@@ -1686,6 +1688,20 @@ def validate_coerce(self, v):
16861688 if v is None :
16871689 # Pass None through
16881690 pass
1691+ elif self .array_ok and is_homogeneous_array (v ):
1692+ try :
1693+ v_array = copy_to_readonly_numpy_array (v , force_numeric = True )
1694+ except (ValueError , TypeError , OverflowError ):
1695+ self .raise_invalid_val (v )
1696+ v = v_array # Always numeric numpy array
1697+ elif self .array_ok and is_simple_array (v ):
1698+ # Check numeric
1699+ invalid_els = [e for e in v if not isinstance (e , numbers .Number )]
1700+
1701+ if invalid_els :
1702+ self .raise_invalid_elements (invalid_els [:10 ])
1703+
1704+ v = to_scalar_or_list (v )
16891705 elif not isinstance (v , numbers .Number ):
16901706 self .raise_invalid_val (v )
16911707 else :
0 commit comments