
    ?wg[!                         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 Zd Z	 G d d      Z
d Z ed	d
dddddddddddddddd      d        Zy)    N   )Metadatac                 P    dj                  d | j                  d      D              S )N
c              3   ~   K   | ]5  }|j                         r#|j                         j                  d       s| 7 yw)#N)strip
startswith).0lines     [/var/www/horilla/myenv/lib/python3.12/site-packages/pkg_resources/tests/test_working_set.py	<genexpr>z!strip_comments.<locals>.<genexpr>   s4      ::<

 7 7 < 	s   ;=)joinsplit)ss    r   strip_commentsr      s(    99 GGDM      c              #     K   | j                         } t        j                  d|       D ]  }|s|j                  dd      }dt        |      cxk  rdk  sJ  J |j	                  d      j                  dd      \  }}|r2t        j                  |j	                  d            }t        d|f      }nd}t        j                  |||	      }|  yw)
a  
    Parse a series of distribution specs of the form:
    {project_name}-{version}
       [optional, indented requirements specification]

    Example:

        foo-0.2
        bar-1.0
          foo>=3.0
          [feature]
          baz

    yield 2 distributions:
        - project_name=foo, version=0.2
        - project_name=bar, version=1.0,
          requires=['foo>=3.0', 'baz; extra=="feature"']
    z\n(?=[^\s])r   r      r   -zrequires.txtN)project_nameversionmetadata)r	   rer   lenpoprsplittextwrapdedentr   pkg_resourcesDistribution)r   specfieldsnamer   requiresr   dists           r   parse_distributionsr'      s     & 	
	A+ D!$CK$1$$$$$

1,,S!4gvzz!}5H :;HH))w
 
s   CCc                       e Zd ZddZd Zy)FakeInstallerNc                     || _         y N)_installable_dists)selfinstallable_distss     r   __init__zFakeInstaller.__init__;   s
    "3r   c                 \    t        t        t        fd| j                              d       S )Nc                     | v S r+    )r&   reqs    r   <lambda>z(FakeInstaller.__call__.<locals>.<lambda>@   s    TS[ r   )nextiterfilterr,   )r-   r3   s    `r   __call__zFakeInstaller.__call__>   s(    0$2I2IJKT
 	
r   )returnN)__name__
__module____qualname__r/   r8   r2   r   r   r)   r)   :   s    4
r   r)   c                     g }g }| D ]>  }d t        j                  |      j                         j                  dd      D        \  }}}}}}	t	        t        |            }t	        t        |            }t	        t        j                  |            }|d|f|dz   d|	ffD ]  \  }
}}|j                  |
       t        |j                               }t        j                  d|      r"t        t        |      }t        |t              sJ t	        t        |            }|j                  t!        j"                  |||||              A t         j$                  j'                  d||	      S )
Nc              3   N   K   | ]  }t        |j                                 y wr+   )r   lstrip)r   r   s     r   r   z7parametrize_test_working_set_resolve.<locals>.<genexpr>O   s#      
 188:&
s   #%z

   F_replace_conflictingTz\w+$z^installed_dists,installable_dists,requirements,replace_conflicting,resolved_dists_or_exception)ids)r   r   r?   r   listr'   r    parse_requirementsappendr   r	   r   matchgetattr
