-
Notifications
You must be signed in to change notification settings - Fork 67
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
chore(weave): Cleanup save object basic #3015
base: master
Are you sure you want to change the base?
Conversation
@@ -1335,13 +1335,13 @@ def _save_object_basic( | |||
"""Directly saves an object to the weave server and attach | |||
the ref to the object. This is the lowest level object saving logic. | |||
""" | |||
orig_val = val |
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.
moved to top for clarity
# `to_json` is mostly fast, except for CustomWeaveTypes | ||
# which incur network costs to serialize the payload |
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.
moved comment closer to code for clarity
digest_future: Future[str] = self.future_executor.then( | ||
[res_future], lambda res: res[0].digest | ||
) | ||
|
||
ref: Ref | ||
if is_opdef: | ||
if is_op(orig_val): |
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.
inline
ref = OpRef(self.entity, self.project, name, digest_future) | ||
else: | ||
ref = ObjectRef(self.entity, self.project, name, digest_future) | ||
|
||
# Attach the ref to the object | ||
try: | ||
set_ref(orig_val, ref) | ||
except: | ||
except Exception: |
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.
blank except is actually BaseException
which is not safe
https://stackoverflow.com/questions/27995057/why-is-it-recommended-to-derive-from-exception-instead-of-baseexception-class-in
Tidying this block