https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/future/backports/urllib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/future/backports/urllib/__pycache__/robotparser.cpython-310.pyc
o

,�]��@s�ddlmZmZmZddlmZ	ddlmZddlm	Z
mZe
e_	ee_dgZ
Gdd�de�ZGdd�de�ZGd	d
�d
e�ZdS)�)�absolute_import�division�unicode_literals��str)�urllib)�parse�request�RobotFileParserc@sZeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)r
zs This class provides a set of methods to read, parse and answer
    questions about a single robots.txt file.

    �cCs,g|_d|_d|_d|_|�|�d|_dS)NFr)�entries�
default_entry�disallow_all�	allow_all�set_url�last_checked��self�url�r�E/usr/lib/python3/dist-packages/future/backports/urllib/robotparser.py�__init__s

zRobotFileParser.__init__cCs|jS)z�Returns the time the robots.txt file was last fetched.

        This is useful for long-running web spiders that need to
        check for new robots.txt files periodically.

        )r�rrrr�mtime&szRobotFileParser.mtimecCsddl}|��|_dS)zYSets the time the robots.txt file was last fetched to the
        current time.

        rN)�timer)rrrrr�modified/szRobotFileParser.modifiedcCs&||_tj�|�dd�\|_|_dS)z,Sets the URL referring to a robots.txt file.��N)rrr�urlparse�host�pathrrrrr7s zRobotFileParser.set_urlc
Cs�z	tj�|j�}Wn4tjjy=}z&|jdvrd|_n|jdkr+d|_WYd}~dSWYd}~dSWYd}~dSd}~ww|�	�}|�
|�d����dS)z4Reads the robots.txt URL and feeds it to the parser.)i�i�Ti�Nzutf-8)
rr	�urlopenr�error�	HTTPError�coderr�readr�decode�
splitlines)r�f�err�rawrrrr%<s

����zRobotFileParser.readcCs2d|jvr|jdur||_dSdS|j�|�dS�N�*)�
useragentsr
r�append)r�entryrrr�
_add_entryIs



�zRobotFileParser._add_entrycCsjd}t�}|D]�}|s#|dkrt�}d}n|dkr#|�|�t�}d}|�d�}|dkr2|d|�}|��}|s9q|�dd�}t|�dkr�|d����|d<tj�	|d���|d<|ddkrx|dkrm|�|�t�}|j
�|d�d}q|ddkr�|dkr�|j�t
|dd	��d}q|dd
kr�|dkr�|j�t
|dd��d}q|dkr�|�|�dSdS)z�Parse the input lines from a robots.txt file.

        We allow that a user-agent: line is not preceded by
        one or more blank lines.
        rr��#N�:z
user-agent�disallowF�allowT)�Entryr0�find�strip�split�len�lowerrr�unquoter-r.�	rulelines�RuleLine)r�lines�stater/�line�irrrrRsP



���zRobotFileParser.parsecCs�|jrdS|jr
dStj�tj�|��}tj�dd|j|j|j	|j
f�}tj�|�}|s.d}|jD]}|�
|�r?|�|�Sq1|jrI|j�|�SdS)z=using the parsed robots.txt decide if useragent can fetch urlFTr�/)rrrrrr<�
urlunparser �params�query�fragment�quoter�
applies_to�	allowancer
)r�	useragentr�
parsed_urlr/rrr�	can_fetch�s$�

�zRobotFileParser.can_fetchcCsd�dd�|jD��S)NrcSsg|]}t|�d�qS)�
r)�.0r/rrr�
<listcomp>�sz+RobotFileParser.__str__.<locals>.<listcomp>)�joinrrrrr�__str__��zRobotFileParser.__str__N)r)
�__name__�
__module__�__qualname__�__doc__rrrrr%r0rrMrRrrrrr
s
	
	3c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r>zoA rule line is a single "Allow:" (allowance==True) or "Disallow:"
       (allowance==False) followed by a path.cCs(|dkr|sd}tj�|�|_||_dS)NrT)rrrHr rJ)rr rJrrrr�s
zRuleLine.__init__cCs|jdkp
|�|j�Sr+)r �
startswith)r�filenamerrrrI�rSzRuleLine.applies_tocCs|jrdpdd|jS)N�Allow�Disallowz: )rJr rrrrrR�szRuleLine.__str__N)rTrUrVrWrrIrRrrrrr>�s
r>c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r6z?An entry has one or more user-agents and zero or more rulelinescCsg|_g|_dS)N)r-r=rrrrr�s
zEntry.__init__cCsHg}|jD]
}|�d|dg�q|jD]}|�t|�dg�qd�|�S)NzUser-agent: rNr)r-�extendr=rrQ)r�ret�agentrArrrrR�s


z
Entry.__str__cCsF|�d�d��}|jD]}|dkrdS|��}||vr dSqdS)z2check if this entry applies to the specified agentrCrr,TF)r9r;r-)rrKr^rrrrI�s
�zEntry.applies_tocCs$|jD]}|�|�r|jSqdS)zZPreconditions:
        - our agent applies to this entry
        - filename is URL decodedT)r=rIrJ)rrYrArrrrJ�s



�zEntry.allowanceN)rTrUrVrWrrRrIrJrrrrr6�s
r6N)�
__future__rrr�future.builtinsr�future.backportsr�future.backports.urllibr�_parser	�_request�__all__�objectr
r>r6rrrr�<module>s
	

https://t.me/RX1948 - 2025