Skip to content

Commit 787793d

Browse files
committed
Merge branch 'master' into cache-plot-schema
Conflicts: plotly/tools.py
2 parents f375701 + 44c527e commit 787793d

File tree

3 files changed

+3
-49
lines changed

3 files changed

+3
-49
lines changed

plotly/plotly/plotly.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -576,17 +576,6 @@ def write(self, trace, layout=None, validate=True,
576576
"to 'your_stream.write()'. Here's why the object is "
577577
"invalid:\n\n{1}".format(stream_object['type'], err)
578578
)
579-
try:
580-
tools.validate_stream(stream_object, stream_object['type'])
581-
except exceptions.PlotlyError as err:
582-
raise exceptions.PlotlyError(
583-
"Part of the data object with type, '{0}', cannot yet be "
584-
"streamed into Plotly. If you do not want to validate "
585-
"your data objects when streaming, you can set "
586-
"'validate=False' in the call to 'your_stream.write()'. "
587-
"Here's why the object cannot be streamed:\n\n{1}"
588-
.format(stream_object['type'], err)
589-
)
590579
if layout is not None:
591580
try:
592581
tools.validate(layout, 'Layout')

plotly/tests/test_core/test_stream/test_stream.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ def test_stream_validate_layout():
102102
my_stream.close()
103103

104104

105-
@raises(exceptions.PlotlyError)
106105
def test_stream_unstreamable():
106+
107+
# even though `name` isn't streamable, we don't validate it --> should pass
108+
107109
py.sign_in(un, ak)
108110
my_stream = py.Stream(tk)
109111
my_stream.open()

plotly/tools.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,43 +1314,6 @@ def validate(obj, obj_type):
13141314
format(obj_type))
13151315

13161316

1317-
def validate_stream(obj, obj_type):
1318-
"""Validate a data dictionary (only) for use with streaming.
1319-
1320-
An error is raised if a key within (or nested within) is not streamable.
1321-
1322-
"""
1323-
# TODO: Deprecate or move. #283
1324-
from plotly.graph_objs import graph_objs
1325-
try:
1326-
obj_type = graph_objs.KEY_TO_NAME[obj_type]
1327-
except KeyError:
1328-
pass
1329-
info = graph_objs.INFO[graph_objs.NAME_TO_KEY[obj_type]]
1330-
for key, val in list(obj.items()):
1331-
if key == 'type':
1332-
continue
1333-
if 'streamable' in info['keymeta'][key].keys():
1334-
if not info['keymeta'][key]['streamable']:
1335-
raise exceptions.PlotlyError(
1336-
"The '{0}' key is not streamable in the '{1}' "
1337-
"object".format(
1338-
key, obj_type
1339-
)
1340-
)
1341-
else:
1342-
raise exceptions.PlotlyError(
1343-
"The '{0}' key is not streamable in the '{1}' object".format(
1344-
key, obj_type
1345-
)
1346-
)
1347-
try:
1348-
sub_obj_type = graph_objs.KEY_TO_NAME[key]
1349-
validate_stream(val, sub_obj_type)
1350-
except KeyError:
1351-
pass
1352-
1353-
13541317
def _replace_newline(obj):
13551318
"""Replaces '\n' with '<br>' for all strings in a collection."""
13561319
if isinstance(obj, dict):

0 commit comments

Comments
 (0)