o
    -wii
                     @   s   d Z ddlZddlZddlmZ ddlmZmZ ddlZddl	m
Z
 ddlmZ ddlmZmZ ddlmZ ed	ed
ZdedefddZdS )z
normalize.    Nwraps)CallableTypeVar)
RetryError)env)	CommErrorError)parse_backend_error_messages_F)boundfuncreturnc                    s   t   fdd}|S )zLFunction decorator for catching common errors and re-raising as wandb.Error.c                     s  d}z | i |W S  t jyW } z@t|j}|jj}|r*d| dd| }n$|jjr9d| d|jj }n|jjrId| d|jj d}nd| }t||d }~w t	y } zMdt
|jv r|jjd urz|jj dd	|igd
 d	 }W n ty   |jjj}Y nw |j}t r|jt d t||jt d d }~w ty     ty } z5t|jd
kr|jd
 }n|}t|drtt|d	 }nt|}t r t||t d d }~ww )NzWhoa, you found a bug.zHTTP z: z; z ()responseerrorsmessager      {)requests	HTTPErrorr
   r   status_codejointextreasonr   r   dirlast_exceptionjsonget
ValueErrorr   is_debugwith_tracebacksysexc_infor	   	Exceptionlenargsstr
startswithastliteral_eval)r&   kwargsr   errorr   statuserrpayloadr    Q/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/wandb/apis/normalize.pywrapper   sd   




z%normalize_exceptions.<locals>.wrapperr   )r   r3   r1   r0   r2   normalize_exceptions   s   ;r4   )__doc__r)   r"   	functoolsr   typingr   r   r   wandb_gql.clientr   wandbr   wandb.errorsr   r	   
wandb.utilr
   r   r4   r1   r1   r1   r2   <module>   s    