-
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
mnt: fixed and simplified some logic in the read_multiple function #2
mnt: fixed and simplified some logic in the read_multiple function #2
Conversation
|
||
Returns | ||
------- | ||
single entry or list from multiple reads | ||
""" | ||
def decorator(func): | ||
# ensure we can access the callables | ||
nonlocal skip_call, pre_call, post_call, postprocess |
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.
the nonlocal
ensures that the variables are kept in scope
It should now be able to handle more cases and more easily transfer data to a required data-structure. Added an xyz skip function which is much faster than the read_geometry call. Changed default all=True for the ANI file. Changed the suffix for ANI files to be capitalized. Added a postprocess function for post-processing the data returned by the read_multiple function. This would enable one to merge stuff etc. Signed-off-by: Nick Papior <[email protected]>
35b2374
to
e577063
Compare
# they should be equivalent but skip can be used to | ||
# skip some processing of the read data. | ||
if skip_call is None: | ||
skip_call = wrap_func |
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 came to think that a skip_call
should not do any of the pre_call
and post_call
since then it can be used in larger chunks of files. Say complicated files that doesn't really fit regular data files.
It may be weird for users supplying a skip call to be wrapped with the pre and post if they are not needed. It is simpler to manually put them in if needed.
r = skip_call(self, *args, **kwargs) | ||
post_call() | ||
return r | ||
def multiple(*args, start=start, stop=stop, step=step, all=all, **kwargs): |
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.
My fault was that *
is not required when you have *args
. All arguments between *args
and **kwargs
are keyword only arguments! So nothing needs to be changed.
Looks good. Thanks! |
It should now be able to handle more cases and more easily transfer data to a required data-structure.
Added an xyz skip function which is much faster than the read_geometry call.
Changed default all=True for the ANI file.
Changed the suffix for ANI files to be capitalized.
Added a postprocess function for post-processing the data returned by the read_multiple function. This would enable one to merge stuff etc.