Skip to content

Commit ad10f3b

Browse files
authored
docs: improved documentation on model_options (#134)
Signed-off-by: Masataro Asai <[email protected]>
1 parent a24a8fb commit ad10f3b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mellea/backends/types.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ class ModelOption:
3030
def replace_keys(options: dict, from_to: dict[str, str]) -> dict[str, Any]:
3131
"""Returns a new dict with the keys in `options` replaced with the corresponding value for that key in `from_to`.
3232
33-
If any keys already exist in `options`, don't edit the associated value.
33+
* Any key with value == None is treated the same as the key missing.
34+
35+
* If the destination key already exists in `options`, the original value is kept in the output.
36+
37+
* Regardless of the presense of the destination key in `options`,
38+
the source key is always absent in the output.
3439
3540
Example:
3641
```python
@@ -41,6 +46,9 @@ def replace_keys(options: dict, from_to: dict[str, str]) -> dict[str, Any]:
4146
>>> print(new_options)
4247
... {"M1": "m1", "M2": "v2"}
4348
```
49+
50+
* Notice that "M1" keeps the original value "m1", rather than "v1".
51+
* Notice that both "k1" and "k2" are absent in the output.
4452
"""
4553
new_options = {}
4654

0 commit comments

Comments
 (0)