+
    ,j1                        ^ RI Ht ^ RIt^ RIHt ^ RIHtHtHt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Ht ^ RIHt  ! R R]4      t ! R R4      tR# )    )annotationsN)Path)ListOptionalTypeLiteralIterable)TracebackType)	MatchSpec)Channel)PackageName)Enum)PySparseRepoDataPyPackageFormatSelection)RepoDataRecordc                      ] tR t^tRt]P                  t ]P                  t	 ]P                  t ]P                  t ]P                  tRtR# )PackageFormatSelectionzZ
Enum that describes what to do if both a `.tar.bz2` and a `.conda` package is available.
 N)__name__
__module____qualname____firstlineno____doc__r   
OnlyTarBz2ONLY_TAR_BZ2	OnlyConda
ONLY_CONDAPreferCondaPREFER_CONDAPreferCondaWithWhlPREFER_CONDA_WITH_WHLBothBOTH__static_attributes__r       8lib/python3.14/site-packages/rattler/repo_data/sparse.pyr   r      sb     ,66L *33J ,77L 5GG
 $((Dr%   r   c                  p   ] tR t^0tRtR R ltR R lt]P                  3R R llt	]P                  3R R	 llt
]P                  3R
 R llt]P                  3R R llt]P                  3R R llt]R R l4       t]]P                  3R R ll4       t]R R l4       tR R ltR R ltR R ltRtR# )SparseRepoDataz
A class to enable loading records from a `repodata.json` file on demand.
Since most of the time you don't need all the records from the `repodata.json`
this can help provide some significant speedups.
c               (    V ^8  d   QhRRRRRRRR/# )	   channelr   subdirstrpathzos.PathLike[str] | strreturnNoner   )formats   "r&   __annotate__SparseRepoData.__annotate__7   s8     M MM M %	M
 
Mr%   c                	   \        V\        4      '       g$   \        R \        V4      P                  : R24      h\        V\
        4      '       g$   \        R \        V4      P                  : R24      h\        V\
        \        34      '       g$   \        R \        V4      P                  : R24      h\        VP                  V\        V4      4      V n	        R# )z6SparseRepoData constructor received unsupported type  z for the `channel` parameterz for the `subdir` parameterz for the `path` parameterN)

isinstancer   	TypeErrortyper   r-   r   r   _channel_sparse)selfr+   r,   r.   s   &&&&r&   __init__SparseRepoData.__init__7   s     '7++M**--IK  &#&&L)),,GI  $d,,J''**CE  ((8(8&#d)Lr%   c                   V ^8  d   QhRR/# )r*   r/   r0   r   )r1   s   "r&   r2   r3   N   s        t  r%   c                :    V P                   P                  4        R# )an  
Closes any mapped resources associated with this `SparseRepoData`
instance. It is good practice to call this method when you are done
with it. This is especially important if you want to modify or delete
the file from which this instance was created.

This method will release all resources associated with this instance,
including those that are currently being used on another thread. This
method will block until all resources are released.

This method has no effect if the file is already closed. Once the
instance is closed, any operation on the instance will raise a
`ValueError`.

As a convenience, it is allowed to call this method more than once;
only the first call, however, will have an effect.

Examples
--------
```python
>>> from rattler import Channel, ChannelConfig
>>> channel = Channel("dummy", ChannelConfig())
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
>>> sparse_data.close()
>>> sparse_data.package_names() # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
ValueError: I/O operation on closed file.
>>>
```
N)r9   closer:   s   &r&   r?   SparseRepoData.closeN   s    @ 	r%   c                    V ^8  d   QhRRRR/# )r*   package_format_selectionr   r/   z	List[str]r   )r1   s   "r&   r2   r3   p   s      J J(>J	Jr%   c                L    V P                   P                  VP                  4      # )aA  
Returns a list over all package names in this repodata file.
This works by iterating over all elements in the `packages` and
`conda_packages` fields of the repodata and returning the unique
package names.

