-
Notifications
You must be signed in to change notification settings - Fork 946
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
Any descendant of the state can be a binary_type #1194
Merged
jasongrout
merged 21 commits into
jupyter-widgets:master
from
maartenbreddels:nested-buffers
Mar 21, 2017
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
8803a05
Any descendant of the state can be a binary_type now, usefull for ser…
maartenbreddels 035e75e
serializing of nested buffer supported
maartenbreddels 01e03ca
better docstring for _split_state_buffers
maartenbreddels 7866d2c
fix: although state is a copy, it's ancestors may refer to original d…
maartenbreddels 542940d
if a top level key enters twice, don't try to remove it twice
maartenbreddels 761b62f
added unittest, make _split_state_buffer a function instead of method…
maartenbreddels 1fa8e08
fix: toplevel buffers triggered a bug, since items were already remov…
maartenbreddels caadc22
test: using byte/string for memoryview for python27 compat
maartenbreddels 1fccf08
fix unittest
maartenbreddels d5740b4
better docstring
maartenbreddels 9d896f7
not using a seperate state with keeps the state which have buffer, mu…
maartenbreddels cca2110
_split_state_buffer renamed for ts/js consistency, _remove_buffers/_p…
maartenbreddels 33e7569
Support object toJSON serialization in js
jasongrout 926d40a
!= -> !==
jasongrout 6ff791a
We can assume hasOwnProperty in our supported browsers.
jasongrout 03323a6
whitespace changes
jasongrout 91e8497
fix some unit tests
jasongrout abe3ee8
seperate -> separate
jasongrout c3e13ec
Add buffers to args dict on creation.
jasongrout 0a1dffb
var -> let
jasongrout 036487c
add newline
jasongrout File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just like on the python side, I think we should assume that the objects and lists given to us at this stage are already copies, and we can mutate them however we wish to get them onto the wire.
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.
Furthermore, I think it's okay to assume that we don't have cyclic references. This translation step should really essentially be the last step before using JSON.stringify. I think these two assumptions will greatly simplify the code here. Also, if we don't have to clone, I think we can delete the underscore import at the top.
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.
Both I disagree with. I've been bit by modifying the data. Say you serialize (from py side), and array like {'data': memoryview(ar), shape: ar.shape}. And on the JS side, you work with this as an object. Then you do not want this js code to delete the data attribute.
Cyclic references exists :( If you don't take this into account, the Controller will trigger this.
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 think the serialization step should make a copy of the object being sent (otherwise it's not sending a snapshot of the current data). So I think what we're working with here should be our own copy. (We'd make a concession to binary data here, i.e., we're not copying it since it's typically large.)
The Controller widget has cyclic references in the JSON structure that is stringified? Won't that cause an error in the stringification? That sounds like a problem.
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.
Yes, i even saw the widgetmanager with the promises being serialized, didnt look into it further though. Only saw that with Controller.
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 was surprised to see Promises being stringified as well.