Ë
    bQêj_  ã                   ó&  — d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZddl	m
Z
 ddlmZ ddlmZmZ e j                   d„ «       Z G d„ d	«      Z G d
„ deej&                  ej(                  «      Z G d„ deej,                  ej(                  «      Z G d„ deej&                  ej(                  «      Z G d„ deej,                  ej(                  «      Z G d„ d«      Z G d„ d«      Z G d„ deej&                  eej(                  «      Z G d„ deej,                  eej(                  «      Z G d„ d«      Z G d„ deej&                  eej(                  «      Z G d„ deej,                  eej(                  «      Z e!d k(  r ejD                  «        yy)!é    Né   )ÚTraversableé   )Úutil)Úimport_helperÚ	os_helperc               #   ó    K  — t        j                  d¬«      5 } t        j                  dt        ¬«       | –— d d d «       y # 1 sw Y   y xY w­w)NT)ÚrecordÚdefault)Úcategory)ÚwarningsÚcatch_warningsÚsimplefilterÚDeprecationWarning)Úctxs    úi/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/importlib_resources/tests/test_files.pyÚsuppress_known_deprecationr      s@   è ø€ ä	×	 Ñ	 ¨Ô	-ð °Ü×Ñ˜iÔ2DÕEØŠ	÷÷ ñ üs   ‚A™ A¹	AÁAÁAc                   ó$   — e Zd Zd„ Zd„ Zd„ Zd„ Zy)Ú
FilesTestsc                 óŽ   — t        j                  | j                  «      }|j                  d«      j	                  «       }|dk(  sJ ‚y )Nú
utf-8.files   Hello, UTF-8 world!
)Ú	resourcesÚfilesÚdataÚjoinpathÚ
read_bytes©Úselfr   Úactuals      r   Útest_read_byteszFilesTests.test_read_bytes   s:   € Ü—‘ §	¡	Ó*ˆØ—‘ Ó-×8Ñ8Ó:ˆØÐ1Ò1Ð1Ñ1ó    c                 ó’   — t        j                  | j                  «      }|j                  d«      j	                  d¬«      }|dk(  sJ ‚y )Nr   úutf-8©ÚencodingzHello, UTF-8 world!
)r   r   r   r   Ú	read_textr   s      r   Útest_read_textzFilesTests.test_read_text   s?   € Ü—‘ §	¡	Ó*ˆØ—‘ Ó-×7Ñ7ÀÐ7ÓIˆØÐ0Ò0Ð0Ñ0r!   c                 ób   — t        t        j                  | j                  «      t        «      sJ ‚y ©N)Ú
isinstancer   r   r   r   ©r   s    r   Útest_traversablezFilesTests.test_traversable"   s   € Üœ)Ÿ/™/¨$¯)©)Ó4´kÔBÐBÑBr!   c                 óŠ   — t        j                  | j                  «      }|j                  dd«      }|j	                  «       sJ ‚y )NÚsubdirectoryzbinary.file)r   r   r   r   Úis_file)r   r   Úbinfiles      r   Ú test_joinpath_with_multiple_argsz+FilesTests.test_joinpath_with_multiple_args%   s4   € Ü—‘ §	¡	Ó*ˆØ—.‘. °Ó?ˆØ�‰Ô Ð Ñ r!   N)Ú__name__Ú
__module__Ú__qualname__r    r'   r,   r1   © r!   r   r   r      s   „ ò2ò
1ò
Có!r!   r   c                   ó   — e Zd Zy)ÚOpenDiskTestsN©r2   r3   r4   r5   r!   r   r7   r7   +   ó   „ Ør!   r7   c                   ó   — e Zd Zy)ÚOpenZipTestsNr8   r5   r!   r   r;   r;   /   r9   r!   r;   c                   ó   — e Zd ZdZd„ Zy)ÚOpenNamespaceTestsÚnamespacedata01c                 ól   — ddl }|j                  j                  d«       t        j                  |«       y)aÿ  
        Non-path items in a namespace package's ``__path__`` are ignored.

        As reported in python/importlib_resources#311, some tools
        like Setuptools, when creating editable packages, will inject
        non-paths into a namespace package's ``__path__``, a
        sentinel like
        ``__editable__.sample_namespace-1.0.finder.__path_hook__``
        to cause the ``PathEntryFinder`` to be called when searching
        for packages. In that case, resources should still be loadable.
        r   Nz6__editable__.sample_namespace-1.0.finder.__path_hook__)r>   Ú__path__Úappendr   r   )r   r>   s     r   Útest_non_paths_in_dunder_pathz0OpenNamespaceTests.test_non_paths_in_dunder_path6   s,   € ó 	à× Ñ ×'Ñ'ØDô	
