a
    ŠxdÜ  ã                   @  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
 G dd„ deƒZdd	d
œdd„Zddddddœdd„Zdddœdd„ZdS )é    )Úannotationsé   )Úevent_classÚT_JSON_DICT)Ú	dataclassN)Úruntimec                      sB   e Zd ZdZddœdd„Zedd dœdd„ƒZ‡ fd	d
„Z‡  ZS )ÚStreamHandlez‹
    This is either obtained from another method or specified as ``blob:&lt;uuid&gt;`` where
    ``&lt;uuid&gt`` is an UUID of a Blob.
    Ústr)Úreturnc                 C  s   | S ©N© ©Úselfr   r   úb/var/www/html/Ranjet/env/lib/python3.9/site-packages/selenium/webdriver/common/devtools/v113/io.pyÚto_json   s    zStreamHandle.to_json)Újsonr
   c                 C  s   | |ƒS r   r   )Úclsr   r   r   r   Ú	from_json   s    zStreamHandle.from_jsonc                   s   d  tƒ  ¡ ¡S )NzStreamHandle({}))ÚformatÚsuperÚ__repr__r   ©Ú	__class__r   r   r      s    zStreamHandle.__repr__)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úclassmethodr   r   Ú__classcell__r   r   r   r   r      s
   r   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])Úhandler
   c                 c  s&   t ƒ }|  ¡ |d< d|dœ}|V }dS )zu
    Close the stream, discard any temporary backing storage.

    :param handle: Handle of the stream to close.
    r   zIO.close©ÚmethodÚparamsN)Údictr   )r   r"   Úcmd_dictr   r   r   r   Úclose   s    þr%   ztyping.Optional[int]zZtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[typing.Optional[bool], str, bool]])r   ÚoffsetÚsizer
   c                 c  sp   t ƒ }|  ¡ |d< |dur"||d< |dur2||d< d|dœ}|V }d|v rVt|d ƒndt|d ƒt|d	 ƒfS )
a†  
    Read a chunk of the stream

    :param handle: Handle of the stream to read.
    :param offset: *(Optional)* Seek to the specified offset before reading (if not specificed, proceed with offset following the last read). Some types of streams may only support sequential reads.
    :param size: *(Optional)* Maximum number of bytes to read (left upon the agent discretion if not specified).
    :returns: A tuple with the following items:

        0. **base64Encoded** - *(Optional)* Set if the data is base64-encoded
        1. **data** - Data that were read.
        2. **eof** - Set if the end-of-file condition occurred while reading.
    r   Nr&   r'   zIO.readr    Zbase64EncodedÚdataÚeof)r#   r   Úboolr	   )r   r&   r'   r"   r$   r   r   r   r   Úread0   s    þ

ýr+   zruntime.RemoteObjectIdz/typing.Generator[T_JSON_DICT, T_JSON_DICT, str])Ú	object_idr
   c                 c  s.   t ƒ }|  ¡ |d< d|dœ}|V }t|d ƒS )zª
    Return UUID of Blob object specified by a remote object id.

    :param object_id: Object id of a Blob object wrapper.
    :returns: UUID of the specified Blob.
    ZobjectIdzIO.resolveBlobr    Úuuid)r#   r   r	   )r,   r"   r$   r   r   r   r   Úresolve_blobS   s    	þr.   )NN)Ú
__future__r   Úutilr   r   Zdataclassesr   ÚenumÚtypingÚ r   r	   r   r%   r+   r.   r   r   r   r   Ú<module>   s     ý#