|
1 | 1 | import base64
|
2 | 2 | import numbers
|
3 | 3 | import textwrap
|
4 |
| -import traceback |
5 | 4 | import uuid
|
6 | 5 | from importlib import import_module
|
7 | 6 | import copy
|
@@ -208,17 +207,6 @@ def is_homogeneous_array(v):
|
208 | 207 | return False
|
209 | 208 |
|
210 | 209 |
|
211 |
| -def is_typed_array_spec(v): |
212 |
| - """ |
213 |
| - Return whether a value is considered to be a typed array spec for plotly.js |
214 |
| - """ |
215 |
| - return isinstance(v, dict) and "bdata" in v and "dtype" in v |
216 |
| - |
217 |
| - |
218 |
| -def is_none_or_typed_array_spec(v): |
219 |
| - return v is None or is_typed_array_spec(v) |
220 |
| - |
221 |
| - |
222 | 210 | def is_simple_array(v):
|
223 | 211 | """
|
224 | 212 | Return whether a value is considered to be an simple array
|
@@ -412,7 +400,9 @@ def description(self):
|
412 | 400 | )
|
413 | 401 |
|
414 | 402 | def validate_coerce(self, v):
|
415 |
| - if is_none_or_typed_array_spec(v): |
| 403 | + |
| 404 | + if v is None: |
| 405 | + # Pass None through |
416 | 406 | pass
|
417 | 407 | elif is_homogeneous_array(v):
|
418 | 408 | v = copy_to_readonly_numpy_array(v)
|
@@ -609,7 +599,8 @@ def in_values(self, e):
|
609 | 599 | return False
|
610 | 600 |
|
611 | 601 | def validate_coerce(self, v):
|
612 |
| - if is_none_or_typed_array_spec(v): |
| 602 | + if v is None: |
| 603 | + # Pass None through |
613 | 604 | pass
|
614 | 605 | elif self.array_ok and is_array(v):
|
615 | 606 | v_replaced = [self.perform_replacemenet(v_el) for v_el in v]
|
@@ -769,7 +760,8 @@ def description(self):
|
769 | 760 | return desc
|
770 | 761 |
|
771 | 762 | def validate_coerce(self, v):
|
772 |
| - if is_none_or_typed_array_spec(v): |
| 763 | + if v is None: |
| 764 | + # Pass None through |
773 | 765 | pass
|
774 | 766 | elif self.array_ok and is_homogeneous_array(v):
|
775 | 767 | np = get_module("numpy")
|
@@ -915,7 +907,8 @@ def description(self):
|
915 | 907 | return desc
|
916 | 908 |
|
917 | 909 | def validate_coerce(self, v):
|
918 |
| - if is_none_or_typed_array_spec(v): |
| 910 | + if v is None: |
| 911 | + # Pass None through |
919 | 912 | pass
|
920 | 913 | elif v in self.extras:
|
921 | 914 | return v
|
@@ -1078,7 +1071,8 @@ def description(self):
|
1078 | 1071 | return desc
|
1079 | 1072 |
|
1080 | 1073 | def validate_coerce(self, v):
|
1081 |
| - if is_none_or_typed_array_spec(v): |
| 1074 | + if v is None: |
| 1075 | + # Pass None through |
1082 | 1076 | pass
|
1083 | 1077 | elif self.array_ok and is_array(v):
|
1084 | 1078 |
|
@@ -1379,7 +1373,8 @@ def description(self):
|
1379 | 1373 | return valid_color_description
|
1380 | 1374 |
|
1381 | 1375 | def validate_coerce(self, v, should_raise=True):
|
1382 |
| - if is_none_or_typed_array_spec(v): |
| 1376 | + if v is None: |
| 1377 | + # Pass None through |
1383 | 1378 | pass
|
1384 | 1379 | elif self.array_ok and is_homogeneous_array(v):
|
1385 | 1380 | v = copy_to_readonly_numpy_array(v)
|
@@ -1523,7 +1518,8 @@ def description(self):
|
1523 | 1518 |
|
1524 | 1519 | def validate_coerce(self, v):
|
1525 | 1520 |
|
1526 |
| - if is_none_or_typed_array_spec(v): |
| 1521 | + if v is None: |
| 1522 | + # Pass None through |
1527 | 1523 | pass
|
1528 | 1524 | elif is_array(v):
|
1529 | 1525 | validated_v = [
|
@@ -1728,7 +1724,8 @@ def description(self):
|
1728 | 1724 | return desc
|
1729 | 1725 |
|
1730 | 1726 | def validate_coerce(self, v):
|
1731 |
| - if is_none_or_typed_array_spec(v): |
| 1727 | + if v is None: |
| 1728 | + # Pass None through |
1732 | 1729 | pass
|
1733 | 1730 | elif self.array_ok and is_homogeneous_array(v):
|
1734 | 1731 | try:
|
@@ -1916,9 +1913,6 @@ def validate_coerce(self, v):
|
1916 | 1913 | if v is None:
|
1917 | 1914 | # Pass None through
|
1918 | 1915 | pass
|
1919 |
| - if is_typed_array_spec(v): |
1920 |
| - # Pass typed array spec through |
1921 |
| - pass |
1922 | 1916 | elif self.array_ok and is_array(v):
|
1923 | 1917 |
|
1924 | 1918 | # Coerce individual strings
|
@@ -1975,7 +1969,8 @@ def description(self):
|
1975 | 1969 | return desc
|
1976 | 1970 |
|
1977 | 1971 | def validate_coerce(self, v):
|
1978 |
| - if is_none_or_typed_array_spec(v): |
| 1972 | + if v is None: |
| 1973 | + # Pass None through |
1979 | 1974 | pass
|
1980 | 1975 | elif self.array_ok and is_homogeneous_array(v):
|
1981 | 1976 | v = copy_to_readonly_numpy_array(v, kind="O")
|
@@ -2183,7 +2178,8 @@ def validate_element_with_indexed_name(self, val, validator, inds):
|
2183 | 2178 | return val
|
2184 | 2179 |
|
2185 | 2180 | def validate_coerce(self, v):
|
2186 |
| - if is_none_or_typed_array_spec(v): |
| 2181 | + if v is None: |
| 2182 | + # Pass None through |
2187 | 2183 | return None
|
2188 | 2184 | elif not is_array(v):
|
2189 | 2185 | self.raise_invalid_val(v)
|
@@ -2246,7 +2242,7 @@ def validate_coerce(self, v):
|
2246 | 2242 | return v
|
2247 | 2243 |
|
2248 | 2244 | def present(self, v):
|
2249 |
| - if is_none_or_typed_array_spec(v): |
| 2245 | + if v is None: |
2250 | 2246 | return None
|
2251 | 2247 | else:
|
2252 | 2248 | if (
|
|
0 commit comments