a
    $ñ»j‹	  ã                   @  sŽ   d dl mZ d dlZd dlmZ ddlmZmZ eG dd„ dƒƒZdd	œd
d„Z	ddddœdd„Z
dd	œdd„ZedƒeG dd„ dƒƒƒZdS )é    )ÚannotationsN)Ú	dataclassé   )Úevent_classÚT_JSON_DICTc                   @  sD   e Zd ZU dZded< ded< ddœdd	„Zedd d
œdd„ƒZdS )ÚMetriczRun-time execution metric.ÚstrÚnameÚfloatÚvaluer   ©Úreturnc                 C  s   t ƒ }| j|d< | j|d< |S )Nr	   r   )Údictr	   r   )ÚselfÚjson© r   ú7E:\soccer\ml_env\Lib\site-packages\mycdp/performance.pyÚto_json   s    

zMetric.to_json©r   r   c                 C  s   | t |d ƒt|d ƒd�S )Nr	   r   )r	   r   )r   r
   ©Úclsr   r   r   r   Ú	from_json   s    

þzMetric.from_jsonN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   Úclassmethodr   r   r   r   r   r      s   
r   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]r   c                  c  s   ddi} | V }dS )z)Disable collecting and reporting metrics.ÚmethodzPerformance.disableNr   ©Úcmd_dictr   r   r   r   Údisable$   s    ÿr!   ztyping.Optional[str])Útime_domainr   c                 c  s*   t ƒ }| dur| |d< d|dœ}|V }dS )z�
    Enable collecting and reporting metrics.
    :param time_domain: *(Optional)*
    Time domain to use for collecting and reporting duration metrics.
    NZ
timeDomainzPerformance.enable)r   Úparams)r   )r"   r#   r    r   r   r   r   Úenable,   s    þr$   z?typing.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[Metric]]c                  c  s    ddi} | V }dd„ |d D ƒS )zi
    Retrieve current values of run-time metrics.
    :returns: Current values for run-time metrics.
    r   zPerformance.getMetricsc                 S  s   g | ]}t  |¡‘qS r   ©r   r   ©Ú.0Úir   r   r   Ú
<listcomp>I   ó    zget_metrics.<locals>.<listcomp>Úmetricsr   r   r   r   r   Úget_metrics>   s    ÿr,   zPerformance.metricsc                   @  s6   e Zd ZU dZded< ded< edd dœdd	„ƒZd
S )ÚMetricszCurrent values of the metrics.ztyping.List[Metric]r+   r   Útitler   r   c                 C  s"   | dd„ |d D ƒt |d ƒd�S )Nc                 S  s   g | ]}t  |¡‘qS r   r%   r&   r   r   r   r)   X   r*   z%Metrics.from_json.<locals>.<listcomp>r+   r.   )r+   r.   )r   r   r   r   r   r   U   s    
þzMetrics.from_jsonN)r   r   r   r   r   r   r   r   r   r   r   r-   L   s
   
r-   )N)Ú
__future__r   ÚtypingÚdataclassesr   Úutilr   r   r   r!   r$   r,   r-   r   r   r   r   Ú<module>   s   	 ÿ