
    jJP              	         U d dl m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mZmZmZmZmZ ddlmZmZmZmZmZ ddlmZ ddlmZ dd	lmZmZ dd
lmZ erd dlm Z  g dZ!dJdZ"ee#ee#e	e#         f         ge$f         Z%ed         Z&	 ddhZ'h dZ( G d de)          Z* G d de)          Z+ G d de,          Z- G d de          Z.dKdZ/dLd!Z0	 dMdNd(Z1d) d* d+ ej2        ej2        ej3        ej2        d, d-Z4d.e5d/<   dOd7Z6dPd9Z7dQd<Z8dRd>Z9dSdAZ:ej;        dTdB            Z<dTdCZ= G dD dE          Z>dUdGZ?dVdIZ@dS )W    )annotationsN)Set)TYPE_CHECKINGCallableLiteral	TypedDictUnioncast   )
MarkerAtom
MarkerListOpValueVariable)parse_marker)ParserSyntaxError)InvalidSpecifier	Specifiercanonicalize_name)Mapping)EnvironmentEvaluateContextInvalidMarkerMarkerUndefinedComparisonUndefinedEnvironmentNamedefault_environmentreturn	list[str]c                     t           S N)__all__     P/var/www/html/python-test/venv/lib/python3.11/site-packages/packaging/markers.py__dir__r'   #   s    Nr%   )metadata	lock_filerequirementextrasdependency_groups>   python_versionplatform_releasepython_full_versionimplementation_versionc                      e Zd ZdZdS )r   zRaised when attempting to create a :class:`Marker` from invalid input.

    This error indicates that the given marker string does not conform to the
    :ref:`specification of dependency specifiers <pypug:dependency-specifiers>`.
    N__name__
__module____qualname____doc__r$   r%   r&   r   r   =   s           r%   r   c                      e Zd ZdZdS )r   zRaised when evaluating an unsupported marker comparison.

    This can happen when marker values are compared as versions but do not
    conform to the :ref:`specification of version specifiers
    <pypug:version-specifiers>`.
    Nr2   r$   r%   r&   r   r   E   s           r%   r   c                      e Zd ZdZdS )r   a  Raised when evaluating a marker that references a missing environment key.

    Subclasses :class:`KeyError` so that code catching the bare ``KeyError`` that
    a missing environment lookup historically produced keeps working.

    .. versionchanged:: 26.3
        Now subclasses :class:`KeyError` (was :class:`ValueError`) and is raised by
        :meth:`Marker.evaluate` for missing environment keys, where a bare
        ``KeyError`` was raised before.
    Nr2   r$   r%   r&   r   r   N   s        	 	 	 	r%   r   c                      e Zd ZU dZded<   	 ded<   	 ded<   	 ded<   	 ded<   	 ded<   	 ded	<   	 ded
