Rh ddlZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z ddl m Z eejefZeZdZde defdZed ed ede fd Zed ed edefd Ze dd ed ed edede f dZe dd ed ed ededef dZed edeefdZed ededefdZed ed edeej8fdZy)N)UnionIterableContextManagerBinaryIOTextIOAny)_commoncBtjfd}|S)Ncftjjdtd|i|S)Nz is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.) stacklevel)warningswarn__name__DeprecationWarning)argskwargsfuncs 2/usr/lib/python3.12/importlib/resources/_legacy.pywrapperzdeprecated..wrappers> }}oP P   T$V$$) functoolswraps)rrs` r deprecatedrs%__T%% Nrpathreturnct|}tjj|\}}|rt |d|S)zNormalize a path by ensuring it is a string. If the resulting string contains path separators, an exception is raised. z must be only a file name)strosrsplit ValueError)rstr_pathparent file_names rnormalize_pathr&s@ 4yH h/FI D8#<=>> rpackageresourcecbtj|t|z jdS)zDReturn a file-like object opened for binary reading of the resource.rbr filesr&openr'r(s r open_binaryr/*s( MM' "^H%= = C CD IIrc`tj|t|z jS)z+Return the binary contents of the resource.)r r,r& read_bytesr.s r read_binaryr20s& MM' "^H%= = I I KKrencodingerrorschtj|t|z jd||S)zBReturn a file-like object opened for text reading of the resource.r)r3r4r+)r'r(r3r4s r open_textr76s7 MM' "^H%= = C C hv D rcjt||||5}|jcdddS#1swYyxYw)zReturn the decoded string of the resource. The decoding-related arguments have the same semantics as those of bytes.decode(). N)r7read)r'r(r3r4fps r read_textr;Cs2 7Hh 72wwys)2ctj|jDcgc]}|jc}Scc}w)zReturn an iterable of entries in `package`. Note that not all entries are resources. Specifically, directories are not considered resources. Use `is_resource()` on each entry returned here to check if it is a resource or not. )r r,iterdirname)r'rs rcontentsr?Ss.#*--"8"@"@"B C$DII CC Cs<r>ct|tfdtj|j DS)zYTrue if `name` is a resource inside `package`. Directories are *not* resources. c3`K|]%}|jk(xr|j'yw)N)r>is_file).0 traversabler(s r zis_resource..es5  H$>)<)<)>>s+.)r&anyr r,r=)r'r>r(s @r is_resourcerG^s; d#H "==199; rcjtjtj|t|z S)akA context manager providing a file path object to the resource. If the resource does not already exist on its own on the file system, a temporary file will be created. If the file was created, the file will be deleted upon exiting the context manager (no exception is raised if the file was deleted prior to the context manager exiting). )r as_filer,r&r.s rrrks& ??7==1N84LL MMr)zutf-8strict)rr pathlibtypesrtypingrrrrrrr ModuleTyperPackageResourcerr&r/bytesr2r7r;r?boolrGPathrrrrVs  II   #% &      JJHJJ J  LLHLL L                          DgD(3-D D         N  N NGLL! N  Nr