
    _fd9                     ,   d dl Z d dlZd dlZd dlmZ ddlmZ ddlmZ dZ	dZ
dZd	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ  ee	          Z! ee
          Z" ee          Z# ee          Z$ ee          Z% ee          Z& ee          Z' ee          Z( ee          Z) ee          Z* ee          Z+ ee          Z, ee          Z- ee          Z. ee          Z/ ee          Z0 ee          Z1 ee          Z2 ee          Z3 ee          Z4 ee          Z5 ee          Z6 ee          Z7 ee           Z8 G d dej9                  Z: e;ej<        =                    ej<        >                    e?          d                     5 Z@ e jA        e@          ZBddd           n# 1 swxY w Y   d! ZC ejD        eB          D ]2\  ZEZF eeFd"                   eFd#<    eGe:d$eEz    eCeF                     3dS )%    N)user_agent_parser   )compat)parsezMozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B179 Safari/7534.48.3zMozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10zMozilla/5.0 (Linux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1zMozilla/5.0 (Linux; U; Android 4.0.4; en-gb; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30zMozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=truezzMozilla/5.0 (PlayBook; U; RIM Tablet OS 2.0.1; en-US) AppleWebKit/535.8+ (KHTML, like Gecko) Version/7.2.0.1 Safari/535.8+zMozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166  Safari/535.19zfMozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; SAMSUNG; SGH-i917)zMozilla/5.0 (BlackBerry; U; BlackBerry 9800; zh-TW) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.448 Mobile Safari/534.8+zdBlackBerry9700/5.0.0.862 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/331 UNTRUSTED/1.0 3gpp-gbazMozilla/5.0 (BlackBerry; U; BlackBerry 9930; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.241 Mobile Safari/534.11+zEMozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0)zWOpera/9.80 (J2ME/MIDP; Opera Mini/9.80 (J2ME/22.478; U; en) Presto/2.5.25 Version/10.54z@Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)zGMozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Touch)ztMozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2z?Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)zLMozilla/5.0 (X11; Ubuntu; Linux i686; rv:15.0) Gecko/20100101 Firefox/15.0.1zHMozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)zMozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/12.0.024; Profile/MIDP-2.1 Configuration/CLDC-1.1; en-us) AppleWebKit/525 (KHTML, like Gecko) BrowserNG/7.1.12344z>Mozilla/5.0 (Android; Mobile; rv:27.0) Gecko/27.0 Firefox/27.0zZMozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 Lightning/4.0.2z\Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/6.0; Microsoft Outlook 15.0.4420)zmMozilla/5.0 (X11; CrOS i686 0.12.433) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.77 Safari/534.30c                   D    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )UserAgentsTestc                    t          j        t          d         d                   }t          d         d         }|                     |j        j        |d         d                    |                     |j        j        t          |d         d                   t          |d         d                   f           |                     |j        j        |d         d                    |                     |j        j        t          |d         d                   t          |d         d                   f           |                     |j	        j        |d         d                    d S )	Niphone	ua_string
user_agentfamilymajorminorosdevice)
r   ParsedevicesassertEqualbrowserr   versionintr   r   )selfua_dict	iphone_uas      C/var/www/html/env/lib/python3.11/site-packages/user_agents/tests.py"test_user_agent_object_assignmentsz1UserAgentsTest.test_user_agent_object_assignments?   sS   #)'(*;K*HIIH%l3	 	*1 .x8	: 	: 	:%&w/00&w/002	
 	
 	
 	,gdmH.EFFFL w'((#gdmG.D*E*EF	
 	
 	
 	)0 *84	6 	6 	6 	6 	6    c                    |                      t          j                   |                      t          j                   |                      t          j                   |                      t
          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                     t           j                   |                     t"          j                   |                     t$          j                   |                     t&          j                   |                     t(          j                   |                      t*          j                   d S N)assertFalser   	is_tabletgalaxy_s3_uablackberry_torch_uablackberry_bold_uawindows_phone_uaie_uaie_touch_uamac_safari_uawindows_ie_uaubuntu_firefox_uaj2me_opera_uagoogle_bot_uanokia_n97_ua
