MSV FM

[email protected]: ~ $
Path : /usr/lib64/python3.6/site-packages/lxml/html/__pycache__/
File Upload :
Current < : //usr/lib64/python3.6/site-packages/lxml/html/__pycache__/clean.cpython-36.pyc

3

��]b�i�/@s�dZddlZddlZyddlmZWn ek
rDddlmZYnXddlmZddl	m
Z
ddl	mZmZddl	m
Z
mZyeWnek
r�eZYnXyeWnek
r�eZYnXyeWnek
r�eZYnXyeWnek
�r
eefZYnXdd	d
ddd
dgZejdejejB�jZejdej�jZejdej�jZejdej�j Z!ejdej�j Z"ejdej�j Z#dd�Z$ejd�jZ%ejdejejB�Z&ej'd�Z(ej'ddeid�Z)Gdd
�d
e*�Z+e+�Z,e,j-Z-ejdej�ejdej�gZ.d d!d"d#d$d%gZ/ejd&ej�ejd'ej�ejd(�gZ0d)gZ1e.e/e0e1fd*d�Z2d+d,�Z3d-d�Z4e2je4_d!d d"gZ5d.gZ6d/e5e6ed0�fd1d
�Z7d2d�Z8d3d4�Z9ejd5ej�Z:d6d7�Z;dS)8zcA cleanup tool for HTML.

Removes unwanted tags and content.  See the `Cleaner` class for
details.
�N)�urlsplit)�etree)�defs)�
fromstring�XHTML_NAMESPACE)�
xhtml_to_html�_transform_result�
clean_html�clean�Cleaner�autolink�
autolink_html�
word_break�word_break_htmlzexpression\s*\(.*?\)z
@\s*importz</?[a-zA-Z]+|\son[a-zA-Z]+\s*=z^data:image/(.+);base64,z:(javascript|jscript|livescript|vbscript|data|about|mocha):z	(xml|svg)cCs:d}x t|�D]}d}t|�rdSqW|r.dStt|��S)NFT)�_find_image_dataurls�_is_unsafe_image_type�bool�_is_possibly_malicious_scheme)�sZis_image_urlZ
image_type�r�/usr/lib64/python3.6/clean.py�_is_javascript_schemeTsrz[\s\x00-\x08\x0B\x0C\x0E-\x19]+z\[if[\s\n\r]+.*?][\s\n\r]*>zdescendant-or-self::*[@style]z�descendant-or-self::a  [normalize-space(@href) and substring(normalize-space(@href),1,1) != '#'] |descendant-or-self::x:a[normalize-space(@href) and substring(normalize-space(@href),1,1) != '#']�x)Z
namespacesc	@s�eZdZdZdZdZdZdZdZdZ	dZ
dZdZdZ
dZdZdZdZdZdZdZdZejZdZfZeddg�Zdd�Zed	d
ddgd	d	d	d
d
�Zdd�Zdd�Z dd�Z!dd�Z"dd�Z#d!dd�Z$dd�Z%e&j'de&j(�j)Z*dd�Z+dd �Z,dS)"ra
    Instances cleans the document of each of the possible offending
    elements.  The cleaning is controlled by attributes; you can
    override attributes in a subclass, or set them in the constructor.

    ``scripts``:
        Removes any ``<script>`` tags.

    ``javascript``:
        Removes any Javascript, like an ``onclick`` attribute. Also removes stylesheets
        as they could contain Javascript.

    ``comments``:
        Removes any comments.

    ``style``:
        Removes any style tags.

    ``inline_style``
        Removes any style attributes.  Defaults to the value of the ``style`` option.

    ``links``:
        Removes any ``<link>`` tags

    ``meta``:
        Removes any ``<meta>`` tags

    ``page_structure``:
        Structural parts of a page: ``<head>``, ``<html>``, ``<title>``.

    ``processing_instructions``:
        Removes any processing instructions.

    ``embedded``:
        Removes any embedded objects (flash, iframes)

    ``frames``:
        Removes any frame-related tags

    ``forms``:
        Removes any form tags

    ``annoying_tags``:
        Tags that aren't *wrong*, but are annoying.  ``<blink>`` and ``<marquee>``

    ``remove_tags``:
        A list of tags to remove.  Only the tags will be removed,
        their content will get pulled up into the parent tag.

    ``kill_tags``:
        A list of tags to kill.  Killing also removes the tag's content,
        i.e. the whole subtree, not just the tag itself.

    ``allow_tags``:
        A list of tags to include (default include all).

    ``remove_unknown_tags``:
        Remove any tags that aren't standard parts of HTML.

    ``safe_attrs_only``:
        If true, only include 'safe' attributes (specifically the list
        from the feedparser HTML sanitisation web site).

    ``safe_attrs``:
        A set of attribute names to override the default list of attributes
        considered 'safe' (when safe_attrs_only=True).

    ``add_nofollow``:
        If true, then any <a> tags will have ``rel="nofollow"`` added to them.

    ``host_whitelist``:
        A list or set of hosts that you can use for embedded content
        (for content like ``<object>``, ``<link rel="stylesheet">``, etc).
        You can also implement/override the method
        ``allow_embedded_url(el, url)`` or ``allow_element(el)`` to
        implement more complex rules for what can be embedded.
        Anything that passes this test will be shown, regardless of
        the value of (for instance) ``embedded``.

        Note that this parameter might not work as intended if you do not
        make the links absolute before doing the cleaning.

        Note that you may also need to set ``whitelist_tags``.

    ``whitelist_tags``:
        A set of tags that can be included with ``host_whitelist``.
        The default is ``iframe`` and ``embed``; you may wish to
        include other tags like ``script``, or you may want to
        implement ``allow_embedded_url`` for more control.  Set to None to
        include all tags.

    This modifies the document *in place*.
    TFN�iframe�embedcKsZx:|j�D].\}}t||�s,td||f��t|||�q