Examples
--------
```python
>>> from rattler import Channel, ChannelConfig
>>> channel = Channel("dummy", ChannelConfig())
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
>>> package_names = sparse_data.package_names()
>>> package_names
[...]
>>> isinstance(package_names[0], str)
True
>>>
```
)r9   package_namesvaluer:   rC   s   &&r&   rE   SparseRepoData.package_namesp   s     0 ||))*B*H*HIIr%   c                    V ^8  d   QhRRRR/# )r*   rC   r   r/   intr   )r1   s   "r&   r2   r3      s      I I(>I	Ir%   c                L    V P                   P                  VP                  4      # )zF
Returns the total number of packages in this repodata file.
:return:
)r9   record_countrF   rG   s   &&r&   rL   SparseRepoData.record_count   s      ||(()A)G)GHHr%   c               $    V ^8  d   QhRRRRRR/# )r*   package_namezstr | PackageNamerC   r   r/   List[RepoDataRecord]r   )r1   s   "r&   r2   r3      s(     
 
'
 #9
 
	
r%   c                    \        V\        4      '       g   \        V4      pV P                  P                  VP                  VP
                  4       Uu. uF  p\        P                  ! V4      NK  	  up# u upi )a  
Returns all the records for the specified package name.

Examples
--------
```python
>>> from rattler import Channel, ChannelConfig, RepoDataRecord, PackageName
>>> channel = Channel("dummy", ChannelConfig())
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
>>> package_name = PackageName(sparse_data.package_names()[0])
>>> records = sparse_data.load_records(package_name)
>>> records
[...]
>>> isinstance(records[0], RepoDataRecord)
True
>>>
```
)r5   r   r9   load_records_namerF   r   _from_py_record)r:   rO   rC   records   &&& r&   rR   SparseRepoData.load_records   sk    0 ,44&|4L ,,33L4F4FH`HfHfg
g **62g
 	
 
s   A6c                    V ^8  d   QhRRRR/# )r*   rC   r   r/   rP   r   )r1   s   "r&   r2   r3      s     
 
(>
	
r%   c                    V P                   P                  VP                  4       Uu. uF  p\        P                  ! V4      NK  	  up# u upi )a  
Returns all the records for the specified package name.

Examples
--------
```python
>>> from rattler import Channel, ChannelConfig, RepoDataRecord, PackageName
>>> channel = Channel("dummy", ChannelConfig())
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
>>> records = sparse_data.load_all_records()
>>> records
[...]
>>> isinstance(records[0], RepoDataRecord)
True
>>>
```
)r9   load_all_recordsrF   r   rT   )r:   rC   rU   s   && r&   rY   SparseRepoData.load_all_records   sJ    0 ,,778P8V8VW
W **62W
 	
 
s   A
c               $    V ^8  d   QhRRRRRR/# )r*   specszIterable[MatchSpec]rC   r   r/   rP   r   )r1   s   "r&   r2   r3      s(     
 
"
 #9
 
	
r%   c                    V P                   P                  V Uu. uF  q3P                  NK  	  upVP                  4       Uu. uF  p\        P
                  ! V4      NK  	  up# u upi u upi )a  
Returns all the records that match any of the specified MatchSpecs.

Examples
--------
```python
>>> from rattler import Channel, ChannelConfig, RepoDataRecord, PackageName
>>> channel = Channel("dummy", ChannelConfig())
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
>>> [record.file_name for record in sparse_data.load_matching_records([MatchSpec("cuda-version 12.5")])]
['cuda-version-12.5-hd4f0392_3.conda']
>>>
```
)r9   load_matching_records_match_specrF   r   rT   )r:   r\   rC   specrU   s   &&&  r&   r^   $SparseRepoData.load_matching_records   sk    , ,,<<.34ed!!e46N6T6T
 **62
 	
 5
s   A$A)c                   V ^8  d   QhRR/# r*   r/   r-   r   )r1   s   "r&   r2   r3      s     # # #r%   c                .    V P                   P                  # )aa  
Returns the subdirectory from which this repodata was loaded.

Examples
--------
```python
>>> from rattler import Channel, ChannelConfig
>>> channel = Channel("dummy", ChannelConfig())
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
>>> sparse_data.subdir
'linux-64'
>>>
```
)r9   r,   r@   s   &r&   r,   SparseRepoData.subdir   s    " ||"""r%   c               (    V ^8  d   QhRRRRRRRR/# )	r*   	repo_datazList[SparseRepoData]rE   zList[PackageName]rC   r   r/   zList[List[RepoDataRecord]]r   )r1   s   "r&   r2   r3      s0     
 
'
(
 #9
 
$	
r%   c           
     @   \         P                  ! V  Uu. uF  q3P                  NK  	  upV Uu. uF  qDP                  NK  	  upVP                  4       UUu. uF)  pV Uu. uF  p\
        P                  ! V4      NK  	  upNK+  	  upp# u upi u upi u upi u uppi )a  
Given a set of [`SparseRepoData`]s load all the records
for the packages with the specified names and all the packages
these records depend on. This will parse the records for the
specified packages as well as all the packages these records
depend on.

Examples
--------
```python
>>> from rattler import Channel, ChannelConfig, PackageName
>>> channel = Channel("dummy")
>>> subdir = "test-data/dummy/linux-64"
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
>>> package_name = PackageName("python")
>>> SparseRepoData.load_records_recursive([sparse_data], [package_name])
[...]
>>>
```
)r   load_records_recursiver9   rS   rF   r   rT   )rg   rE   rC   rplist_of_recordsrU   s   &&&    r&   ri   %SparseRepoData.load_records_recursive   s    : $4#J#J$-.IqI.-0P-Q-0PRjRpRp$
$ CRR/^++F3/R$
 	
 /0P S
s"   BB
	B!B BBc                    V ^8  d   QhRRRR/# )r*   py_sparse_repo_datar   r/   r(   r   )r1   s   "r&   r2   r3     s        <L  Q_  r%   c                4    V P                  V 4      pWn        V# )zD
Construct Rattler SparseRepoData from FFI PySparseRepoData object.
)__new__r9   )clsro   sparse_repo_datas   && r&   _from_py_sparse_repo_data(SparseRepoData._from_py_sparse_repo_data  s    
 ;;s+#6 r%   c                   V ^8  d   QhRR/# rc   r   )r1   s   "r&   r2   r3   &  s     9 9# 9r%   c                "    RV P                    R2# )ac  
Returns a representation of the SparseRepoData.

Examples
--------
```python
>>> from rattler import Channel, ChannelConfig
>>> channel = Channel("dummy", ChannelConfig())
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
>>> sparse_data = SparseRepoData(channel, "linux-64", path)
>>> sparse_data
SparseRepoData(subdir="linux-64")
>>>
```
zSparseRepoData(subdir="z"))r,   r@   s   &r&   __repr__SparseRepoData.__repr__&  s      )R88r%   c                   V ^8  d   QhRR/# )r*   r/   r(   r   )r1   s   "r&   r2   r3   8  s      > r%   c                    V # )a  
Returns the `SparseRepoData` instance itself. This is used to
enable the use of the `with` statement to automatically close
the instance when done.

Examples
--------
```python
>>> from rattler import Channel, ChannelConfig
>>> channel = Channel("dummy", ChannelConfig())
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
>>> with SparseRepoData(channel, "linux-64", path) as sparse_data:
...     print(sparse_data)
...
SparseRepoData(subdir="linux-64")
>>>
```
r   r@   s   &r&   	__enter__SparseRepoData.__enter__8  s	    & r%   c               (    V ^8  d   QhRRRRRRRR/# )	r*   exctypezOptional[Type[BaseException]]excinstzOptional[BaseException]exctbzOptional[TracebackType]r/   zLiteral[False]r   )r1   s   "r&   r2   r3   M  s2      . ) '	
 
r%   c                &    V P                  4        R# )a  
Closes the `SparseRepoData` instance when exiting the `with` statement.

Examples
--------
```python
>>> from rattler import Channel, ChannelConfig
>>> channel = Channel("dummy", ChannelConfig())
>>> path = "../test-data/channels/dummy/linux-64/repodata.json"
>>> with SparseRepoData(channel, "linux-64", path) as sparse_data:
...     print(sparse_data)
...
SparseRepoData(subdir="linux-64")
>>>
```
F)r?   )r:   r   r   r   s   &&&&r&   __exit__SparseRepoData.__exit__M  s    , 	

r%   )r9   N)r   r   r   r   r   r;   r?   r   r   rE   rL   rR   rY   r^   propertyr,   staticmethodri   classmethodrt   rx   r|   r   r$   r   r%   r&   r(   r(   0   s    M. F BXAdAdJ6 BXAdAdI <R;^;^
@ BXAdAd
< <R;^;^
6 # #$  <R;^;^
 
B    9$* r%   r(   )
__future__r   ospathlibr   typingr   r   r   r   r	   typesr
   rattler.match_spec.match_specr   rattler.channel.channelr   rattler.package.package_namer   enumr   rattler.rattlerr   r   rattler.repo_data.recordr   r   r(   r   r%   r&   <module>r      sB    " 	  : :  3 + 4  F 3T @t tr%   