
    #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!d/d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.	 	 	 	 d0dZ/d1dZ0	 d2	 	 	 	 	 d3dZ1d d d ejd                  ejd                  ejf                  ejd                  d  d!Z4d"e5d#<   d4d$Z6	 	 	 	 	 	 	 	 d5d%Z7	 	 	 	 	 	 d6d&Z8	 	 	 	 	 	 d7d'Z9d8d(Z:ejv                  d9d)       Z<d9d*Z= G d+ d,      Z>d:d-Z?	 	 	 	 d;d.Z@y)<    )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_environmentc                     t         S N)__all__     U/var/www/oz-panel.ru/ozpay-pub/venv/lib/python3.12/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y)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y)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>`.
    Nr/   r!   r"   r#   r   r   E   s    r"   r   c                      e Zd ZdZy)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.
    Nr/   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<   y)r   z
    A dictionary that represents a Python environment as captured by
    :func:`default_environment`. All fields are required.
    strimplementation_namer-   os_nameplatform_machiner+   platform_systemplatform_versionr,   platform_python_implementationr*   sys_platformN)r0   r1   r2   r3   __annotations__r!   r"   r#   r   r   [   s    
 >
 L
      %(' 9r"   r   c                x   t        | t              r| D cg c]  }t        |       c}S t        | t              s| S | \  }}}t        |t              r@|j
                  dk(  r1t        |t              r!t        |j
                        }t        |      }nt        |t              r@|j
                  dk(  r1t        |t              r!t        |j
                        }t        |      }nPt        |t              r@|j
                  t        v r.t        |t              rt        t        |j
                              }|||fS c c}w )Nextra)	
isinstancelist_normalize_extrastupler   valuer   r   MARKERS_ALLOWING_SET)resultrlhsoprhsnormalized_extras         r#   rD   rD      s     &$.45!!$55fe$LCS#x SYY'%9je>T,SYY7$%	C	"syyG';
3PU@V,SYY7$%3!II--sE" %cii01C</ 6s   D7c                >    | D cg c]  }t        |       c}S c c}w )z!
    Normalize extra values.
    )rD   )resultsrI   s     r#   _normalize_extra_valuesrP      s    
 +22Qa 222s   c                   t        | t        t        t        f      sJ t        | t              r7t	        |       dk(  r)t        | d   t        t        f      rt        | d   |      S t        | t              r3d | D        }|rdj                  |      S ddj                  |      z   dz   S t        | t              r-dj                  | D cg c]  }|j                          c}      S | S c c}w )Nr   r   firstc              3  6   K   | ]  }t        |d         yw)FrR   N)_format_marker).0ms     r#   	<genexpr>z!_format_marker.<locals>.<genexpr>   s     @A//@s    ())rB   rC   rE   r7   lenrU   join	serialize)markerrS   innerrW   s       r#   rU   rU      s     ftUC0111
 	64 K1vay4-0fQiu55&$@@88E?"%(3..	FE	"xx71788 8s   C'c                
    | |v S r   r!   rJ   rL   s     r#   <lambda>rc      s
    3#: r"   c                
    | |vS r   r!   rb   s     r#   rc   rc      s
    s#~ r"   c                     yNFr!   _lhs_rhss     r#   rc   rc          r"   c                     yrf   r!   rg   s     r#   rc   rc      rj   r"   )inznot in<z<=z==z!=z>=>zdict[str, Operator]
_operatorsc          	         |j                         }|t        v r#	 t        | |       }|j                  | d      S t
        j                  |      }|t        d|d| d|d       || |      S # t        $ r Y @w xY w)NT)prereleasesz
Undefined z on z and .)r^   MARKERS_REQUIRING_VERSIONr   containsr   ro   getr   )rJ   rK   rL   keyop_strspecopers          r#   _eval_oprz      s    \\^F
''	8xu-.D ==$=77&NN62D|!JrfDuSG1"MNNS>   		s   A1 1	A=<A=c                    |dk(  rt        |t              sJ d       | |fS |t        v rJt        |t              rt        |       t        |      fS t        |       |D ch c]  }t        |       c}fS | |fS c c}w )NrA   zextra value must be a string)rB   r7   rG   r   )rJ   rL   rv   vs       r#   
_normalizer}     s     g~#s#C%CC#Sz
""c3%c*,=c,BCC%c*3,Oa->q-A,OPP 8O -Ps   A7c                @    	 | |   S # t         $ r t        |      d w xY wr   )KeyErrorr   )environmentrv   s     r#   _lookup_environmentr     s.    63 6&s+56s    c           
        g g}| D ]3  }t        |t              r|d   j                  t        ||             3t        |t              r|\  }}}t        |t
              r%|j                  }t        ||      }|j                  }	n$|j                  }|j                  }t        ||      }	t        |t              s#t        d|d| d|j                         d      t        ||	|      \  }}	|d   j                  t        |||	|             	|dk(  r|j                  g        !|dk(  r(t        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 rr   )rv   orandzUnexpected marker c              3  2   K   | ]  }t        |        y wr   )all)rV   items     r#   rX   z$_evaluate_markers.<locals>.<genexpr>G  s     ,Ts4y,s   )rB   rC   append_evaluate_markersrE   r   rF   r   r7   r   r^   r}   rz   	TypeErrorany)