W|jdkrVd|krV|j|_dS)NzUnknown parameter: %s=%r�inline_style)�items�hasattr�	TypeError�setattrr�style)�self�kw�name�valuerrr�__init__�s
zCleaner.__init__�src�href�code�object)�script�link�appletrr�layer�acCs�t|d�r|j�}t|�x|jd�D]
}d|_q&W|jsD|j|�t|jpNf�}t|j	p\f�}t|j
pjf�}|jr~|jd�|j
r�t|j�}x:|jtj�D]*}|j}x|j�D]}||kr�||=q�Wq�W|j�r*|j
o�|jtjk�s(x@|jtj�D]0}|j}x$|j�D]}|jd��r||=�qWq�W|j|jdd�|j�s�x\t|�D]P}|jd�}	td	|	�}
td	|
�}
|j|
��r�|jd=n|
|	k�rJ|jd|
��qJW|j�s*x�t|jd��D]p}|jd
d	�j �j!�dk�r�|j"��q�|j#�p�d	}	td	|	�}
td	|
�}
|j|
��rd|_#n|
|	k�r�|
|_#�q�W|j�s:|j$�rF|jtj%�|j$�rZ|jtj&�|j�rl|jd�|j�r�tj'|d�|j(�r�|jd
�nT|j�s�|j�r�xBt|jd
��D]0}d|jdd	�j �k�r�|j)|��s�|j"��q�W|j*�r�|jd�|j+�r|j,d)�|j-�r�x\t|jd��D]J}d}|j.�}x$|dk	�rX|jd*k�rX|j.�}�q6W|dk�r$|j"��q$W|j,d+�|j,d,�|j/�r�|j,tj0�|j1�r�|jd�|j,d-�|j2�r�|j,d.�g}
g}x`|j�D]T}|j|k�r|j)|��r��q�|j3|�n&|j|k�r�|j)|��r"�q�|
j3|��q�W|
�rb|
d"|k�rb|
j4d"�}d#|_|jj5�n8|�r�|d"|k�r�|j4d"�}|jdk�r�d#|_|j5�|j6�x|D]}|j"��q�Wx|
D]}|j7��q�W|j8�r�|�r�t9d$��ttj:�}|�rlg}x(|j�D]}|j|k�r|j3|��qW|�rl|d"|k�rT|j4d"�}d#|_|jj5�x|D]}|j7��qZW|j;�r�xdt<|�D]X}|j=|��s~|jd�}|�r�d%|k�r�d&d'|k�r��q~d(|}nd%}|jd|��q~WdS)/z&
        Cleans the document.
        �getrootZimageZimgr*ZonF)Zresolve_base_hrefr ��typeztext/javascriptz
/* deleted */r+Z
stylesheet�rel�meta�head�html�title�paramNr,r)rrr-Zform�button�input�select�textarea�blink�marqueerZdivzIIt does not make sense to pass in both allow_tags and remove_unknown_tagsZnofollowz
 nofollow z %s z%s nofollow)r4r5r6)r,r))r,)rrr-r)r7)r8r9r:r;)r<r=)>rr/r�iter�tag�comments�kill_conditional_comments�set�	kill_tags�remove_tags�
allow_tags�scripts�add�safe_attrs_only�
safe_attrsrZElement�attrib�keys�
javascriptr�
startswithZ
rewrite_links�_remove_javascript_linkr�_find_styled_elements�get�_replace_css_javascript�_replace_css_import�_has_sneaky_javascriptr �list�lower�strip�	drop_tree�text�processing_instructions�CommentZProcessingInstructionZstrip_attributes�links�
allow_elementr3�page_structure�update�embeddedZ	getparent�framesZ
frame_tags�forms�
annoying_tags�append�pop�clear�reverseZdrop_tag�remove_unknown_tags�
ValueErrorZtags�add_nofollow�_find_external_links�allow_follow)r!�doc�elrCrDrErIrJZaname�old�newZfound_parent�parent�_removeZ_kill�badr2rrr�__call__s
































zCleaner.__call__cCsdS)zF
        Override to suppress rel="nofollow" on some anchors.
        Fr)r!�anchorrrrrk�szCleaner.allow_followcCs�|j|jkrdS|j|j}t|ttf�r^x.|D]&}|j|�}|sFdS|j||�s0dSq0WdS|j|�}|spdS|j||�SdS)NFT)r?�_tag_link_attrs�
isinstancerT�tuplerP�allow_embedded_url)r!rm�attrZone_attr�urlrrrr\�s


zCleaner.allow_elementcCs^|jdk	r|j|jkrdSt|�\}}}}}|j�jdd�d}|dkrLdS||jkrZdSdS)	NF�:�r�http�httpsT)r}r~)�whitelist_tagsr?rrU�split�host_whitelist)r!rmrz�schemeZnetloc�pathZqueryZfragmentrrrrx�s

zCleaner.allow_embedded_urlcCsg}|j|dd�tj�dS)z�
        IE conditional comments basically embed HTML that the parser
        doesn't normally see.  We can't allow anything like that, so
        we'll kill any comments that could be conditional.
        cSstj|j�S)N)�_conditional_comment_re�searchrX)rmrrr�<lambda>�sz3Cleaner.kill_conditional_comments.<locals>.<lambda>N)�_kill_elementsrrZ)r!rlrrrrrrA�sz!Cleaner.kill_conditional_commentscCsDg}x$|j|�D]}||�r|j|�qWx|D]}|j�q0WdS)N)r>rcrW)r!rlZ	conditionZiteraterrrmrrrr��s
zCleaner._kill_elementscCstd|�}t|�rdS|S)Nr0)�_substitute_whitespacer)r!r+rorrrrN�s
zCleaner._remove_javascript_linkz	/\*.*?\*/cCsj|jd|�}|jdd�}td|�}|j�}d|kr6dSd|krBdSd|krNdSd|krZdSt|�rfdSdS)	a�
        Depending on the browser, stuff like ``e x p r e s s i o n(...)``
        can get interpreted, or ``expre/* stuff */ssion(...)``.  This
        checks for attempt to do stuff like this.

        Typically the response will be to kill the entire style; if you
        have just a bit of Javascript in the style another rule will catch
        that and remove only the Javascript from the style; this catches
        more sneaky attempts.
        r0�\zjavascript:Tzexpression(z@importz
</noscriptF)�_substitute_comments�replacer�rU�_looks_like_tag_content)r!r rrrrS�s
zCleaner._has_sneaky_javascriptcCs8t|�}t|t�rt|�}n
tj|�}||�t||�S)N)r1rv�
basestringr�copy�deepcopyr)r!r5�result_typerlrrrr	s


zCleaner.clean_html)N)-�__name__�
__module__�__qualname__�__doc__rFrLr@r rr[r3r]rYr_r`rarbrDrErCrgrHrrIrir�rBrr%�dictrursrkr\rxrAr�rN�re�compile�S�subr�rSr	rrrrrmsV]	5
zb(?P<body>https?://(?P<host>[a-z0-9._-]+)(?:/[/\-_.,a-z0-9%&?;=~]*)?(?:\([/\-_.,a-z0-9%&?;=~]*\))?)z9mailto:(?P<body>[a-z0-9._-]+@(?P<host>[a-z0-9_.-]+[a-z]))r;Zprer(r4r:r.z
^localhostz\bexample\.(?:com|org|net)$z^127\.0\.0\.1$ZnolinkcCs�|j|krdS|jd�}|r>|j�}x|D]}||kr*dSq*Wxht|�D]\}t|||||d�|jrHt|j|||jd�\}}	|	rH||_|j|�}
|	||
d|
d�<qHW|j	r�t|j	|||jd�\}}|r�||_	||dd�<dS)a
    Turn any URLs into links.

    It will search for links identified by the given regular
    expressions (by default mailto and http(s) links).

    It won't link text in an element in avoid_elements, or an element
    with a class in avoid_classes.  It won't link to anything with a
    host that matches one of the regular expressions in avoid_hosts
    (default localhost and 127.0.0.1).

    If you pass in an element, the element's tail will not be
    substituted, only the contents of the element.
    N�class)�link_regexes�avoid_elements�avoid_hosts�
