관리-도구
편집 파일: readers.cpython-38.pyc
U +�e! � @ s� d dl Z d dlZd dlZd dlZd dlZd dlZddlmZ ddlm Z ddl mZmZ dd� Z G dd � d ej�ZG d d� dej�ZG dd � d ej�ZG dd� dej�ZdS )� N� )�abc)�only)�ZipPath�ensure_traversablec C s t tj�| ��S �N)�iter�collections�OrderedDict�fromkeys)�items� r �I/opt/hc_python/lib/python3.8/site-packages/importlib_resources/readers.py�remove_duplicates s r c @ s$ e Zd Zdd� Zdd� Zdd� ZdS )� FileReaderc C s t �|j�j| _d S r )�pathlib�Path�path�parent)�self�loaderr r r �__init__ s zFileReader.__init__c C s t | j�|��S �z{ Return the file system path to prevent `resources.path()` from creating a temporary copy. ��strr �joinpath�r �resourcer r r � resource_path s zFileReader.resource_pathc C s | j S r �r �r r r r �files s zFileReader.filesN)�__name__� __module__�__qualname__r r r! r r r r r s r c s4 e Zd Zdd� Z� fdd�Zdd� Zdd� Z� ZS ) � ZipReaderc C s4 |� d�\}}}|j�dd�| d | _|j| _d S )N�.�\�/)� rpartition�prefix�replace�archive)r r �module�_�namer r r r # s zZipReader.__init__c sD zt � �|�W S tk r> } zt|jd ��W 5 d }~X Y nX d S �Nr )�super� open_resource�KeyError�FileNotFoundError�args)r r �exc�� __class__r r r2 ( s zZipReader.open_resourcec C s | � � �|�}|�� o|�� S )zf Workaround for `zipfile.Path.is_file` returning true for non-existent paths. )r! r �is_file�exists)r r �targetr r r �is_resource. s zZipReader.is_resourcec C s t | j| j�S r )r r, r* r r r r r! 6 s zZipReader.files)r"