a
    $ñ»j‰  ã                   @  sð   d dl mZ ddlmZ d dlZd dlZd dlmZ G dd„ dejƒZ	eG dd	„ d	ƒƒZ
d
d
ddœdd„Zd*d
dddœdd„Zddœdd„Zd
ddœdd„Zd+d
ddddœdd„Zd
dd ddœd!d"„Zd
ddd#œd$d%„Zd
dd&dd'œd(d)„ZdS ),é    )Úannotationsé   )ÚT_JSON_DICTN)Ú	dataclassc                   @  sB   e Zd ZdZdZdZdZdZddœdd	„Ze	dd d
œdd„ƒZ
dS )ÚStorageAreazStorage areas.ÚsessionÚlocalZsyncZmanagedÚstr©Úreturnc                 C  s   | j S ©N)Úvalue)Úself© r   ú6E:\soccer\ml_env\Lib\site-packages\mycdp/extensions.pyÚto_json   s    zStorageArea.to_json©Újsonr   c                 C  s   | |ƒS r   r   ©Úclsr   r   r   r   Ú	from_json   s    zStorageArea.from_jsonN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ZSESSIONZLOCALZSYNCZMANAGEDr   Ú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ed< ded< d	d
œdd„Zed	d dœdd„ƒZdS )ÚExtensionInfoz(Detailed information about an extension.r	   Úid_ÚnameÚversionÚpathÚboolÚenabledr   r
   c                 C  s<   t ƒ }| j|d< | j|d< | j|d< | j|d< | j|d< |S )NÚidr   r   r    r"   )Údictr   r   r   r    r"   )r   r   r   r   r   r   ,   s    




zExtensionInfo.to_jsonr   c              	   C  sD   | t | d¡ƒt | d¡ƒt | d¡ƒt | d¡ƒt| d¡ƒd�S )Nr#   r   r   r    r"   )r   r   r   r    r"   )r	   Úgetr!   r   r   r   r   r   5   s    ûzExtensionInfo.from_jsonN)r   r   r   r   Ú__annotations__r   r   r   r   r   r   r   r      s   
	r   r	   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])r   Ú	target_idr   c                 c  s*   t ƒ }| |d< ||d< d|dœ}|V }dS )a-  
    Runs an extension default action.
    Available if the client is connected using the --remote-debugging-pipe
    flag and the --enable-unsafe-extension-debugging flag is set.
    :param id_: Extension id.
    :param target_id:
     A tab target ID to trigger the default extension action on.
    r#   ZtargetIdzExtensions.triggerAction©ÚmethodÚparamsN©r$   )r   r'   r*   Úcmd_dictr   r   r   r   Útrigger_action@   s    þr-   ztyping.Optional[bool]z/typing.Generator[T_JSON_DICT, T_JSON_DICT, str])r    Úenable_in_incognitor   c                 c  s<   t ƒ }| |d< |dur||d< d|dœ}|V }t| d¡ƒS )aÄ  
    Installs an unpacked extension from the filesystem similar to
    --load-extension CLI flags. Returns extension ID once the extension
    has been installed. Available if the client is connected using the
    --remote-debugging-pipe flag and the --enable-unsafe-extension-debugging
    flag is set.
    :param path: Absolute file path.
    :param enable_in_incognito: *(Optional)* Enable the extension in incognito
    :returns: Extension id.
    r    NZenableInIncognitozExtensions.loadUnpackedr(   r#   )r$   r	   r%   )r    r.   r*   r,   r   r   r   r   Úload_unpackedU   s    þr/   zFtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[ExtensionInfo]]r
   c                  c  s    ddi} | V }dd„ |d D ƒS )z¾
    Gets a list of all unpacked extensions.
    Available if the client is connected using the --remote-debugging-pipe flag
    and the --enable-unsafe-extension-debugging flag is set.
    r)   zExtensions.getExtensionsc                 S  s   g | ]}t  |¡‘qS r   )r   r   ©Ú.0Úir   r   r   Ú
<listcomp>z   ó    z"get_extensions.<locals>.<listcomp>Ú
extensionsr   )r,   r   r   r   r   Úget_extensionsn   s    	ÿr6   )r   r   c                 c  s"   t ƒ }| |d< d|dœ}|V }dS )zò
    Uninstalls an unpacked extension (others not supported) from the profile.
    Available if the client is connected using the --remote-debugging-pipe flag
    and the --enable-unsafe-extension-debugging.
    :param id_: Extension id.
    r#   zExtensions.uninstallr(   Nr+   )r   r*   r,   r   r   r   r   Ú	uninstall}   s    þr7   z!typing.Optional[typing.List[str]]z0typing.Generator[T_JSON_DICT, T_JSON_DICT, dict])r   Ústorage_areaÚkeysr   c                 c  sR   t ƒ }| |d< | ¡ |d< |dur4dd„ |D ƒ|d< d|dœ}|V }t | d	¡ƒS )
a  
    Gets data from extension storage in the given `storageArea`.
    If ``keys`` is specified, these are used to filter the result.
    :param id_: ID of extension.
    :param storage_area: StorageArea to retrieve data from.
    :param keys: *(Optional)* Keys to retrieve.
    r#   ÚstorageAreaNc                 S  s   g | ]}|‘qS r   r   r0   r   r   r   r3   �   r4   z%get_storage_items.<locals>.<listcomp>r9   zExtensions.getStorageItemsr(   Údata)r$   r   r%   ©r   r8   r9   r*   r,   r   r   r   r   Úget_storage_items�   s    þr=   ztyping.List[str]c                 c  s@   t ƒ }| |d< | ¡ |d< dd„ |D ƒ|d< d|dœ}|V }dS )	zÇ
    Removes `keys` from extension storage in the given `storageArea`.
    :param id_: ID of extension.
    :param storage_area: StorageArea to remove data from.
    :param keys: Keys to remove.
    r#   r:   c                 S  s   g | ]}|‘qS r   r   r0   r   r   r   r3   ²   r4   z(remove_storage_items.<locals>.<listcomp>r9   zExtensions.removeStorageItemsr(   N©r$   r   r<   r   r   r   Úremove_storage_items¦   s    	þr?   )r   r8   r   c                 c  s.   t ƒ }| |d< | ¡ |d< d|dœ}|V }dS )z›
    Clears extension storage in the given ``storageArea``.
    :param id_: ID of extension.
    :param storage_area: StorageArea to remove data from.
    r#   r:   zExtensions.clearStorageItemsr(   Nr>   )r   r8   r*   r,   r   r   r   r   Úclear_storage_itemsº   s    þr@   r$   )r   r8   Úvaluesr   c                 c  s6   t ƒ }| |d< | ¡ |d< ||d< d|dœ}|V }dS )a  
    Sets ``values`` in extension storage in the given ``storageArea``.
    The provided ``values`` will be merged with existing values
    in the storage area.
    :param id_: ID of extension.
    :param storage_area: StorageArea to set data in.
    :param values: Values to set.
    r#   r:   rA   zExtensions.setStorageItemsr(   Nr>   )r   r8   rA   r*   r,   r   r   r   r   Úset_storage_itemsÌ   s    þrB   )N)N)Ú
__future__r   Úutilr   ÚenumÚtypingÚdataclassesr   ÚEnumr   r   r-   r/   r6   r7   r=   r?   r@   rB   r   r   r   r   Ú<module>   s"   ! ÿ ý