assertTruewindows_rt_uaipad_uaplaybook_uakindle_fire_ua
nexus_7_uaandroid_firefox_aurora_uar   s    r   test_is_tablet_propertyz&UserAgentsTest.test_is_tablet_propertyW   s   ,---/000,6777+5666)3444))).///01110111*455501110111/000/000)***-...0111
,---2<=====r   c                    |                      t          j                   |                      t          j                   |                      t          j                   |                      t
          j                   |                      t          j                   |                      t          j                   |                      t          j                   | 	                    t          j                   | 	                    t          j                   | 	                    t          j                   | 	                    t          j                   | 	                    t          j                   | 	                    t          j                   | 	                    t           j                   | 	                    t"          j                   | 	                    t$          j                   | 	                    t&          j                   | 	                    t(          j                   |                      t*          j                   d S r   )r.   r   	is_mobiler"   r#   r$   r%   r+   r-   r    r/   r0   r1   r2   r3   r&   r'   r(   r)   r*   r,   r4   r5   s    r   test_is_mobile_propertyz&UserAgentsTest.test_is_mobile_propertyl   s   	+,,,.///+5666*4555(2333/000.///0111*+++.///1222-...))).///01110111*455501111;<<<<<r   c                    |                      t          j                   |                      t          j                   |                      t          j                   |                      t
          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                     t          j                   |                     t          j                   |                     t           j                   |                     t"          j                   |                     t$          j                   |                     t&          j                   |                     t(          j                   |                     t*          j                   |                      t,          j                   d S r   )r.   r   is_touch_capabler"   r0   r1   r2   r3   r%   r'   blackberry_bold_touch_uar8   r#   r    r+   r&   r$   r(   r)   r*   r,   r-   r4   r5   s    r   test_is_touch_propertyz%UserAgentsTest.test_is_touch_property   s   	23335666011145557888
