Usage
Installation
To use Lumache, first install it using pip:
(.venv) $ pip install lumache
Creating recipes
To retrieve a list of random ingredients, you can use the
lumache.get_random_ingredients() function:
lumache.get_random_ingredients(kind=None)
Return a list of random ingredients as strings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind |
list[str] | None
|
Optional "kind" of ingredients. |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
The ingredients list. |
Raises:
| Type | Description |
|---|---|
lumache.InvalidKindError
|
If the kind is invalid. |
Source code in repo/lumache.py
def get_random_ingredients(kind=None):
"""
Return a list of random ingredients as strings.
:param kind: Optional "kind" of ingredients.
:type kind: list[str] or None
:raise lumache.InvalidKindError: If the kind is invalid.
:return: The ingredients list.
:rtype: list[str]
"""
return ["shells", "gorgonzola", "parsley"]
The kind parameter should be either "meat", "fish", or "veggies".
Otherwise, get_random_ingredients will raise an exception lumache.InvalidKindError.
For example:
>>> import lumache
>>> lumache.get_random_ingredients()
['shells', 'gorgonzola', 'parsley']