File manager - Edit - /home/u478019808/domains/bestandroidphones.store/public_html/static/img/logo/file_part.cpython-39.pyc.tar
Back
opt/gsutil/gslib/__pycache__/file_part.cpython-39.pyc 0000644 00000010045 15025234077 0016570 0 ustar 00 a +(Wg� � @ sZ d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlZG dd� dej�Z dS ) z8FilePart implementation for representing part of a file.� )�absolute_import)�print_function)�division)�unicode_literalsNc @ s� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd&dd�Ze j fd d�Zdd� Zd'dd�Z d(dd�Zd)dd�Zd*dd�Zd+dd�Zd,dd�Zd-dd�Zd.d d!�Zd/d"d#�Zd0d$d%�ZdS )1�FileParta Subclass of the file API for representing part of a file. This class behaves as a contiguous subset of a given file (e.g., this object will behave as though the desired part of the file was written to another file, and the second file was opened). c C s8 t |d�| _|| _|| _| j| j | _| j�| j� dS )aF Initializes the FilePart. Args: filename: The name of the existing file, of which this object represents a part. offset: The position (in bytes) in the original file that corresponds to the first byte of the FilePart. length: The total number of bytes in the FilePart. �rbN)�open�_fp�length�_start�_end�seek)�self�filename�offsetr � r �/opt/gsutil/gslib/file_part.py�__init__# s zFilePart.__init__c C s d S �Nr �r r r r � __enter__3 s zFilePart.__enter__c C s | � � d S r )�close)r �type�value� tracebackr r r �__exit__7 s zFilePart.__exit__c C s | j �� | j S r )r �tellr r r r r r : s z FilePart.tell���c C s6 |dk r| j }t|| j| j�� �}| j�td|��S )Nr )r �minr r r �read�max�r �sizer r r r = s z FilePart.readc C sJ |t jkr| j�|| j �S |t jkr4| j�||�S | j�| j| �S d S r )�os�SEEK_ENDr r r �SEEK_CURr )r r �whencer r r r C s z FilePart.seekc C s | j �� d S r )r r r r r r r K s zFilePart.closeNc C s t d��d S )Nz%flush is not implemented in FilePart.��NotImplementedErrorr! r r r �flushN s zFilePart.flushc C s t d��d S )Nz&fileno is not implemented in FilePart.r'