o 0iI @ s d dl Z d dlZddlmZ ddlmZmZ ddlmZ d dlm Z d dl mZ d dlm Z d d lmZmZ d d lmZ d dlmZ d dlmZmZmZ d d lmZ d dlmZmZ d dlmZ d dlmZ g dZ ee!ef Z"ee!e j#f Z$de"de$defddZ% d3de"de$de!de!def ddZ&de"de$de'fddZ( d3de"de$de!de!de!f dd Z)de"de$dd!fd"d#Z*d$d% Z+d&d' Z,d(d) Z-de"d*e!de.fd+d,Z/de"dee! fd-d.Z0ed/d0 Z1e12ed1d2 Z3dS )4 N )_common)as_filefiles)ResourceReader)suppress)ResourceLoader) ModuleSpec)BytesIO TextIOWrapper)Path) ModuleType)ContextManagerIterableUnion)cast)BinaryIOTextIO)Sequence)singledispatch)PackageResourcer r contentsr is_resourceopen_binary open_textpathread_binary read_textpackageresourcereturnc C s& t |}t | } t | }|dur||S tt| j}|jdur'|j}n|j dur8t jt j |j g}|D ]N}t j||}z t|ddW S ty tt|j}d}t|jdrztt ||}W d n1 suw Y |durt| Y S Y q:w t|d|j)zDReturn a file-like object opened for binary reading of the resource.Nrb)modeget_dataz resource not found in )r normalize_pathget_packageget_resource_reader open_resourcer r __spec__submodule_search_locationsoriginosr dirnameabspathjoinopenOSErrorr loaderhasattrr r$ r FileNotFoundErrorname) r r readerspecpathsZpackage_path full_pathr2 data r; :/opt/alt/python310/lib64/python3.10/importlib/resources.pyr ( s4 r utf-8strictencodingerrorsc C s t t| |||dS )zBReturn a file-like object opened for text reading of the resource.)r? r@ )r r )r r r? r@ r; r; r<