HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/compose/cli/__pycache__/command.cpython-310.pyc
o

S�`^�@s$ddlZddlZddlZddlmZddlmZddlmZddlmZddl	m
Z
dd	l	mZdd
l	mZddl
mZddlmZdd
lmZddlmZddlmZe�e�Zhd�Zd)dd�Zdd�Zdd�Zd)dd�Zdd�Zdd�Z			d*dd �Zd!d"�Zd#d$�Z d%d&�Z!d+d'd(�Z"dS),�N�)�errors�)�config)�parallel)�Environment)�LABEL_CONFIG_FILES)�LABEL_ENVIRONMENT_FILE)�LABEL_WORKING_DIR)�Project)�
get_client)�load_context)�make_context)�	UserError>�ps�rm�top�exec�kill�logs�stop�pause�start�events�restart�unpausec	
Cs�|pi}t|�}|�d�}t�|p||�}|�dd�tv|_t|�d}|�dd�}|r9t|�}|s9td�	|���|�dd�}|durT|rItd��|�
d�}t|||�}t|t
||�|�d�|�d	�||||�d
�|t||�d�
S)N�
--env-file�COMMANDz	--contextzContext '{}' not foundz--hostzL-H, --host and -c, --context are mutually exclusive. Only one should be set.�=z--project-namez	--verbose�--no-interpolate)�project_name�verbose�context�environment�override_dir�interpolate�environment_file�enabled_profiles)�get_project_dir�getr�
from_env_file�SILENT_COMMANDS�silent�set_parallel_limitr
r�format�lstripr�get_project�get_config_path_from_options�get_profiles_from_options)	�project_dir�options�additional_optionsr$r&r#r"�context_name�host�r8�5/usr/lib/python3/dist-packages/compose/cli/command.py�project_from_options$s@
�

�r:c
Csf|�d�}|r1zt|�}Wntyt�d�|�d����w|dkr)t�d��tj�|�dSdS)N�COMPOSE_PARALLEL_LIMITz7COMPOSE_PARALLEL_LIMIT must be an integer (found: "{}")rz-COMPOSE_PARALLEL_LIMIT can not be less than 2)	r)�int�
ValueErrorrrr.r�GlobalLimit�set_global_limit)r#�parallel_limitr8r8r9r-Js
���
�r-cCsBd}t|tj�}|r|ddkrdStj�|d�}|�d�p |S)Nr�-�.z--project-directory)r1�os�environ�path�dirnamer))r4r$�filesr8r8r9r(Zsr(cCsT|pi}t|�}|�d�}t�|p||�}t||�}t�t�||||�|�d��S)Nrr)r(r)rr*r1r�load�find)�base_dirr4r5r$r&r#�config_pathr8r8r9�get_config_from_optionsds


�rLcCsLdd�}|�d�}|r||�S|�d�}|r$|�dtj�}||�|��SdS)NcSsdd�|D�S)NcSs$g|]}t|t�r|�d�n|�qS)zutf-8)�
isinstance�bytes�decode)�.0�pr8r8r9�
<listcomp>rs$zGget_config_path_from_options.<locals>.unicode_paths.<locals>.<listcomp>r8)�pathsr8r8r9�
unicode_pathsqsz3get_config_path_from_options.<locals>.unicode_pathsz--file�COMPOSE_FILE�COMPOSE_PATH_SEPARATOR)r)rC�pathsep�split)r4r#rT�file_option�config_filesrWr8r8r9r1ps

r1cCs.|�d�}|r	|S|�d�}|r|�d�SgS)Nz	--profile�COMPOSE_PROFILES�,)r)rX)r4r#�profile_option�profilesr8r8r9r2s


r2FTc

Cs�|st�|�}t�||||�}
t|
j||�}t�|
|�}|�d�}t||||d�}
t	�
|
��t�|||
|�d�t
|
|�|	�Wd�S1sIwYdS)N�COMPOSE_API_VERSION)r!�versionr"r#�DOCKER_DEFAULT_PLATFORM)rr*rrI�get_project_name�working_dirrHr)rr�handle_connection_errorsr�from_config�execution_context_labels)r3rKr r!r"r#r$r%r&r'�config_details�config_data�api_version�clientr8r8r9r0�s*
�
��$�r0cCs\d�ttj�|j��g}t|�s|�d�tt	|���|dur,|�d�t
tj�|���|S)Nz{}={})r.r
rCrE�abspathrc�use_config_from_stdin�appendr�config_files_labelr	�normpath)rgr&�extra_labelsr8r8r9rf�s�
�rfcCs|jD]}|jsdSqdS)NTF)rZ�filename)rg�cr8r8r9rl�s

�rlcCsd�dd�|jD��S)Nr\css�|]
}tj�|j�VqdS�N)rCrErorq)rPrrr8r8r9�	<genexpr>�s�
�z%config_files_label.<locals>.<genexpr>)�joinrZ)rgr8r8r9rn�s
�rncCsTdd�}|st�|�}|p|�d�}|r||�Stj�tj�|��}|r(||�SdS)NcSst�dd|���S)Nz[^-_a-z0-9]�)�re�sub�lower)�namer8r8r9�normalize_name�sz(get_project_name.<locals>.normalize_name�COMPOSE_PROJECT_NAME�default)rr*r)rCrE�basenamerk)rcr r#r{�projectr8r8r9rb�s
rbrs)	NNFNNNTNN)NN)#�loggingrCrwrvrrr�config.environmentr�constrr	r
rr�
docker_clientrr
rr�	getLogger�__name__�logr+r:r-r(rLr1r2r0rfrlrnrbr8r8r8r9�<module>s>

&


