
    yj%              
           d Z ddlZddlZddlZddlmZ ddlZddlZddl	m
Z
mZ ddlmZ ddlmZ dedefd	Zd
edededej        fdZded
edededej        f
dZd
ededefdZded
ededefdZdS )z
dot
    N)HTTPException)#STUDIO_MODEL_API_URL_PREFIX_DEFAULTSALT)datetime)logsaltreturnc                     | d|  }t          j        |                                                                          }|S )z	get param_)hashlibmd5encode	hexdigest)r   api_timerawr   s       `/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/aistudio_sdk/dot.pygenerate_api_keyr      s=    



C
+cjjll
#
#
-
-
/
/CJ    repo_idrevisionactionc           	      ~   t           }| d}t          t          j                    dz            }t          t          |          }d| dd|t          j        |          ||d}ddi}	 t          j        |||	          }	|	j	        d
k    rt          j        d|	j	                    |	S # t          $ r}
Y d}
~
dS d}
~
ww xY w)	post infoz/modelcenter/v2/statistic/repoi  modeldownloadsdk)biz_idr   ac_typeclient_typer   r   r   api_keyContent-Typeapplication/jsonjsonheaders   dot.response:N)r   inttimer   r   r$   dumpsrequestspoststatus_coder   debug	Exception)r   r   r   addressurlr   r    payloadr%   responsees              r   post_repo_statisticr5      s     2G
4
4
4C49;;%&&HtX..G*V$$	 	G 	*G=7GDDD3&&I<h&:<<===   s   '?B' '
B<7B<token	file_path	file_sizec                 h   t           }| d}t          j                                        d          }|d||| dd}||d}t	          j        |d          }	d	d
i}
	 t          j        ||	|
          }|j        dk    rt          j
        d|j                    |S # t          $ r}Y d}~dS d}~ww xY w)r   z/studio-dot/reportz%Y-%m-%d %H:%M:%Sr   137)repoId
clientTypefilePathfileSizer6   eid)r   r)   ),:)
separatorsr!   r"   r#   r&   r'   N)r   r   nowstrftimer$   r*   r+   r,   r-   r   r.   r/   )r6   r   r7   r8   r0   r1   r   r   r2   compact_jsonr%   r3   r4   s                r   post_upload_statisticrF   7   s     2G
(
(
(C|~~&&':;;H F  G
 :g*===L 	*G=<III3&&I<h&:<<===   s   ?B 
B1,B1c                     t           j                            d          5 }|                    t          | ||           ddd           dS # 1 swxY w Y   dS z
    async
       )max_workersN)
concurrentfuturesThreadPoolExecutorsubmitr5   )r   r   r   executors       r   post_repo_statistic_asyncrP   \   s     
		.	.1	.	=	= H+WhGGGH H H H H H H H H H H H H H H H H Hs   AAAc                     t           j                            d          5 }|                    t          | |||           ddd           dS # 1 swxY w Y   dS rH   )rK   rL   rM   rN   rF   )r6   r   r7   r8   rO   s        r   post_upload_statistic_asyncrR   f   s     
		.	.1	.	=	= U-ugy)TTTU U U U U U U U U U U U U U U U U Us   AAA)__doc__concurrent.futuresrK   r)   r   http.clientr   r+   r$   aistudio_sdk.configr   r   r   aistudio_sdkr   strr   dictResponser5   r(   rF   rP   rR    r   r   <module>r\      s          % % % % % %   I I I I I I I I            3 S      	   @""" " 	"
 " " " "JHs HHH H H H
U
U
U 
U 	
U 
U 
U 
U 
U 
Ur   