3444(9:::45550:;;;+56667888/000+<===78887888*;<<<788867771BCCCCCr   c                    |                      t          j                   |                      t          j                   |                      t          j                   |                      t
          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                      t          j                   |                     t           j                   |                     t"          j                   |                     t$          j                   |                     t&          j                   |                     t(          j                   |                      t*          j                   |                     t,          j                   d S r   )r    r   is_pcr"   r0   r1   r2   r3   r%   r<   r#   r$   r+   r,   r-   r.   r(   r)   r*   r'   r&   r4   chromebook_uar5   s    r   
test_is_pczUserAgentsTest.test_is_pc   s   )))+,,,'''*+++-...)***)/00017888,2333+1222,---,---+,,,+,,,+,,,)/000)***$$$28999+,,,,,r   c                    |                      t          j                   |                     t          j                   |                     t
          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t           j                   |                     t"          j                   |                     t$          j                   |                     t&          j                   |                     t(          j                   |                     t*          j                   d S r   )r.   r,   is_botr    r   r"   r0   r1   r2   r3   r%   r<   r#   r$   r+   r(   r)   r*   r'   r&   r-   r4   r5   s    r   test_is_botzUserAgentsTest.test_is_bot   s   ,---)***,---(((+,,,.///*+++)011118999,3444+2333-...-...-...*1222+,,,&&&,---29:::::r   c                 $   |                      t          j                   |                      t          j                   |                     t
          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t          j                   |                     t           j                   |                     t"          j                   |                     t$          j                   |                     t&          j                   d S r   )r.   thunderbird_uais_email_client
outlook_uar    r1   r2   r3   r%   r<   r#   r$   r+   r(   r)   r*   r'   r&   r-   r4   r5   s    r   test_is_email_clientz#UserAgentsTest.test_is_email_client   s   6777
2333455578883444)9:::1ABBB,<===+;<<<677767776777*:;;;4555.///56662BCCCCCr   c                    |                      t          t                    d           |                      t          t                    d           |                      t          t                    d           |                      t          t
                    d           |                      t          t                    d           |                      t          t                    d           |                      t          t                    d           |                      t          t                    d           |                      t          t                    d	           |                      t          t                    d
           |                      t          t                    d           |                      t          t                    d           |                      t          t                    d           |                      t          t                    d           |                      t          t                     d           |                      t          t"                    d           |                      t          t$                    d           |                      t          t&                    d           |                      t          t(                    d           |                      t          t*                    d           |                      t          t,                    d           d S )N$iPhone / iOS 5.1 / Mobile Safari 5.1z$iPad / iOS 3.2 / Mobile Safari 4.0.4z,Samsung SCH-I800 / Android 2.2 / Android 2.2z0Samsung GT-I9300 / Android 4.0.4 / Android 4.0.4z'Kindle / Android / Amazon Silk 1.1.0-80zJBlackBerry Playbook / BlackBerry Tablet OS 2.0.1 / BlackBerry WebKit 2.0.1z/Asus Nexus 7 / Android 4.1.1 / Chrome 18.0.1025z4Samsung SGH-i917 / Windows Phone 7.5 / IE Mobile 9.0zPC / Windows RT / IE 10.0z?BlackBerry 9800 / BlackBerry OS 6.0.0 / BlackBerry WebKit 6.0.0z7BlackBerry 9700 / BlackBerry OS 5.0.0 / BlackBerry 9700z?BlackBerry 9930 / BlackBerry OS 7.0.0 / BlackBerry WebKit 7.0.0z/Generic Feature Phone / Other / Opera Mini 9.80zPC / Windows 8 / IE 10.0z,PC / Mac OS X 10.6.8 / WebKit Nightly 537.13zPC / Windows 7 / IE 9.0zPC / Ubuntu / Firefox 15.0.1zSpider / Other / Googlebot 2.1z4Nokia N97 / Symbian OS 9.4 / Nokia Browser 7.1.12344z2Generic Smartphone / Android / Firefox Mobile 27.0)r   strr   r0   
galaxy_tabr"   r2   r1   r3   r%   r/   r#   r$   r<   r+   r&   r'   r(   r)   r*   r,   r-   r4   r5   s    r   test_stringszUserAgentsTest.test_strings   s   Y)OPPPW'MNNNZ*XYYY\**,^___^,,.WXXX[))+wxxxZ*[\\\-..0fggg]++-HIII0113tuuu/002klll5668yzzz]++-^___U%?@@@[))+EFFF]++-[\\\]++-FGGG.//1OPPP]++-MNNN\**,bccc6779mnnnnnr   c                 R   	 t          t          d         d                   }|                     |d           |                     t	          |t                                d S # t
          $ r: t          t          d         d                   }|                     |d           Y d S w xY w)Nr
   r   rK   )unicoder   r   r.   
isinstance	NameErrorrL   )r   unicode_ua_strs     r   test_unicode_stringsz#UserAgentsTest.test_unicode_strings   s    
	E$WX%6|%DEEN^DF F FOOJ~w??@@@@@ 	E 	E 	E !2<!@AAN^CE E E E E E	Es   AA" "A B&%B&N)__name__
__module____qualname__r   r6   r9   r=   rA   rD   rI   rN   rT    r   r   r   r   =   s        6 6 60> > >*= = =*D D D*- - -,; ; ;*D D D(o o o.E E E E Er   r   zdevices.jsonc                       fd}|S )Nc                 z    d}|D ]4}|                      t          d         |          |         |           5d S )N)rC   r8   r?   r!   r;   r   )msg)r   getattr)r   attrsattritemss      r   	test_funcztest_wrapper.<locals>.test_func   sg    ; 	K 	KDl+T22E$KT  K K K K	K 	Kr   rX   )r_   r`   s   ` r   test_wrapperra      s)    K K K K K r   r   r   test_)Hjsonr   unittest	ua_parserr    r   parsersr   iphone_ua_stringipad_ua_stringgalaxy_tab_ua_stringgalaxy_s3_ua_stringkindle_fire_ua_stringplaybook_ua_stringnexus_7_ua_stringwindows_phone_ua_stringblackberry_torch_ua_stringblackberry_bold_ua_stringblackberry_bold_touch_ua_stringwindows_rt_ua_stringj2me_opera_ua_stringie_ua_stringie_touch_ua_stringmac_safari_ua_stringwindows_ie_ua_stringubuntu_firefox_ua_stringgoogle_bot_ua_stringnokia_n97_ua_string android_firefox_aurora_ua_stringthunderbird_ua_stringoutlook_usa_stringchromebook_ua_stringr   r0   rM   r"   r2   r1   r3   r%   r/   r#   r$   r<   r+   r&   r'   r(   r)   r*   r,   r-   r4   rF   rH   r@   TestCaser   openpathjoindirname__file__floadr   ra   	iteritemsr   r_   setattrrX   r   r   <module>r      s    				  ' ' ' ' ' '             \  f `  d  y  R  Z  C  a  C  #h ^ p Q^  N X i a  ~ #c  t s  G E"##	
%

U'((
u()),--e&''U$%%
5011 *++e677 U455  5!@AA *++le&''*++*++E233 *++u())!E"BCC ,--U%&&
*++zE zE zE zE zEX& zE zE zEz 
T"',,rwx00.
A
ABB adillG              
 
 
 &V%g.. C CMFE%k 233E,GNGf,ll5.A.ABBBBC Cs   &GG
G