%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/landscape/lib/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/landscape/lib/__pycache__/fs.cpython-312.pyc

�

�~�e0��\�dZddlZddlZddlmZd�Zd�Zd�Zd�Zdd�Z	dd	�Z
e
ZeZdd
�Z
y)zFile-system utils�N)�longc�:�t||jd��y)z�Create a file with the given content.

    The content is encoded with utf-8 before writing.

    @param path: The path to the file.
    @param content: The content to be written in the file.
    �utf-8N)�create_binary_file�encode��path�contents  �2/usr/lib/python3/dist-packages/landscape/lib/fs.py�create_text_filers���t�W�^�^�G�4�5�c�h�t|d�5}|j|�ddd�y#1swYyxYw)z�Create a file with the given binary content.

    @param path: The path to the file.
    @param content: The content to be written in the file.
    �wbN��open�write�r	r
�fds   rrrs1��
�d�D�	��R�
����������(�1c�:�t||jd��y)aAppend a file with the given content.

    The file is created, if it doesn't exist already.

    The content is utf-8 encoded before it is written.

    @param path: The path to the file.
    @param content: The content to be written in the file at the end.
    rN)�append_binary_filerrs  r�append_text_filers���t�W�^�^�G�4�5r
c�h�t|d�5}|j|�ddd�y#1swYyxYw)z�Append a file with the given binary content.

    The file is created, if it doesn't exist already.

    @param path: The path to the file.
    @param content: The content to be written in the file at the end.
    �abNrrs   rrr*s1��
�d�D�	��R�
��������rc�r�t||�dn|dz�}|jdd�}|�|S|dk\r|d|S||dS)a�Return the content of the given file as string.

    @param path: The path to the file.
    @param limit: An optional read limit. If positive, read up to that number
        of characters from the beginning of the file. If negative, read up to
        that number of bytes from the end of the file.
    @return content: The content of the file string, possibly trimmed to
        C{limit} characters.
    N�r�replacer)�read_binary_file�decode)r	�limitr
s   r�read_text_filer!6sS��"�t�U�]�T���	�J�G��n�n�W�i�0�G��}���	�!���v�����u�v��r
c�>�t|d�5}|�jtjj|�t	|�kDr?|dk\r|j|�cddd�S|j
|tj�|j�cddd�S#1swYyxYw)a�Return the content of the given file as bytes.

    @param path: The path to the file.
    @param limit: An optional read limit. If positive, read up to that number
        of bytes from the beginning of the file. If negative, read up to that
        number of bytes from the end of the file.
    @return content: The content of the file as bytes, possibly trimmed to
        C{limit}.
    �rbNr)r�osr	�getsize�abs�read�seek�SEEK_END)r	r rs   rrrQs|��
�d�D�	��R���������!6��U��!C���z��w�w�u�~���
����r�{�{�+��w�w�y�
���s�AB�/B�Bc��t|d�j�|�%ttj��|z}||f}nd}t	j
||�y)z�Touch a file, creating it if it doesn't exist.

    @param path: the path to the file to be touched.
    @param offset_seconds: a signed integer number of seconds to offset the
        atime and mtime of the file from the current time.

    rN)r�closer�timer$�utime)r	�offset_seconds�offset_time�
touch_times    r�
touch_filer1isO��	��t������!��4�9�9�;�'�.�8��!�;�/�
��
��H�H�T�:�r
)N)�__doc__r$r,�twisted.python.compatrrrrrr!r�	read_file�create_filer1�r
r�<module>r7s@���	��&�6��
6�	��6�(
�	� ��r

Zerion Mini Shell 1.0