+
    :1jx                      a  0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIHtH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^RIHt ^RIHtHt ^RIHt ^RIH t  ^RI!H"t" ^RI#H$t% ^RI&H't'H(t(H)t) ^RI*H+t+ ^RI,H-t-H.t.H/t/ ^RI0H1t1 ^RI2H3t3H4t4 ^RI5H6t6 ^RI7H8t8H9t9  ^ RI:H:t: ]'       d   ^ RIH=t= ^RI>H?t? ]! ]@4      tA]P                  ! R4      tCR]DR&   ]P                  ! R]P                  4      tFR]DR&   ]P                  ! R 4      tGR]DR!&   ]P                  ! R"4      tHR]DR#&   ]P                  ! R$]P                  4      tIR]DR%&   ]P                  ! R&4      tJR]DR'&   ]P                  ! R(]P                  4      tKR]DR)&   ]P                  ! R*4      tLR]DR+&   ]P                  ! R,4      tMR]DR-&   ]P                  ! R.]P                  4      tNR]DR/&   R0 R1 ltO ! R2 R3]P4      tQ ! R4 R5]QR67      tRR7 tSR8 tTR9 tU/ tVR: R; ltWR< R= ltXR> tYR? tZR@ RA lt[ ! RB RC]R67      t\ ! RD RE4      t] ! RF RG]]]\4      t^ ! RH RI]^4      t_ ! RJ RK]]]\4      t` ! RL RM]`4      ta ! RN RO]\4      tb ! RP RQ]\4      tc ! RR RS]\4      td ! RT RU]`4      te ! RV RW]a4      tfRX]eRY]aRZ]9R[]`R\]8R]]cR^]cR_]fR`]fRa]fRb]dRc]d/tgR#   ]; d    ^RI<H:t:  ELi ; i)dzImplements the query language for conda packages (a.k.a, MatchSpec).

The MatchSpec is the conda package specification (e.g. `conda==23.3`, `python<3.7`,
`cryptography * *_0`) and is used to communicate the desired packages to install.
)annotationsN)ABCMetaabstractmethod)Mapping)reduce)chain)	getLogger)
attrgetter)basename)TYPE_CHECKING)memoizedproperty)CONDA_PACKAGE_EXTENSION_V1CONDA_PACKAGE_EXTENSION_V2)context)
isiterable)dashlist)groupby_to_dict)expandstrip_pkg_extensionurl_to_path)yaml)is_urlpath_to_urlunquote)
deprecated)InvalidMatchSpecInvalidSpec)Channel)BuildNumberMatchVersionSpec)
frozendict)AnyPackageRecordz.*(?:(\[.*\]))zre.Pattern[str]_BRACKETS_REa  
    ([a-zA-Z0-9_-]+?)       # key
    =                        # separator
    (["\']?)                 # optional opening quote
    ([^\'"]*?)               # value
    (\2)                     # matching closing quote
    (?:[,\ ]|$)              # delimiter or end
    _BRACKETS_KV_REz^.*?(\[.*\])_BRACKETS_RE_V3z,\s*,_LIST_EMPTY_ITEM_REa+  
    (?P<key>[a-zA-Z0-9_-]+?)        # key
    \ *=\ *                         # separator, with or without surrounding spaces
    (?:                             # the value can be a:
                                      # 1. a list of maybe-quoted strings (key={extras,flags})
                                      #    this has to be matched first so we can capture
                                      #    comma-separated lists fully (e.g. flags=[a, b])
                                      #    without being caught by 'when' specs like
                                      #    `python[version='>=3,<4']`
        \[\ *                           # opening square bracket, with maybe spaces
        (?P<value_list>[^\[\]]*?)         # inner value; will be parsed as YAML, this is enough.
                                          # a previous attempt had a more sophisticated regex
                                          # with quote and comma tracking, but it hang with input:
                                          # 'channel=https://repo.anaconda.com/pkgs/free'
        \ *\]                           # matching closing square bracket closes the list
        |                             # 2. maybe-quoted string
        (?P<quote_s>["']?)              # optional opening quote
        (?P<value>.*?)                  # non-greedy value; will be post-processed later
                                        # depending on the key type
        (?P=quote_s)                    # matching closing quote
    )
    (?:[,\ ]|$)               # delimiter or end
    _BRACKETS_KV_RE_V3z.*(?:(\(.*\)))
_PARENS_REza
    ([^\ =<>!~]+)?          # package name
    ([><!=~\ ].+)?          # version constraint
    _NAME_VERSION_REz;^(([a-z0-9])|([a-z0-9_](?!_)))[._-]?([a-z0-9]+(\.|-|_|$))*$_CEP26_NAME_REz(^__[a-z0-9][._-]?([a-z0-9]+(\.|-|_|$))*$_CEP26_VIRTUAL_NAME_REz
    ((?:.+?)[^><!,|]?)      # version (non-greedy, not ending in operator)
    (?:
        (?<![=!|,<>~])      # not preceded by an operator
        (?:[\ =])           # space or equals separator
        ([^-=,|<>~]+?)      # build string
    )?$
    _VERSION_BUILD_REc               $    V ^8  d   QhRRRRRR/# )   namestroriginal_spec_strreturnNone )formats   "7lib/python3.14/site-packages/conda/models/match_spec.py__annotate__r8   |   s!     
 
 
 
 
    c           	     b   RV 9   d   R# V P                  4       p\        P                  ! RV4      ;p'       d3   \        VRRP	                  \
        P                  V4      4       R24      h\        P                  V4      '       g*   \        P                  V4      '       g   \        VR4      hR# R# )zValidate a package name against CEP-26 rules.

Glob patterns (containing *) are not validated.
Names are lowercased before checking since conda normalizes case.
*Nz[^a-z0-9._-]z*package name contains invalid characters ( )zinvalid package name)
lowerrefindallr   joindictfromkeysr+   matchr,   )r0   r2   
normalizedinvalids   &&  r7   _validate_package_namerG   |   s     d{J**_j99w98wAW9X8YYZ[
 	

 	Z((,B,H,H,T,T"
 	
 -U(r9   c                  ,   a  ] tR t^tRV 3R lltRtV ;t# )MatchSpecTypec                	V  <  V'       Ed   \        V\        4      '       d   V'       g   V# \        V\        4      '       d   \        VP                  4      pVP	                  R VP
                  4       VP	                  RVP                  4       VP                  VR&   VP                  ! R/ VB  \        SV `(  ! R/ VB # \        V\        4      '       d\   \        V4      pV'       d9   \        V3/ VB p\        V4      R R0,
          '       d   VP                  RR4       \        SV `(  ! R/ VB # \        V\        4      '       d   \        V3/ VB p\        SV `(  ! R/ VB # \!        VR4      '       d'   VP#                  4       pV'       d   \        V3/ VB # V# \%        RV RV 24      h\        SV `(  ! R/ VB #   \$         db   pRpT'       d
   Yq ,          pT'       d5   TRR	P'                  R
 TP)                  4        4       4      ,           ,          p\+        YvR7      ThRp?ii ; i)optionaltarget_original_spec_strNto_match_speczInvalid MatchSpec:
  spec_arg=z

  kwargs=r<    , c              3  4   "   T F  w  rV R V 2x  K  	  R# 5i)=Nr5   ).0kvs   &  r7   	<genexpr>)MatchSpecType.__call__.<locals>.<genexpr>   s     &Mnda!AaSzns   )detailsr5   )
isinstance	MatchSpecrB   _match_components
setdefaultrK   rL   r2   updatesuper__call__r1   _parse_spec_str_dispatchersetpopr   hasattrrN   r   rA   itemsr   )	clsspec_argkwargs
new_kwargsparsedspecemsg	__class__s	   &&,     r7   r_   MatchSpecType.__call__   s   )	:xh	226#O)44!%h&@&@!AJ))*h6G6GH))(HOOD7?7Q7QJ34%%// 7+9j99#..7AF!%f!7!7v;*h)??? #JJ';TB 7+5f55'22!(5f5F 7+5f55X77#113D(888#%9(;vhW  w'1&11 	:C$sTYY&Mflln&MMMM"329	:sS   F< F< F< BF<  A0F< 11F< #)F< F< F<  F< <H(H#"AH##H(r5   N)__name__
__module____qualname____firstlineno__r_   __static_attributes____classcell__rm   s   @r7   rI   rI      s    *: *:r9   rI   c                     ] tR t^tRtR't]! ]4      t/ tR(R lt	]
R 4       tR tR tR)R lt]R 4       tR	 t]R
 4       t]R 4       t]R 4       tR R ltR tR tR tR tR tR tR tR tR tR tR t ]!R 4       t"R t#R t$]%R 4       t&]R 4       t']R 4       t(]R  4       t)]R! 4       t*]R" 4       t+]
