@@ -1808,32 +1808,29 @@ def validate_coerce(self, v):
1808
1808
1809
1809
is_v_2d = v and is_array (v [0 ])
1810
1810
1811
- if is_v_2d :
1812
- if self .dimensions == 1 :
1813
- self .raise_invalid_val (orig_v )
1814
- else : # self.dimensions is '1-2' or 2
1815
- if is_array (self .items ):
1816
- # e.g. 2D list as parcoords.dimensions.constraintrange
1817
- # check that all items are there for each nested element
1818
- for i , row in enumerate (v ):
1819
- # Check row length
1820
- if not is_array (row ) or len (row ) != len (self .items ):
1821
- self .raise_invalid_val (orig_v [i ], [i ])
1822
-
1823
- for j , validator in enumerate (self .item_validators ):
1824
- row [j ] = self .validate_element_with_indexed_name (
1825
- v [i ][j ], validator , [i , j ])
1826
- else :
1827
- # e.g. 2D list as layout.grid.subplots
1828
- # check that all elements match individual validator
1829
- validator = self .item_validators [0 ]
1830
- for i , row in enumerate (v ):
1831
- if not is_array (row ):
1832
- self .raise_invalid_val (orig_v [i ], [i ])
1833
-
1834
- for j , el in enumerate (row ):
1835
- row [j ] = self .validate_element_with_indexed_name (
1836
- el , validator , [i , j ])
1811
+ if is_v_2d and self .dimensions in ('1-2' , 2 ):
1812
+ if is_array (self .items ):
1813
+ # e.g. 2D list as parcoords.dimensions.constraintrange
1814
+ # check that all items are there for each nested element
1815
+ for i , row in enumerate (v ):
1816
+ # Check row length
1817
+ if not is_array (row ) or len (row ) != len (self .items ):
1818
+ self .raise_invalid_val (orig_v [i ], [i ])
1819
+
1820
+ for j , validator in enumerate (self .item_validators ):
1821
+ row [j ] = self .validate_element_with_indexed_name (
1822
+ v [i ][j ], validator , [i , j ])
1823
+ else :
1824
+ # e.g. 2D list as layout.grid.subplots
1825
+ # check that all elements match individual validator
1826
+ validator = self .item_validators [0 ]
1827
+ for i , row in enumerate (v ):
1828
+ if not is_array (row ):
1829
+ self .raise_invalid_val (orig_v [i ], [i ])
1830
+
1831
+ for j , el in enumerate (row ):
1832
+ row [j ] = self .validate_element_with_indexed_name (
1833
+ el , validator , [i , j ])
1837
1834
elif v and self .dimensions == 2 :
1838
1835
# e.g. 1D list passed as layout.grid.subplots
1839
1836
self .raise_invalid_val (orig_v [0 ], [0 ])
0 commit comments