
    \j                        d dl Z d dlmZ d dlmZmZ d dlmZmZm	Z	m
Z
mZmZ g dZ edd       G d d	             Z edd       G d
 d             Z edd       G d d             Z G d de      Z edd       G d d             Z edd       G d d             Z edd       G d d             Z G d de
      Z ed      Z G d de j.                  ee         Zeeee      eee      eee      f   Zy)    N)	dataclass)Flagauto)GenericListOptionalProtocolTupleTypeVar)	OSDefaultedResultDeviceDomainMatchersPartialResultResolverResult	UserAgentT)frozenslotsc                   p    e Zd ZU dZdZeed<   dZee   ed<   dZ	ee   ed<   dZ
ee   ed<   dZee   ed<   y)	r   z{Browser ("user agent" aka the software responsible for the request)
    information parsed from the user agent string.
    OtherfamilyNmajorminorpatchpatch_minor__name__
__module____qualname____doc__r   str__annotations__r   r   r   r   r        8/root/env/lib/python3.12/site-packages/ua_parser/core.pyr   r      sK     FCE8C=E8C=E8C=!%K#%r&   r   c                   p    e Zd ZU dZdZeed<   dZee   ed<   dZ	ee   ed<   dZ
ee   ed<   dZee   ed<   y)	r   z1OS information parsed from the user agent string.r   r   Nr   r   r   r   r   r%   r&   r'   r   r       sG    ;FCE8C=E8C=E8C=!%K#%r&   r   c                   H    e Zd ZU dZdZeed<   dZee   ed<   dZ	ee   ed<   y)r   z5Device information parsed from the user agent string.r   r   Nbrandmodel)
r   r    r!   r"   r   r#   r$   r*   r   r+   r%   r&   r'   r   r   +   s+    ?FCE8C=E8C=r&   r   c                   J    e Zd ZdZ e       Z e       Z e       Zeez  ez  Zy)r   zaHint for selecting which domains are requested when asking for a
    :class:`PartialResult`.
    N)	r   r    r!   r"   r   
USER_AGENTr   DEVICEALLr%   r&   r'   r   r   4   s,    
 J	BVF
r/F
"Cr&   r   c                   :    e Zd ZU dZeed<   eed<   eed<   eed<   y)r   zVariant of :class:`Result` where attributes are set
    to a default value if their resolution failed.

    For all domains, the default value has ``family`` set to
    ``"Other"`` and every other attribute set to ``None``.
    
user_agentosdevicestringN)	r   r    r!   r"   r   r$   r   r   r#   r%   r&   r'   r   r   C   s     
FNKr&   r   c                   X    e Zd ZU dZee   ed<   ee   ed<   ee   ed<   e	ed<   de
fdZy)	r   zComplete result.

    For each attribute (and domain), either the resolution was a
    success (a match was found) and the corresponding data is set, or
    it was a failure and the value is `None`.

    r1   r2   r3   r4   returnc                     t        | j                  xs
 t               | j                  xs
 t	               | j
                  xs
 t               | j                        S )zReplaces every failed domain by its default value.

        Roughly matches pre-1.0 semantics, and can allow for more
        uniform handling by the client if they don't want or need the
        lookup failure information.

        r1   r2   r3   r4   )r   r1   r   r2   r   r3   r   r4   selfs    r'   with_defaultszResult.with_defaultsa   sA     5)+ww"$;;*&(;;	
 	
r&   N)r   r    r!   r"   r   r   r$   r   r   r#   r   r;   r%   r&   r'   r   r   R   s:     ##VK
 
r&   r   c                   b    e Zd ZU dZeed<   ee   ed<   ee   ed<   ee	   ed<   e
ed<   defdZy	)
r   aI  Potentially partial (incomplete) result.

    Domain fields (``user_agent``, ``os``, and ``device``) can be:

    - unset if not parsed yet
    - set to a parsing failure
    - set to a parsing success

    The ``domains`` flags specify which is which: if a :class:`Domain`
    flag is set, the corresponding attribute was looked up and is
    either ``None`` for a resolution failure (no match was found) or a
    value for a parsing success.

    If the flag is unset, the field has not been looked up yet, in
    which case it can be anything (but should usually be ``None``).

    domainsr1   r2   r3   r4   r6   c                     | j                   t        j                  k7  rt        d      t	        | j
                  | j                  | j                  | j                        S )zRequires that the result be fully resolved (every attribute is set,
        even if to a lookup failure).

        :raises ValueError: if the result is not fully resolved
        z6Only a result with all attributes set can be completedr8   )	r=   r   r/   
ValueErrorr   r1   r2   r3   r4   r9   s    r'   completezPartialResult.complete   sI     <<6::%UVVww;;;;	
 	
r&   N)r   r    r!   r"   r   r$   r   r   r   r   r#   r   r@   r%   r&   r'   r   r   r   s?    $ O##VK
& 
r&   r   c                   B    e Zd ZdZej
                  dededefd       Z	y)r   aU  Resolver()

    The resolver is the thin central abstraction of ua-parser, and
    used to compose various objects into the resolution stack which
    best fits the system's needs.

    A resolver is any callable which takes a string ``ua`` and a
    :class:`Domain`, and returns a :class:`PartialResult` with at
    least the requested domains marked as resolved (whether
    successfully or not).

    A resolver may resolve more domains than requested, but it needs
    to resolve at least the requested domains.

    See :class:`PartialResult` for more information about its
    working.

    uadomainr6   c                     y)zResolves the ``ua``.Nr%   )r:   rB   rC   s      r'   __call__zResolver.__call__        	r&   N)
r   r    r!   r"   abcabstractmethodr#   r   r   rE   r%   r&   r'   r   r      s6    & 	3  m  r&   r   Tc                       e Zd ZdZej
                  dedee   fd       Z	e
ej
                  defd              Ze
defd       Zy)MatcherzA matcher is an individual pattern-rule, able to match a user
    agent string and in case of success extract the relevant data.

    Matchers need to expose their pattern for bulk resolvers.

    rB   r6   c                      y)z Applies the matcher to an input.Nr%   )r:   rB   s     r'   rE   zMatcher.__call__   rF   r&   c                      y)zReturns the matcher's pattern.Nr%   r9   s    r'   regexzMatcher.regex   s     	r&   c                      y)zReturns the matcher's pattern flags (only
        :data:`re.IGNORECASE` is supported, and only for
        :class:`Matcher` [:class:`Device`])

        r   r%   r9   s    r'   flagszMatcher.flags   s     r&   N)r   r    r!   r"   rG   rH   r#   r   rI   rE   propertyrN   intrP   r%   r&   r'   rK   rK      sw     	3 8A;   s    s  r&   rK   )rG   dataclassesr   enumr   r   typingr   r   r   r	   r
   r   __all__r   r   r   r   r   r   r   r   rI   ABCrK   r   r%   r&   r'   <module>rX      sK   
 !  D D
 $d#	& 	& $	& $d#& & $& $d#    $ #T # $d#  $ $d#
 
 $
> $d#'
 '
 $'
Tx 4 CLcggwqz : 	r&   