Package pyxb :: Package binding :: Module content :: Class AutomatonConfiguration
[hide private]
[frames] | no frames]

Class AutomatonConfiguration

source code

object --+
         |
        AutomatonConfiguration

State for a pyxb.utils.fac.Automaton monitoring content for an incrementally constructed complex type binding instance.


Warning: This is not an implementation of pyxb.utils.fac.Configuration_ABC because we need the step function to return a different type of value.

Instance Methods [hide private]
 
__init__(self, instance)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
reset(self)
Reset the automaton to its initial state.
source code
 
nondeterminismCount(self)
Return the number of pending configurations.
source code
 
step(self, value, element_decl)
Attempt a transition from the current state.
source code
 
resolveNondeterminism(self, prefer_accepting=True)
Resolve any non-determinism in the automaton state.
source code
 
acceptableContent(self)
Return the sequence of acceptable symbols at this state.
source code
 
isAccepting(self, raise_if_rejecting=False)
Return True iff the automaton is in an accepting state.
source code
 
_diagnoseIncompleteContent(self, symbols, symbol_set)
Check for incomplete content.
source code
 
diagnoseIncompleteContent(self)
Generate the exception explaining why the content is incomplete.
source code
 
__resetPreferredSequence(self, instance) source code
 
__discardPreferredSequence(self, preferred_sequence, pi=None)
Extract non-element content from the sequence and return None.
source code
 
__processPreferredSequence(self, preferred_sequence, symbol_set, vc) source code
 
sequencedChildren(self)
Implement pyxb.binding.basis.complexTypeDefinition._validatedChildren.
source code

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

Class Variables [hide private]
  __instance = None
hash(x)
  __cfg = None
hash(x)
  __multi = None
hash(x)
  __preferredSequenceIndex = 0
  __preferredPendingSymbol = None
hash(x)
  __pendingNonElementContent = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, instance)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

reset(self)

source code 

Reset the automaton to its initial state.

Subsequent transitions are expected based on candidate content to be supplied through the step method.

nondeterminismCount(self)

source code 

Return the number of pending configurations.

The automaton is deterministic if exactly one configuration is available.

step(self, value, element_decl)

source code 

Attempt a transition from the current state.

Parameters:
  • value - the content to be supplied. For success the value must be consistent with the recorded symbol (element or wildcard declaration) for a transition from the current automaton state.
  • element_decl - optional pyxb.binding.content.ElementDeclaration that is the preferred symbol for the transition.
Returns:
the cardinal number of successful transitions from the current configuration based on the parameters.

resolveNondeterminism(self, prefer_accepting=True)

source code 

Resolve any non-determinism in the automaton state.

If the automaton has reached a single configuration (was deterministic), this does nothing.

If multiple candidate configurations are available, the best one is selected and applied, updating the binding instance with the pending content.

"Best" in this case is determined by optionally eliminating configurations that are not accepting, then selecting the path where the initial transition sorts highest using the binding sort key (based on position in the original schema).

Parameters:
  • prefer_accepting - eliminate non-accepting paths if any accepting path is present.

acceptableContent(self)

source code 

Return the sequence of acceptable symbols at this state.

The list comprises the pyxb.binding.content.ElementUse and pyxb.binding.content.WildcardUse instances that are used to validate proposed symbols, in preferred order.

isAccepting(self, raise_if_rejecting=False)

source code 

Return True iff the automaton is in an accepting state.

If the automaton has unresolved nondeterminism, it is resolved first, preferring accepting states.

_diagnoseIncompleteContent(self, symbols, symbol_set)

source code 

Check for incomplete content.

Returns:
the topmost configuration (if accepting)
Raises:

sequencedChildren(self)

source code 

Implement pyxb.binding.basis.complexTypeDefinition._validatedChildren.

Go there for the interface.