Package pyxb :: Package binding :: Module datatypes :: Class duration
[hide private]
[frames] | no frames]

type duration

source code

                    object --+                
                             |                
                       cscRoot --+            
                                 |            
     utils.utility.Locatable_mixin --+        
                                     |        
              basis._TypeBinding_mixin --+    
                                         |    
                            object --+   |    
                                     |   |    
utils.utility._DeconflictSymbols_mixin --+    
                                         |    
                        object --+       |    
                                 |       |    
                           cscRoot --+   |    
                                     |   |    
            basis._DynamicCreate_mixin --+    
                                         |    
                basis.simpleTypeDefinition --+
                                             |
                                object --+   |
                                         |   |
                        datetime.timedelta --+
                                             |
                                            duration

XMLSchema datatype duration.

This class uses the Python datetime.timedelta class as its underlying representation. This works fine as long as no months or years are involved, and no negative durations are involved. Because the XML Schema value space is so much larger, it is kept distinct from the Python value space, which reduces to integral days, seconds, and microseconds.

In other words, the implementation of this type is a little shakey.

Nested Classes [hide private]
_XsdBaseType
XMLSchema datatype anySimpleType.
Instance Methods [hide private]
 
negativeDuration(self) source code
 
durationData(self) source code

Inherited from basis.simpleTypeDefinition: __init__, pythonLiteral, xsdConstraintsOK, xsdLiteral, xsdValueLength

Inherited from basis._TypeBinding_mixin: __setattr__, toDOM, toxml, validateBinding

Inherited from datetime.timedelta: __abs__, __add__, __div__, __eq__, __floordiv__, __ge__, __getattribute__, __gt__, __hash__, __le__, __lt__, __mul__, __ne__, __neg__, __nonzero__, __pos__, __radd__, __rdiv__, __reduce__, __repr__, __rfloordiv__, __rmul__, __rsub__, __str__, __sub__, total_seconds

Class Methods [hide private]
 
XsdLiteral(cls, value)
Convert from a python value to a string usable in an XML document.
source code

Inherited from basis.simpleTypeDefinition: PythonLiteral, SimpleTypeDefinition, XsdConstraintsOK, XsdSuperType, XsdValueLength

Inherited from basis._TypeBinding_mixin: Factory

Static Methods [hide private]
a new object with type S, a subtype of T
__new__(cls, *args, **kw) source code
Class Variables [hide private]
  _ExpandedName = pyxb.namespace.XMLSchema.createExpandedName('d...
The expanded name of the component.
  __Lexical_re = re.compile(r'^(?P<neg>-?)P((?P<years>\d+)Y)?((?...
  __XSDFields = ('years', 'months', 'days', 'hours', 'minutes', ...
  __PythonFields = ('days', 'seconds', 'microseconds', 'minutes'...
  __negativeDuration = None
  __durationData = None
  _CF_enumeration = <pyxb.binding.facets.CF_enumeration object a...
  _CF_maxExclusive = <pyxb.binding.facets.CF_maxExclusive object...
  _CF_maxInclusive = <pyxb.binding.facets.CF_maxInclusive object...
  _CF_minExclusive = <pyxb.binding.facets.CF_minExclusive object...
  _CF_minInclusive = <pyxb.binding.facets.CF_minInclusive object...
  _CF_pattern = <pyxb.binding.facets.CF_pattern object at 0x2446...
  _CF_whiteSpace = <pyxb.binding.facets.CF_whiteSpace object at ...
  __SimpleTypeDefinition = <pyxb.xmlschema.structures.SimpleType...
  _httpwww_w3_org2001XMLSchema_duration_FacetMap = {<class 'pyxb...

Inherited from basis.simpleTypeDefinition (private): _ReservedSymbols

Inherited from basis._TypeBinding_mixin: _validationConfig_

Inherited from datetime.timedelta: max, min, resolution

Properties [hide private]

Inherited from basis._TypeBinding_mixin (private): _validationConfig

Inherited from datetime.timedelta: days, microseconds, seconds

Method Details [hide private]

__new__(cls, *args, **kw)
Static Method

source code 
Returns: a new object with type S, a subtype of T
Overrides: datetime.timedelta.__new__
(inherited documentation)

XsdLiteral(cls, value)
Class Method

source code 

Convert from a python value to a string usable in an XML document.

This should be implemented in the subclass.

Overrides: basis.simpleTypeDefinition.XsdLiteral
(inherited documentation)

Class Variable Details [hide private]

_ExpandedName

The expanded name of the component.

Value:
pyxb.namespace.XMLSchema.createExpandedName('duration')

__Lexical_re

Value:
re.compile(r'^(?P<neg>-?)P((?P<years>\d+)Y)?((?P<months>\d+)M)?((?P<da\
ys>\d+)D)?(?P<Time>T((?P<hours>\d+)H)?((?P<minutes>\d+)M)?(((?P<second\
s>\d+)(?P<fracsec>\.\d+)?)S)?)?$')

__XSDFields

Value:
('years', 'months', 'days', 'hours', 'minutes', 'seconds')

__PythonFields

Value:
('days', 'seconds', 'microseconds', 'minutes', 'hours')

_CF_enumeration

Value:
<pyxb.binding.facets.CF_enumeration object at 0x2445090>

_CF_maxExclusive

Value:
<pyxb.binding.facets.CF_maxExclusive object at 0x2446fd0>

_CF_maxInclusive

Value:
<pyxb.binding.facets.CF_maxInclusive object at 0x2445110>

_CF_minExclusive

Value:
<pyxb.binding.facets.CF_minExclusive object at 0x2445050>

_CF_minInclusive

Value:
<pyxb.binding.facets.CF_minInclusive object at 0x2446f90>

_CF_pattern

Value:
<pyxb.binding.facets.CF_pattern object at 0x2446f50>

_CF_whiteSpace

Value:
<pyxb.binding.facets.CF_whiteSpace object at 0x24450d0>

__SimpleTypeDefinition

Value:
<pyxb.xmlschema.structures.SimpleTypeDefinition object at 0x288d510>

_httpwww_w3_org2001XMLSchema_duration_FacetMap

Value:
{<class 'pyxb.binding.facets.CF_pattern'>: <pyxb.binding.facets.CF_pat\
tern object at 0x2446f50>,
 <class 'pyxb.binding.facets.CF_enumeration'>: <pyxb.binding.facets.CF\
_enumeration object at 0x2445090>,
 <class 'pyxb.binding.facets.CF_maxInclusive'>: <pyxb.binding.facets.C\
F_maxInclusive object at 0x2445110>,
 <class 'pyxb.binding.facets.CF_minExclusive'>: <pyxb.binding.facets.C\
F_minExclusive object at 0x2445050>,
...