
    j                         d dl Z d dlZd dlZ ej                  e      ZdefdZdefdZdefdZ	defdZ
dedefdZ G d	 d
e j                        ZdefdZy)    Nreturnc                      t         j                  j                         xs" t               xs t	               xs
 t               S )z
    Determines if the current environment is interactive.

    Returns:
        bool: True if the environment is either running in a terminal,
              a Jupyter notebook, an IPython environment, or Google Colab.
              False otherwise.
    )sysstdinisatty_in_jupyter_environment_in_ipython_environment_in_colab_environment     ~/Users/manta/Documents/Projects/TheRoad-I1/backend/.venv/lib/python3.12/site-packages/opik/configurator/interactive_helpers.pyis_interactiver      s<     			 	#"$	#"$	# !"	r   c                  j    	 ddl } | j                         }|t        |d      syy# t        $ r Y yw xY w)z
    Determine if the current environment is a Jupyter notebook.

    Returns:
        bool: True if running in a Jupyter notebook environment, otherwise False.
    r   NFkernelT)IPython	Exceptionget_ipythonhasattrr   ipys     r   r   r      sB     


C
{'#x0  s   & 	22c                  R    	 ddl } | j                         }|yy# t        $ r Y yw xY w)z
    Determines if the current environment is an IPython environment.

    Returns:
        bool: True if the code is running in an IPython environment, False otherwise.
    r   NFT)r   r   r   r   s     r   r	   r	   ,   s9     


C
{  s    	&&c                  d    	 ddl } | j                         }dt        |      v S # t        $ r Y yw xY w)z
    Determines if the code is running within a Google Colab environment.

    Returns:
        bool: True if running in Google Colab, False otherwise.
    r   NFzgoogle.colab)r   r   r   strr   s     r   r
   r
   ?   s=     


CSX%%	  s   # 	//messagec                     	 t        |       j                         j                         }|dv ry|dv ryt        j	                  d       G)a:  
    Prompt the user with a message for approval (Y/Yes/N/No).

    Args:
        message (str): The message to display to the user.

    Returns:
        bool: True if the user approves (Y/Yes/empty input), False if the user disapproves (N/No).

    Logs:
        Error when the user input is not recognized.
    T)YYES )NNOFzWrong choice. Please try again.)inputstripupperLOGGERerror)r   users_choices     r   ask_user_for_approvalr'   O   sK     W~++-335++;&67 r   c                   2    e Zd ZdZdZdZededd fd       Zy)DeploymentType)   zOpik Cloud (default))   zSelf-hosted Comet platform)   zLocal deploymentvaluer   c                 Z    | D ]  }|j                   d   |k(  s|c S  t        d| d      )z
        Find the DeploymentType by its integer value.

        :param value: The integer value of the DeploymentType.
        :return: The corresponding DeploymentType.
        r   zNo DeploymentType with value '')r-   
ValueError)clsr-   vs      r   find_by_valuezDeploymentType.find_by_valuej   s:     AwwqzU"  9%BCCr   N)	__name__
__module____qualname__CLOUDSELF_HOSTEDLOCALclassmethodintr3   r   r   r   r)   r)   e   s6    'E3K#E
D# 
D*: 
D 
Dr   r)   c                  ~   dg} t         D ]2  }| j                  |j                  d    d|j                  d           4 | j                  d       dj                  |       }	 t	        |      j                         }|dvrt        j                  d       4|d	k(  rd}nt        |      }t         j                  |      }|S )
z
    Asks the user to select a deployment type from the available Opik deployment options.
    Prompts the user until a valid selection is made.

    Returns:
        DeploymentType: The user's selected deployment type.
    z8Which Opik deployment do you want to log your traces to?r   z - r*   z
> 
)123r   z Wrong choice. Please try again.
r   )
r)   appendr-   joinr!   r"   r$   r%   r;   r3   )msg
deploymentmessage_string
choice_strchoice_indexchoices         r   ask_user_for_deployment_typerI   x   s     F
FC$


j&&q)*#j.>.>q.A-BCD % JJvYYs^N
>*002
00LL<=Lz?L--l;r   )enumloggingr   	getLoggerr4   r$   boolr   r   r	   r
   r   r'   Enumr)   rI   r   r   r   <module>rO      s      
			8	$ " & &&t & 83 84 8,DTYY D&n r   