o
    M,h                     @  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ddl	m
Z
 ddl	mZ eG dd	 d	ZeG d
d dZeG dd dZdddZdS )    )annotations   )event_classT_JSON_DICT)	dataclassN)network)storagec                   @  sB   e Zd ZU ded< ded< ded< ded< dd	 Zed
d ZdS )Filestrnameznetwork.TimeSinceEpochlast_modifiedfloatsizetype_c                 C  s6   t  }| j|d< | j |d< | j|d< | j|d< |S )Nr   lastModifiedr   type)dictr   r   to_jsonr   r   selfjson r   /var/www/www-root/data/www/bot.pdev.uz/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v140/file_system.pyr      s   


zFile.to_jsonc                 C  s4   | t |d tj|d t|d t |d dS )Nr   r   r   r   )r   r   r   r   )r
   r   TimeSinceEpoch	from_jsonr   clsr   r   r   r   r   $   s   


zFile.from_jsonN__name__
__module____qualname____annotations__r   classmethodr   r   r   r   r   r	      s   
 r	   c                   @  s:   e Zd ZU ded< ded< ded< dd Zed	d
 ZdS )	Directoryr
   r   typing.List[str]nested_directoriesztyping.List[File]nested_filesc                 C  s<   t  }| j|d< dd | jD |d< dd | jD |d< |S )Nr   c                 S     g | ]}|qS r   r   .0ir   r   r   
<listcomp>:       z%Directory.to_json.<locals>.<listcomp>nestedDirectoriesc                 S  s   g | ]}|  qS r   )r   r(   r   r   r   r+   ;       nestedFiles)r   r   r%   r&   r   r   r   r   r   7   s
   
zDirectory.to_jsonc                 C  s2   | t |d dd |d D dd |d D dS )Nr   c                 S     g | ]}t |qS r   r
   r(   r   r   r   r+   B   r.   z'Directory.from_json.<locals>.<listcomp>r-   c                 S  s   g | ]}t |qS r   )r	   r   r(   r   r   r   r+   C   s    r/   )r   r%   r&   r1   r   r   r   r   r   >   s
   
zDirectory.from_jsonNr   r   r   r   r   r#   .   s   
 r#   c                   @  s>   e Zd ZU ded< ded< dZded< dd	 Zed
d ZdS )BucketFileSystemLocatorzstorage.SerializedStorageKeystorage_keyr$   path_componentsNztyping.Optional[str]bucket_namec                 C  s@   t  }| j |d< dd | jD |d< | jd ur| j|d< |S )N
storageKeyc                 S  r'   r   r   r(   r   r   r   r+   U   r,   z3BucketFileSystemLocator.to_json.<locals>.<listcomp>pathComponents
bucketName)r   r3   r   r4   r5   r   r   r   r   r   R   s   

zBucketFileSystemLocator.to_jsonc                 C  s@   | t j|d dd |d D d|v rt|d dS d dS )Nr6   c                 S  r0   r   r1   r(   r   r   r   r+   ^   r.   z5BucketFileSystemLocator.from_json.<locals>.<listcomp>r7   r8   )r3   r4   r5   )r   SerializedStorageKeyr   r
   r   r   r   r   r   Z   s   z!BucketFileSystemLocator.from_json)r   r   r    r!   r5   r   r"   r   r   r   r   r   r2   G   s   
 r2   bucket_file_system_locatorreturn5typing.Generator[T_JSON_DICT, T_JSON_DICT, Directory]c                 c  s2    t  }|  |d< d|d}|V }t|d S )zd
    :param bucket_file_system_locator:
    :returns: Returns the directory object at the path.
    bucketFileSystemLocatorzFileSystem.getDirectory)methodparams	directory)r   r   r#   r   )r:   r?   cmd_dictr   r   r   r   get_directoryc   s   rB   )r:   r2   r;   r<   )
__future__r   utilr   r   dataclassesr   enumtyping r   r   r	   r#   r2   rB   r   r   r   r   <module>   s   