ó
`¾Tc           @   sR   d  Z  d d l Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d d l m Z d S(   s[  
    werkzeug.useragents
    ~~~~~~~~~~~~~~~~~~~

    This module provides a helper to inspect user agent strings.  This module
    is far from complete but should work for most of the currently available
    browsers.


    :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
    :license: BSD, see LICENSE for more details.
iÿÿÿÿNt   UserAgentParserc           B   s§   e  Z d  Z d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE dF f Z dG dH dI dJ dK dL dM dN dO dP dQ dR dS dT dU dV dW dX dY f Z d4 Z e j d5 ƒ Z d6 „  Z	 d7 „  Z
 RS(Z   s5   A simple user agent parser.  Used by the `UserAgent`.s
   iphone|iost   iphonet   ipads   darwin|mac|os\s*xt   macost   wint   windowst   androids   x11|lin(\b|ux)?t   linuxs   (sun|i86)ost   solariss   nintendo\s+wiit   wiit   irixs   hp-?uxt   hpuxt   aixs   sco|unix_svt   scot   bsdt   amigas   blackberry|playbookt
   blackberryt	   googlebott   googlet   msnbott   msnt   yahoos
   ask jeevest   asks   aol|america\s+online\s+browsert   aolt   operat   chromes"   firefox|firebird|phoenix|iceweaselt   firefoxt   galeont   safarit   webkitt   caminot	   konquerors   k-meleont   kmeleont   netscapes$   msie|microsoft\s+internet\s+explorert   msiet   lynxt   linkss   seamonkey|mozillat	   seamonkeys#   (?:%s)[/\sa-z(]*(\d+[.\da-z]+)?(?i)sa   (?:;\s*|\s+)(\b\w{2}\b(?:-\b\w{2}\b)?)\s*;|(?:\(|\[|;)\s*(\b\w{2}\b(?:-\b\w{2}\b)?)\s*(?:\]|\)|;)c         C   sy   g  |  j  D]' \ } } | t j | t j ƒ f ^ q
 |  _  g  |  j D]( \ } } | t j |  j | ƒ f ^ qD |  _ d  S(   N(   t	   platformst   ret   compilet   It   browserst   _browser_version_re(   t   selft   at   b(    (    sY   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/useragents.pyt   __init__A   s    :c         C   sæ   x< |  j  D]+ \ } } | j | ƒ } | d  k	 r
 Pq
 q
 Wd  } xO |  j D]: \ } } | j | ƒ } | d  k	 rI | j d ƒ } PqI qI Wd  } } |  j j | ƒ } | d  k	 rÐ | j d ƒ pÊ | j d ƒ } n d  } | | | | f S(   Ni   i   (   R&   t   searcht   NoneR*   t   groupt   _language_re(   R,   t
   user_agentt   platformt   regext   matcht   browsert   versiont   language(    (    sY   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/useragents.pyt   __call__F   s     
!(   s
   iphone|iosR   (   R   R   (   s   darwin|mac|os\s*xR   (   R   R   (   R   R   (   s   x11|lin(\b|ux)?s   linux(   s   (sun|i86)oss   solaris(   s   nintendo\s+wiiR	   (   s   irixs   irix(   s   hp-?uxR   (   s   aixs   aix(   s   sco|unix_svR   (   R   R   (   R   R   (   s   blackberry|playbookR   (   R   R   (   R   R   (   R   R   (   s
   ask jeevesR   (   s   aol|america\s+online\s+browserR   (   R   R   (   R   R   (   s"   firefox|firebird|phoenix|iceweaselR   (   R   R   (   R   R   (   R   R   (   R   R   (   R   R   (   s   k-meleonR    (   R!   R!   (   s$   msie|microsoft\s+internet\s+explorerR"   (   R#   R#   (   s   linkss   links(   s   seamonkey|mozillaR%   (   t   __name__t
   __module__t   __doc__R&   R*   R+   R'   R(   R3   R/   R;   (    (    (    sY   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/useragents.pyR       sP   				t	   UserAgentc           B   sJ   e  Z d  Z e ƒ  Z d „  Z d „  Z d „  Z d „  Z e Z	 d „  Z
 RS(   sQ  Represents a user agent.  Pass it a WSGI environment or a user agent
    string and you can inspect some of the details from the user agent
    string via the attributes.  The following attributes exist:

    .. attribute:: string

       the raw user agent string

    .. attribute:: platform

       the browser platform.  The following platforms are currently
       recognized:

       -   `aix`
       -   `amiga`
       -   `android`
       -   `bsd`
       -   `hpux`
       -   `iphone`
       -   `ipad`
       -   `irix`
       -   `linux`
       -   `macos`
       -   `sco`
       -   `solaris`
       -   `wii`
       -   `windows`

    .. attribute:: browser

        the name of the browser.  The following browsers are currently
        recognized:

        -   `aol` *
        -   `ask` *
        -   `camino`
        -   `chrome`
        -   `firefox`
        -   `galeon`
        -   `google` *
        -   `kmeleon`
        -   `konqueror`
        -   `links`
        -   `lynx`
        -   `msie`
        -   `msn`
        -   `netscape`
        -   `opera`
        -   `safari`
        -   `seamonkey`
        -   `webkit`
        -   `yahoo` *

        (Browsers maked with a star (``*``) are crawlers.)

    .. attribute:: version

        the version of the browser

    .. attribute:: language

        the language of the browser
    c         C   sX   t  | t ƒ r$ | j d d ƒ } n  | |  _ |  j | ƒ \ |  _ |  _ |  _ |  _ d  S(   Nt   HTTP_USER_AGENTt    (	   t
   isinstancet   dictt   gett   stringt   _parserR5   R8   R9   R:   (   R,   t   environ_or_string(    (    sY   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/useragents.pyR/   Ÿ   s    	c         C   s   |  j  S(   N(   RE   (   R,   (    (    sY   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/useragents.pyt	   to_header¦   s    c         C   s   |  j  S(   N(   RE   (   R,   (    (    sY   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/useragents.pyt   __str__©   s    c         C   s   t  |  j ƒ S(   N(   t   boolR8   (   R,   (    (    sY   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/useragents.pyt   __nonzero__¬   s    c         C   s   d |  j  j |  j |  j f S(   Ns
   <%s %r/%s>(   t	   __class__R<   R8   R9   (   R,   (    (    sY   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/useragents.pyt   __repr__±   s    	(   R<   R=   R>   R    RF   R/   RH   RI   RK   t   __bool__RM   (    (    (    sY   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/useragents.pyR?   \   s   ?					(   t   UserAgentMixin(   R>   R'   t   objectR    R?   t   werkzeug.wrappersRO   (    (    (    sY   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/werkzeug/useragents.pyt   <module>   s   Kb