minor changes
This commit is contained in:
@@ -7,28 +7,29 @@ load_dotenv()
|
||||
|
||||
file_path = os.getenv("file_path") if os.getenv("file_path") else "./checklist.md"
|
||||
|
||||
def read_json() -> dict | None:
|
||||
def read_json() -> dict:
|
||||
try:
|
||||
with open("./src/json/ingredients.json", "rt") as file:
|
||||
return json.load(file)
|
||||
except:
|
||||
print("Could not find or read file.")
|
||||
return {}
|
||||
|
||||
def update_json(meals: dict):
|
||||
def update_json(meals: dict) -> None:
|
||||
try:
|
||||
with open("./src/json/ingredients.json", "w") as file:
|
||||
json.dump(meals, file, indent=4)
|
||||
except Exception as e:
|
||||
print(f"Unable to write data to file. {e}")
|
||||
|
||||
def get_selected_meals(meals: dict) -> dict | None:
|
||||
def get_selected_meals(meals: dict) -> dict:
|
||||
meal_json = read_json()
|
||||
selected_meals = {}
|
||||
if meal_json:
|
||||
for meal in meals:
|
||||
if meal in meal_json:
|
||||
selected_meals[meal] = meal_json[meal]
|
||||
return selected_meals
|
||||
return selected_meals
|
||||
|
||||
def combine_ingredients(meals: dict) -> dict:
|
||||
combined_ingredients = {}
|
||||
|
||||
Reference in New Issue
Block a user