
    g                    0   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ej                        Z
e G d d	             Ze G d
 d             Ze G d d             ZddZddZddZ	 	 	 	 ddZ	 	 	 	 ddZ	 	 d	 	 	 	 	 ddZddZddZddZddZy)    )annotations   )event_classT_JSON_DICT)	dataclassNc                  .    e Zd ZdZdZdZd Zed        Zy)PressureLevelz 
    Memory pressure level.
    moderatecriticalc                    | j                   S N)value)selfs    a/var/www/html/venv/lib/python3.12/site-packages/selenium/webdriver/common/devtools/v129/memory.pyto_jsonzPressureLevel.to_json   s    zz    c                     | |      S r    clsjsons     r   	from_jsonzPressureLevel.from_json   s    4yr   N)	__name__
__module____qualname____doc__MODERATECRITICALr   classmethodr   r   r   r   r	   r	      s,     HH  r   r	   c                  F    e Zd ZU dZded<   ded<   ded<   d Zed        Zy	)
SamplingProfileNodez
    Heap profile sample.
    floatsizetotalztyping.List[str]stackc                    t               }| j                  |d<   | j                  |d<   | j                  D cg c]  }| c}|d<   |S c c}w )Nr#   r$   r%   )dictr#   r$   r%   r   r   is      r   r   zSamplingProfileNode.to_json*   sE    vyyV

W$(JJ/q/W 0s   	Ac           
          | t        |d         t        |d         |d   D cg c]  }t        |       c}      S c c}w )Nr#   r$   r%   )r#   r$   r%   )r"   strr   r   r)   s      r   r   zSamplingProfileNode.from_json1   sB    tF|$W&#'=1a3q61
 	
 2s   >Nr   r   r   r   __annotations__r   r   r   r   r   r   r!   r!      s6     K L  
 
r   r!   c                  <    e Zd ZU dZded<   ded<   d Zed        Zy)	SamplingProfilez(
    Array of heap profile samples.
    z typing.List[SamplingProfileNode]samplesztyping.List[Module]modulesc                    t               }| j                  D cg c]  }|j                          c}|d<   | j                  D cg c]  }|j                          c}|d<   |S c c}w c c}w )Nr1   r2   )r'   r1   r   r2   r(   s      r   r   zSamplingProfile.to_jsonC   sR    v04=1199;=Y04=1199;=Y >=s   A#A(c           	          | |d   D cg c]  }t         j                  |       c}|d   D cg c]  }t        j                  |       c}      S c c}w c c}w )Nr1   r2   )r1   r2   )r!   r   Moduler,   s      r   r   zSamplingProfile.from_jsonI   sP    ?CIO!(2215O26y/BQV%%a(B
 	
OBs
   AA
Nr-   r   r   r   r0   r0   :   s.     .-   
 
r   r0   c                  P    e Zd ZU dZded<   ded<   ded<   ded<   d Zed	        Zy
)r5   z'
    Executable module information
    r+   nameuuidbase_addressr"   r#   c                    t               }| j                  |d<   | j                  |d<   | j                  |d<   | j                  |d<   |S )Nr7   r8   baseAddressr#   )r'   r7   r8   r9   r#   )r   r   s     r   r   zModule.to_jsonc   sE    vyyVyyV"//]yyVr   c           	     z     | t        |d         t        |d         t        |d         t        |d               S )Nr7   r8   r;   r#   )r7   r8   r9   r#   )r+   r"   r   s     r   r   zModule.from_jsonk   s@    T&\"T&\"T-01tF|$	
 	
r   Nr-   r   r   r   r5   r5   Q   s=     I I  K 
 
r   r5   c               #  l   K   ddi} | }t        |d         t        |d         t        |d         fS w)z


    :returns: A tuple with the following items:

        0. **documents** - 
        1. **nodes** - 
        2. **jsEventListeners** - 
    methodzMemory.getDOMCounters	documentsnodesjsEventListeners)intcmd_dictr   s     r   get_dom_countersrE   u   sO      	)H >DDDMD#$% s   24c               #     K   ddi} | }y w)Nr>   zMemory.prepareForLeakDetectionr   rC   s     r   prepare_for_leak_detectionrG      s      	2H >D   
c               #     K   ddi} | }yw)z8
    Simulate OomIntervention by purging V8 memory.
    r>   z$Memory.forciblyPurgeJavaScriptMemoryNr   rC   s     r   !forcibly_purge_java_script_memoryrJ      s     
 	8H >DrH   c              #  <   K   t               }| |d<   d|d}|}yw)z
    Enable/disable suppressing memory pressure notifications in all processes.

    :param suppressed: If true, memory pressure notifications will be suppressed.
    
suppressedz)Memory.setPressureNotificationsSuppressedr>   paramsNr'   )rL   rN   rD   r   s       r   %set_pressure_notifications_suppressedrP      s/      &F%F<=H >Ds   c              #  X   K   t               }| j                         |d<   d|d}|}yw)z
    Simulate a memory pressure notification in all processes.

    :param level: Memory pressure level of the notification.
    levelz#Memory.simulatePressureNotificationrM   N)r'   r   )rR   rN   rD   r   s       r   simulate_pressure_notificationrS      s4      &FmmoF7O7H >Ds   (*c              #  N   K   t               }| | |d<   |||d<   d|d}|}yw)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   )sampling_intervalsuppress_randomnessrN   rD   r   s        r   start_samplingrY      sG      &F$%6!"&':#$(H >Ds   #%c               #     K   ddi} | }yw)z0
    Stop collecting native memory profile.
    r>   zMemory.stopSamplingNr   rC   s     r   stop_samplingr[      s     
 	'H >DrH   c               #  J   K   ddi} | }t         j                  |d         S w)zr
    Retrieve native memory allocations profile
    collected since renderer process startup.

    :returns: 
    r>   z Memory.getAllTimeSamplingProfileprofiler0   r   rC   s     r   get_all_time_sampling_profiler_      3      	4H >D$$T)_55   !#c               #  J   K   ddi} | }t         j                  |d         S w)zq
    Retrieve native memory allocations profile
    collected since browser process startup.

    :returns: 
    r>   z Memory.getBrowserSamplingProfiler]   r^   rC   s     r   get_browser_sampling_profilerc      r`   ra   c               #  J   K   ddi} | }t         j                  |d         S w)zu
    Retrieve native memory allocations profile collected since last
    ``startSampling`` call.

    :returns: 
    r>   zMemory.getSamplingProfiler]   r^   rC   s     r   get_sampling_profilere      s3      	-H >D$$T)_55ra   )returnzGtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[int, int, int]])rf   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])rL   boolrf   rg   )rR   r	   rf   rg   )NN)rW   ztyping.Optional[int]rX   ztyping.Optional[bool]rf   rg   )rf   z;typing.Generator[T_JSON_DICT, T_JSON_DICT, SamplingProfile])
__future__r   utilr   r   dataclassesr   enumtypingEnumr	   r!   r0   r5   rE   rG   rJ   rP   rS   rY   r[   r_   rc   re   r   r   r   <module>ro      s    # * !  DII  
 
 
: 
 
 
,  
  
  
F*	7"	7$ 3759/2 
8,666r   