
    Jc}                     H    d dl Z d dlZddlmZ ddlmZ  G d d          ZdS )    N   )loads)TOMLDocumentc                   >    e Zd ZdZdeddfdZdefdZdeddfdZdS )	TOMLFilezI
    Represents a TOML file.

    :param path: path to the TOML file
    pathreturnNc                 6    || _         t          j        | _        d S )N)_pathoslinesep_linesep)selfr   s     1lib/python3.11/site-packages/tomlkit/toml_file.py__init__zTOMLFile.__init__   s    

    c                 P   t          | j        dd          5 }|                                }|                    d          }|dk    r8|                    d          }||k    rd| _        n|dk    rd| _        nd| _        t          |          cddd           S # 1 swxY w Y   dS )	zGRead the file content as a :class:`tomlkit.toml_document.TOMLDocument`.utf-8 encodingnewline
r   
mixedN)openr   readcountr   r   )r   fcontentnum_newlinenum_win_eols        r   r   zTOMLFile.read   s    $*w;;; 	"qffhhG "----KQ ,%mmF33+- ,$*DMM A% ,$(DMM$+DM>>	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"s   A6BB"Bdatac                 @   |                                 }| j        dk    r|                    dd          }n!| j        dk    rt          j        dd|          }t          | j        ddd          5 }|                    |           ddd           dS # 1 swxY w Y   dS )	z#Write the TOMLDocument to the file.r   r   z	(?<!\r)\nwr   r   r   N)	as_stringr   replaceresubr   r   write)r   r#   r    r   s       r   r*   zTOMLFile.write%   s    .."" =D  	<oofd33GG]f$ 	<f\67;;G$*cGR@@@ 	AGGG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   0BBB)	__name__
__module____qualname____doc__strr   r   r   r*    r   r   r   r      s}         #S #T # # # #"l " " " "$, 4      r   r   )r   r(   apir   toml_documentr   r   r0   r   r   <module>r3      sm    				 				       ' ' ' ' ' '( ( ( ( ( ( ( ( ( (r   