관리-도구
편집 파일: hosts.cpython-39.opt-1.pyc
a ����'�Dg� ����������������������@���s*���d�dl�mZ�d�dlmZ�G�dd��d�ZdS�)�����)�StringIO)�chop_commentc�������������������@���sD���e�Zd�Zdd��Zdd��Zdd��Zdd��Zd d ��Zdd��Zd d��Z dS�)� HostsConfc�����������������C���s���||�_�d�|�_d�S��N)�_text� _contents)�self�text��r ����C/usr/lib/python3.9/site-packages/cloudinit/distros/parsers/hosts.py�__init__���s����zHostsConf.__init__c�����������������C���s���|�j�d�u�r|��|�j�|�_�d�S�r���)r����_parser���)r���r ���r ���r����parse���s���� zHostsConf.parsec�����������������C���sV���|������g�}|�jD�]>\}}|dkr|\}}t|�r|d�|kr|�|dd�����q|S�)N�optionr�������)r���r����len�append)r����ip�options� line_type� components�pieces�_tailr ���r ���r���� get_entry���s����zHostsConf.get_entryc�����������������C���sx���|������g�}|�jD�]Z\}}|dkr4|�||f��qq|\}}t|�rR|d�|krRqt|�r|�|t|�f��q||�_d�S�)Nr���r���)r���r���r���r����list)r���r���Z n_entriesr���r���r���r���r ���r ���r����del_entries"���s����zHostsConf.del_entriesc�����������������G���s,���|������|�j�d||gt|��dff��d�S�)Nr�����)r���r���r���r���)r���r���Zcanonical_hostname�aliasesr ���r ���r���� add_entry1���s�����zHostsConf.add_entryc�����������������C���sx���g�}|����D�]f}t|����s.|�d|gf��qt|���d�\}}t|�sZ|�d|gf��q|�d|�d��|gf��q|S�)N�blank�#�all_commentr���)� splitlinesr����stripr���r����split)r����contents�entries�line�head�tailr ���r ���r���r ���7���s����zHostsConf._parsec�����������������C���s����|������t��}|�jD�]z\}}|dkr8|�d|d����q|dkrT|�d|d����q|dkr|\}}dd��|D��}d�|�}|�d ||f���q|���S�) Nr���z%s r���r!���r���c�����������������S���s���g�|�]}t�|��qS�r ���)�str)�.0�pr ���r ���r���� <listcomp>N��������z%HostsConf.__str__.<locals>.<listcomp>� z%s%s )r���r���r����write�join�getvalue)r���r%���r���r���r���r)���r ���r ���r����__str__D���s���� zHostsConf.__str__N) �__name__� __module__�__qualname__r���r���r���r���r���r ���r3���r ���r ���r ���r���r������s��� r���N)�ior���Zcloudinit.distros.parsersr���r���r ���r ���r ���r����<module>���s���