Ë
    ûmxiC  ã                   ó–   — d Z ddlZddlZddlZddlZ ej
                  e«      ZdZdZ	dZ
 eee	e
g«      ZeZdZdZdZd	„ Zd
„ Zd„ Zd„ Zy)z-Helper functions for commonly used utilities.é    NÚWARNINGÚ	EXCEPTIONÚIGNOREzFile: {0}: Is a symbolic link.z{0}: Is a directoryz,Cannot access {0}: No such file or directoryc                 ó¸   ‡ — ˆ fd„}t        ‰ t        «      r|S t        j                  ‰ «      \  }}}}}}} t	        t        |«      t        |«      z
  «      ‰ «      S )aŠ  A decorator to declare that only the first N arguments may be positional.

    This decorator makes it easy to support Python 3 style keyword-only
    parameters. For example, in Python 3 it is possible to write::

        def fn(pos1, *, kwonly1=None, kwonly2=None):
            ...

    All named parameters after ``*`` must be a keyword::

        fn(10, 'kw1', 'kw2')  # Raises exception.
        fn(10, kwonly1='kw1')  # Ok.

    Example
    ^^^^^^^

    To define a function like above, do::

        @positional(1)
        def fn(pos1, kwonly1=None, kwonly2=None):
            ...

    If no default value is provided to a keyword argument, it becomes a
    required keyword argument::

        @positional(0)
        def fn(required_kw):
            ...

    This must be called with the keyword parameter::

        fn()  # Raises exception.
        fn(10)  # Raises exception.
        fn(required_kw=10)  # Ok.

    When defining instance or class methods always remember to account for
    ``self`` and ``cls``::

        class MyClass(object):

            @positional(2)
            def my_method(self, pos1, kwonly1=None):
                ...

            @classmethod
            @positional(2)
            def my_method(cls, pos1, kwonly1=None):
                ...

    The positional decorator behavior is controlled by
    ``_helpers.positional_parameters_enforcement``, which may be set to
    ``POSITIONAL_EXCEPTION``, ``POSITIONAL_WARNING`` or
    ``POSITIONAL_IGNORE`` to raise an exception, log a warning, or do
    nothing, respectively, if a declaration is violated.

    Args:
        max_positional_arguments: Maximum number of positional arguments. All
                                  parameters after this index must be
                                  keyword only.

    Returns:
        A decorator that prevents using arguments after max_positional_args
        from being used as positional parameters.

    Raises:
        TypeError: if a keyword-only argument is provided as a positional
                   parameter, but only if
                   _helpers.positional_parameters_enforcement is set to
                   POSITIONAL_EXCEPTION.
    c                 óF   •‡ — t        j                  ‰ «      ˆˆ fd„«       }|S )Nc                  ó  •— t        | «      ‰kD  rkd}‰dk7  rd}dj                  ‰j                  ‰t        | «      |¬«      }t        t        k(  rt        |«      ‚t        t        k(  rt        j                  |«        ‰| i |¤ŽS )NÚ é   ÚszV{function}() takes at most {args_max} positional argument{plural} ({args_given} given))ÚfunctionÚargs_maxÚ
