HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/cloudinit/distros/parsers/__pycache__/sys_conf.cpython-310.pyc
o

�AdV�@sfddlZddlZddlmZddlZdZe�de�e�d�e�d�gZdd�ZGd	d
�d
ej	�Z
dS)�N)�StringIOz[a-zA-Z_]+[a-zA-Z0-9_]*z\$z\$[0-9#\?\-@\*]z\$\{.+\}cCstD]
}|�|�rdSqdS)NTF)�SHELL_VAR_REGEXES�search)�text�r�r�D/usr/lib/python3/dist-packages/cloudinit/distros/parsers/sys_conf.py�_contains_shell_variable$s

�r	c@s2eZdZdZdd�Zdd�Zddd�Zd	d
�ZdS)
�SysConfaA configobj.ConfigObj subclass specialised for sysconfig files.

    :param contents:
        The sysconfig file to parse, in a format accepted by
        ``configobj.ConfigObj.__init__`` (i.e. "a filename, file like object,
        or list of lines").
    cCstjj||ddd�dS)NFT)�
interpolation�write_empty_values)�	configobj�	ConfigObj�__init__)�self�contentsrrrr4s
�zSysConf.__init__cCsJ|��}t�}t|ttf�r|�d�|��|��S|�t|��|��S)N�
)�writer�
isinstance�list�tuple�join�str�getvalue)rr�out_contentsrrr�__str__9s�zSysConf.__str__Fcs�t|t�std|��t|�dkrdSd}|ddvr.|ddvr.t|�dkr-�fdd�}n0|���d	�r=|���d
�r=n!t�d|�r^t	|�r[t�d|�rT�fd
d�}n
�fdd�}nt
j}|sb|S||�S)NzValue "%s" is not a stringr�)�"�'����c���|�|S�N��_get_single_quote��x�rrr�<lambda>K�z SysConf._quote.<locals>.<lambda>z$(�)z	[\t\r\n ]z[\n\"']cr!r")�_get_triple_quoter%r'rrr(Yr)cr!r"r#r%r'rrr(]r))rr�
ValueError�len�strip�
startswith�endswith�rerr	�pipes�quote)r�value�	multiline�	quot_funcrr'r�_quoteBs.

��
�
�zSysConf._quotecCs<|�|�|��}|�|�|��}|�|�}d||d||fS)Nz
%s%s%s%s%s�=)�_decode_elementr7)r�
indent_string�entry�
this_entry�comment�val�key�cmntrrr�_write_linees
�zSysConf._write_lineN)F)�__name__�
__module__�__qualname__�__doc__rrr7rArrrrr
+s
	#r
)r2r1�iorr
�SHELL_VAR_RULE�compilerr	rr
rrrr�<module>s	