markersr   groupsr_   rJ   rK   rL   environment_key	lhs_value	rhs_values
             r#   r   r   #  sQ    !#tF =fd#2J/DE&!LCS#x("%))/_M	II	II	"%))/_M	i-)((; <B&' (!||~03  $.i#X Iy2Jhy"i_UVt^MM"u_0
;<<;=> ,V,,,r"   c                    | j                    d| j                   d| j                   }| j                  }|dk7  r||d   t	        | j
                        z   z  }|S )Nrr   finalr   )majorminormicroreleaselevelr7   serial)infoversionkinds      r#   _format_full_versionr   J  sW    Adjj\4::,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j                  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.
    rr   N   )r8   r-   r9   r:   r+   r;   r<   r,   r=   r*   r>   )r   sysimplementationr   nameosplatformmachinereleasesystemr*   python_implementationr]   python_version_tuple)iverr8   s     r#   _cached_default_environmentr   R  s       2 2 : :;D,,112"&77$,,.$,,.#??,$,,.'668*2*H*H*J((8#@#@#B2A#FG r"   c                 <    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B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y)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.
    )_markersc                    g | _         	 t        t        |            | _         y # t        $ r}t	        t        |            |d }~ww xY wr   )r   rP   _parse_markerr   r   r7   )selfr_   es      r#   __init__zMarker.__init__  sD     %'	/3M&4IJDM" ! 	/A'Q.	/s   # 	AAAc                6    | j                  |       }||_        |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   )rU   r   r   s    r#   __str__zMarker.__str__  s    dmm,,r"   c                N    d| j                   j                   dt        |       dS )Nrm   rZ   z)>)	__class__r0   r7   r   s    r#   __repr__zMarker.__repr__  s&    4>>**+1SYM<<r"   c                *    t        t        |             S r   )hashr7   r   s    r#   __hash__zMarker.__hash__  s    CIr"   c                \    t        |t              st        S t        |       t        |      k(  S r   )rB   r   NotImplementedr7   r   others     r#   __eq__zMarker.__eq__  s%    %(!!4yCJ&&r"   c                    t        |       S r   )r7   r   s    r#   __getstate__zMarker.__getstate__  s     4yr"   c                   t        |t              r	 t        t        |            | _        y t        |t              r!d|v r|d   }t        |t              r|| _        y t        |t              rDt        |      dk(  r6|\  }}t        |t              r!d|v r|d   }t        |t              r|| _        y t        d|      # t
        $ r}t        d|      |d }~ww xY w)NzCannot restore Marker from r   r   )rB   r7   rP   r   r   r   r   r   rC   rE   r\   )r   stateexcr   _	slot_dicts         r#   __setstate__zMarker.__setstate__  s    eS!R 7e8L M eT"zU':J'G'4( 'eU#E
a LAy)T*zY/F#J/gt,$+DM5eY?@@# % R"=eY GHcQRs   B? ?	CCCc                ~    t        |t              st        S | j                  | j                  d|j                  g      S )zXCombine this marker with another using ``and``.

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

        .. versionadded:: 26.1
        r   r   r   s     r#   __or__zMarker.__or__  s4    
 %(!!!!4==$"GHHr"   Nc                   t        dt                     }|dk(  r|t               t               dz  }n
|dk(  rd|d<   |*||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.
        !dict[str, str | AbstractSet[str]]r&   )r(   r)   r%    rA   z
str | None)r
   r   	frozensetr   r   r   _repair_python_full_version)r   r   contextcurrent_environmentrA   s        r#   evaluatezMarker.evaluate  s    8 #/1D1F
 k!#+%.[$  
"+-(";.-- \+>w+GHKP/@/GVX#G, MM67JK
 	
r"   )r_   r7   returnNone)r   r   r   r   )r   r7   )r   int)r   objectr   bool)r   r   r   r   )r   r   r   r   )Nr%   )r   z+Mapping[str, str | AbstractSet[str]] | Noner   r   r   r   )r0   r1   r2   r3   	__slots__r   classmethodr   r   r   r   r   r   r   r   r   r   r!   r"   r#   r   r   |  s}    & I/<  -='
A0JI DH#-2
@2
 !2
 
	2
r"   r   c                2    | j                  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(%&e,,r"   c                @    t        d| d         }t        |      | d<   | S )r   r7   r,   )r
   r   )envr,   s     r#   r   r   7  s-     uc*?&@A!<=P!QCJr"   )r   z	list[str])rH   MarkerList | MarkerAtom | strr   r   )rO   r   r   r   )T)r_   zlist[str] | MarkerAtom | strrS   zbool | Noner   r7   )
rJ   r7   rK   r   rL   str | AbstractSet[str]rv   r7   r   r   )rJ   r7   rL   r   rv   r7   r   z"tuple[str, str | AbstractSet[str]])r   r   rv   r7   r   r   )r   r   r   r   r   r   )r   zsys._version_infor   r7   )r   r   )r,   r7   r   r7   )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$   r7   r   Operatorr   rG   rs   
ValueErrorr   r   r   r   r   rD   rP   rU   eqnero   r?   rz   r}   r   r   r   cacher   r   r   r   r   r!   r"   r#   <module>r      s  
 #   	  
 . K K @ @ 2 ) 3 $' S%[%5 567=>@A	 !"56  J * 
x 
J) JZ)"<3 @D(1<6 &-	!
++
++
++
++	!	#
 	"	)03'*6269<66$-$-&G$-	$-N  2D n
 n
b		*	&	r"   