Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_robotparser.cpython-312.pyc

�

'Μg,��v�ddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZm
Z
Gd�d�ZGd�d	eej�ZGd
�deej�ZGd�d
eej�ZGd�deej�ZGd�de�ZGd�deej�ZGd�deej�ZGd�de�ZGd�deej�ZGd�deej�ZGd�deej�ZGd�deej�ZGd �d!e�ZGd"�d#eej�ZGd$�d%eej�ZGd&�d'eej�ZGd(�d)eej�Z Gd*�d+eej�Z!Gd,�d-eej�Z"Gd.�d/e�Z#ejHejJd0�Gd1�d2ej��Z&ejN�Gd3�d4ej��Z(e)d5k(rejT�yy)6�N)�support)�
socket_helper)�threading_helper)�BaseHTTPRequestHandler�
HTTPServerc�>�eZdZdZdZgZgZdZd�Zd�Z	d�Z
d�Zd�Zy)	�
BaseRobotTest��test_robotparserNc���tj|j�j�}tj
j
�|_|jj|�y�N)	�io�StringIO�
robots_txt�	readlines�urllib�robotparser�RobotFileParser�parser�parse)�self�liness  �2/usr/local/lib/python3.12/test/test_robotparser.py�setUpzBaseRobotTest.setUpsE�����D�O�O�,�6�6�8���(�(�8�8�:��������%� �c�P�t|t�r	|\}}||fS|j|fSr
)�
isinstance�tuple�agent�r�urlrs   r�get_agent_and_urlzBaseRobotTest.get_agent_and_urls-���c�5�!��J�E�3��#�:���z�z�3��rc���|jD]]}|j|�\}}|j||��5|j|jj||��ddd��_y#1swY�jxYw�N)r!r)�goodr"�subTest�
assertTruer�	can_fetchr s   r�test_good_urlszBaseRobotTest.test_good_urlss`���9�9�C��/�/��4�J�E�3����#�U��3������� 5� 5�e�S� A�B�4�3��3�3���,A.�.A7	c���|jD]]}|j|�\}}|j||��5|j|jj||��ddd��_y#1swY�jxYwr$)�badr"r&�assertFalserr(r s   r�
test_bad_urlszBaseRobotTest.test_bad_urls$sb���8�8�C��/�/��4�J�E�3����#�U��3�� � ����!6�!6�u�c�!B�C�4�3��3�3�r*c�l�|j|jj�|j�yr
)�assertEqualr�	site_maps�rs r�test_site_mapszBaseRobotTest.test_site_maps*s#��������.�.�0�$�.�.�Ar)
�__name__�
__module__�__qualname__rrr%r,r1rr"r)r.r3�rrr	r	s7���J��E�
�D�
�C��I�!�
�C�D�Brr	c� �eZdZdZddgZgd�Zy)�UserAgentWildcardTestz�User-agent: *
Disallow: /cyberworld/map/ # This is an infinite virtual URL space
Disallow: /tmp/ # these will soon disappear
Disallow: /foo.html
    �/�
/test.html)�/cyberworld/map/index.htmlz/tmp/xxx�	/foo.htmlN�r4r5r6rr%r,r7rrr9r9.s���J�
���D�
A�Crr9c��eZdZdZgd�ZdgZy)�CrawlDelayAndCustomAgentTestz�# robots.txt for http://www.example.com/

User-agent: *
Crawl-delay: 1
Request-rate: 3/15
Disallow: /cyberworld/map/ # This is an infinite virtual URL space

# Cybermapper knows where to go.
User-agent: cybermapper
Disallow:
    )r:r;)�cybermapperr<r<Nr>r7rrr@r@9s���J�N�D�'�
(�Crr@c�&�eZdZdZddgZdgZddgZy)�SitemapTesta# robots.txt for http://www.example.com/

User-agent: *
Sitemap: http://www.gstatic.com/s2/sitemaps/profiles-sitemap.xml
Sitemap: http://www.google.com/hostednews/sitemap_index.xml
Request-rate: 3/15
Disallow: /cyberworld/map/ # This is an infinite virtual URL space

    r:r;r<z7http://www.gstatic.com/s2/sitemaps/profiles-sitemap.xmlz2http://www.google.com/hostednews/sitemap_index.xmlN)r4r5r6rr%r,r1r7rrrCrCJs+��	�J�
���D�'�
(�C�J�E�G�IrrCc��eZdZdZgZgd�Zy)�RejectAllRobotsTestz(# go away
User-agent: *
Disallow: /
    )r<r:�/tmp/Nr>r7rrrErE[s���J�
�D�
6�CrrEc��eZdZdZdZd�Zy)�BaseRequestRateTestNc��|j}|j|jzD�]!}|j|�\}}|j	||��5|j|j
|�|j�|j|�}|j||j�|j��|j|tjj�|j|j|jj�|j|j|jj�ddd���$y#1swY��0xYwr$)rr%r,r"r&r0�crawl_delay�request_rate�assertIsInstancerr�RequestRate�requests�seconds)rrr!r�parsed_request_rates     r�test_request_ratez%BaseRequestRateTest.test_request_rateis�������9�9�t�x�x�'�C��/�/��4�J�E�3����#�U��3�� � ��!3�!3�E�!:�D�<L�<L�M�&,�&9�&9�%�&@�#�� � �!4�d�6G�6G�H��$�$�0��)�)�+��*�*�6�6���$�$�+�4�4��)�)�2�2���$�$�+�3�3��)�)�1�1��4�3�(�3�3�s
�C/E�E	)r4r5r6rKrJrQr7rrrHrHes���L��K�rrHc��eZdZdZdgZy)�
EmptyFileTestr
z/fooN)r4r5r6rr%r7rrrSrS�s���J��8�DrrSc�^�eZdZdZdZejjdd�ZdZ	dgZ
gd�Zy)	�CrawlDelayAndRequestRateTestz�User-agent: figtree
Crawl-delay: 3
Request-rate: 9/30
Disallow: /tmp
Disallow: /a%3cd.html
Disallow: /a%2fb.html
Disallow: /%7ejoe/index.html
    �figtree�	��)rVr=)�/tmpz	/tmp.html�/tmp/a.html�/a%3cd.html�/a%3Cd.htmlz/a%2fb.htmlz/~joe/index.htmlN)r4r5r6rrrrrMrKrJr%r,r7rrrUrU�s<���J�
�E��%�%�1�1�!�R�8�L��K�$�%�D�.�CrrUc��eZdZdZy)�DifferentAgentTestzFigTree Robot libwww-perl/5.04N�r4r5r6rr7rrr_r_�s��,�Err_c�"�eZdZdZdgZgd�ZdZy)�InvalidRequestRateTestz�User-agent: *
Disallow: /tmp/
Disallow: /a%3Cd.html
Disallow: /a/b.html
Disallow: /%7ejoe/index.html
Crawl-delay: 3
Request-rate: 9/banana
    rZ)rFr[r\r]z	/a/b.htmlz/%7Ejoe/index.htmlrYN)r4r5r6rr%r,rJr7rrrbrb�s���J�
�8�D�!�C��Krrbc��eZdZdZdgZgZy)�InvalidCrawlDelayTestz2User-Agent: *
Disallow: /.
Crawl-delay: pears
    r=Nr>r7rrrdrd�s���J�

�=�D�
�Crrdc� �eZdZdZdZdgZdgZy)�AnotherInvalidRequestRateTestzeUser-agent: Googlebot
Allow: /folder1/myfile.html
Disallow: /folder1/
Request-rate: whale/banana
    �	Googlebot�/folder1/myfile.html�/folder1/anotherfile.htmlN�r4r5r6rrr%r,r7rrrfrf�s ���J�
�E�"�#�D�&�
'�Crrfc��eZdZdZdZdgZy)�UserAgentOrderingTestzMUser-agent: Googlebot
Disallow: /

User-agent: Googlebot-Mobile
Allow: /
    rgz/something.jpgN)r4r5r6rrr,r7rrrlrl�s���J�
�E��
�Crrlc��eZdZdZy)�UserAgentGoogleMobileTestzGooglebot-MobileNr`r7rrrnrn�s���Errnc� �eZdZdZdZdgZdgZy)�GoogleURLOrderingTestzJUser-agent: Googlebot
Allow: /folder1/myfile.html
Disallow: /folder1/
    �	googlebotrhriNrjr7rrrprp�s ���J�

�E�"�#�D�&�
'�Crrpc��eZdZdZdgZdgZy)�DisallowQueryStringTestz2User-agent: *
Disallow: /some/path?name=value
    �
/some/pathz/some/path?name=valueNr>r7rrrsrs�s���J�
�>�D�"�
#�Crrsc��eZdZdZdgZdgZy)�UseFirstUserAgentWildcardTestzNUser-agent: *
Disallow: /some/path

User-agent: *
Disallow: /another/path
    z
/another/pathrtNr>r7rrrvrv�s���J�
��D��.�Crrvc��eZdZdZdgZdgZy)�EmptyQueryStringTestz>User-agent: *
Allow: /some/path?
Disallow: /another/path?
    z/some/path?z/another/path?Nr>r7rrrxrx�s���J�

�?�D��
�Crrxc�Z�eZdZdZej
j
dd�ZdZddgZ	dgZ
y)	�DefaultEntryTestzOUser-agent: *
Crawl-delay: 1
Request-rate: 3/15
Disallow: /cyberworld/map/
    rY��r:r;r<N)r4r5r6rrrrMrKrJr%r,r7rrrzrzs:���J��%�%�1�1�!�R�8�L��K����D�'�
(�Crrzc��eZdZdZdZd�Zy)�StringFormattingTestz�User-agent: *
Crawl-delay: 1
Request-rate: 3/15
Disallow: /cyberworld/map/ # This is an infinite virtual URL space

