get_traits#

geodesic.entanglement.object.get_traits(traits=None, refresh=False)[source]#

Gets all registered traits and their predicates. A trait modifies an object class to allow certain kinds of connections between objects. For example, an “Observer” trait allows the “can-observe” predicate between two edges. If traits are specified, returns the predicates for each of these traits, if registered.

Parameters:
  • traits (List[str] | None) – a list of trait names to check

  • refresh (bool) – by default, these names are cached. If you want to grab the latest from the server, set refresh to True

Returns:

a list of dictionaries with the keys ‘name’ and ‘predicates’. ‘predicates’ contains

a list of Predicate objects for that trait.

Return type:

traits

Example

>>> get_traits()
[{'name': 'Correlator', 'predicates': [{'name': 'correlates-with']},
{'name': 'Linker', 'predicates': [{'name': 'links']},
{'name': 'Observer', 'predicates': ['name': 'can-observe']}]