관리-도구
편집 파일: _compat.cpython-38.pyc
U +�e� � @ s d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZ ej dkrXd dl mZ nd dl mZ zd dlmZ W n ek r� dd� ZY nX zd d lmZ W n ek r� e jZY nX G d d� d�Zdd � Zej dkr�eeeje f Zneedf Zdd� ZdS )� N)�suppress)�Union)� � )�Path)�runtime_checkablec C s | S �N� )�clsr r �I/opt/hc_python/lib/python3.8/site-packages/importlib_resources/_compat.pyr s r )�Protocolc @ s, e Zd ZdZdd� Zedd� �Zdd� ZdS ) �TraversableResourcesLoaderz� Adapt loaders to provide TraversableResources and other compatibility. Used primarily for Python 3.9 and earlier where the native loaders do not yet implement TraversableResources. c C s || _ d S r ��spec)�selfr r r r �__init__) s z#TraversableResourcesLoader.__init__c C s | j jS r )r �origin)r r r r �path, s zTraversableResourcesLoader.pathc s~ ddl m�m} �fdd�}�fdd�}dd� � � fd d �}��fdd�}|�j�p||�j�p||�j�p||�j�p||��j�S ) N� )�readers� _adaptersc s0 t t�� � �| j| j�W 5 Q R � S Q R X d S r )r �AttributeErrorZ ZipReader�loader�namer �r r r �_zip_reader3 s zCTraversableResourcesLoader.get_resource_reader.<locals>._zip_readerc s. t tt�� � �| j�W 5 Q R � S Q R X d S r )r r � ValueErrorZNamespaceReader�submodule_search_locationsr r r r �_namespace_reader7 s zITraversableResourcesLoader.get_resource_reader.<locals>._namespace_readerc S s. t t�� | j�| j�W 5 Q R � S Q R X d S r )r r r �get_resource_readerr r r r r �_available_reader; s zITraversableResourcesLoader.get_resource_reader.<locals>._available_readerc s � | �}t |d�r|S d S )N�files)�hasattr)r �reader)r r r �_native_reader? s zFTraversableResourcesLoader.get_resource_reader.<locals>._native_readerc s>