관리-도구
편집 파일: _iotools.cpython-37.pyc
B ��Fd�| � @ sx d Z ddlmZmZmZ dZddlZddlZddl m mZ ddl mZmZmZmZ ejd dkr�ddlmZmZmZmZmZmZ eZn$ddlmZmZmZmZmZmZmZ ejd dkr�d d � Zdd� ZneZeZd d� Zdd� Zd*dd�Z dd� Z!d+dd�Z"G dd� de�Z#G dd� de�Z$dd� Z%G dd � d e&�Z'G d!d"� d"e'�Z(G d#d$� d$e)�Z*G d%d&� d&e�Z+d,d(d)�Z,dS )-zBA collection of functions designed to help I/O with ascii files. � )�division�absolute_import�print_functionzrestructuredtext enN)�asbytes�bytes�asbytes_nested� basestring� )�bool�int�float�complex�object�str)r r r r r �unicoder c C s t | �d��S )N�ascii)r �decode)�s� r �E/opt/alt/python37/lib64/python3.7/site-packages/numpy/lib/_iotools.py�_bytes_to_complex s r c C s | � d�S )Nr )r )r r r r �_bytes_to_name s r c C s* y| d W n t tfk r$ dS X dS )z2 Check whether obj behaves like a string. � FT)� TypeError� ValueError)�objr r r �_is_string_like s r c C s* y| d W n t tfk r$ dS X dS )z8 Check whether obj behaves like a bytes object. � FT)r r )r r r r �_is_bytes_like* s r �rFc C s� t | �rV| �d�r(ddl}|�| |�}n(| �d�rFddl}|�| �}n t| |�}d}nt| d�rj| }d}ntd��|r~||fS |S ) a� Returns the filehandle corresponding to a string or a file. If the string ends in '.gz', the file is automatically unzipped. Parameters ---------- fname : string, filehandle Name of the file whose filehandle must be returned. flag : string, optional Flag indicating the status of the file ('r' for read, 'w' for write). return_opened : boolean, optional Whether to return the opening status of the file. z.gzr Nz.bz2T�seekFz%fname must be a string or file handle) r �endswith�gzip�open�bz2�BZ2File�file�hasattrr )�fname�flagZ return_openedr"