R*R# l4       t,]
R$ 4       t-R*R% lt.R&t/R# )+rZ   a  The query language for conda packages.

Any of the fields that comprise a :class:`PackageRecord` can be used to compose a
:class:`MatchSpec`.

:class:`MatchSpec` can be composed with keyword arguments, where keys are any of the
attributes of :class:`PackageRecord`.  Values for keyword arguments are the exact values the
attribute should match against.  Many fields can also be matched against non-exact values--by
including wildcard `*` and `>`/`<` ranges--where supported.  Any non-specified field is
the equivalent of a full wildcard match.

:class:`MatchSpec` can also be composed using a single positional argument, with optional
keyword arguments.  Keyword arguments also override any conflicting information provided in
the positional argument.  The positional argument can be either an existing :class:`MatchSpec`
instance or a string.  Conda has historically supported more than one string representation
for equivalent :class:`MatchSpec` queries.  This :class:`MatchSpec` should accept any existing
valid spec string, and correctly compose a :class:`MatchSpec` instance.

A series of rules are now followed for creating the canonical string representation of a
:class:`MatchSpec` instance.  The canonical string representation can generically be
represented by

    (channel(/subdir):(namespace):)name(version(build))[key1=value1,key2=value2]

where `()` indicate optional fields.  The rules for constructing a canonical string
representation are:

1. `name` (i.e. "package name") is required, but its value can be '*'.  Its position is always
   outside the key-value brackets.
2. If `version` is an exact version, it goes outside the key-value brackets and is prepended
   by `==`. If `version` is a "fuzzy" value (e.g. `1.11.*`), it goes outside the key-value
   brackets with the `.*` left off and is prepended by `=`.  Otherwise `version` is included
   inside key-value brackets.
3. If `version` is an exact version, and `build` is an exact value, `build` goes outside
   key-value brackets prepended by a `=`.  Otherwise, `build` goes inside key-value brackets.
   `build_string` is an alias for `build`.
4. The `namespace` position is being held for a future conda feature.
5. If `channel` is included and is an exact value, a `::` separator is ued between `channel`
   and `name`.  `channel` can either be a canonical channel name or a channel url.  In the
   canonical string representation, the canonical channel name will always be used.
6. If `channel` is an exact value and `subdir` is an exact value, `subdir` is appended to
   `channel` with a `/` separator.  Otherwise, `subdir` is included in the key-value brackets.
7. Key-value brackets can be delimited by comma, space, or comma+space.  Value can optionally
   be wrapped in single or double quotes, but must be wrapped if `value` contains a comma,
   space, or equal sign.  The canonical format uses comma delimiters and single quotes.
8. When constructing a :class:`MatchSpec` instance from a string, any key-value pair given
   inside the key-value brackets overrides any matching parameter given outside the brackets.

When :class:`MatchSpec` attribute values are simple strings, the are interpreted using the
following conventions:

  - If the string begins with `^` and ends with `$`, it is converted to a regex.
  - If the string contains an asterisk (`*`), it is transformed from a glob to a regex.
  - Otherwise, an exact match to the string is sought.

Some fields (`extras`, `flags`) allow list of strings. They must be passed with Python
syntax for lists. Quotes are optional like in YAML.

The `when` field expects a string that can be parsed as a `MatchSpec`. This inner spec
cannot contain another `when` field.

Examples:
    >>> str(MatchSpec(name='foo', build='py2*', channel='conda-forge'))
    'conda-forge::foo[build=py2*]'
    >>> str(MatchSpec('foo 1.0 py27_0'))
    'foo==1.0=py27_0'
    >>> str(MatchSpec('foo=1.0=py27_0'))
    'foo==1.0=py27_0'
    >>> str(MatchSpec('conda-forge::foo[version=1.0.*]'))
    'conda-forge::foo=1.0'
    >>> str(MatchSpec('conda-forge/linux-64::foo>=1.0'))
    "conda-forge/linux-64::foo[version='>=1.0']"
    >>> str(MatchSpec('*/linux-64::foo>=1.0'))
    "foo[subdir=linux-64,version='>=1.0']"
    >>> str(MatchSpec('package[extras=[a,b]]'))
    "package[extras=['a', 'b']]"
    >>> str(MatchSpec('package[when=__unix]'))
    'package[when=__unix]'

To fully-specify a package with a full, exact spec, the fields
  - channel
  - subdir
  - name
  - version
  - build
must be given as exact values.  In the future, the namespace field will be added to this list.
Alternatively, an exact spec is given by '*[md5=12345678901234567890123456789012]'
or '*[sha256=f453db4ffe2271ec492a2913af4e61d4a6c118201f07de757df0eff769b65d2e]'.
Nc                	z    Wn         W n        VP                  R R4      V n        V P                  ! R/ VB V n        R# )rM   Nr5   )	_optional_targetrb   rM   _build_componentsr[   )selfrK   rL   rg   s   &&&,r7   __init__MatchSpec.__init__2  s6    !"(**-A4"H!%!7!7!A&!Ar9   c                	   / pV\        \        4      ) R  \        8X  d   VR \        \        4      )  pM/V\        \        4      ) R  \        8X  d   VR \        \        4      )  pRV9   d^   VP                  R^4      w  r1RV9   d?   VP	                  R^4      w  rEV\
        P                  9  d   TpR pWBR&   V'       d   WRR&   MW2R&   VP	                  R^4      w  rgpVP                  RVRVRV/4       V ! R	/ VB # )
N::/channelsubdir-r0   versionbuildr5   )lenr   r   splitrsplitr   known_subdirsr]   )	re   dist_strpartschannel_subdir_strchannel_strr   r0   r   r   s	   &&       r7   from_dist_strMatchSpec.from_dist_str8  s   S34467;UU B3'A#B"BCHs56689=WW B3'A#B"BCH8+3>>$+B(((&8&?&?Q&G#!6!66"4K!F#.i &,(O#5i 'sA6u7	
 |U|r9   c                	d    V P                   P                  V4      pT;'       d    VP                  # ro   )r[   getexact_valuer|   
field_namerU   s   && r7   get_exact_valueMatchSpec.get_exact_valueV  s*    ""&&z2""Q]]"r9   c                	d    V P                   P                  V4      pT;'       d    VP                  # ro   )r[   r   	raw_valuer   s   && r7   get_raw_valueMatchSpec.get_raw_valueZ  s*    ""&&z2  Q[[ r9   c                	4    V P                  V4      pVf   V# T# ro   )r   )r|   r   defaultrU   s   &&& r7   r   MatchSpec.get^  s!    z*)w**r9   c                	    \        V P                  4      ^8H  ;'       d'    RV P                  9   ;'       d    V P                  R8g  # )   r0   r;   )r   r[   r0   r|   s   &r7   is_name_only_specMatchSpec.is_name_only_specb  sJ     &&'1, ! !$000! !		S 	
r9   c                	"    V P                  4       # ro   __str__r   s   &r7   r   MatchSpec.dist_strj      ||~r9   c                	    V P                   # ro   )ry   r   s   &r7   rK   MatchSpec.optionalm  s    ~~r9   c                	    V P                   # ro   )rz   r   s   &r7   rL   MatchSpec.targetq  s    ||r9   c                	    V P                   # ro   )rM   r   s   &r7   r2   MatchSpec.original_spec_stru  s    &&&r9   c                    V ^8  d   QhRRRR/# )r/   reczPackageRecord | dict[str, Any]r3   boolr5   )r6   s   "r7   r8   MatchSpec.__annotate__y  s      7 D r9   c                    \        V\        4      '       d   ^RIHp VP                  ! V4      pV P
                  P                  4        F)  w  r4VR8X  d   K  V P                  WV4      '       d   K(   R# 	  R# )z
