HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/self/root/usr/lib/python3/dist-packages/pysimplesoap/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3/dist-packages/pysimplesoap/__pycache__/c14n.cpython-311.pyc
�

�/$ZL@���dZdZddlZddlmZ	ddlmZn#Gd�d��ZYnxYw	ddlZeZn#e	$rddlZYnwxYwd�Z
d	�Zd
�Zd�Z
ed��\ZZZd
�Zd�Zd�Zd�Zd�ZGd�d��Zdd�ZdS)a�XML Canonicalization

Patches Applied to xml.dom.ext.c14n:
    http://sourceforge.net/projects/pyxml/

    [ 1444526 ] c14n.py: http://www.w3.org/TR/xml-exc-c14n/ fix
        -- includes [ 829905 ] c14n.py fix for bug #825115, 
           Date Submitted: 2003-10-24 23:43
        -- include dependent namespace declarations declared in ancestor nodes 
           (checking attributes and tags), 
        -- handle InclusiveNamespaces PrefixList parameter

This module generates canonical XML of a document or element.
    http://www.w3.org/TR/2001/REC-xml-c14n-20010315
and includes a prototype of exclusive canonicalization
    http://www.w3.org/Signature/Drafts/xml-exc-c14n

Requires PyXML 0.7.0 or later.

Known issues if using Ft.Lib.pDomlette:
    1. Unicode
    2. does not white space normalize attributes of type NMTOKEN and ID?
    3. seems to be include "
" after importing external entities?

Note, this version processes a DOM tree, and consequently it processes
namespace nodes as attributes, not from a node's namespace axis. This
permits simple document and element canonicalization without
XPath. When XPath is used, the XPath result node list is passed and used to
determine if the node is in the XPath result list, but little else.

Authors:
    "Joseph M. Reagle Jr." <reagle@w3.org>
    "Rich Salz" <rsalz@zolera.com>

$Date: 2006-03-30 23:47:16 +0000 (Thu, 30 Mar 2006) $ by $Author: boverhof $
a*Copyright 2001, Zolera Systems Inc.  All Rights Reserved.
Copyright 2001, MIT. All Rights Reserved.

Distributed under the terms of:
  Python 2.0 License or later.
  http://www.python.org/2.0.1/license.html
or
  W3C Software License
  http://www.w3.org/Consortium/Legal/copyright-software-19980720
�N)�Node)�XMLNSc��eZdZdZdZdS)rzhttp://www.w3.org/2000/xmlns/�$http://www.w3.org/XML/1998/namespaceN)�__name__�
__module__�__qualname__�BASE�XML���3/usr/lib/python3/dist-packages/pysimplesoap/c14n.pyrr7s������.��4���r
rc�F�|jr|j���pgS�N)�
attributes�values��Es r�<lambda>r@s ��A�L�:�Q�\�%8�%8�%:�%:�A�r�r
c��|jpgSr)�
childNodesrs rrrAs
��a�l�(�b�r
c�6�|j�d��S)N�xmlns)�name�
startswith��ns rrrBs��q�v�(�(��1�1�r
c��|jdkSr)�unsuppressedPrefixesrs rrrCs��q�-��5�r
�c�r�t|j|j��}|r|St|j|j��S)zB_sorter(n1,n2) -> int
    Sorting predicate for non-NS attributes.)�cmp�namespaceURI�	localName)�n1�n2�is   r�_sorterr(Js4��	�B�O�R�_�-�-�A��N��(��r�|�R�\�*�*�*r
c�r�|ddkrdS|ddkrdSt|d|d��S)zY_sorter_ns((n,v),(n,v)) -> int
    "(an empty namespace URI is lexicographically least)."rr����)r")r%r&s  r�
_sorter_nsr,SsB��
�!�u������	�!�u�������r�!�u�b��e���r
c�.�|�d��r|dd�}n|�d��r
|dd�}|dkr	|jdvs||jks||vrdS|D]}||jkrdS�|� t|��D]}||jkrdS�d	S)
z~_utilized(n, node, other_attrs, unsuppressedPrefixes) -> boolean
    Return true if that nodespace is utilized within the node�xmlns:�Nr��)z#defaultNr+r)r�prefix�_attrs)r�node�other_attrsr�attrs     r�	_utilizedr7[s���	�|�|�H����
�a�b�b�E���	
���g�	�	��
�a�b�b�E��	�2���$�+�!3�3�3�	�T�[���A�!5�5�5��1��&�&�������A�A�A���'��4�L�L�	*�	*�D��D�K��������1r
c��g}|jrd|jzg}ndg}t|��D]A}|j�d��s|js�$|�d|jz���Bi}|D]�}|j}||vr|�|���#|�d��r"|dd�|vr|�|���Z|�d��r"|dd�|vr|�|����|j|vr|�|����|�d��r
|j||<��||fS)z�http://www.w3.org/TR/xml-exc-c14n/ 
    InclusiveNamespaces PrefixList parameter, which lists namespace prefixes that 
    are handled in the manner described by the Canonical XML Recommendation�xmlns:%srr.r/Nr0)r2r3�nodeNamer�append�value)	r4�contextr�	inclusive�usedPrefixes�a�unused_namespace_dictr6rs	         r�_inclusiveNamespacePrefixesrBos����I��{�!�"�D�K�/�0����y��
�D�\�\�2�2���:� � ��)�)�C���C�8����J���0�1�1�1�1����2�2���M���$�$�$����T�"�"�"�"�
�\�\�(�
#�
#�	2��!�"�"��1E�(E�(E����T�"�"�"�"�
�\�\�'�
"�
"�	2�q����u�0D�'D�'D����T�"�"�"�"�
�]�l�
*�
*����T�"�"�"�"�
�\�\�(�
#�
#�	2�'+�z�!�!�$���+�+�+r
c��|dup||vSrr)�subsetr4s  rrr�s��&�D�.�"B�D�F�N�r
c���eZdZdZiZd�Zd�Zd�Zeeej	<d�Z
e
eej<e
eej<d�Z
e
eej<d�Zeeej<d�Zgd	fd
�Zeeej<d	S)�_implementationz�Implementation class for C14N. This accompanies a node during it's
    processing and includes the parameters and processing state.c�&�||_|�d��|_|�dd��|_|�d��|_|�dt
jt
jd���}|ddiiif|_|j	tjkr|�|��d
S|j	tj
kr�t|_t!|��sFt#||�|��|j��\}}|�|||�	��d
S|�|��}|�||��d
S|j	tjkrd
St+t-|�����)z"Create and run the implementation.rD�commentsrr�nsdict)�xmlrrJr1)�unusedN)�write�getrDrHrrrr
�state�nodeTyper�
DOCUMENT_NODE�_do_document�ELEMENT_NODE�_Element�
documentOrder�
_inclusiverB�_inherit_context�_do_element�DOCUMENT_TYPE_NODE�	TypeError�str)�selfr4rL�kwrI�	inheritedrKs       r�__init__z_implementation.__init__�ss����
��f�f�X�&�&������z�1�-�-��
�$&�F�F�+A�$B�$B��!�����5�9�u�z�"K�"K�L�L���u�R�j�"�b�1��
��=�D�.�.�.����d�#�#�#�#�#�
�]�d�/�
/�
/�!)�D���d�#�#�
2�#>�t�T�EZ�EZ�[_�E`�E`� $� 9�$;�$;� �	�&�� � ��y�� �@�@�@�@�@� �1�1�$�7�7�	�� � ��y�1�1�1�1�1�
�]�d�5�
5�
5��D��C��I�I�&�&�&r
c�z�ttt|����}g|j}}|r�|jt
jkrxttt|����D]7}|j}||vr*|�|��|�|���8|j}|r|jt
jk�x|S)z�_inherit_context(self, node) -> list
        Scan ancestors of attribute and namespace context.  Used only
        for single element node canonicalization, not for subset
        canonicalization.)	�filter�
