Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/landscape/lib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/landscape/lib/__pycache__/fs.cpython-310.pyc
o

���c1�@sjdZddlZddlZddlmZdd�Zdd�Zdd	�Zd
d�Zddd
�Z	ddd�Z
e
ZeZddd�Z
dS)zFile-system utils�N)�longcC�t||�d��dS)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�content�r
�2/usr/lib/python3/dist-packages/landscape/lib/fs.py�create_text_file	srcC�:t|d��}|�|�Wd�dS1swYdS)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�rr	�fdr
r
rrs"�rcCr)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_filerrr
r
r�append_text_files
rcCr
)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.
    �abNrrr
r
rr+s"�rcCsRt||durdn|d�}|�dd�}|dur|S|dkr#|d|�S||d�S)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	r
r
r�read_text_file7srcCs�t|d��1}|dur+tj�|�t|�kr+|dkr$|�|�Wd�S|�|tj�|��Wd�S1s9wYdS)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)rrrr
r
rrRs
�$�rcCsDt|d���|durtt���|}||f}nd}t�||�dS)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_timer
r
r�
touch_filejs
r*)N)�__doc__rr%�twisted.python.compatrrrrrrr�	read_file�create_filer*r
r
r
r�<module>s




Spamworldpro Mini