U if@% @ s d dl Z d dlZddlmZ d dlmZmZ d dlm Z d dl mZ d dlm Z mZ d dlmZ d d lmZ d d lmZmZmZmZmZ d dlmZ d dlmZmZ d d lmZ dddddddddg Zee ef Z!ee e j"f Z#edddZ$e dddZ%eeej& dddZ'dd Z(e!e#ed!d"dZ)d-e!e#e e ed%d&dZ*e!e#e+d!d'dZ,d.e!e#e e e d%d(dZ-ee!e#ee d!d)dZ.e!e e/d*d+dZ0e!ee dd,dZ1dS )/ N )abc)contextmanagersuppress) import_module)ResourceLoader)BytesIO TextIOWrapper)Path) ModuleType)IterableIteratorOptionalSetUnion)cast)BinaryIOTextIO)ZipImportErrorPackageResourcecontentsis_resourceopen_binary open_textpathread_binary read_text)returnc C s\ t | dr0| jjdkr*td| jjqX| S n(t| }|jjdkrTtd| n|S dS )zTake a package name or module object and return the module. If a name, the module is imported. If the passed or imported module object is not a package, raise an exception. __spec__Nz{!r} is not a package)hasattrr submodule_search_locations TypeErrorformatnamer )packagemodule r' 8/opt/alt/python38/lib64/python3.8/importlib/resources.py_get_package" s r) c C s, t j| \}}|r$td| n|S dS )zNormalize a path by ensuring it is a string. If the resulting string contains path separators, an exception is raised. z{!r} must be only a file nameN)osr split ValueErrorr# )r parent file_namer' r' r( _normalize_path6 s r/ )r% r c C s, | j }t|jdr(ttj|j|jS d S )Nget_resource_reader)r r loaderr resources_abcResourceReaderr0 r$ )r% specr' r' r( _get_resource_readerB s r5 c C s&