ô 	�‰˜Õ(r!   N)r2   r3   r4   ÚMODULErB   r5   r!   r   r=   r=   3   s   „ Ø€Fó)r!   r=   c                   ó   — e Zd ZdZy)ÚOpenNamespaceZipTestsr>   N)r2   r3   r4   Ú
ZIP_MODULEr5   r!   r   rE   rE   K   s   „ Ø"�Jr!   rE   c                   ó   — e Zd ZdZdZd„ Zy)Ú
DirectSpeczI
    Override behavior of ModuleSetup to write a full spec directly.
    Úunusedc                 ó:   — | j                  | j                  «       y r)   )Útree_on_pathÚspec)r   Únames     r   Úload_fixturezDirectSpec.load_fixtureV   s   € Ø×Ñ˜$Ÿ)™)Õ$r!   N)r2   r3   r4   Ú__doc__rC   rN   r5   r!   r   rH   rH   O   s   „ ñð €Fó%r!   rH   c                   ó   — e Zd ZdddœZd„ Zy)ÚModulesFilesÚ úresources are the best)zmod.pyúres.txtc                 óœ   — ddl }t        j                  |«      j                  d«      j	                  d¬«      }|| j
                  d   k(  sJ ‚y)zK
        A module can have resources found adjacent to the module.
        r   NrT   r#   r$   )Úmodr   r   r   r&   rL   )r   rV   r   s      r   Útest_module_resourcesz"ModulesFiles.test_module_resources`   sE   € ó 	ä—‘ Ó%×.Ñ.¨yÓ9×CÑCÈWÐCÓUˆØ˜Ÿ™ 9Ñ-Ò-Ð-Ñ-r!   N)r2   r3   r4   rL   rW   r5   r!   r   rQ   rQ   Z   s   „ àØ+ñ€Dó
