o
    ҷh                     @  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G dd dej	Z
eG dd	 d	ZeG d
d dZeG dd dZd-ddZd.ddZd.ddZd/ddZd0ddZ		d1d2d"d#Zd.d$d%Zd3d'd(Zd3d)d*Zd3d+d,ZdS )4    )annotations   )event_classT_JSON_DICT)	dataclassNc                   @  s,   e Zd ZdZdZdZdd Zedd ZdS )	PressureLevelz 
    Memory pressure level.
    moderatecriticalc                 C  s   | j S N)value)self r   a/var/www/html/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v119/memory.pyto_json   s   zPressureLevel.to_jsonc                 C  s   | |S r
   r   clsjsonr   r   r   	from_json   s   zPressureLevel.from_jsonN)	__name__
__module____qualname____doc__MODERATECRITICALr   classmethodr   r   r   r   r   r      s    r   c                   @  s>   e Zd ZU dZded< ded< ded< dd Zed	d
 ZdS )SamplingProfileNodez
    Heap profile sample.
    floatsizetotalztyping.List[str]stackc                 C  s2   t  }| j|d< | j|d< dd | jD |d< |S )Nr   r   c                 S  s   g | ]}|qS r   r   .0ir   r   r   
<listcomp>.   s    z/SamplingProfileNode.to_json.<locals>.<listcomp>r   )dictr   r   r   r   r   r   r   r   r   *   s
   

zSamplingProfileNode.to_jsonc                 C  s,   | t |d t |d dd |d D dS )Nr   r   c                 S  s   g | ]}t |qS r   )strr    r   r   r   r#   6       z1SamplingProfileNode.from_json.<locals>.<listcomp>r   )r   r   r   )r   r   r   r   r   r   1   s
   

zSamplingProfileNode.from_jsonNr   r   r   r   __annotations__r   r   r   r   r   r   r   r      s   
 r   c                   @  s6   e Zd ZU dZded< ded< dd Zedd	 Zd
S )SamplingProfilez(
    Array of heap profile samples.
    z typing.List[SamplingProfileNode]samplesztyping.List[Module]modulesc                 C  s2   t  }dd | jD |d< dd | jD |d< |S )Nc                 S     g | ]}|  qS r   r   r    r   r   r   r#   E   r'   z+SamplingProfile.to_json.<locals>.<listcomp>r+   c                 S  r-   r   r.   r    r   r   r   r#   F   r'   r,   )r$   r+   r,   r%   r   r   r   r   C   s   zSamplingProfile.to_jsonc                 C  s(   | dd |d D dd |d D dS )Nc                 S     g | ]}t |qS r   )r   r   r    r   r   r   r#   L       z-SamplingProfile.from_json.<locals>.<listcomp>r+   c                 S  r/   r   )Moduler   r    r   r   r   r#   M   r0   r,   )r+   r,   r   r   r   r   r   r   I   s   zSamplingProfile.from_jsonNr(   r   r   r   r   r*   :   s   
 r*   c                   @  sF   e Zd ZU dZded< ded< ded< ded< dd	 Zed
d ZdS )r1   z'
    Executable module information
    r&   nameuuidbase_addressr   r   c                 C  s2   t  }| j|d< | j|d< | j|d< | j|d< |S )Nr2   r3   baseAddressr   )r$   r2   r3   r4   r   r%   r   r   r   r   c   s   



zModule.to_jsonc                 C  s0   | t |d t |d t |d t|d dS )Nr2   r3   r5   r   )r2   r3   r4   r   )r&   r   r   r   r   r   r   k   s   



zModule.from_jsonNr(   r   r   r   r   r1   Q   s   
 r1   returnGtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[int, int, int]]c                  c  s2    ddi} | V }t |d t |d t |d fS )z


    :returns: A tuple with the following items:

        0. **documents** - 
        1. **nodes** - 
        2. **jsEventListeners** - 
    methodzMemory.getDOMCounters	documentsnodesjsEventListeners)intcmd_dictr   r   r   r   get_dom_countersu   s   


r?   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                  c  s    ddi} | V }d S )Nr8   zMemory.prepareForLeakDetectionr   r=   r   r   r   prepare_for_leak_detection   s   
rA   c                  c      ddi} | V }dS )z8
    Simulate OomIntervention by purging V8 memory.
    r8   z$Memory.forciblyPurgeJavaScriptMemoryNr   r=   r   r   r   !forcibly_purge_java_script_memory      
rC   
suppressedboolc                 c  s$    t  }| |d< d|d}|V }dS )z
    Enable/disable suppressing memory pressure notifications in all processes.

    :param suppressed: If true, memory pressure notifications will be suppressed.
    rE   z)Memory.setPressureNotificationsSuppressedr8   paramsNr$   )rE   rH   r>   r   r   r   r   %set_pressure_notifications_suppressed   s   
rJ   levelc                 c  s(    t  }|  |d< d|d}|V }dS )z
    Simulate a memory pressure notification in all processes.

    :param level: Memory pressure level of the notification.
    rK   z#Memory.simulatePressureNotificationrG   N)r$   r   )rK   rH   r>   r   r   r   r   simulate_pressure_notification   s   
rL   sampling_intervaltyping.Optional[int]suppress_randomnesstyping.Optional[bool]c                 c  s<    t  }| dur| |d< |dur||d< d|d}|V }dS )z
    Start collecting native memory profile.

    :param sampling_interval: *(Optional)* Average number of bytes between samples.
    :param suppress_randomness: *(Optional)* Do not randomize intervals between samples.
    NsamplingIntervalsuppressRandomnesszMemory.startSamplingrG   rI   )rM   rO   rH   r>   r   r   r   r   start_sampling   s   

rS   c                  c  rB   )z0
    Stop collecting native memory profile.
    r8   zMemory.stopSamplingNr   r=   r   r   r   stop_sampling   rD   rT   ;typing.Generator[T_JSON_DICT, T_JSON_DICT, SamplingProfile]c                  c      ddi} | V }t |d S )zr
    Retrieve native memory allocations profile
    collected since renderer process startup.

    :returns: 
    r8   z Memory.getAllTimeSamplingProfileprofiler*   r   r=   r   r   r   get_all_time_sampling_profile   
   rY   c                  c  rV   )zq
    Retrieve native memory allocations profile
    collected since browser process startup.

    :returns: 
    r8   z Memory.getBrowserSamplingProfilerW   rX   r=   r   r   r   get_browser_sampling_profile   rZ   r[   c                  c  rV   )zu
    Retrieve native memory allocations profile collected since last
    ``startSampling`` call.

    :returns: 
    r8   zMemory.getSamplingProfilerW   rX   r=   r   r   r   get_sampling_profile   rZ   r\   )r6   r7   )r6   r@   )rE   rF   r6   r@   )rK   r   r6   r@   )NN)rM   rN   rO   rP   r6   r@   )r6   rU   )
__future__r   utilr   r   dataclassesr   enumtypingEnumr   r   r*   r1   r?   rA   rC   rJ   rL   rS   rT   rY   r[   r\   r   r   r   r   <module>   s0   
#








