
    g,                       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             Z	e G d d	             Z
e G d
 d             Ze G d d             Z G d dej                        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y)    )annotations   )event_classT_JSON_DICT)	dataclassNc                      e Zd ZU dZded<   ded<   ded<   ded<   ded<   ded	<   d
Zded<   d
Zded<   d Zed        Z	y
)	GPUDevicez6
    Describes a single graphics processor (GPU).
    float	vendor_id	device_idstrvendor_stringdevice_stringdriver_vendordriver_versionNztyping.Optional[float]
sub_sys_idrevisionc                :   t               }| j                  |d<   | j                  |d<   | j                  |d<   | j                  |d<   | j
                  |d<   | j                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   |S )	NvendorIddeviceIdvendorStringdeviceStringdriverVendordriverVersionsubSysIdr   )	dictr   r   r   r   r   r   r   r   selfjsons     f/var/www/html/venv/lib/python3.12/site-packages/selenium/webdriver/common/devtools/v129/system_info.pyto_jsonzGPUDevice.to_json*   s    v>>Z>>Z#11^#11^#11^ $ 3 3_??&#D==$#}}D    c                    | t        |d         t        |d         t        |d         t        |d         t        |d         t        |d         d|v rt        |d         nd d|v rt        |d         	      S d 	      S )
Nr   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )r
   r   clsr   s     r    	from_jsonzGPUDevice.from_json8   s    D,-D,-d>23d>23d>23tO452<2DuT*-.$0:d0BU4
+,	
 		
 IM	
 		
r"   )
__name__
__module____qualname____doc____annotations__r   r   r!   classmethodr&    r"   r    r	   r	      sj           *.J&- (,H$+ 

 

