Repository navigation
Wrapper to create non-async methods from all async methods in a class - #149
Merged
Merged
Conversation
(since they follow a trivial common boilerplate)
methods and auto-generate the non-async versions
Contributor
Author
|
@jdnc - it would be great if you could give this a try on your next module. |
Contributor
|
Sure I 'll try this for the NIST that I'm doing next. One question is that currently this won't be able to generate automatically from |
Contributor
Author
|
I think not; we may need a different wrapper for that. There are definitely still kinks to work out:
|
Merged
wrapper because "The nested function looks up variables from the parent scope when executed, not when defined." See http://stackoverflow.com/questions/12423614/local-variables-in-python-nested-functions
Contributor
Author
|
I'll merge this as soon as splatalogue tests pass; splatalogue actually makes use of this module & tests it directly |
Contributor
Author
|
(@jdnc - FYI) See splatalogue for an example, but basically I've taken this approach:
If |
class methods before
keflavich
added a commit
that referenced
this pull request
Aug 7, 2013
Wrapper to create non-async methods from all async methods in a class
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Since all of the
query_xtools are trivial wrappers on top ofquery_x_async, they are taking up a lot of lines of code without adding any useful functionality. Therefore, for the sake of code readability and maintenance, it makes sense to use a generator function.This PR implements the generator, which would be applied to any
classwith_asyncmethods, e.g. inVizier/core.pyyou would do:process_asyncs(Vizier)