Your IP : 3.14.254.103


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/tomlkit/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/tomlkit/__pycache__/toml_file.cpython-311.pyc

�

��bg?���ddlZddlZddlmZddlmZddlmZerddlm	Z
nddlmZeeej
fZ
Gd�d��ZdS)	�N)�
TYPE_CHECKING)�loads)�TOMLDocument)�StrPath)�Unionc�>�eZdZdZdeddfd�Zdefd�Zdeddfd�ZdS)	�TOMLFilezI
    Represents a TOML file.

    :param path: path to the TOML file
    �path�returnNc�6�||_tj|_dS)N)�_path�os�linesep�_linesep)�selfr
s  �b/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/tomlkit/toml_file.py�__init__zTOMLFile.__init__s����
��
��
�
�
�c�P�t|jdd���5}|���}|�d��}|dkr8|�d��}||krd|_n|dkrd|_nd|_t|��cddd��S#1swxYwYdS)	zGRead the file content as a :class:`tomlkit.toml_document.TOMLDocument`.�utf-8���encoding�newline�
r�
�mixedN)�openr
�read�countrr)r�f�content�num_newline�num_win_eols     rrz
TOMLFile.reads���
�$�*�w��
;�
;�
;�	"�q��f�f�h�h�G�"�-�-��-�-�K��Q���%�m�m�F�3�3���+�-�-�$*�D�M�M� �A�%�%�$(�D�M�M�$+�D�M���>�>�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	"�	"s�A6B�B�"B�datac�@�|���}|jdkr|�dd��}n!|jdkrtjdd|��}t|jddd���5}|�|��ddd��dS#1swxYwYdS)	z#Write the TOMLDocument to the file.rrz	(?<!\r)\n�wrrrN)�	as_stringr�replace�re�subrr
�write)rr%r"r!s    rr,zTOMLFile.write/s����.�.�"�"���=�D� � ��o�o�f�d�3�3�G�G�
�]�f�
$�
$��f�\�6�7�;�;�G�
�$�*�c�G�R�
@�
@�
@�	�A�
�G�G�G����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�0B�B�B)	�__name__�
__module__�__qualname__�__doc__�_StrPathrrrr,�rrr	r	s}��������#�X�#�$�#�#�#�#�"�l�"�"�"�"�$�,��4������rr	)rr*�typingr�tomlkit.apir�tomlkit.toml_documentr�	_typeshedrr1r�str�PathLiker	r2rr�<module>r9s���	�	�	�	�	�	�	�	� � � � � � �������.�.�.�.�.�.��'�-�-�-�-�-�-�-��������S�"�+�%�&�H�(�(�(�(�(�(�(�(�(�(r

?>