Skip to content
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

Make API more reusable #13

Merged
merged 1 commit into from Mar 17, 2020
Merged

Conversation

@cthoyt
Copy link
Contributor

cthoyt commented Mar 16, 2020

Since both the gilda.api.ground() and gilda.api.get_models() functions rely on the static instance of the gilda.api.GrounderInstance class at gilda.api.grounder, this PR moves the implementations of these functions into the class itself. Later, this made it possible to just call these methods on the static instance of the GrounderInstance from the api-level functions.

This will enable a user to make their own GrounderInstance if they would like.

@bgyori

This comment has been minimized.

Copy link
Collaborator

bgyori commented Mar 16, 2020

That makes sense - it also makes me wonder if the Grounder class could expose the same interface for ground and get_models so that the API wouldn't have to do anything beyond just calling those.

@cthoyt

This comment has been minimized.

Copy link
Contributor Author

cthoyt commented Mar 16, 2020

@bgyori yes! I would propose that next. Since the top level API directly reflects the model, it would be possible to write it like this:

...
grounder = GrounderInstance()
ground = grounder.ground
get_models = grounder.get_models
Since both the ground() and get_models() function rely on a static instance of the GrounderInstance, I moved the implementations of these functions into the class itself. Later, this made it possible to just call these methods on the static instance of the GrounderInstance from the api-level functions.

This will enable a user to make their own GrounderInstance if they would like
@bgyori bgyori force-pushed the cthoyt:improve-api-reusability branch from 90adedf to 8b896d8 Mar 17, 2020
@bgyori bgyori merged commit ba61cea into indralab:master Mar 17, 2020
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@cthoyt cthoyt deleted the cthoyt:improve-api-reusability branch Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.