r"   r	   c                  <    e Zd ZU dZded<   ded<   d Zed        Zy)SizezA
    Describes the width and height dimensions of an entity.
    intwidthheightc                V    t               }| j                  |d<   | j                  |d<   |S )Nr1   r2   )r   r1   r2   r   s     r    r!   zSize.to_jsonQ   s(    v

WXr"   c                F     | t        |d         t        |d               S )Nr1   r2   )r1   r2   )r0   r$   s     r    r&   zSize.from_jsonW   s'    d7m$tH~&
 	
r"   Nr'   r(   r)   r*   r+   r!   r,   r&   r-   r"   r    r/   r/   F   s.     J K 
 
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	)
 VideoDecodeAcceleratorCapabilityzo
    Describes a supported video decoding profile with its associated minimum and
    maximum resolutions.
    r   profiler/   max_resolutionmin_resolutionc                    t               }| j                  |d<   | j                  j                         |d<   | j                  j                         |d<   |S )Nr8   maxResolutionminResolution)r   r8   r9   r!   r:   r   s     r    r!   z(VideoDecodeAcceleratorCapability.to_jsonn   sM    v,,Y $ 3 3 ; ; =_ $ 3 3 ; ; =_r"   c                     | t        |d         t        j                  |d         t        j                  |d               S )Nr8   r<   r=   )r8   r9   r:   )r   r/   r&   r$   s     r    r&   z*VideoDecodeAcceleratorCapability.from_jsonu   s=    Y(>>$*?@>>$*?@
 	
r"   Nr5   r-   r"   r    r7   r7   _   s7    
 L   
 
r"   r7   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) VideoEncodeAcceleratorCapabilityzx
    Describes a supported video encoding profile with its associated maximum
    resolution and maximum framerate.
    r   r8   r/   r9   r0   max_framerate_numeratormax_framerate_denominatorc                    t               }| j                  |d<   | j                  j                         |d<   | j                  |d<   | j
                  |d<   |S )Nr8   r<   maxFramerateNumeratormaxFramerateDenominator)r   r8   r9   r!   rA   rB   r   s     r    r!   z(VideoEncodeAcceleratorCapability.to_json   sV    v,,Y $ 3 3 ; ; =_(,(D(D$%*.*H*H&'r"   c           	          | t        |d         t        j                  |d         t        |d         t        |d               S )Nr8   r<   rD   rE   )r8   r9   rA   rB   )r   r/   r&   r0   r$   s     r    r&   z*VideoEncodeAcceleratorCapability.from_json   sH    Y(>>$*?@$'-D(E$F&)$/H*I&J	
 	
r"   Nr5   r-   r"   r    r@   r@   ~   s=    
 L 
 ! "" 
 
r"   r@   c                  2    e Zd ZdZdZdZdZd Zed        Z	y)SubsamplingFormatz>
    YUV subsampling type of the pixels of a given image.
    yuv420yuv422yuv444c                    | j                   S Nvaluer   s    r    r!   zSubsamplingFormat.to_json       zzr"   c                     | |      S rM   r-   r$   s     r    r&   zSubsamplingFormat.from_json       4yr"   N)
r'   r(   r)   r*   YUV420YUV422YUV444r!   r,   r&   r-   r"   r    rH   rH      s1     FFF  r"   rH   c                  2    e Zd ZdZdZdZdZd Zed        Z	y)	ImageTypez(
    Image format of a given image.
    jpegwebpunknownc                    | j                   S rM   rN   rP   s    r    r!   zImageType.to_json   rQ   r"   c                     | |      S rM   r-   r$   s     r    r&   zImageType.from_json   rS   r"   N)
r'   r(   r)   r*   JPEGWEBPUNKNOWNr!   r,   r&   r-   r"   r    rX   rX      s1     DDG  r"   rX   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) ImageDecodeAcceleratorCapabilityz
    Describes a supported image decoding profile with its associated minimum and
    maximum resolutions and subsampling.
    rX   
image_typer/   max_dimensionsmin_dimensionsztyping.List[SubsamplingFormat]subsamplingsc                (   t               }| j                  j                         |d<   | j                  j                         |d<   | j                  j                         |d<   | j
                  D cg c]  }|j                          c}|d<   |S c c}w )N	imageTypemaxDimensionsminDimensionsrf   )r   rc   r!   rd   re   rf   r   r   is      r    r!   z(ImageDecodeAcceleratorCapability.to_json   s~    v OO335[ $ 3 3 ; ; =_ $ 3 3 ; ; =_595F5FG		G^  Hs   0Bc                     | t         j                  |d         t        j                  |d         t        j                  |d         |d   D cg c]  }t        j                  |       c}      S c c}w )Nrh   ri   rj   rf   )rc   rd   re   rf   )rX   r&   r/   rH   r%   r   rl   s      r    r&   z*ImageDecodeAcceleratorCapability.from_json   si     **4+<=>>$*?@>>$*?@BF~BVWQ+55a8W	
 	
 Xs   A3Nr5   r-   r"   r    rb   rb      s@    
    10 
 