Accepts a `PackageRecord` or a dict, and matches can pull from any field
in that record.  Returns True for a match, and False for no match.
r"   whenFT)rY   rB   recordsr#   from_objectsr[   rd   _match_individual)r|   r   r#   r   rU   s   &&   r7   rD   MatchSpec.matchy  sg    
 c4  .,,S1C!3399;MJV# ))#1== < r9   c                	f    \        W4      p VP                  V4      #   \         d    Y48H  u # i ; iro   )getattrrD   AttributeError)r|   recordr   match_componentvals   &&&& r7   r   MatchSpec._match_individual  s:    f)	*"((-- 	*"))	*s    00c                	h    \        V P                  4      ^8H  ;'       d    V P                  R4      RJ# )r   r0   N)r   r[   r   r   s   &r7   
_is_simpleMatchSpec._is_simple  s7    &&'1, 9 9$$V,D8	
r9   c                	2    \        V P                  4      ^8H  # )r   )r   r[   r   s   &r7   
_is_singleMatchSpec._is_single  s    4))*a//r9   c                	L  a  S P                  R 4      pV'       d   V# \        ;QJ d    . V 3R lR 4       F  NK  	  5M! V 3R lR 4       4      p\        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       g   RP                  ! V!  \        ,           # R# )fnc              3  F   <"   T F  pSP                  V4      x  K  	  R # 5iro   r   )rS   xr|   s   & r7   rV   4MatchSpec._to_filename_do_not_use.<locals>.<genexpr>  s!     S6RT))!,,6Rs   !c              3  (   "   T F  qR J x  K
  	  R # 5iro   r5   rS   r   s   & r7   rV   r     s     +d9ds   TFz{}-{}-{}Nr0   r   r   )r   tupleanyr6   r   )r|   fn_fieldvalss   f  r7   _to_filename_do_not_use!MatchSpec._to_filename_do_not_use  sx     ''-OuS6RSuuS6RSSs+d+sss+d+++%%t,0JJJr9   c                	(   V P                   P                   R V  R2.pV P                  '       d    VP                  RV P                   R24       V P                  '       d   VP                  R4       VP                  R4       RP                  V4      # )z(""z
, target="z, optional=Truer=   r<   )rm   rp   rL   appendrK   rA   )r|   builders   & r7   __repr__MatchSpec.__repr__  su    nn--.ba89;;;NNZ}A67===NN,-swwwr9   c                		  a	a
a . p. pV P                   P                  R 4      pV'       d.   VP                  '       d   VP                  \	        V4      4       M7V'       d0   VP
                  '       g   VP                  R\	        V4       24       V P                   P                  R4      pV'       dD   V'       d(   VP                  '       d   VP                  RV 24       MVP                  RV 24       V P                   P                  RR4      pTP                  V'       d   RMRV,          4       V P                   P                  R	4      oV P                   P                  R
4      o	RpS'       Ed=   \	        S4      o\        ;QJ d    V3R lR 4       F  '       g   K   RM	  RM! V3R lR 4       4      '       d   VP                  RS R24       MSR,          R"9   d1   S	'       d   VP                  RS R24       MVP                  S4       MSR#R R8X  d   VP                  RSRR# ,           4       MwSR8X  d   MoSR$,          R8X  d   VP                  RSRR$ ,           4       MESP                  R4      '       d   VP                  S4       RpMVP                  RS,           4       RpS	'       d   \	        S	4      o	\        ;QJ d    V	3R lR 4       F  '       g   K   RM	  RM! V	3R lR 4       4      '       d   VP                  RS	 R24       MQRS	9   d   VP                  RS	 24       M5V'       d   VP                  RS	,           4       MVP                  RS	 24       0 R%mpRV P                   9   d#   RV P                   9   d   VP                  R4       V P                   F  pW9  g   K  WP                   9   g   K  VR8X  d   V'       d   K.  \	        V P                   V,          4      o
S
P                  R4      '       d    VR&9   d   VP                  V RS
 24       K  \        ;QJ d    V
3R lR 4       F  '       g   K   RM	  RM! V
3R lR 4       4      '       d   VP                  V RS
 R24       K  VP                  V RS
 24       K  	  V'       d0   VP                  RP                  R P                  V4      4      4       R!P                  V4      # )'r   zchannel=r   r   zsubdir=r0   r;   z::%sz%sr   r   Fc              3  ,   <"   T F	  qS9   x  K  	  R # 5iro   r5   )rS   sr   s   & r7   rV   $MatchSpec.__str__.<locals>.<genexpr>  s     2A<   z><$^|,Tz	version='':Nr/   NN.*rR   ==c              3  ,   <"   T F	  qS9   x  K  	  R # 5iro   r5   )rS   r   r   s   & r7   rV   r     s     0x!:xr   zbuild='zbuild=urlr   [c              3  ,   <"   T F	  qS9   x  K  	  R # 5iro   r5   )rS   r   values   & r7   rV   r     s     3UeUr   z, =z='[{}],r<   )z!=z~=>   r0   r   r   r   r   )extrasflags)r[   r   r   r   r1   matches_allr   
startswithaddFIELD_NAMESr6   rA   )r|   r   bracketschannel_matchersubdir_matchername_matcherversion_exact_skipkeyr   r   r   s   &        @@@r7   r   MatchSpec.__str__  s   0044Y?:::NN3/0_%@%@%@OOhs?';&<=>//33H=?#>#>#>>"234'.)9 :;--11&#>'t|CD((,,Y7&&**737'lGs22sss2222)G9A 67,OOiy$:;NN7+%sWSb\12 C#sWSb\12##D))w' $tg~. $JEs0x0sss0x000'% 23& 01sU{+& 01AD***tt7M7M/MIIdO##CC+A+A$A%<OD22378##C((S4G-GOOse1UG$45S3U3SSS3U333OOse2eWA$67OOse1UG$45 $ NN6==();<=wwwr9   c                	"    V P                  4       # ro   r   r   s   &r7   __json__MatchSpec.__json__   r   r9   c                	F   . pV P                  R 4      pV'       g   \        R4      hVP                  V4       V P                  R4      pV P                  R4      pV'       d   T;'       g    RpWV.,          pMV'       d   VP                  V4       RP	                  V4      # )r0   z3.conda_build_form() requires a non-empty spec name.r   r   r;   rO   )r   
ValueErrorr   r   rA   )r|   r   r0   r   r   s   &    r7   conda_build_formMatchSpec.conda_build_form  s    ##F+RSSt""7+$$Y/nnG''GNN7#xx  r9   c                    \        V 4      pRV9   d   VP                  R^4      ^,          pRV9   d   VP                  RR^4      pV# )aq  
Return the package specification in conda environment export format.

This produces the format used by `conda env export`: name=version=build
(single equals), without channel prefixes and without .* patterns.

Examples:
    >>> MatchSpec("numpy==1.21.0=py39h1234567_0").conda_env_form()
    'numpy=1.21.0=py39h1234567_0'
    >>> MatchSpec("numpy=1.21.0").conda_env_form()  # no-builds case
    'numpy=1.21.0'
    >>> MatchSpec("conda-forge::numpy==1.21.0=py39h1234567_0").conda_env_form()
    'numpy=1.21.0=py39h1234567_0'
    >>> # channel prefix removed

Returns:
    str: Package specification in conda env export format
