
f#]c           @   s  d  Z  d d l Z d d l m Z e j e  Z d e f d     YZ d Z	 d Z
 d Z d d	 l Td d l Z d
 e f d     YZ d Z d Z d Z e a i e d 6e d 6e d 6Z e g  e j e  D] \ Z Z e e f ^ q  Z d Z d d  Z e   e Z y e st  e  Z Wn n Xe Z! d e f d     YZ" e"   Z# e  a$ d d  Z% e  a& d d  Z' e a( d d  Z) d Z* d Z+ d   Z, d S(   s  PyXB stands for Python U{W3C XML
Schema<http://www.w3.org/XML/Schema>} Bindings, and is pronounced
"pixbee".  It enables translation between XML instance documents and
Python objects following rules specified by an XML Schema document.

This is the top-level entrypoint to the PyXB system.  Importing this
gets you all the L{exceptions<pyxb.exceptions_.PyXBException>}, and
L{pyxb.namespace}.  For more functionality, delve into these
submodules:

 - L{pyxb.xmlschema} Module holding the
   L{structures<pyxb.xmlschema.structures>} that convert XMLSchema
   from a DOM model to a Python class model based on the XMLSchema
   components.  Use this when you need to operate on the component
   model.

 - L{pyxb.binding} Module used to generate the bindings and at runtime
   to support the generated bindings.  Use this if you need to use the
   binding model or content model.

 - L{pyxb.utils} Common utilities used in parsing, generating, and
   executing.  The submodules must be imported separately.