args_givenÚplural)	ÚlenÚformatÚ__name__Ú!positional_parameters_enforcementÚPOSITIONAL_EXCEPTIONÚ	TypeErrorÚPOSITIONAL_WARNINGÚloggerÚwarning)ÚargsÚkwargsÚplural_sÚmessageÚmax_positional_argsÚwrappeds       €€úO/home/htdocs/ttos/venv/lib/python3.12/site-packages/googleapiclient/_helpers.pyÚpositional_wrapperzDpositional.<locals>.positional_decorator.<locals>.positional_wrappero   s�   ø€ ä�4‹yÐ.Ò.Ø�Ø&¨!Ò+Ø"�Hð<ß<B¹FØ!(×!1Ñ!1Ø!4Ü#& t£9Ø'ð	 =Có =ð ô 5Ô8LÒLÜ# GÓ,Ð,Ü6Ô:LÒLÜ—N‘N 7Ô+Ù˜DÐ+ FÑ+Ð+ó    )Ú	functoolsÚwraps)r   r    r   s   ` €r   Úpositional_decoratorz(positional.<locals>.positional_decoratorn   s&   ù€ Ü	�‰˜Ó	!ô	,ó 
"ð	,ð( "Ð!r!   )Ú
isinstanceÚintÚinspectÚgetfullargspecÚ
positionalr   )r   r$   r   Ú_Údefaultss   `    r   r)   r)   &   s\   ø€ ôP"ô0 Ð%¤sÔ+Ø#Ð#ä(/×(>Ñ(>Ð?RÓ(SÑ%ˆˆa��H˜a  AØ4Œzœ#˜d›)¤c¨(£mÑ3Ó4Ð5HÓIÐIr!   c                 óè   — t         j                  j                  | «      }i }|j                  «       D ]=  \  }}t	        |«      dk7  r"d|›ddj                  |«      ›�}t        |«      ‚|d   ||<   Œ? |S )a  Parses unique key-value parameters from urlencoded content.

    Args:
        content: string, URL-encoded key-value pairs.

    Returns:
        dict, The key-value pairs from ``content``.

    Raises:
        ValueError: if one of the keys is repeated.
    r
   z.URL-encoded content contains a repeated value:z -> z, r   )ÚurllibÚparseÚparse_qsÚitemsr   ÚjoinÚ
ValueError)ÚcontentÚurlencoded_paramsÚparamsÚkeyÚvalueÚmsgs         r   Úparse_unique_urlencodedr9   �   s{   € ô Ÿ™×-Ñ-¨gÓ6ÐØ€FØ'×-Ñ-Ó/ò ‰
ˆˆUÜˆu‹:˜‹?âØ—	‘	˜%Ô ðˆCô ˜S“/Ð!Ø˜A‘hˆˆsŠðð €Mr!   c                 ó,  — t         j                  j                  | «      }t        |j                  «      }|j                  |«       t         j                  j                  |«      }|j                  |¬«      }t         j                  j                  |«      S )a  Updates a URI with new query parameters.

    If a given key from ``params`` is repeated in the ``uri``, then
    the URI will be considered invalid and an error will occur.

    If the URI is valid, then each value from ``params`` will
    replace the corresponding value in the query parameters (if
    it exists).

    Args:
        uri: string, A valid URI, with potential existing query parameters.
        params: dict, A dictionary of query parameters.

    Returns:
        The same URI but with the new query parameters added.
    )Úquery)	r-   r.   Úurlparser9   r;   ÚupdateÚ	urlencodeÚ_replaceÚ
urlunparse)Úurir5   ÚpartsÚquery_paramsÚ	new_queryÚ	new_partss         r   Úupdate_query_paramsrF   ¦   sm   € ô" �L‰L×!Ñ! #Ó&€EÜ*¨5¯;©;Ó7€LØ×Ñ˜ÔÜ—‘×&Ñ& |Ó4€IØ—‘ Y�Ó/€IÜ�<‰<×"Ñ" 9Ó-Ð-r!   c                 ó&   — |€| S t        | ||i«      S )a\  Adds a query parameter to a url.

    Replaces the current value if it already exists in the URL.

    Args:
        url: string, url to add the query parameter to.
        name: string, query parameter name.
        value: string, query parameter value.

    Returns:
        Updated query parameter. Does not update the url if value is None.
    )rF   )ÚurlÚnamer7   s      r   Ú_add_query_parameterrJ   ¿   s   € ð €}Øˆ
ä" 3¨¨u¨Ó6Ð6r!   )Ú__doc__r"   r'   Úloggingr-   Ú	getLoggerr   r   r   r   ÚPOSITIONAL_IGNOREÚ	frozensetÚPOSITIONAL_SETr   Ú_SYM_LINK_MESSAGEÚ_IS_DIR_MESSAGEÚ_MISSING_FILE_MESSAGEr)   r9   rF   rJ   © r!   r   ú<module>rU      s€   ðñ 4ã Û Û Û à	ˆ×	Ñ	˜8Ó	$€àÐ Ø"Ð ØÐ ÙØÐ-Ð/@ÐAó€ð %7Ð !à4Ð Ø'€ØFÐ òdJòNò2.ó27r!   