Ë
    Õªg7?  ã                  óâ  — d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZmZ erd dlmZmZmZ d dlm Z  d dl!m"Z" d dl#m$Z$ dZ%e G d„ d«      «       Z&eddœd(d„«       Z'e	 d)dddœ	 	 	 	 	 	 	 	 	 d*d„«       Z(e	 d)dddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d+d„«       Z)e	 d)dddddddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d+d„«       Z*eddddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d,d „«       Z+eddddddddd!œ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d-d"„«       Z,dd#œd.d$„Z-d/d%„Z.ddd&œd0d'„Z/y)1é    )ÚannotationsN)Úcontextmanager)Ú	dataclass)Úinvalidate_caches)ÚPath)Údedent)ÚTYPE_CHECKINGÚAny)Úinspect)Úvisit)ÚLinesCollection)Úload)ÚModuleÚObject)ÚIteratorÚMappingÚSequence)ÚModulesCollection)ÚParser)Ú
ExtensionsÚgriffe_c                  ó>   — e Zd ZU dZded<   	 ded<   	 ded<   	 d	d„Zy)
Ú
TmpPackagez£A temporary package.

    The `tmpdir` and `path` parameters can be passed as relative path.
    They will be resolved to absolute paths after initialization.
    r   ÚtmpdirÚstrÚnameÚpathc                ó€   — | j                   j                  «       | _         | j                  j                  «       | _        y ©N)r   Úresolver   )Úselfs    úB/var/www/openai/venv/lib/python3.12/site-packages/_griffe/tests.pyÚ__post_init__zTmpPackage.__post_init__/   s*   € Ø—k‘k×)Ñ)Ó+ˆŒØ—I‘I×%Ñ%Ó'ˆ	ó    N)ÚreturnÚNone)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r#   © r$   r"   r   r       s&   … ñð ƒLØ9Ø
ƒIØ8Ø
ƒJØô(r$   r   Úmodule©Úmodule_namec             #  óÌ   K  — t        j                  t        ¬«      5 }t        |«      |› dz  }|j	                  t        | «      «       ||f–— ddd«       y# 1 sw Y   yxY w­w)aB  Create a Python file containing the given code in a temporary directory.

    Parameters:
        code: The code to write to the temporary file.
        module_name: The name of the temporary module.

    Yields:
        module_name: The module name, as to dynamically import it.
        module_path: The module path.
    ©Úprefixú.pyN)ÚtempfileÚTemporaryDirectoryÚ_TMPDIR_PREFIXr   Ú
write_textr   )Úcoder/   r   Útmpfiles       r"   Útemporary_pyfiler:   4   sU   è ø€ ô 
×	$Ñ	$¬NÕ	;¸vÜv“, K =°Ð!4Ñ4ˆØ×Ñœ6 $›<Ô(Ø˜7Ð"Ò"÷ 
<×	;Ñ	;üs   ‚A$2AÁ	A$ÁA!ÁA$T©ÚinitÚinitsc             #  ó  K  — |xs i }t        |t        «      r|D ci c]  }|d“Œ }}dddœ}t        j                  t        ¬«      5 }t        |«      }dj                  t        | «      j                  «      }|| z  }	 |	j                  d	i |¤Ž |r|	j                  d«      j                  «        |j                  «       D ]•  \  }
}|	}t        |
«      j                  D ]v  }|j                  d«      r*|j                  |«      j                  t        |«      «       Œ>||z  } |j                  d	i |¤Ž |sŒX|j                  d«      j                  «        Œx Œ— t        |||	«      –— ddd«       yc c}w # 1 sw Y   yxY w­w)
a(  Create a package containing the given modules in a temporary directory.

    Parameters:
        package: The package name. Example: `"a"` gives
            a package named `a`, while `"a/b"` gives a namespace package
            named `a` with a package inside named `b`.
            If `init` is false, then `b` is also a namespace package.
        modules: Additional modules to create in the package.
            If a list, simply touch the files: `["b.py", "c/d.py", "e/f"]`.
            If a dict, keys are the file names and values their contents:
            `{"b.py": "b = 1", "c/d.py": "print('hey from c')"}`.
        init: Whether to create an `__init__` module in the top package.
        inits: Whether to create `__init__` modules in subpackages.

    Yields:
        A temporary package.
    Ú T)ÚparentsÚexist_okr1   Ú.ú__init__.py)r3   z.pyiNr,   )Ú
