+
    ,j*                        ^ RI Ht ^ RIHtHt ^ RIHt ^ RIHt ^ RI	H
t
 ]'       d   ^ RIHt ^ RIHt  ! R R	4      tR
# )    )annotations)TYPE_CHECKINGOptional)Channel)PackageNameMatcher)PyMatchSpec)NamelessMatchSpec)PackageRecordc                     ] tR t^tRtR*R R llt]R R l4       t]R R l4       t]R R	 l4       t	]R
 R l4       t
]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       tR R lt]R  R! l4       t]R" R# l4       tR$ R% ltR& R' ltR(tR)# )+	MatchSpeca  
A `MatchSpec` is a query language for conda packages.
It can be composed of any of the attributes of `PackageRecord`.

`MatchSpec` can be composed of keyword arguments, where keys are
any of the attributes of `PackageRecord`. Values for keyword arguments
are exact values the attributes should match against. Many fields can
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.

MatchSpecs 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. Conda has historically had several string
representations for equivalent MatchSpecs.

A series of rules are now followed for creating the canonical string
representation of a 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. Its position is always outside the
key-value brackets. It can also be a glob pattern or a regex if `exact_names_only`
is `False`.
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 feature. It is currently
ignored.
5. If `channel` is included and is an exact value, a `::` separator is used 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 `MatchSpec` instance from a string, any key-value pair given
inside the key-value brackets overrides any matching parameter given outside the
brackets.

