Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/tailer/__pycache__/__init__.cpython-39.pyc
Ðазад
a ]�h�! � @ s~ d dl Z d dlZd dlZejdk r&eZG dd� de�Zddd�Zddd �Z ddd�Z d d� Zdd� Zdd� Z edkrze � dS )� N)� c @ s� e Zd ZdZdZd!dd�Zdd� Zd d � Zd"dd �Zd#dd�Z dd� Z dd� Zd$dd�Zd%dd�Z d&dd�Zdd� Zdd � ZdS )'�TailerzZ Implements tailing and heading functionality like GNU tail and head commands. )� � � � Fc C s( || _ || _| j�� | _|r$| �� d S �N)� read_size�file�tell� start_pos�seek_end)�selfr r �end� r �/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/tailer/__init__.py�__init__ s zTailer.__init__c C s t �d�| j�|�S )N�|)�re�split�join�line_terminators)r �datar r r � splitlines s zTailer.splitlinesc C s | � dd� d S )Nr � )�seek�r r r r r s zTailer.seek_endr c C s | j �||� d S r )r r )r �pos�whencer r r r s zTailer.seekNc C s( |r| j �|�}n | j �� }t|�|fS r )r �read�len)r r �read_strr r r r s zTailer.readc C s� | j �� }}| �| j�\}}d}|r<|d | jv r<|d7 }|dkr�|}||k r�|| | jv rz| �|| d � | j �� S |d7 }qH|| j7 }| �|� | �| j�\}}q<dS )z� Searches forward from the current file position for a line terminator and seeks to the charachter after it. r � N)r r r r r r )r r r � bytes_readr! �start�ir r r �seek_line_forward'