isinstanceÚlistr4   r5   r6   r   ÚjoinÚpartsÚmkdirÚjoinpathÚtouchÚitemsÚendswithr7   r   r   )ÚpackageÚmodulesr<   r=   ÚmodÚmkdir_kwargsr   Ú
tmpdirpathÚpackage_nameÚpackage_pathr/   Úmodule_contentsÚcurrent_pathÚparts                 r"   Útemporary_pypackagerW   F   sY  è ø€ ð2 Šm˜€GÜ'œ4Ô Ù&-Ó.¡g˜s3˜‘7 gˆÐ.Ø#°Ñ6€LÜ	×	$Ñ	$¬NÕ	;¸vÜ˜&“\ˆ
Ø—x‘x¤ W£× 3Ñ 3Ó4ˆØ! GÑ+ˆØˆ×ÑÑ*˜\Ò*ÙØ×!Ñ! -Ó0×6Ñ6Ô8Ø,3¯M©M®OÑ(ˆK˜Ø'ˆLÜ˜[Ó)×/Ô/Ø—=‘= Ô1Ø ×)Ñ)¨$Ó/×:Ñ:¼6À/Ó;RÕSà  DÑ(LØ&L×&Ñ&Ñ6¨Ò6ÚØ$×-Ñ-¨mÓ<×BÑBÕDñ 0ð -<ô ˜ \°<Ó@Ò@÷# 
<Ð	;ùò /ç	;Ð	;üs.   ‚F
E0§!FÁC,E5Ä52E5Å'FÅ5E>Å:FF)r<   r=   Ú
extensionsÚdocstring_parserÚdocstring_optionsÚlines_collectionÚmodules_collectionÚallow_inspectionÚstore_sourceÚresolve_aliasesÚresolve_externalÚresolve_implicitc             #  ó²   K  — t        | |||¬«      5 }t        |j                  |j                  g||||||	|
|||d¬«      –— ddd«       y# 1 sw Y   yxY w­w)aƒ  Create and visit a temporary package.

    Parameters:
        package: The package name. Example: `"a"` gives
            a package named `a`, while `"a/b"` gives a namespace package
            named `a` with a package inside named `b`.
            If `init` is false, then `b` is also a namespace package.
        modules: Additional modules to create in the package.
            If a list, simply touch the files: `["b.py", "c/d.py", "e/f"]`.
            If a dict, keys are the file names and values their contents:
            `{"b.py": "b = 1", "c/d.py": "print('hey from c')"}`.
        init: Whether to create an `__init__` module in the top package.
        inits: Whether to create `__init__` modules in subpackages.
        extensions: The extensions to use.
        docstring_parser: The docstring parser to use. By default, no parsing is done.
        docstring_options: Additional docstring parsing options.
        lines_collection: A collection of source code lines.
        modules_collection: A collection of modules.
        allow_inspection: Whether to allow inspecting modules when visiting them is not possible.
        store_source: Whether to store code source in the lines collection.
        resolve_aliases: Whether to resolve aliases.
        resolve_external: Whether to try to load unspecified modules to resolve aliases.
            Default value (`None`) means to load external modules only if they are the private sibling
            or the origin module (for example when `ast` imports from `_ast`).
        resolve_implicit: When false, only try to resolve an alias if it is explicitly exported.

    Yields:
        A module.
    r;   F©Úsearch_pathsrX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   Úforce_inspectionN)rW   r   r   r   )rM   rN   r<   r=   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   Útmp_packages                  r"   Útemporary_visited_packagerg   w   sh   è ø€ ô^ 