.r!   rQ   c                   ó   — e Zd Zy)ÚModuleFilesDiskTestsNr8   r5   r!   r   rY   rY   j   r9   r!   rY   c                   ó   — e Zd Zy)ÚModuleFilesZipTestsNr8   r5   r!   r   r[   r[   n   r9   r!   r[   c                   ó°   — e Zd Z ej                  dej                   › d�«      Zeeddœej                  ej                   d«      ddœdœZd„ Z	d	„ Z
d
„ Zd„ Zy)ÚImplicitContextFilesz
        import zZ as res
        val = res.files().joinpath('res.txt').read_text(encoding='utf-8')
        rS   )ú__init__.pyz	submod.pyrT   Úc_resources)r^   rT   )ÚsomepkgÚ	frozenpkgc                 óL   — t        j                  d«      j                  dk(  sJ ‚y)úW
        Without any parameter, files() will infer the location as the caller.
        r`   rS   N©Ú	importlibÚimport_moduleÚvalr+   s    r   Útest_implicit_files_packagez0ImplicitContextFiles.test_implicit_files_package…   s$   € ô ×&Ñ& yÓ1×5Ñ5Ð9QÒQÐQÑQr!   c                 óL   — t        j                  d«      j                  dk(  sJ ‚y)rc   zsomepkg.submodrS   Nrd   r+   s    r   Útest_implicit_files_submodulez2ImplicitContextFiles.test_implicit_files_submodule‹   s%   € ô ×&Ñ&Ð'7Ó8×<Ñ<Ð@XÒXÐXÑXr!   c                 óö  — | j                   j                  t        j                  «       «      }t	        j
                  |d«      }t	        j
                  t        j                  «      j                  }|j                  d«      D ]G  }|j                  |j                  |«      «      j                  d«      }t        j                  ||«       ŒI | j                   j                  t        j                   |«      «       y)z¹
        Make a compiled-only copy of the importlib resources package.

        Currently only code is copied, as importlib resources doesn't itself
        have any resources.
        r_   z**/*.pyz.pycN)ÚfixturesÚenter_contextr   Útemp_dirÚpathlibÚPathr   Ú__file__ÚparentÚglobr   Úrelative_toÚwith_suffixÚ
py_compileÚcompiler   ÚDirsOnSysPath)r   Úbin_siter_   ÚsourcesÚsource_pathÚc_paths         r   Ú_compile_importlibz'ImplicitContextFiles._compile_importlib‘   s½   € ð —=‘=×.Ñ.¬y×/AÑ/AÓ/CÓDˆÜ—l‘l 8¨]Ó;ˆÜ—,‘,œy×1Ñ1Ó2×9Ñ9ˆà"Ÿ<™<¨	Ó2ò 	4ˆKØ ×)Ñ)¨+×*AÑ*AÀ'Ó*JÓK×WÑWØóˆFô ×Ñ˜{¨FÕ3ð		4ð
 	�‰×#Ñ#¤M×$?Ñ$?ÀÓ$IÕJr!   c                 ól   — | j                  «        t        j                  d«      j                  dk(  sJ ‚y)zk
        Caller detection works for compiled-only resources module.

        python/cpython#123085
        ra   rS   N)r}   re   rf   rg   r+   s    r   Ú+test_implicit_files_with_compiled_importlibz@ImplicitContextFiles.test_implicit_files_with_compiled_importlib£   s0   € ð 	×ÑÔ!Ü×&Ñ& {Ó3×7Ñ7Ð;SÒSÐSÑSr!   N)r2   r3   r4   ÚtextwrapÚdedentr   Úset_valÚreplacerL   rh   rj   r}   r   r5   r!   r   r]   r]   r   sz   „ Øˆh�o‰oðØ×"Ñ"Ð#ð $	ð	ó€Gð #Ø Ø/ñ
ð #Ÿ?™?¨9×+=Ñ+=¸}ÓMØ/ñ
ñ
€DòRòYòKó$Tr!   r]   c                   ó   — e Zd Zy)ÚImplicitContextFilesDiskTestsNr8   r5   r!   r   r…   r…   ­   ó   „ ð 	r!   r…   c                   ó   — e Zd Zy)ÚImplicitContextFilesZipTestsNr8   r5   r!   r   rˆ   rˆ   ³   r†   r!   rˆ   Ú__main__)#Ú
contextlibre   ro   rv   r€   Úunittestr   Úimportlib_resourcesr   Úabcr   rR   r   Úcompat.py39r   r   Úcontextmanagerr   r   Ú	DiskSetupÚTestCaser7   ÚZipSetupr;   r=   rE   rH   rQ   rY   r[   r]   r…   rˆ   r2   Úmainr5   r!   r   ú<module>r”      sa  ðÛ Û Û Û Û Û Û ã 'å Ý ß 1ð ×Ññó ð÷!ñ !ô(	�J §¡°×0AÑ0Aô 	ô	�:˜tŸ}™}¨h×.?Ñ.?ô 	ô)˜ T§^¡^°X×5FÑ5Fô )ô0#˜J¨¯©°x×7HÑ7Hô #÷%ñ %÷.ñ .ô 	˜: t§~¡~°|ÀX×EVÑEVô 	ô	˜* d§m¡m°\À8×CTÑCTô 	÷8Tñ 8Tôv	Ø�—‘Ð 4°h×6GÑ6Gô	ô	Ø�—‘Ð3°X×5FÑ5Fô	ð ˆzÒØ€H‡M�M…Oð r!   