avoid_classes)�factoryr|r)
r?rPr�rTr�tail�
_link_textZmakeelement�indexrX)rmr�r�r�r��
class_nameZmatch_class�childrXZ
tail_childrenr�Zpre_childrenrrrr4s4



cCs�d}g}d}�x�d\}}x�|D]~}	|}
xJ|	j||
d�}|dkr@P|jd�}x"|D]}
|
j|�rP|j�}
PqPWPq(W|dkr|q|dks�|j�|kr|}|j�}qW|dkr�|r�|djs�t�||d
_n|s�t�|}P|jd�}|j�}|jd��s|jd��r|d8}|dd�}|d|j��}|�rJ|dj�s>t�||d_n|�sVt�|}|d�}|jd	|�|jd
�}|�s�|}|jd��s�|jd��r�|dd�}||_|j	|�||d�}qW||fS)Nr0r)�pos�hostr|�.�,r.r'�body)NN���r�r�r�r�r�)
r��group�end�startr��AssertionError�endswithrBrXrc)rXr�r�r�Zleading_textr[Zlast_posZ
best_matchZbest_posZregexZ	regex_pos�matchr�Z
host_regexr+r�Z	prev_textrtr�rrrr�asf







r�cOs@t|�}t|t�rt|�}n
tj|�}t|f|�|�t||�S)N)r1rvr�rr�r�rr)r5�argsr"r�rlrrrr
�s


