
f#]c           @   sl  d  Z  d d l Z d d l Z d d l m Z d d l Z d d l m Z d d l	 Z
 d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m Z d d l m Z m Z d d l Z e j e  Z e a d d l m Z d e j j  e j j! j" e j# j$ j% e j# j$ j& f d	     YZ' d
 e j( f d     YZ) d e j( f d     YZ* d e j( f d     YZ+ d e, f d     YZ- d e j# j$ j% e j( f d     YZ. d e j( f d     YZ/ d e j( f d     YZ0 d e j( f d     YZ1 d e' e. e j j2 j3 e+ e/ e0 f d     YZ4 d e' e j j2 j3 e/ f d     YZ5 d e) e' e. e j j2 j3 e+ e/ e0 f d     YZ6 d  e' e. e j j2 j3 e+ e1 f d!     YZ7 d" e7 e* f d#     YZ8 d$ e' e. e j j2 j3 e+ e1 f d%     YZ9 d& e' e. e+ f d'     YZ: d( e) e' e+ f d)     YZ; d* e) e' e j j2 j3 f d+     YZ< d, e) e' e+ f d-     YZ= d. e' e. e+ e j j2 j3 f d/     YZ> d0 e' e. e+ f d1     YZ? d2 e' f d3     YZ@ d4 e' e. e j j2 j3 e+ f d5     YZA d6 eA e* f d7     YZB d8 e+ f d9     YZC d: e' f d;     YZD d<   ZE d d lF ZF d d lG Z e j jH jI eF jJ e  d S(=   s  Classes corresponding to W3C XML Schema components.

Class names and behavior should conform to the schema components described in
U{XML Schema Part 1: Structures<http://www.w3.org/TR/xmlschema-1/>}.
References to sections in the documentation of this module generally refers to
that document.

Each class has a C{CreateFromDOM} class method that creates an instance and
initializes it from a DOM node.  Only the L{Wildcard}, L{Particle}, and
L{ModelGroup} components are created from non-DOM sources.  However, the
requirements on DOM interface are restricted to attributes, child nodes, and
basic fields, though all these must support namespaces.

@group Mixins: *_mixin
@group Ur Type Specializations: *UrType*
@group Utilities: _ImportElementInformationItem

iN(   t   Node(   t   parse(   t   basist	   datatypest   facets(   t   domutilst   six(   t	   XMLSchemat   _SchemaComponent_mixinc           B   s  e  Z d  Z e   Z d   Z d   Z d! Z e j	 d  d! Z
 d! Z d! Z e j	 d  d! Z e j	 d  d   Z d! Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d! Z e j	 d  d   Z d! Z e j	 d  d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" d   Z# d   Z$ d   Z% d   Z& d! Z' d   Z( d   Z) d! Z* e j	 d   RS("   s  A mix-in that marks the class as representing a schema component.

    This exists so that we can determine the owning schema for any
    component we encounter.  This is normally done at construction
    time by passing a C{schema=val} parameter to the constructor.
    c         C   s/   |  j  d k r( t j d |  f   n  |  j  S(   s  The namespace context for this schema.

        This defines where it looks things up, where it puts things it
        creates, the in-scope namespace declarations, etc.  Must be defined
        for anything that does any sort of QName interpretation.  The value is
        generally a reference to a namespace context associated with the DOM
        element node corresponding to this component.s2   Attempt to access missing namespace context for %sN(   t(   _SchemaComponent_mixin__namespaceContextt   Nonet   pyxbt
   LogicError(   t   self(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _namespaceContextJ   s    c         C   s   |  j    d  |  _ |  S(   N(   t   schemaOrderSortKeyR
   R	   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _clearNamespaceContextU   s    
	t   namespaceContextt   ownert   ownedComponentc         C   s   |  j  S(   sN   The context into which declarations in or subordinate to this node are placed.(   t   _SchemaComponent_mixin__scope(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _scopeq   s    c         C   s   t  j |  j    S(   s9   Return True iff nobody has defined a scope for this node.(   t   _ScopedDeclaration_mixint   ScopeIsIndeterminateR   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _scopeIsIndeterminatev   s    c         C   s   t  j |  j    S(   s0   Return True iff this component has global scope.(   R   t   ScopeIsGlobalR   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _scopeIsGlobalz   s    c         C   sL   |  j  d k	 s t  t |  t  s* t  t | t  s? t  | |  _ |  S(   s  Set the scope of this instance after construction.

        This should only be invoked on cloned declarations being incorporated
        into a complex type definition.  Note that the source of the clone may
        be any scope: indeterminate if from a model (attribute) group
        definition; global if a reference to a global component; or ctd if
        inherited from a complex base type.N(   t#   _SchemaComponent_mixin__cloneSourceR
   t   AssertionErrort
   isinstanceR   t   ComplexTypeDefinitionR   (   R   t   ctd(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt	   _setScope~   s
    	c         O   s  t    |  _ | j d  |  _ | j d  |  _ | j d  } | j d  } |  j d
 k r | d
 k r{ t j d   n  t j j	 j
 |  |  _ n  |  j d
 k r t j d   n  t t |   j | |   |  j   j   j |   |  j |  t | t j j j  r$|  j | j    n. t | t j j j  rR|  j | j    n  | j d  } | d
 k	 r|  j | j    n1 t |  t t t f  st d t |   f   t |  t  rd	 t  |  j j!    k  st  n  d
 S(   s  Initialize portions of a component.

        @keyword scope: The scope in which the component is defined

        @keyword namespace_context: The NamespaceContext to use within this component

        @keyword node: If no C{namespace_context} is provided, a DOM node must
        be provided from which a namespace context can be identified.

        @keyword owner: Reference to the component that owns this one (the
        immediately enclosing component).  Is C{None} in the case of top-level
        components.

        @keyword schema: Reference to the L{Schema} component to which the
        component belongs.  Required for every component except L{Schema},
        L{Annotation}, and L{Wildcard}.
        t   scopet   namespace_contextt   nodeR   sD   Schema component constructor must be given namespace_context or nodes)   No namespace_context for schema componentt   schemas   No origin available for type %si   N("   t   sett'   _SchemaComponent_mixin__ownedComponentst   getR   R	   R
   R   R   t	   namespacet   NamespaceContextt   GetNodeContextt   superR   t   __init__R   t   targetNamespacet   _associateComponentt	   _setOwnerR   t   utilst   utilityt   Locatable_mixint   _setLocationt	   _locationt   _setObjectOrigint   originRecordt   Schemat
   Annotationt   WildcardR   t   typeR   t   lent   inScopeNamespaces(   R   t   argst   kwR#   R   R$   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,      s0    1c         C   s    |  j    j   j |  d  |  S(   s   Dissociate this component from its owning namespace.

        This should only be done whwen there are no other references to the
        component, and you want to ensure it does not appear in the model.N(   R   R-   t   _replaceComponentR
   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _dissociateFromNamespace   s    c         C   sc   | d k	 r_ |  j d k sC |  j | k sC t d |  j | f   | |  _ | j j |   n  |  S(   s   Set the owner of this component.

        If C{owner} is C{None}, this has no effect.  Otherwise, the
        component's current owner must be either C{None} or the same as the
        input C{owner}.s   Owner was %s set to %sN(   R
   t   _SchemaComponent_mixin__ownerR   R&   t   add(   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR/      s
    7	c         C   s   |  j  S(   N(   RA   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR      s    t   cloneSourcec         C   s   |  j  S(   sa   The source component from which this is a clone.

        Returns C{None} if this is not a clone.(   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _cloneSource   s    t   clonesc         C   s   |  j  S(   sr   The set of instances cloned from this component.

        Returns None if no instances have been cloned from this.(   t   _SchemaComponent_mixin__clones(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _clones   s    c            s     j  d k	 s t  | d } d   _ d   _ |   _ t   t  oU t | t  s_ t  t	     _
 d   _ | j   j   j      j d k r | j     _ n    f d   } t t t    d |  |   S(   s  Virtual method to clear whatever attributes should be reset in a
        cloned component.

        This instance should be an instance created by copy.copy().

        The implementation in this class clears the owner and dependency
        relations.

        Returns C{self}.
        R   c             s     S(   N(    (   t   _argst   _kw(   R   (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   <lambda>  s    t   _resetClone_cscN(   R   R
   R   t%   _SchemaComponent_mixin__nameInBindingt+   _SchemaComponent_mixin__uniqueNameInBindingRA   R   R   R7   R%   R&   RF   R   R-   R.   R	   t   getattrR+   R   (   R   R>   R   t   self_fn(    (   R   sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRK      s    
			%	c         C   s   t  |  t j j j  r- |  j   s- t  n  | d k	 s? t  t j |   } |  | _	 |  j
 d k ru t   |  _
 n  |  j
 j |  | j d | d |  t  | t j j j  r | j   s t  n  | S(   s   Create a copy of this instance suitable for adoption by some other
        component.

        This is used for creating a locally-scoped declaration from a
        declaration in a named model or attribute group.R   t   originN(   R   R   R(   t
   resolutiont   _Resolvable_mixint
   isResolvedR   R
   t   copyR   RF   R%   RB   RK   (   R   R   RP   t   that(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _clone  s    	c         C   s   t  |  t t f  S(   sN   Return True iff this component is a simple or complex type
        definition.(   R   t   SimpleTypeDefinitionR   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   isTypeDefinition  s    c         C   s   t  |  t t f  S(   sN   Return True iff this component is a simple or complex type
        definition.(   R   t   _SimpleUrTypeDefinitiont   _UrTypeDefinition(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   isUrTypeDefinition$  s    c         C   sQ   t  |  t  r |  j   St  |  t  rM |  j   } | d k	 rM | j   Sn  d S(   s   Return the name of this component, as best it can be determined.

        For example, ModelGroup instances will be named by their
        ModelGroupDefinition, if available.  Returns None if no name can be
        inferred.N(   R   t   _NamedComponent_mixint   namet
   ModelGroupt   modelGroupDefinitionR
   (   R   t   agd(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt
   bestNCName)  s    
c         C   s   |  j  S(   s  Return the name by which this component is known in the binding module.

        @note: To support builtin datatypes, type definitions with an
        associated L{pythonSupport<SimpleTypeDefinition.pythonSupport>} class
        initialize their binding name from the class name when the support
        association is created.  As long as no built-in datatype conflicts
        with a language keyword, this should be fine.(   RL   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   nameInBinding7  s    c         C   s   |  j  S(   sF   Return the name by which this component is known in the binding class.(   RM   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   uniqueNameInBindingA  s    c         C   s%   |  j    p$ t |  t  o$ |  j   S(   s  Return C{True} iff this is a component which has a user-visible
        Python construct which serves as its binding.

        Type definitions have classes as their bindings.  Global element
        declarations have instances of L{pyxb.binding.basis.element} as their
        bindings.(   RX   R   t   ElementDeclarationR   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt
   hasBindingE  s    c         C   s   | |  _  |  S(   sJ   Set the name by which this component shall be known in the binding module.(   RL   (   R   t   name_in_binding(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   setNameInBindingN  s    	c         C   s   | |  _  |  S(   sI   Set the name by which this component shall be known in the binding class.(   RM   (   R   t   unique_name(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   setUniqueNameInBindingS  s    	c            sb     | k s t     f d   } t t t    d |  |    j d k r^ | j   _ n    S(   s   Override fields in this instance with those from the other.

        Post-extended; description in leaf implementation in
        ComplexTypeDefinition and SimpleTypeDefinition.c             s     S(   N(    (   RH   RI   (   R   (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRJ   ^  s    t   _updateFromOther_cscN(   R   RN   R+   R   RL   R
   (   R   t   otherRO   (    (   R   sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRj   X  s    c         C   s  |  j  d k rd } t |  t  rT |  j   } | d k rx |  j   j   } qx n$ t |  t  rx |  j   j   } n  d } | d k	 r | j   d k	 r | j   } n  | g } |  j	   } d } | d k	 r | j
 d k	 r | j
 } n  | j |  d } | d k	 r'| j d k	 r'| j } n  | j |  d } | d k	 ra| j d k	 ra| j } n  | j |  t |  |  _  n  |  j  S(   sK  A key to be used when sorting components for binding generation.

        This is a tuple comprising the namespace URI, schema location, and
        line and column of the component definition within the schema.  The
        purpose is to ensure consistent order of binding components in
        generated code, to simplify maintenance involving the generated
        sources.

        To support Python 3 values that are C{None} are replaced with the
        default value for whatever type belongs in the corresponding
        position: (uri:str, locbase:str, locline:int, loccol:int) t    i    N(   t*   _SchemaComponent_mixin__schemaOrderSortKeyR
   R   R\   t   bindingNamespaceR   R-   t   _ParticleTree_mixint   uriR4   t   locationBaset   appendt
   lineNumbert   columnNumbert   tuple(   R   t   nst   ns_urit   key_eltst   loct   v(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   e  s6    	c         C   s   |  j  d k	 s t  |  j  S(   s  A sort key matching preferred content order.

        This is an ordinal (integer) used to control which candidate
        transitions are attempted first when testing symbols against the
        content automaton state.

        @note: The value associated with a node (especially a L{ModelGroup} or
        L{Particle} will be different for different complex types, and is
        valid only during generation of the automata code for a given type.N(   t'   _SchemaComponent_mixin__facStateSortKeyR
   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   facStateSortKey  s    
c         C   s   | |  _  d S(   sS   Set the automata state sort key.

        @param key: the ordinal used for sorting.N(   R{   (   R   t   key(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _setFacStateSortKey  s    R|   N(+   t   __name__t
   __module__t   __doc__R%   t(   _SchemaComponent_mixin__PrivateTransientR   R   R
   R	   RB   RL   RM   RA   R&   R   R   R   R   R    R,   R@   R/   R   R   RD   RF   RG   RK   RV   RX   R[   Ra   Rb   Rc   Re   Rg   Ri   Rj   R   Rm   R|   R~   R{   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   ;   sX   									2											
							'		Ro   c           B   s   e  Z d    Z RS(   c         C   s   t  d |  j j f   d S(   sU  Mix-in supporting walks of L{Particle} trees.

        This invokes a provided function on each node in a tree defining the
        content model of a particle, both on the way down the tree and on the
        way back up.  A standard implementation would be::

          def _walkParticleTree (self, visit, arg):
            visit(self, True, arg)
            self.__term.walkParticleTree(visit, arg)
            visit(self, False, arg)

        @param visit: A callable with parameters C{node, entering, arg} where
        C{node} is an instance of a class inheriting L{_ParticleTree_mixin},
        C{entering} indicates tree transition status, and C{arg} is a
        caller-provided state parameter.  C{entering} is C{True} if C{node}
        has particle children and the call is before they are visited;
        C{None} if the C{node} has no particle children; and C{False} if
        C{node} has particle children and they have been visited.

        @param arg: The caller-provided state parameter to be passed along
        with the node and entry/exit status in the invocation of C{visit}.
        s   %s._walkParticleTreeN(   t   NotImplementedErrort	   __class__R   (   R   t   visitt   arg(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _walkParticleTree  s    (   R   R   R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRo     s   t   _Singleton_mixinc           B   s   e  Z d  Z d   Z RS(   s   This class is a mix-in which guarantees that only one instance
    of the class will be created.  It is used to ensure that the
    ur-type instances are pointer-equivalent even when unpickling.
    See ComplexTypeDefinition.UrTypeDefinition().c         O   sU   d |  j  f } | |  j k rJ t |  | t t |   j |  | |   n  |  j | S(   Ns   _%s__singleton(   R   t   __dict__t   setattrR+   R   t   __new__(   t   clsR=   R>   t   singleton_property(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    +(   R   R   R   R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s   t   _Annotated_mixinc           B   s8   e  Z d  Z d Z d   Z d   Z d   Z d   Z RS(   s7  Mix-in that supports an optional single annotation that describes the component.

    Most schema components have annotations.  The ones that don't are
    L{AttributeUse}, L{Particle}, and L{Annotation}.  L{ComplexTypeDefinition}
    and L{Schema} support multiple annotations, so do not mix-in this
    class.c         O   s/   t  t |   j | |   | j d  |  _ d  S(   Nt
   annotation(   R+   R   R,   R'   t   _Annotated_mixin__annotation(   R   R=   R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,     s    c         C   s\   t  j | d  } | d  k	 rX i  } t |  t  r@ |  | d <n  t j | |  |  _ n  d  S(   NR   R   (   R   t   LocateUniqueChildR
   R   R   R8   t   CreateFromDOMR   (   R   R#   t   cnR>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _annotationFromDOM  s    c            sP     | k s t     f d   } t t t    d |  |  | j   _   S(   s   Override fields in this instance with those from the other.

        Post-extended; description in leaf implementation in
        ComplexTypeDefinition and SimpleTypeDefinition.c             s     S(   N(    (   RH   RI   (   R   (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRJ     s    Rj   (   R   RN   R+   R   R   (   R   Rk   RO   (    (   R   sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRj     s
    c         C   s   |  j  S(   N(   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    N(	   R   R   R   R
   R   R,   R   Rj   R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s   			t   _PickledAnonymousReferencec           B   s   e  Z d  Z e j j j j   Z d Z
 d Z d   Z e d    Z d   Z d   Z d   Z d   Z e Z e Z e Z e Z e Z e Z e Z d   Z RS(	   s  A helper that encapsulates a reference to an anonymous type in a different namespace.

    Normally references to components in other namespaces can be made using
    the component's name.  This is not the case when a namespace derives from
    a base type in another namespace and needs to reference the attribute or
    element declarations held in that type.  If these declarations are local
    to the base complex type, they cannot be identified by name.  This class
    provides a pickleable representation for them that behaves rather like an
    L{pyxb.namespace.ExpandedName} instance in that it can be used to
    dereference various component types.c         C   s+   | |  _  | |  _ |  j d k	 s' t  d S(   sm  Create a new anonymous reference.

        @param namespace: The namespace in which the component is declared.
        @type namespace: L{pyxb.namespace.Namespace}
        @param anonymous_name: A generated name guaranteed to be unique within
        the namespace.  See L{_NamedComponent_mixin._anonymousName}.
        @type anonymous_name: C{basestring}.
        N(   t%   _PickledAnonymousReference__namespacet)   _PickledAnonymousReference__anonymousNameR
   R   (   R   R(   t   anonymous_name(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,     s    			c         C   s=   t  | t  s9 t  | t  s$ t  t j j |  } n  | S(   s   Return the component referred to by the provided reference,
        regardless of whether it is a normal or anonymous reference.(   R   R   Ru   R   R   R(   t   ExpandedName(   R   t   object_reference(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   FromPickled  s    c         C   s   |  j  S(   N(   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR(     s    c         C   s   |  j  S(   N(   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   anonymousName  s    c         C   s   |  j  j   S(   s$   Forward to the associated namespace.(   R   t   validateComponentModel(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s   |  j  j |  j  j |  j  S(   N(   R   t   categoryMapt-   _PickledAnonymousReference__AnonymousCategoryR'   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __lookupObject  s    c         C   s    d t  j j |  j |  j  f S(   sH   Represent the anonymous reference in a form recognizable by a developer.s   ANONYMOUS:%s(   R   R(   R   R   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __str__)  s    N(   R   R   R   R   R(   t   archivet   NamespaceArchivet   _AnonymousCategoryR   R
   R   R   R,   t   classmethodR   R   R   t(   _PickledAnonymousReference__lookupObjectt   typeDefinitiont   attributeGroupDefinitionR_   t   attributeDeclarationt   elementDeclarationt   identityConstraintDefinitiont   notationDeclarationR   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s$   
						R\   c           B   sG  e  Z d  Z e   Z d   Z d Z d   Z d d d  Z	 d d  Z
 d Z d   Z d Z d   Z d   Z d Z d   Z d Z e j j j j   Z d	   Z d
   Z d Z e j d  d   Z d   Z d   Z d   Z  d   Z! d   Z" d   Z# d   Z$ d   Z% d   Z& d   Z' d   Z( d   Z) d   Z* d   Z+ RS(   sa  Mix-in to hold the name and targetNamespace of a component.

    The name may be None, indicating an anonymous component.  The
    targetNamespace is never None, though it could be an empty namespace.  The
    name and targetNamespace values are immutable after creation.

    This class overrides the pickling behavior: when pickling a Namespace,
    objects that do not belong to that namespace are pickled as references,
    not as values.  This ensures the uniqueness of objects when multiple
    namespace definitions are pre-loaded.

    This class must follow L{_SchemaComponent_mixin} in the MRO.
    c         C   s   |  j  S(   s   Name of the component within its scope or namespace.

        This is an NCName.  The value isNone if the component is
        anonymous.  The attribute is immutable after the component is
        created creation.(   t   _NamedComponent_mixin__name(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR]   >  s    c         C   s   |  j  d k S(   s>   Return true iff this instance is locally scoped (has no name).N(   R   R
   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   isAnonymousG  s    c         C   sQ  |  j  d  k	 r d  S|  j   s% t  | d  k	 s7 t  |  j   d  k	 rd |  j   | k sd t  n  |  j   d  k	 r |  j   | k s t  n  | d  k r.|  j   } | d  k r |  j   } n  | d  k r d } n  | d  k	 r d | | f } n  t j	 j
 j | t t j | j |  j     } n  | |  _  | j |  j | |   d  S(   Nt   ANON_IN_GROUPs   %s_%s(   t$   _NamedComponent_mixin__anonymousNameR
   t+   _NamedComponent_mixin__needAnonymousSupportR   Rn   R-   Rb   R]   R   R0   R1   t
   MakeUniqueR%   R   t   iterkeysR   t(   _NamedComponent_mixin__AnonymousCategoryt   addCategoryObject(   R   R(   t	   unique_idt	   anon_name(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _setAnonymousNameK  s&    	6	c         C   sJ   |  j  d  k	 sC t d t |   t |   |  j   |  j   f   |  j  S(   Ns%   %x %s %s in %s missing anonymous name(   R   R
   R   t   idR:   R]   R-   (   R   R(   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _anonymousName`  s    Cc         C   s   |  j  S(   s  The targetNamespace of a component.

        This is None, or a reference to a Namespace in which the
        component is declared (either as a global or local to one of
        the namespace's complex type definitions).  This is immutable
        after creation.
        (   t&   _NamedComponent_mixin__targetNamespace(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR-   e  s    c         C   s   |  j  S(   s:   The namespace in which this component's binding is placed.(   t'   _NamedComponent_mixin__bindingNamespace(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRn   p  s    c         C   s   | |  _  d  S(   N(   R   (   R   R(   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _setBindingNamespaces  s    c         C   s   |  j  S(   s  A map from template keys to component-specific values.

        This is used in code generation to maintain unique names for accessor
        methods, identifiers, keys, and other characteristics associated with
        the code generated in support of the binding for this component.(   t"   _NamedComponent_mixin__templateMap(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _templateMapw  s    c         C   s,   |  j    p+ |  j   o+ t |  t t f  S(   N(   R   R   R   t   AttributeGroupDefinitiont   ModelGroupDefinition(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __needAnonymousSupport  s    c         C   s   |  j  S(   sn  Return the schema component from which this component was defined.

        Needed so we can distinguish components that came from different
        locations, since that imposes an external order dependency on them and
        on cross-namespace inclusions.

        @note: This characteristic is removed when the component is stored in
        a namespace archive.(   t   _NamedComponent_mixin__schema(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _schema  s    	R$   c            s\     j    r.   j | j   d | j   n    f d   } t t t    d |  |  S(   NR   c             s     S(   N(    (   RH   RI   (   R   (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRJ     s    t   _prepareForArchive_csc(   R   R   R(   t   generationUIDRN   R+   R\   (   R   t   module_recordRO   (    (   R   sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    "c         C   s   t  |  j   t  r( |  j   j |  S|  j   d k	 sn t d |  |  j   |  j   |  j   j   f   |  j	   d k	 s t  |  j	   j
   | j
   k } | S(   s  Return C{True} if this component should be pickled by value in the
        given namespace.

        When pickling, a declaration component is considered to belong to the
        namespace if it has a local scope which belongs to the namespace.  In
        that case, the declaration is a clone of something that does not
        belong to the namespace; but the clone does.

        @see: L{_bindsInNamespace}

        @return: C{False} if the component should be pickled by reference.
        s/   %s has no tns, scope %s, location %s, schema %sN(   R   R   R   t   _picklesInArchiveR-   R
   R   R4   R   t   _objectOriginR   (   R   R   t   new_flag(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    Fc         C   s   |  j    | d f k S(   s  Return C{True} if the binding for this component should be
        generated in the given namespace.

        This is the case when the component is in the given namespace.  It's
        also the case when the component has no associated namespace (but not
        an absent namespace).  Be aware that cross-namespace inheritance means
        you will get references to elements in another namespace when
        generating code for a subclass; that's fine, and those references
        should not be generated locally.
        N(   R-   R
   (   R   Rv   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _bindsInNamespace  s    c         C   s5   |  j    d k r d St j j |  j   |  j     S(   s9   Return the L{pyxb.namespace.ExpandedName} of this object.N(   R]   R
   R   R(   R   R-   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   expandedName  s    c   	      O   s  d t  |  k r. t t |   j |   } | S| \ } } } t j |  } | j   d } t | t	 t f  rdt j |  } | j
   | j
   k r | j   d | j
   j   k s t  n  | j   } | d k r t j d | f   n  t | t  r| j |  } n! t | t  r6| j |  } n  | d k rpt j d | | | f   qpnt j |  st j |  rpt | t  st | t  r| j   } n t | t  r| j   } nx t | t  r| j   } nZ t | t  r	| j   } n< t | t  r'| j   } n t | t   rE| j!   } n  | d k rpt j d | | f   qpn  | d k rt j d | | | d k rd p| j"   t# |  | f   n  | S(	   s5  Pickling support.

        Normally, we just create a new instance of this class.
        However, if we're unpickling a reference in a loadable schema,
        we need to return the existing component instance by looking
        up the name in the component map of the desired namespace.  We
        can tell the difference because no normal constructors that
        inherit from this have positional arguments; only invocations
        by unpickling with a value returned in __getnewargs__ do.

        This does require that the dependent namespace already have
        been validated (or that it be validated here).  That shouldn't
        be a problem, except for the dependency loop resulting from
        use of xml:lang in the XMLSchema namespace.  For that issue,
        see pyxb.namespace._XMLSchema.
        i    R   s    Unable to resolve local scope %ss&   Unable to resolve %s as %s in scope %ss   Unable to resolve %s as %ss@   Unable to resolve reference %s, scope %s ns %s type %s, class %ss	   <unknown>N($   R;   R+   R\   R   R   R   R   R
   R   Ru   R(   t
   categoriesR   R   R   t   SchemaValidationErrort
   issubclasst   AttributeDeclarationt    lookupScopedAttributeDeclarationRd   t   lookupScopedElementDeclarationR   R   R   RW   R   R   R   R   R_   R   R   t   IdentityConstraintDefinitionR   R-   R:   (	   R   R=   R>   t   rvR   R!   t   iclst	   scope_reft	   scope_ctd(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     sN    

!"Cc         O   s   d t  |  k s t  | j d  } | d  k s[ d | j d  k s[ t d | f   | |  _ | j d |  j   j    |  _ | j d  |  _	 i  |  _
 | j d  |  _ |  j   d  k	 s t  t t |   j | |   d  S(   Ni    R]   t   :s   name %st   target_namespacet   binding_namespaceR$   (   R;   R   R'   R
   t   findR   R   R-   R   R   R   R   R   R+   R\   R,   (   R   R=   R>   R]   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,     s    4	!	c         C   s/   |  | k p. |  j    o. |  j   | j   k S(   sH  Return true iff this and the other component share the same name and target namespace.

        Anonymous components are inherently name inequivalent, except to
        themselves.  This relies on equivalence as defined for
        pyxb.namespace.ExpandedName, for which None is not equivalent to any
        non-anonymous name.(   R   R   (   R   Rk   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   isNameEquivalent  s    c         C   s%   t  |   t  |  k o$ |  j |  S(   s   Return True iff this and the other component have matching types.

        It appears that name equivalence is used; two complex type definitions
        with identical structures are not considered equivalent (at least, per
        XMLSpy).
        (   R:   R   (   R   Rk   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   isTypeEquivalent!  s    c         C   s   |  } x | d k	 r | j |  r( t S| j   r@ | j   sF t  t |  t  rq |  j | j   k r t	 SnG t |  t
  s t  |  j | j   k r t	 S| j   j |  s t	 S| j   } q	 Wt	 S(   sJ  Return True iff this type can serve as a restriction of the other
        type for the purposes of U{element consistency<http://www.w3.org/TR/xmlschema-1/#cos-element-consistent>}.

        It appears that name equivalence is normally used; two complex type
        definitions with identical structures are not considered equivalent
        (at least, per XMLSpy).  However, some OpenGIS standards demonstrate
        that derivation by restriction from the other type is also acceptable.
        That opens a whole can of worms; see
        L{ElementDeclaration.isAdaptable}.
        N(   R
   R   t   TrueRS   R   R   R   t   DM_restrictiont   derivationMethodt   FalseRW   t   _DA_restrictiont   _derivationAlternativet   baseTypeDefinitiont   isDerivationConsistent(   R   Rk   t   this(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   *  s    c         C   sM   |  j    r= |  j   d  k	 s$ t  t |  j   |  j    S|  j   j   S(   N(   R   R   R
   R   R   R-   R   t   uriTuple(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _picklingReferenceH  s    c         C   sj   |  j    d  k r t St j j j j   } | d  k r; t S|  j   d  k	 sS t	  |  j
 |  rf t St S(   N(   R-   R
   R   R   R(   R   R   t   PicklingArchiveR   R   R   R   (   R   t   pickling_archive(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __pickleAsReferenceN  s    c         C   s>   |  j    r |  j   S|  j   d  k r+ n  t t |   j   S(   N(   t(   _NamedComponent_mixin__pickleAsReferenceR   R-   R
   R+   R\   t   __getstate__(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   `  s
    
c         C   s  |  j    r|  j   } t |  t  r |  j |  j   k r? q t |  j   t  r |  j   j   } t | t t	 f  s t
 |    q |  j   s t
  nZ t |  t  s t
 d |  f   t | t  s t
 d |  |  j   | |  j   f   |  j   | |  j f } | Sd S(   s   Pickling support.

        If this instance is being pickled as a reference, provide the
        arguments that are necessary so that the unpickler can locate
        the appropriate component rather than create a duplicate
        instance.sA   Pickling unnamed component %s in indeterminate scope by references   %s %s %s %s(    (   R   R   R   R   t   SCOPE_globalR!   R   R   Ru   R   R   R   R\   R]   R   R   (   R   R!   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __getnewargs__y  s    $"8c         C   s   t  | t  ri |  j   d  k	 s' t  |  j   j   | d k sI t  |  j   | d k se t  d  St  | t  r |  j   d  k	 s t  |  j   | j   k s t  |  j	   s t  |  j
   | j   k s t  d  S|  j j |  d  S(   Ni    i   (   R   Ru   R-   R
   R   Rp   R]   R   R(   R   R   R   R   t   update(   R   t   state(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __setstate__  s    "c            sq   d    _   f d   } t t t    d |  |   } i    _ | j d  } d    _   j | d t	 | S(   Nc             s     S(   N(    (   RH   RI   (   R   (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRJ     s    RK   RP   t   override(
   R
   R   RN   R+   R\   R   R'   R   R5   R   (   R   R>   RO   R   RP   (    (   R   sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRK     s    	!		N(,   R   R   R   R%   t'   _NamedComponent_mixin__PrivateTransientR]   R
   R   R   R   R   R   R-   R   Rn   R   R   R   R   R   R(   R   R   R   R   R   R   R   RB   R   R   R   R   R   R,   R   R   R   R   R   R   R   R   RK   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR\   -  sF   										
					@		
							!	t   _ValueConstraint_mixinc           B   sJ   e  Z d  Z d Z d Z d Z d Z d   Z d   Z	 d   Z
 d   Z RS(	   s^   Mix-in indicating that the component contains a simple-type
    value that may be constrained.i    i   i   c         C   s   |  j  S(   s   A constraint on the value of the attribute or element.

        Either None, or a pair consisting of a string in the lexical
        space of the typeDefinition and one of VC_default and
        VC_fixed.(   t'   _ValueConstraint_mixin__valueConstraint(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   valueConstraint  s    c         C   s;   t  |  j t  s d S|  j |  j d k r0 d S|  j d S(   s_   If this instance constraints a default value, return that
        value; otherwise return None.i   i    N(   R   R   Ru   R
   t
   VC_default(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   default  s
    c         C   s;   t  |  j t  s d S|  j |  j d k r0 d S|  j d S(   s]   If this instance constraints a fixed value, return that
        value; otherwise return None.i   i    N(   R   R   Ru   R
   t   VC_fixed(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   fixed  s
    c         C   s   t  j | d  } t  j | d  } t  j | d  } | d  k	 r` | d  k	 r` t j d   n  | d  k	 r | d  k	 r d | k r t j d   n  | |  j f |  _ |  S| d  k	 r | |  j f |  _ |  Sd  |  _ |  S(   NR   R   t   uses:   Attributes default and fixed may not both appear (3.2.3r1)t   optionals=   Attribute use must be optional when default present (3.2.3r2)(   R   t   NodeAttributeR
   R   R   R   R   R   (   R   R#   t   adefaultt   afixedt   ause(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _valueConstraintFromDOM  s    	N(   R   R   R   t   VC_naR   R   R
   R   R   R   R   R  (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s   					R   c           B   s   e  Z d  Z d Z d Z e d    Z e d    Z e d    Z d   Z	 d   Z
 d Z d   Z d	   Z e Z d
   Z d   Z d   Z RS(   s  Mix-in class for named components that have a scope.

    Scope is important when doing cross-namespace inheritance,
    e.g. extending or restricting a complex type definition that is
    from a different namespace.  In this case, we will need to retain
    a reference to the external component when the schema is
    serialized.

    This is done in the pickling process by including the scope when
    pickling a component as a reference.  The scope is the
    SCOPE_global if global; otherwise, it is a tuple containing the
    external namespace URI and the NCName of the complex type
    definition in that namespace.  We assume that the complex type
    definition has global scope; otherwise, it should not have been
    possible to extend or restrict it.  (Should this be untrue, there
    are comments in the code about a possible solution.)

    @warning: This mix-in must follow L{_NamedComponent_mixin} in the C{mro}.
    t   globalt   indeterminatec         C   s   |  j  | k p t | t  S(   N(   R   R   R   (   R   t   value(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   IsValidScope  s    c         C   s   |  j  | k S(   N(   t   XSCOPE_indeterminate(   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s   |  j  | k S(   N(   R   (   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s`   |  j  |  s$ |  j  |  j    r( t S|  j   | k r> t S|  j |  j   k o_ t | t  S(   s'  Return True if this scope currently assigned to this instance is compatible with the given scope.

        If either scope is indeterminate, presume they will ultimately be
        compatible.  Scopes that are equal are compatible, as is a local scope
        if this already has a global scope.(   R   R!   R   R   R   R   (   R   R!   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _scopeIsCompatible  s
    $c         C   s
   |  j    S(   s  The scope for the declaration.

        Valid values are SCOPE_global, or a complex type definition.
        A value of None means a non-global declaration that is not
        owned by a complex type definition.  These can only appear in
        attribute group definitions, model group definitions, and element
        declarations.

        @todo: For declarations in named model groups (viz., local
        elements that aren't references), the scope needs to be set by
        the owning complex type.
        (   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR!     s    c         C   s   |  j  p |  S(   N(   t)   _ScopedDeclaration_mixin__baseDeclaration(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   baseDeclaration2  s    c         C   s   | j    |  _ |  j S(   N(   R  R
  (   R   t   referenced_declaration(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _baseDeclaration4  s    c         C   s   |  j  S(   N(   t.   _ScopedDeclaration_mixin__overridesParentScope(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   overridesParentScope<  s    c         C   s   | |  _  t |  _ d  S(   N(   t/   _ScopedDeclaration_mixin__overriddenDeclarationR   R  (   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _overrideParentScope>  s    	c         C   s   |  j  S(   N(   R  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   overriddenDeclarationA  s    N(   R   R   R   R   R  R   R  R   R   R	  R!   R
   R
  R  R  R   R  R  R  R  (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s   						t   _AttributeWildcard_mixinc           B   s>   e  Z d  Z d Z d   Z d   Z d   Z e d    Z	 RS(   s  Support for components that accept attribute wildcards.

    That is L{AttributeGroupDefinition} and L{ComplexTypeDefinition}.  The
    calculations of the appropriate wildcard are sufficiently complex that
    they need to be abstracted out to a mix-in class.c         C   s   |  j  S(   s   Return the L{Wildcard} component associated with attributes of this
        instance, or C{None} if attribute wildcards are not present in the
        instance.(   t+   _AttributeWildcard_mixin__attributeWildcard(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   attributeWildcardN  s    c         C   s.   | d k s! t | t  s! t  | |  _ |  S(   s6   Set the attribute wildcard property for this instance.N(   R
   R   R9   R   R  (   R   t   attribute_wildcard(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _setAttributeWildcardT  s    !	c         C   s   g  } g  } d } x | D] } t j | j k r7 q n  t j | d  rY | j |  q t j | d  r t j | d  } | d k r t	 j
 d   n  | j |  q t j | d  r | d k	 r t	 j
 d   n  | } q q W| | | f S(   s  Return the nodes that are relevant for attribute processing.

        @param node_list: A sequence of nodes found in a definition content
        information item.

        @return: A tuple C{( attributes, attributeGroups, attributeWildcard)}
        where C{attributes} is the subsequence of C{node_list} that are
        XMLSchema C{attribute} nodes; C{attributeGroups} is analogous; and
        C{attributeWildcard} is a single DOM node with XMLSchema name
        C{anyAttribute} (or C{None}, if no such node is present in the list).

        @raise pyxb.SchemaValidationError: An C{attributeGroup} node is
        present but does not have the required C{ref} attribute.
        @raise pyxb.SchemaValidationError: Multiple C{anyAttribute} nodes are
        identified.
        t	   attributet   attributeGroupt   refs9   Require ref attribute on internal attributeGroup elementst   anyAttributes.   Multiple anyAttribute children are not allowedN(   R
   R    t   ELEMENT_NODEt   nodeTypet   xsdt   nodeIsNamedRr   R   t   NodeAttributeQNameR   R   (   R   t	   node_listt
   attributest   attribute_groupst   any_attributeR#   t   agd_en(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _attributeRelevantChildrenZ  s$    c      	   C   s  g  } xK | D]C } t  | t  s( t  | j   d k	 r | j | j    q q Wg  | D] } | j   ^ q[ } d t |  k r | S| d k	 r t d | j	   d t j
 | | j   g  d | j   d |  St d | d j	   d t j
 |  d |  S(   s  Implement the algorithm as described the
        U{specification<http://www.w3.org/TR/xmlschema-1/#declare-type>}.

        @param namespace_context: The L{pyxb.namespace.NamespaceContext} to be
        associated with any created L{Wildcard} instance
        @param attribute_groups: A list of L{AttributeGroupDefinition} instances
        @param local_wildcard: A L{Wildcard} instance computed from a relevant
        XMLSchema C{anyAttribute} element, or C{None} if no attribute wildcard
        is relevant
        i    t   process_contentst   namespace_constraintR   R"   N(   R   R   R   R  R
   Rr   t   namespaceConstraintR;   R9   t   processContentst   IntensionalIntersectiont   namespaecConstraintR   (   R   R"   R#  t   local_wildcardt   agd_wildcardsR`   t   _agdt   agd_constraints(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   CompleteWildcard  s     N(
   R   R   R   R
   R  R  R  R&  R   R1  (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR  D  s   			)R   c           B   sz   e  Z d  Z d
 Z d   Z d
 Z d   Z d   Z e	 d
 d   Z
 e	 d    Z d   Z d   Z d   Z d	   Z RS(   sp   An XMLSchema U{Attribute Declaration<http://www.w3.org/TR/xmlschema-1/#cAttribute_Declarations>} component.
    c         C   s   |  j  S(   sM   The simple type definition to which an attribute value must
         conform.(   t%   _AttributeDeclaration__typeDefinition(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         O   s/   t  t |   j | |   d | k s+ t  d  S(   NR!   (   R+   R   R,   R   (   R   R=   R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,     s    c         C   s=   |  j    r, d |  j   |  j    j   f Sd |  j   f S(   Ns	   AD[%s:%s]s   AD[%s:?](   R   R]   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s     c         C   st   i | d 6| d 6| j    j   d 6t j d 6} | d k	 sC t  |  |   } | d k	 rg | | _ n  d | _ | S(   sD   Create an attribute declaration component for a specified namespace.R]   R$   R"   R!   N(   R-   t   initialNamespaceContextR   R   R
   R   R2  t'   _AttributeDeclaration__typeExpandedName(   R   R]   R$   t   stdR>   t   bi(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   CreateBaseInstance  s    
	c         K   s  | d } t  j |  s. t  j |  s. t  t j | d  sF t  t j | d  } t j | j d  r |  j	 | k s t  nN t j | d  d k r t  j |  s t | t  s t  n t j d   |  d | d | |  } | j |  | j |  t j | d  | _ | j d d  | | d	 <t j | d
  } | d k	 rjt j | |  | _ n! | j d k rt j   | _ n  | j d k r| j d  n  | S(   ss  Create an attribute declaration from the given DOM node.

        wxs is a Schema instance within which the attribute is being
        declared.

        node is a DOM element.  The name must be one of ( 'all',
        'choice', 'sequence' ), and the node must be in the XMLSchema
        namespace.

        scope is the _ScopeDeclaration_mxin context into which the
        attribute declaration is placed.  It can be SCOPE_global, a
        complex type definition, or XSCOPE_indeterminate if this is an
        anonymous declaration within an attribute group.  It is a
        required parameter for this function.
        R!   R  R]   R$   R  s+   Internal attribute declaration by referenceR#   R:   R   t
   simpleTypet   creationN(   R   R   R  R   R  R  R   R   t
   parentNodeR   R
   R   R   R   R   R   R  R   R4  t   popR   RW   R   R2  t   SimpleUrTypeDefinitiont   _queueForResolution(   R   R#   R>   R!   R]   R   t   st_node(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s.    
$'
c         C   s   |  j  d  k	 S(   N(   R2  R
   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRS     s    c         C   s   |  j    r |  S|  j d  k	 s8 t d |  j   f   |  j j   |  _ |  j d  k ru t j d |  j f   n  t	 |  j t
  s t j d |  j f   n  |  S(   Ns3   AD %s is unresolved but had no type attribute fields!   Type reference %s cannot be founds   Need %s to be a simple type(   RS   R4  R
   R   R   R   R2  R   R   R   RW   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _resolve  s    (c         C   s   |  | k s t   |  j   d k	 s* t   |  j |  s? t   t t |   j |  | j   s t j	 j
 |  j   j   k r t j d |  j   |  j  q d |  _ n  |  S(   s  Override fields in this instance with those from the other.

        This method is invoked only by Schema._addNamedComponent, and
        then only when a built-in type collides with a schema-defined
        type.  Material like facets is not (currently) held in the
        built-in copy, so the DOM information is copied over to the
        built-in STD, which is subsequently re-resolved.

        Returns self.
        s   Not destroying builtin %s: %sN(   R   R]   R
   R   R+   R   Rj   RS   R   R(   t   BuiltInObjectUIDR   R   t   _logt   warningR   R2  (   R   Rk   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRj     s    c         C   s   t  |  j g  S(   s*   Attribute declarations require their type.(   t	   frozensetR2  (   R   t   include_lax(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _bindingRequires_vx1  s    N(   R   R   R   R
   R2  R   R4  R,   R   R   R7  R   RS   R?  Rj   RE  (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s   			6			t   AttributeUsec           B   s   e  Z d  Z d Z d Z d Z d Z d   Z d   Z	 d Z
 d Z d   Z d   Z d   Z d Z d	   Z d
   Z e e d   Z e d    Z d   Z d   Z d   Z d   Z d   Z RS(   sZ   An XMLSchema U{Attribute Use<http://www.w3.org/TR/xmlschema-1/#cAttribute_Use>} component.i   i   i   c         C   s   |  j  |  j k S(   N(   t   USE_requiredt   _AttributeUse__use(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   required@  s    c         C   s   |  j  |  j k S(   N(   t   USE_prohibitedRH  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt
   prohibitedC  s    c         C   s   |  j  S(   N(   t   _AttributeUse__restrictionOf(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   restrictionOfJ  s    c         C   sF   t  | t  s t  |  j d  k s9 |  j | k s9 t  | |  _ d  S(   N(   R   RF  R   RL  R
   (   R   t   au(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _setRestrictionOfL  s    $c         C   s   |  j  S(   s/  The attribute declaration for this use.

        When the use scope is assigned, the declaration is cloned (if
        necessary) so that each declaration corresponds to only one use.  We
        rely on this in code generation, because the template map for the use
        is stored in its declaration.(   t#   _AttributeUse__attributeDeclaration(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   S  s    c         K   s   t  t |   j |   d  S(   N(   R+   RF  R,   (   R   R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,   ^  s    c         C   su   |  j    s d S|  j   } t   } xI | D]A } | j    sB d S| j   } | j |  r, | j |  q, q, W| S(   sC   Return the subset of au_set for which the use names match this use.N(   RS   R
   R   R%   R   RB   (   R   t   au_sett   this_adR   RN  t   that_ad(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   matchingQNameMembersa  s    	c         C   sW   i | d 6| j    j   d 6} |  |   } t | t  sA t  | | _ | | _ | S(   NR$   R"   (   R-   R3  R   R   R   RP  RH  (   R   R$   t   attribute_declarationR   R>   R6  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR7  p  s    
		c         K   s  | d } t  j |  s. t | t  s. t  t j | d  sF t  | d } |  d | |  } |  j | _ t	 j
 | d  } | d k	 r d | k r |  j | _ q d | k r |  j | _ q d | k r |  j | _ q t j d	 | f   n  | j |  t	 j | d
  | _ | j d k ro| j d d  | | d <| j | t  | d <t j | |  | _ n  | j   s| j d  n  | S(   s  Create an Attribute Use from the given DOM node.

        wxs is a Schema instance within which the attribute use is
        being defined.

        node is a DOM element.  The name must be 'attribute', and the
        node must be in the XMLSchema namespace.

        scope is the _ScopeDeclaration_mixin context into which any
        required anonymous attribute declaration is put.  This must be
        a complex type definition, or None if this use is in an
        attribute group.
        R!   R  R$   R#   R   RI  R   RK  s/   Unexpected value %s for attribute use attributeR  R   R   R9  N(   R   R   R   R   R   R  R  t   USE_optionalRH  R   R   R
   RG  RJ  R   R   R  R   t   _AttributeUse__refExpandedNameR;  t   targetNamespaceForNodeR   R   RP  RS   R=  (   R   R#   R>   R!   R$   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   {  s2    
$

c         C   s   |  j  d  k	 S(   N(   RP  R
   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRS     s    c         C   si   |  j    r |  S|  j j   |  _ |  j d  k rM t j d |  j f   n  t |  j t  se t	  |  S(   Ns(   Attribute declaration %s cannot be found(
   RS   RW  R   RP  R
   R   R   R   R   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR?    s    c         C   s    | s t    St  |  j   g  S(   s;   Attribute uses require their declarations, but only if lax.(   RC  R   (   R   RD  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRE    s    c         C   s   |  } |  j    s t  |  j } | j   d k	 s9 t  t | t  sN t  t | j   t  s |  j | | j    } | j | | j    | _ | j j	 |  n  | j
 | j  | S(   s  Adapt this instance for the given complex type.

        If the attribute declaration for this use is not associated with a
        complex type definition, then associate a clone of it with this CTD,
        and clone a new attribute use that uses the associated declaration.
        This attribute use is then inherited by extensions and restrictions,
        while retaining its original scope.N(   RS   R   RP  R!   R
   R   R   RV   R   R    t   _recordLocalDeclaration(   R   R   R   t   ad(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _adaptForScope  s    	c         C   s   d |  j    f S(   Ns   AU[%s](   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    N(   R   R   R   R
   RH  RG  RV  RJ  RI  RK  RW  RL  RM  RO  R   RP  R,   RT  R   R7  R   RS   R?  RE  R[  R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRF  5  s.   							
1				Rd   c           B   s,  e  Z d  Z d Z d   Z d   Z d Z d Z e	 Z
 d   Z d Z d   Z d Z d   Z d Z d Z d Z d	 Z i e d
 6e d 6Z e j   Z e j i e d 6 e Z e Z e	 Z d   Z d   Z d   Z d   Z e d    Z  d   Z! d   Z" e	 Z# d   Z$ d   Z% d   Z& d   Z' RS(   sg   An XMLSchema U{Element Declaration<http://www.w3.org/TR/xmlschema-1/#cElement_Declarations>} component.c         C   s   |  j  S(   s?   The simple or complex type to which the element value conforms.(   t#   _ElementDeclaration__typeDefinition(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s/  | |  _  | d  k	 r+|  j   d  k	 r+t } t |  j  t  rH t } n t |  j  t  r | j   } | d  k r t } t |  j  j	   k r d  |  _  |  j
 d  q q t | t  o t j | d k } n  | r+|  j d  k rt j d |  j   f   n  t j d |  j   |  j f   q+n  |  S(   Ns   unresolved base typei    s6   Value constraint on element %s with non-simple contents6   Value constraint on element %s with non-simple type %s(   R\  R
   R   R   R   RW   R   R   t   contentTypet   _isComplexContentR=  Ru   t	   CT_SIMPLEt%   _ElementDeclaration__typeExpandedNameR   R   R   (   R   t   type_definitiont   failedt   ct(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _typeDefinition  s$    			&(c         C   s   |  j  S(   N(   t   _ElementDeclaration__nillable(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   nillable  s    c         C   s   |  j  S(   s1   A list of IdentityConstraintDefinition instances.(   t2   _ElementDeclaration__identityConstraintDefinitions(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   identityConstraintDefinitions  s    c         C   s   |  j  S(   s.   None, or a reference to an ElementDeclaration.(   t1   _ElementDeclaration__substitutionGroupAffiliation(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   substitutionGroupAffiliation  s    i    i   i   i   t	   extensiont   restrictiont   substitutionc         C   s   |  j  S(   N(   t   _ElementDeclaration__abstract(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   abstract!  s    c         C   s   t  S(   s;   Return False, since element declarations are not wildcards.(   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   hasWildcardElement$  s    c         C   s   t  |  j g  S(   sL   Element declarations depend on the type definition of their
        content.(   RC  R\  (   R   RD  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRE  )  s    c         O   s   t  t |   j | |   d  S(   N(   R+   Rd   R,   (   R   R=   R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,   .  s    c      	   K   s  | d } t  j |  s. t  j |  s. t  t j | d  sF t  t j | d  } t j | j d  r t  j	 | k s t  nN t j | d  d k r t  j |  s t | t  s t  n t j d   |  d | d | |  } | j |  | j |  t j | d  | _ | j d d  | | d	 <| j   rPt  j | d <n  g  } xW | j D]L } t j | j k r`t j | d
 d d  r`| j t j | |   q`q`W| | _ d | _ t j | d  | _ t j  | d  } t j  | d  }	 | j d k	 r7| d k	 r7|	 d k	 r7t j d   q7n  | j d k rn| d k	 rn| j! t" j | |   n  | j d k r|	 d k	 r| j! t j |	 |   n  | j d k r| j d k rx< | j D]1 } t# j$ |  rt j d | j% f   qqW| j! t j&    qn  | j d k	 o6| j d k | _' | j' sU| j( d  n  t j | d  }
 |
 d k	 rt) j* |
  | _+ n  t j | d  }
 |
 d k	 rt) j* |
  | _, n  | d } | j- | |  j.  | _/ | j0 | |  j1  | _2 | S(   s  Create an element declaration from the given DOM node.

        wxs is a Schema instance within which the element is being
        declared.

        scope is the _ScopeDeclaration_mixin context into which the
        element declaration is recorded.  It can be SCOPE_global, a
        complex type definition, or None in the case of elements
        declared in a named model group.

        node is a DOM element.  The name must be 'element', and the
        node must be in the XMLSchema namespace.R!   t   elementR]   R$   R  s(   Created reference as element declarationR#   t   substitutionGroupR   R}   t   uniquet   keyrefR:   R8  t   complexTypesB   Cannot combine type attribute with simpleType or complexType childs2   Node %s in element must be wrapped by complexType.R9  Rf  Ro  N(3   R   R   R  R   R  R  R   R   R:  R   R
   R   R   R   R   R   R  R   t2   _ElementDeclaration__substitutionGroupExpandedNameR;  R   R  t
   childNodesR    R  R  Rr   R   R   Rg  R\  R`  R   Rd  RW   t   Particlet   IsParticleNodet	   localNamet   UrTypeDefinitiont   _ElementDeclaration__isResolvedR=  R   t   booleanRe  Rn  t   blockForNodet   _DS_Mapt,   _ElementDeclaration__disallowedSubstitutionst   finalForNodet   _SGE_Mapt0   _ElementDeclaration__substitutionGroupExclusions(   R   R#   R>   R!   R]   R   t   identity_constraintsR   t   simpleType_nodet   complexType_nodet   attr_valR$   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   2  sh    
$'
* 		 !	
c         C   s   |  j    s t S|  j   j    r& t S| j |  j    } | d k rK t S|  j   j | j    rj t St j	 d |  j    t S(   s  Determine whether this element declaration is adaptable.

        OK, this gets ugly.  First, if this declaration isn't resolved, it's
        clearly not adaptable.

        Now: For it to be adaptable, we must know enough about its type to
        verify that it is derivation-consistent with any other uses of the
        same name in the same complex type.  If the element's type is
        resolved, that's good enough.

        If the element's type isn't resolved, we're golden as long as
        type-equivalent types were used.  But it's also allowed for the
        derived ctd to use the element name constraining it to a derivation of
        the element base type.  (Go see namespace
        http://www.opengis.net/ows/1.1 types PositionType, PositionType2D,
        BoundingBox, and WGS84BoundingBox for an example).  So, we really do
        have to have the element's type resolved.

        Except that if a CTD's content incorporates an element with the same
        type as the CTD (i.e., nested), this will never happen, because the
        CTD can't get resolved until after it has been resolved.
        (Go see {http://www.opengis.net/ows/1.1}ContentsBaseType and
        {http://www.opengis.net/ows/1.1}DatasetDescriptionSummaryBaseType for
        an example).

        So, we give the world a break and assume that if the type we're trying
        to resolve is the same as the type of an element in that type, then
        the element type will be resolved by the point it's needed.  In point
        of fact, it won't, but we'll only notice that if a CTD contains an
        element whose type is a restriction of the CTD.  In that case,
        isDerivationConsistent will blow chunks and somebody'll have to come
        back and finish up this mess.
        s+   Require %s to be resolved; might be a loop.N(
   RS   R   R   R   R   R   R
   R   RA  RB  (   R   R   t   existing_decl(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   isAdaptable  s    #c         C   s   |  } t  | t  s( t d | f   t  |  j   t  sw | d  k	 sO t  |  j | | j    } | j |  n  | j |  | S(   Ns   %s is not a CTD(	   R   R   R   R!   R
   RV   R   R    RY  (   R   R   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR[    s    "c         C   s   |  j  S(   N(   R|  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRS     s    c         C   s   |  j    r |  S|  j d  k	 rb |  j j   } | d  k rV t j d |  j f   n  | |  _ n  t } |  j d  k r |  j	 d  k	 s t
  |  j	 j   } | d  k r t j d |  j	 f   n  |  j |  |  j   d  k	 } n  | |  _ |  S(   Ns@   Element declaration refers to unrecognized substitution group %ss#   Type declaration %s cannot be found(   RS   Rv  R
   R   R   R   Ri  R   R\  R`  R   R   Rd  R|  (   R   t   sgat   resolvedt   td(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR?    s"    	c         C   s   | |  d  |  d  S(   N(   R
   (   R   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   sC   |  j    d  k	 r2 d |  j   |  j    j   f Sd |  j   f S(   Ns	   ED[%s:%s]s   ED[%s:?](   R   R
   R]   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s     N((   R   R   R   R
   R\  R   Rd  Rv  R`  R   Re  Rf  Rg  Rh  Ri  Rj  t   SGE_nonet   SGE_extensiont   SGE_restrictiont   SGE_substitutionR  RT   R  R   R  R  Rn  Ro  Rp  RE  R,   R   R   R  R[  R|  RS   R?  R   R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRd     sF   					

				Y	8	
			R   c           B   sL  e  Z e   Z d/ Z d    Z d Z d Z d Z	 i e d 6e	 d 6Z
 d/ Z d   Z e Z e Z d   Z d/ Z d   Z d/ Z d	   Z d/ Z d
   Z d/ Z e d  Z d   Z d   Z d Z d Z d Z d Z d   Z d   Z  d/ Z! d   Z" d   Z# e Z$ d/ Z% d   Z& d   Z' d   Z( d/ Z) e* d/ e d   Z+ d   Z, d   Z- e* d    Z. d/ Z/ d/ Z0 d/ Z1 d/ Z2 d/ Z3 d/ Z4 d/ Z5 e j6 d d d d  d! d" g  d#   Z7 d$   Z8 d/ Z9 d/ Z: e j6 d% g  d/ Z; d/ Z< d/ Z= d&   Z> d/ Z? d/ Z@ d'   ZA d(   ZB e ZC d)   ZD d*   ZE d+   ZF d,   ZG d-   ZH d.   ZI RS(0   c         C   s   |  j  S(   s*   The type resolved from the base attribute.(   t*   _ComplexTypeDefinition__baseTypeDefinition(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    i    i   i   Rk  Rl  c         C   s   |  j  S(   s   How the type was derived.(   t(   _ComplexTypeDefinition__derivationMethod(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   	  s    c         C   s   |  j  S(   N(   t    _ComplexTypeDefinition__abstract(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRo    s    c         C   s   |  j  S(   s(   A frozenset() of AttributeUse instances.(   t%   _ComplexTypeDefinition__attributeUses(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   attributeUses  s    c         C   s#   |  j  d k r d S|  j  j |  S(   s   Find an attribute declaration with the given name that is local to this type.

        Returns None if there is no such local attribute declaration.N(   t3   _ComplexTypeDefinition__scopedAttributeDeclarationsR
   R'   (   R   t   expanded_name(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s#   |  j  d k r d S|  j  j |  S(   s   Find an element declaration with the given name that is local to this type.

        Returns None if there is no such local element declaration.N(   t1   _ComplexTypeDefinition__scopedElementDeclarationsR
   R'   (   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   )  s    c         C   s   | s |  j  d k r g  t j |  j  D] } |  | j   k r( | ^ q( } | j d d    g  t j |  j  D] } |  | j   k rr | ^ qr } | j d d    | |  _  |  j  j |  n  |  j  S(   sD  Return a list of element and attribute declarations that were
        introduced in this definition (i.e., their scope is this CTD).

        @note: This specifically returns a list, with element declarations
        first, because name binding should privilege the elements over the
        attributes.  Within elements and attributes, the components are sorted
        by expanded name, to ensure consistency across a series of binding
        generations.

        @keyword reset: If C{False} (default), a cached previous value (if it
        exists) will be returned.
        R}   c         S   s
   |  j    S(   N(   R   (   t   _x(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRJ   A  s    c         S   s
   |  j    S(   N(   R   (   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRJ   C  s    N(	   t/   _ComplexTypeDefinition__localScopedDeclarationsR
   R   t
   itervaluesR  R!   t   sortR  t   extend(   R   t   resett   _edt   rvet   _adt   rva(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   localScopedDeclarations2  s    77	c         C   s  t  | t  s t  t  | t  r0 |  j } n7 t  | t  rK |  j } n t j d t	 |  f   | j
   } | j | |  } | | k rt  | t  r0| j   } | j   } | j |  s t j d | j
   | | f   n  | | k r}|  j |  j   k r}| j |  | | | <| } q}qt  | t  r^t j d | j
   f   qt st d t	 |  f   n  | j |  |  S(   sJ   Record the given declaration as being locally scoped in
        this type.s8   Unexpected instance of %s recording as local declarationsB   Conflicting element declarations for %s: existing %s versus new %ss&   Multiple attribute declarations for %ss   Unrecognized type %s(   R   R   R   Rd   R  R   R  R   R   R:   R   t
   setdefaultR   R   R   R   R   R  R   R  (   R   t   declt	   scope_mapt   decl_enR  t   existing_typet   pending_type(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRY  H  s.    %!
"c         C   s"   |  j  } t | t  p! | j   S(   sT   Return C{True} iff this is the root of a complex type definition hierarchy.
        (   R  R   RW   R[   (   R   t   base(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _isHierarchyRootj  s    	t   EMPTYt   SIMPLEt   MIXEDt   ELEMENT_ONLYc         C   s$   t  |  j t  r |  j d S|  j S(   s   Return the value of the content type identifier, i.e. one of the
        CT_ constants.  Return value is None if no content type has been
        defined.i    (   R   t#   _ComplexTypeDefinition__contentTypeRu   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _contentTypeTagu  s    c         C   s!   t  |  j t  r |  j d Sd  S(   Ni   (   R   R  Ru   R
   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _contentTypeComponent}  s    c         C   s   |  j  S(   s  Identify the sort of content in this type.

        Valid values are:
         - C{CT_EMPTY}
         - ( C{CT_SIMPLE}, a L{SimpleTypeDefinition} instance )
         - ( C{CT_MIXED}, a L{Particle} instance )
         - ( C{CT_ELEMENT_ONLY}, a L{Particle} instance )
        (   R  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR]    s    	c         C   s   |  j  |  j   k r d S|  j   \ } } |  j | k rE d | f S|  j | k r_ d | f S|  j | k ry d | f St j d   d  S(   NR  s   Simple [%s]s
   Mixed [%s]s   Element [%s]s   Unhandled content type(   t   CT_EMPTYR]  R_  t   CT_MIXEDt   CT_ELEMENT_ONLYR   R   (   R   t   tagt   particle(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   contentTypeAsString  s    c         O   sA   t  t |   j | |   | j d  |  _ i  |  _ i  |  _ d  S(   Nt   derivation_method(   R+   R   R,   R'   R  R  R  (   R   R=   R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,     s    	c         C   sH   |  j  |  j   k r t S|  j   \ } } |  j | k r> t S| j   S(   sS   Return True iff this type includes a wildcard element in
        its content model.(   R  R]  R   R_  Rp  (   R   R  R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRp    s    c         C   sz   |  | k s t   |  j |  s' t   t t |   j |  | j   sv t j j |  j	   j
   k rv t |  _ qv n  |  S(   s  Override fields in this instance with those from the other.

        This method is invoked only by Schema._addNamedComponent, and
        then only when a built-in type collides with a schema-defined
        type.  Material like facets is not (currently) held in the
        built-in copy, so the DOM information is copied over to the
        built-in STD, which is subsequently re-resolved.

        Returns self.
        (   R   R   R+   R   Rj   RS   R   R(   R@  R   R   R   t"   _ComplexTypeDefinition__isResolved(   R   Rk   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRj     s    c   	      C   s  |  j  d k r| d k	 s! t  | j   j   } i d d 6| d 6| d 6| j   d 6|  j d 6t j d 6} t |   } | | _	 | j
 t d t j d	 t j |   i | d 6| d 6t j d 6} t d t j d	 t j |  } t | d
 d d d | } t d t j d | g |  } |  j t | |  f | _ t   | _ |  j | _ |  j | _ t | _ | j | j    t | _ | |  _  n  |  j  S(   su   Create the ComplexTypeDefinition instance that approximates
        the ur-type.

        See section 3.4.7.
        t   anyTypeR]   R$   R"   R   R  R!   R(  R'  t
   min_occursi    t
   max_occurst
   compositort	   particlesN(   t(   _ComplexTypeDefinition__UrTypeDefinitionR
   R   R-   R3  R   R   R   RZ   R  R  R9   t   NC_anyt   PC_laxR  Rx  R^   t
   C_SEQUENCER  R  R%   R  t   DM_emptyt   _ComplexTypeDefinition__finalt/   _ComplexTypeDefinition__prohibitedSubstitutionsR   R  Rg   R]   R   R  (	   R   R$   t   in_builtin_definitiont   ns_ctxR>   R6  t   wt   pt   m(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR{    s6    

	%
		c         C   s   |  j    |  k S(   s5   Indicate whether this simple type is a built-in type.(   R{  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt	   isBuiltin  s    c         C   s   t    } |  j d k	 s t  | j |  j  x? |  j   D]1 } | sV t | t  r; | j | j    q; q; W| r |  j	   } | d k	 r | j |  q n  t
 |  S(   s   Complex type definitions depend on their base type definition, the
        type definitions of any local attribute declarations, and if strict
        the type definitions of any local element declarations.N(   R%   R  R
   R   RB   R  R   R   R   R  RC  (   R   RD  R   R  Rc  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRE    s    	c         K   s  t  j | d  s t  t j | d  } |  d | d | d d  |  } | j   r t | j   t	  so t  | j
   r t j d   q nG t | j   t	  s t  | j
   s t j d | j   f   n  | j d d   | | d <| | d <| j | |  S(	   NRu  R]   R#   R  s*   Anonymous complex type at schema top levels6   Name attribute invalid on non-global complex types: %sR   R!   (   R  R  R   R   R   R
   R   R   R   R7   R   R   R   R   R;  t)   _ComplexTypeDefinition__setContentFromDOM(   R   R#   R>   R]   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    

t   ckwR  t   attributeGroupNamest   usesC1t   usesC1C2t   attributeGroupsc      
   C   sF  |  j  d  k rb|  j } t   } g  |  _ x |  j D]} } | j   } | d  k rk t j d | f   n  | j	   s |  j
 d d | |  S|  j j |  | j | j    q4 W| j |  } xm | D]e } | j	   s |  j
 d  |  S| j   }	 |	 j	   s |	 j   }
 |  j
 d |
 f d |	 |  Sq Wt g  | D] } | j |   ^ q> |  _  n  t   } t |  j t  rt |  j j  } |  j j	   st  x | D] } | j	   s|  j
 d d | |  S| j   }	 |	 j	   s|	 j   }
 |  j
 d |
 f d |	 |  S| j   j   st  qW|  j | k rx |  j  D] } | j |  } | d  k	 sst  d t |  k st d   x: | D]2 } | j	   st  | j |  | j |  qWqLWq|  j | k st  n  i  } xv |  j  j |  D]b } | j	   st  | j   j   }
 |
 | k r^t j d	 |
 |  j   f   n  | | |
 <qWt t j  |   |  _ |  j   sx: |  j D], } | j   j   st d
 | f   qWn  d  } |  j! d  k	 rt" j# |  j!  } n  t$ j% |  j&   |  j |  } |  j | k r4|  j' |  n |  j | k sIt  |  j(   j	   sat  d  } t |  j(   t  r|  j(   j)   } n  | d  k	 r| d  k r|  j' |  q|  j' t" d | j*   d t" j+ | j,   | j,   g  d | j-   d |  j&     n |  j' |  |  ` |  `  |  ` d  |  _. t/ |  _0 |  S(   Ns"   Attribute group %s cannot be founds   unresolved attribute groupt
   depends_ons   attribute use not resolveds2   unresolved attribute declaration %s from base types'   unresolved attribute use from base typei   s.   Multiple inherited attribute uses with name %ss%   Multiple definitions for %s in CTD %ss   indeterminate scope for %sR'  R(  R   R"   (1   t    _ComplexTypeDefinition__usesC1C2R
   t   _ComplexTypeDefinition__usesC1R%   t'   _ComplexTypeDefinition__attributeGroupst+   _ComplexTypeDefinition__attributeGroupNamesR   R   R   RS   R=  Rr   R   R  t   unionR   R   RC  R[  R   R  R   R  R   R   R   RT  R;   t   removeRO  t   DM_extensionR   R  t$   _ComplexTypeDefinition__anyAttributeR9   R   R  R1  R   R  R   R  R*  t   IntensionalUnionR)  R   t   _ComplexTypeDefinition__ckwR   R  (   R   t   methodt   content_stylet   uses_c1t   uses_c2t   ag_enR`   t	   uses_c1c2RN  RZ  t   ad_ent   _ut   uses_c3t   matching_usest   au2t   use_mapR-  t   complete_wildcardt   base_wildcard(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __completeProcessingE  s    			.	"-		c         K   sS  t  |  j t  rC|  j j } t |  t k r |  j | d k r |  j | k r |  j d  k	 sg t
  |  j } | d  k r | d } n  t  | t  s t
  | j   s d  S|  j } d  |  _ d  |  _ |  j | j |  |  f St |  t k r?|  j | d k r?| d j   r?t  |  j t  s/t
  |  j |  j f S| S|  j |  j f S(   Ni    i   (   R   R  R   R  R:   Ru   R_  R   t+   _ComplexTypeDefinition__ctscRestrictionNodeR
   R   t&   _ComplexTypeDefinition__ctscClause2STDRW   RS   t   _createRestrictionR  t   isEmptiable(   R   R  R>   t   parent_content_typeR5  t   restriction_node(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __simpleContent  s.    				t   ctscRestrictionNodec         C   s   |  j  S(   N(   t(   _ComplexTypeDefinition__isComplexContent(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR^    s    c         K   s  | j    } t j j j |  | d <d  } | d  k	 rL t j | d  } n  | d  k rm t j | d  } n  | d  k	 r t j	 |  } n t
 } t }	 t
 }
 t
 } d  } x | D] } t j | j k r q n  t j | d d  r t j d   n  t j |  r| } t
 }	 n  t j | d d  rAt j |  rAt }
 n  t j | d  r t j |  r t j | d	  } | d  k	 rd
 t j |  k rt } qq q Wd
 } |	 r| d 7} n  |
 r| d 7} n  | r| d 7} n  d | k rH| r<| d  k s|
 st  t d t j d g  |  } t | |  } ql|  j } n$ | d  k	 sZt  t j | |  } | |  _ | |  _ | |  _ d  S(   NR"   t   mixedt   simpleContentt   complexContents.   Missed explicit wrapper in complexType contentt   allt   sequencet   choicet	   minOccursi    i   R  R  (   RT   R   R(   R)   R*   R
   R   R   R   R}  R   R   R    R  R  R  R  R   Rx  t   IsTypedefNodet   HasNonAnnotationChildt   integerR   R^   R  R  R   t&   _ComplexTypeDefinition__effectiveMixedt(   _ComplexTypeDefinition__effectiveContentR  (   R   t	   type_nodet   content_nodet   definition_node_listR  R>   R  t
   mixed_attrt   effective_mixedt
   test_2_1_1t
   test_2_1_2t
   test_2_1_3t   typedef_nodeR   t   mo_attrt   satisfied_predicatesR  t   effective_content(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __setComplexContentFromDOM  sb    				c         C   s  |  j  } |  j r |  j } n	 |  j } |  j | k r |  j |  j k rT |  j } qa| |  j f } d t |  j  k s~ t	  |  j j
 |  j j  n |  j | k s t	  |  j j   s t	  |  j j   } |  j |  j k r | } nv |  j | k r| |  j f } nU t |  t k s$t	  t d t j d | d |  j g |  } | t | |  f } |  j | k st |  t k r| d d  k	 st	  | S(   Ni    R  R  i   (   R  R   R  R  R   R  R  R;   R  R   R   R  R  RS   R]  R:   Ru   R^   R  Rx  R
   (   R   R  R  Rc  t   content_typeR  R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __complexContent;	  s,    				(7c         C   s   |  j  S(   sR  Indicate whether this complex type is fully defined.

        All built-in type definitions are resolved upon creation.
        Schema-defined type definitionss are held unresolved until the
        schema has been completely read, so that references to later
        schema-defined types can be resolved.  Resolution is performed
        after the entire schema has been scanned and type-definition
        instances created for all topLevel{Simple,Complex}Types.

        If a built-in type definition is also defined in a schema
        (which it should be), the built-in definition is kept, with
        the schema-related information copied over from the matching
        schema-defined type definition.  The former then replaces the
        latter in the list of type definitions to be resolved.  See
        Schema._addNamedComponent.
        (   R  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRS   e	  s    c         C   s   | |  _  t |  _ |  S(   N(   R  R   R  (   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _setDerivationMethodz	  s    		c         K   sd  | j  d  } | d  k	 s! t  | j | |  j  |  _ | j | |  j  |  _ t j	 | d  } | d  k	 r t
 j |  |  _ n  | j } t } t j   |  _ |  j } t j |  } d  }	 d  }
 d  } | rt } t j | d  r t } t } nO t j | d  rt } n4 t j | d d d  sHt j d | j f   n  | rt j | d	 t }	 |	 | k sut  t j |	 d
 t } t j | d  r|  j } | s*| } t j | d  } | d  k	 rt j | |  }
 qq*n@ t j | d  r|  j } n" t j d |	 j |  j    f   t j! | d  |  _" |  j" d  k rjt j d | j f   n  d  |  _ | j } qn  | |  _# | |  _$ | |  _% |
 |  _& |  j' |  \ } } } t(   |  _) x0 | D]( } t* j | |  } |  j) j+ |  qW| |  _, | |  _- |  j$ r7|  j. | |	 | |  j# |  n  |  j/ |  |  j0   s`|  j1 d  n  |  S(   NR$   Ro  R  R  R  R  R  s,   Unexpected element %s at root of complexTypet   require_uniquet	   absent_okRl  R8  Rk  s;   Expected restriction or extension as sole child of %s in %sR  s!   Element %s missing base attributeR9  (2   R'   R
   R   R~  t   _DM_MapR  R  R  R   R   R   R}  R  Rw  R   R   R{  R  R   t   LocateFirstChildElementR   R  R  Rx  Ry  R   R   t   nodeNameR   RW   R   R  R]   R   t(   _ComplexTypeDefinition__baseExpandedNameR  R  R  R  R&  R%   R  RF  RB   R  R  t0   _ComplexTypeDefinition__setComplexContentFromDOMR   RS   R=  (   R   R#   R>   R$   R  R  t   is_complex_contentR  t	   first_eltR  t   clause2_stdt   ctsc_restriction_nodet   have_contentt   ionst   ions_stR"  t   attribute_group_namesR$  R   RN  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __setContentFromDOM	  sx    					"								c         C   s  |  j    r |  S|  j d  k r |  j j   } | d  k rV t j d |  j f   n  | j    s |  j d |  j f d | |  S| |  _ n  |  j d  k r|  j	 r |  j
 |  j  } d |  _ n8 |  j |  j  } | d  k r |  j d  |  Sd |  _ | d  k	 st  | |  _ n  t |  j t  rt |  j d t  r|  j d } | j |   sw|  j d | f  |  S|  j d	 | j |  |   f |  _ n  |  j |  j |  j  S(
   Ns   Cannot locate %s: need import?s   unresolved base type %sR  t   complexs%   restriction of unresolved simple typet   simplei   s(   content particle %s is not deep-resolvedi    (   RS   R  R
   R  R   R   R   R=  R  R  t&   _ComplexTypeDefinition__complexContentR  t$   _ComplexTypeDefinition__contentStylet%   _ComplexTypeDefinition__simpleContentR   R   Ru   Rx  R  R[  t*   _ComplexTypeDefinition__completeProcessing(   R   t	   base_typeR  t   prt(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR?  	  s8    		(%c         C   s   d S(   s7   Complex type definitions have no built-in type support.N(   R
   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   pythonSupport
  s    c         C   s.   |  j    r d t |   f Sd |  j   f S(   Ns   CTD{Anonymous}[%x]s   CTD[%s](   R   R   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   
  s    N(J   R   R   R%   t(   _ComplexTypeDefinition__PrivateTransientR
   R  R   R  R  R   R  R  R   R  R   R  Ro  R  R  R  R   R  R   R  R  RY  R  R  R_  R  R  R  R  R  R]  R  R  t#   _ComplexTypeDefinition__annotationsR,   Rp  Rj   R  R   R{  R  RE  R   R  R  R  R  R  R  R  R   R'  R&  R  R  R   R  R  R^  t+   _ComplexTypeDefinition__ctscRestrictionModeR%  R  R$  R  RS   R  R  R?  R*  R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s   		

				
		"							
	@						G	)			f	1	RZ   c           B   s    e  Z d  Z d   Z d   Z RS(   s+   Subclass ensures there is only one ur-type.c         C   s   t  j S(   s3   The ur-type does have a Python class backing it up.(   R   R  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR*  !
  s    c         C   s   |  j  |  j  S(   N(   R  R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR?  %
  s    (   R   R   R   R*  R?  (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRZ   
  s   	R   c           B   s   e  Z d  Z e   Z d Z d   Z d   Z e	 d    Z
 d Z d Z e j d d g  e	 d    Z e Z d   Z d   Z d	   Z d
   Z RS(   su   An XMLSchema U{Attribute Group Definition<http://www.w3.org/TR/xmlschema-1/#cAttribute_Group_Definitions>} component.c         O   s   t  t |   j | |   d  S(   N(   R+   R   R,   (   R   R=   R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,   2
  s    c         C   s   d |  j    f S(   Ns   AGD[%s](   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   7
  s    c         C   sY   i | d 6| d 6| j    j   d 6t j d 6} |  |   } t |  | _ t | _ | S(   sD   Create an attribute declaration component for a specified namespace.R]   R$   R"   R!   (   R-   R3  R   R   RC  t(   _AttributeGroupDefinition__attributeUsesR   t%   _AttributeGroupDefinition__isResolved(   R   R]   R$   t   attribute_usesR>   R6  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR7  :
  s    
	R  R  c   	      K   s  t  j | d  s t  t j | d  } | j i t j d 6 |  d | d | |  } | j |  t j | d  r t	 j
 d   n  | j d d	  | | d <| j | j  \ } } } t   | _ x* | D]" } | j j t j | |   q W| | _ | | _ | j d  | S(
   sG   Create an attribute group definition from the given DOM node.

        R  R]   R!   R#   R  s    Attribute reference at top levelR   R9  N(   R  R  R   R   R   R   R   R  R   R   R   R;  R
   R&  Rw  R%   R.  RB   RF  R   t.   _AttributeGroupDefinition__attributeGroupNamest'   _AttributeGroupDefinition__anyAttributeR=  (	   R   R#   R>   R]   R   R"  R   R$  R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   K
  s"    
 		c         C   s   |  j  S(   N(   R/  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRS   r
  s    c         C   s  |  j  r |  S|  j } g  } x |  j D]} } | j   } | d  k r] t j d | f   n  | j   s |  j d | f  |  S| j	 |  | j
 | j    } q& Wt |  |  _ d  } |  j d  k	 r t j |  j  } n  |  j t j |  j   | |   t |  _  |  S(   Ns"   Attribute group %s cannot be founds   attributeGroup %s not resolved(   R/  R.  R1  R   R
   R   R   RS   R=  Rr   R  R  RC  R2  R9   R   R  R  R1  R   R   (   R   t   usesR#  R  R`   R-  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR?  u
  s(    		"	c         C   s   | s t    St  |  j    S(   sA   Attribute group declarations require their uses, but only if lax.(   RC  R  (   R   RD  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRE  
  s    c         C   s   |  j  S(   N(   R.  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR  
  s    N(   R   R   R   R%   t+   _AttributeGroupDefinition__PrivateTransientR
   R.  R,   R   R   R7  R2  R1  R   R   R   R/  RS   R?  RE  R  (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   +
  s   			&			R   c           B   s>   e  Z d  Z d Z d   Z e d    Z d   Z d   Z	 RS(   sm   An XMLSchema U{Model Group Definition<http://www.w3.org/TR/xmlschema-1/#cModel_Group_Definitions>} component.c         C   s   |  j  S(   s:   The model group for which this definition provides a name.(   t!   _ModelGroupDefinition__modelGroup(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt
   modelGroup
  s    c         K   s  t  j | d  s t  t j | d  d k s6 t  t j | d  } t j | d <|  d | d | |  } | j |  | j	 d d  | | d <xf | j
 D][ } t j | j k r q n  t j |  r | j s t  t j | d | | | _ q q W| j d k	 st  | S(	   sc  Create a Model Group Definition from a DOM element node.

        wxs is a Schema instance within which the model group is being
        defined.

        node is a DOM element.  The name must be 'group', and the node
        must be in the XMLSchema namespace.  The node must have a
        'name' attribute, and must not have a 'ref' attribute.
        t   groupR  R]   R!   R#   R   t   model_group_definitionN(   R  R  R   R   R   R
   R   R  R   R;  Rw  R    R  R  R^   t   IsGroupMemberNodeR5  R   (   R   R#   R>   R]   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   
  s     
"c         C   s   | s t    St  |  j g  S(   s<   Model group definitions depend on the contained model group.(   RC  R5  (   R   RD  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRE  
  s    c         C   s   d |  j    |  j   f S(   Ns   MGD[%s: %s](   R]   R6  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   
  s    N(
   R   R   R   R
   R5  R6  R   R   RE  R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   
  s   	$	R^   c           B   s   e  Z d  Z d Z d Z d Z d Z e Z d   Z e	 d    Z
 d   Z d Z d   Z d	   Z d
   Z d Z d   Z d   Z d   Z d   Z e	 d    Z e	 d    Z d   Z d   Z d   Z RS(   sV   An XMLSchema U{Model Group<http://www.w3.org/TR/xmlschema-1/#cModel_Group>} component.i    i   i   i   c         C   s   |  j  S(   N(   t   _ModelGroup__compositor(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR  
  s    c         C   s=   |  j  | k r d S|  j | k r& d S|  j | k r9 d Sd S(   s#   Map a compositor value to a string.R  R  R  t   invalid(   t   C_ALLt   C_CHOICER  (   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   CompositorToString
  s    c         C   s   |  j  |  j  S(   s2   Return a string representing the compositor value.(   R>  R:  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   compositorToString
  s    c         C   s   |  j  S(   N(   t   _ModelGroup__particles(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR  
  s    c         C   s.   x' |  j    D] } | j |  s t Sq Wt S(   sa   A model group has an unresolvable particle if any of its
        particles is unresolvable.  Duh.(   R  R  R   R   (   R   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR  
  s    c   
      C   s  |  j  |  j |  j f k r d } d } x[ |  j D]P } | j   \ } } | | 7} | d k	 r1 | d k rt d } q | | 7} q1 q1 W| j   } | d k	 r | d k r d } q | | 9} n  | | j   | f S|  j  |  j k s t	  d t
 |  j  k rd } d }	 n |  j d j   \ } }	 xr |  j d D]c } | j   \ } } | | k  rc| } n  | d k rxd }	 q6|	 d k	 r6| |	 k r6| }	 q6q6W| | j   9} |	 d k	 r| j   d k	 r|	 | j   9}	 n  | |	 f S(   s   Return the minimum and maximum of the number of elements that can
        appear in a sequence matched by this particle.

        See U{http://www.w3.org/TR/xmlschema-1/#cos-seq-range}
        i    i   N(   R:  R<  R  R@  t   effectiveTotalRangeR
   t	   maxOccursR  R=  R   R;   (
   R   R  t   sum_minoccurst   sum_maxoccursR)  t   prt_mint   prt_maxt   prod_maxoccurst   min_minoccurst   max_maxoccurs(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRA  
  sB    
					c         C   s   |  j  S(   sI   The ModelGroupDefinition that names this group, or None if it is unnamed.(   t!   _ModelGroup__modelGroupDefinition(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR_   +  s    c         O   sS   t  t |   j | |   d | k s+ t  | |  _ | |  _ | j d  |  _ d S(   sL  Create a new model group.

        compositor must be a legal compositor value (one of C_ALL, C_CHOICE, C_SEQUENCE).

        particles must be a list of zero or more Particle instances.

        scope is the _ScopeDeclaration_mixin context into which new
        declarations are recorded.  It can be SCOPE_global, a complex
        type definition, or None if this is (or is within) a named
        model group.

        model_group_definition is an instance of ModelGroupDefinition
        if this is a named model group.  It defaults to None
        indicating a local group.
        R!   R8  N(   R+   R^   R,   R   R:  R@  R'   RJ  (   R   R  R  R=   R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,   /  s
    		c         C   s+   x$ |  j    D] } | j   r t Sq Wt S(   sC   Return True if the model includes a wildcard amongst its particles.(   R  Rp  R   R   (   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRp  F  s    c         C   s   | s t    St  |  j  S(   N(   RC  R@  (   R   RD  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRE  N  s    c         K   s  | d } t  j |  s. t | t  s. t  t j | d  rL |  j } n? t j | d  rj |  j } n! t j | d  s t  |  j	 } g  } | j
 d d  x | j D] } t j | j k r q n  t j |  rZt j d | |  } d | j   k rJt | d t  r*d	 t | j    } n d
 } t j d | | f  q| j |  q t j | d  s t j d | j f   q q W|  | | d | | }	 x | D] }
 |
 j |	  qW|	 j |  |	 S(   s  Create a model group from the given DOM node.

        wxs is a Schema instance within which the model group is being
        defined.

        node is a DOM element.  The name must be one of ( 'all',
        'choice', 'sequence' ), and the node must be in the XMLSchema
        namespace.

        scope is the _ScopeDeclaration_mxin context that is assigned
        to declarations that appear within the model group.  It can be
        None, indicating no scope defined, or a complex type
        definition.
        R!   R  R  R  R   R#   i    R4   s    at Rl   s*   Particle %s%s discarded due to maxOccurs 0R   s$   Unexpected element %s in model groupN(    R   R   R   R   R   R  R  R<  R=  R  R;  R
   Rw  R    R  R  Rx  Ry  R   RB  RN   R   t   strR4   RA  RB  Rr   R   R   R  R/   R   (   R   R#   R>   R!   R  R  R   R  t   locationR   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   T  s8    
$	 c         C   s   t  j | d d d  S(   NR  R  R  (   R  R  (   R   R#   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR9    s    c         C   s   |  } t  | t  s t  |  j | | j    } g  |  j   D] } | j | |  ^ q@ } |  j   | k p |  j   | k } | r | } | | _ n  | S(   N(	   R   R   R   RV   R   R  R[  R   R@  (   R   R   R   R   t   maybe_rvt   _pt   scoped_particlest   do_clone(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR[    s    +$c         C   sK   | |  t  |  x$ |  j   D] } | j | |  q W| |  t |  d  S(   N(   R   R  R   R   (   R   R   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s   d  } |  j |  j   k r$ d } n< |  j |  j   k rB d } n |  j |  j   k r` d } n  d | t j d  j g  |  j   D] } t j	 |  ^ q  f S(   Nt   ALLt   CHOICEt   SEQUENCEs   %s:(%s)t   ,(
   R
   R<  R  R=  R  R   t   ut   joinR  t	   text_type(   R   t   compRN  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    			N(   R   R   R   t	   C_INVALIDR<  R=  R  R:  R  R   R>  R?  R
   R@  R  R  RA  RJ  R_   R,   Rp  RE  R   R9  R[  R   R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR^   
  s.   					.				4		Rx  c           B   s   e  Z d  Z d Z d   Z d Z d   Z d Z d   Z	 d Z
 d Z d Z d   Z d   Z d   Z d   Z d	   Z d
   Z e d    Z d   Z d   Z d   Z d   Z d   Z e d    Z e d    Z d   Z RS(   sP   An XMLSchema U{Particle<http://www.w3.org/TR/xmlschema-1/#cParticle>} component.i   c         C   s   |  j  S(   sH   The minimum number of times the term may appear.

        Defaults to 1.(   t   _Particle__minOccurs(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    s    c         C   s   |  j  S(   sF  Upper limit on number of times the term may appear.

        If None, the term may appear any number of times; otherwise,
        this is an integral value indicating the maximum number of times
        the term may appear.  The default value is 1; the value, unless
        None, must always be at least minOccurs().
        (   t   _Particle__maxOccurs(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRB    s    c         C   s   |  j  S(   s=   A reference to a ModelGroup, Wildcard, or ElementDeclaration.(   t   _Particle__term(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   term  s    c         C   s8   t  |  j t  r" |  j j |   S|  j   |  j   f S(   s   Extend the concept of effective total range to all particles.

        See U{http://www.w3.org/TR/xmlschema-1/#cos-seq-range} and
        U{http://www.w3.org/TR/xmlschema-1/#cos-choice-range}
        (   R   R\  R^   RA  R  RB  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRA    s    c         C   s   d |  j    d k S(   s   Return C{True} iff this particle can legitimately match an empty
        sequence (no content).

        See U{http://www.w3.org/TR/xmlschema-1/#cos-group-emptiable}
        i    (   RA  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    s    c         C   s   |  j    j   S(   sy   Return True iff this particle has a wildcard in its term.

        Note that the wildcard may be in a nested model group.(   R]  Rp  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRp    s    c         O   s   t  t |   j | |   | j d d  } | j d d  } d | k sO t  |  j   sv t |  j   t  sv t  | d k	 r | |  _
 n  t | t j  s t  | |  _ | d k s t | t j  s t  | |  _ |  j d k	 r|  j |  j k rt j d | | f   qn  d S(   s  Create a particle from the given DOM node.

        term is a XML Schema Component: one of ModelGroup,
        ElementDeclaration, and Wildcard.

        The following keyword arguments are processed:

        min_occurs is a non-negative integer value with default 1,
        denoting the minimum number of terms required by the content
        model.

        max_occurs is a positive integer value with default 1, or None
        indicating unbounded, denoting the maximum number of terms
        allowed by the content model.

        scope is the _ScopeDeclaration_mxin context that is assigned
        to declarations that appear within the particle.  It can be
        None, indicating no scope defined, or a complex type
        definition.
        R  i   R  R!   s>   Particle minOccurs %s is greater than maxOccurs %s on creationN(   R+   Rx  R,   R'   R   R   R   R   R   R
   R\  R   t   integer_typesRZ  R[  R   R   (   R   R]  R=   R>   R  R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,     s    '	$	c         C   sN  |  j    r |  St |  j k r} |  j j   } | d  k rV t j d |  j f   n  | j   |  _	 |  j	 d  k	 s)t
  n t |  j k r|  j d  k	 r |  j	 d  k s t
  |  j j   |  _	 |  j	 d  k r t j d |  j f   q n  |  j	 d  k	 st
  |  j	 d  k	 s)t
  n t s)t
  |  j	 |  _ |  j d  k	 sJt
  |  S(   Ns(   Model group reference %s cannot be founds)   Unable to locate element referenced by %s(   RS   R^   t   _Particle__resolvableTypet   _Particle__refExpandedNameR_   R
   R   R   R6  t   _Particle__pendingTermR   Rd   R   R   R\  (   R   t
   group_decl(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR?    s(    c         C   s   |  j  d  k	 S(   N(   R\  R
   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRS   .  s    c         K   s4  | d } t  j |  s. t | t  s. t  | j i d d 6d d 6| d 6 t j |  s{ t j	 d | j
 f   n  t j | d  } | d k	 r t j |  | d <n  t j | d  } | d k	 r d	 | k r d | d <q t j |  | d <n  |  d |  } | j d d  | | d
 <t j | d  | _ d | _ d | _ t j | d  r| j d k rt j d   n  t | _ nt j | d  r| j d k r4| j d  } | d k	 st  | j | t  } | j d  } | d k	 r| | k st  n
 | | d <t j d | |  | _ qxE d D]= }	 t j | |	  }
 |
 d k	 r;t j d |	 f   q;q;Wt | _ t j | j d  st  np t j | d  rt j d |  | _ nF t j  |  rt j | |  | _ n t j	 d | j! d  f   | j"   s0| j# d  n  | S(   s   Create a particle from the given DOM node.

        wxs is a Schema instance within which the model group is being
        defined.

        node is a DOM element.  The name must be one of ( 'group',
        'element', 'any', 'all', 'choice', 'sequence' ), and the node
        must be in the XMLSchema namespace.

        scope is the _ScopeDeclaration_mxin context that is assigned
        to declarations that appear within the model group.  It can be
        None, indicating no scope defined, or a complex type
        definition.
        R!   i   R  R  R#   s4   Attempted to create particle from illegal element %sR  RB  t	   unboundedR   R  R7  s    group particle without referenceRq  R$   R   Rf  R   R   t   formt   blockR:   s#   element with "ref" cannot have "%s"t   anys,   Unhandled node in Particle.CreateFromDOM: %ss   utf-8R9  N(   s   nillables   defaults   fixedRd  s   blocks   type($   R   R   R   R   R   R   Rx  Ry  R   R   R  R   R   R
   R   t   nonNegativeIntegerR;  R   R`  Ra  R_  R  R  R   R^   R'   RX  Rd   R   R\  R:  R9   R9  t   toxmlRS   R=  (   R   R#   R>   R!   R  R   R$   R   t   incoming_tnsR  t   av(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   2  sb    
$
		
	c         C   s   | s t    St  |  j g  S(   N(   RC  R\  (   R   RD  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRE    s    c         C   s   |  } t  | t  s t  |  j | | j    } | j j | |  } |  j   | k pf | j | k } | r | } | | _ n  | S(   N(   R   R   R   RV   R   R\  R[  R   (   R   R   R   R   RM  R]  RP  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR[    s    !c         C   s#   |  j    s t S|  j   j |  S(   s   A particle has an unresolvable particle if it cannot be
        resolved, or if it has resolved to a term which is a model
        group that has an unresolvable particle.
        (   RS   R   R]  R  (   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    s    c         C   s   |  j  | |  d S(   sx   The entry-point to walk a particle tree defining a content model.

        See L{_ParticleTree_mixin._walkParticleTree}.N(   R   (   R   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   walkParticleTree  s    c         C   s7   | |  t  |  |  j j | |  | |  t |  d  S(   N(   R   R\  R   R   (   R   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s   t  j | d d d d  S(   NR7  R  R  R  (   R  R  (   R   R#   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    s    c      	   G   s"   t  j | d d d d d d |  S(   NR7  R  R  R  Rq  Rf  (   R  R  (   R   R#   t   others(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRy    s    c         C   s&   d d |  j    |  j   t |   f S(   Ns   PART{%s:%d,%s}[%x]t   TERM(   R  RB  R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    N(   R   R   R   RZ  R  R[  RB  R
   R\  R]  Ra  R`  R_  RA  R  Rp  R,   R?  RS   R   R   RE  R[  R  Rk  R   R  Ry  R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRx    s2   				
			*	#	W						R9   c           B   s   e  Z d  Z d Z d Z d Z d Z d Z d   Z	 e
 d    Z e
 d    Z d Z d	 Z d
 Z d Z d   Z d   Z d   Z d   Z d   Z d   Z e
 d    Z RS(   sP   An XMLSchema U{Wildcard<http://www.w3.org/TR/xmlschema-1/#cParticle>} component.s   ##anys   ##others   ##targetNamespaces   ##localc         C   s   |  j  S(   s  A constraint on the namespace for the wildcard.

        Valid values are:
         - L{Wildcard.NC_any}
         - A tuple ( L{Wildcard.NC_not}, a_namespace )
         - set(of_namespaces)

        Note that namespace are represented by
        L{Namespace<pyxb.namespace.Namespace>} instances, not the URIs that
        actually define a namespace.  Absence of a namespace is represented by
        C{None}, both in the "not" pair and in the set.
        (   t   _Wildcard__namespaceConstraint(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR)    s    c         C   s0  d t  |  k  s t  | j d  } xd t  |  k  r+| j d  } | | k r] q* n  |  j | k s{ |  j | k r |  j } q* n  t | t  r t | t  r | j |  } q* n  t | t  rt | t  r| d | d k r|  j d f } q* n  d } d } t | t  rCt | t  s4t  | } | } n6 t | t  sXt  t | t  smt  | } | } | d } | d k	 r| | k rd | k r|  j } q* n  | | k r|  j d f } q* n  d | k rt
 j d   n  | } q* n  d | k r|  j } q* |  j d f } q* W| S(   s.   http://www.w3.org/TR/xmlschema-1/#cos-aw-unioni    i   s7   Union of wildcard namespace constraints not expressibleN(   R;   R   R;  R  R   R%   R  Ru   t   NC_notR
   R   R   (   R   t   constraintst   o1t   o2t   c_tuplet   c_sett
   negated_ns(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    sR    	2	
	c   	      C   sn  d t  |  k  s t  | j d  } x@d t  |  k  ri| j d  } | | k r] q* n  |  j | k s{ |  j | k r |  j | k r* | } q* q* n  t | t  r t | t  r | j |  } q* n  t | t  rt | t  r| d } | d } | d k	 r4| d k	 r4| | k r4t	 j
 d   n  | d k sR| d k sRt  | d k r| d k	 spt  |  j | f } q* | d k	 st  |  j | f } q* n  d } d } t | t  rt | t  st  | } | } n6 t | t  st  t | t  st  | } | } | d } | | k rD| j |  n  d | k r`| j d  n  | } q* W| S(   s2   http://www.w3.org/TR/xmlschema-1/#cos-aw-intersecti    i   s>   Intersection of wildcard namespace constraints not expressibleN(   R;   R   R;  R  R   R%   t   intersectionRu   R
   R   R   Ro  R  (	   R   Rp  Rq  Rr  t   ns1t   ns2Rs  Rt  Ru  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR+    sT    	

$	

t   skipt   laxt   strictc         C   s   |  j  S(   N(   t   _Wildcard__processContents(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR*  K  s    c         C   s   t  S(   s5   Return True, since Wildcard components are wildcards.(   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRp  N  s    c         O   sO   d t  |  k s t  t t |   j | |   | d |  _ | d |  _ d  S(   Ni    R(  R'  (   R;   R   R+   R9   R,   Rn  R|  (   R   R=   R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,   R  s    c         C   s   t  S(   N(   R   (   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR  X  s    c         C   s   | |  d  |  d  S(   N(   R
   (   R   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   [  s    c         C   s   |  S(   s,   Wildcards are scope-independent; return self(    (   R   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR[  _  s    c         K   s  t  j j j |  } t j | d d  s0 t  t j | d  } | d  k rZ |  j
 } n |  j
 | k ru |  j
 } n |  j | k r |  j | j   f } n t   } xw | j   D]i } |  j | k r | j d   q |  j | k r | j | j    q | j t  j j | d t  q Wt |  } t j | d  } | d  k rU|  j }	 n= | |  j |  j |  j g k r|| }	 n t  j d | f   |  d | d | d	 |	 |  }
 |
 j |  |
 S(
   NRf  R  R(   t   create_if_missingR*  s4   illegal value "%s" for any processContents attributeR#   R(  R'  (   R   R(   R)   R*   R  R  R   R   R   R
   R  Ro  R-   R%   t   splitt   NC_localRB   t   NC_targetNamespacet   NamespaceForURIR   RC  t	   PC_strictt   PC_skipR  R   R   (   R   R#   R>   R"   t   ncR(  t   ncsRw   t   pcR'  R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   d  s4    	#	N(   R   R   R   R  Ro  R  R  R
   Rn  R)  R   R  R+  R  R  R  R|  R*  Rp  R,   R  R   R[  R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR9     s(   	98						R   c           B   s   e  Z d  Z d Z d Z d Z d Z d   Z d Z	 d   Z
 d Z d   Z d Z d Z d Z d Z d   Z e d    Z e Z d	   Z d
   Z d   Z RS(   s}   An XMLSchema U{Identity Constraint Definition<http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions>} component.i   i   i   c         C   s   |  j  S(   N(   t9   _IdentityConstraintDefinition__identityConstraintCategory(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   identityConstraintCategory  s    c         C   s   |  j  S(   N(   t'   _IdentityConstraintDefinition__selector(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   selector  s    c         C   s   |  j  S(   N(   t%   _IdentityConstraintDefinition__fields(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   fields  s    c         C   s   |  j  S(   N(   t*   _IdentityConstraintDefinition__annotations(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   annotations  s    c   
      K   s0  t  j | d  } | d } t j |  s@ t j |  s@ t  |  d | d | |  } | j d d   | | d <t | _	 d  } t
 j | d  r | j } n t
 j | d  r | j } t  j | d  | _ | j d  k r t j d   n  t | _	 n= t
 j | d	  r| j } n t j d
 | j d  f   | | _ t  j | d  } t  j | d  | _ | j d  k rt j d   n  g  | _ xZ t  j | d  D]F } t  j | d  } | d  k rt j d   n  | j j |  qW| j |  g  | _ | j   d  k	 r+| j j |  n  x | j D] } t j  | j! k rSq5n  d  }	 t
 j | d d  rt  j | d  }	 n t
 j | d  r| }	 n  |	 d  k	 r5| j j t" j# |	 |   q5q5W| | _$ | j | j$ k r| j%   j&   j' d | j(   |  n  | j)   s,| j* d  n  | S(   NR]   R!   R#   R   R}   Rt  t   refers*   Require refer attribute on keyref elementsRs  s&   Unexpected identity constraint node %ss   utf-8R  t   xpaths(   selector element missing xpath attributet   fields%   field element missing xpath attributeR   R   R9  (+   R   R   R   R   R  R   R;  R
   R   t)   _IdentityConstraintDefinition__isResolvedR  R  t   ICC_KEYt
   ICC_KEYREFt-   _IdentityConstraintDefinition__referAttributeR   R   R   t
   ICC_UNIQUER   Rh  t"   _IdentityConstraintDefinition__iccR   R  R  t   LocateMatchingChildrenRr   R   R  R   Rw  R    R  R  R8   R   R  R   R-   R   R]   RS   R=  (
   R   R#   R>   R]   R!   R   t   iccR   t   xp_attrt   an(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     sd    
$
						#	(c         C   s   |  j  S(   N(   R  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRS     s    c         C   s   |  j    r |  S|  j } |  j | k r |  j   j |  j  } | j   } | d  k rv |  j d | f d | |  S| |  _	 n  t
 |  _ |  S(   Ns1   Identity constraint definition %s cannot be foundR  (   RS   R  R  R   t   interpretQNameR  R   R
   R=  t,   _IdentityConstraintDefinition__referencedKeyR   R  (   R   R  t   refer_enR  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR?    s    		c         C   s;   t    } | r1 |  j d k	 r1 | j |  j  n  t |  S(   sO   Constraint definitions that are by reference require the referenced constraint.N(   R%   R  R
   RB   RC  (   R   RD  R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRE    s    	N(   R   R   R   R  R  R  R
   R  R  R  R  R  R  R  R  R  R  R  R   R   R   R  RS   R?  RE  (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s(   				?		t   NotationDeclarationc           B   sD   e  Z d  Z d Z d   Z d Z d   Z e d    Z	 d   Z
 RS(   si   An XMLSchema U{Notation Declaration<http://www.w3.org/TR/xmlschema-1/#cNotation_Declarations>} component.c         C   s   |  j  S(   N(   t&   _NotationDeclaration__systemIdentifier(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   systemIdentifier  s    c         C   s   |  j  S(   N(   t&   _NotationDeclaration__publicIdentifier(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   publicIdentifier
  s    c         K   se   t  j | d  } |  d | d | |  } t  j | d  | _ t  j | d  | _ | j |  | S(   NR]   R#   t   systemt   public(   R   R   R  R  R   (   R   R#   R>   R]   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s   t    S(   N(   RC  (   R   RD  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRE    s    N(   R   R   R   R
   R  R  R  R  R   R   RE  (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    s   		R8   c           B   st   e  Z d  Z d	 Z d   Z d	 Z d   Z d   Z d	 Z	 e
 d    Z e j d  Z d   Z d   Z d   Z RS(
   sT   An XMLSchema U{Annotation<http://www.w3.org/TR/xmlschema-1/#cAnnotation>} component.c         C   s   |  j  S(   N(   t#   _Annotation__applicationInformation(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   applicationInformation"  s    c         C   s   |  j  S(   N(   t   _Annotation__userInformation(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   userInformation&  s    c         K   s   | j  d d   } | j  d d   } t t |   j |   | d  k	 rk t | t  rk t j |  g } n  | d  k	 r t | t  r t j |  g } n  | |  _	 | |  _
 d  S(   Nt   application_informationt   user_information(   R;  R
   R+   R8   R,   R   t   listR   RW  R  R  (   R   R>   R  R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,   *  s    	c         K   s   |  d | |  } t  j | d  s* t  g  } g  } xU | j D]J } t  j | d  rh | j |  q@ t  j | d  r@ | j |  q@ q@ Wd t |  k  r | | _ n  d t |  k  r | | _ n  | S(   NR#   R   t   appinfot   documentationi    (   R  R  R   Rw  Rr   R;   R  R  (   R   R#   R>   R   t   app_infot	   user_infoR   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   ?  s    s   ""+c         C   s`   |  j    } |  j j d   |  } | j d  r@ d | } n  | j d  r\ | d } n  | S(   sq  Return the text in a form suitable for embedding in a
        triple-double-quoted docstring.

        Any sequence of two or more double quotes is replaced by a sequence of
        single quotes that is the same length.  Following this, spaces are
        added at the start and the end as necessary to ensure a double quote
        does not appear in those positions.c         S   s   d |  j  d  |  j d  S(   Nt   'i    (   t   endt   start(   t   _mo(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRJ   b  s    t   "t    (   t   textt    _Annotation__RemoveMultiQuote_ret   subt
   startswitht   endswith(   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   asDocStringY  s    c         C   ss   |  j  d  k r d Sg  } xJ |  j  D]? } x6 | j D]+ } t j | j k r3 | j | j  q3 q3 Wq# Wd j |  S(   NRl   (	   R  R
   Rw  R    t	   TEXT_NODER  Rr   t   dataRV  (   R   R  t   dnR   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR  i  s    c         C   s
   |  j    S(   s   Return the catenation of all user information elements in the
        annotation as a single unicode string.  Returns the empty string if
        there are no user information elements.(   R  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   u  s    N(   R   R   R   R
   R  R  R  R  R,   t   _Annotation__attributesR   R   t   ret   compileR  R  R  R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR8     s   					RW   c           B   s  e  Z d  Z d4 Z d   Z d4 Z d4 Z d4 Z d4 Z	 d4 Z
 d4 Z d   Z d4 Z d   Z d Z d Z d Z d Z d Z i e d	 6e d
 6e d 6e d 6Z e Z e d    Z d Z d Z d Z d Z d Z d Z d
 Z d Z d   Z  d4 Z! d4 Z" d   Z# e d    Z$ d4 Z% e& d  Z' d4 Z( d   Z) d4 Z* d   Z+ d   Z, d4 Z- e. Z/ d   Z0 d   Z1 d   Z2 d   Z3 d   Z4 d4 Z5 e d4 e. d   Z6 e d    Z7 e d    Z8 e d    Z9 e d     Z: e d!    Z; e. d"  Z< d#   Z= d$   Z> d4 Z? d%   Z@ d&   ZA d'   ZB d(   ZC d)   ZD d*   ZE d+   ZF d,   ZG d-   ZH e d.    ZI d4 ZJ d/   ZK d0   ZL d1   ZM d2   ZN d3   ZO RS(5   sl   An XMLSchema U{Simple Type Definition<http://www.w3.org/TR/xmlschema-1/#Simple_Type_Definitions>} component.c         C   s   |  j  S(   N(   t)   _SimpleTypeDefinition__baseTypeDefinition(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s1   |  j  d  k s* t |  j  t j  s* t  |  j  S(   N(   t   _SimpleTypeDefinition__facetsR
   R   R   t   dictionary_typeR   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    *c         C   s   |  j  S(   s5   A frozenset of instances of facets.FundamentallFacet.(   t(   _SimpleTypeDefinition__fundamentalFacets(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   fundamentalFacets  s    i    i   i   i   i   Rk  R  Rl  R  c         C   s   g  } | |  j  @r# | j d  n  | |  j @r@ | j d  n  | |  j @r] | j d  n  | |  j @rz | j d  n  d j |  S(   s"   Convert a final value to a string.Rk  R  Rl  R  R  (   t   STD_extensionRr   t   STD_listt   STD_restrictiont	   STD_unionRV  (   R   t   final_valuet   tags(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _FinalToString  s    i   s   none specifiedc         C   s   |  j  S(   N(   t,   _SimpleTypeDefinition__derivationAlternative(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s   |  j  S(   N(   t   _SimpleTypeDefinition__variety(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   variety  s    c         C   sP   |  j  | k r d S|  j | k r& d S|  j | k r9 d S|  j | k rL d Sd S(   s$   Convert a variety value to a string.t   absentt   atomicR  R  s   ?NoVariety?(   t   VARIETY_absentt   VARIETY_atomict   VARIETY_listt   VARIETY_union(   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   VarietyToString  s    c         C   sX   | rQ |  j  |  j   k s! t  |  j d  k rQ t j d |  |  j     qQ n  |  j S(   Ns$   Expected primitive type for %s in %s(   R  R  R   t.   _SimpleTypeDefinition__primitiveTypeDefinitionR
   R   R   R-   (   R   t   throw_if_absent(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   primitiveTypeDefinition  s
    !c         C   sC   |  j  |  j   k s t  |  j d  k r< t j d   n  |  j S(   Ns   Expected item type(   R  R  R   t)   _SimpleTypeDefinition__itemTypeDefinitionR
   R   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   itemTypeDefinition  s    c         C   sC   |  j  |  j   k s t  |  j d  k r< t j d   n  |  j S(   Ns   Expected member types(   R  R  R   t,   _SimpleTypeDefinition__memberTypeDefinitionsR
   R   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   memberTypeDefinitions  s    c         C   s%  t    } |  |  j   k r1 | j |  j    n  |  j |  j   k rR t    } n |  j |  j   k r |  |  j   k r| j |  j    qn |  j |  j   k r |  |  j   k s t	  | j |  j    nF |  j
 |  j   k s t	  |  |  j   k st	  | j |  j    t |  S(   s   Implement base class method.

        This STD depends on its baseTypeDefinition, unless its variety
        is absent.  Other dependencies are on item, primitive, or
        member type definitions.(   R%   R   RB   R  R  R  R  R  R  R   R  R  R   RC  (   R   RD  t   type_definitions(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRE    s    	c         O   s*   t  t |   j | |   | d |  _ d  S(   NR  (   R+   RW   R,   R  (   R   R=   R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,     s    c            sT   t  t t    d   f d    } | |    j d k	 rP   j j    n  d S(   s6  Extend base class unpickle support to retain link between
        this instance and the Python class that it describes.

        This is because the pythonSupport value is a class reference,
        not an instance reference, so it wasn't deserialized, and its
        class member link was never set.
        R   c            s     j  j |   S(   N(   R   R   (   t   _state(   R   (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRJ   (  s    N(   RN   R+   RW   t$   _SimpleTypeDefinition__pythonSupportR
   t   _SimpleTypeDefinition(   R   R   t   super_fn(    (   R   sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR      s    $
c         C   s   |  j    d  k	 r' |  j    d g } n	 d g } |  j |  j   k rU | j d  n |  j |  j   k r | j d |  j   j    f  n |  j |  j   k r | j d |  j   j    f  np |  j	 |  j   k r(| j d t
 j d  j g  |  j   D] } t
 j | j     ^ q   n | j d  |  j rg  } xE t
 j |  j  D]1 \ } } | d  k	 rW| j t
 j |   qWqWW| j t
 j d	  d
 j |  f  n  |  j r| j d  | j t
 j d
  j g  |  j D] } t
 j |  ^ q  n  d d j |  f S(   NR   s   <anonymous>:s   the ur-types   restriction of %ss
   list of %ss   union of %sR  t   ?s   
  %sRT  s   
  s   STD[%s]Rl   (   R]   R
   R  R  Rr   R  R   R  R  R  R   RU  RV  R  RW  R  t	   iteritemsR  (   R   t   eltst   _mtdt   feltst   kRz   t   _f(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   -  s,    	##N	)	Ac         C   s   |  | k s t   |  j |  s' t   t t |   j |  | j d k s_ t  d | f   | j d k	 st t   | j |  _ | j d k	 r | j |  _ n  d |  _	 |  S(   s  Override fields in this instance with those from the other.

        This method is invoked only by Schema._addNamedComponent, and
        then only when a built-in type collides with a schema-defined
        type.  Material like facets is not (currently) held in the
        built-in copy, so the DOM information is copied over to the
        built-in STD, which is subsequently re-resolved.

        Returns self.
        s   Update from resolved STD %sN(
   R   R   R+   RW   Rj   R  R
   t   _SimpleTypeDefinition__domNodeR  R  (   R   Rk   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRj   I  s    "	c         C   s   |  j  S(   s5   Indicate whether this simple type is a built-in type.(   t    _SimpleTypeDefinition__isBuiltin(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR  f  s    c         C   s   |  j  d k r | d k	 s! t  | j   j   } i d d 6| d 6| d 6| j   d 6|  j d 6t j d 6} t |   } | j	 t
 j  t j   | _ |  j | _ i  | _ t   | _ | j   | |  _  n  |  j  S(	   sk   Create the SimpleTypeDefinition instance that approximates the simple ur-type.

        See section 3.14.7.t   anySimpleTypeR]   R$   R"   R   R  R!   N(   t-   _SimpleTypeDefinition__SimpleUrTypeDefinitionR
   R   R-   R3  R  R   R   RY   t   _setPythonSupportR   R  R   R{  R  R   R  R  RC  R  t%   _SimpleTypeDefinition__resolveBuiltin(   R   R$   R  R  R>   R6  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR<  k  s$    

	
c         C   s  d d l  m } i | d 6| j   d 6| j   j   d 6t j d 6|  j d 6} d | k r |  |   } |  j | _ t	 j
 j   | _ | j j | _ | j | j  | j d	  n d
 | k r'|  |   } |  j   | _ t	 j j   g | _ |  j | _ | | _ | j | j  | j d  n t j d | f   i  | _ xE t j | j   j  D]+ } t | t j  r_| | j | j  <q_q_W| S(   s   Create STD instances for built-in types.

        For example, xml:space is a restriction of NCName; xml:lang is a union.

        i(   t   xml_R$   R   R"   R!   R  t   spacet   STD_ANON_spacet   langt   STD_ANON_langs   No implementation for xml:%s(!   t   pyxb.bindingR  R-   R3  R   R   R  R   R  R   t   NCNameRW   R  R  R  R  Rg   R<  t   languaget"   _SimpleTypeDefinition__memberTypest	   _DA_unionR  R   t   IncompleteImplementationErrorR  R   R  R*  R   R   R   t   ConstrainingFacetR   (   R   R]   R$   R  R>   R6  Rz   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _CreateXMLInstance  s6    

		c         C   s   i | d 6| d 6| j    d 6| j    j   d 6t j d 6|  j d 6} |  |   } | j |  |  j | _ |  j   | _	 | | _
 | j   | j   s t  | S(   s  Create a primitive simple type in the target namespace.

        This is mainly used to pre-load standard built-in primitive
        types, such as those defined by XMLSchema Datatypes.  You can
        use it for your own schemas as well, if you have special types
        that require explicit support to for Pythonic conversion.

        All parameters are required and must be non-None.
        R]   R$   R   R"   R!   R  (   R-   R3  R   R   R  R  R   R  R<  R  R  R  RS   R   (   R   R]   R$   t   python_supportR>   R6  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   CreatePrimitiveInstance  s    

	
c         C   s   | s t   | j |  j |  j f k s- t   i | d 6| d 6| j   d 6| j   j   d 6t j d 6| j d 6} |  |   } | j |  | | _	 |  j
 | _ |  j | j k r | j	 j | _ n  | j   | S(   s  Create a derived simple type in the target namespace.

        This is used to pre-load standard built-in derived types.  You
        can use it for your own schemas as well, if you have special
        types that require explicit support to for Pythonic
        conversion.
        R]   R$   R   R"   R!   R  (   R   R  R  R  R-   R3  R   R   R  R  R   R  R  R  (   R   R]   R$   t
   parent_stdR  R>   R6  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   CreateDerivedInstance  s     	!

	
c         C   s   i | d 6| d 6| j    d 6| j    j   d 6t j d 6|  j d 6} |  |   } | j |  |  j   | _ | s| t  | | _	 | j
   | S(   sN  Create a list simple type in the target namespace.

        This is used to preload standard built-in list types.  You can
        use it for your own schemas as well, if you have special types
        that require explicit support to for Pythonic conversion; but
        note that such support is identified by the item_std.
        R]   R$   R   R"   R!   R  (   R-   R3  R   R   R  R  R<  R  R   R  R  (   R   R]   R$   t   item_stdR  R>   R6  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   CreateListInstance  s    


	
c         C   s   t  j d   d S(   sr   (Placeholder) Create a union simple type in the target namespace.

        This function has not been implemented.s#   No support for built-in union typesN(   R   R  (   R   R]   R$   t   member_stds(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   CreateUnionInstance  s    c         C   s   d  } xi | j D]^ } t j | j k r t j | d  sX | rF q n  t j d   n  | se t	  | } q q W| d  k r t j d   n  | S(   NR8  s,   Context requires element to be xs:simpleTypes>   Content requires an xs:simpleType member (or a base attribute)(
   R
   Rw  R    R  R  R  R  R   R   R   (   R   t   bodyt   other_elts_okt   simple_type_childR   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __singleSimpleTypeChild  s    c         K   sm   |  j    |  _ t j | d  |  _ |  j d  k rT |  j |  j |  |  |  _ n  |  j	 | |  j
 |  j  S(   Nt   itemType(   R<  R  R   R   t+   _SimpleTypeDefinition__itemTypeExpandedNameR
   R   t,   _SimpleTypeDefinition__singleSimpleTypeChildR  t)   _SimpleTypeDefinition__completeResolutionR  t   _DA_list(   R   R  R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __initializeFromList/  s
    !c         K   ss   |  j  d  k r] t j | d  |  _ |  j d  k r] |  j |  j | d t |  |  _  q] n  |  j | d  |  j	  S(   NR  R  (
   R  R
   R   R   t'   _SimpleTypeDefinition__baseExpandedNameR   R  R   R  R   (   R   R  R>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __initializeFromRestriction9  s
    *c         K   s  |  j    |  _ t j | d  } d  |  _ | d  k	 ry t j j j	 |  } g  | j
   D] } | j |  ^ qX |  _ n  |  j d  k r g  |  _ xW | j D]I } t j | j k r t j | d  r |  j j |  j | |   q q Wn  |  j | |  j |  j  S(   Nt   memberTypesR8  (   R<  R  R   R   R
   t/   _SimpleTypeDefinition__memberTypesExpandedNamesR   R(   R)   R*   R~  R  t'   _SimpleTypeDefinition__localMemberTypesRw  R    R  R  R  R  Rr   R   R  R  R  (   R   R  R>   t   mtat   nsct   _mtenR   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __initializeFromUnionA  s    	.	$&c         C   s   |  j    r i  |  _ xs t j |  j   j  D]V } t | t j  r. | |  j | j	 <| j
   d  k r | j d t d |   q q. q. Wn  t |  _ |  S(   Nt   _constructort   owner_type_definition(   t   hasPythonSupportR  R   R  R*  R   R   R   R  R   t   ownerTypeDefinitionR
   t   setFromKeywordsR   R  (   R   Rz   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __resolveBuiltinO  s    	#	c         C   s=   |  j  | k r |  S|  j j t j  |  j j t j  |  S(   s   Create facets for varieties that can take facets that are undeclared.

        This means unions, which per section 4.1.2.3 of
        http://www.w3.org/TR/xmlschema-2/ can have enumeration or
        pattern restrictions.(   R  R  R  R   t
   CF_patternt   CF_enumeration(   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __defineDefaultFacetsZ  s
    c   
      C   s  i  |  _  t   |  _ |  j   d k r4 |  j |  S|  j   j   } | d k r_ |  j |  Si  } t   } t   } x| D]	} x | j D] } t	 j
 | j k r q n  t j j j | d  rLt j | d  } | d k r t j d | f   n  | | k r t j d | f   n  | j |  t j j |  }	 d | |	 <n  t j j j | d  r | j t j j | |    q q Wq~ Wd t |  k  r|  j |  j   k st  | |  _  t |  j  t j  st  n  d t |  k  rt |  |  _ n  |  S(   s  Identify the facets and properties for this stype.

        This method simply identifies the facets that apply to this
        specific type, and records property values.  Only
        explicitly-associated facets and properties are stored; others
        from base types will also affect this type.  The information
        is taken from the applicationInformation children of the
        definition's annotation node, if any.  If there is no support
        for the XMLSchema_hasFacetAndProperty namespace, this is a
        no-op.

        Upon return, self.__facets is a map from the class for an
        associated fact to None, and self.__fundamentalFacets is a
        frozenset of instances of FundamentalFacet.

        The return value is self.
        t   hasFacetR]   s%   hasFacet missing name attribute in %ss'   Multiple hasFacet specifications for %st   hasPropertyi    N(    R  RC  R  R   R
   t*   _SimpleTypeDefinition__defineDefaultFacetsR  R%   Rw  R    R  R  R   R(   t   XMLSchema_hfpR  R   R   R   RB   R   R  t   ClassForFacett   FundamentalFacetR   R;   R  R<  R   R   R   R  (
   R   R  R  t	   facet_mapt   fundamental_facetst   seen_facetst   aiR   t
   facet_namet   facet_class(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __processHasFacetAndPropertyf  s@    			'	c         C   sb  i  } xLt  j j D]>} t j | | j    } d t |  k  r | d |  j d |   } t | t  j	  r} | j
 |   n  x | D] } i t j | d  d 6} xH t d | j j  D]1 } | j j |  }	 |	 j | t j |	 j  <q Wy | j |   Wq t j k
 r?}
 t j d | j   |  j   |
 f   q Xq W| | | <q q W| |  _ i  } |  j j   r|  j j   } | t j k r| j | j    qnI |  j j    rt |  j j    t j   st!  | j |  j j     n  | j |  j     |  j |  _" x. t j# |  D] } |  j" j$ | | |  q"Wt |  j" t j   s^t!  d  S(   Ni    t   base_type_definitionR  R   s"   Error assigning facet %s in %s: %s(%   R   t   Facett   FacetsR   R  t   NameR;   R  R   t   _LateDatatype_mixint   bindValueDatatypeR   t   rangeR"  t   lengtht   itemR  R   RW  Rz  R  R   t   PyXBExceptionR   R   t"   _SimpleTypeDefinition__localFacetsR  R*  R   R  R   t	   _FacetMapR  R   R  R   R  (   R   R  t   local_facetst   fct   childrent   fiR   R>   R,  t   attrt   et   base_facetst   pstd(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __updateFacets  s@    	0		!c         C   sX   t  d | d | j   d d d |  j   d | j    } |  | _ | j | d |  j  S(   s  Create a new simple type with this as its base.

        The type is owned by the provided owner, and may have facet
        restrictions defined by the body.
        @param owner: the owner for the newly created type
        @type owner: L{ComplexTypeDefinition}
        @param body: the DOM node from which facet information will be extracted
        @type body: C{xml.dom.Node}
        @rtype: L{SimpleTypeDefinition}
        R   R"   R  R!   R$   N(   RW   R   R
   R   R   R  R  R   (   R   R   R  R5  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    s    9	c   
      C   su  |  j  d  k s t  |  j d  k r |  j d  k	 s9 t  |  j j   } t | t  ss t j	 d |  j f   n  | |  _ n  |  j |  k s t  |  j j
   s |  j d |  j f d |  j |  S| d  k r |  j j  } n  | d  k	 s t  |  j | k rn|  j | k r^|  } x4 t | t  rQ|  j | j j   k rQ| j } qW| |  _ n|  j | k r|  j | k r|  j d  k	 r|  j j   |  _ t |  j t  st j	 d |  j f   qqq|  j | k r|  j j |  _ qt j d | f   n|  j | k r|  j | k ru|  j d  k rg  } |  j d  k	 rxg |  j D]Y } | j   } | d  k rt j	 d | f   n  t | t  st  | j |  qWWn  | j |  j  | |  _ d  |  j k st  n  g  } x |  j D]v }	 t |	 t  st  |	 j
   s6|  j d d |	 |  S|  j |	 j   k ra| j |	 j    q| j |	  qWnj |  j | k r|  j st  |  j j
   st  |  j j } | d  k	 st  n t j d | f   | |  _ n t j d	 | f   |  j |  z3 t j j  j! t j j  j" |   |  j# |  Wd  t j j  j$   X| |  _% | |  _  d  |  _& |  S(
   Ns   Unable to locate base type %ss   base type %s is not resolvedR  s!   Unable to locate STD %s for itemss3   completeResolution list variety with alternative %ss   Unable to locate member type %ss   member type not resolveds4   completeResolution union variety with alternative %ss&   completeResolution with variety 0x%02x('   R  R
   R   R  R  R   R   RW   R   R   RS   R=  R  R  R  R  R  R  R  R  R   R   R  R  R  R  Rr   R  R  R  t1   _SimpleTypeDefinition__processHasFacetAndPropertyR(   R)   t   PushContextR*   t#   _SimpleTypeDefinition__updateFacetst
   PopContextR  R  (
   R   R  R  t   alternativeR(  t   ptdt   mtdt   mn_enR5  t   mt(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __completeResolution  s     *"	"			c         C   s   |  j  d k	 S(   sc  Indicate whether this simple type is fully defined.

        Type resolution for simple types means that the corresponding
        schema component fields have been set.  Specifically, that
        means variety, baseTypeDefinition, and the appropriate
        additional fields depending on variety.  See _resolve() for
        more information.
        N(   R  R
   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRS   N  s    
c         C   sl  |  j  d k	 r |  S|  j s" t  |  j } i |  d 6|  j   d 6} t } t j | d  } | rv |  j | |  n  t j | d  } | r |  j  d k r |  j	 | |  q t
 } n  t j | d  } | r |  j  d k r |  j | |  q t
 } n  |  j d k rt j d   n  |  j   d k	 rP|  j   j | |  j  |  _ n  | rht j d   n  |  S(	   s  Attempt to resolve the type.

        Type resolution for simple types means that the corresponding
        schema component fields have been set.  Specifically, that
        means variety, baseTypeDefinition, and the appropriate
        additional fields depending on variety.

        All built-in STDs are resolved upon creation.  Schema-defined
        STDs are held unresolved until the schema has been completely
        read, so that references to later schema-defined STDs can be
        resolved.  Resolution is performed after the entire schema has
        been scanned and STD instances created for all
        topLevelSimpleTypes.

        If a built-in STD is also defined in a schema (which it should
        be for XMLSchema), the built-in STD is kept, with the
        schema-related information copied over from the matching
        schema-defined STD.  The former then replaces the latter in
        the list of STDs to be resolved.

        Types defined by restriction have the same variety as the type
        they restrict.  If a simple type restriction depends on an
        unresolved type, this method simply queues it for resolution
        in a later pass and returns.
        R   R$   R  Rl  R  s<   xs:simpleType must have list, union, or restriction as childsG   Expected exactly one of list, restriction, union as child of simpleTypeN(   R  R
   R  R   R   R   R   R   t)   _SimpleTypeDefinition__initializeFromListt0   _SimpleTypeDefinition__initializeFromRestrictionR   t*   _SimpleTypeDefinition__initializeFromUnionR  R   R   R  t   _STD_Mapt   _SimpleTypeDefinition__final(   R   R#   R>   t   bad_instancet	   candidate(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR?  [  s6    	
		!c         K   so   t  j | d  s t  t j | d  } |  d | d | d d  |  } | j |  | | _ | j d  | S(   NR8  R]   R#   R  R9  (	   R  R  R   R   R   R
   R   R  R=  (   R   R#   R>   R]   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    	c         C   s`   t  | t j  s t  | |  _ |  j j |   |  j   d  k rY |  j |  j j	  n  |  j S(   N(
   R   R   t   simpleTypeDefinitionR   R  R  Rb   R
   Rg   R   (   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    s    	c         C   s   |  j  d  k	 S(   N(   R  R
   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    s    c         C   s5   |  j  d  k r. t j d |  j   f   n  |  j  S(   Ns   %s: No support defined(   R  R
   R   R   R]   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR*    s    c         C   s   |  j    j |  S(   N(   R*  t   stringToPython(   R   t   string(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRW    s    c         C   s   |  j    j |  S(   N(   R*  t   pythonToString(   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRY    s    N(P   R   R   R   R
   R  R   R  R  R  R  R:  R  R   R  R  t	   STD_emptyR  R  R  R  RR  RS  R   R  R  R  R  R  t	   _DA_emptyR   R  R  R   R  R  R  R  R  R   R  R  R  R  R  RE  R  R   R  R,   R   R   Rj   R  R  R<  R  R   R  R  R  R  RO  RP  R  RQ  R  R%  RE  RG  R  R  RS   R?  R   R  R  R  R*  RW  RY  (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRW   |  s   			

					!					%$!!	
					5	3		n		D	
			RY   c           B   s   e  Z d  Z RS(   s2   Subclass ensures there is only one simple ur-type.(   R   R   R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRY     s   t   _ImportElementInformationItemc           B   sb   e  Z d  Z d   Z d Z d   Z d Z d   Z d Z	 d   Z
 d Z d   Z d Z d   Z RS(   s   Data associated with an
    U{import<http://www.w3.org/TR/xmlschema-1/#composition-schemaImport>}
    statement within a schema.c         C   s   |  j  S(   s;   The value of the C{id} attribute from the import statement.(   t!   _ImportElementInformationItem__id(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     s    c         C   s   |  j  S(   s   The L{pyxb.namespace.Namespace} instance corresponding to the value
        of the C{namespace} attribute from the import statement.(   t(   _ImportElementInformationItem__namespace(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR(     s    c         C   s   |  j  S(   s   The value of the C{schemaLocation} attribute from the import
        statement, normalized relative to the location of the importing
        schema.(   t-   _ImportElementInformationItem__schemaLocation(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   schemaLocation  s    c         C   s   |  j  S(   s^  The prefix from a namespace declaration for L{namespace} that was
        active in the context of the import element, or C{None} if there was
        no relevant namespace declaration in scope at that point.

        This is propagated to be used as the default prefix for the
        corresponding namespace if no prefix had been assigned.
        (   t%   _ImportElementInformationItem__prefix(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   prefix  s    c         C   s   |  j  S(   s8  The L{Schema} instance corresponding to the imported schema, if
        available.

        Normally C{import} statements will be fulfilled by loading components
        from a L{namespace archive<pyxb.namespace.NamespaceArchive>} in which
        the corresponding namespace is marked as public.  Where there are
        cycles in the namespace dependency graph, or the schema for a
        namespace are associated with a restricted profile of another
        namespace, there may be no such archive and instead the components are
        obtained using this schema.(   t%   _ImportElementInformationItem__schema(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR$     s    c         K   s  t  t |   j |   t j | d  } | d k rF t j d   n  t j j	 j
 t j | d  | j    } | |  _ t j j | d t } |  _ | j   } | s d |  _ n  t j j j |  } |  j   d k	 rt|  j j |  \ }	 }
 |	 shi | d 6| j   d 6| j   d 6} y t j |   }
 Wqht k
 rdt j d | |  j |    qhXn  |
 |  _ n | rt j d	 |  n  |  j d k	 r| |  j j   k rt j  d
 | |  j j   f   qn  | j! |  j    |  _" |  j# |  d S(   sm  Gather the information relative to an C{import} statement.

        If the imported namespace can be loaded from an archive, the
        C{schemaLocation} attribute is ignored.  Otherwise, it attempts to
        retrieve and parse the corresponding schema (if this has not already
        been done).

        @param importing_schema: The L{Schema} instance in which the import
        was found.
        @param node: The C{xml.dom.DOM} node incorporating the schema
        information.

        @raise Exception: Any exception raised when attempting to retrieve and
        parse data from the schema location.
        R(   s1   import statements without namespace not supportedR`  R}  t   absolute_schema_locationt   generation_uidt   uri_content_archive_directorys-   Import %s cannot read schema location %s (%s)s1   No information available on imported namespace %ss'   Import expected namespace %s but got %sN($   R+   R\  R,   R   R   R
   R   R  R0   R1   t   NormalizeLocationRL  R_  R(   R  R   R^  t   isImportAugmentableR)   R*   R`  t   lookupSchemaByLocationR   t   _uriContentArchiveDirectoryR7   t   CreateFromLocationt	   ExceptionRA  t	   exceptionRc  RB  R-   R   t   prefixForNamespaceRa  R   (   R   t   importing_schemaR#   R>   Rp   t   schema_locationRv   t   need_schemaR  t
   has_schemat   schema_instanceR  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,     s<    *	

(N(   R   R   R   R   R
   R]  R(   R^  R`  R_  Rb  Ra  R$   Rc  R,   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR\    s   						R7   c           B   s  e  Z d  Z d   Z dA Z e Z d   Z dA Z	 d   Z
 dA Z d   Z dA Z d   Z dA Z d   Z dA Z d   Z dA Z d   Z dA Z d	   Z dA Z dA Z d
   Z dA Z d   Z dA Z d   Z dA Z d Z d Z  i e  e! j" j# dA d  6e  e! j" j# dA d  6d e! j" j# dA d  6d e! j" j# dA d  6dA e! j" j# dA d  6dA e! j" j# dA d  6dA e! j" j# dA d  6dA e! j" j$ j% d  6Z& d   Z' d   Z( d   Z) d   Z* dB Z+ d#   Z, dA Z- d$   Z. i e/ d% 6e0 d& 6e1 d' 6e2 d( 6e3 d) 6e4 d* 6e5 d+ 6Z6 e7 d,    Z8 e7 d-    Z9 e7 d.    Z: e7 dA dA dA dA d/   Z; d0 Z< d1   Z= d2   Z> d3   Z? d4   Z@ d5   ZA d6   ZB d7   ZC d8   ZD d9   ZE d:   ZF d;   ZG d<   ZH d=   ZI d>   ZJ d?   ZK d@   ZL RS(C   sB   An XMLSchema U{Schema<http://www.w3.org/TR/xmlschema-1/#Schemas>}.c         C   s   t  j d   d  S(   Ns$   Attempt to serialize Schema instance(   R   R   (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   >  s    c         C   s   |  j  S(   s
  URI or path to where the schema can be found.

        For schema created by a user, the location should be provided to the
        constructor using the C{schema_location} keyword.  In the case of
        imported or included schema, the including schema's location is used
        as the base URI for determining the absolute URI of the included
        schema from its (possibly relative) location value.  For files,
        the scheme and authority portions are generally absent, as is often
        the abs_path part.(   t   _Schema__location(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRL  H  s    
c         C   s   |  j  S(   N(   t   _Schema__locationTag(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   locationTagU  s    c         C   s   |  j  S(   N(   t   _Schema__signature(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt	   signatureY  s    c         C   s   |  j  S(   N(   t   _Schema__generationUID(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   ]  s    c         C   s   |  j  S(   N(   t   _Schema__originRecord(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR6   a  s    c         C   s   |  j  S(   s  The targetNamespace of a componen.

        This is None, or a reference to a Namespace in which the
        component is declared (either as a global or local to one of
        the namespace's complex type definitions).  This is immutable
        after creation.
        (   t   _Schema__targetNamespace(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR-   e  s    c         C   s   |  j  S(   s   Default namespace of the schema.

        Will be None unless the schema has an 'xmlns' attribute.  The
        value must currently be provided as a keyword parameter to the
        constructor.  (   t   _Schema__defaultNamespace(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   defaultNamespacep  s    c         C   s   |  j  S(   N(   t   _Schema__referencedNamespaces(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   referencedNamespacesy  s    c         C   s   |  j  S(   N(   t   _Schema__importEIIs(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt
   importEIIs  s    c         C   s   |  j  S(   N(   t   _Schema__importedSchema(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   importedSchema  s    c         C   s   |  j  S(   N(   t   _Schema__includedSchema(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   includedSchema  s    t	   qualifiedt   unqualifiedt   attributeFormDefaultt   elementFormDefaultRl   t   blockDefaultt   finalDefaultR   R-   t   versionR  c         C   s#   | j  |  j t j j | j  <|  S(   s7   Override the schema attribute with the given DOM value.(   t	   nodeValuet   _Schema__attributeMapR   R(   R   R]   (   R   R@  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _setAttributeFromDOM  s    c         C   s   |  j  j |  |  S(   s>   Override the schema attributes with values from the given map.(   R  R   (   R   t   attr_map(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _setAttributesFromMap  s    c         C   s7   t  | t j  r* t j j d |  } n  | |  j k S(   sD   Return True iff the schema has an attribute with the given (nc)name.N(   R   R   t   string_typesR   R(   R   R
   R  (   R   t	   attr_name(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   schemaHasAttribute  s    c         C   s5   t  | t j  r* t j j d |  } n  |  j | S(   sr  Return the schema attribute value associated with the given (nc)name.

        @param attr_name: local name for the attribute in the schema element.
        @return: the value of the corresponding attribute, or C{None} if it
        has not been defined and has no default.
        @raise KeyError: C{attr_name} is not a valid attribute for a C{schema} element.
        N(   R   R   R  R   R(   R   R
   R  (   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   schemaAttribute  s    R   R   R_   R   R   R   R   c         C   s   |  j  S(   N(   t#   _Schema__uriContentArchiveDirectory(   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRj    s    c         O   s.  | j  d t  s( t j j j j   n  d | k s: t  | j  d  |  _ | j  d  |  _	 |  j	 d  k	 r |  j	 } d | j d  k r t j |  d } n  t j j |  d j d	  d |  _ n  | j  d
  |  _ |  j d  k rt j d  t j j j   |  _ n  | j  d  |  _ t t |   j | |   t   |  _ t   |  _ t   |  _ |  j   j    |  _! t" |  j! t j j#  st j$ d   n  |  j! j% |   |  _& |  j! j' |  j(  |  j) d  k	 r|  j) j' |  j(  n  |  j* j+   |  _* g  |  _, t- t. j/ |  j   j0     |  _1 d  S(   Nt   _bypass_preloadR$   Rf  Rp  i    R   i   i   t   .Re  s   No generationUID providedt   schema_signaturesH   Schema constructor requires valid Namespace instance as target_namespace(2   R'   R   R   R(   R   R   t   PreLoadArchivesR   R  Rt  R
   R   t   urlparset   ost   pathR~  Ru  Ry  RA  RB  R0   R1   t   UniqueIdentifierRw  R+   R7   R,   R%   R  R  R  R   R-   R{  R   t	   NamespaceR   t	   addSchemaRz  t   configureCategoriest   _Schema__SchemaCategoriesR|  R  RT   t   _Schema__annotationsR  R   R  R<   R~  (   R   R=   R>   t   schema_path(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR,     s:    	)	Rq  R  t   notationR8  Ru  R7  R  c         K   sD   d | k r( t  j j j |  | d <n  |  j t j | |  |  S(   NR  (   R   R0   R1   t   HashForTextR   R   t   StringToDOM(   R   t   xmlsR>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   CreateFromDocument  s    c         K   s   | j  d t j j j | j d  | j d  | j d    } | | d <| d <t | t j  s t	 d | t
 |  f   | j d  } |  j t j j j | d | |  S(	   s  Create a schema from a schema location.

        Reads an XML document from the schema location and creates a schema
        using it.  All keyword parameters are passed to L{CreateFromDOM}.

        @keyword schema_location: A file path or a URI.  If this is a relative
        URI and C{parent_uri} is present, the actual location will be
        L{normallzed<pyxb.utils.utility.NormalizeLocation>}.
        @keyword parent_uri: The context within which schema_location will be
        normalized, if necessary.
        @keyword absolute_schema_location: A file path or URI.  This value is
        not normalized, and supersedes C{schema_location}.
        Rd  Rp  t
   parent_urit
   prefix_mapt   location_bases/   Unexpected value %s type %s for schema_locationRf  t   archive_directory(   R;  R   R0   R1   Rg  R'   R   R   R  R   R:   R  t   DataFromURI(   R   R>   Rp  Rf  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRk    s
    B.c         K   s   |  j  | j   |  S(   N(   R  t   read(   R   t   streamR>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   CreateFromStream  s    c         K   sf  | j  d  } | } t j | j k r3 | j } n  t j | j k rW t j d   n  | d k s~ t	 | t j
 j  s~ t  t j
 j j | d | d | }	 |	 j   }
 |
 d k r t j d   n  |  d |	 d | d | d | |  } |	 | _ | j   |	 j   k r6t j d	 | j   |	 j   f   n  x3 t | j j  D] } | j | j j |   qIWt j | d
  st j d | j f   n  x | j D] } t j | j k r| j |  } | d k r^t j d | j | j d   q^qt j | j k r9| j j    } | r^t j d |  q^qt j! | j k rNqt j d |  qW| S(   sH  Take the root element of the document, and scan its attributes under
        the assumption it is an XMLSchema schema element.  That means
        recognize namespace declarations and process them.  Also look for
        and set the default namespace.  All other attributes are passed up
        to the parent class for storage.t   including_contexts(   Must be given a DOM node of type ELEMENTt   parent_contexts:   No targetNamespace associated with content (not a schema?)R"   Rp  R  Re  s$   targetNamespace %s conflicts with %sR$   s5   Root node %s of document is not an XML schema elements   Unrecognized: %s %ss   utf-8s   Ignored text: %ss   Ignoring non-element: %sN("   R'   R    t   DOCUMENT_NODER  t   documentElementR  R   R   R
   R   R(   R)   R   R*   R-   R   t   _Schema__namespaceDataR6  R"  R7  R  R8  R  R  R  Rw  t   _Schema__processTopLevelNodeRA  t   infoRh  R  R  t   stript   COMMENT_NODE(   R   R#   R"   Rp  R  Re  R>   R  t	   root_nodeR  t   tnsR$   R,  R   R   R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR     sD    
'	$	(%	s   #allc         C   s   t  j | |  } | d  k r7 |  j d | f  } n  d } | |  j k rs xQ t j |  D] } | | 7} q\ Wn- x* | j   D] } | | j | d  7} q W| S(   Ns	   %sDefaulti    (	   R   R   R
   R  t   _SA_AllR   R  R~  R'   (   R   R@  t   dom_nodet   candidate_mapt   ebvR   Rz   RU  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __ebvForNodeU  s    c         C   s   |  j  d | |  S(   s  Return a bit mask indicating a set of options read from the node's "block" attribute or the schema's "blockDefault" attribute.

        A value of '#all' means enable every options; otherwise, the attribute
        value should be a list of tokens, for which the corresponding value
        will be added to the return value.

        @param dom_node: the node from which the "block" attribute will be retrieved
        @type dom_node: C{xml.dom.Node}
        @param candidate_map: map from strings to bitmask values
        Re  (   t   _Schema__ebvForNode(   R   R  R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR~  b  s    c         C   s   |  j  d | |  S(   s  Return a bit mask indicating a set of options read from the node's
        "final" attribute or the schema's "finalDefault" attribute.

        A value of '#all' means enable every options; otherwise, the attribute
        value should be a list of tokens, for which the corresponding value
        will be added to the return value.

        @param dom_node: the node from which the "final" attribute will be retrieved
        @type dom_node: C{xml.dom.Node}
        @param candidate_map: map from strings to bitmask values
        t   final(   R  (   R   R  R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR  o  s    c         C   s   t  j | d  } | d k rs | t k r< |  j d  } qs | t k rZ |  j d  } qs t j d | f   n  d } |  j | k r |  j	   } | j
   r d } q n1 |  j | k r t j d |  j |  j f   n  | S(   s  Determine the target namespace for a local attribute or element declaration.

        Look at the node's C{form} attribute, or if none the schema's
        C{attributeFormDefault} or C{elementFormDefault} value.  If the
        resulting value is C{"qualified"} and the parent schema has a
        non-absent target namespace, return it to use as the declaration
        target namespace.  Otherwise, return None to indicate that the
        declaration has no namespace.

        @param dom_node: The node defining an element or attribute declaration
        @param declaration_type: Either L{AttributeDeclaration} or L{ElementDeclaration}
        @return: L{pyxb.namespace.Namespace} or None
        Rd  R  R  s;   Expected ElementDeclaration or AttributeDeclaration: got %ss   Form type neither %s nor %sN(   R   R   R
   Rd   R  R   R   R   t
   _QUALIFIEDR-   t   isAbsentNamespacet   _UNQUALIFIEDR   (   R   R  t   declaration_typet	   form_typeR  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyRX  }  s    "c         C   s&   |  j  r" t j d | f   n  d S(   s   Throw a SchemaValidationException referencing the given
        node if we have passed the sequence point representing the end
        of prolog elements.s   Unexpected node %s after prologN(   t   _Schema__pastPrologR   R   (   R   t	   node_name(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __requireInProlog  s    	c         C   sh  |  j  | j  t j j j t j | d  |  j  } |  j	   j
 |  \ } } | si | d 6|  j d 6|  j   d 6|  j   d 6} y |  j |   } Wqt j k
 r } t j d | j   | j   | j   j    qt k
 r} t j d |    qXn  | rd|  j	   | j	   k rQt j d | j	   |  j	   f   n  |  j j |  n  | S(	   NR`  Rd  R  Re  Rf  sI   Skipping apparent redundant inclusion of %s defining %s (hash matches %s)s   INCLUDE %s caughts@   Included namespace %s not consistent with including namespace %s(   t   _Schema__requireInPrologR  R   R0   R1   Rg  R   R   Rt  R-   Ri  R  R   Rj  Rk  t   SchemaUniquenessErrorRA  RB  R`  R(   t   existingSchemaRL  Rl  Rm  R   R  RB   (   R   R#   t   abs_uriRr  Rs  R>   RA  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __processInclude  s(    '

1
(c         C   s   |  j  | j  t |  |  } | j   d k	 rJ |  j j | j    n  |  j   j | j	    | j	   } | j
   d k r | j | j
    n  |  j j |  | S(   s   Process an import directive.

        This attempts to locate schema (named entity) information for
        a namespace that is referenced by this schema.
        N(   R  R  R\  R$   R
   R  RB   R-   t   importNamespaceR(   Rb  t	   setPrefixR  (   R   R#   t
   import_eiit   ins(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __processImport  s    c         C   s#   |  j  | j  t j d   d  S(   Ns   redefine not implemented(   R  R  R   R  (   R   R#   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __processRedefine  s    c         C   s   |  j  t j |   |  S(   N(   t   _addAnnotationR8   R   (   R   R#   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __processAnnotation  s    c         C   s   t  j | d  r |  j |  St  j | d  r> |  j |  St  j | d  r] |  j |  St  j | d  r| |  j |  S|  j j | j  } | d	 k	 r t
 |  _ i t j d 6|  d 6|  d 6} |  j | j | |   St j d | j f   d	 S(
   s   Process a DOM node from the top level of the schema.

        This should return a non-None value if the node was
        successfully recognized.t   includet   importt   redefineR   R!   R$   R   s   Unexpected top-level element %sN(   R  R  t   _Schema__processIncludet   _Schema__processImportt   _Schema__processRedefinet   _Schema__processAnnotationt   _Schema__TopLevelComponentMapR'   Rz  R
   R   R  R   R   t   _addNamedComponentR   R   R   R  (   R   R#   t	   componentR>   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __processTopLevelNode  s     	
c         C   s   |  j  j |  | S(   N(   R  Rr   (   R   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    s    c         C   s  |  j    } | d  k	 s t  t | t  sI t j d | j f   n  | j   rp t j d | j f   n  t | t	  r t	 j
 | j   k s t  n  t | t t f  r |  j |  St | t  r |  j |  St | t  r |  j |  St | t  r| j d | j   |  St | t  rG| j d | j   |  St | t  ro| j d | j   |  St | t  r| j d | j   |  St st d | j f   d  S(   Ns0   Attempt to add unnamed %s instance to dictionarys4   Attempt to add anonymous component to dictionary: %sR_   R   R   R   s/   No support to record named component of type %s(   R-   R
   R   R   R\   R   R   R   R   R   R   R!   RW   R   t   _Schema__addTypeDefinitionR   t    _Schema__addAttributeDeclarationR   t$   _Schema__addAttributeGroupDefinitionR   R   R]   Rd   R  R   R   (   R   R  R  (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR    s.    c         C   s  | j    } |  j s t  |  j   } | j   j |  } | d  k	 r | | k r t | t  t | t  k r t	 j
 d | j    f   n  | j |  s t	 j
 d | j |  f   n  | j | | j |   } n | j d | j    |  | d  k	 st  | S(   Ns.   Name %s used for both simple and complex typess3   Attempt to re-define non-builtin type definition %sR   (   R]   R{  R   R-   t   typeDefinitionsR'   R
   R   R   R   R   t   _allowUpdateFromOthert   createExpandedNameR?   t   _updateFromOtherR   (   R   R  t
   local_nameR  t   old_td(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __addTypeDefinition  s    "c         C   s   | j    } |  j s t  |  j   } | j   j |  } | d  k	 r | | k r | j |  s t j	 d | j
 |  f   n  | j | | j |   } n | j d | j    |  | d  k	 s t  | S(   Ns9   Attempt to re-define non-builtin attribute declaration %sR   (   R]   R{  R   R-   t   attributeDeclarationsR'   R
   R  R   R   R  R?   R  R   (   R   RZ  R  R  t   old_ad(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __addAttributeDeclaration!  s    "c         C   s   | j    } |  j s t  |  j   } | j   j |  } | d  k	 r | | k r | j |  s t j	 d | j
 |  f   n  | j | | j |   n | j d | j    |  | d  k	 s t  | S(   Ns>   Attempt to re-define non-builtin attribute group definition %sR   (   R]   R{  R   R-   t   attributeGroupDefinitionsR'   R
   R  R   R   R  R?   R  R   (   R   R`   R  R  t   old_agd(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   __addAttributeGroupDefinition2  s    "c         C   s   d |  j    f S(   Ns   SCH[%s](   RL  (   R   (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR   C  s    N(   s   typeDefinitions   attributeGroupDefinitions   modelGroupDefinitions   attributeDeclarations   elementDeclarations   notationDeclarations   identityConstraintDefinition(M   R   R   R   R   R
   R  R   R  RL  Rt  Rv  Ru  Rx  Rw  R   Ry  R6   Rz  R-   R{  R}  R|  R  R~  R  R  R  R  R  R  R  R  R  R   R(   R   t   XMLR  R  R  R  R  R  R  Rj  R  R,   Rd   R   R  RW   R   R   R   R  R   R  Rk  R  R   R  R  R~  R  RX  R  R  R  R  R  R  R  R  R  R  R  R   (    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyR7   ;  s   																	  		*
C				!											c   
   	   C   sM  t  d t j j j   d d d t j j d t  } | j t j	 | d t  } | j
   sc t  | j t j | d t  } | j
   s t  i  } x{ t j D]p } | j j d  } | j t j | | |   } | j
   s t  | j   | k st  | j | |  q Wx t j D] } | j j d  } | | j   } | j t j | | | |   } | j
   s|t  | j   | k st  | j | |  q!Wx t j D] } | j j d  } | j j j d  } | j   j   j |  }	 |	 d k	 st  | j t j | | |	 |   } | j
   st  qWt a | S(	   s   Add to the schema the definitions of the built-in types of XMLSchema.
    This should only be invoked by L{pyxb.namespace} when the built-in
    namespaces are initialized. R"   Rp  s   URN:noLocation:PyXB:XMLSchemaRe  R  R  t   _N(   R7   R   R(   R   R3  R@  R   R  R   R{  RS   R   RW   R<  R   t   _PrimitiveDatatypesR   t   rstripR   R  t   _DerivedDatatypest   XsdSuperTypeR  t   _ListDatatypest	   _ItemTypeR-   R  R'   R
   R  t   _PastAddBuiltInTypes(
   R(   R$   R  t   pts_std_mapt   dtcR]   R  t	   list_namet   element_namet   element_std(    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   _AddSimpleTypesG  s8    3!!(K   R   R  t   loggingt   xml.domR    RT   t   pyxb.utils.six.moves.urllibR   R  t   os.pathR  R   t   pyxb.xmlschemat   pyxb.namespace.archivet   pyxb.namespace.resolutionR  R   R   R   t
   pyxb.utilsR   R   t   pyxb.utils.utilityt	   getLoggerR   RA  R   R  t   pyxb.namespaceR   R  R(   t   _ComponentDependency_mixinR   t   _ArchivableObject_mixinR0   R1   t   PrivateTransient_mixinR2   R   t   cscRootRo   R   R   t   objectR   R\   R   R   R  RQ   RR   R   RF  Rd   R   RZ   R   R   R^   Rx  R9   R   R  R8   RW   RY   R\  R7   R  t   syst   pyxb.namespace.builtint   builtint   _InitializeBuiltinNamespacest   modules(    (    (    sN   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/xmlschema/structures.pyt   <module>!   sz    f&?% 6Yc.%1 +   ,+o8% (z^(   Tj  	'