˜W g°DÀÕ	FÈ+ÜØ×ÑØ%×,Ñ,Ð-Ø!Ø-Ø/Ø-Ø1Ø-Ø%Ø+Ø-Ø-Ø"ô
ò 	
÷ 
G×	FÑ	Füs   ‚A’0AÁ	AÁAÁAc             #  ó€  K  — t        | |||¬«      5 }	 t        |j                  |j                  g||||||	|
|||d¬«      –— t	        t
        j                  j                  «       «      D ]<  }|| k(  s|j                  | › d«      sŒt
        j                  j                  |d«       Œ> t        «        	 ddd«       y# t	        t
        j                  j                  «       «      D ]<  }|| k(  s|j                  | › d«      sŒt
        j                  j                  |d«       Œ> t        «        w xY w# 1 sw Y   yxY w­w)ab  Create and inspect a temporary package.

    Parameters:
        package: The package name. Example: `"a"` gives
            a package named `a`, while `"a/b"` gives a namespace package
            named `a` with a package inside named `b`.
            If `init` is false, then `b` is also a namespace package.
        modules: Additional modules to create in the package.
            If a list, simply touch the files: `["b.py", "c/d.py", "e/f"]`.
            If a dict, keys are the file names and values their contents:
            `{"b.py": "b = 1", "c/d.py": "print('hey from c')"}`.
        init: Whether to create an `__init__` module in the top package.
        inits: Whether to create `__init__` modules in subpackages.
        extensions: The extensions to use.
        docstring_parser: The docstring parser to use. By default, no parsing is done.
        docstring_options: Additional docstring parsing options.
        lines_collection: A collection of source code lines.
        modules_collection: A collection of modules.
        allow_inspection: Whether to allow inspecting modules.
        store_source: Whether to store code source in the lines collection.
        resolve_aliases: Whether to resolve aliases.
        resolve_external: Whether to try to load unspecified modules to resolve aliases.
            Default value (`None`) means to load external modules only if they are the private sibling
            or the origin module (for example when `ast` imports from `_ast`).
        resolve_implicit: When false, only try to resolve an alias if it is explicitly exported.

    Yields:
        A module.
    r;   Trc   rB   N)rW   r   r   r   ÚtupleÚsysrN   ÚkeysÚ
startswithÚpopr   )rM   rN   r<   r=   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rf   r   s                   r"   Útemporary_inspected_packagern   ¸   s  è ø€ ô^ 
˜W g°DÀÕ	FÈ+ð	 ÜØ× Ñ Ø)×0Ñ0Ð1Ø%Ø!1Ø"3Ø!1Ø#5Ø!1Ø)Ø /Ø!1Ø!1Ø!%ôò ô  œcŸk™k×.Ñ.Ó0Ö1Ø˜7’? d§o¡o¸¸	À°mÕ&DÜ—K‘K—O‘O D¨$Õ/ð 2ô Õ÷+ 
GÐ	Føô$ œcŸk™k×.Ñ.Ó0Ö1Ø˜7’? d§o¡o¸¸	À°mÕ&DÜ—K‘K—O‘O D¨$Õ/ð 2ô Õú÷+ 
GÐ	FüsA   ‚D>’D2”/B=ÁAD2Â,D2Â4	D>Â=AD/Ä-D/Ä/D2Ä2D;Ä7D>)r/   rX   ÚparentrY   rZ   r[   r\   c             #  óü   K  — t        | «      } t        | |¬«      5 \  }}	|xs
 t        «       }| j                  «       ||	<   t	        ||	| ||||||¬«	      }
|
|
j
                  |<   |
–— ddd«       y# 1 sw Y   yxY w­w)aS  Create and visit a temporary module with the given code.

    Parameters:
        code: The code of the module.
        module_name: The name of the temporary module.
        extensions: The extensions to use when visiting the AST.
        parent: The optional parent of this module.
        docstring_parser: The docstring parser to use. By default, no parsing is done.
        docstring_options: Additional docstring parsing options.
        lines_collection: A collection of source code lines.
        modules_collection: A collection of modules.

    Yields:
        The visited module.
    r.   )Úfilepathr8   rX   ro   rY   rZ   r[   r\   N)r   r:   r   Ú