When `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.

To fully-specify a package with a full, exact spec, the following fields must be
given as exact values:
- channel
- subdir
- name
- version
- build
c               4    V ^8  d   QhRRRRRRRRRRRRR	R
/# )   specstrstrictboolexact_names_onlyextrasconditionalsflagsreturnNone )formats   "=lib/python3.14/site-packages/rattler/match_spec/match_spec.py__annotate__MatchSpec.__annotate__T   sP     . .. . 	.
 . . . 
.    c                    \        V\        4      '       d   \        VVVVVV4      V n        R# \	        R\        V4      P                  : R24      h)aw  
Create a new version spec.

When `strict` is `True`, some ambiguous version specs are rejected.

When `extras` is `True`, extras syntax (`pkg[extras=[foo,bar]]`) is
allowed. When `conditionals` is `True`, conditionals syntax
(`pkg[when="python >=3.6"]`) is allowed. When `flags` is `True`, flags
syntax (`pkg[flags=[cuda]]`) is allowed.

```python
>>> MatchSpec("pip >=24.0")
MatchSpec("pip >=24.0")
>>> MatchSpec("pip 24")
MatchSpec("pip ==24")
>>> MatchSpec("python[license=MIT]")
MatchSpec("python[license="MIT"]")
>>> MatchSpec("foo*", strict=True, exact_names_only=False)
MatchSpec("foo*")
>>> MatchSpec("^foo.*$", strict=True, exact_names_only=True) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
InvalidMatchSpecError: "^foo.*$" looks like a regex but only exact package names are allowed, package names can only contain 0-9, a-z, A-Z, -, _, or .
>>>
```
z0MatchSpec constructor received unsupported type z for the 'spec' parameterN)
isinstancer   r   _match_spec	TypeErrortype__name__)selfr   r   r   r   r   r   s   &&&&&&&r   __init__MatchSpec.__init__T   sX    D dC  *  D B4:CVCVBYYrs r   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   r      s     W W( Wr   c                V    \         P                  ! V P                  P                  4      # )z
The name of the package.
)r   _from_py_package_name_matcherr!   namer%   s   &r   r+   MatchSpec.name   s!    
 "??@P@P@U@UVVr   c                   V ^8  d   QhRR/# r   r   zOptional[str]r   )r   s   "r   r   r      s     ( ( (r   c                .    V P                   P                  # )zD
The version spec of the package (e.g. `1.2.3`, `>=1.2.3`, `1.2.*`)
)r!   versionr,   s   &r   r1   MatchSpec.version   s    
 '''r   c                   V ^8  d   QhRR/# r/   r   )r   s   "r   r   r      s     & &} &r   c                .    V P                   P                  # )zJ
The build string of the package (e.g. `py37_0`, `py37h6de7cb9_0`, `py*`)
)r!   buildr,   s   &r   r5   MatchSpec.build   s    
 %%%r   c                   V ^8  d   QhRR/# r/   r   )r   s   "r   r   r      s     - -m -r   c                .    V P                   P                  # )z"
The build number of the package.
)r!   build_numberr,   s   &r   r9   MatchSpec.build_number   s    
 ,,,r   c                   V ^8  d   QhRR/# r/   r   )r   s   "r   r   r           * *= *r   c                .    V P                   P                  # )z-
Match the specific filename of the package.
)r!   	file_namer,   s   &r   r>   MatchSpec.file_name       
 )))r   c                   V ^8  d   QhRR/# )r   r   zOptional[Channel]r   )r   s   "r   r   r      s     = =* =r   c                n    V P                   P                  pT;'       d    \        P                  ! V4      # )z
The channel of the package.
)r!   channelr   _from_py_channel)r%   rC   s   & r   rC   MatchSpec.channel   s.    
 ""**<<733G<<r   c                   V ^8  d   QhRR/# r/   r   )r   s   "r   r   r      s     ' ' 'r   c                .    V P                   P                  # )z
The subdir of the channel.
)r!   subdirr,   s   &r   rH   MatchSpec.subdir       
 &&&r   c                   V ^8  d   QhRR/# r/   r   )r   s   "r   r   r      r<   r   c                .    V P                   P                  # )z
The namespace of the package.
)r!   	namespacer,   s   &r   rM   MatchSpec.namespace   r@   r   c                   V ^8  d   QhRR/# )r   r   zOptional[list[str]]r   )r   s   "r   r   r      s     ' '+ 'r   c                .    V P                   P                  # )z4
The extras (optional dependencies) of the package.
)r!   r   r,   s   &r   r   MatchSpec.extras   rJ   r   c                   V ^8  d   QhRR/# r/   r   )r   s   "r   r   r      r<   r   c                .    V P                   P                  # )z4
The condition under which this match spec applies.
)r!   	conditionr,   s   &r   rT   MatchSpec.condition   r@   r   c                   V ^8  d   QhRR/# r   r   zOptional[bytes]r   )r   s   "r   r   r      s     $ $_ $r   c                .    V P                   P                  # )z
The md5 hash of the package.
)r!   md5r,   s   &r   rY   MatchSpec.md5   s    
 ###r   c                   V ^8  d   QhRR/# rW   r   )r   s   "r   r   r      s     ' ' 'r   c                .    V P                   P                  # )z!
The sha256 hash of the package.
)r!   sha256r,   s   &r   r]   MatchSpec.sha256   rJ   r   c                    V ^8  d   QhRRRR/# )r   py_match_specr   r   r   r   )r   s   "r   r   r      s       	 r   c                4    V P                  V 4      pWn        V# )z=
Construct py-rattler MatchSpec from PyMatchSpec FFI object.
)__new__r!   )clsr`   
match_specs   && r   _from_py_match_specMatchSpec._from_py_match_spec   s    
 [[%
!.r   c                    V ^8  d   QhRRRR/# )r   recordr
   r   r   r   )r   s   "r   r   r      s     8 8m 8 8r   c                L    V P                   P                  VP                  4      # )z*Match a MatchSpec against a PackageRecord.)r!   matches_record)r%   rh   s   &&r   rj   MatchSpec.matches   s    ''77r   c               $    V ^8  d   QhRRRRRR/# )r   r   r	   r+   r   r   r   r   )r   s   "r   r   r      s'     c c!2 c# c) cr   c                b    V P                  \        P                  ! VP                  V4      4      # )a  
Constructs a MatchSpec from a NamelessMatchSpec
and a name.

Examples
--------
```python
>>> from rattler import NamelessMatchSpec
>>> spec = NamelessMatchSpec('3.4')
>>> MatchSpec.from_nameless(spec, "foo")
MatchSpec("foo ==3.4")
>>> MatchSpec.from_nameless(spec, "$foo") # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
exceptions.PackageNameMatcherParseError
>>>
```
)re   r   from_nameless_nameless_match_spec)rc   r   r+   s   &&&r   ro   MatchSpec.from_nameless   s)    & &&{'@'@AZAZ\`'abbr   c                    V ^8  d   QhRRRR/# )r   urlr   r   r   r   )r   s   "r   r   r      s     B B3 B9 Br   c                L    V P                  \        P                  ! V4      4      # )a  
Constructs a MatchSpec from a URL.

Examples
--------
```python
>>> MatchSpec.from_url('https://repo.anaconda.com/pkgs/main/linux-64/python-3.9.0-h3.tar.bz2')
MatchSpec("python[url="https://repo.anaconda.com/pkgs/main/linux-64/python-3.9.0-h3.tar.bz2"]")
>>> MatchSpec.from_url('https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#d7c89558ba9fa0495403155b64376d81')
MatchSpec("_libgcc_mutex[md5="d7c89558ba9fa0495403155b64376d81", url="https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2"]")
>>> MatchSpec.from_url('https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#sha256:adfa71f158cbd872a36394c56c3568e6034aa55c623634b37a4836bd036e6b91')
MatchSpec("_libgcc_mutex[sha256="adfa71f158cbd872a36394c56c3568e6034aa55c623634b37a4836bd036e6b91", url="https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2"]")
>>>
```
)re   r   from_url)rc   rs   s   &&r   ru   MatchSpec.from_url   s     " &&{';';C'@AAr   c                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   r     s     ) ) )r   c                6    V P                   P                  4       # )z
Returns a string representation of the MatchSpec.

Examples
--------
```python
>>> from rattler import NamelessMatchSpec
>>> spec = NamelessMatchSpec('3.4')
>>> str(MatchSpec.from_nameless(spec, "foo"))
'foo ==3.4'
>>>
```
r!   as_strr,   s   &r   __str__MatchSpec.__str__  s     &&((r   c                   V ^8  d   QhRR/# rx   r   )r   s   "r   r   r     s     ; ;# ;r   c                >    RV P                   P                  4        R2# )z
Returns a representation of the MatchSpec.

Examples
--------
```python
>>> from rattler import NamelessMatchSpec
>>> spec = NamelessMatchSpec('3.4')
>>> MatchSpec.from_nameless(spec, "foo")
MatchSpec("foo ==3.4")
>>>
```
zMatchSpec("z")rz   r,   s   &r   __repr__MatchSpec.__repr__  s#     T--4467r::r   )r!   N)FTTTT)r$   
__module____qualname____firstlineno____doc__r&   propertyr+   r1   r5   r9   r>   rC   rH   rM   r   rT   rY   r]   classmethodre   rj   ro   ru   r|   r   __static_attributes__r   r   r   r   r      sU   CJ.` W W ( ( & & - - * * = = ' ' * * ' ' * * $ $ ' '  8 c c( B B$) ; ;r   r   N)
__future__r   typingr   r   rattler.channel.channelr   $rattler.package.package_name_matcherr   rattler.rattlerr   rattler.match_specr	   rattler.repo_datar
   r   r   r   r   <module>r      s)    " * + C '4/_; _;r   