o
    ß­j=	  ã                   @  s†   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 dd	lmZ dd
lmZ G dd„ dejƒZdS )zThe compile command.é    )Úannotations)ÚSequence)Úcommand)Úcommand_utils)Úipython_env)Úmodel_registry)Úparsed_args_lib)Úpost_process_utils)Úpy_utilsc                      s:   e Zd ZdZ	dd‡ fdd„Zddd„Zddd„Z‡  ZS )ÚCompileCommandz(Implementation of the "compile" command.NÚmodelsúmodel_registry.ModelRegistryÚenvúipython_env.IPythonEnv | Nonec                   s   t ƒ  ¡  || _|| _dS )zyConstructor.

        Args:
          models: ModelRegistry instance.
          env: The IPythonEnv environment.
        N)ÚsuperÚ__init__Ú_modelsÚ_ipython_env)Úselfr   r   ©Ú	__class__© úe/var/www/html/CropPilot/venv/lib/python3.10/site-packages/google/generativeai/notebook/compile_cmd.pyr      s   

zCompileCommand.__init__Úparsed_argsúparsed_args_lib.ParsedArgsÚcell_contentÚstrÚpost_processing_fnsú2Sequence[post_process_utils.ParsedPostProcessExpr]Úreturnc                 C  s2   t j| j| j|||d�}t |j|¡ d |j¡S )N)r   r   r   r   r   z%Saved function to Python variable: {})r   Úcreate_llm_functionr   r   r
   Ú
set_py_varÚcompile_save_nameÚformat)r   r   r   r   Úllm_fnr   r   r   Úexecute.   s   ûzCompileCommand.executeÚtokensúSequence[Sequence[str]]c                 C  s
   t  |¡S ©N)r	   Úresolve_post_processing_tokens)r   r&   r   r   r   Úparse_post_processing_tokens?   s   
z+CompileCommand.parse_post_processing_tokensr(   )r   r   r   r   )r   r   r   r   r   r   r   r   )r&   r'   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r%   r*   Ú__classcell__r   r   r   r   r      s    ý
r   N)r.   Ú
__future__r   Útypingr   Úgoogle.generativeai.notebookr   r   r   r   r   r	   r
   ÚCommandr   r   r   r   r   Ú<module>   s   