
    j                     p    d dl Z d dlZd dlmZ d dlZd dlZdee   fdZe j                  dedefd       Z
y)    N)Optionalreturnc                  r   t         j                  j                         } | j                  t         j                  j                  k7  r| j                  S t        t         j                  j                         t         j                  j                         z         }t         j                  j                   d| }|S )a  
    The workspace name serves as a user identifier.
    If workspace is default, then we try to compute the identifier as a hash from the hostname
    and username.
    It is not a strict relation, host machine might change or the user might accidentally pass incorrect workspace.
    But we use it as an approximation to have a better visibility of the amount of users affected by some error.
    _)	opikconfig
OpikConfig	workspaceOPIK_WORKSPACE_DEFAULT_NAME_compute_hashenvironmentget_hostnameget_user)r   hashed_part
identifiers      y/Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/site-packages/opik/error_tracking/user_details.pyget_idr   
   s     [[##%F4;;BBB%%'$*:*:*C*C*EEK KK;;<Ak]KJ    valuec                 f    t        j                  | j                  d            j                         S )Nzutf-8)hashlibsha256encode	hexdigest)r   s    r   r   r       s#    >>%,,w/0::<<r   )	functoolsr   typingr   opik.configr   opik.environmentstrr   	lru_cacher    r   r   <module>r"      sL         , = = = =r   