r   r   rR   )r1   r   replace)r|   spec_strs   & r7   conda_env_formMatchSpec.conda_env_form  sO    ( t9 8~~dA.q1H 8''c15Hr9   c                	d    \        V\        4      '       d   V P                  VP                  8H  # R # F)rY   rZ   	_hash_keyr|   others   &&r7   __eq__MatchSpec.__eq__5  s%    eY''>>U__44r9   c                	,    \        V P                  4      # ro   )hashr  r   s   &r7   __hash__MatchSpec.__hash__;  s    DNN##r9   c                	H    V P                   V P                  V P                  3# ro   )r[   rK   rL   r   s   &r7   r  MatchSpec._hash_key>  s    %%t}}dkkAAr9   c                	    WP                   9   # ro   r[   )r|   fields   &&r7   __contains__MatchSpec.__contains__B  s    ....r9   c                	   a \        V4      \        P                  ,
          pV'       d   \        V P                  R V 24      h\        P
                  o\        V3R lVP                  4        4       4      # )zCannot match on field(s): c              3  8   <"   T F  w  rS! W4      x  K  	  R # 5iro   r5   )rS   r   r   _make_components   &  r7   rV   .MatchSpec._build_components.<locals>.<genexpr>L  s     W*#/#55s   )ra   rZ   FIELD_NAMES_SETr   rM   r  r    rd   )r|   rg   
not_fieldsr  s   &, @r7   r{   MatchSpec._build_componentsE  s^    [9#<#<<
"''+Ej\)R  $33WWWWr9   c                	   \        VR 4      '       d   TpW3# \        P                  pW3pVP                  V4      pV'       d   W3# V \        9   d   \        V ,          ! V4      pM\        \        V4      4      pW#W3&   W3# rD   )rc   rZ   _MATCHER_CACHEr   _implementorsExactStrMatchr1   )r   r   matcherr!  	cache_keycached_matchers   &&    r7   r  MatchSpec._make_componentN  s    5'""G&&"11'	'++I6--&#J/6G#CJ/G.5
*+""r9   c                	8    V P                  R 4      ;'       g    R# )r0   r;   r   r   s   &r7   r0   MatchSpec.name`  s    ##F+22s2r9   c                	   a  \        V 3R  lR 4       4      pV\        S P                  4      8  d   ^# S P                  R4      '       d   RS P                  9   d   ^# RS P                  9   d   ^# ^# )c              3  @   <"   T F  qSP                   9   x  K  	  R # 5iro   r  )rS   fr|   s   & r7   rV   'MatchSpec.strictness.<locals>.<genexpr>l  s     R5QT+++5Qs   r0   r   r   r   )sumr   r[   r   )r|   r   s   f r7   
strictnessMatchSpec.strictnessh  sa     R5QRRs4))**%%f--D<R<R1R$000r9   c                	"    V P                  4       # ro   )r   r   s   &r7   rj   MatchSpec.specv  s    $$&&r9   c                	8    V P                   P                  R 4      # )r   )r[   r   r   s   &r7   r   MatchSpec.versionz  s     %%)))44r9   c                	    V P                  R 4      ;'       g    V P                  R4      pV'       d   \        V4      pV'       g   \        R4      hV# )r   r   z.fn cannot be empty.)r   r
   r   )r|   r   s   & r7   r   MatchSpec.fn  sE      &CC$*<*<U*C3-C344
r9   c                	  a a \        \        ;QJ d    . V 3R  lV 4       F  NK  	  5M! V 3R  lV 4       4      \        R7      p\        \	        R4      V4      pVP                  R. 4      VP                  R. 4      ,           p. p\        \        P                  ! R VP                  4        4       4      4      pV F  p\        \	        R4      V4      pVP                  RR4       \        V4      ^8  d   \        R\        V4       24      hTP                  \        V4      ^8  d   \        V3R lV4      MV^ ,          4       K  	  . VOVO5# )	c              3  F   <"   T F  q'       g   K  S! V4      x  K  	  R # 5iro   r5   )rS   r   re   s   & r7   rV   "MatchSpec.merge.<locals>.<genexpr>  s     "D;a!63q66;s   	!!)r   r0   r;   Nc              3  X   "   T F   p\        R  V4      P                  4       x  K"  	  R# 5i)c                    V P                   # ro   )rK   )r   s   &r7   <lambda>+MatchSpec.merge.<locals>.<genexpr>.<lambda>  s    !**r9   N)groupbyvalues)rS   groups   & r7   rV   r9    s+       1E ,e4;;==1s   (*rL   zIncompatible MatchSpec merge:c                (   < V P                  VS4      # ro   )_merge)r   yunions   &&r7   r<  !MatchSpec.merge.<locals>.<lambda>  s    AHHQ$6r9   )sortedr   r1   r>  r	   rb   r   from_iterabler?  r   r   r   r   r   )	re   match_specsrD  name_groupsunmergeablemerged_specsmergeable_groupsr@  target_groupss	   f&f      r7   mergeMatchSpec.merge  s   UU"D;"DUU"D;"DD#Nj0+>!ooc2.r1JJ   (//1  
 &E#Jx$8%@MdD)=!A% #@%@Q!RSSu:> 6>1X & -,,,r9   c                	(    V P                  VR R7      # )T)rD  )rN  )re   rH  s   &&r7   rD  MatchSpec.union  s    yyDy11r9   c                	   V P                   VP                   8w  g   V P                  VP                  8w  d   \        R V  RV 24      h/ p\        V P                  4      \        VP                  4      ,          pV F  pV P                  P                  V4      pVP                  P                  V4      pVf   Vf   KC  Vf   WsV&   KM  Vf   WcV&   KW  V'       d    VP                  V4      pMVP                  V4      pWV&   K  	  V P                  ! RRV P                   RV P                  /VB #   \        \        \        3 d    T RT 2p LQi ; i)z!Incompatible MatchSpec merge:  - 
  - |rK   rL   r5   )rK   rL   r   ra   r[   r   rD  r   	TypeErrorrN  rm   )	r|   r
  rD  final_componentscomponent_namescomponent_namethis_componentthat_componentfinals	   &&&      r7   rB  MatchSpec._merge  sR   ==ENN*dkkU\\.I@fUGTUUd445E<S<S8TT-N!3377GN"4488HN%.*@'3A0'3A0E . 4 4^ D +00@E380# .$ ~~ 
]]
+/;;
:J
 	
 +J	B E#1"2!N3C DEs   D00EE)r[   ry   rM   rz   )r   r   r0   r   r   build_numbertrack_featuresfeaturesr   md5sha256licenselicense_familyr   r   r   r   )FNro   r  )0rp   rq   rr   rs   __doc__r   	frozensetr  r!  r}   classmethodr   r   r   r   propertyr   r   rK   rL   r2   rD   r   r   r   r   r   r   r   r   r  r  r  r   r  r  r{   staticmethodr  r0   r/  rj   r   r   rN  rD  rB  rt   r5   r9   r7   rZ   rZ      s   XtK&  ,ONB  :#!+ 
 
     ' '&*
0
 M ^!$@$ B B/X # #" 3 3   ' ' 5 5
   - -0 2 2
 
r9   rZ   )	metaclassc                    \         P                  V 4      pV'       d.   VP                  4       w  r#T;'       d    VP                  4       pMT Rr2T;'       d    VP	                  RR4      V3# )a  This should reliably pull the build string out of a version + build string combo.
Examples:
    >>> _parse_version_plus_build("=1.2.3 0")
    ('=1.2.3', '0')
    >>> _parse_version_plus_build("1.2.3=0")
    ('1.2.3', '0')
    >>> _parse_version_plus_build(">=1.0 , < 2.0 py34_0")
    ('>=1.0,<2.0', 'py34_0')
    >>> _parse_version_plus_build(">=1.0 , < 2.0 =py34_0")
    ('>=1.0,<2.0', 'py34_0')
    >>> _parse_version_plus_build("=1.2.3 ")
    ('=1.2.3', None)
    >>> _parse_version_plus_build(">1.8,<2|==1.7")
    ('>1.8,<2|==1.7', None)
    >>> _parse_version_plus_build("* openblas_0")
    ('*', 'openblas_0')
    >>> _parse_version_plus_build("* *")
    ('*', '*')
