o
    Qhf                     @   sp   d dl Z d dl mZ d dlmZmZmZmZ d dlmZm	Z	 d dl
mZmZmZ d dlmZ G dd deZdS )	    N)Path)DictOptionalUnioncast)ChannelOwnerfrom_channel)Errormake_dirs_for_filepatch_error_message)Streamc                
       s   e Zd Zdededededdf
 fddZdejfd	d
Z	de
eef ddfddZdee fddZdddZdefddZdddZ  ZS )ArtifactparenttypeguidinitializerreturnNc                    s    t  |||| |d | _d S )NabsolutePath)super__init__absolute_path)selfr   r   r   r   	__class__ W/home/air/yokohama/back/venv/lib/python3.10/site-packages/playwright/_impl/_artifact.pyr      s   zArtifact.__init__c                    s.   | j jr	td| jdI d H }t|S )Nz\Path is not available when using browser_type.connect(). Use save_as() to save a local copy.pathAfterFinished)_connection	is_remoter	   _channelsendpathlibr   )r   pathr   r   r   path_after_finished   s   
zArtifact.path_after_finishedr"   c                    s:   t tt| jdI d H }t| ||I d H  d S )NsaveAsStream)r   r   r   r   r    r
   save_as)r   r"   streamr   r   r   r%   '   s   zArtifact.save_asc                    s   t | jdI d H S )Nfailure)r   r   r    r   r   r   r   r'   ,      zArtifact.failurec                       | j dI d H  d S )Ndeleter   r    r(   r   r   r   r+   /   r)   zArtifact.deletec                    s0   t tt| jdI d H }| I d H }|S )Nr&   )r   r   r   r   r    read_all)r   r&   bufferr   r   r   read_info_buffer2   s   zArtifact.read_info_bufferc                    r*   )Ncancelr,   r(   r   r   r   r0   7   r)   zArtifact.cancel)r   N)__name__
__module____qualname__r   strr   r   r!   r   r#   r   r%   r   r'   r+   bytesr/   r0   __classcell__r   r   r   r   r      s$    
r   )r!   r   typingr   r   r   r   playwright._impl._connectionr   r   playwright._impl._helperr	   r
   r   playwright._impl._streamr   r   r   r   r   r   <module>   s   