Skip to content

Commit

Permalink
Re Ran Test Representation
Browse files Browse the repository at this point in the history
Due to some small code review changes, had to re-record the representation.
  • Loading branch information
BethanyG committed Mar 15, 2024
1 parent 330a262 commit 0e67a90
Show file tree
Hide file tree
Showing 3 changed files with 901 additions and 962 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
""" Examples adapted from Mecha Munch Management"""
""" Examples adapted from Mecha Munch Management, Alphametrics, and ChatGPT
ChatGPT Prompt: Write a python function that
reads user settings from a toml file and
merges them with a dictionary of default
settings to create a single dictionary.
If there are any conflicts between the
two sources of settings, the data from
the toml file should be used.
"""


def update_recipes_tuple(ideas, recipe_updates):
"""Update the recipe ideas dictionary.
"""Mecha Munch Management Example.
Update the recipe ideas dictionary.
:param ideas: dict - The "recipe ideas" dict.
:param recipe_updates: tuple - tuple with updates for the ideas section.
:return: dict - updated "recipe ideas" dict.
Expand All @@ -14,7 +27,9 @@ def update_recipes_tuple(ideas, recipe_updates):


def update_recipes_dict(ideas, recipe_updates):
"""Update the recipe ideas dictionary.
"""Second Mecha Munch Management Example.
Update the recipe ideas dictionary.
:param ideas: dict - The "recipe ideas" dict.
:param recipe_updates: dict - dictionary with updates for the ideas section.
:return: dict - updated "recipe ideas" dict.
Expand All @@ -37,9 +52,9 @@ def update_recipes_dict(ideas, recipe_updates):
# {'Banana Bread': {'Banana': 4, 'Walnuts': 2, 'Flour': 1, 'Eggs': 3, 'Butter': 1, 'Milk': 2}}



""" Example from `alphametrics` exercise """
def assign(letters, selections, lefty, righty):
""" Example from `alphametrics` exercise """

while letters:
new_selections = []

Expand All @@ -61,19 +76,6 @@ def assign(letters, selections, lefty, righty):
return [slc for slc, _ in selections]





"""
This exmple comes from ChatGPT
Prompt: Write a python function that
reads user settings from a toml file and
merges them with a dictionary of default
settings to create a single dictionary.
If there are any conflicts between the
two sources of settings, the data from
the toml file should be used.
"""
import tomlib

def merge_settings(default_settings, toml_file_path):
Expand All @@ -95,4 +97,4 @@ def merge_settings(default_settings, toml_file_path):
toml_file_path = 'settings.toml' # Path to the TOML file

final_settings = merge_settings(default_settings, toml_file_path)
print("Final Settings:", final_settings)
print("Final Settings:", final_settings)
Loading

0 comments on commit 0e67a90

Please sign in to comment.