# Cybermapper knows where to go.
User-agent: cybermapper
Disallow: /some/path
    zxUser-agent: cybermapper
Disallow: /some/path

User-agent: *
Crawl-delay: 1
Request-rate: 3/15
Disallow: /cyberworld/map/c�b�|jt|j�|j�yr
)r0�strr�expected_outputr2s r�test_string_formattingz+StringFormattingTest.test_string_formatting*s!������T�[�[�)�4�+?�+?�@rN)r4r5r6rr�r�r7rrr~r~s��	�J��O�Arr~c��eZdZd�Zd�Zy)�RobotHandlerc�(�|jdd�y)Ni�zForbidden access)�
send_errorr2s r�do_GETzRobotHandler.do_GET0s������/�0rc��yr
r7)r�format�argss   r�log_messagezRobotHandler.log_message3s��rN)r4r5r6r�r�r7rrr�r�.s��1�
rr�z&Socket server requires working socket.c�<�eZdZd�Zd�Zejd��Zy)�PasswordProtectedSiteTestCasec�\�|jtjj�t	t
jdft�|_tjd|jjddi��|_d|j_
|jj�y)NrzHTTPServer serving�
poll_intervalg{�G�z�?)�name�target�kwargsT)�
addCleanupr�request�
urlcleanuprr�HOSTr��server�	threading�Thread�
serve_forever�t�daemon�startr2s rrz#PasswordProtectedSiteTestCase.setUp=sw��������1�1�2� �-�"4�"4�a�!8�,�G����!�!�%��;�;�,�,�$�D�)�
+�������
������rc��|jj�|jj�|jj	�yr
)r��shutdownr��join�server_closer2s r�tearDownz&PasswordProtectedSiteTestCase.tearDownMs/�������������
���� � �"rc�D�|jj}dtjzdzt	|d�z}|dz}t
jj�}|j|�|j�|j|jd|��y)Nzhttp://�:r|z/robots.txt�*)r��server_addressrr�r�rrr�set_url�readr-r()r�addrr!�
robots_urlrs     r�testPasswordProtectedSitez7PasswordProtectedSiteTestCase.testPasswordProtectedSiteRs����{�{�)�)���-�,�,�,�s�2�S��a��\�A���=�(�
��#�#�3�3�5�����s�����
�����)�)�#�z�:�;rN)r4r5r6rr�r�reap_threadsr�r7rrr�r�7s&��� #�
�"�"�<�#�<rr�c�Z�eZdZdZdj	e�Zed��Zd�Zd�Z	d�Z
d�Zy)	�NetworkTestCasezhttp://www.pythontest.net/z{}elsewhere/robots.txtc�&�tjd�tj|j�5t
jj|j�|_	|jj�ddd�y#1swYyxYw)N�network)r�requiresr�transient_internet�base_urlrrrrrr�)�clss r�
setUpClasszNetworkTestCase.setUpClasscsX������#�
�
-�
-�c�l�l�
;��+�+�;�;�C�N�N�K�C�J��J�J�O�O��<�
;�
;�s�A	B�Bc��dj|j|tjj	|�dsd�Sd�S)Nz{}{}{}r|r:r
)r�r��os�path�splitext)rr�s  rr!zNetworkTestCase.urljsA������M�M�4�B�G�G�,<�,<�T�,B�1�,E��
�	
�KM�
�	
rc��|j|jj�|j|jj�|j	|jj�d�|j|jj
d��|j|jjd��y)Nrr�)r-r�disallow_all�	allow_all�
assertGreater�mtimerJrKr2s r�
test_basiczNetworkTestCase.test_basicos���������1�1�2�������.�.�/����4�;�;�,�,�.��2�������0�0��5�6�������1�1�#�6�7rc��|j|jjd|jd���|j	|jjd|j
��|j	|jjd|jd���|j	|jjd|jd���|j	|jjd|jd���|j|jjd|j
��y)Nr��	elsewhere�Nutch�brian�webstats)r'rr(r!r-r�r2s r�test_can_fetchzNetworkTestCase.test_can_fetchvs���������-�-�c�4�8�8�K�3H�I�J�������.�.�w��
�
�F�G�������.�.�w�����8I�J�K�������.�.�w�����8L�M�N�������.�.�s�D�H�H�Z�4H�I�J�������-�-�c�4�=�=�A�Brc��tjj|jd��}|j	�|j|j�|j|j�|j|j�d�|j|jd��|j|jd��y)Nzi-robot.txtrr�)rrrr!r�r'r�r-r�r0r��assertIsNonerJrK)rrs  r�
test_read_404zNetworkTestCase.test_read_404~s����#�#�3�3�D�H�H�]�4K�L�����
�����(�(�)�����,�,�-���������+����&�,�,�S�1�2����&�-�-�c�2�3rN)r4r5r6r�r�r�classmethodr�r!r�r�r�r7rrr�r�]s@��,�H�)�0�0��:�J�����
�
8�C�4rr��__main__)+rr�r��unittest�urllib.robotparserr�testr�test.supportrr�http.serverrrr	�TestCaser9r@rCrErHrSrUr_rbrdrfrlrnrprsrvrxrzr~r��
skipUnless�has_socket_supportr��requires_working_socketr�r4�mainr7rr�<module>r�s+��	�	�����&�)�:�B�B�DB�M�8�+<�+<�B�)�=�(�2C�2C�)�"G�-��!2�!2�G�"7�-��):�):�7��-��8�'��):�):��
.�#6��8I�8I�.�$-�5�-�
�]�H�,=�,=�
� 	
�M�8�+<�+<�	
�
(�M�8�3D�3D�
(��M�8�+<�+<��� 5��
(�M�8�+<�+<�
(�$�m�X�->�->�$�
�M�8�3D�3D�
��=�(�*;�*;��
)�*�H�,=�,=�
)�A�=�(�*;�*;�A�4
�)�
��������,��<�H�$5�$5�<�	�<�D!�� � �"�'4�h�'�'�'4�#�'4�R�Z���H�M�M�O�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists