=OgK XddlZddlZddlZddlZddlZddlZddlZddlmZm Z ddl m Z m Z ddl mZeejefZdZdZdZd Zd Zejdejd d ZejdZeejejdZdS)N)UnionOptional)ResourceReader Traversable) wrap_specc:tt|S)z3 Get a Traversable resource from a package ) from_package get_package)packages B/opt/alt/python311/lib64/python3.11/importlib/resources/_common.pyfilesrs  G,, - --cd|j}t|jdd}|dS||jS)z? Return the package's loader if it's a ResourceReader. get_resource_readerN)__spec__getattrloadernamer specreaders r rrs<  D T["7 > >F ~t 6$)  rcbt|tjr|ntj|S)N) isinstancetypes ModuleType importlib import_module)cands r resolver *s*dE$455 X449;RSW;X;XXrcpt|}t|jt|d|S)zTake a package name or module object and return the module. Raise an exception if the resolved module is not a package. Nz is not a package)r rsubmodule_search_locations TypeError)r resolveds r r r /s> wH5=7777888 Orct|}|j|j}|S)z= Return a Traversable object for the given package. )rrrrrrs r r r ;s6 W  D [ , ,TY 7 7F <<>>r) _os_removec#~Ktj|\}} tj||tj|n#tj|wxYw~t j|V ||dS#t$rYdSwxYw# ||w#t$rYwwxYwxYw)Nsuffix)tempfilemkstemposwriteclosepathlibPathFileNotFoundError)rr*r'fdraw_paths r _tempfiler5Es#6222LB   HR " " " HRLLLLBHRLLLL l8$$$$$  Jx      DD   Jx      D sRABA%%B B BBB< B,+B<, B96B<8B99B<c8t|j|jS)zu Given a Traversable object, return that object as a path on the local file system in a context manager. r))r5 read_bytesrpaths r as_filer:\s T_TY 7 7 77rc#K|VdS)z7 Degenerate behavior for pathlib.Path objects. Nr8s r _r=es JJJJJr)r&)r-r0r+ functools contextlibrrtypingrrabcrr _adaptersrrstrPackagerrr r r contextmanagerremover5singledispatchr:registerr1r=r<rr rIs  """""""",,,,,,,,  #% &..."YYY    I, 888 ',  r