exopy.utils.declarator module

Base class for extension declaration relying on a visitor pattern.

class exopy.utils.declarator.Declarator(parent=None, **kwargs)[source]

Bases: enaml.core.declarative.Declarative

Base class for extension object which uses a visitor pattern.

is_registered

Flag indicating whether the declarator has been successfully registered

get_path()[source]

Query from parent the path to use for this declarator.

Returns

path – Path declared by the parent. This can be None if no path is declared.

Return type

unicode or None

get_group()[source]

Get the group defined by the closest parent.

register(collector, traceback)[source]

Add the contribution of this extension to the plugin.

Parameters
  • collector (DeclaratorCollector) – Collector in charge handling the registering of declarators. Contributions should be added to the contributions member (Dict). If a declarator cannot be registered because another one need to be registered first it should add itself to the _delayed member (List)

  • traceback (dict) – Dictionary in which any issue occuring during registration should be recorded.

unregister(plugin)[source]

Remove the contribution of this extension to the plugin.

Parameters

collector (DeclaratorCollector) – Collector in charge handling the registering of declarators.

class exopy.utils.declarator.GroupDeclarator(parent=None, **kwargs)[source]

Bases: exopy.utils.declarator.Declarator

Declarator used to group an ensemble of declarator.

path

Prefix path to use for all children Declarator. Path should be dot separated.

group

Id of the group common to all children Declarator. It is the responsability of the children to mention they are part of a group.

get_path()[source]

Overriden method to walk all parents.

register(plugin, traceback)[source]

Register all children Declarator.

unregister(plugin)[source]

Unregister all children Declarator.

exopy.utils.declarator.import_and_get(path, name, traceback, id)[source]

Function importing a module and retrieving an object from it.

This function provides a common pattern for declarator.