splitlinesr   r\   )r8   r/   rX   ro   rY   rZ   r[   r\   Ú_r   r-   s              r"   Útemporary_visited_modulert   ÿ   sˆ   è ø€ ô6 $‹<€DÜ	˜$¨KÕ	8¹I¸QÀØ+Ò@¬Ó/@ÐØ!%§¡Ó!2Ð˜ÑÜØØØØ!ØØ-Ø/Ø-Ø1ô

ˆð 28ˆ×!Ñ! +Ñ.ØŠ÷ 
9×	8Ñ	8üs   ‚A<›AA0Á'	A<Á0A9Á5A<)r/   Úimport_pathsrX   ro   rY   rZ   r[   r\   c             #  ó¨  K  — t        | |¬«      5 \  }	}
|xs
 t        «       }| j                  «       ||
<   	 t        ||
|||||||¬«	      }||j                  |<   |–— |t
        j                  v rt
        j                  |= t        «        	 ddd«       y# |t
        j                  v rt
        j                  |= t        «        w xY w# 1 sw Y   yxY w­w)aŽ  Create and inspect a temporary module with the given code.

    Parameters:
        code: The code of the module.
        module_name: The name of the temporary module.
        import_paths: Paths to import the module from.
        extensions: The extensions to use when visiting the AST.
        parent: The optional parent of this module.
        docstring_parser: The docstring parser to use. By default, no parsing is done.
        docstring_options: Additional docstring parsing options.
        lines_collection: A collection of source code lines.
        modules_collection: A collection of modules.

    Yields:
        The inspected module.
    r.   )rq   ru   rX   ro   rY   rZ   r[   r\   N)r:   r   rr   r   r\   rj   rN   r   )r8   r/   ru   rX   ro   rY   rZ   r[   r\   rs   r   r-   s               r"   Útemporary_inspected_modulerw   -  sÉ   è ø€ ô: 
˜$¨KÕ	8¹I¸QÀØ+Ò@¬Ó/@ÐØ!%§¡Ó!2Ð˜Ñð	 ÜØØØ)Ø%ØØ!1Ø"3Ø!1Ø#5ô
ˆFð 6<ˆF×%Ñ% kÑ2ØŠLàœcŸk™kÑ)Ü—K‘K Ð,ÜÕ÷) 
9Ð	8øð$ œcŸk™kÑ)Ü—K‘K Ð,ÜÕú÷) 
9Ð	8üs3   ‚C%C¶'BÁ-CÂ	CÂ/CÃCÃCÃC)Úreturn_leafc                ó†   — |st        d«      ‚|d   }|}|dd D ]   }|j                  |j                  |«       |}Œ" | r|S |S )a<  Link objects together, vertically.

    Parameters:
        *objects: A sequence of objects. The first one is at the top of the tree.
        return_leaf: Whether to return the leaf instead of the root.

    Raises:
        ValueError: When no objects are provided.

    Returns:
        The top or leaf object.
    ú$At least one object must be providedr   é   N©Ú
ValueErrorÚ
set_memberr   )rx   ÚobjectsÚtopÚleafÚobjs        r"   Úvtreerƒ   a  sW   € ñ ÜÐ?Ó@Ð@Ø
!‰*€CØ€DØqr‹{ˆØ‰˜Ÿ™ #Ô&Ø‰ð ñ ˆ4Ð' CÐ'r$   c                 óv   — | st        d«      ‚| d   }| dd D ]  }|j                  |j                  |«       Œ  |S )a=  Link objects together, horizontally.

    Parameters:
        *objects: A sequence of objects. All objects starting at the second become members of the first.

    Raises:
        ValueError: When no objects are provided.

    Returns:
        The first given object, with all the other objects as members of it.
    rz   r   r{   Nr|   )r   r€   r‚   s      r"   Úhtreer…   x  sC   € ñ ÜÐ?Ó@Ð@Ø
!‰*€CØqr‹{ˆØ‰s—x‘x Õ%ð à€Jr$   )Úleaf_packagerx   c               ó  — | j                  d«      }t        |«      D cg c]   \  }}t        |t        g |d| ¢d‘­Ž ¬«      ‘Œ" }}}|s+|d   j                  j                  |d   «      }||d   _        t        |d|iŽS c c}}w )ao  Link objects together, vertically.

    Parameters:
        path: The complete module path, like `"a.b.c.d"`.
        leaf_package: Whether the deepest module should also be a package.
        return_leaf: Whether to return the leaf instead of the root.

    Raises:
        ValueError: When no objects are provided.

    Returns:
        The top or leaf module.
    rB   NrC   )rq   éÿÿÿÿrx   )ÚsplitÚ	enumerater   r   rq   Ú	with_stemÚ	_filepathrƒ   )r   r†   rx   rG   Úindexr   rN   rq   s           r"   Úmodule_vtreerŽ   Œ  s   € ð J‰Js‹O€EÜ]fÐglÔ]mÔnÑ]mÉkÈeÐUYŒvd¤TÐ%H¨5°°%¨=Ð%H¸-Ò%HÖIÐ]m€GÑnÙØ˜2‘;×'Ñ'×1Ñ1°%¸±)Ó<ˆØ (ˆ‰ÔÜ'Ð3 {Ñ3Ð3ùó	 os    %B )r8   r   r/   r   r%   zIterator[tuple[str, Path]]r   )