issubclass	Exceptionpytestparammarkparametrize)	test_listidlist	argvaluestestr$   installed_distsr.   requirements	expected1	expected2id_replace_conflictingexpecteds                r   $parametrize_test_working_set_resolverY   D   sx   FI "
__T*11399&!D
	

 2?CD !45F!GHM<<\JK5)$**D)<3
 	.C$h MM#%hnn&67Hxx*"=(;!(I666 3H =>#% '	"F ;;""	& 	 #  r   z
    # id
    noop

    # installed

    # installable

    # wanted

    # resolved

    # resolved [replace conflicting]
    z
    # id
    already_installed

    # installed
    foo-3.0

    # installable

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    foo-3.0

    # resolved [replace conflicting]
    foo-3.0
    z
    # id
    installable_not_installed

    # installed

    # installable
    foo-3.0
    foo-4.0

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    foo-3.0

    # resolved [replace conflicting]
    foo-3.0
    z
    # id
    not_installable

    # installed

    # installable

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    DistributionNotFound

    # resolved [replace conflicting]
    DistributionNotFound
    z
    # id
    no_matching_version

    # installed

    # installable
    foo-3.1

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    DistributionNotFound

    # resolved [replace conflicting]
    DistributionNotFound
    z
    # id
    installable_with_installed_conflict

    # installed
    foo-3.1

    # installable
    foo-3.5

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    foo-3.5
    z
    # id
    not_installable_with_installed_conflict

    # installed
    foo-3.1

    # installable

    # wanted
    foo>=2.1,!=3.1,<4

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    DistributionNotFound
    a  
    # id
    installed_with_installed_require

    # installed
    foo-3.9
    baz-0.1
        foo>=2.1,!=3.1,<4

    # installable

    # wanted
    baz

    # resolved
    foo-3.9
    baz-0.1

    # resolved [replace conflicting]
    foo-3.9
    baz-0.1
    a  
    # id
    installed_with_conflicting_installed_require

    # installed
    foo-5
    baz-0.1
        foo>=2.1,!=3.1,<4

    # installable

    # wanted
    baz

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    DistributionNotFound
    a  
    # id
    installed_with_installable_conflicting_require

    # installed
    foo-5
    baz-0.1
        foo>=2.1,!=3.1,<4

    # installable
    foo-2.9

    # wanted
    baz

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    baz-0.1
    foo-2.9
    a  
    # id
    installed_with_installable_require

    # installed
    baz-0.1
        foo>=2.1,!=3.1,<4

    # installable
    foo-3.9

    # wanted
    baz

    # resolved
    foo-3.9
    baz-0.1

    # resolved [replace conflicting]
    foo-3.9
    baz-0.1
    a  
    # id
    installable_with_installed_require

    # installed
    foo-3.9

    # installable
    baz-0.1
        foo>=2.1,!=3.1,<4

    # wanted
    baz

    # resolved
    foo-3.9
    baz-0.1

    # resolved [replace conflicting]
    foo-3.9
    baz-0.1
    a	  
    # id
    installable_with_installable_require

    # installed

    # installable
    foo-3.9
    baz-0.1
        foo>=2.1,!=3.1,<4

    # wanted
    baz

    # resolved
    foo-3.9
    baz-0.1

    # resolved [replace conflicting]
    foo-3.9
    baz-0.1
    a  
    # id
    installable_with_conflicting_installable_require

    # installed
    foo-5

    # installable
    foo-2.9
    baz-0.1
        foo>=2.1,!=3.1,<4

    # wanted
    baz

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    baz-0.1
    foo-2.9
    z
    # id
    conflicting_installables

    # installed

    # installable
    foo-2.9
    foo-5.0

    # wanted
    foo>=2.1,!=3.1,<4
    foo>=4

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    VersionConflict
    a+  
    # id
    installables_with_conflicting_requires

    # installed

    # installable
    foo-2.9
        dep==1.0
    baz-5.0
        dep==2.0
    dep-1.0
    dep-2.0

    # wanted
    foo
    baz

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    VersionConflict
    ap  
    # id
    installables_with_conflicting_nested_requires

    # installed

    # installable
    foo-2.9
        dep1
    dep1-1.0
        subdep<1.0
    baz-5.0
        dep2
    dep2-1.0
        subdep>1.0
    subdep-0.9
    subdep-1.1

    # wanted
    foo
    baz

    # resolved
    VersionConflict

    # resolved [replace conflicting]
    VersionConflict
    z
    # id
    wanted_normalized_name_installed_canonical

    # installed
    foo.bar-3.6

    # installable

    # wanted
    foo-bar==3.6

    # resolved
    foo.bar-3.6

    # resolved [replace conflicting]
    foo.bar-3.6
    c                    t        j                  g       }t        t        |j                  |              t        j                  |j                  |t        |      |      }t        j                  |      r&t        j                  |      5   |        d d d        y t         |             t        |      k(  sJ y # 1 sw Y   y xY w)N)	installerrW   )r    
WorkingSetrC   mapadd	functoolspartialresolver)   inspectisclassrJ   raisessorted)rR   r.   rS   rW   resolved_dists_or_exceptionwsresolve_calls          r   test_working_set_resolveri   s   s    l 
	!	!"	%BRVV_	%&$$


 12/	L 23]]67 	N	 	 ln%0K)LLLL	 	s   B;;C)r_   rb   r   r   rJ   r    test_resourcesr   r   r'   r)   rY   ri   r2   r   r   <module>rk      s      	    $"J
 
,^ &$&"$&$,(,,,,,(08y
n^M_n^Mr   