Sindbad~EG File Manager
3
B;�WU7�@s�ddlmZmZmZddlmZddlZddlmZm Z ddl
mZmZm
Z
ddl
mZmZmZddlmZmZdd lmZd
je
�dZejded
�Zejded�ZiZed�dkZx�eej��D]p\Z Z!er�ee!�dks�er�ee!�dkr�q�e!dkr�ee!�dk�rej"e!�Z!ne#e!�Z!e!ek�s4e j$�r�e ee!<q�Wdd�Z%ede%�ddd�Z&Gdd�de'�Z(Gdd�de)�Z*dS)�)�absolute_import�division�unicode_literals)� text_typeN)�register_error�xmlcharrefreplace_errors�)�voidElements�booleanAttributes�spaceCharacters)�rcdataElements�entities�xmlEntities)�treewalkers�_utils)�escape�z"'=<>`�[�]u_
/` ᠏
]u��&c
Cs"t|ttf��rg}g}d}x�t|j|j|j��D]n\}}|rFd}q4||j}tj|j|t |j|dg���r�tj
|j||d��}d}nt|�}|j|�q4Wx^|D]V}t
j|�} | r�|jd�|j| �| jd�s�|jd�q�|jdt|�dd��q�Wdj|�|jfSt|�SdS)NFrTr�;z&#x%s;r)�
isinstance�UnicodeEncodeError�UnicodeTranslateError� enumerate�object�start�endrZisSurrogatePair�min�surrogatePairToCodepoint�ord�append�_encode_entity_map�get�endswith�hex�joinr)
�exc�resZ
codepoints�skip�i�c�indexZ codepointZcp�e�r/� /usr/lib/python3.6/serializer.py�htmlentityreplace_errors*s0
"
r1�htmlentityreplace�etreecKs$tj|�}tf|�}|j||�|�S)N)rZ
getTreeWalker�HTMLSerializer�render)�inputZtree�encodingZserializer_optsZwalker�sr/r/r0� serializeJs
r9c@s~eZdZdZdZdZdZdZdZdZ dZ
dZdZdZ
dZdZdZd!Zdd�Zdd�Zdd�Zd"dd�Zd#dd�Zd$dd �ZdS)%r4�legacy�"TF�quote_attr_values�
quote_char�use_best_quote_char�omit_optional_tags�minimize_boolean_attributes�use_trailing_solidus�space_before_trailing_solidus�escape_lt_in_attrs�
escape_rcdata�resolve_entities�alphabetical_attributes�inject_meta_charset�strip_whitespace�sanitizec Kszt|�t|j�}t|�dkr2tdtt|����d|kr@d|_x(|jD]}t|||j|t ||���qHWg|_
d|_dS)a6 Initialize HTMLSerializer.
Keyword options (default given first unless specified) include:
inject_meta_charset=True|False
Whether it insert a meta element to define the character set of the
document.
quote_attr_values="legacy"|"spec"|"always"
Whether to quote attribute values that don't require quoting
per legacy browser behaviour, when required by the standard, or always.
quote_char=u'"'|u"'"
Use given quote character for attribute quoting. Default is to
use double quote unless attribute value contains a double quote,
in which case single quotes are used instead.
escape_lt_in_attrs=False|True
Whether to escape < in attribute values.
escape_rcdata=False|True
Whether to escape characters that need to be escaped within normal
elements within rcdata elements such as style.
resolve_entities=True|False
Whether to resolve named character entities that appear in the
source tree. The XML predefined entities < > & " '
are unaffected by this setting.
strip_whitespace=False|True
Whether to remove semantically meaningless whitespace. (This
compresses all whitespace to a single space except within pre.)
minimize_boolean_attributes=True|False
Shortens boolean attributes to give just the attribute value,
for example <input disabled="disabled"> becomes <input disabled>.
use_trailing_solidus=False|True
Includes a close-tag slash at the end of the start tag of void
elements (empty elements whose end tag is forbidden). E.g. <hr/>.
space_before_trailing_solidus=True|False
Places a space immediately before the closing slash in a tag
using a trailing solidus. E.g. <hr />. Requires use_trailing_solidus.
sanitize=False|True
Strip all unsafe or unknown constructs from output.
See `html5lib user documentation`_
omit_optional_tags=True|False
Omit start/end tags that are optional.
alphabetical_attributes=False|True
Reorder attributes to be in alphabetical order.
.. _html5lib user documentation: http://code.google.com/p/html5lib/wiki/UserDocumentation
rz2__init__() got an unexpected keyword argument '%s'r=FN)� frozenset�options�len� TypeError�next�iterr>�setattrr$�getattr�errors�strict)�self�kwargsZunexpected_args�attrr/r/r0�__init__ps.zHTMLSerializer.__init__cCs*t|t�st�|jr"|j|jd�S|SdS)Nr2)rr�AssertionErrorr7�encode)rT�stringr/r/r0rY�szHTMLSerializer.encodecCs*t|t�st�|jr"|j|jd�S|SdS)NrS)rrrXr7rY)rTrZr/r/r0�encodeStrict�szHTMLSerializer.encodeStrictNccs�||_d}g|_|r0|jr0ddlm}|||�}|jrJddlm}||�}|jrdddlm}||�}|j r~ddl
m}||�}|jr�ddlm}||�}�xR|D�]H}|d}|dk�r`d|d}|dr�|d |d7}n|d
r�|d7}|d
�rJ|d
j
d�d
k�r0|d
j
d�d
k�r*|jd�d}nd}|d||d
|f7}|d7}|j|�Vq�|d5k�r�|dk�sz|�r�|�r�|dj
d�d
k�r�|jd�|j|d�Vn|jt|d��Vq�|d6k�r�|d} |jd| �V| tk�r|j�rd}n|�r|jd��x�|dj�D�]�\\}
}}|}
|}|jd�V|j|
�V|j�s�|
tj| t��k�r"|
tjdt��k�r"|jd�V|jdk�s�t|�d
k�r�d}n@|jd k�r�tj|�dk }n$|jd!k�r�tj|�dk }ntd"��|jd#d$�}|j �r|jd%d&�}|�r�|j!}|j"�rTd|k�r<d|k�r<d}nd|k�rTd|k�rTd}|dk�rl|jdd'�}n|jdd(�}|j|�V|j|�V|j|�Vn|j|�V�q"W| t#k�r�|j$�r�|j%�r�|jd)�Vn|jd*�V|jd�Vq�|d+k�r6|d} | tk�rd}n|�r$|jd�|jd,| �Vq�|d-k�rx|d}|j
d.�d
k�rb|jd/�|jd0|d�Vq�|d1k�r�|d} | d2}|t&k�r�|jd3| �|j'�r�|t(k�r�t&|}nd4| }|j|�Vq�|j|d�q�WdS)7NFr)�Filter�typeZDoctypez<!DOCTYPE %s�nameZpublicIdz PUBLIC "%s"ZsystemIdz SYSTEMr;r�'zASystem identifer contains both single and double quote charactersz %s%s%s�>�
Characters�SpaceCharacters�dataz</zUnexpected </ in CDATA�StartTag�EmptyTagz<%sTz+Unexpected child element of a CDATA element� r�=�always�specr:z?quote_attr_values must be one of: 'always', 'spec', or 'legacy'rz&�<z<z'z"z /�/ZEndTagz</%s>�Commentz--zComment contains --z <!--%s-->ZEntityrzEntity %s not recognizedz&%s;)rarb)rdre))r7rRrGZfilters.inject_meta_charsetr\rFZfilters.alphabeticalattributesrHZfilters.whitespacerIZfilters.sanitizerr?Zfilters.optionaltags�find�serializeErrorr[rYrrrD�itemsr@r
r$�tupler<rL�_quoteAttributeSpec�search�_quoteAttributeLegacy�
ValueError�replacerCr=r>r rArBr
rEr)rT�
treewalkerr7Zin_cdatar\�tokenr]Zdoctyper=r^�_Z attr_nameZ
attr_value�k�vZ
quote_attrrc�keyr/r/r0r9�s�
zHTMLSerializer.serializecCs2|rdjt|j||���Sdjt|j|���SdS)N�r)r'�listr9)rTrvr7r/r/r0r5?szHTMLSerializer.render�XXX ERROR MESSAGE NEEDEDcCs|jj|�|jrt�dS)N)rRr"rS�SerializeError)rTrcr/r/r0rnEszHTMLSerializer.serializeError)r<r=r>r?r@rArBrCrDrErFrGrHrI)N)N)r~)�__name__�
__module__�__qualname__r<r=r>r?r@rArBrCrDrErFrGrHrIrKrWrYr[r9r5rnr/r/r/r0r4Qs68
r4c@seZdZdZdS)rzError in serialized treeN)r�r�r��__doc__r/r/r/r0rLsr)r3N)+Z
__future__rrrZsixr�re�codecsrrZ constantsr r
rrr
rrrrZxml.sax.saxutilsrr'Z_quoteAttributeSpecChars�compilerqrsr#rLZ_is_ucs4r}roryrzr r!�islowerr1r9rr4� Exceptionrr/r/r/r0�<module>s:
|
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists