File: //lib64/python3.6/__pycache__/chunk.cpython-36.opt-2.pyc
3
  \1  �               @   s   G d d� d�Z dS )c               @   sZ   e Zd Zddd�Zdd� Zdd� Zd	d
� Zdd� Zddd�Zdd� Z	ddd�Z
dd� ZdS )�ChunkTFc             C   s�   dd l }d| _|| _|rd}nd}|| _|jd�| _t| j�dk rFt�y |j|d |jd��d | _	W n |j
k
r�   t�Y nX |r�| j	d | _	d| _y| jj� | _
W n ttfk
r�   d| _Y nX d| _d S )	N�    F�>�<�   �L�   T)�struct�closed�align�file�read�	chunkname�len�EOFErrorZunpack_from�	chunksize�error�	size_read�tell�offset�AttributeError�OSError�seekable)�selfr   r
   Z	bigendianZ
inclheaderr   Zstrflag� r   �/usr/lib64/python3.6/chunk.py�__init__4   s,     
zChunk.__init__c             C   s   | j S )N)r
   )r   r   r   r   �getnameN   s    z
Chunk.getnamec             C   s   | j S )N)r   )r   r   r   r   �getsizeR   s    z
Chunk.getsizec             C   s    | j sz| j�  W d d| _ X d S )NT)r	   �skip)r   r   r   r   �closeV   s    zChunk.closec             C   s   | j rtd��dS )NzI/O operation on closed fileF)r	   �
ValueError)r   r   r   r   �isatty]   s    zChunk.isattyr   c             C   sv   | j rtd��| jstd��|dkr0|| j }n|dkrB|| j }|dk sT|| jkrXt�| jj| j	| d� || _d S )NzI/O operation on closed filezcannot seek�   �   r   )
r	   r    r   r   r   r   �RuntimeErrorr   �seekr   )r   �pos�whencer   r   r   r%   b   s    
z
Chunk.seekc             C   s   | j rtd��| jS )NzI/O operation on closed file)r	   r    r   )r   r   r   r   r   u   s    z
Chunk.tellr"