o
    衡i '                     @  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	eG dd	 d	Z
eG d
d dZeG dd dZG dd dejZG dd dej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S )%    )annotations   )event_classT_JSON_DICT)	dataclassNc                   @  sn   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d Zedd Z	d
S )	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                 C  sn   t  }| j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | jd ur+| j|d< | jd ur5| j|d< |S )	NvendorIddeviceIdvendorStringdeviceStringdriverVendordriverVersionsubSysIdr   )	dictr	   r
   r   r   r   r   r   r   selfjson r   /var/www/html/asbeauty/laura_geller_scraping/env/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v144/system_info.pyto_json*   s   









zGPUDevice.to_jsonc                 C  st   | t |d t |d t|d t|d t|d t|d d|v r)t |d nd d|v r6t |d d	S d d	S )
Nr   r   r   r   r   r   r   r   )r	   r
   r   r   r   r   r   r   )r   r   clsr   r   r   r   	from_json8   s   





zGPUDevice.from_json)
__name__
__module____qualname____doc____annotations__r   r   r   classmethodr"   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 )
SizezA
    Describes the width and height dimensions of an entity.
    intwidthheightc                 C  s   t  }| j|d< | j|d< |S )Nr+   r,   )r   r+   r,   r   r   r   r   r   Q   s   

zSize.to_jsonc                 C  s   | t |d t |d dS )Nr+   r,   )r+   r,   )r*   r    r   r   r   r"   W   s   

zSize.from_jsonNr#   r$   r%   r&   r'   r   r(   r"   r   r   r   r   r)   F   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 ) VideoDecodeAcceleratorCapabilityzo
    Describes a supported video decoding profile with its associated minimum and
    maximum resolutions.
    r   profiler)   max_resolutionmin_resolutionc                 C  s0   t  }| j|d< | j |d< | j |d< |S )Nr/   maxResolutionminResolution)r   r/   r0   r   r1   r   r   r   r   r   n   s
   
z(VideoDecodeAcceleratorCapability.to_jsonc                 C  s*   | t |d t|d t|d dS )Nr/   r2   r3   )r/   r0   r1   )r   r)   r"   r    r   r   r   r"   u   s
   
z*VideoDecodeAcceleratorCapability.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 ) VideoEncodeAcceleratorCapabilityzx
    Describes a supported video encoding profile with its associated maximum
    resolution and maximum framerate.
    r   r/   r)   r0   r*   max_framerate_numeratormax_framerate_denominatorc                 C  s6   t  }| j|d< | j |d< | j|d< | j|d< |S )Nr/   r2   maxFramerateNumeratormaxFramerateDenominator)r   r/   r0   r   r5   r6   r   r   r   r   r      s   


z(VideoEncodeAcceleratorCapability.to_jsonc                 C  s2   | t |d t|d t|d t|d dS )Nr/   r2   r7   r8   )r/   r0   r5   r6   )r   r)   r"   r*   r    r   r   r   r"      s   


z*VideoEncodeAcceleratorCapability.from_jsonNr-   r   r   r   r   r4   ~   s   
 r4   c                   @  0   e Zd ZdZdZdZdZdd Zedd Z	d	S )
SubsamplingFormatz>
    YUV subsampling type of the pixels of a given image.
    yuv420yuv422yuv444c                 C     | j S Nvaluer   r   r   r   r         zSubsamplingFormat.to_jsonc                 C     | |S r?   r   r    r   r   r   r"         zSubsamplingFormat.from_jsonN)
r#   r$   r%   r&   YUV420YUV422YUV444r   r(   r"   r   r   r   r   r:          r:   c                   @  r9   )
	ImageTypez(
    Image format of a given image.
    jpegwebpunknownc                 C  r>   r?   r@   rB   r   r   r   r      rC   zImageType.to_jsonc                 C  rD   r?   r   r    r   r   r   r"      rE   zImageType.from_jsonN)
r#   r$   r%   r&   JPEGWEBPUNKNOWNr   r(   r"   r   r   r   r   rJ      rI   rJ   c                   @  s^   e Zd ZU dZded< ded< ded< ded	< d
Zded< d
Zded< dd Zedd Z	d
S )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_encodingNztyping.Optional[dict]aux_attributesfeature_statusc                 C  s   t  }dd | jD |d< dd | jD |d< dd | jD |d< dd | jD |d	< | jd ur5| j|d
< | jd ur?| j|d< |S )Nc                 S     g | ]}|  qS r   r   .0ir   r   r   
<listcomp>       z#GPUInfo.to_json.<locals>.<listcomp>rR   c                 S  s   g | ]}|qS r   r   rZ   r   r   r   r]      s    driverBugWorkaroundsc                 S  rX   r   rY   rZ   r   r   r   r]      r^   videoDecodingc                 S  rX   r   rY   rZ   r   r   r   r]      r^   videoEncodingauxAttributesfeatureStatus)r   rR   rS   rT   rU   rV   rW   r   r   r   r   r      s   



zGPUInfo.to_jsonc              	   C  sx   | dd |d D dd |d D dd |d D dd |d	 D d
|v r+t |d
 nd d|v r8t |d dS d dS )Nc                 S     g | ]}t |qS r   )r   r"   rZ   r   r   r   r]          z%GPUInfo.from_json.<locals>.<listcomp>rR   c                 S  s   g | ]}t |qS r   )r   rZ   r   r   r   r]      r^   r_   c                 S  rd   r   )r.   r"   rZ   r   r   r   r]      re   r`   c                 S  rd   r   )r4   r"   rZ   r   r   r   r]      re   ra   rb   rc   )rR   rS   rT   rU   rV   rW   )r   r    r   r   r   r"      s   zGPUInfo.from_json)
r#   r$   r%   r&   r'   rV   rW   r   r(   r"   r   r   r   r   rQ      s   
 rQ   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 )ProcessInfoz"
    Represents process info.
    r   type_r*   id_r   cpu_timec                 C  s(   t  }| j|d< | j|d< | j|d< |S )NtypeidcpuTime)r   rg   rh   ri   r   r   r   r   r     s
   


zProcessInfo.to_jsonc                 C  s&   | t |d t|d t|d dS )Nrj   rk   rl   )rg   rh   ri   )r   r*   r   r    r   r   r   r"     s
   


zProcessInfo.from_jsonNr-   r   r   r   r   rf      s   
 rf   returnPtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[GPUInfo, str, str, str]]c                  c  s>    ddi} | V }t |d t|d t|d t|d fS )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)rQ   r"   r   cmd_dictr   r   r   r   get_info  s   


rv   feature_stater   0typing.Generator[T_JSON_DICT, T_JSON_DICT, bool]c                 c  s,    t  }| |d< d|d}|V }t|d S )z`
    Returns information about the feature state.

    :param feature_state:
    :returns: 
    featureStatezSystemInfo.getFeatureState)ro   paramsfeatureEnabled)r   bool)rw   rz   ru   r   r   r   r   get_feature_state(  s   	r}   Dtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[ProcessInfo]]c                  c  s"    ddi} | V }dd |d D S )zj
    Returns information about all running processes.

    :returns: An array of process info blocks.
    ro   zSystemInfo.getProcessInfoc                 S  rd   r   )rf   r"   rZ   r   r   r   r]   E  re   z$get_process_info.<locals>.<listcomp>processInfor   rt   r   r   r   get_process_info;  s
   r   )rm   rn   )rw   r   rm   rx   )rm   r~   )
__future__r   utilr   r   dataclassesr   enumtypingr   r)   r.   r4   Enumr:   rJ   rQ   rf   rv   r}   r   r   r   r   r   <module>   s,   8$.