NrO   r<   )r-   searchgroupsstripr  )v_plus_br   r   r   s   &   r7   _parse_version_plus_buildro    s\    ( $$X.E''%++-!4//wsB/66r9   c                N    \        V 4      w  rV P                  R^4      w  r#pW#V3# )z
Examples:
    >>> _parse_legacy_dist("_license-1.1-py27_1.tar.bz2")
    ('_license', '1.1', 'py27_1')
    >>> _parse_legacy_dist("_license-1.1-py27_1")
    ('_license', '1.1', 'py27_1')
r   )r   r   )r   _r0   r   r   s   &    r7   _parse_legacy_distrr    s0     &h/KH#??32D5%r9   c                    V '       g   R# \        V 4      pVP                  ;'       g    VP                  pW!P                  3# )N)NN)r   r0   base_urlr   )channel_valchnchannel_names   &  r7   _parse_channelrx    s7    
+
C88++s||L##r9   c               $    V ^8  d   QhRRRRRR/# )r/   r   r1   r   z
str | Noner3   r5   )r6   s   "r7   r8   r8     s!     4 43 4z 4c 4r9   c                t  a V R9   d   V # V P                  R4      '       g   V # V P                  R4      oV P                  R4      '       d   Vf   S# \        ;QJ d    V3R lR 4       F  '       g   K   RM	  RM! V3R lR 4       4      '       g'   Vf!   SP                  R4      '       g
   SR,           # S# V # )	a  
Sanitize version strings for MatchSpec parsing.

Handles edge cases and translates version patterns for proper MatchSpec processing.

Empty operators like "==" are passed through so existing error handling code can
treat them like other incomplete operators ("<=" or ">="). This is necessary because
downstream translation code would mangle "==" into an empty string, resulting in an
empty version field that breaks logic expecting missing versions to be represented
as operators like "==", "<=", and ">=".

These missing version cases result from match specs like "numpy==", "numpy<=",
"numpy>=", "numpy= " (with trailing space), which should be treated as errors.
Note: "numpy=" (no trailing space) is treated as valid.

For simple versions starting with "=", translates patterns like "=1.2.3" to "1.2.3*"
when appropriate conditions are met.

Args:
    version: The version string to sanitize
    build: Optional build string that affects sanitization behavior

Returns:
    Sanitized version string

Examples:
    "==" or "=" -> passed through for error handling
    "==1.2.3" -> "1.2.3" (when build is None)
    "=1.2.3" -> "1.2.3*" (when build is None and no special chars)
    ">=1.0" -> ">=1.0" (unchanged, doesn't start with "=")
r   rR   c              3  ,   <"   T F	  qS9   x  K  	  R # 5iro   r5   )rS   charversion_without_equalss   & r7   rV   (_sanitize_version_str.<locals>.<genexpr>'  s     @%$--%r   z=,|TFr;   )r   rR   )r   lstripr   endswith)r   r   r}  s   &&@r7   _sanitize_version_strr    s    B + c""$^^C0 $EM%% 3@%@333@%@@@=!7!@!@!E!E)C//%%Nr9   c                   V ^8  d   QhRR/# )r/   r3   zdict[str, object]r5   )r6   s   "r7   r8   r8   /  s     % %,= %r9   c                X    \         P                  R8X  d   \        V 4      # \        V 4      # )z=
Temporary dispatcher while we introduce the new v3 features
rattler)r   solver_parse_spec_str_v3_parse_spec_str)r  s   &r7   r`   r`   /  s&     ~~"!(++8$$r9   c                4
   \         P                  V 4      pV'       d   V# T pV P                  R 4      '       d   V RR pRRRV3/# RV 9   d*   V P                  R4      pV RV WR rPV P	                  4        V P                  R^4      p\        V4      ^8  d   \        P                  RV 4       V^ ,          p \        P                  P                  V 4      '       d   \        V 4      '       g   \        \        \        V 4      4      4      p \!        V 4      pVP"                  '       dI   \%        VP&                  4      w  rp
RVP(                  R	VP"                  RVR
V	RV
RVP&                  RV /pV# V P+                  R4      '       d   \-        V 4      pMT pRRR\/        V4      RV /# / p\0        P3                  V 4      pV'       d   VP5                  4       ^ ,          pV P7                  VR4      p V^R p\8        P;                  V4      pV Fq  pVP5                  4       w  ppppV'       d	   V'       g   \=        VR4      hVR
8X  d2   V'       d*   \?        VVPA                  4       P                  R4      4      pVVV&   Ks  	  \B        P3                  V 4      p/ pV'       ds   VP5                  4       ^ ,          pV P7                  VR4      p V^R p\8        P;                  V4      pV F  pVP5                  4       w  ppppVVV&   K  	  RV9   d   RVR&   V PE                  R^4      p\        V4      pV^8X  d   Vw  ppp M/V^8X  d	   Vw  pp RpM V'       d   V^ ,          p RRppM
\G        4       h\I        V4      w  ppRV9   d2   \I        VPK                  R4      4      w  ppV'       d   TpV'       d   TpR	V9   d   VPK                  R	4      p\L        P3                  V 4      pV'       d3   VP5                  4       w  rVf   \=        VRV  R24      h\O        W4       M\=        VR4      hT ;'       d    V P	                  4       p V '       d-   RV 9   d   \=        VR4      h\Q        V 4      w  r\?        W4      p	MRRr/ pT;'       g    RVR&   Ve   VVR&   Ve   VVR	&   Ve    V	e   V	VR
&   V
e   V
VR&   RV9   dG   RV9   d@   RVR,           RVR,           RVR,           R2p \R        PT                  ! V \V        4       VR VPY                  V4       VVR&   V\         V&   V# )@Nr0   r;   r^  #z if zIgnoring conditional in spec %sr   r   r   r   r   r   file://r<   zkey-value mismatch in bracketsrK   T:no package name found in 'r   no package name foundr   &multiple brackets sections not allowed'name' specified both inside () and outside (.) of brackets. The value outside of brackets () will be used.rM   r   )-_PARSE_CACHEr   r  indexrm  r   r   logdebugr   plugin_managerhas_package_extensionr   r   r   r   r   r   rr  package_filenamecanonical_namer   r   r
   r$   rD   rl  r  r%   finditerr   r  	groupdictr)   r   NotImplementedErrorrx  rb   r*   rG   ro  warningswarnUserWarningr]   )!r  cached_resultr2   feature_namendxrq  
spec_splitr   r0   r   r   resultpath_or_urlr   m3brackets_strm3brD   r   r   m4parens
parens_strm4bm5m5_lenr   	namespacer   	b_channelb_subdir
componentsrl   s!   &                                r7   r  r  8  sF    $$X.M  }C|o
 	
 hnnS!tnhtn! *J
