+
    ,j3                        ^ RI Ht ^ RIt^ RIHtHtHtHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHt ]'       d   ^ RIHt  ! R	 R
4      tR# )    )annotationsN)ListOptionalTupleTYPE_CHECKING)LockChannel)Environment)RepoDataRecord)
PyLockFileLockPlatformc                      ] tR t^t$ RtR]R&   R R lt]R R l4       tR R	 lt	R
 R lt
R R ltR R ltR R ltR R ltR R ltR R lt]R R l4       tR R ltRtR# )LockFilez
Represents a lock-file for both Conda packages and Pypi packages.
Lock-files can store information for multiple platforms and for multiple environments.
r   
_lock_filec                    V ^8  d   QhRRRR/# )   	platformsList[LockPlatform]returnNone )formats   "6lib/python3.14/site-packages/rattler/lock/lock_file.py__annotate__LockFile.__annotate__   s     
D 
D"4 
D 
D    c                b    \        V Uu. uF  q"P                  NK  	  up4      V n        R# u upi )a	  
Create a new rattler-lock file with the given platforms.

Packages can be added using the `add_conda_package` and `add_pypi_package` methods.
Channels can be set using the `set_channels` method.

Args:
    platforms: The list of platforms this lock file supports.
N)r   _innerr   )selfr   ps   && r   __init__LockFile.__init__   s$     %	%B	1hh	%BC%Bs   ,c                    V ^8  d   QhRRRR/# )r   pathos.PathLike[str]r   r   r   )r   s   "r   r   r   #   s     G G( GX Gr   c                T    \         P                  \        P                  ! V 4      4      # )z
Parses a rattler-lock file from a file.

Examples
--------
```python
>>> lock_file = LockFile.from_path("./pixi.lock")
>>> lock_file
LockFile()
>>>
```
)r   _from_py_lock_filer   	from_path)r$   s   &r   r(   LockFile.from_path"   s      **:+?+?+EFFr   c                    V ^8  d   QhRRRR/# )r   r$   r%   r   r   r   )r   s   "r   r   r   2   s     - -, - -r   c                8    V P                   P                  V4      # )z
Writes the rattler-lock to a file.

Examples
--------
```python
>>> import tempfile
>>> lock_file = LockFile.from_path("./pixi.lock")
>>> with tempfile.NamedTemporaryFile() as fp:
...     lock_file.to_path(fp.name)
>>>
```
)r   to_path)r   r$   s   &&r   r,   LockFile.to_path2   s     &&t,,r   c                   V ^8  d   QhRR/# )r   r   zList[Tuple[str, Environment]]r   )r   s   "r   r   r   B   s     m m; mr   c                    V P                   P                  4        UUu. uF  w  rV\        P                  ! V4      3NK  	  upp# u uppi )a)  
Returns an iterator over all environments defined in the lock-file.

Examples
--------
```python
>>> lock_file = LockFile.from_path("./pixi.lock")
>>> sorted(lock_file.environments())
[('default', Environment()), ('docs', Environment()), ('repl', Environment()), ('test', Environment())]
>>>
```
)r   environmentsr	   _from_py_environment)r   namees   &  r   r0   LockFile.environmentsB   s?     NR__MiMiMklMk	{77:;Mkllls   #Ac                    V ^8  d   QhRRRR/# )r   r2   strr   Optional[Environment]r   )r   s   "r   r   r   Q   s       (= r   c                x    V P                   P                  V4      ;p'       d   \        P                  ! V4      # R# )z
Returns the environment with the given name.

Examples
--------
```python
>>> lock_file = LockFile.from_path("./pixi.lock")
>>> lock_file.environment("default")
Environment()
>>> lock_file.environment("doesnt-exist")
>>>
```
N)r   environmentr	   r1   )r   r2   envs   && r   r9   LockFile.environmentQ   s2     //--d333333C88r   c                   V ^8  d   QhRR/# )r   r   r7   r   )r   s   "r   r   r   c   s     W W%: Wr   c                ^    \         P                  ! V P                  P                  4       4      # )z
Returns the environment with the default name as defined by [`DEFAULT_ENVIRONMENT_NAME`].

Examples
--------
```python
>>> lock_file = LockFile.from_path("./pixi.lock")
>>> lock_file.default_environment()
Environment()
>>>
```
)r	   r1   r   default_environmentr   s   &r   r>   LockFile.default_environmentc   s"     //0S0S0UVVr   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   r   r   s     ] ]- ]r   c                    ^ RI Hp V P                  P                  4        Uu. uF  q!P                  ! V4      NK  	  up# u upi )a/  
Returns all platforms defined in the lock-file.

