catpy.applications.relation_identifier module¶
-
class
catpy.applications.relation_identifier.
RelationIdentifier
(catmaid_client)[source]¶ Bases:
catpy.applications.base.CatmaidClientApplication
Class to convert connector relation IDs to ConnectorRelation enums and back.
The mappings are cached on the class, and so do not need to be re-fetched for new instances.
The mappings are retrieved on a per-project basis.
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_id
(relation_id[, project_id])Return the ConnectorRelation for the given relation ID. 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. populate_mappings
(project_id)Populate the id-relation mappings cache for the given project post
(relative_url[, data, raw])Post data to a running instance of CATMAID. to_id
(relation[, project_id])Return the integer ID for the given ConnectorRelation. -
from_id
(relation_id, project_id=None)[source]¶ Return the ConnectorRelation for the given relation ID. If
project_id
is given and you know this project’s mappings are already populated (possibly via a different instance), this can be used as a class method.Parameters: - relation_id
- project_id
Returns: - ConnectorRelation
-
id_to_relation
= {}¶
-
populate_mappings
(project_id)[source]¶ Populate the id-relation mappings cache for the given project
-
relation_to_id
= {}¶