a
    $ñ»jQ  ã                   @  sv   d dl mZ d dlZddlm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 )é    )ÚannotationsNé   )ÚT_JSON_DICT)Ú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:<uuid>``
    where ``<uuid>`` is an UUID of a Blob.
    Ústr)Úreturnc                 C  s   | S ©N© ©Úselfr
   r
   ú.E:\soccer\ml_env\Lib\site-packages\mycdp/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 )zt
    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  sx   t ƒ }|  ¡ |d< |dur"||d< |dur2||d< d|dœ}|V }| dd¡dur^t|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 specified, 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   ÚgetÚboolr   )r   r$   r%   r    r"   r   r
   r
   r   Úread-   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_blobY   s    þr-   )NN)Ú
__future__r   ÚtypingÚutilr   Ú r   r   r   r#   r*   r-   r
   r
   r
   r   Ú<module>   s     ý,