Trees | Indices | Help |
|
---|
|
object --+ | WithMetaMixin
Metadata access mixin.
I factorize all metadata-related code for classes Package and PackageElement.
I also provide an alias mechanism to make frequent metadata easily accessible as python properties.
FIXME: expand description with usage example
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
|
|
|||
__cache = None
|
|||
__cache_is_complete = False
|
|
|||
meta | |||
Inherited from |
|
Iter over all the metadata of this object. Yields (key, value) pairs, where the value is either a string or an element. If the element is unreachable, value is None. See also `iter_meta_ids`. |
Iter over all the metadata of this object. Yields (key, value) pairs, where the value is a string with a special attribute ``is_id`` indicating if it represents the id-ref of an element. See also `iter_meta`. |
Return the metadata (string or element) associated to the given key. If no metadata is associated to the given key, a KeyError is raised. If the given key references an unreachable element, a `NoSuchElementError` or `UnreachableImportError` is raised. All exceptions can be avoided by providing a ``default`` value, that will be returned instead of raising an exception. |
Return the metadata id (string or element) associated to the given key. The returned value is a string with a special attribute ``is_id`` indicating if it represents the id-ref of an element. If no metadata is associated to the given key, a KeyError is raised, unless ``default`` is provideded, in which case its value is returned instead. |
Return the metadata id (string or element) associated to the given key. The returned value is a string with a special attribute ``is_id`` indicating if it represents the id-ref of an element. If no metadata is associated to the given key, a KeyError is raised, unless ``default`` is provideded, in which case its value is returned instead. |
Set the metadata. ``val`` can either be a PackageElement or a string. If an element, it must be directly imported by the package of self, or a ModelError will be raised. Use `val_is_idref` only if you know what you are doing: it forces `val` to be interpreted as an id-ref rather than a plain string; if the id-ref has an import-prefix, only the existence of the import is checked. This is mainly useful for parsers. |
Delete the metadata. Note that if the given key is not in use, this will have no effect. |
Attempts to create a python property in cls mapping to metadata key. If alias is None, key is considered as a URI, and the last part of that URI (after # or /) is used. If default is not provided, an exception is raised whenever the property is accessed when it is not set. Else, the default value will be returned is that case. If doc is not None or not provided, a simple docstring will be generated. Raises an AttributeError if cls already has a member with that name. FIXME: should attach docstring to the property somehow |
|
|
meta
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jul 8 16:00:03 2009 | http://epydoc.sourceforge.net |