Skip to content

Commit c555d57

Browse files
committed
suppress DeprecationWarnings when updating template.data
1 parent e3f8c1a commit c555d57

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: plotly/graph_objs/layout/_template.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
21
import copy as _copy
2+
import warnings
33

4+
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
45

56
class Template(_BaseLayoutHierarchyType):
67

@@ -324,7 +325,12 @@ def __init__(self, arg=None, data=None, layout=None, **kwargs):
324325
_v = arg.pop("data", None)
325326
_v = data if data is not None else _v
326327
if _v is not None:
327-
self["data"] = _v
328+
# Template.data contains key for deprecated scattermapbox trace
329+
# In order to prevent false deprecation warnings from surfacing,
330+
# we suppress deprecation warnings for this line only
331+
with warnings.catch_warnings():
332+
warnings.filterwarnings("ignore", category=DeprecationWarning)
333+
self["data"] = _v
328334
_v = arg.pop("layout", None)
329335
_v = layout if layout is not None else _v
330336
if _v is not None:

0 commit comments

Comments
 (0)