|
28 | 28 | # - Setting a property to Undefined leaves existing value unmodified |
29 | 29 | Undefined = object() |
30 | 30 |
|
| 31 | +Deprecated_mapbox_traces = [ |
| 32 | + "scattermapbox", |
| 33 | + "choroplethmapbox", |
| 34 | + "densitymapbox", |
| 35 | +] |
| 36 | + |
31 | 37 |
|
32 | 38 | def _len_dict_item(item): |
33 | 39 | """ |
@@ -4840,49 +4846,56 @@ def __setitem__(self, prop, value): |
4840 | 4846 | # ### Unwrap scalar tuple ### |
4841 | 4847 | prop = prop[0] |
4842 | 4848 |
|
4843 | | - if self._validate: |
4844 | | - if prop not in self._valid_props: |
4845 | | - self._raise_on_invalid_property_error()(prop) |
| 4849 | + # skip deprecated mapbox templates |
| 4850 | + if ( |
| 4851 | + prop not in Deprecated_mapbox_traces |
| 4852 | + or "template" not in self._parent_path_str |
| 4853 | + ): |
| 4854 | + if self._validate: |
| 4855 | + if prop not in self._valid_props: |
| 4856 | + self._raise_on_invalid_property_error()(prop) |
4846 | 4857 |
|
4847 | | - # ### Get validator for this property ### |
4848 | | - validator = self._get_validator(prop) |
| 4858 | + # ### Get validator for this property ### |
| 4859 | + validator = self._get_validator(prop) |
4849 | 4860 |
|
4850 | | - # ### Handle compound property ### |
4851 | | - if isinstance(validator, CompoundValidator): |
4852 | | - self._set_compound_prop(prop, value) |
| 4861 | + # ### Handle compound property ### |
| 4862 | + if isinstance(validator, CompoundValidator): |
| 4863 | + self._set_compound_prop(prop, value) |
4853 | 4864 |
|
4854 | | - # ### Handle compound array property ### |
4855 | | - elif isinstance(validator, (CompoundArrayValidator, BaseDataValidator)): |
4856 | | - self._set_array_prop(prop, value) |
| 4865 | + # ### Handle compound array property ### |
| 4866 | + elif isinstance( |
| 4867 | + validator, (CompoundArrayValidator, BaseDataValidator) |
| 4868 | + ): |
| 4869 | + self._set_array_prop(prop, value) |
4857 | 4870 |
|
4858 | | - # ### Handle simple property ### |
| 4871 | + # ### Handle simple property ### |
| 4872 | + else: |
| 4873 | + self._set_prop(prop, value) |
4859 | 4874 | else: |
4860 | | - self._set_prop(prop, value) |
4861 | | - else: |
4862 | | - # Make sure properties dict is initialized |
4863 | | - self._init_props() |
4864 | | - |
4865 | | - if isinstance(value, BasePlotlyType): |
4866 | | - # Extract json from graph objects |
4867 | | - value = value.to_plotly_json() |
4868 | | - |
4869 | | - # Check for list/tuple of graph objects |
4870 | | - if ( |
4871 | | - isinstance(value, (list, tuple)) |
4872 | | - and value |
4873 | | - and isinstance(value[0], BasePlotlyType) |
4874 | | - ): |
4875 | | - value = [ |
4876 | | - v.to_plotly_json() if isinstance(v, BasePlotlyType) else v |
4877 | | - for v in value |
4878 | | - ] |
| 4875 | + # Make sure properties dict is initialized |
| 4876 | + self._init_props() |
| 4877 | + |
| 4878 | + if isinstance(value, BasePlotlyType): |
| 4879 | + # Extract json from graph objects |
| 4880 | + value = value.to_plotly_json() |
| 4881 | + |
| 4882 | + # Check for list/tuple of graph objects |
| 4883 | + if ( |
| 4884 | + isinstance(value, (list, tuple)) |
| 4885 | + and value |
| 4886 | + and isinstance(value[0], BasePlotlyType) |
| 4887 | + ): |
| 4888 | + value = [ |
| 4889 | + v.to_plotly_json() if isinstance(v, BasePlotlyType) else v |
| 4890 | + for v in value |
| 4891 | + ] |
4879 | 4892 |
|
4880 | | - self._props[prop] = value |
| 4893 | + self._props[prop] = value |
4881 | 4894 |
|
4882 | | - # Remove any already constructed graph object so that it will be |
4883 | | - # reconstructed on property access |
4884 | | - self._compound_props.pop(prop, None) |
4885 | | - self._compound_array_props.pop(prop, None) |
| 4895 | + # Remove any already constructed graph object so that it will be |
| 4896 | + # reconstructed on property access |
| 4897 | + self._compound_props.pop(prop, None) |
| 4898 | + self._compound_array_props.pop(prop, None) |
4886 | 4899 |
|
4887 | 4900 | # Handle non-scalar case |
4888 | 4901 | # ---------------------- |
|
0 commit comments