
    $h                     N    S SK r S SKrS SKrSS jr " S S\5      rS rS rS rg)	    Nc                     Uc  / n[        X5      R                  U5      R                  5       R                  5       R	                  5       $ )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
)UserAgentBuilderinclude_extrasinclude_implementationinclude_systembuild)nameversionextrass      Z/var/www/html/shao/venv/lib/python3.13/site-packages/requests_toolbelt/utils/user_agent.py
user_agentr      sD     ~

.

 
  

.
557#    c                   :    \ rS rSrSrSrS rS rS rS r	S r
S	rg
)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                 >    [         R                  " X4/5      U l        g)zInitialize 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
   s      r   __init__UserAgentBuilder.__init__4   s     #((4/):;r   c                 z    SR                  U R                   Vs/ sH  oR                  U-  PM     sn5      $ s  snf )z\Finalize the User-Agent string.

:returns:
    Formatted User-Agent string.
:rtype:
    str
 )joinr   format_string)r   pieces     r   r   UserAgentBuilder.build>   s2     xxN++e3NOONs   8c                     [        S U 5       5      (       a  [        S5      eU R                  R                  U5        U $ )zrInclude extra portions of the User-Agent.

:param list extras:
    list of tuples of extra-name and extra-version
c              3   <   #    U H  n[        U5      S :g  v   M     g7f)   N)len).0extras     r   	<genexpr>2UserAgentBuilder.include_extras.<locals>.<genexpr>N   s     3F5s5zQFs   z/Extras should be a sequence of two item tuples.)any
ValueErrorr   extend)r   r   s     r   r   UserAgentBuilder.include_extrasH   s8     3F333NOOF#r   c                 L    U R                   R                  [        5       5        U $ )zAppend 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_tupler   s    r   r   'UserAgentBuilder.include_implementationT   s     	134r   c                 L    U R                   R                  [        5       5        U $ )z2Append the information about the Operating System.)r   r,   _platform_tupler.   s    r   r   UserAgentBuilder.include_system]   s    O-.r   )r   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r   r   __static_attributes__ r   r   r   r      s(    $ M<P
r   r   c                  8   [         R                  " 5       n U S:X  a  [         R                  " 5       nX4$ U S:X  a  [        R                  R
                  < S[        R                  R                  < S[        R                  R                  < 3n[        R                  R                  S:w  a+  SR                  U[        R                  R                  /5      nX4$ U S:X  a  [         R                  " 5       nX4$ U S:X  a  [         R                  " 5       nX4$ SnX4$ )	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PyPy.final Jython
IronPythonUnknown)
platformpython_implementationpython_versionsyspypy_version_infomajorminormicroreleaselevelr   )implementationimplementation_versions     r   r-   r-   c   s    335N"!)!8!8!:  33 
6	!/2/D/D/J/J/2/D/D/J/J/2/D/D/J/J"L   --8%'WW&(=(=(J(J. &" 33 
8	#!)!8!8!: 33 
<	'!)!8!8!: 33 "+33r   c                      S[        5       -  $ )Nr   )r-   r9   r   r   _implementation_stringrO      s    *,,,r   c                       [         R                  " 5       n [         R                  " 5       nX4$ ! [         a	    Sn Sn X4$ f = f)NrB   )rC   systemreleaseIOError)p_system	p_releases     r   r1   r1      sP    ??$$$&	     	  s   */ AA)N)	r   rC   rF   r   objectr   r-   rO   r1   r9   r   r   <module>rW      s2      
#0Av AH4B-!r   