:		3X>!}H 33H==h{6(+;<=H(#>>>#5g6N6N#O D5711'..7g..xF,  ""9--)(3& h{+x  H			H	%B	yy{1~##L"5#Ab)&&|4E$||~CE1e&%'G  iE-eU__5F5J5J75ST!HSM  
		(	#BF	YY[^
##J3"%
&&z2E$||~CE1F3K  #!%F: 
a	 BWF{+-(Y	1 	8	a5!%tYY!##$[1OGVH,X\\)-DE	8GF8h' 
			)B	<"!%?z#K  	t702IJJ ,,HNN,H
 (?"!#K  38<'7t JJv '
9%
8 '
9#
7 ( 2,Xf-=,> ?6"# $6"#?4 	
 	c;'Vh'8J#$&0L"#r9   c                   \         P                  V 4      pV'       d   V# T pV P                  R4      '       d   V RR5 pRRRV3/# RV 9   d*   V P                  R4      pV RV WR rPV P	                  4        \
        P                  P                  V 4      '       d   \        V 4      '       g   \        \        \        V 4      4      4      p \        V 4      pVP                  '       dI   \        VP                  4      w  rxp	RVP                   RVP                  RVR	VR
V	RVP                  RV /p
V
# V P#                  R4      '       d   \%        V 4      pMT pRRR\'        V4      RV /# / p\(        P+                  V 4      pV'       Edo   VP-                  4       ^ ,          pV P/                  VR4      p V^R5 p\1        \2        P5                  V4      4      pV EFg  pVP7                  4       pVR,          pVV9   d   \9        RV R24      hVR,          ;'       g
    VR,          pV'       d	   V'       g   \9        R4      hRV9   d   \9        R4      hVR69   d   V^ ,          R8H  VR5,          R8H  ,          '       d   \9        RV RV 24      hVP	                  R4      p\:        P=                  V4      '       d   \9        RV RV: 24      h\>        ;QJ d,    . R \@        PB                  ! RV R24       4       F  NK  	  5M%! R \@        PB                  ! RV R24       4       4      pMVR8X  d   \E        V4       VVV&   EKj  	  V'       d@   WR5,          PG                  4       R P	                  R4      pV'       d   \9        R V: 24      hV'       gf   VP#                  R	4      '       d@   V\I        R	4      R p\K        VR4      VR	&   \L        PN                  ! R!R"R#R$V R%V R&2R'7       M\9        R(V R)24      hVP                  R	4      ;p'       d   \K        VVP                  R
4      4      VR	&   \P        P+                  V 4      p/ pV'       d   VP-                  4       ^ ,          pV P/                  VR4      p V^R5 p\2        P5                  V4      pV F7  pVP7                  4       pVR,          ;'       g
    VR,          VVR,          &   K9  	  R*V9   d   R+VR*&   V PS                  R,^4      p\I        V4      pV^8X  d   Vw  ppp M/V^8X  d	   Vw  pp RpM V'       d   V^ ,          p RRppM
\U        4       h\W        V4      w  pp RV9   d2   \W        VPY                  R4      4      w  p!p"V!'       d   T!pV"'       d   T"p RV9   d   VPY                  R4      p \Z        P+                  V 4      pV'       d3   VP-                  4       w  rpVf   \]        VR-V  R24      h\_        Wr4       M\]        VR.4      hT ;'       d    V P	                  4       p V '       d-   RV 9   d   \]        VR/4      h\a        V 4      w  r\K        W4      pMRRr/ p#T;'       g    RV#R&   Ve   VV#R&   V e   V V#R&   Ve    Ve   VV#R	&   V	e   V	V#R
&   RV#9   dG   RV9   d@   R0VR,           R1V#R,           R2V#R,           R32p$\b        Pd                  ! V$\f        4       VR V#Pi                  V4       VV#R4&   V#\         V&   V## )7z
New parser engine only used
r  Nr0   r;   r^  r  r   r   r   r   r   r   r  r<   r   z/Each key can only be specified once: repeated 'z' r   
value_listz;key-value mismatch in brackets; a key or a value is missingz][z)Multiple bracket sections are not allowedr   ]r   z!' value has unbalanced brackets: z[]z' list has an empty item: c              3  D   "   T F  pVe   \        V4      MRx  K  	  R # 5i)Nnull)r1   r   s   & r7   rV   %_parse_spec_str_v3.<locals>.<genexpr>B  s$      5  mCF75s    r   rP   z"Unrecognized content in brackets: z26.9z27.3z0MatchSpec version expression without = separatorzThis MatchSpec syntax `z=` was accidentally allowed in the past. Please use `version='z'`.)topicaddendumzCNo key-value pairs found in square brackets, did you mean `extras=[z]`?rK   Tr  r  r  r  r  r  r  r  rM   r   )r   r   )5r  r   r  r  rm  r   r  r  r   r   r   r   r   r   rr  r  r  r   r   r
   r&   rD   rl  r  listr(   r  r  r   r'   rk  r   r   loads_validate_when_specendr   r  r   r  r)   r   r  rx  rb   r*   r   rG   ro  r  r  r  r]   )%r  r  r2   r  r  rq  r   r0   r   r   r  r  r   r  r  r  rD   rl  r   r   inner	remainderbrackets_str_versionversion_valuer  r  r  r  r  r  r   r  r   r  r  r  rl   s%   &                                    r7   r  r    s    !$$X.M  }C|o
 	
 hnnS!tnhtn! 33H==h{6(+;<=H(#>>>#5g6N6N#O D5711'..7g..xF,  ""9--)(3& h{+x  H			x	(B	ryy{1~##L"5#Ab)%..|<=E__&F-Ch!EcU"M  7O;;vl';EE!Q  u}!"MNN))!HOb	S(899%#.OPUw&WXXD)&--e44%#.H	&RSS !ZZ!E7!5 !ZZ!E7!5  #E*!HSM7 8 $W[[]_5;;DAI!$Fym"TUU &&y11'3C	N4D'E$&;<PRV&W#  L67H6I JAAU@VVY[	 "--9N#?  !Y//}/38<<0

 
		(	#BF	YY[^
##J3"%
 ))*5E__&F$*7O$K$Kvl7KF6%=!  #!%F: 
a	 BWF{+-(Y	1 	8	a5!%tYY!##$[1OGVH,X\\)-DE	8GF8h' 
			)B	<"!%?z#K  	t702IJJ ,,HNN,H
 (?"!#K  38<'7t JJv '
9%
8 '
9#
7 ( 2,Xf-=,> ?6"# $6"#?4 	
 	c;'Vh'8J#$&0L"#r9   c                   V ^8  d   QhRR/# )r/   r3   r4   r5   )r6   s   "r7   r8   r8     s     " " "r9   c                \   V '       d   V P                  4       '       g   \        R4      h. pV P                  R4       F;  pVP                  R4       F#  pVP                  VP                  R4      4       K%  	  K=  	  V F\  p\	        V4      pVP                  R4      '       d   \        RV R24      hVP                  RR	4      pV P                  VRV R24      p K^  	  \        V4      ^8X  d   R
#  \        P                  ! V 4       R
#   \        \        3 d   p\        R4      ThR
p?ii ; i)a  
The value of a `when` expression is a MatchSpec or a boolean
expression of MatchSpecs. Parentheses override precedence.
We can use Python's parser for this but we need to wrap the MatchSpec
as strings first.

>>> _validate_when_spec("python")
>>> _validate_when_spec("(python)")
>>> _validate_when_spec("(python and __unix)")
>>> _validate_when_spec("(python and __unix>=3)")
>>> _validate_when_spec("(python and __unix>=3 or __win)")
z'when' value must not be emptyz and z or z ()r   z1'when' specs cannot include inner 'when' fields: rO   r   z\"Nz"'when' expression cannot be parsed)rm  r   r   r   rZ   r   r  r   astparser   SyntaxError)rj   specsabfoundri   escapedexcs   &       r7   r  r    s    tzz||:;;EZZ ALL( ! ! 5!::fCE7!L  --U+||EQwiq>2  5zQI		$  $ I>?SHIs   1D	 	D+D&&D+c                  h    ] tR tRtR t]R 4       tR t]R 4       t	]]R 4       4       t
R tR tR	tR
# )MatchInterfacei  c                	    Wn         R # ro   
_raw_valuer|   r   s   &&r7   r}   MatchInterface.__init__  s    r9   c                	    \        4       hro   r  r	  s   &&r7   rD   MatchInterface.match  s    !##r9   c                	$    V P                  V4      # ro   r   r  s   &&r7   matchesMatchInterface.matches  s    zz%  r9   c                	    V P                   # ro   r  r   s   &r7   r   MatchInterface.raw_value      r9   c                    \        4       h)zYIf the match value is an exact specification, returns the value.
Otherwise returns None.
r  r   s   &r7   r   MatchInterface.exact_value  s     "##r9   c                	    V P                   VP                   8w  d(   \        R V P                   : RVP                   : 24      hV P                   # )z"Incompatible component merge:
  - rS  )r   r   r	  s   &&r7   rN  MatchInterface.merge	  sE    >>U__,5dnn5GveooM`a  ~~r9   c                	T    V P                   VP                   0pR P                  V4      # )rT  )r   rA   )r|   r
  optionss   && r7   rD  MatchInterface.union  s#    >>5??3xx  r9   r  N)rp   rq   rr   rs   r}   r   rD   r  rg  r   r   rN  rD  rt   r5   r9   r7   r  r    sZ      $ $!   $  $!r9   r  c                  >    ] tR tRtR tR tR tR t]R 4       t	Rt
R# )	_StrMatchMixini  c                	    V P                   # ro   r  r   s   &r7   r   _StrMatchMixin.__str__  s    r9   c                	N    V P                   P                   R V P                   R2# )z('z'))rm   rp   r  r   s   &r7   r   _StrMatchMixin.__repr__  s%    ..))*"T__,=R@@r9   c                	n    \        WP                  4      ;'       d    V P                  VP                  8H  # ro   rY   rm   r  r	  s   &&r7   r  _StrMatchMixin.__eq__  (    %0XXT__HXHX5XXr9   c                	,    \        V P                  4      # ro   r  r  r   s   &r7   r  _StrMatchMixin.__hash__      DOO$$r9   c                	    V P                   # ro   r  r   s   &r7   r   _StrMatchMixin.exact_value"  r  r9   r5   N)rp   rq   rr   rs   r   r   r  r  rg  r   rt   r5   r9   r7   r  r    s,    AY%  r9   r  c                  2   a  ] tR tRtRtV 3R ltR tRtV ;t# )r#  i'  c                	&   < \         SV `  V4       R # ro   )r^   r}   r|   r   rm   s   &&r7   r}   ExactStrMatch.__init__*  s    r9   c                	r     VP                   pV P                   V8H  #   \         d    \        T4      p L'i ; iro   )r  r   r1   r|   r
  
