a
    ^ŠÝg¬  ã                   @   sN   d dl Z d dlZd dlZddd„ZG dd„ deƒZdd„ Zdd	„ Zd
d„ ZdS )é    Nc                 C   s(   |du rg }t | |ƒ |¡ ¡  ¡  ¡ S )a¿  Return an internet-friendly user_agent string.

    The majority of this code has been wilfully stolen from the equivalent
    function in Requests.

    :param name: The intended name of the user-agent, e.g. "python-requests".
    :param version: The version of the user-agent, e.g. "0.0.1".
    :param extras: List of two-item tuples that are added to the user-agent
        string.
    :returns: Formatted user-agent string
    :rtype: str
    N)ÚUserAgentBuilderÚinclude_extrasÚinclude_implementationÚinclude_systemÚbuild)ÚnameÚversionÚextras© r
   úp/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/requests_toolbelt/utils/user_agent.pyÚ
user_agent   s    ÿýr   c                   @   s<   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Z	dS )r   aï  Class to provide a greater level of control than :func:`user_agent`.

    This is used by :func:`user_agent` to build its User-Agent string.

    .. code-block:: python

        user_agent_str = UserAgentBuilder(
                name='requests-toolbelt',
                version='17.4.0',
            ).include_implementation(
            ).include_system(
            ).include_extras([
                ('requests', '2.14.2'),
                ('urllib3', '1.21.2'),
            ]).build()

    ú%s/%sc                 C   s   t  ||fg¡| _dS )zÕInitialize our builder with the name and version of our user agent.

        :param str name:
            Name of our user-agent.
        :param str version:
            The version string for user-agent.
        N)ÚcollectionsÚdequeÚ_pieces)Úselfr   r   r
   r
   r   Ú__init__4   s    zUserAgentBuilder.__init__c                    s   d  ‡ fdd„ˆ jD ƒ¡S )z„Finalize the User-Agent string.

        :returns:
            Formatted User-Agent string.
        :rtype:
            str
        ú c                    s   g | ]}ˆ j | ‘qS r
   )Úformat_string)Ú.0Zpiece©r   r
   r   Ú
<listcomp>F   ó    z*UserAgentBuilder.build.<locals>.<listcomp>)Újoinr   r   r
   r   r   r   >   s    zUserAgentBuilder.buildc                 C   s*   t dd„ |D ƒƒrtdƒ‚| j |¡ | S )zŠInclude extra portions of the User-Agent.

        :param list extras:
            list of tuples of extra-name and extra-version
        c                 s   s   | ]}t |ƒd kV  qdS )é   N)Úlen)r   Úextrar
   r
   r   Ú	<genexpr>N   r   z2UserAgentBuilder.include_extras.<locals>.<genexpr>z/Extras should be a sequence of two item tuples.)ÚanyÚ
ValueErrorr   Úextend)r   r	   r
   r
   r   r   H   s    zUserAgentBuilder.include_extrasc                 C   s   | j  tƒ ¡ | S )z¦Append the implementation string to the user-agent string.

        This adds the the information that you're using CPython 2.7.13 to the
        User-Agent.
        )r   ÚappendÚ_implementation_tupler   r
   r
   r   r   T   s    z'UserAgentBuilder.include_implementationc                 C   s   | j  tƒ ¡ | S )z2Append the information about the Operating System.)r   r!   Ú_platform_tupler   r
   r
   r   r   ]   s    zUserAgentBuilder.include_systemN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r
   r
   r
   r   r      s   

	r   c                  C   sŒ   t  ¡ } | dkrt  ¡ }nj| dkr\dtjjtjjtjjf }tjjdkr„d 	|tjjg¡}n(| dkrnt  ¡ }n| dkr€t  ¡ }nd}| |fS )	aÎ  Return the tuple of interpreter name and version.

    Returns a string that provides both the name and the version of the Python
    implementation currently running. For example, on CPython 2.7.5 it will
    return "CPython/2.7.5".

    This function works best on CPython and PyPy: in particular, it probably
    doesn't work for Jython or IronPython. Future investigation should be done
    to work out the correct shape of the code for those platforms.
    ÚCPythonÚPyPyz%s.%s.%sÚfinalÚ ÚJythonÚ
IronPythonÚUnknown)
ÚplatformÚpython_implementationÚpython_versionÚsysÚpypy_version_infoÚmajorÚminorÚmicroÚreleaselevelr   )ÚimplementationÚimplementation_versionr
   r
   r   r"   c   s$    
þÿ

r"   c                   C   s
   dt ƒ  S )Nr   )r"   r
   r
   r
   r   Ú_implementation_string„   s    r:   c                  C   s8   zt  ¡ } t  ¡ }W n ty.   d} d}Y n0 | |fS )Nr.   )r/   ÚsystemÚreleaseÚIOError)Zp_systemZ	p_releaser
   r
   r   r#   ˆ   s    
r#   )N)	r   r/   r2   r   Úobjectr   r"   r:   r#   r
   r
   r
   r   Ú<module>   s   
D!