Examples
--------
```python
>>> from rattler import LockFile, LockPlatform
>>> lock_file = LockFile([LockPlatform("linux-64"), LockPlatform("osx-arm64")])
>>> lock_file.platforms()
[LockPlatform(name='linux-64'), LockPlatform(name='osx-arm64')]
>>>
```
r   )rattler.lock.platformr   r   r   _from_py_lock_platform)r   r   r    s   &  r   r   LockFile.platformsr   s7     	7@D@Y@Y@[\@[133A6@[\\\s   A c               $    V ^8  d   QhRRRRRR/# )r   r9   r6   channelszList[LockChannel]r   r   r   )r   s   "r   r   r      s'     R R R7H RT Rr   c                x    V P                   P                  Y Uu. uF  q3P                  NK  	  up4       R# u upi )a  
Sets the channels for the given environment.

Args:
    environment: The name of the environment.
    channels: The list of channels to set.

Examples
--------
```python
>>> from rattler import LockFile, LockPlatform, LockChannel
>>> lock_file = LockFile([LockPlatform("linux-64")])
>>> lock_file.set_channels("default", [LockChannel("https://conda.anaconda.org/conda-forge/")])
>>>
```
N)r   set_channels_channel)r   r9   rG   cs   &&& r   rI   LockFile.set_channels   s,    " 	$$[x2Px!::x2PQ2Ps   7
c               (    V ^8  d   QhRRRRRRRR/# )	r   r9   r6   platformr   recordr
   r   r   r   )r   s   "r   r   r      s0     X XS XL XR` Xei Xr   c                f    V P                   P                  WP                  VP                  4       R# )au  
Adds a conda package to the lock file for the given environment and platform.

The platform must be one of the platforms specified when creating the lock file.

Args:
    environment: The name of the environment.
    platform: The platform to add the package for.
    record: The repo data record of the package to add.

Raises:
    Exception: If the platform is not one of the platforms in this lock file.

Examples
--------
```python
>>> from rattler import LockFile, LockPlatform
>>> lock_file = LockFile([LockPlatform("linux-64")])
>>> # lock_file.add_conda_package("default", LockPlatform("linux-64"), some_record)
>>>
```
N)r   add_conda_packager   _record)r   r9   rN   rO   s   &&&&r   rQ   LockFile.add_conda_package   s     . 	))+Wr   c               0    V ^8  d   QhRRRRRRRRRRRR	/# )
r   r9   r6   rN   r   r2   versionlocationr   r   r   )r   s   "r   r   r      sD     ` ``*6`>A`LO`[^`	`r   c                T    V P                   P                  WP                  W4V4       R# )a  
Adds a pypi package to the lock file for the given environment and platform.

The platform must be one of the platforms specified when creating the lock file.

Args:
    environment: The name of the environment.
    platform: The platform to add the package for.
    name: The name of the package.
    version: The version of the package.
    location: The URL or path where the package can be found.

Raises:
    Exception: If the platform is not one of the platforms in this lock file.

Examples
--------
```python
>>> from rattler import LockFile, LockPlatform
>>> lock_file = LockFile([LockPlatform("linux-64")])
>>> # lock_file.add_pypi_package("default", LockPlatform("linux-64"), "requests", "2.28.0", "https://...")
>>>
```
N)r   add_pypi_packager   )r   r9   rN   r2   rU   rV   s   &&&&&&r   rX   LockFile.add_pypi_package   s    6 	((ootV^_r   c                    V ^8  d   QhRRRR/# )r   py_lock_filer   r   r   r   )r   s   "r   r   r      s      j X r   c                4    V P                  V 4      pWn        V# )z8
Construct Rattler LockFile from FFI PyLockFile object.
)__new__r   )clsr[   	lock_files   && r   r'   LockFile._from_py_lock_file   s    
 KK$	+r   c                   V ^8  d   QhRR/# )r   r   r6   r   )r   s   "r   r   r      s      # r   c                    R# )z+
Returns a representation of the LockFile.
z
LockFile()r   r?   s   &r   __repr__LockFile.__repr__   s     r   )r   N)__name__
__module____qualname____firstlineno____doc____annotations__r!   staticmethodr(   r,   r0   r9   r>   r   rI   rQ   rX   classmethodr'   rc   __static_attributes__r   r   r   r   r      sw    
 
D G G- m$W]$R&X2`:   r   r   )
__future__r   ostypingr   r   r   r   rattler.lock.channelr   rattler.lock.environmentr	   rattler.repo_data.recordr
   rattler.rattlerr   rC   r   r   r   r   r   <module>ru      s/    " 	 7 7 , 0 3 &2L Lr   