
    'jd                       U d Z ddlmZ g dZddlZddlZddlmZm	Z	m
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mZmZmZ dd
lmZmZ ddlmZ eegef         Z dZ!de"d<   ej#        $                    d          rddl%mZ! dZ&de"d<   ej#        $                    d          rddl'mZ&  e( e)de&e!ef                    Z*de"d<   dZ+ G d d          Z,de"d<   	  ej-                    Z.d$dZ/d%dZ0d&dZ1d'd!Z2d(d#Z3dS ))a  The package provides top-level helpers which use a lazily initialised
default parser. These are convenience functions, for more control it
is perfectly acceptable to instantiate and call parsers directly.

The default parser does use a cache keyed on the user-agent string,
but its exact behaviour is unspecified, if you require a consistent
behaviour or specific algorithm, set up your own parser (global or
not).

For convenience, direct aliases are also provided for:

- :mod:`core types <.types>`
- :mod:`caching utilities <.caching>`
- :mod:`ua_parser.basic.Parser` as :class:`BasicParser`

This way importing anything but the top-level package should not be
necessary unless you want to *implement* a parser.
    )annotations)OSBasicResolverCacheCachingResolverDefaultedResultDeviceDomainMatchersPartialResultResolverResult	UserAgentload_builtinsload_lazy_builtinsparseparse_deviceparse_osparse_user_agentN)CallableOptionalcast   )r   )r   S3Fifo)	r   r	   r
   r   r   r   r   r   r   )r   r   )IS_GRAALzOptional[_ResolverCtor]Re2Resolverre2RegexResolverua_parser_rs_ResolverCtorBestAvailableResolver)r   r      c                  Z    e Zd ZdZedd            Zdd	ZddZddZddZ	ddZ
d dZdS )!Parserz^Wrapper object, provides convenience methods around an
    underlying :class:`Resolver`.

    mr   returnc               h     | t          t          |          t          d                              S )zfrom_matchers(Matchers) -> Parser

        Instantiates a parser from the provided
        :class:`~ua_parser.core.Matchers` using the default resolver
        stack.

        i  )r   r!   r   )clsr%   s     V/home/ice/.hermes/hermes-agent/venv/lib/python3.11/site-packages/ua_parser/__init__.pyfrom_matcherszParser.from_matchersT   s-     s?#8#;#;U4[[IIJJJ    resolverr   Nonec                    || _         d S )Nr,   )selfr,   s     r)   __init__zParser.__init___   s     r+   uastrdomainsr
   r   c               .    |                      ||          S )zParses the ``ua`` string, returning a parse result with *at least*
        the requested :class:`domains <Domain>` resolved (whether to success or
        failure).
        r/   )r0   r2   r4   s      r)   __call__zParser.__call__b   s    
 }}R)))r+   r0   r   c                R     | |t           j                                                  S )z+Convenience method for parsing all domains.)r
   ALLcompleter0   r2   s     r)   r   zParser.parsei   s"    tB
##,,...r+   Optional[UserAgent]c                8     | |t           j                  j        S )z=Convenience method for parsing the :class:`UserAgent` domain.)r
   
USER_AGENT
user_agentr:   s     r)   r   zParser.parse_user_agentm   s    tB)**55r+   Optional[OS]c                8     | |t           j                  j        S )z6Convenience method for parsing the :class:`OS` domain.)r
   r   osr:   s     r)   r   zParser.parse_osq   s    tB	""%%r+   Optional[Device]c                8     | |t           j                  j        S )z:Convenience method for parsing the :class:`Device` domain.)r
   DEVICEdevicer:   s     r)   r   zParser.parse_deviceu   s    tB&&--r+   N)r%   r   r&   r$   )r,   r   r&   r-   )r2   r3   r4   r
   r&   r   )r0   r   r2   r3   r&   r   )r0   r   r2   r3   r&   r;   )r0   r   r2   r3   r&   r?   )r0   r   r2   r3   r&   rB   )__name__
__module____qualname____doc__classmethodr*   r1   r6   r   r   r   r    r+   r)   r$   r$   N   s         
 K K K [K! ! ! !* * * */ / / /6 6 6 6& & & &. . . . . .r+   r$   parsernamer3   r&   c                   t           5  | dk    rt                                          d          x}r!t          t          |          cd d d            S t
          st          st          rt                      }nt                      }t          
                    |          at          cd d d            S 	 d d d            n# 1 swxY w Y   t          dt          d|           )NrL   zmodule z has no attribute )_lazy_globals_lockglobalsgetr   r$   r   r   r   r   r   r*   rL   AttributeErrorrF   )rM   pmatcherss      r)   __getattr__rU      sJ   	  8
 IIMM(+++q 'FA         + +x +-//(??))(33F                       I8IIII
J
JJs   >B?AB??CCr2   r   c                ^    ddl m}  || t          j                                                  S )a  Parses the :class:`.UserAgent`, :class:`.OS`, and :class:`.Device`
    information using the :data:`global parser <parser>`.

    Equivalent to calling each of :func:`parse_user_agent`,
    :func:`parse_os`, and :func:`parse_device` but *may* be more
    efficient than calling them separately depending on the underlying
    parser.

    Even in the best case, prefer the domain-specific helpers if
    you're not going to use *all* of them.
    r   rL   ) rL   r
   r8   r9   r2   rL   s     r)   r   r      s6     6"fj!!**,,,r+   r;   c                D    ddl m}  || t          j                  j        S )zgParses the :class:`browser <.UserAgent>` information using the
    :data:`global parser <parser>`.
    r   rW   )rX   rL   r
   r=   r>   rY   s     r)   r   r      s.     6"f'((33r+   r?   c                D    ddl m}  || t          j                  j        S )zVParses the :class:`.OS` information using the :data:`global parser
    <parser>`.
    r   rW   )rX   rL   r
   r   rA   rY   s     r)   r   r      s-     6"fi  ##r+   rB   c                D    ddl m}  || t          j                  j        S )zZParses the :class:`.Device` information using the :data:`global
    parser <parser>`.
    r   rW   )rX   rL   r
   rD   rE   rY   s     r)   r   r      s-     6"fm$$++r+   )rM   r3   r&   r$   )r2   r3   r&   r   )r2   r3   r&   r;   )r2   r3   r&   r?   )r2   r3   r&   rB   )4rI   
__future__r   __all__importlib.util	importlib	threadingtypingr   r   r   basicr   r   cachingr   r   r   corer   r	   r
   r   r   r   r   r   loadersr   r   utilsr   r    r   __annotations__util	find_specr   r   regexnextfilterr!   VERSIONr$   LockrO   rU   r   r   r   r   rK   r+   r)   <module>rp      s    & # " " " " "  *         + + + + + + + + + + , , , , , , 5 5 5 5 5 5 5 5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 7 6 6 6 6 6 6 6      (X-.'+ + + + +>E"" -,,,,,,)- - - - ->N++ 1000000'+t
F4-m<==( (     
 ). ). ). ). ). ). ). ).X  $Y^%% K K K K*- - - -&4 4 4 4$ $ $ $, , , , , ,r+   