Package pyxb :: Package utils :: Module utility :: Class _DeconflictSymbols_mixin
[hide private]
[frames] | no frames]

Class _DeconflictSymbols_mixin

source code

object --+
         |
        _DeconflictSymbols_mixin
Known Subclasses:

Mix-in used to deconflict public symbols in classes that may be inherited by generated binding classes.

Some classes, like the pyxb.binding.basis.element or pyxb.binding.basis.simpleTypeDefinition classes in pyxb.binding.basis, have public symbols associated with functions and variables. It is possible that an XML schema might include tags and attribute names that match these symbols. To avoid conflict, the reserved symbols marked in this class are added to the pre-defined identifier set.

Subclasses should create a class-level variable _ReservedSymbols that contains a set of strings denoting the symbols reserved in this class, combined with those from any superclasses that also have reserved symbols. Code like the following is suggested:

  # For base classes (direct mix-in):
  _ReservedSymbols = set([ 'one', 'two' ])
  # For subclasses:
  _ReservedSymbols = SuperClass._ReservedSymbols.union(set([ 'three' ]))

Only public symbols (those with no underscores) are currently supported. (Private symbols can't be deconflicted that easily, and no protected symbols that derive from the XML are created by the binding generator.)

Instance Methods [hide private]

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _ReservedSymbols = set([])
There are no reserved symbols in the base class.
Properties [hide private]

Inherited from object: __class__