_IN_XML_NSr3�
parentNoderOrrRr$r;)r[r4�xmlattrsr]�parentr@rs       rrVz _implementation._inherit_context�s����*�f�T�l�l�3�3�����6�	��	'���D�,=�=�=��J��v���7�7�
(�
(���K���H�$�$��O�O�A�&�&�&��$�$�Q�'�'�'���&�F�
�	'���D�,=�=�=��r
c���t|_|jD]�}|jtjkr.t|_|�|��t|_�E|jtj	kr|�
|���p|jtjkr|�|����|jtj
kr��tt|�����dS)z�_do_document(self, node) -> None
        Process a document node. documentOrder holds whether the document
        element has been encountered such that PIs/comments can be written
        as specified.N)�_LesserElementrTrrOrrRrSrW�_GreaterElement�PROCESSING_INSTRUCTION_NODE�_do_pi�COMMENT_NODE�_do_commentrXrYrZ)r[r4�childs   rrQz_implementation._do_document�s���,����_�	,�	,�E��~��!2�2�2�%-��"�� � ��'�'�'�%4��"�"���4�#C�C�C����E�"�"�"�"���4�#4�4�4�� � ��'�'�'�'���4�#:�:�:����E�
�
�+�+�+�	,�	,r
c� �t|j|��sdStj|jdd��}tj|dd��}tj|dd��}tj|dd	��}|r|�|��dSdS)
z�_do_text(self, node) -> None
        Process a text or CDATA node.  Render various special characters
        as their C14N entity representations.N�&�&amp;�<�&lt;�>z&gt;�
z&#xD;)�
_in_subsetrD�string�replace�datarL)r[r4�ss   r�_do_textz_implementation._do_text�s����$�+�t�,�,�4�f�f��N�4�9�c�7�3�3���N�1�c�6�*�*���N�1�c�6�*�*���N�1�f�g�.�.����d�j�j��m�m�m�m�m��r
c�<�t|j|��sdS|j}|jtkr|d��|d��||j��|j}|r|d��||��|d��|jtkr
|d��dSdS)z�_do_pi(self, node) -> None
        Process a PI node. Render a leading or trailing #xA if the
        document order of the PI is greater or lesser (respectively)
        than the document element.
        N�
z<?� z?>)rtrDrLrTrgr:rwrf)r[r4�Wrxs    rriz_implementation._do_pi�s����$�+�t�,�,�4�f�f��J�����0�0�!�!�D�'�'�'�	��$����	��$�-�����I���	�
�A�c�F�F�F�
�A�a�D�D�D�	��$�������/�/���4������/�/r
c��t|j|��sdS|jre|j}|jt
kr|d��|d��||j��|d��|jtkr|d��dSdSdS)z�_do_comment(self, node) -> None
        Process a comment node. Render a leading or trailing #xA if the
        document order of the comment is greater or lesser (respectively)
        than the document element.
        Nr{z<!--z-->)rtrDrHrLrTrgrwrf)r[r4r}s   rrkz_implementation._do_comments����$�+�t�,�,�4�f�f��=�	=��
�A��!�_�4�4�a�a��g�g�g�
�A�f�I�I�I�
�A�d�i�L�L�L�
�A�e�H�H�H��!�^�3�3�Q�Q�t�W�W�W�W�W�
	=�	=�4�3r
c��|j}|d��||��|d��tj|dd��}tj|dd��}tj|dd��}tj|d	d
��}tj|dd��}tj|d
d��}||��|d��dS)z;'_do_attr(self, node) -> None
        Process an attribute.r|z="rnrorprq�"z&quot;�	z&#x9r{z&#xArsz&#xDN)rLrurv)r[rr<r}rxs     r�_do_attrz_implementation._do_attrs���
�J��	��#����	��!����	��$�����N�5�#�w�/�/���N�1�c�6�*�*���N�1�c�8�,�,���N�1�f�f�-�-���N�1�f�f�-�-���N�1�f�f�-�-��	��!����	��#�����r
Nc��|jd|jd���|jd���}}}|}|�|jd���}|���}t|��}	i}
g}t|j|��}|t|��zD]�}
|
jtjkr|
j	}|dkrd}|
j
||<nc|
jtjkr$|	s|rt|j|
��r
|
|
|
j	<n*t|j|
��r|�|
��|�
|
����|jd}}|�r7|j	}|	sv|j�d|jz}nd}|�|��sM|�|��s8|�|��st#d	|�d
|�����||||<||=|d��||��g}|���D]�\}}|dkr5|tjdfvr%|�d��tjddfvr�@|d
vr|dvr�I||f|���vr8|	st)||||j��r|�||f����|	s|||<��|�t.��|D] \}}|�||��|||<�!|	rt|j|j��r(|�|
�����n'|�|�����|�t8��|D]"}
|�|
j	|
j���#|d��|j||||fc}|_t=|��D]"}t?j |j!||���#||_|r|d|z��dSdS)zu_do_element(self, node, initial_other_attrs = [], unused = {}) -> None
        Process an element (and its children).rr+�Nr r.rr9z*For exclusive c14n, unable to map prefix "z" in rpr1)z	xmlns:xmlrJ)rrrz</%s>)"rN�copyrUrtrDr3r#rr