Znobreak�(i c	Cs�|jtkrdS|jd�}|rLd}|j�}x|D]}||kr.d}Pq.W|rLdS|jrbt|j||�|_x4|D],}t|||||d�|jrht|j||�|_qhWdS)a�
    Breaks any long words found in the body of the text (not attributes).

    Doesn't effect any of the tags in avoid_elements, by default
    ``<textarea>`` and ``<pre>``

    Breaks words by inserting &#8203;, which is a unicode character
    for Zero Width Space character.  This generally takes up no space
    in rendering, but does copy as a space, and in monospace contexts
    usually takes up space.

    See http://www.cs.tut.fi/~jkorpela/html/nobr.html for a discussion
    Nr�FT)�	max_widthr�r��break_character)r?�_avoid_word_break_elementsrPr�rX�_break_textrr�)	rmr�r�r�r�r�Z
dont_breakZavoidr�rrrr�s*



cOs*t|�}t|�}t|f|�|�t||�S)N)r1rrr)r5r�r"r�rlrrrr�scCs>|j�}x0|D](}t|�|krt|||�}|j||�}qW|S)N)r��len�
_insert_breakr�)rXr�r�Zwords�wordZreplacementrrrr��s
r�z[^a-z]cCs�|}d}xrt|�|krz|d|�}ttj|��}|r\|d}|j�|dkr\|d|j��}|||7}|t|�d�}q
W||7}|S)Nr0r|�
r�)r�rT�_break_prefer_re�finditerr�)r��widthr�Z	orig_word�resultr�ZbreaksZ
last_breakrrrr��sr�)<r�r�r�Zurlparser�ImportErrorZurllib.parseZlxmlrZ	lxml.htmlrrrrrZunichr�	NameError�chrZunicode�str�bytesr��__all__r�r��Ir�rQrR�ASCIIr�r��findallrrrrr�r�ZXPathrOrjr)rr
r	Z
_link_regexesZ_avoid_elementsZ_avoid_hostsZ_avoid_classesrr�r
r�Z_avoid_word_break_classesrrr�r�r�rrrr�<module>s�





3*:	
&
Bethany
Bethany
0%

THE FINEST HOTEL NEAR LAKE KIVU

The Perfect Base For You

Required fields are followed by *





EC1A68011

About Us

Delicious Interior With The Pinch Of Everything

Bethany Investment group is Presbyterian church in Rwanda(EPR) company that manage Hotel and Guest house in Karongi (Bethany Hotel), ISANO branch in GIKONDO(Kigali), Kiyovu branch(Kigali), AMIZERO branch(Nyagatare-East) and Gisenyi Branch(Rubavu).

Accomodation

Get a Comfortable Room
Feel The Comfort

Get a comfortable room and feel our hotel’s comfort. Bethany Hotel features a variety of fully furnished rooms with extra space, Executive rooms, Deluxe rooms with a beautiful lake view and garden space, Deluxe rooms, comfort rooms, family rooms and standard rooms at your service.

Standard Single

Services

We Provide Top Class Facility
Especially For You

Beach BBQ Party

Kick back on the beach& and enjoy our berbecue from our masterchef

Breakfast

Kick back at our hotels& enjoy our breakfast from our masterchef

Conference Hall

Kick back at our hotels& enjoy our conference halls from all bethany branches

Enjoy with your partner

Honeymoon Package

80%

Get In Touch

Don’t Miss Any Update

    +

    Search your Room

    Required fields are followed by *