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

Class SequenceState

source code

    object --+        
             |        
       cscRoot --+    
                 |    
ContentState_mixin --+
                     |
                    SequenceState

Represent the state of validation against a sequence of particles.

Instance Methods [hide private]
 
__init__(self, group, parent_particle_state)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
accepts(self, particle_state, instance, value, element_use)
Determine whether the provided value can be added to the instance without violating state validation.
source code
 
_verifyComplete(self, parent_particle_state)
Determine whether the deep state is complete without further elements.
source code
 
notifyFailure(self, sub_state, particle_ok)
Invoked by a sub-state to indicate that validation cannot proceed in the current state.
source code

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

Class Variables [hide private]
  __sequence = None
hash(x)
  __particleState = None
hash(x)
  __parentParticleState = None
hash(x)
  __index = -1
  __failed = False
True iff the content provided is in conflict with the sequence requirements.
  __satisfied = False
True iff the content provided is consistent with the sequence requirements.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, group, parent_particle_state)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

accepts(self, particle_state, instance, value, element_use)

source code 

Determine whether the provided value can be added to the instance without violating state validation.

This method must not throw any non-catastrophic exceptions; general failures should be transformed to a False return value.

Parameters:
  • particle_state - The ParticleState instance serving as the parent to this state. The implementation must inform that state when the proposed value completes the content model.
  • instance - An instance of a subclass of basis.complexTypeDefinition, into which the provided value will be stored if it is consistent with the current model state.
  • value - The value that is being validated against the state.
  • element_use - An optional ElementUse instance that specifies the element to which the value corresponds. This will be available when the value is extracted by parsing a document, but will be absent if the value was passed as a constructor positional parameter.
Returns:
True if the value was successfully matched against the state. False if the value did not match against the state.
Overrides: ContentState_mixin.accepts
(inherited documentation)

_verifyComplete(self, parent_particle_state)

source code 

Determine whether the deep state is complete without further elements.

No-op for non-aggregate state. For aggregate state, all contained particles should be checked to see whether the overall model can be satisfied if no additional elements are provided.

This method does not have a meaningful return value; violations of the content model should produce the corresponding exception (generally, MissingContentError).

Parameters:
  • parent_particle_state - the ParticleState for which this state is the term.
Overrides: ContentState_mixin._verifyComplete
(inherited documentation)

notifyFailure(self, sub_state, particle_ok)

source code 

Invoked by a sub-state to indicate that validation cannot proceed in the current state.

Normally this is used when an intermediate content model must reset itself to permit alternative models to be evaluated.

Parameters:
  • sub_state - the state that was unable to accept a value
  • particle_ok - True if the particle that rejected the value is in an accepting terminal state
Overrides: ContentState_mixin.notifyFailure
(inherited documentation)

Class Variable Details [hide private]

__failed

True iff the content provided is in conflict with the sequence requirements.

Specifically, the model requires content that has not been provided. Set within accepts. This state is sticky.

Value:
False

__satisfied

True iff the content provided is consistent with the sequence requirements.

Specifically, nothing has been presented with conflicts with the model. Set within notifyFailure.

Value:
False