U  üe ã@s„dZddlZddlZddlZddlmZmZddlmZmZGdd„dej ƒZ Gdd „d eƒZ Gd d „d eƒZ Gd d „d ee ƒZ dS)z+ Interface adapters for low-level readers. éN)ÚBinaryIOÚListé)Ú TraversableÚTraversableResourcesc@szeZdZdZeejedœdd„ƒƒZeje ddœdd„ƒZ eje edœdd„ƒZ ejee d œd d „ƒZ ed d „ƒZdS)Ú SimpleReaderzQ The minimum, low-level interface required from a resource provider. )ÚreturncCsdS)zP The name of the package for which this reader loads resources. N©©Úselfr r úH/opt/hc_python/lib/python3.8/site-packages/importlib_resources/simple.pyÚpackageszSimpleReader.packagecCsdS)zo Obtain an iterable of SimpleReader for available child containers (e.g. directories). Nr r r r r ÚchildrenszSimpleReader.childrencCsdS)zL Obtain available named resources for this virtual package. Nr r r r r Ú resources!szSimpleReader.resources)ÚresourcercCsdS)z: Obtain a File-like for a named resource. Nr )r rr r r Ú open_binary'szSimpleReader.open_binarycCs|j d¡dS)NÚ.éÿÿÿÿ)r Úsplitr r r r Úname-szSimpleReader.nameN)Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚpropertyÚabcÚabstractmethodÚstrr rrrrrrr r r r r src@s>eZdZdZedœdd„Zdd„Zdd„Zd d „Zd d „Z d S)ÚResourceContainerzI Traversable container for a package's resources via its reader. ©ÚreadercCs ||_dS©Nr)r r r r r Ú__init__7szResourceContainer.__init__cCsdS©NTr r r r r Úis_dir:szResourceContainer.is_dircCsdS©NFr r r r r Úis_file=szResourceContainer.is_filecs2‡fdd„ˆjjDƒ}ttˆj ¡ƒ}t ||¡S)Nc3s|]}tˆ|ƒVqdSr!)ÚResourceHandle)Ú.0rr r r Ú Asz,ResourceContainer.iterdir..)r rÚmaprrÚ itertoolsÚchain)r ÚfilesÚdirsr r r Úiterdir@szResourceContainer.iterdircOs tƒ‚dSr!)ÚIsADirectoryError)r ÚargsÚkwargsr r r ÚopenEszResourceContainer.openN) rrrrrr"r$r&r/r3r r r r r2s rc@sBeZdZdZeedœdd„Zdd„Zdd„Zdd d „Z d d „Z dS)r'z9 Handle to a named resource in a ResourceReader. ©ÚparentrcCs||_||_dSr!r4)r r5rr r r r"NszResourceHandle.__init__cCsdSr#r r r r r r&RszResourceHandle.is_filecCsdSr%r r r r r r$UszResourceHandle.is_dirÚrcOs.|jj |j¡}d|kr*tj|f|ž|Ž}|S)NÚb)r5r rrÚioÚ TextIOWrapper)r Úmoder1r2Ústreamr r r r3XszResourceHandle.opencCs tdƒ‚dS)NzCannot traverse into a resource)Ú RuntimeError)r rr r r Újoinpath^szResourceHandle.joinpathN)r6) rrrrrrr"r&r$r3r=r r r r r'Is  r'c@seZdZdZdd„ZdS)ÚTraversableReaderzÄ A TraversableResources based on SimpleReader. Resource providers may derive from this class to provide the TraversableResources interface by supplying the SimpleReader interface. cCst|ƒSr!)rr r r r r-iszTraversableReader.filesN)rrrrr-r r r r r>bsr>)rrr8r+ÚtypingrrrrÚABCrrr'r>r r r r Ús%