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/config/__pycache__/environment.cpython-310.pyc
o

S�`�@stddlZddlZddlZddlZddlmZddlmZddlmZe�	e
�Zdd�Zdd
d�Z
Gdd
�d
e�ZdS)�N�)�IS_WINDOWS_PLATFORM�)�ConfigurationError)�EnvFileNotFoundcCs^t|t�r|�dd�}d}}d|vr|�dd�\}}n|}t�d|�r+td�|���||fS)Nzutf-8�replace�=rz\sz:environment variable name '{}' may not contain whitespace.)�
isinstance�bytes�decode�split�re�searchr�format)�env�key�value�r�</usr/lib/python3/dist-packages/compose/config/environment.py�	split_envs
�rTcCsrtj�|�s
td�|���tj�|�std�|���tj|d|d�}|��D]\}}|r.|n|�	dd�||<q&|S)zA
    Read in a line delimited file of environment variables.
    zCouldn't find env file: {}z{} is not a file.z	utf-8-sig)�dotenv_path�encoding�interpolate�$z$$)
�os�path�existsrr�isfile�dotenv�
dotenv_values�itemsr)�filenamerr�k�vrrr�env_vars_from_filesr$csdeZdZ�fdd�Zeddd��Zedd��Z�fdd	�Z�fd
d�Z�fdd
�Z	ddd�Z
�ZS)�Environmentcs"t�j|i|��g|_d|_dS)NF)�super�__init__�missing_keys�silent)�self�args�kwargs��	__class__rrr'-s
zEnvironment.__init__Ncs&���fdd�}|�}|�tj�|S)Ncsf��}�dur	|S�rtj�t����}�t|��Stj��d�}z�t|��WSty2Y|Sw)Nz.env)rr�join�getcwdr$r)�result�
env_file_path��base_dir�cls�env_filerr�_initialize4s�z.Environment.from_env_file.<locals>._initialize)�updater�environ)r5r4r6r7�instancerr3r�
from_env_file2szEnvironment.from_env_filecCsF|�}|��D]\}}|dur|tjvrtj|||<q|||<q|S�N)r rr9)r5�parsed_env_optsr1r"r#rrr�from_command_lineGs
zEnvironment.from_command_linecs~zt��|�WSty>tr%zt��|���WYSty$Ynw|js;||jvr;t�d�	|��|j�
|�YdSw)Nz9The {} variable is not set. Defaulting to a blank string.�)r&�__getitem__�KeyErrorr�upperr)r(�log�warningr�append)r*rr-rrr@Ss"���zEnvironment.__getitem__cs(t��|�}tr|pt��|���S|Sr<)r&�__contains__rrB)r*rr1r-rrrFes
�zEnvironment.__contains__csFtrt��|t�j|��g|�Ri|���St�j|g|�Ri|��Sr<)rr&�getrB)r*rr+r,r-rrrGms�zEnvironment.getFcCs&|�|�}|s	|S|��dvrdSdS)N)�0�falseFT)rG�lower)r*r�defaultrrrr�get_booleanus
zEnvironment.get_booleanr<)F)�__name__�
__module__�__qualname__r'�classmethodr;r>r@rFrGrL�
__classcell__rrr-rr%,s
r%)T)�loggingrr
r�constr�errorsrr�	getLoggerrMrCrr$�dictr%rrrr�<module>s