_other_vals   && r7   rD   ExactStrMatch.match-  s=    	$))J *,,  	$UJ	$s    66r5   r  )	rp   rq   rr   rs   	__slots__r}   rD   rt   ru   rv   s   @r7   r#  r#  '  s    I - -r9   r#  c                  .   a  ] tR tRtV 3R ltR tRtV ;t# )ExactLowerStrMatchi5  c                	B   < \         SV `  VP                  4       4       R # ro   r^   r}   r>   r  s   &&r7   r}   ExactLowerStrMatch.__init__6      'r9   c                	     VP                   pV P                   VP                  4       8H  #   \         d    \        T4      p L5i ; iro   )r  r   r1   r>   r  s   && r7   rD   ExactLowerStrMatch.match9  sF    	$))J *"2"2"444  	$UJ	$s   + AAr5   )rp   rq   rr   rs   r}   rD   rt   ru   rv   s   @r7   r  r  5  s    (5 5r9   r  c                  ^   a  ] tR tRtRtV 3R ltR t]R 4       t]R 4       t	V 3R lt
RtV ;t# )	GlobStrMatchiA  c                	  < \         SV `  V4       R V n         VP                  R4      '       d?   VP	                  R4      '       d(   \
        P                  ! V4      P                  V n        R # RV9   dR   \
        P                  ! V4      P                  RR4      p\
        P                  ! RV R24      P                  V n        R # R #   \
        P                   d   p\        TRT R	24      hR p?ii ; i)
N^$r;   \*r   z^(?:)$)Contains an invalid regular expression. 'r   )r^   r}   	_re_matchr   r  r?   compilerD   escaper  errorr   r|   r   rk   rm   s   && r7   r}   GlobStrMatch.__init__D  s    		$$)<)<!#E!2!8!8		%(00>!#tE7",=!>!D!D  xx 	"B1#QG 	s)   C C %C .AC C2C--C2c                	     VP                   pV P                  '       d   V P                  V4      # V P                   V8H  #   \         d    \        T4      p LJi ; iro   )r  r   r1   r  r  s   && r7   rD   GlobStrMatch.matchS  sU    	$))J >>>>>*--??j00  	$UJ	$s   A   AAc                	:    V P                   f   V P                  # R # ro   )r  r  r   s   &r7   r   GlobStrMatch.exact_value^  s    "&.."8tBdBr9   c                	     V P                   R 8H  # )r;   r  r   s   &r7   r   GlobStrMatch.matches_allb  s    #%%r9   c                	  < V P                   VP                   8X  d   V P                   # V P                  '       g+   \        V\        4      '       d   VP                  '       d   Yr\	        V4      pR V9  dE   V P                  '       d$   V P                  V4      '       d   VP                   # \
        SV `  V4      # V P                   P                  R 4      VP                  R 4      u;8X  d   ^8X  d   M MV P                   ^ ,          V^ ,          u;8X  d   R 8X  g-   M V P                   R,          VR,          u;8X  d   R 8X  dc   M M_V P                   P                  R 4      pVP                  R 4      pW49   d   VP                   # WC9   d   V P                   # \
        SV `  V4      # . pV P                   V3 F  pVP                  R4      '       d.   VP                  R4      '       d   VP                  V^R 4       KG  R V9   d:   \        P                  ! V4      P                  RR4      pVP                  V4       K  VP                  V4       K  	  RV^ ,           RV^,           R2# )	r;   r  r  r  r   z^(?=z)(?:r  r   )r   r  rY   r	  r1   r^   rN  countrm  r   r  r   r?   r  r  )r|   r
  other_as_strself_strippedother_strippedpatternsr   rm   s   &&     r7   rN  GlobStrMatch.mergef  s   >>U__,>>!~~~*UL"A"Aeooo4 5zl" ~~~$..">">& w}U++  NN  %););C)@EAE^^A,q/8S8r"l2&6=#= NN005M)//4N.&.~~%7='' nnl3E$$)<)<a,		%(00>&& 4 x{m4}B77r9   r  )r  r  )rp   rq   rr   rs   r  r}   rD   rg  r   r   rN  rt   ru   rv   s   @r7   r	  r	  A  sH    )I	1 C C & &@8 @8r9   r	  c                  (   a  ] tR tRtV 3R ltRtV ;t# )GlobLowerStrMatchi  c                	B   < \         SV `  VP                  4       4       R # ro   r  r  s   &&r7   r}   GlobLowerStrMatch.__init__  r  r9   r5   )rp   rq   rr   rs   r}   rt   ru   rv   s   @r7   r%  r%    s    ( (r9   r%  c                  `   a  ] tR tRtRtV 3R ltR tR tR tR t	R t
R t]R	 4       tR
tV ;t# )SplitStrMatchi  c                	D   < \         SV `  V P                  V4      4       R # ro   r^   r}   _convertr  s   &&r7   r}   SplitStrMatch.__init__      u-.r9   c                	     \        VP                  R R4      P                  R4      4      #   \         d!    \	        T4      '       d   \        T4      u # h i ; i)rO   r   )re  r  r   r   r   r  s   &&r7   r,  SplitStrMatch._convert  sP    	U]]34::3?@@ 	%   ''	s   ), 'AAc                	     T;'       d    V P                   VP                   ,          #   \         d&    T P                   T P                  T4      ,          u # i ; iro   )r  r   r,  r	  s   &&r7   rD   SplitStrMatch.match  sK    	:??T__u/?/??? 	:??T]]5%999	:s   ) ) -AAc                	    V P                   '       d;   R P                  RP                  R \        V P                   4       4       4      4      # R# )z{{{}}}rP   c              3  .   "   T F  pR V R 2x  K  	  R# 5ir   Nr5   )rS   r   s   & r7   rV   )SplitStrMatch.__repr__.<locals>.<genexpr>  s     ,W?V!q1X?V   zset())r  r6   rA   rF  r   s   &r7   r   SplitStrMatch.__repr__  s5    ?????499,Wvdoo?V,W#WXXr9   c                	J    R P                  \        V P                  4      4      # rO   rA   rF  r  r   s   &r7   r   SplitStrMatch.__str__  s    xxt/00r9   c                	n    \        WP                  4      ;'       d    V P                  VP                  8H  # ro   r  r	  s   &&r7   r  SplitStrMatch.__eq__  r  r9   c                	,    \        V P                  4      # ro   r  r   s   &r7   r  SplitStrMatch.__hash__  r  r9   c                	    V P                   # ro   r  r   s   &r7   r   SplitStrMatch.exact_value  r  r9   r5   r  rp   rq   rr   rs   r  r}   r,  rD   r   r   r  r  rg  r   rt   ru   rv   s   @r7   r)  r)    s@    I/:1Y%  r9   r)  c                  `   a  ] tR tRtRtV 3R ltR tR tR tR t	R t
R t]R	 4       tR
tV ;t# )FeatureMatchi  c                	D   < \         SV `  V P                  V4      4       R # ro   r+  r  s   &&r7   r}   FeatureMatch.__init__  r.  r9   c                	    V'       g   \        4       # \        V\        4      '       d9   \        R  R VP                  RR4      P	                  R4       4        4       4      # \        R R V 4        4       4      # )c              3  :   "   T F  pV'       g   K  Vx  K  	  R # 5iro   r5   rS   r,  s   & r7   rV   (FeatureMatch._convert.<locals>.<genexpr>  s      RA R   

