o
    M,hN                     @  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eG dd dZd2ddZd3ddZd4ddZd4ddZd5ddZd6d!d"Z		d7d8d'd(Zd4d)d*Zd9d,d-Zd9d.d/Zd9d0d1ZdS ):    )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   z/var/www/www-root/data/www/bot.pdev.uz/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v139/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                   @  6   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  r0   r   )Moduler   r    r   r   r   r#   M   r1   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 )r2   z'
    Executable module information
    r&   nameuuidbase_addressr   r   c                 C  s2   t  }| j|d< | j|d< | j|d< | j|d< |S )Nr3   r4   baseAddressr   )r$   r3   r4   r5   r   r%   r   r   r   r   c   s   



zModule.to_jsonc                 C  s0   | t |d t |d t |d t|d dS )Nr3   r4   r6   r   )r3   r4   r5   r   )r&   r   r   r   r   r   r   k   s   



zModule.from_jsonNr(   r   r   r   r   r2   Q   s   
 r2   c                   @  r*   )
DOMCounterz"
    DOM object counter data.
    r&   r3   intcountc                 C  s   t  }| j|d< | j|d< |S )Nr3   r9   )r$   r3   r9   r%   r   r   r   r      s   

zDOMCounter.to_jsonc                 C  s   | t |d t|d dS )Nr3   r9   )r3   r9   )r&   r8   r   r   r   r   r      s   

zDOMCounter.from_jsonNr(   r   r   r   r   r7   u   s   
 r7   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
    Retruns current DOM object counters.

    :returns: A tuple with the following items:

        0. **documents** - 
        1. **nodes** - 
        2. **jsEventListeners** - 
    methodzMemory.getDOMCounters	documentsnodesjsEventListeners)r8   cmd_dictr   r   r   r   get_dom_counters   s   


rB   Ctyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[DOMCounter]]c                  c  s"    ddi} | V }dd |d D S )zv
    Retruns DOM object counters after preparing renderer for leak detection.

    :returns: DOM object counters.
    r<   z%Memory.getDOMCountersForLeakDetectionc                 S  r0   r   )r7   r   r    r   r   r   r#      r1   z7get_dom_counters_for_leak_detection.<locals>.<listcomp>countersr   r@   r   r   r   #get_dom_counters_for_leak_detection   s
   rE   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                  c      ddi} | V }dS )z
    Prepares for leak detection by terminating workers, stopping spellcheckers,
    dropping non-essential internal caches, running garbage collections, etc.
    r<   zMemory.prepareForLeakDetectionNr   r@   r   r   r   prepare_for_leak_detection   s   
rH   c                  c  rG   )z8
    Simulate OomIntervention by purging V8 memory.
    r<   z$Memory.forciblyPurgeJavaScriptMemoryNr   r@   r   r   r   !forcibly_purge_java_script_memory      
rI   
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.
    rK   z)Memory.setPressureNotificationsSuppressedr<   paramsNr$   )rK   rN   rA   r   r   r   r   %set_pressure_notifications_suppressed   s   
rP   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.
    rQ   z#Memory.simulatePressureNotificationrM   N)r$   r   )rQ   rN   rA   r   r   r   r   simulate_pressure_notification   s   
rR   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.startSamplingrM   rO   )rS   rU   rN   rA   r   r   r   r   start_sampling   s   

rY   c                  c  rG   )z0
    Stop collecting native memory profile.
    r<   zMemory.stopSamplingNr   r@   r   r   r   stop_sampling   rJ   rZ   ;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: 
    r<   z Memory.getAllTimeSamplingProfileprofiler+   r   r@   r   r   r   get_all_time_sampling_profile  
   r_   c                  c  r\   )zq
    Retrieve native memory allocations profile
    collected since browser process startup.

    :returns: 
    r<   z Memory.getBrowserSamplingProfiler]   r^   r@   r   r   r   get_browser_sampling_profile  r`   ra   c                  c  r\   )zu
    Retrieve native memory allocations profile collected since last
    ``startSampling`` call.

    :returns: 
    r<   zMemory.getSamplingProfiler]   r^   r@   r   r   r   get_sampling_profile$  r`   rb   )r:   r;   )r:   rC   )r:   rF   )rK   rL   r:   rF   )rQ   r   r:   rF   )NN)rS   rT   rU   rV   r:   rF   )r:   r[   )
__future__r   utilr   r   dataclassesr   enumtypingEnumr   r   r+   r2   r7   rB   rE   rH   rI   rP   rR   rY   rZ   r_   ra   rb   r   r   r   r   <module>   s6   #