r:�	nodeValuerr;�updaterLr2�has_key�RuntimeError�itemsrMr7r�sortr,r�rb�extendrr(r<�	_childrenrF�handlersrO)r[r4�initial_other_attrsrK�	ns_parent�ns_rendered�	xml_attrs�ns_unused_inherited�ns_localr>�xml_attrs_localr5�	in_subsetr@rr}rr2�ns_to_render�vrN�cs                      rrWz_implementation._do_element%s����
�1�
�t�z�!�}�1�1�3�3�T�Z��]�5G�5G�5I�5I�!*�;�	�%���>�"&�*�Q�-�"4�"4�"6�"6���>�>�#�#���t�$�$�	������t�{�D�1�1�	�$�v�d�|�|�3�	.�	.�A��~���+�+��J����=�=�g�!��k�������5�9�,�,��4��4�
�4�;��0J�0J�4�23�O�A�J�/���t�{�A�.�.�*��&�&�q�)�)�)�
���_�-�-�-�-��*�d�4���>	��=�D��

4��;�*�'���4�F�F�$�F�"�*�*�6�2�2�4�8�;K�;K�F�;S�;S�4�.�6�6�v�>�>�+�*�l�"�F�F�D�D�*�+�+�+�(;�6�'B�H�V�$�+�F�3�
�A�c�F�F�F�
�A�d�G�G�G��L��~�~�'�'�
3�
3���!���<�<�A�5�:�r�);�$;�$;��O�O�G�,�,�%�*�b�$�0H�H�H��
�,�,�,��C�C�C��
�a�5�� 1� 1� 3� 3�3�3� �3�I�a��{�D�D]�$^�$^�3�$�+�+�Q��F�3�3�3�3�&�3�12�+�A�.��
���j�)�)�)�#�
!�
!���!��
�
�a��#�#�#� ��A���
�
7�
�4�;�t�� G� G�
7��"�"�?�#9�#9�#;�#;�<�<�<�<��"�"�9�#3�#3�#5�#5�6�6�6����W�%�%�%� �
3�
3���
�
�a�j�!�'�2�2�2�2�
�A�c�F�F�F�!�J��;�	�K^�(_���t�z��4���	:�	:�A��$�Q�Z�0��q�9�9�9�9���
��"���7�T�>�"�"�"�"�"�"�"r
)rrr	�__doc__r�r^rVrQrrPry�	TEXT_NODE�CDATA_SECTION_NODErirhrkrjr�rWrRrr
rrFrF�s������D�D��H�'�'�'�8���*,�,�,�($0�H�T�
� �	�	�	� (�H�T�^��(0�H�T�
$�%�9�9�9�"28�H�T�
-�.�
=�
=�
=�#.�H�T�
�����$79�4�t#�t#�t#�t#�j#.�H�T�
���r
rFc���|rtt||jf|��dStj��}tt||jf|��|���S)a�Canonicalize(node, output=None, **kw) -> UTF-8

    Canonicalize a DOM document/element node and all descendents.
    Return the text; if output is specified then output.write will
    be called to output the text and None will be returned
    Keyword parameters:
        nsdict: a dictionary of prefix:uri namespace entries
                assumed to exist in the surrounding context
        comments: keep comments if non-zero (default is 0)
        subset: Canonical XML subsetting resulting from XPath
                (default is [])
        unsuppressedPrefixes: do exclusive C14N, and this specifies the
                prefixes that should be inherited.
    N)�applyrFrL�StringIO�getvalue)r4�outputr\rxs    r�Canonicalizer��s_����
�o��f�l�3�R�8�8�8�8�8������
�o��a�g���3�3�3��z�z�|�|�r
r)r��
_copyrightru�xml.domr�xml.nsr�	cStringIOr��ImportErrorr3r�rarU�rangerfrSrgr(r,r7rBrtrFr�rr
r�<module>r�s���#�#�J	�
��
�
�
�������5���������5�5�5�5�5�5�5�5�5�5�5����������H�H�������O�O�O�O�O�����
B�	A��(�(�	�
1�
1�
�
5�
5�
�
-2�E�!�H�H�)���/�+�+�+����
�
�
�(,�,�,�>C�
B�
�I.�I.�I.�I.�I.�I.�I.�I.�X�����s��(�3�	?�?