Skip to content

Conversation

@clbarnes
Copy link

@clbarnes clbarnes commented Mar 9, 2017

Also includes the changes from #1; only merge one!

This wraps all of the appropriate functions of catmaid_interface in 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.

clbarnes added 3 commits March 9, 2017 17:44
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.
@clbarnes
Copy link
Author

clbarnes commented Mar 10, 2017

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.

@clbarnes
Copy link
Author

Uuuuurgh I'm a moron, completely ignored catmaid_interface3.py. DISREGARD.

@clbarnes clbarnes closed this Mar 10, 2017
@clbarnes clbarnes deleted the oo-interface branch March 10, 2017 00:35
@clbarnes clbarnes restored the oo-interface branch March 10, 2017 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant