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

Class 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 --+
                                             |
                            object --+       |
                                     |       |
                               cscRoot --+   |
                                         |   |
        basis._RepresentAsXsdLiteral_mixin --+
                                             |
                                            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

Inherited from object: __delattr__, __format__, __reduce_ex__, __sizeof__, __subclasshook__

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.ExpandedName object>
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
hash(x)
  __durationData = None
hash(x)
  _CF_enumeration = <pyxb.binding.facets.CF_enumeration object>
  _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>
  _CF_whiteSpace = <pyxb.binding.facets.CF_whiteSpace object>
  __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

Inherited from object: __class__

Method Details [hide private]

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

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__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]

__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')

__SimpleTypeDefinition

Value:
<pyxb.xmlschema.structures.SimpleTypeDefinition object>

_httpwww_w3_org2001XMLSchema_duration_FacetMap

Value:
{<class 'pyxb.binding.facets.CF_pattern'>: <pyxb.binding.facets.CF_pat\
tern object>,
 <class 'pyxb.binding.facets.CF_enumeration'>: <pyxb.binding.facets.CF\
_enumeration object>,
 <class 'pyxb.binding.facets.CF_whiteSpace'>: <pyxb.binding.facets.CF_\
whiteSpace object>,
 <class 'pyxb.binding.facets.CF_minInclusive'>: <pyxb.binding.facets.C\
F_minInclusive object>,
...