
    Ee	                         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y)    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.12/site-packages/anaconda_anon_usage/tokens.pyversion_tokenr      s
     r   c                  :    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                 Z    | 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.
    etcr   r   )sysprefixr   r   )r!   r   s     r   environment_tokenr"   /   s/     ~,E}f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$   =   s&     :KF:S r   c                    dt         z   g}|rt        |       }|j                  r|j                  d|j                  z          |j                  r|j                  d|j                  z          |j
                  r*|j                  d|j
                  z          nt        d       dj                  |      }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F#==LL-.>>LL./LL 2 2237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      s     " $  > >	HM	N
#
   ) ) $ $ 
6 
6    r   