r"   rb   c                  v    e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   dZded<   dZded<   d Zed        Z	y)GPUInfoz>
    Provides information about the GPU(s) on the system.
    ztyping.List[GPUDevice]devicesztyping.List[str]driver_bug_workaroundsz-typing.List[VideoDecodeAcceleratorCapability]video_decodingz-typing.List[VideoEncodeAcceleratorCapability]video_encodingz-typing.List[ImageDecodeAcceleratorCapability]image_decodingNztyping.Optional[dict]aux_attributesfeature_statusc                J   t               }| j                  D cg c]  }|j                          c}|d<   | j                  D cg c]  }| c}|d<   | j                  D cg c]  }|j                          c}|d<   | j
                  D cg c]  }|j                          c}|d<   | j                  D cg c]  }|j                          c}|d<   | j                  | j                  |d<   | j                  | j                  |d<   |S c c}w c c}w c c}w c c}w c c}w )Nrq   driverBugWorkaroundsvideoDecodingvideoEncodingimageDecodingauxAttributesfeatureStatus)	r   rq   r!   rr   rs   rt   ru   rv   rw   rk   s      r    r!   zGPUInfo.to_json  s    v04=1199;=Y373N3N'Oa'O#$6:6I6I J J_6:6I6I J J_6:6I6I J J_*$($7$7D!*$($7$7D! >'O J J Js   D	D!DD7D c                    | |d   D cg c]  }t         j                  |       c}|d   D cg c]  }t        |       c}|d   D cg c]  }t        j                  |       c}|d   D cg c]  }t        j                  |       c}|d   D cg c]  }t
        j                  |       c}d|v rt        |d         nd d|v rt        |d               S d       S c c}w c c}w c c}w c c}w c c}w )	Nrq   ry   rz   r{   r|   r}   r~   )rq   rr   rs   rt   ru   rv   rw   )r	   r&   r   r7   r@   rb   r   rn   s      r    r&   zGPUInfo.from_json  s    59)_EY((+E489O4P#QqCF#QSWXgShia<FFqIiSWXgShia<FFqIiSWXgShia<FFqIi:IT:Q4_ 56W[:IT:Q4_ 56
 	
 X\
 	
E#Qiiis   C#C(

C-/C2C7)
r'   r(   r)   r*   r+   rv   rw   r!   r,   r&   r-   r"   r    rp   rp      se     $# -, BA BA BA -1N)0 -1N)0 	
 	
r"   rp   c                  F    e Zd ZU dZded<   ded<   ded<   d Zed	        Zy
)ProcessInfoz"
    Represents process info.
    r   type_r0   id_r
   cpu_timec                t    t               }| j                  |d<   | j                  |d<   | j                  |d<   |S )NtypeidcpuTime)r   r   r   r   r   s     r    r!   zProcessInfo.to_json*  s5    vzzVXXT
--Yr"   c                `     | t        |d         t        |d         t        |d               S )Nr   r   r   )r   r   r   )r   r0   r
   r$   s     r    r&   zProcessInfo.from_json1  s2    d6l#DJ4	?+
 	
r"   Nr5   r-   r"   r    r   r     s5     J 
H O 
 
r"   r   c               #     K   ddi} | }t         j                  |d         t        |d         t        |d         t        |d         fS w)a  
    Returns information about the system.

    :returns: A tuple with the following items:

        0. **gpu** - Information about the GPUs on the system.
        1. **modelName** - A platform-dependent description of the model of the machine. On Mac OS, this is, for example, 'MacBookPro'. Will be the empty string if not supported.
        2. **modelVersion** - A platform-dependent description of the version of the machine. On Mac OS, this is, for example, '10.1'. Will be the empty string if not supported.
        3. **commandLine** - The command line string used to launch the browser. Will be the empty string if not supported.
    methodzSystemInfo.getInfogpu	modelNamemodelVersioncommandLine)rp   r&   r   )cmd_dictr   s     r    get_infor   :  sa      	&H >D$u+&DD !D 	 s   A	Ac              #  V   K   t               }| |d<   d|d}|}t        |d         S w)z`
    Returns information about the feature state.

    :param feature_state:
    :returns: 
    featureStatezSystemInfo.getFeatureState)r   paramsfeatureEnabled)r   bool)feature_stater   r   r   s       r    get_feature_stater   Q  s@      &F*F>.H >D%&''s   ')c               #  p   K   ddi} | }|d   D cg c]  }t         j                  |       c}S c c}w w)zj
    Returns information about all running processes.

    :returns: An array of process info blocks.
    r   zSystemInfo.getProcessInfoprocessInfo)r   r&   )r   r   rl   s      r    get_process_infor   d  sB      	-H >D.2=.ABK!!!$BBBs   616)returnzPtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[GPUInfo, str, str, str]])r   r   r   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, bool])r   zDtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[ProcessInfo]])
__future__r   utilr   r   dataclassesr   enumtypingr	   r/   r7   r@   EnumrH   rX   rb   rp   r   r   r   r   r-   r"   r    <module>r      s   # * !  
5
 5
 5
p 
 
 
0 
 
 
< !
 !
 !
H		  		    
  
  
F 0
 0
 0
f 
 
 
<.((	7(&
Cr"   