U
    -hbo  ã                   @  s¦   d dl mZ ddlmZmZ d dlmZ d dlZd dlZeG dd„ dƒƒZ	dd	œd
d„Z
ddddœdd„Zdddœdd„Zdd	œdd„ZedƒeG dd„ dƒƒƒZdS )é    )Úannotationsé   )Úevent_classÚT_JSON_DICT)Ú	dataclassNc                   @  s6   e Zd ZU dZded< ded< dd„ Zedd	„ ƒZd
S )ÚMetricz$
    Run-time execution metric.
    ÚstrÚnameÚfloatÚvaluec                 C  s   t ƒ }| j|d< | j|d< |S )Nr	   r   )Údictr	   r   )ÚselfÚjson© r   úV/tmp/pip-unpacked-wheel-2_72kl_u/selenium/webdriver/common/devtools/v99/performance.pyÚto_json   s    

zMetric.to_jsonc                 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])Úreturnc                  c  s   ddi} | V }dS )z3
    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k	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.
    NÚ
timeDomainzPerformance.enable©r   Úparams©r   ©r    r#   r   r   r   r   r   Úenable0   s    þr&   r   c                 c  s"   t ƒ }| |d< d|dœ}|V }dS )a  
    Sets time domain to use for collecting and reporting duration metrics.
    Note that this must be called before enabling metrics collection. Calling
    this method while metrics collection is enabled returns an error.

    **EXPERIMENTAL**

    :param time_domain: Time domain
    r!   zPerformance.setTimeDomainr"   Nr$   r%   r   r   r   Úset_time_domainB   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 )zj
    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>a   s     zget_metrics.<locals>.<listcomp>Úmetricsr   r   r   r   r   Úget_metricsW   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   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,   r   s     z%Metrics.from_json.<locals>.<listcomp>r-   r0   )r-   r0   )r   r   r   r   r   r   o   s    
þzMetrics.from_jsonN)r   r   r   r   r   r   r   r   r   r   r   r/   d   s
   
r/   )N)Ú
__future__r   Úutilr   r   Zdataclassesr   ÚenumÚtypingr   r   r&   r'   r.   r/   r   r   r   r   Ú<module>   s    ÿ