
    2 f?                         d dl Z d dlZd dlmZ d dlmZ d dlmZ erd dlm	Z
 nd dlmZ eee j        f         Z
 G d d          ZdS )	    N)TYPE_CHECKING)loads)TOMLDocument)StrPath)Unionc                   >    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     G/var/www/equiseq/venv/lib/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___StrPathr   r   r   r,    r   r   r	   r	      s}         #X #$ # # # #"l " " " "$, 4      r   r	   )r   r*   typingr   tomlkit.apir   tomlkit.toml_documentr   	_typeshedr   r1   r   strPathLiker	   r2   r   r   <module>r9      s    				 				                   . . . . . .  '-------S"+%&H( ( ( ( ( ( ( ( ( (r   