c              3  @   "   T F  qP                  4       x  K  	  R # 5iro   rm  rS   ffs   & r7   rV   rK         R/Q((**/Q   rO   r   c              3  8   "   T F  q'       g   K  Vx  K  	  R # 5iro   r5   rJ  s   & r7   rV   rK    s     J(D1QQ(D   	
c              3  @   "   T F  qP                  4       x  K  	  R # 5iro   rN  rO  s   & r7   rV   rK    s     (DeerR  )re  rY   r1   r  r   r  s   &&r7   r,  FeatureMatch._convert  sh    ;s## Ru}}S#/F/L/LS/QR   J(De(DJJJr9   c                	B    V P                  V4      pV P                  V8H  # ro   r,  r  r	  s   &&r7   rD   FeatureMatch.match      e$%''r9   c                	v    R P                  RP                  R \        V P                  4       4       4      4      # )r   rP   c              3  .   "   T F  pR V R 2x  K  	  R# 5ir5  r5   rS   rT   s   & r7   rV   (FeatureMatch.__repr__.<locals>.<genexpr>       &Q9PA1#Qx9Pr7  r6   rA   rF  r  r   s   &r7   r   FeatureMatch.__repr__  )    }}TYY&Q9P&QQRRr9   c                	J    R P                  \        V P                  4      4      # r:  r;  r   s   &r7   r   FeatureMatch.__str__  s    xxt/00r9   c                	n    \        WP                  4      ;'       d    V P                  VP                  8H  # ro   r  r	  s   &&r7   r  FeatureMatch.__eq__  r  r9   c                	,    \        V P                  4      # ro   r  r   s   &r7   r  FeatureMatch.__hash__  r  r9   c                	    V P                   # ro   r  r   s   &r7   r   FeatureMatch.exact_value  r  r9   r5   r  rC  rv   s   @r7   rE  rE    sB    I/
K(S1Y%  r9   rE  c                  ^   a  ] tR tRtR
tV 3R ltR tR tR t]t	R t
R t]R 4       tR	tV ;t# )ListOfStrMatchi  c                	D   < \         SV `  V P                  V4      4       R # ro   r+  r  s   &&r7   r}   ListOfStrMatch.__init__  r.  r9   c                	   V'       g   R# \        V\        4      '       dy   \        ;QJ d:    . R  R VP                  RR4      P	                  R4       4        4       F  NK  	  5# ! R  R VP                  RR4      P	                  R4       4        4       4      # \        ;QJ d    . R R V 4        4       F  NK  	  5# ! R R V 4        4       4      # )c              3  :   "   T F  pV'       g   K  Vx  K  	  R # 5iro   r5   rJ  s   & r7   rV   *ListOfStrMatch._convert.<locals>.<genexpr>
  s      RA RrL  c              3  @   "   T F  qP                  4       x  K  	  R # 5iro   rN  rO  s   & r7   rV   rq    rQ  rR  rO   r   c              3  8   "   T F  q'       g   K  Vx  K  	  R # 5iro   r5   rJ  s   & r7   rV   rq    s     F$@qA$@rT  c              3  @   "   T F  qP                  4       x  K  	  R # 5iro   rN  rO  s   & r7   rV   rq    s     $@%BXXZZ%rR  r5   )rY   r1   r   r  r   r  s   &&r7   r,  ListOfStrMatch._convert  s    Is##5 Ru}}S#/F/L/LS/QR5 5 Ru}}S#/F/L/LS/QR   5F$@%$@F5F5F$@%$@FFFr9   c                	B    V P                  V4      pV P                  V8H  # ro   rX  r	  s   &&r7   rD   ListOfStrMatch.match  rZ  r9   c                	v    R P                  RP                  R \        V P                  4       4       4      4      # )r   rP   c              3  .   "   T F  pR V R 2x  K  	  R# 5ir5  r5   r]  s   & r7   rV   *ListOfStrMatch.__repr__.<locals>.<genexpr>  r_  r7  r`  r   s   &r7   r   ListOfStrMatch.__repr__  rb  r9   c                	n    \        WP                  4      ;'       d    V P                  VP                  8H  # ro   r  r	  s   &&r7   r  ListOfStrMatch.__eq__  r  r9   c                	,    \        V P                  4      # ro   r  r   s   &r7   r  ListOfStrMatch.__hash__  r  r9   c                	    V P                   # ro   r  r   s   &r7   r   ListOfStrMatch.exact_value!  r  r9   r5   r  rC  rv   s   @r7   rl  rl    sF      I/
G(S GY%  r9   rl  c                  :   a  ] tR tRtV 3R ltR tR tR tRtV ;t	# )ChannelMatchi&  c                	  < R V n          \        V\        4      '       d   VP                  R4      '       d>   VP	                  R4      '       d'   \
        P                  ! V4      P                  V n         MWRV9   dF   \
        P                  ! RP                  VP                  RR4      4      4      P                  V n         M\        V4      p\        \        V `?  V4       R #   \
        P                   d   p\        TRT R24      hR p?ii ; i)Nr  r  r;   z^(?:{})$r   r  r   )r  rY   r1   r   r  r?   r  rD   r6   r  r   r  r   r^   r	  r}   r  s   && r7   r}   ChannelMatch.__init__'  s    	%%%##C((U^^C-@-@%'ZZ%6%<%<DNE\%'ZZ#**5==e+DE&e N $ENE 	lD*51 xx 	"B1#QG 	s4   C  C  C  %C  4AC   C   D
5DD
c                	    \        VP                  4      pV P                  '       d   V P                  VP                  4      # V P                  P
                  VP
                  VP                  39   #   \         d    \        T4      p Lti ; iro   )r   r  r   r  r  r0   r  s   && r7   rD   ChannelMatch.match;  sw    	( !1!12J >>>>>*";";<< ??''JOOZ=V=V+WWW  	( J	(s   A3 3BBc                	n     V P                   P                   #   \         d    T P                    u # i ; iro   )r  r0   r   r   s   &r7   r   ChannelMatch.__str__H  s6    	(oo**+, 	(oo&'	(s    44c                	*    R V P                  4        R 2# )r   r   r   s   &r7   r   ChannelMatch.__repr__N  s    4<<>"!$$r9   r#  )
rp   rq   rr   rs   r}   rD   r   r   rt   ru   rv   s   @r7   r  r  &  s    2(X(% %r9   r  c                      ] tR tRtR tRtR# )CaseInsensitiveStrMatchiR  c                	     VP                   pVP                  4       pV P                  '       d   V P	                  V4      # V P                   V8H  #   \         d    \        T4      p LZi ; iro   )r  r   r1   r>   r  r  s   && r7   rD   CaseInsensitiveStrMatch.matchS  sc    	$))J  %%'
>>>>>*--??j00  	$UJ	$s   A A)(A)r5   N)rp   rq   rr   rs   rD   rt   r5   r9   r7   r  r  R  s    
1r9   r  r   r0   r   r   r]  r^  r_  rb  rc  r   r   r   )h__conditional_annotations__rd  
__future__r   r  r?   r  abcr   r   collections.abcr   	functoolsr   	itertoolsr   loggingr   operatorr	   os.pathr
   typingr   auxlib.decoratorsr   base.constantsr   r   base.contextr   common.compatr   	common.ior   common.iteratorsr   r>  common.pathr   r   r   common.serializer   
common.urlr   r   r   deprecationsr   
exceptionsr   r   r   r   r   r   r   r    ImportErrorauxlib.collectionr!   r   r#   rp   r  r  r$   __annotations__VERBOSEr%   r&   r'   r(   r)   r*   r+   r,   r-   rG   typerI   rZ   ro  rr  rx  r  r  r`   r  r  r  r  r  r#  r  r	  r%  r)  rE  rl  r  r  r"  )r  s   @r7   <module>r     s   # 
 	  ' #        0 S " &   9 B B # 5 5 % 6  2/%
 & !#

+< =o =#%:: JJ
$ 
 $&::o#> >')zz('; _ ;&(jj. JJ1' O 6 !jj):;
O ;$&JJ JJ% /  #%**B#  +-**/+   &(ZZ JJ
& ? 

.+:D +:\
- 
D7:
 $ 4n%qh^B"J !w  !F $-NN -	5 	5e8>> e8P( (
&N &R$> $N%^ %P)%< )%X1/ 1 |
{\$l&-
#^ns1  /../s   (J3 3KK