Skip to content

Commit cb3dba7

Browse files
committed
clean up basedatatypes (return to previous)
1 parent c187794 commit cb3dba7

File tree

1 file changed

+38
-43
lines changed

1 file changed

+38
-43
lines changed

Diff for: packages/python/plotly/plotly/basedatatypes.py

+38-43
Original file line numberDiff line numberDiff line change
@@ -4846,56 +4846,51 @@ def __setitem__(self, prop, value):
48464846
# ### Unwrap scalar tuple ###
48474847
prop = prop[0]
48484848

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)
4849+
if self._validate:
4850+
if prop not in self._valid_props:
4851+
self._raise_on_invalid_property_error()(prop)
48574852

4858-
# ### Get validator for this property ###
4859-
validator = self._get_validator(prop)
4853+
# ### Get validator for this property ###
4854+
validator = self._get_validator(prop)
48604855

4861-
# ### Handle compound property ###
4862-
if isinstance(validator, CompoundValidator):
4863-
self._set_compound_prop(prop, value)
4856+
# ### Handle compound property ###
4857+
if isinstance(validator, CompoundValidator):
4858+
self._set_compound_prop(prop, value)
48644859

4865-
# ### Handle compound array property ###
4866-
elif isinstance(
4867-
validator, (CompoundArrayValidator, BaseDataValidator)
4868-
):
4869-
self._set_array_prop(prop, value)
4860+
# ### Handle compound array property ###
4861+
elif isinstance(
4862+
validator, (CompoundArrayValidator, BaseDataValidator)
4863+
):
4864+
self._set_array_prop(prop, value)
48704865

4871-
# ### Handle simple property ###
4872-
else:
4873-
self._set_prop(prop, value)
4866+
# ### Handle simple property ###
48744867
else:
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-
]
4868+
self._set_prop(prop, value)
4869+
else:
4870+
# Make sure properties dict is initialized
4871+
self._init_props()
4872+
4873+
if isinstance(value, BasePlotlyType):
4874+
# Extract json from graph objects
4875+
value = value.to_plotly_json()
4876+
4877+
# Check for list/tuple of graph objects
4878+
if (
4879+
isinstance(value, (list, tuple))
4880+
and value
4881+
and isinstance(value[0], BasePlotlyType)
4882+
):
4883+
value = [
4884+
v.to_plotly_json() if isinstance(v, BasePlotlyType) else v
4885+
for v in value
4886+
]
48924887

4893-
self._props[prop] = value
4888+
self._props[prop] = value
48944889

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)
4890+
# Remove any already constructed graph object so that it will be
4891+
# reconstructed on property access
4892+
self._compound_props.pop(prop, None)
4893+
self._compound_array_props.pop(prop, None)
48994894

49004895
# Handle non-scalar case
49014896
# ----------------------

0 commit comments

Comments
 (0)