Skip to content

Remove streaming validation. #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions plotly/plotly/plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,17 +576,6 @@ def write(self, trace, layout=None, validate=True,
"to 'your_stream.write()'. Here's why the object is "
"invalid:\n\n{1}".format(stream_object['type'], err)
)
try:
tools.validate_stream(stream_object, stream_object['type'])
except exceptions.PlotlyError as err:
raise exceptions.PlotlyError(
"Part of the data object with type, '{0}', cannot yet be "
"streamed into Plotly. If you do not want to validate "
"your data objects when streaming, you can set "
"'validate=False' in the call to 'your_stream.write()'. "
"Here's why the object cannot be streamed:\n\n{1}"
.format(stream_object['type'], err)
)
if layout is not None:
try:
tools.validate(layout, 'Layout')
Expand Down
4 changes: 3 additions & 1 deletion plotly/tests/test_core/test_stream/test_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ def test_stream_validate_layout():
my_stream.close()


@raises(exceptions.PlotlyError)
def test_stream_unstreamable():

# even though `name` isn't streamable, we don't validate it --> should pass

py.sign_in(un, ak)
my_stream = py.Stream(tk)
my_stream.open()
Expand Down
35 changes: 0 additions & 35 deletions plotly/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,41 +1328,6 @@ def validate(obj, obj_type):
format(obj_type))


def validate_stream(obj, obj_type):
"""Validate a data dictionary (only) for use with streaming.

An error is raised if a key within (or nested within) is not streamable.

"""
try:
obj_type = graph_objs.KEY_TO_NAME[obj_type]
except KeyError:
pass
info = graph_objs.INFO[graph_objs.NAME_TO_KEY[obj_type]]
for key, val in list(obj.items()):
if key == 'type':
continue
if 'streamable' in info['keymeta'][key].keys():
if not info['keymeta'][key]['streamable']:
raise exceptions.PlotlyError(
"The '{0}' key is not streamable in the '{1}' "
"object".format(
key, obj_type
)
)
else:
raise exceptions.PlotlyError(
"The '{0}' key is not streamable in the '{1}' object".format(
key, obj_type
)
)
try:
sub_obj_type = graph_objs.KEY_TO_NAME[key]
validate_stream(val, sub_obj_type)
except KeyError:
pass


def _replace_newline(obj):
"""Replaces '\n' with '<br>' for all strings in a collection."""
if isinstance(obj, dict):
Expand Down