Skip to content

Commit 44c527e

Browse files
committed
Merge pull request #281 from plotly/remove-streaming-validation
Remove streaming validation.
2 parents cff2ab5 + 2a0cda7 commit 44c527e

File tree

3 files changed

+3
-47
lines changed

3 files changed

+3
-47
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 & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,41 +1328,6 @@ def validate(obj, obj_type):
13281328
format(obj_type))
13291329

13301330

1331-
def validate_stream(obj, obj_type):
1332-
"""Validate a data dictionary (only) for use with streaming.
1333-
1334-
An error is raised if a key within (or nested within) is not streamable.
1335-
1336-
"""
1337-
try:
1338-
obj_type = graph_objs.KEY_TO_NAME[obj_type]
1339-
except KeyError:
1340-
pass
1341-
info = graph_objs.INFO[graph_objs.NAME_TO_KEY[obj_type]]
1342-
for key, val in list(obj.items()):
1343-
if key == 'type':
1344-
continue
1345-
if 'streamable' in info['keymeta'][key].keys():
1346-
if not info['keymeta'][key]['streamable']:
1347-
raise exceptions.PlotlyError(
1348-
"The '{0}' key is not streamable in the '{1}' "
1349-
"object".format(
1350-
key, obj_type
1351-
)
1352-
)
1353-
else:
1354-
raise exceptions.PlotlyError(
1355-
"The '{0}' key is not streamable in the '{1}' object".format(
1356-
key, obj_type
1357-
)
1358-
)
1359-
try:
1360-
sub_obj_type = graph_objs.KEY_TO_NAME[key]
1361-
validate_stream(val, sub_obj_type)
1362-
except KeyError:
1363-
pass
1364-
1365-
13661331
def _replace_newline(obj):
13671332
"""Replaces '\n' with '<br>' for all strings in a collection."""
13681333
if isinstance(obj, dict):

0 commit comments

Comments
 (0)