-
Notifications
You must be signed in to change notification settings - Fork 0
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
Deserialize Job Event Params #29
Deserialize Job Event Params #29
Conversation
dcp/api/job.py
Outdated
nonlocal callback | ||
new_args = [] | ||
for arg in inner_args: | ||
if isinstance(arg, dict) and bool(arg): |
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.
For readability, would it be better
if isinstance(arg, dict) and bool(arg): | |
if isinstance(arg, dict) and len(arg) > 0: |
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.
honestly it's a no-op anyways, not sure why I check the length. It could just be
if isinstance(arg, dict):
I'll change it to that
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.
changed in dfe1623
dcp/api/job.py
Outdated
# deserialize job on event parameters before passing them to user defined callback | ||
def cb_deserialize_wrapper(callback): | ||
def new_cb(*inner_args): | ||
nonlocal callback |
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.
Do we need to change callback
? If not, it's probably better to remove this line.
nonlocal callback |
Previously, parameters passed to jon event handler callbacks weren't deserialized. See the example below:
example code:
Before this change, the output would be:
After this change, the output is now:
the main diff is that now instead of
<memory at 0x73bb740e0280>
it prints{'val': 2}