Interface object for catmaid_interface#2
Closed
clbarnes wants to merge 3 commits intoceesem:masterfrom
Closed
Conversation
Method to return a dictionary of the same format as the 'Treenode and connector geometry' option from the skeleton export widget.
Rather than faffing with the proj_opts dict and remembering where it goes in the function call, you just instantiate a CatmaidAPI and call all of the functions are instance methods without the proj_opts argument. The CatmaidAPI instance can also be used as a drop-in replacement for a proj_opts dict, and its string representation is the JSON identical to a proj_opts dict. Future methods could (should?) be defined straight on the object, but for backwards compatibility the existing methods can be called either way. Also, added docstrings which IDEs will recognise.
Also a fetch method which behaves very similarly to the javascript API.
Author
|
A couple of thin wrapper methods around requests makes this very very similar to the javascript API, and also saves having to deal with auth and so on every time. |
Author
|
Uuuuurgh I'm a moron, completely ignored |
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.
Also includes the changes from #1; only merge one!
This wraps all of the appropriate functions of
catmaid_interfacein a class - you'd instantiate that with your credentials and make all the calls through that, as is a common pattern in these sorts of libraries. It saves having to manually enter the proj_opts into the call (and you don't need to remember where it goes) and means you only need to import one thing.