<   	 ded<   	 ded<   	 ded<   dS )r   z
    A dictionary that represents a Python environment as captured by
    :func:`default_environment`. All fields are required.
    strimplementation_namer0   os_nameplatform_machiner.   platform_systemplatform_versionr/   platform_python_implementationr-   sys_platformN)r3   r4   r5   r6   __annotations__r$   r%   r&   r   r   [   s          
 >
 LLL
      (''' 9 r%   r   resultMarkerList | MarkerAtom | strc                   t          | t                    rd | D             S t          | t                    s| S | \  }}}t          |t                    rD|j        dk    r9t          |t
                    r$t          |j                  }t          |          }nt          |t                    rD|j        dk    r9t          |t
                    r$t          |j                  }t          |          }nYt          |t                    rD|j        t          v r6t          |t
                    r!t          t          |j                            }|||fS )Nc                ,    g | ]}t          |          S r$   _normalize_extras.0rs     r&   
<listcomp>z%_normalize_extras.<locals>.<listcomp>   s!    555!!$$555r%   extra)
isinstancelisttupler   valuer   r   MARKERS_ALLOWING_SET)rC   lhsoprhsnormalized_extras        r&   rH   rH      s?    &$ 655f5555fe$$ LCS#x   2SY'%9%9je>T>T%9,SY77$%%	C	"	" 2syG';';
3PU@V@V';,SY77$%%3!!2I---sE"" . %ci0011C<r%   resultsr   c                    d | D             S )z!
    Normalize extra values.
    c                ,    g | ]}t          |          S r$   rG   rI   s     r&   rL   z+_normalize_extra_values.<locals>.<listcomp>   s!    222Qa  222r%   r$   )rW   s    r&   _normalize_extra_valuesrZ      s    
 32'2222r%   Tmarkerlist[str] | MarkerAtom | strfirstbool | Noner:   c                   t          | t          t          t          f          sJ t          | t                    rLt	          |           dk    r9t          | d         t          t          f          rt          | d         |          S t          | t                    r>d | D             }|rd                    |          S dd                    |          z   dz   S t          | t                    rd                    d | D                       S | S )	Nr   r   r]   c              3  8   K   | ]}t          |d           V  dS )Fr`   N)_format_markerrJ   ms     r&   	<genexpr>z!_format_marker.<locals>.<genexpr>   s/      @@A///@@@@@@r%    ()c                6    g | ]}|                                 S r$   )	serializerc   s     r&   rL   z"_format_marker.<locals>.<listcomp>   s     7771777r%   )rN   rO   rP   r:   lenrb   join)r[   r]   inners      r&   rb   rb      s    ftUC011111
 	64  6KK1vay4-00  fQiu5555&$ 	@@@@@ 	/88E??"%(3..	FE	"	" xx77777888r%   c                
    | |v S r"   r$   rS   rU   s     r&   <lambda>rp      s
    3#: r%   c                
    | |vS r"   r$   ro   s     r&   rp   rp      s
    s#~ r%   c                    dS NFr$   _lhs_rhss     r&   rp   rp          E r%   c                    dS rs   r$   rt   s     r&   rp   rp      rw   r%   )inznot in<z<=z==z!=z>=>zdict[str, Operator]
_operatorsrS   rT   r   rU   str | AbstractSet[str]keyboolc          	     4   |                                 }|t          v r;	 t          | |           }|                    | d          S # t          $ r Y nw xY wt
                              |          }|t          d|d| d|d           || |          S )NT)prereleasesz
Undefined z on z and .)rj   MARKERS_REQUIRING_VERSIONr   containsr   r|   getr   )rS   rT   rU   r~   op_strspecopers          r&   _eval_opr      s    \\^^F
'''	8---..D ==$=777   	 	 	D	
 'NN622D|!"Mr"M"M"M"MS"M"M"MNNN4S>>s   A	 	
AA"tuple[str, str | AbstractSet[str]]c                
   |dk    r#t          |t                    s
J d            | |fS |t          v rNt          |t                    rt          |           t          |          fS t          |           d |D             fS | |fS )NrM   zextra value must be a stringc                ,    h | ]}t          |          S r$   r   )rJ   vs     r&   	<setcomp>z_normalize.<locals>.<setcomp>  s!    ,O,O,Oa->q-A-A,O,O,Or%   )rN   r:   rR   r   )rS   rU   r~   s      r&   
_normalizer     s     g~~#s##CC%CCCCSz
"""c3 	Q%c**,=c,B,BCC%c**,O,O3,O,O,OPP 8Or%   environment!dict[str, str | AbstractSet[str]]c                P    	 | |         S # t           $ r t          |          d w xY wr"   )KeyErrorr   )r   r~   s     r&   _lookup_environmentr     s=    63 6 6 6&s++56s   
 %markersc           
        g g}| D ]g}t          |t                    r*|d                             t          ||                     Bt          |t                    r|\  }}}t          |t
                    r|j        }t          ||          }|j        }	n|j        }|j        }t          ||          }	t          |t                    s+t          d|d| d|
                                d          t          ||	|          \  }}	|d                             t          |||	|                     2|dk    r|                    g            O|dk    rWt          d	|          t          d
 |D                       S )NzSet-valued marker z= can only be used with the membership form (e.g. "<name>" in z-); it cannot appear on the left-hand side of r   )r~   orandzUnexpected marker c              3  4   K   | ]}t          |          V  d S r"   )all)rJ   items     r&   re   z$_evaluate_markers.<locals>.<genexpr>G  s(      ,,Ts4yy,,,,,,r%   )rN   rO   append_evaluate_markersrP   r   rQ   r   r:   r   rj   r   r   	TypeErrorany)
r   r   groupsr[   rS   rT   rU   environment_key	lhs_value	rhs_values
             r&   r   r   #  s    !#tF = =fd## 	=2J/DDEEEE&& 	=!LCS#x(( N"%)/_MM	I		I	"%)/_MM	i-- )3 3 3&3 3  "||~~3 3 3   $.i#X#X#X Iy2Jhy"i_UUUVVVVt^^MM"u__;;;<<<,,V,,,,,,r%   infosys._version_infoc                    | j          d| j         d| j         }| j        }|dk    r ||d         t	          | j                  z   z  }|S )Nr   finalr   )majorminormicroreleaselevelr:   serial)r   versionkinds      r&   _format_full_versionr   J  sV    77dj774:77GDw47S----Nr%   c                    t          t          j        j                  } t          j        j        }|| t
          j        t          j                    t          j                    t          j	                    t          j                    t          j
                    t          j                    d                    t          j                    dd                   t          j        dS )aV  Build the default marker environment for the current Python process.

    The values are derived from process-constant data (the running interpreter
    and the host platform), so this is cached and built only once. The result is
    shared between callers and must never be mutated; :func:`default_environment`
    returns a fresh copy.
    r   N   )r;   r0   r<   r=   r.   r>   r?   r/   r@   r-   rA   )r   sysimplementationr   nameosplatformmachinereleasesystemr-   python_implementationrl   python_version_tuple)iverr;   s     r&   _cached_default_environmentr   R  s       2 :;;D,12"&7$,..$,..#?,,$,..'688*2*H*J*J((8#@#B#B2A2#FGG  r%   c                 T    t          dt          t                                          S )ay  Return the default marker environment for the current Python process.

    This is the base environment used by :meth:`Marker.evaluate`. A fresh copy
    is returned on every call so callers may freely mutate the result; a shallow
    copy suffices because all values are immutable strings.

    .. versionchanged:: 26.3
        The environment is computed once per process and cached, since it is
        derived from process-constant data. Patching ``platform``/``sys``/``os``
        after the first call has no effect; pass an explicit ``environment`` to
        :meth:`Marker.evaluate` to evaluate against different values.
    r   )r
   dictr   r$   r%   r&   r   r   l  s#     t$?$A$ABBCCCr%   c                      e Zd ZdZdZddZed d
            Zd!dZd!dZ	d"dZ
d#dZd!dZd$dZd%dZd%dZ	 	 d&d'dZdS )(r   a  Represents a parsed dependency marker expression.

    Marker expressions are parsed according to the
    :ref:`specification of dependency specifiers <pypug:dependency-specifiers>`.

    :param marker: The string representation of a marker expression.
    :raises InvalidMarker: If ``marker`` cannot be parsed.

    Instances are safe to serialize with :mod:`pickle`. They use a stable
    format so the same pickle can be loaded in future packaging releases.

    .. versionchanged:: 26.2

        Added a stable pickle format. Pickles created with packaging 26.2+ can
        be unpickled with future releases.  Backward compatibility with pickles
        from packaging < 26.2 is supported but may be removed in a future
        release.
    )_markersr[   r:   r   Nonec                    g | _         	 t          t          |                    | _         d S # t          $ r"}t	          t          |                    |d }~ww xY wr"   )r   rZ   _parse_markerr   r   r:   )selfr[   es      r&   __init__zMarker.__init__  sb     %'	/3M&4I4IJJDMMM" ! 	/ 	/ 	/A''Q.	/s   !, 
AAAr   r   c                >    |                      |           }||_        |S )zCreate a Marker instance from a pre-parsed marker tree.

        This avoids re-parsing serialised marker strings when combining markers.
        )__new__r   )clsr   news      r&   _from_markerszMarker._from_markers  s!     kk#
r%   c                *    t          | j                  S r"   )rb   r   r   s    r&   __str__zMarker.__str__  s    dm,,,r%   c                B    d| j         j         dt          |           dS )Nrz   rg   z)>)	__class__r3   r:   r   s    r&   __repr__zMarker.__repr__  s&    <4>*<<SYY<<<<r%   intc                :    t          t          |                     S r"   )hashr:   r   s    r&   __hash__zMarker.__hash__  s    CIIr%   otherobjectr   c                z    t          |t                    st          S t          |           t          |          k    S r"   )rN   r   NotImplementedr:   r   r   s     r&   __eq__zMarker.__eq__  s1    %(( 	"!!4yyCJJ&&r%   c                     t          |           S r"   )r:   r   s    r&   __getstate__zMarker.__getstate__  s     4yyr%   statec                :   t          |t                    rJ	 t          t          |                    | _        n%# t
          $ r}t          d|          |d }~ww xY wd S t          |t                    r*d|v r&|d         }t          |t                    r	|| _        d S t          |t                    rWt          |          dk    rD|\  }}t          |t                    r*d|v r&|d         }t          |t                    r	|| _        d S t          d|          )NzCannot restore Marker from r   r   )rN   r:   rZ   r   r   r   r   r   rO   rP   rk   )r   r   excr   _	slot_dicts         r&   __setstate__zMarker.__setstate__  s<   eS!! 	R 7e8L8L M M$ R R R Ge G GHHcQRFeT"" 	zU':':J'G'4((  'eU## 	E

a LAy)T** zY/F/F#J/gt,, $+DMF?e??@@@s   !9 
AAAc                ~    t          |t                    st          S |                     | j        d|j        g          S )zXCombine this marker with another using ``and``.

        .. versionadded:: 26.1
        r   rN   r   r   r   r   r   s     r&   __and__zMarker.__and__  s;    
 %(( 	"!!!!4=%"HIIIr%   c                ~    t          |t                    st          S |                     | j        d|j        g          S )zWCombine this marker with another using ``or``.

        .. versionadded:: 26.1
        r   r   r   s     r&   __or__zMarker.__or__  s;    
 %(( 	"!!!!4=$"GHHHr%   Nr(   r   +Mapping[str, str | AbstractSet[str]] | Nonecontextr   c                P   t          dt                                }|dk    r!|t                      t                      dz  }n|dk    rd|d<   |5||z  }d|v r,t          d|d                   }|rt          |          nd|d<   t	          | j        t          |                    S )	a  Evaluate a marker.

        Return the boolean from evaluating this marker against the environment.
        The environment is determined from the current Python process unless
        passed in explicitly.

        :param environment: Mapping containing keys and values to override the
           detected environment.
        :param EvaluateContext context: The context in which the marker is
            evaluated, which influences what marker names are considered valid.
            Accepted values are ``"metadata"`` (for core metadata; default),
            ``"lock_file"``, and ``"requirement"`` (i.e. all other situations).
        :raises UndefinedComparison: If the marker uses a comparison on values
            that are not valid versions per the :ref:`specification of version
            specifiers <pypug:version-specifiers>`.
        :raises UndefinedEnvironmentName: If the marker references a value that
            is missing from the evaluation environment.
        :returns: ``True`` if the marker matches, otherwise ``False``.

        .. versionchanged:: 25.0
            Added the ``context`` parameter, which influences which marker names
            are considered valid.
        r   r)   )r+   r,   r(    rM   Nz
str | None)r
   r   	frozensetr   r   r   _repair_python_full_version)r   r   r   current_environmentrM   s        r&   evaluatezMarker.evaluate  s    8 #/1D1F1F
 
 k!!#++%.[[$ $  
""+-(";.--- \+>w+GHHKP/X/@/G/G/GVX#G, M67JKK
 
 	
r%   )r[   r:   r   r   )r   r   r   r   )r   r:   )r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   )Nr(   )r   r   r   r   r   r   )r3   r4   r5   r6   	__slots__r   classmethodr   r   r   r   r   r   r   r   r   r   r$   r%   r&   r   r   |  s(        & I/ / / /<    [- - - -= = = =   ' ' ' '   
A A A A0J J J JI I I I DH#-2
 2
 2
 2
 2
 2
 2
r%   r   r/   c                :    |                      d          r|  dS | S )
    Work around platform.python_version() returning something that is not PEP 440
    compliant for non-tagged Python builds.
    +local)endswith)r/   s    r&   _pep440_python_full_versionr   -  s/    
 ##C(( -%,,,,r%   envc                V    t          d| d                   }t          |          | d<   | S )r   r:   r/   )r
   r   )r   r/   s     r&   r   r   7  s3     uc*?&@AA!<=P!Q!QCJr%   )r   r    )rC   rD   r   rD   )rW   r   r   r   )T)r[   r\   r]   r^   r   r:   )
rS   r:   rT   r   rU   r}   r~   r:   r   r   )rS   r:   rU   r}   r~   r:   r   r   )r   r   r~   r:   r   r}   )r   r   r   r   r   r   )r   r   r   r:   )r   r   )r/   r:   r   r:   )r   r   r   r   )A
__future__r   	functoolsoperatorr   r   r   collections.abcr   AbstractSettypingr   r   r   r   r	   r
   _parserr   r   r   r   r   r   r   
_tokenizerr   
specifiersr   r   utilsr   r   r#   r'   r:   r   Operatorr   rR   r   
ValueErrorr   r   r   r   r   rH   rZ   rb   eqner|   rB   r   r   r   r   r   cacher   r   r   r   r   r$   r%   r&   <module>r     s  
 # " " " " " "      				  



 . . . . . . K K K K K K K K K K K K K K K K @ @ @ @ @ @ @ @ @ @ @ @ @ @ 2 2 2 2 2 2 ) ) ) ) ) ) 3 3 3 3 3 3 3 3 $ $ $ $ $ $ (''''''      S%[%5 567=>@A	 !"56        J       *   
 
 
 
 
x 
 
 
J J J J J) J J JZ   <3 3 3 3 @D    6 &
%--	!	!
+
+
+
+	!	!	# 	#
 	 	 	 	   "   *6 6 6 6$- $- $- $-N       2D D D D n
 n
 n
 n
 n
 n
 n
 n
b   	 	 	 	 	 	r%   