
    DCe	                        d dl Z d dlmZ d dlmZmZ ddlmZ ddlm	Z	m
Z
mZmZ  edd          Z ed	          Zed
             Zed             Zed             Zedd            Zedd            Zedd            ZdS )    N)
namedtuple)
expanduserjoin   __version__)_debug_random_token_saved_tokencachedTokens)versionclientsessionenvironmentz~/.condac                      t           S )zQ
    Returns the version token, which is just the
    version string itself.
    r        :lib/python3.11/site-packages/anaconda_anon_usage/tokens.pyversion_tokenr      s
     r   c                  L    t          t          d          } t          | d          S )z
    Returns the client token. If a token has not yet
    been generated, an attempt is made to do so. If
    that fails, an empty string is returned.
    	aau_tokenr   )r   
CONFIG_DIRr   )fpaths    r   client_tokenr      s#     [))Ex(((r   c                       t          d          S )z^
    Returns the session token, generated randomly for each
    execution of the process.
    r   )r
   r   r   r   session_tokenr   &   s     ###r   c                 b    | t           j        } t          | dd          }t          |d|           S )z
    Returns the environment token for the given prefix, or
    sys.prefix if one is not supplied. If a token has not
    yet been generated, an attempt is made to do so. If that
    fails, an empty string is returned.
    Netcr   r   )sysprefixr   r   )r!   r   s     r   environment_tokenr"   /   s3     ~,,E}f555r   c                     t          t                      t                      t                      t	          |                     S )zv
    Returns the token set, in the form of a Tokens namedtuple.
    Fields: version, client, session, environment
    )r   r   r   r   r"   )r!   s    r   
all_tokensr$   =   s4     :KF:S:S  r   Tc                    dt           z   g}|r|t          |           }|j        r|                    d|j        z              |j        r|                    d|j        z              |j        r|                    d|j        z              nt          d           d                    |          }t          d|           |S )zh
    Returns the token set, formatted into the string that is
    appended to the conda user agent.
    zaau/zc/zs/ze/z&anaconda_anon_usage disabled by config zFull client token: %s)r   r$   r   appendr   r   r	   r   )r!   enabledpartsvaluesresults        r   token_stringr,   H   s     k!"E 	9F##= 	/LL-...> 	0LL./// 	4LL 223337888XXe__F
"F+++Mr   )N)NT)r    collectionsr   os.pathr   r    r   utilsr	   r
   r   r   r   r   r   r   r   r"   r$   r,   r   r   r   <module>r1      sL   


 " " " " " " $ $ $ $ $ $ $ $       > > > > > > > > > > > >	HM	N	NZ
##
    ) ) ) $ $ $ 
6 
6 
6 
6          r   