rM   r   rN   ú(Sequence[str] | Mapping[str, str] | Noner<   Úboolr=   r   r%   zIterator[TmpPackage])rM   r   rN   r   r<   r   r=   r   rX   úExtensions | NonerY   úParser | NonerZ   údict[str, Any] | Noner[   úLinesCollection | Noner\   úModulesCollection | Noner]   r   r^   r   r_   r   r`   zbool | Nonera   r   r%   úIterator[Module])r8   r   r/   r   rX   r‘   ro   úModule | NonerY   r’   rZ   r“   r[   r”   r\   r•   r%   r–   )r8   r   r/   r   ru   zlist[Path] | NonerX   r‘   ro   r—   rY   r’   rZ   r“   r[   r”   r\   r•   r%   r–   )r   r   rx   r   r%   r   )r   r   r%   r   )r   r   r†   r   rx   r   r%   r   )0Ú
__future__r   rj   r4   Ú
contextlibr   Údataclassesr   Ú	importlibr   Úpathlibr   Útextwrapr   Útypingr	   r
   Ú_griffe.agents.inspectorr   Ú_griffe.agents.visitorr   Ú_griffe.collectionsr   Ú_griffe.loaderr   Ú_griffe.modelsr   r   Úcollections.abcr   r   r   r   Ú_griffe.enumerationsr   Ú_griffe.extensions.baser   r6   r   r:   rW   rg   rn   rt   rw   rƒ   r…   rŽ   r,   r$   r"   Ú<module>r§      sÅ  ðõ
 #ã 
Û Ý %Ý !Ý 'Ý Ý ß %å ,Ý (Ý /Ý ß )áß;Ñ;å5Ý+Ý2à€ð ÷(ð (ó ð(ð& Ø6>ô #ó ð#ð" ð 9=ð-Að Øñ-AØð-Aà5ð-Að ð	-Að
 ð-Að ò-Aó ð-Að` ð 9=ð=
ð ØØ$(Ø&*Ø/3Ø/3Ø37Ø"ØØ!Ø$(Ø"ñ=
Øð=
à5ð=
ð ð	=
ð
 ð=
ð "ð=
ð $ð=
ð -ð=
ð -ð=
ð 1ð=
ð ð=
ð ð=
ð ð=
ð "ð=
ð ð=
ð  ò!=
ó ð=
ð@ ð 9=ðC ð ØØ$(Ø&*Ø/3Ø/3Ø37Ø!ØØ!Ø$(Ø"ñC ØðC à5ðC ð ð	C ð
 ðC ð "ðC ð $ðC ð -ðC ð -ðC ð 1ðC ð ðC ð ðC ð ðC ð "ðC ð ðC ð  ò!C ó ðC ðL ð  Ø$(Ø Ø&*Ø/3Ø/3Ø37ñ*Ø
ð*ð ð*ð "ð	*ð
 ð*ð $ð*ð -ð*ð -ð*ð 1ð*ð ò*ó ð*ðZ ð  Ø&*Ø$(Ø Ø&*Ø/3Ø/3Ø37ñ0 Ø
ð0 ð ð0 ð $ð	0 ð
 "ð0 ð ð0 ð $ð0 ð -ð0 ð -ð0 ð 1ð0 ð ò0 ó ð0 ðf 16õ (ó.ð( 59Èeö 4r$   