U e5d@% ã @ 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#edœdd„Z$e dœdd„Z%eeej& dœdd„Z'dd „ Z(e!e#ed!œd"d„Z)d-e!e#e e ed%œd&d„Z*e!e#e+d!œd'd„Z,d.e!e#e e e d%œd(d„Z-ee!e#ee d!œd)d„ƒZ.e!e e/d*œd+d„Z0e!ee dœd,d„Z1dS )/é Né )Úabc)ÚcontextmanagerÚsuppress)Ú import_module)ÚResourceLoader)ÚBytesIOÚ TextIOWrapper)ÚPath)Ú ModuleType)ÚIterableÚIteratorÚOptionalÚSetÚUnion)Úcast)ÚBinaryIOÚTextIO)ÚZipImportErrorÚPackageÚResourceÚcontentsÚis_resourceÚopen_binaryÚ open_textÚpathÚread_binaryÚ read_text)Úreturnc C s\ t | dƒr0| jjdkr*td | jj¡ƒ‚qX| S n(t| ƒ}|jjdkrTtd | ¡ƒ‚n|S dS )z»Take 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Ú TypeErrorÚformatÚnamer )ÚpackageÚmodule© r' ú+/usr/lib64/python3.8/importlib/resources.pyÚ_get_package" s ÿr) c C s, t j | ¡\}}|r$td | ¡ƒ‚n|S dS )z€Normalize 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|jdƒr(ttj|j |j¡ƒS d S )NÚget_resource_reader)r r Úloaderr Ú resources_abcÚResourceReaderr0 r$ )r% Úspecr' r' r( Ú_get_resource_readerB s ÿr5 c C s&