o
    iv                     @   s   d dl mZ d dlmZ ddlmZmZ ddlmZm	Z	 ddl
mZmZ ddlmZ e	d	ed
ddee ddddfdedefddZdddededefddZdS )    )Path)msg   )load_project_configlogger   )Argapp)RemoteStorageget_command_hash)update_lockfilepulldefaultzName or path of remote storage)helpzELocation of project directory. Defaults to current working directory.TF)r   exists	file_okayremoteproject_dirc                 C   s6   t || D ]\}}|durtd| d|  qdS )ap  Retrieve available precomputed outputs from a remote storage.
    You can alias remotes in your project.yml by mapping them to storage paths.
    A storage can be anything that the smart_open library can upload to, e.g.
    AWS, Google Cloud Storage, SSH, local directories etc.

    DOCS: https://github.com/explosion/weasel/tree/main/docs/cli.md#arrow_down-push
    NzPulled z from )project_pullr   good)r   r   urloutput_path r   C/home/ubuntu/.local/lib/python3.10/site-packages/weasel/cli/pull.pyproject_pull_cli   s
   r   )verboser   c                #   sF   t  }||di v r|d | }t |}t|dg }|rtt|D ]r\}}td|d   fdd|dg D }tdd	 |D rtd
d
||d }	|dg D ]}
|j	|
|	d}td||
|	 ||
fV  qY fdd|dg D }tdd	 |D rt
 | ||  ntd|d  q(d S |s"d S d S )NremotescommandszCMD: %s.namec                       g | ]} | qS r   r   .0depr   r   r   
<listcomp>,       z project_pull.<locals>.<listcomp>depsc                 s       | ]}|  V  qd S Nr   r    r   r   r   	<genexpr>-       zproject_pull.<locals>.<genexpr> scriptoutputs)command_hashz#URL: %s for %s with command hash %sc                    r   r   r   )r!   outr#   r   r   r$   9   r%   c                 s   r'   r(   r)   )r!   locr   r   r   r*   :   r+   z(Dependency missing. Skipping %s outputs.)r   getr
   list	enumerater   debugallr   r   r   pop)r   r   r   configstorager   icmdr&   cmd_hashr   r   out_locsr   r#   r   r      s:   


r   N)pathlibr   wasabir   utilr   r   mainr   r	   remote_storager
   r   runr   commandcwdstrr   boolr   r   r   r   r   <module>   s    
 