
    Hoh                       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jF                  jI                  d      rddl%mZ! dZ&de"d<   ejF                  jI                  d      rddl'mZ&  e( e)de&e!d f            Z*de"d<   dZ+ G d d      Z,de"d<   	  ejZ                         Z.ddZ/ddZ0ddZ1d dZ2d!dZ3y)"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_rsc                >    t        t        |       t        d            S )Ni  )r   r   r   )ms    n/var/www/html/wine-match-dev/backend/winematch-backend/venv/lib/python3.12/site-packages/ua_parser/__init__.py<lambda>r#   L   s    omA&6dD     _ResolverCtorBestAvailableResolver)r   r   r   c                  R    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y	)Parserz^Wrapper object, provides convenience methods around an
    underlying :class:`Resolver`.

    c               $     | t        |            S )zfrom_matchers(Matchers) -> Parser

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

        )r&   )clsr!   s     r"   from_matcherszParser.from_matchers[   s     (+,,r$   c                    || _         y )Nresolver)selfr.   s     r"   __init__zParser.__init__f   s	     r$   c               &    | j                  ||      S )zParses the ``ua`` string, returning a parse result with *at least*
        the requested :class:`domains <Domain>` resolved (whether to success or
        failure).
        r-   )r/   uadomainss      r"   __call__zParser.__call__i   s    
 }}R))r$   c                L     | |t         j                        j                         S )z+Convenience method for parsing all domains.)r
   ALLcompleter/   r2   s     r"   r   zParser.parsep   s    B

#,,..r$   c                D     | |t         j                        j                  S )z=Convenience method for parsing the :class:`UserAgent` domain.)r
   
USER_AGENT
user_agentr8   s     r"   r   zParser.parse_user_agentt   s    B))*555r$   c                D     | |t         j                        j                  S )z6Convenience method for parsing the :class:`OS` domain.)r
   r   osr8   s     r"   r   zParser.parse_osx   s    B		"%%%r$   c                D     | |t         j                        j                  S )z:Convenience method for parsing the :class:`Device` domain.)r
   DEVICEdevicer8   s     r"   r   zParser.parse_device|   s    B&---r$   N)r!   r   returnr(   )r.   r   rA   None)r2   strr3   r
   rA   r   )r/   r   r2   rC   rA   r   )r/   r   r2   rC   rA   Optional[UserAgent])r/   r   r2   rC   rA   Optional[OS])r/   r   r2   rC   rA   Optional[Device])__name__
__module____qualname____doc__classmethodr+   r0   r4   r   r   r   r    r$   r"   r(   r(   U   s9    
 - -!*/6&.r$   r(   parserc                l   t         5  | dk(  rt               j                  d      x}rt        t        |      cd d d        S t
        st        st        rt               }n
t               }t        j                  |      at        cd d d        S 	 d d d        t        dt        d|       # 1 sw Y   xY w)NrM   zmodule z has no attribute )_lazy_globals_lockglobalsgetr   r(   r   r   r   r   r   r+   rM   AttributeErrorrG   )namepmatcherss      r"   __getattr__rV      s    	 8
 IMM(++q+FA  x-/(?))(3F   78,.@I
JJ! s   0B*AB**B3c                X    ddl m}  || t        j                        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   rM   ) rM   r
   r6   r7   r2   rM   s     r"   r   r      s!     "fjj!**,,r$   c                P    ddl m}  || t        j                        j                  S )zgParses the :class:`browser <.UserAgent>` information using the
    :data:`global parser <parser>`.
    r   rX   )rY   rM   r
   r:   r;   rZ   s     r"   r   r      s      "f''(333r$   c                P    ddl m}  || t        j                        j                  S )zVParses the :class:`.OS` information using the :data:`global parser
    <parser>`.
    r   rX   )rY   rM   r
   r   r=   rZ   s     r"   r   r      s     "fii ###r$   c                P    ddl m}  || t        j                        j                  S )zZParses the :class:`.Device` information using the :data:`global
    parser <parser>`.
    r   rX   )rY   rM   r
   r?   r@   rZ   s     r"   r   r      s     "fmm$+++r$   )rS   rC   rA   r(   )r2   rC   rA   r   )r2   rC   rA   rD   )r2   rC   rA   rE   )r2   rC   rA   rF   )4rJ   
__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   rV   r   r   r   r   rL   r$   r"   <module>rq      s  & #*   + + , 5
 
 
 7 (X-.'+$ +>>E",)-& ->>N+0'+
D	
	( } 	 ). ).X 	 $Y^^% K*-&4$,r$   