Skip to content

Commit

Permalink
fix: add missing __init__ docstrings (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
calebzulawski committed Sep 5, 2024
1 parent bc3bdf1 commit b23af5c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions py-rattler/rattler/lock/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class LockChannel:
_channel: PyLockChannel

def __init__(self, url: str) -> None:
"""
Create a new channel.
"""
self._channel = PyLockChannel(url)

@classmethod
Expand Down
3 changes: 3 additions & 0 deletions py-rattler/rattler/lock/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class Environment:
_env: PyEnvironment

def __init__(self, name: str, requirements: Dict[Platform, List[RepoDataRecord]]) -> None:
"""
Create a new environment.
"""
self._env = PyEnvironment(
name,
# TODO: move this logic to rust
Expand Down
5 changes: 5 additions & 0 deletions py-rattler/rattler/lock/lock_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class LockFile:
_lock_file: PyLockFile

def __init__(self, envs: Dict[str, Environment]) -> None:
"""
Create a new rattler-lock file.
`envs` maps each environment to its name.
"""
self._lock_file = PyLockFile({name: env._env for (name, env) in envs.items()})

@staticmethod
Expand Down
13 changes: 13 additions & 0 deletions py-rattler/rattler/match_spec/match_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ class MatchSpec:
"""

def __init__(self, spec: str, strict: bool = False) -> None:
"""
Create a new version spec.
When `strict` is `True`, some ambiguous version specs are rejected.
```python
>>> MatchSpec("pip >=24.0")
MatchSpec("pip >=24.0")
>>> MatchSpec("pip 24")
MatchSpec("pip ==24")
>>>
```
"""
if isinstance(spec, str):
self._match_spec = PyMatchSpec(spec, strict)
else:
Expand Down
13 changes: 13 additions & 0 deletions py-rattler/rattler/match_spec/nameless_match_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ class NamelessMatchSpec:
"""

def __init__(self, spec: str, strict: bool = False) -> None:
"""
Create a new version spec.
When `strict` is `True`, some ambiguous version specs are rejected.
```python
>>> NamelessMatchSpec(">=24.0")
NamelessMatchSpec(">=24.0")
>>> NamelessMatchSpec("24")
NamelessMatchSpec("==24")
>>>
```
"""
if isinstance(spec, str):
self._nameless_match_spec = PyNamelessMatchSpec(spec, strict)
else:
Expand Down

0 comments on commit b23af5c

Please sign in to comment.