Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.8k
Test fixes 2#994
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
Uh oh!
There was an error while loading. Please reload this page.
Test fixes 2 #994
Changes from all commits
3cef6d3ce3b7237378270fbdcb6239d036d53bcdecc88ef4075b0ffcc2821a6f7c75ccc22889522f15c057a56aa0fc27276f8dcf420ecb25f024f5747622f5390c4f26d5dd92f70202d64558370fedc1b6ed70dbc891d7577ca1b2f09a5ec0b5a98cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -31,6 +31,7 @@ | ||
| from plotly.api import v1, v2 | ||
| from plotly.basedatatypes import BaseTraceType | ||
| from plotly.plotly import chunked_requests | ||
| from plotly.graph_objs import Scatter | ||
| from plotly.grid_objs import Grid, Column | ||
| from plotly.dashboard_objs import dashboard_objs as dashboard | ||
| @@ -304,7 +305,6 @@ def plot_mpl(fig, resize=True, strip_style=False, update=None, **plot_options): | ||
| fig = tools.mpl_to_plotly(fig, resize=resize, strip_style=strip_style) | ||
| if update and isinstance(update, dict): | ||
| fig.update(update) | ||
| fig.validate() | ||
| elif update is not None: | ||
| raise exceptions.PlotlyGraphObjectError( | ||
| "'update' must be dictionary-like and a valid plotly Figure " | ||
| @@ -588,7 +588,7 @@ def open(self): | ||
| streaming_specs = self.get_streaming_specs() | ||
| self._stream = chunked_requests.Stream(**streaming_specs) | ||
| def write(self, trace, layout=None, validate=True, | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed validate so that users will not be able to use the internal validation | ||
| def write(self, trace, layout=None, | ||
| reconnect_on=(200, '', 408)): | ||
| """ | ||
| Write to an open stream. | ||
| @@ -606,9 +606,6 @@ def write(self, trace, layout=None, validate=True, | ||
| keyword arguments: | ||
| layout (default=None) - A valid Layout object | ||
| Run help(plotly.graph_objs.Layout) | ||
| validate (default = True) - Validate this stream before sending? | ||
| This will catch local errors if set to | ||
| True. | ||
| Some valid keys for trace dictionaries: | ||
| 'x', 'y', 'text', 'z', 'marker', 'line' | ||
| @@ -629,15 +626,24 @@ def write(self, trace, layout=None, validate=True, | ||
| http://nbviewer.ipython.org/github/plotly/python-user-guide/blob/master/s7_streaming/s7_streaming.ipynb | ||
| """ | ||
| # always bypass validation in here as | ||
| # now automatically done | ||
| validate = False | ||
| # Convert trace objects to dictionaries | ||
| if isinstance(trace, BaseTraceType): | ||
| trace = tracefill_percent | ||
| trace = trace.to_plotly_json() | ||
| stream_object = dict() | ||
| stream_object.update(trace) | ||
| if 'type' not in stream_object: | ||
| # tests if Scatter contains invalid kwargs | ||
| dummy_obj = copy.deepcopy(Scatter(**stream_object)) | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here I am making a deepcopy of the trace being coerced into a Scatter from the original dict. The point is that an error will pop up if there is one, and stream_object can continue down the code being untouched and do its thing. Do you think this is a good idea? Is it better to have the actual object the user sent raise the error? | ||
| stream_object = Scatter(**stream_object) | ||
| stream_object['type'] = 'scatter' | ||
| # TODO: remove this validation as now it's | ||
| # done automatically | ||
| if validate: | ||
| try: | ||
| tools.validate(stream_object, stream_object['type']) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import sys | ||
| from unittest import TestCase | ||
| from nose.tools import raises | ||
| import plotly.graph_objs as go | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it create an issue to create a dependancy of
graph_objsforplotly.py?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. There shouldn't be an existing dependency the other way (i.e.
plotly.graph_objs->plotly.plotly)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's good. I only brought it up because another engineer advised against doing that i.e. sent me an blogpost saying it could be a problem