文件操作 - ContainerIO.cpython-311.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/PIL/__pycache__/ContainerIO.cpython-311.pyc
编辑文件内容
� �"�cC � �( � d dl Z G d� d� � ZdS )� Nc �L � e Zd ZdZd� Zd� Zej fd�Zd� Z dd�Z d� Zd � Zd S )�ContainerIOzm A file object that provides read access to a part of an existing file (for example a TAR file). c �r � || _ d| _ || _ || _ | j � |� � dS )z� Create file object. :param file: Existing file. :param offset: Start of region, in bytes. :param length: Size of region, in bytes. r N)�fh�pos�offset�length�seek)�self�filer r s �1/usr/lib/python3/dist-packages/PIL/ContainerIO.py�__init__zContainerIO.__init__ s: � � ����������������V������ c � � dS )NF� �r s r �isattyzContainerIO.isatty, s � ��ur c � � |dk r| j |z | _ n|dk r| j |z | _ n|| _ t dt | j | j � � � � | _ | j � | j | j z � � dS )a Move file pointer. :param offset: Offset in bytes. :param mode: Starting position. Use 0 for beginning of region, 1 for current offset, and 2 for end of region. You cannot move the pointer outside the defined region. � � r N)r r �max�minr r r )r r �modes r r zContainerIO.seek/ s � � �1�9�9��x�&�(�D�H�H� �Q�Y�Y��{�V�+�D�H�H��D�H��q�#�d�h���4�4�5�5�������T�[�4�8�+�,�,�,�,�,r c � � | j S )ze Get current file pointer. :returns: Offset from start of region, in bytes. )r r s r �tellzContainerIO.tellB s � � �x�r r c �� � |rt || j | j z � � }n| j | j z }|sd| j j v rdndS | j |z | _ | j � |� � S )z� Read data. :param n: Number of bytes to read. If omitted or zero, read until end of region. :returns: An 8-bit string. �br � )r r r r r �read)r �ns r r zContainerIO.readJ ss � � � '��A�t�{�T�X�-�.�.�A�A���d�h�&�A�� 6�����-�-�3�3�2�5��8�a�<����w�|�|�A���r c � � d| j j v rdnd}d| j j v rdnd} | � d� � }|sn ||z }||k rn�%|S )zJ Read a line of text. :returns: An 8-bit string. r r r � � Tr )r r r )r �s�newline_character�cs r �readlinezContainerIO.readline[ sv � � �$�'�,�&�&�C�C�B��%(�D�G�L�%8�%8�E�E�d�� �� � �!���A�� ���A��A��%�%�%�� � �r c �f � g } | � � � }|sn|� |� � �-|S )zZ Read multiple lines of text. :returns: A list of 8-bit strings. )r'