Package pyxb :: Package binding :: Module generate
[hide private]
[frames] | no frames]

Module generate

source code

The really ugly code that generates the Python bindings. This whole thing is going to be refactored once customized generation makes it to the top of the task queue.

Classes [hide private]
  ReferenceLiteral
Base class for something that requires fairly complex activity in order to generate its literal value.
  ReferenceFacetMember
  ReferenceWildcard
  ReferenceSchemaComponent
  ReferenceNamespace
  ReferenceExpandedName
  ReferenceFacet
  ReferenceEnumerationMember
  _CTDAuxData
Helper class holding information need in both preparation and generation.
  BindingIO
  _ModuleNaming_mixin
  NamespaceModule
This class represents a Python module that holds all the declarations belonging to a specific namespace.
  NamespaceGroupModule
This class represents a Python module that holds all the declarations belonging to a set of namespaces which have interdependencies.
  Generator
Configuration and data for a single binding-generation action.
Functions [hide private]
 
PrefixModule(value, text=None) source code
 
pythonLiteral(value, **kw) source code
 
_GenerateAutomaton(automaton, template_map, containing_state, lines, **kw) source code
 
GenerateAutomaton(ctd, **kw) source code
 
_useEnumerationTags(td) source code
 
GenerateFacets(td, generator, **kw) source code
 
_VCAppendAuxInit(vc_source, aux_init, binding_module, kw) source code
 
GenerateSTD(std, generator) source code
 
elementDeclarationMap(ed, binding_module, **kw) source code
 
BuildTermTree(node)
Construct a FAC term tree for a particle.
source code
 
BuildPluralityData(term_tree)
Walk a term tree to determine which element declarations may appear multiple times.
source code
 
GenerateCTD(ctd, generator, **kw) source code
 
GenerateED(ed, generator, **kw) source code
 
_PrepareSimpleTypeDefinition(std, generator, nsm, module_context) source code
 
_PrepareComplexTypeDefinition(ctd, generator, nsm, module_context) source code
 
_SetNameWithAccessors(component, container, is_plural, binding_module, nsm, kw) source code
 
GeneratePython(schema_location=None, schema_text=None, namespace=None, module_prefix_elts=[], **kw) source code
Variables [hide private]
  _log = logging.getLogger(__name__)
  __package__ = 'pyxb.binding'
Function Details [hide private]

BuildTermTree(node)

source code 

Construct a FAC term tree for a particle.

This translates the XML schema content model of particles, model groups, element declarations, and wildcards into a tree expressing the corresponding content as a regular expression with numerical constraints.

Parameters:
Returns:
An instance of pyxb.utils.fac.Node

BuildPluralityData(term_tree)

source code 

Walk a term tree to determine which element declarations may appear multiple times.

The bindings need to use a list for any Python attribute corresponding to an element declaration that can occur multiple times in the content model. The number of occurrences is determined by the occurrence constraints on parent particles and the compositors of containing model groups. All this information is available in the term tree used for the content model automaton.

Parameters:
  • term_tree - A FAC term tree representing the content model for a complex data type.
Returns:
Plurality data, as a pair (singles, multiples) where singles is a set of base element declarations that are known to occur at least once and at most once in a region of the content, and multiples is a similar set of declarations that are known to potentially occur more than once.