iN(   t   sixt   cscRootc           B   s   e  Z d  Z d   Z RS(   s@  This little bundle of joy exists because in Python 2.6 it
    became an error to invoke C{object.__init__} with parameters (unless
    you also override C{__new__}, in which case it's only a warning.
    Whatever.).  Since I'm bloody not going to check in every class
    whether C{super(Myclass,self)} refers to C{object} (even if I could
    figure out how to do that, 'cuz the obvious solutions don't work),
    we'll just make this thing the root of all U{cooperative super
    calling<http://www.geocities.com/foetsch/python/new_style_classes.htm#super>}
    hierarchies.  The standard syntax in PyXB for this pattern is::

      def method_csc (self, *args, **kw):
        self_fn = lambda *_args, **_kw: self
        super_fn = getattr(super(ThisClass, self), 'method_csc', self_fn)
        return super_fn(*args, **kw)

    c         O   s?   t  |  j j   d t t f  r; t t |   j |   n  d  S(   Ni(   t
   issubclasst	   __class__t   mrot   listt   dictt   superR   t   __init__(   t   selft   argst   kw(    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyR   3   s    
"(   t   __name__t
   __module__t   __doc__R   (    (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyR   !   s   s   1.2.6s   http://pyxb.sourceforge.nets   Apache License 2.0(   t   *t   BINDc           B   s,   e  Z d  Z d Z d Z d   Z d   Z RS(   s  Bundle data for automated binding generation.

    Instances of this class capture positional and keyword arguments that are
    used to create binding instances based on context.  For example, if C{w}
    is an instance of a complex type whose C{option} element is declared to be
    an anonymous class with simple content of type integer and an attribute of
    C{units}, a correct assignment to that element could be achieved with::

      w.option = BIND(54, units="m")

    c         O   s   | |  _  | |  _ d S(   ss   Cache parameters for subsequent binding creation.
        Invoke just as you would the factory for a binding class.N(   t   _BIND__argst	   _BIND__kw(   R	   R
   R   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyR   ]   s    	c         K   s    | j  |  j  | |  j |   S(   s   Invoke the given factory method.

        Position arguments to the factory are those cached in this instance.
        Keyword arguments are the ones on the command line, updated from the
        ones in this instance.(   t   updateR   R   (   R	   t   factoryR   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   createInstancec   s    N(   R   R   R   t   NoneR   R   R   R   (    (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyR   N   s
   	i    i   i   t   minidomt   saxdomt   saxert   PYXB_XML_STYLEc         C   s   |  d k rv d d l } | j j t  } | d k r? d } n  t j |  }  |  d k rv t d | t f   qv n  t j |   d k r t d |  f   n  |  a d S(   s  Set the interface used to parse XML content.

    This can be invoked within code.  The system default of L{XMLStyle_saxer}
    can also be overridden at runtime by setting the environment variable
    C{PYXB_XML_STYLE} to one of C{minidom}, C{saxdom}, or C{saxer}.

    @param style: One of L{XMLStyle_minidom}, L{XMLStyle_saxdom},
    L{XMLStyle_saxer}.  If not provided, the system default is used.
    iNR   s   Bad value "%s" for %ss   Bad value %s for _SetXMLStyle(	   R   t   ost   environt   gett   _XMLStyle_envvart   _XMLStyleMapt   PyXBExceptiont   _XMLStyleMapReverset	   _XMLStyle(   t   styleR   t
   style_name(    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   _SetXMLStyle   s    	t   ValidationConfigc           B   s   e  Z d  Z e Z d   Z d   Z e e  Z e Z	 d   Z
 d   Z e e
  Z d Z d Z d Z d Z d	 Z d
 Z e Z d   Z d   Z e e  Z e Z d   Z d   Z e e  Z e Z d   Z d   Z e e  Z d   Z RS(   s  Class holding configuration related to validation.

    L{pyxb.GlobalValidationConfig} is available to influence validation in all
    contexts.  Each binding class has a reference to an instance of this
    class, which can be inspected using
    L{pyxb.binding.basis._TypeBinding_mixin._GetValidationConfig} and changed
    using L{pyxb.binding.basis._TypeBinding_mixin._SetValidationConfig}.  Each
    binding instance has a reference inherited from its class which can be
    inspected using L{pyxb.binding.basis._TypeBinding_mixin._validationConfig}
    and changed using
    L{pyxb.binding.basis._TypeBinding_mixin._setValidationConfig}.

    This allows fine control on a per class and per-instance basis.

    L{forBinding} replaces L{RequireValidWhenParsing}.

    L{forDocument} replaces L{RequireValidWhenGenerating}.

    L{contentInfluencesGeneration}, L{orphanElementInContent}, and
    L{invalidElementInContent} control how
    L{pyxb.binding.basis.complexTypeDefinition.orderedContent} affects
    generated documents.
    c         C   s   |  j  S(   s  C{True} iff validation should be performed when manipulating a
        binding instance.

        This includes parsing a document or DOM tree, using a binding instance
        class constructor, or assigning to an element or attribute field of a
        binding instance.(   t   _ValidationConfig__forBinding(   R	   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   _getForBinding   s    c         C   s+   t  | t  s t |   n  | |  _ | S(   s^   Configure whether validation should be performed when manipulating
        a binding instance.(   t
   isinstancet   boolt	   TypeErrorR'   (   R	   t   value(    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   _setForBinding   s    	c         C   s   |  j  S(   s   C{True} iff validation should be performed when creating a document
        from a binding instance.

        This applies at invocation of
        L{toDOM()<pyxb.binding.basis._TypeBinding_mixin.toDOM>}.
        L{toxml()<pyxb.binding.basis._TypeBinding_mixin.toDOM>} invokes C{toDOM()}.(   t   _ValidationConfig__forDocument(   R	   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   _getForDocument   s    c         C   s+   t  | t  s t |   n  | |  _ | S(   sl   Configure whether validation should be performed when generating
        a document from a binding instance.(   R)   R*   R+   R.   (   R	   R,   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   _setForDocument   s    	ii    i   i   i   i   c         C   s   |  j  S(   s   Determine whether complex type content influences element order in
        document generation.

        The value is one of L{ALWAYS}, L{NEVER}, L{MIXED_ONLY} (default).(   t.   _ValidationConfig__contentInfluencesGeneration(   R	   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt    __getContentInfluencesGeneration  s    c         C   s:   | |  j  |  j |  j f k r- t |   n  | |  _ d S(   s0   Set the value of L{contentInfluencesGeneration}.N(   t   ALWAYSt   NEVERt
   MIXED_ONLYt
   ValueErrorR1   (   R	   R,   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   _setContentInfluencesGeneration  s    c         C   s   |  j  S(   s)  How to handle unrecognized elements in content lists.

        This is used when consulting a complex type instance content list to
        influence the generation of documents from a binding instance.

        The value is one of L{IGNORE_ONCE} (default), L{GIVE_UP},
        L{RAISE_EXCEPTION}.(   t)   _ValidationConfig__orphanElementInContent(   R	   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   __getOrphanElementInContent  s    c         C   s:   | |  j  |  j |  j f k r- t |   n  | |  _ d S(   s+   Set the value of L{orphanElementInContent}.N(   t   IGNORE_ONCEt   GIVE_UPt   RAISE_EXCEPTIONR6   R8   (   R	   R,   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   _setOrphanElementInContent  s    c         C   s   |  j  S(   s   How to handle invalid elements in content lists.

        The value is one of L{IGNORE_ONCE} (default), L{GIVE_UP},
        L{RAISE_EXCEPTION}.(   t*   _ValidationConfig__invalidElementInContent(   R	   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   __getInvalidElementInContent$  s    c         C   s:   | |  j  |  j |  j f k r- t |   n  | |  _ d S(   s,   Set the value of L{invalidElementInContent}.N(   R:   R;   R<   R6   R>   (   R	   R,   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   _setInvalidElementInContent*  s    c         C   s   d d l  } | j  |   S(   s   Make a copy of this instance.

        Use this to get a starting point when you need to customize validation
        on a per-instance/per-class basis.iN(   t   copy(   R	   RA   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyRA   1  s    (    R   R   R   t   TrueR'   R(   R-   t   propertyt
   forBindingR.   R/   R0   t   forDocumentR3   R4   R:   R;   R<   R5   R1   t1   _ValidationConfig__getContentInfluencesGenerationR7   t   contentInfluencesGenerationR8   t,   _ValidationConfig__getOrphanElementInContentR=   t   orphanElementInContentR>   t-   _ValidationConfig__getInvalidElementInContentR@   t   invalidElementInContentRA   (    (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyR&      s8   											c         C   s&   |  d k r t j St j |   a |  S(   s  Query or set a flag that controls validation checking in XML generation.

    Normally any attempts to convert a binding instance to a DOM or XML
    representation requires that the binding validate against the content
    model, since only in this way can the content be generated in the correct
    order.  In some cases it may be necessary or useful to generate a document
    from a binding that is incomplete.  If validation is not required, the
    generated documents may not validate even if the content validates,
    because ordering constraints will be ignored.

    @keyword value: If absent or C{None}, no change is made; otherwise, this
    enables (C{True}) or disables (C{False}) the requirement that instances
    validate before being converted to XML.
    @type value: C{bool}

    @return: C{True} iff attempts to generate XML for a binding that does not
    validate should raise an exception.  N(   R   t   GlobalValidationConfigRE   R0   t   _GenerationRequiresValid(   R,   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   RequireValidWhenGenerating>  s    c         C   s&   |  d k r t j St j |   a t S(   s9  Query or set a flag that controls validation checking in XML parsing.

    Normally any attempts to convert XML to a binding instance to a binding
    instance requires that the document validate against the content model.
    In some cases it may be necessary or useful to process a document that is
    incomplete.  If validation is not required, the generated documents may
    not validate even if the content validates, because ordering constraints
    will be ignored.

    @keyword value: If absent or C{None}, no change is made; otherwise, this
    enables (C{True}) or disables (C{False}) the requirement that documents
    validate when being converted to bindings.
    @type value: C{bool}

    @return: C{True} iff attempts to generate bindings for a document that
    does not validate should raise an exception.N(   R   RL   RD   R-   t   _ParsingRequiresValid(   R,   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   RequireValidWhenParsingX  s    c         C   s8   |  d k r t St |  t  s. t |    n  |  a t S(   s  Control whether time values are converted to UTC during input.

    The U{specification <http://www.w3.org/TR/xmlschema-2/#dateTime>} makes
    clear that timezoned times are in UTC and that times in other timezones
    are to be translated to UTC when converted from literal to value form.
    Provide an option to bypass this step, so the input timezone is preserved.

    @note: Naive processing of unnormalized times--i.e., ignoring the
    C{tzinfo} field--may result in errors.N(   R   t   _PreserveInputTimeZoneR)   R*   R+   (   R,   (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   PreserveInputTimeZonep  s    s   utf-8c         C   s(   d d l  } | j j j j |  j    S(   sr  Return an iterator producing the non-element content of the provided instance.

    The catenated text of the non-element content of an instance can
    be obtained with::

       text = six.u('').join(pyxb.NonElementContent(instance))

    @param instance: An instance of L{pyxb.binding.basis.complexTypeDefinition}.

    @return: an iterator producing text values
    iN(   t   pyxb.binding.basist   bindingt   basist   NonElementContentt   ContentIteratort   orderedContent(   t   instancet   pyxb(    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyRV     s    (-   R   t   loggingt
   pyxb.utilsR    t	   getLoggerR   t   _logt   objectR   t   __version__t   __url__t   __license__t   pyxb.exceptions_t   pyxb.namespaceRZ   R   t   XMLStyle_minidomt   XMLStyle_saxdomt   XMLStyle_saxerR"   R   R   t	   iteritemst   _kt   _vR!   R   R   R%   t   Falset   _OptimizationActivet   AssertionErrorRB   t   _CorruptionDetectionEnabledR&   RL   RM   RN   RO   RP   RQ   RR   t   _OutputEncodingt   _InputEncodingRV   (    (    (    sB   /data/av2000/b2b/venv/lib/python2.7/site-packages/pyxb/__init__.pyt   <module>   sN   


4
	