관리-도구
편집 파일: fileinput.cpython-39.opt-2.pyc
a R�f�9 � @ s� d dl Z d dlZd dlmZ g d�Zdad#ddd�dd �Zd d� Zdd � Zdd� Z dd� Z dd� Zdd� Zdd� Z dd� ZG dd� d�Zdd� Zd$dd�Zd d!� Zed"kr�e� dS )%� N)�GenericAlias)�input�close�nextfile�filename�lineno� filelineno�fileno�isfirstline�isstdin� FileInput�hook_compressed�hook_encodedF� �r��mode�openhookc C s( t rt jrtd��t| ||||d�a t S )Nzinput() already activer )�_state�_file�RuntimeErrorr )�files�inplace�backupr r � r �./opt/alt/python39/lib64/python3.9/fileinput.pyr T s r c C s t } d a | r| �� d S �N)r r )�stater r r r a s r c C s t std��t �� S �Nzno active input())r r r r r r r r i s r c C s t std��t �� S r )r r r r r r r r w s r c C s t std��t �� S r )r r r r r r r r � s r c C s t std��t �� S r )r r r r r r r r � s r c C s t std��t �� S r )r r r r r r r r � s r c C s t std��t �� S r )r r r r r r r r � s r c C s t std��t �� S r )r r r r r r r r � s r c @ s� e Zd Zd(ddd�dd�Zdd � Zd d� Zdd � Zdd� Zdd� Zdd� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zee�ZdS ))r NFr r r c C s t |t�r|f}nBt |tj�r,t�|�f}n(|d u rBtjdd � }|sLd}nt|�}|| _|| _ || _ d | _d | _d | _ d| _d| _d | _d| _d | _|dvr�td��d|v r�dd l}|�dtd � || _d|vr�|�d d�nd| _|�r|r�td��t|��std ��|| _d S )N� )�-r F)r ZrU�U�rbz=FileInput opening mode must be one of 'r', 'rU', 'U' and 'rb'r! z'U' mode is deprecated� r �wz4FileInput cannot use an opening hook in inplace modez#FileInput openhook must be callable)� isinstance�str�os�PathLike�fspath�sys�argv�tuple�_files�_inplace�_backup�_savestdout�_output� _filename�_startlineno�_filelinenor �_isstdin�_backupfilename� ValueError�warnings�warn�DeprecationWarning�_mode�replace�_write_mode�callable� _openhook)�selfr r r r r r8 r r r �__init__� sF � zFileInput.__init__c C s | � � d S r �r �r@ r r r �__del__� s zFileInput.__del__c C s z| � � W d| _nd| _0 d S )Nr )r r- rC r r r r � s zFileInput.closec C s | S r r rC r r r � __enter__� s zFileInput.__enter__c C s | � � d S r rB )r@ �type�value� tracebackr r r �__exit__� s zFileInput.__exit__c C s | S r r rC r r r �__iter__� s zFileInput.__iter__c C s6 | � � }|r| jd7 _|S | js(t�| �� q d S �Nr )� _readliner4 r � StopIterationr �r@ �liner r r �__next__� s zFileInput.__next__c C sV dd l }|jdtdd� || �� kr,td��z | �� W S tyP td��Y n0 d S )Nr zTSupport for indexing FileInput objects is deprecated. Use iterator protocol instead.r# )� stacklevelzaccessing lines out of orderzend of input reached)r8 r9 r: r r rP rM � IndexError)r@ �ir8 r r r �__getitem__ s � zFileInput.__getitem__c C s� | j }d | _ |r|t_| j}d | _z�|r0|�� W | j}d | _z| `W n tyX Y n0 zT|rn| jsn|�� W | j }d | _ |r�| j s�zt�|� W n t y� Y n0 d| _n@| j }d | _ |r�| j s�zt�|� W n t y� Y n0 d| _0 n�| j}d | _z| `W n t�y Y n0 z^|�r4| j�s4|�� W | j }d | _ |�rt| j �stzt�|� W n t �yr Y n0 d| _nF| j }d | _ |�r�| j �s�zt�|� W n t �y� Y n0 d| _0 0 d S )NF)r0 r* �stdoutr1 r r rL �AttributeErrorr5 r6 r/ r'