Package pyxb :: Package namespace :: Class _NamespaceCategory_mixin |
[hide private]
[frames] | no frames]

# type _NamespaceCategory_mixin

source code

    object --+
             |
       cscRoot --+
                 |
                _NamespaceCategory_mixin

Known Subclasses:
  - Namespace

Mix-in that aggregates those aspects of XMLNamespaces that hold references to categories of named objects.

Arbitrary groups of named objects, each requiring unique names within themselves, can be saved. Unless configured otherwise, the Namespace instance is extended with accessors that provide direct access to individual category maps. The name of the method is the category name with a suffix of "s"; e.g., if a category "typeDefinition" exists, it can be accessed from the namespace using the syntax `ns.typeDefinitions()`.

Note that the returned value from the accessor is a live reference to the category map; changes made to the map are reflected in the namespace.

Instance Methods | [hide private]
_reset(self) CSC extension to reset fields of a Namespace. | source code
categories(self) The list of individual categories held in this namespace. | source code
_categoryMap(self) Return the whole map from categories to named objects. | source code
categoryMap(self, category) Map from local names to NamedObjectMap instances for the given category. | source code
__defineCategoryAccessors(self) Define public methods on the Namespace which provide access to individual NamedObjectMaps based on their category. | source code
configureCategories(self, categories) Ensure there is a map for each of the given categories. | source code
addCategoryObject(self, category, local_name, named_object) Allow access to the named_object by looking up the local_name in the given category. | source code
replaceCategoryObject(self, category, local_name, old_object, new_object) Replace the referenced object in the category. | source code
_replaceComponent_csc(self, existing_def, replacement_def) Replace a component definition where present in the category maps. | source code
__checkCategoriesEmpty(self) | source code
_namedObjects(self) | source code
_loadNamedObjects(self, category_map) Add the named objects from the given map into the set held by this namespace. | source code
hasSchemaComponents(self) Return `True` iff schema components have been associated with this namespace. | source code
_associateOrigins(self, module_record) Add links from pyxb.namespace.archive._ObjectOrigin instances. | source code
_NamespaceCategory_mixin__checkCategoriesEmpty(self) | source code
_NamespaceCategory_mixin__defineCategoryAccessors(self) Define public methods on the Namespace which provide access to individual NamedObjectMaps based on their category. | source code
Inherited from `cscRoot`: `__init__`

Class Variables | [hide private]
| __categoryMap = `None`
| _NamespaceCategory_mixin__categoryMap = `None`

Method Details | [hide private]

### _reset(self) | source code
CSC extension to reset fields of a Namespace. This one handles category-related data.

### configureCategories(self, categories) | source code
Ensure there is a map for each of the given categories. Category configuration activates a namespace. Existing maps are not affected.

### addCategoryObject(self, category, local_name, named_object) | source code
Allow access to the named_object by looking up the local_name in the given category. Raises pyxb.NamespaceUniquenessError if an object with the same name already exists in the category.

### replaceCategoryObject(self, category, local_name, old_object, new_object) | source code
Replace the referenced object in the category. The new object will be added only if the old_object matches the current entry for local_name in the category.

### _replaceComponent_csc(self, existing_def, replacement_def) | source code
Replace a component definition where present in the category maps. Note: This is a high-cost operation, as every item in every category map must be examined to see whether its value field matches `existing_def`.

### _loadNamedObjects(self, category_map) | source code
Add the named objects from the given map into the set held by this namespace. It is an error to name something which is already present.

### hasSchemaComponents(self) | source code
Return `True` iff schema components have been associated with this namespace. This only checks whether the corresponding categories have been added, not whether there are any entries in those categories. It is useful for identifying namespaces that were incorporated through a declaration but never actually referenced.

### _associateOrigins(self, module_record) | source code
Add links from pyxb.namespace.archive._ObjectOrigin instances. For any resolvable item in this namespace from an origin managed by the module_record, ensure that item can be found via a lookup through that origin. This allows these items to be found when a single namespace comprises items translated from different schema at different times using archives to maintain consistency.