catpy.applications.nameresolver module

exception catpy.applications.nameresolver.MultipleMatchingNamesException[source]

Bases: catpy.applications.nameresolver.NameResolverException

class catpy.applications.nameresolver.NameResolver(catmaid_client)[source]

Bases: catpy.applications.base.CatmaidClientApplication

Catmaid client application which looks up integer database IDs for string names for various objects.

For convenience, lookup methods short-circuit if given an int (i.e. you can transparently use either the ID or the name of an object).

HTTP responses are cached where possible, so there may be a performance benefit to sharing NameResolver instances. Furthermore, subsequent lookups of IDs of the same object type (e.g. stack, user) should be much faster than the first.

Lookup methods ensure that one object matches the given name/title for the given project, raising a NoMatchingNamesException if there are zero matches, and a MultipleMatchingNamesException if there are more than one, both of which subclass NameResolverException, which subclasses ValueError.

Attributes:
base_url
project_id

Methods

fetch(*args, **kwargs) Interact with the CATMAID server in a manner very similar to the javascript CATMAID.fetch API.
from_json(credentials, *args, **kwargs) Return a CatmaidClientApplication instance whose underlying CatmaidClient object is instantiated from the JSON file as per its own from_json method.
get(relative_url[, params, raw]) Get data from a running instance of CATMAID.
get_neuron_names(*skeleton_ids) Get a dict of skeleton IDs to neuron names.
post(relative_url[, data, raw]) Post data to a running instance of CATMAID.
get_neuron_name  
get_stack_id  
get_user_id  
get_neuron_name(id_or_name, *args, **kwargs)[source]
get_neuron_names(*skeleton_ids)[source]

Get a dict of skeleton IDs to neuron names.

Parameters:
skeleton_ids
Returns:
dict of int to str
get_stack_id(id_or_name, *args, **kwargs)[source]
get_user_id(id_or_name, *args, **kwargs)[source]
exception catpy.applications.nameresolver.NameResolverException[source]

Bases: exceptions.ValueError

exception catpy.applications.nameresolver.NoMatchingNamesException[source]

Bases: catpy.applications.nameresolver.NameResolverException

catpy.applications.nameresolver.id_to_name(fn)[source]
catpy.applications.nameresolver.name_to_id(fn)[source]