ó
e#ñ]c           @   s  d  Z  d d l Z d d l Z d d l m Z e j e ƒ Z e j j	 j
 d e j d ƒ Z d d l m Z d e f d „  ƒ  YZ d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ e d d d d d ƒZ e d d d d d d e d d ƒZ e d d d d d d d d i d d 6ƒZ e d d d  d d! d" e ƒZ e j d# d$ g ƒ e d% d d& d d' d d( d e d d) d" e d i e d 6ƒZ e d* d d+ d d, d" e d i d d- 6e d. 6ƒZ e e e e e e g Z e a d/ „  Z i  Z g  e D]* Z  e  j! ƒ  rêe j" e  j# ƒ  e  ƒ ^ qêd S(0   s~   Classes and global objects related to built-in U{XML Namespaces<http://www.w3.org/TR/2006/REC-xml-names-20060816/index.html>}.iÿÿÿÿN(   t   sixs   PyXB-s   -Builtin(   t	   Namespacet   _XMLSchema_instancec           B   sY   e  Z d  Z d Z d Z d Z e Z d Z d Z	 d „  Z
 d d „ Z d „  Z d „  Z RS(	   sh   Extension of L{Namespace} that pre-defines components available in the
    XMLSchema Instance namespace.t   strictt   laxt   skipc         O   sA   t  t |  ƒ j | | Ž  |  j d ƒ |  _ |  j d ƒ |  _ d  S(   Nt   typet   nil(   t   superR   t   __init__t   createExpandedNameR   R   (   t   selft   argst   kw(    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyR	   ;   s    c         C   sO   | |  j  |  j |  j f k r* | |  _ n | d k	 rH t j | ƒ ‚ n  |  j S(   sú  Specify how PyXB should interpret U{xsi:type
        <http://www.w3.org/TR/xmlschema-1/#xsi_type>} attributes when
        converting a document to a binding instance.

        The default value is L{PT_strict}.

        xsi:type should only be provided when using an abstract class,
        or a concrete class that happens to be the same as the
        xsi:type value, or when accepting a wildcard that has an
        unrecognized element name.  In practice, web services tend to
        set it on nodes just to inform their lax-processing clients
        how to interpret the value.

        @param value: One of L{PT_strict}, L{PT_lax}, L{PT_skip}, or C{None} (no change)
        @return: The current configuration for processing xsi:type attributes
        N(   t	   PT_strictt   PT_laxt   PT_skipt    _XMLSchema_instance__processTypet   Nonet   pyxbt
   ValueError(   R   t   value(    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyt   ProcessTypeAttributeC   s
    c   	      C   sA  t  } | d k r | | f S|  j } |  j | k r> | | f S| j | d | ƒ} y | j ƒ  } Wn t k
 r| d } n X|  j | k rþ | d k r± t j	 d | f ƒ ‚ n  | d k	 rþ | j
 ƒ  pÕ t | | ƒ rþ t j	 d | | | j f ƒ ‚ qþ n  |  j | k s(|  j | k r7| d k	 r7| } t } n  | | f S(   s:  Interpret the value of an xsi:type attribute as configured
        by L{ProcessTypeAttribute}.

        @param type_name: The QName value from U{xsi:type
        <http://www.w3.org/TR/xmlschema-1/#xsi_type>}.  If this is
        C{None}, C{type_class} is used as C{ret_type_class}.

        @param ns_ctx: The NamespaceContext within which C{type_name}
        should be resolved

        @param fallback_namespace: The namespace that should be used
        if C{type_name} has no prefix

        @param type_class: The value to return if C{type_name} is
        missing or acceptably invalid (viz., due to L{PT_skip})

        @return: A tuple C{(did_replace, ret_type_class)} where
        C{did_replace} is C{True} iff the C{ret_type_class} is not the
        same as C{type_class}, and C{ret_type_class} is the class that
        should be used.

        @raises pyxb.BadDocumentError: if the processing type
        configuration is L{PT_strict} and C{type_name} fails to
        resolve to a type definition that is consistent with any
        provided C{type_class}.
        t	   namespaces   No type binding for %ss.   %s value %s is not subclass of element type %sN(   t   FalseR   R   R   t   interpretQNamet   typeBindingt   KeyErrorR   R   t   BadDocumentErrort	   _IsUrTypet
   issubclasst   _ExpandedNameR   t   True(	   R   t	   type_namet   ns_ctxt   fallback_namespacet
   type_classt   did_replacet   ptt   type_ent   alternative_type_class(    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyt   _InterpretTypeAttribute[   s(    
	

(%*	c      	   C   s°   | d
 k	 s t ‚ | j d |  j ƒ  d d d t d t ƒ } | j | j j d | ƒ ƒ | j | j j d | ƒ ƒ | j | j j d | ƒ ƒ | j | j j d	 | ƒ ƒ |  S(   s‹   Ensure this namespace is ready for use.

        Overrides base class implementation, since there is no schema
        for this namespace. t   namespace_contextt   schema_locations   URN:noLocation:PyXB:xsit   generation_uidt   _bypass_preloadR   R   t   schemaLocationt   noNamespaceSchemaLocationN(	   R   t   AssertionErrort   Schemat   initialNamespaceContextt   BuiltInObjectUIDR    t   _addNamedComponentt   AttributeDeclarationt   CreateBaseInstance(   R   t   structures_modulet   schema(    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyt   _defineBuiltins_ox‹   s    *N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   R   R	   R   R)   R9   (    (    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyR      s   		0t   _XMLc           B   s   e  Z d  Z d „  Z RS(   sd  Extension of L{Namespace} that pre-defines components available in the
    XML (xml) namespace.  Specifically those are the attribute declarations:

      - C{xml:space}
      - C{xml:lang}
      - C{xml:base}
      - C{xml:id}

    the encompassing attribute group declaration:

      - C{xml:specialAttrs}

    and the anonymous types that support these.c      
   C   sî  | d k	 s t ‚ d d l j j } d d l m } |  j | j j	 ƒ  g ƒ | j
 d |  j ƒ  d d d t d t ƒ } | j j d	 | ƒ } | j |  d
 d ƒ| j |  ƒ | j j d | ƒ } | j |  d
 d ƒ| j |  ƒ | j | j j d | d | j j ƒ  ƒƒ } | j | j j d | d | j j ƒ  ƒƒ } | j | j j d	 | d | ƒƒ }	 | j | j j d | d | ƒƒ }
 | j | j j d | | j j | |	 ƒ | j j | | ƒ | j j | |
 ƒ | j j | | ƒ g ƒ ƒ |  S(   s‹   Ensure this namespace is ready for use.

        Overrides base class implementation, since there is no schema
        for this namespace. iÿÿÿÿN(   t   archiveR*   R+   s   URN:noLocation:PyXB:XMLR,   R-   t   spacet	   anon_namet   STD_ANON_spacet   langt   STD_ANON_langt   baset   stdt   idt   specialAttrs(   R   R0   t   pyxb.binding.datatypest   bindingt	   datatypest   pyxb.namespaceR>   t   configureCategoriest   NamespaceArchivet   _AnonymousCategoryR1   R2   R3   R    t   SimpleTypeDefinitiont   _CreateXMLInstancet   _setAnonymousNamet   _setBindingNamespaceR4   R5   R6   t   anyURIt   IDt   AttributeGroupDefinitiont   AttributeUse(   R   R7   t   xsdR>   R8   t	   std_spacet   std_langRD   RF   R?   RB   (    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyR9   ¨   s*    *--$$(   R:   R;   R<   R9   (    (    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyR=   ™   s   t
   _XMLSchemac           B   s   e  Z d  Z d „  Z RS(   s®   Extension of L{Namespace} that pre-defines components available in the
    XMLSchema namespace.

    The types are defined when L{pyxb.xmlschema.structures} is imported.
    c         C   sÔ   | d k	 s t ‚ | j |  ƒ | j j ƒ  |  j ƒ  d k sD t ‚ | j j ƒ  |  j ƒ  d k si t ‚ |  j d d g ƒ xQ t	 j
 |  j ƒ  ƒ D]: \ } } | j ƒ  d k	 r’ |  j d | | j ƒ  ƒ q’ q’ Wd S(   s9   Register the built-in types into the XMLSchema namespace.t   anyTypet   anySimpleTypeR   t   elementBindingN(   R   R0   t   _AddSimpleTypest   ComplexTypeDefinitiont   UrTypeDefinitiont   typeDefinitionsRO   t   SimpleUrTypeDefinitionRL   R    t	   iteritemst   pythonSupportt   addCategoryObject(   R   R7   t   ent   td(    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyR9   Ò   s    %%"(   R:   R;   R<   R9   (    (    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyRZ   Ë   s   s)   http://www.w3.org/2001/XMLSchema-instancet   descriptions   XML Schema Instancet   builtin_namespacet   XMLSchema_instances   http://www.w3.org/2000/xmlns/s   Namespaces in XMLt   XMLNamespacest   is_undeclared_namespacet   bound_prefixt   xmlnss    http://www.w3.org/2001/XMLSchemas
   XML Schemat	   XMLSchemat   builtin_module_paths   pyxb.binding.datatypest   in_scope_namespacest   xss   http://www.w3.org/1999/xhtmls)   Family of document types that extend HTMLt   XHTMLt   default_namespaceR   R]   s$   http://www.w3.org/XML/1998/namespaces   XML namespacet   XMLs   pyxb.binding.xml_t   xmls4   http://www.w3.org/2001/XMLSchema-hasFacetAndPropertys#   Facets appearing in appinfo sectiont   XMLSchema_hfpt   hfpt   xhtmlc         C   s3   t  s/ t a  g  t D] } | j |  ƒ ^ q n  d S(   sZ  Invoked at the end of the L{pyxb.xmlschema.structures} module to
    initialize the component models of the built-in namespaces.

    @param structures_module: The L{pyxb.xmlschema.structures} module may not
    be importable by that name at the time this is invoked (because it is
    still being processed), so it gets passed in as a parameter.N(   t   __InitializedBuiltinNamespacesR    t   BuiltInNamespacest   _defineBuiltins(   R7   t   _ns(    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyt   _InitializeBuiltinNamespaces!  s    ($   R<   t   loggingR   t
   pyxb.utilsR    t	   getLoggerR:   t   _logt   utilst   utilityt   UniqueIdentifiert   __version__R3   RK   R   R   R=   RZ   Rj   R    Rk   R   Ro   Rs   RL   Ru   Rw   R{   R   Rz   R~   t   _UndeclaredNamespaceMapR}   t   isUndeclaredNamespacet
   setdefaultt   boundPrefix(    (    (    sK   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/namespace/builtin.pyt   <module>   sf    |2									
		