Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brew expert potion #3

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions brewing/brew_potions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import potion_class
import containers
import cooking
import inspection

from brewing import potion_class
from brewing import containers
from brewing import cooking
from brewing import inspection
from brewing import ingredients

def make_example_potion(student_name="ASPP student"):
my_potion = potion_class.Potion(student_name=student_name)
Expand All @@ -14,14 +14,25 @@ def make_example_potion(student_name="ASPP student"):
return my_potion


def make_python_expert_potion(student_name):
def make_python_expert_potion(student_name="Python expert"):
print("I am a Python Expert")
# todo: write this function!
return
my_potion = potion_class.Potion(student_name=student_name)
my_potion.setup(
container=containers.pewter_cauldron,
heat_source=cooking.fire,
)
my_potion.add_ingredients([
ingredients.fish_eyes,
ingredients.unicorn_hair,
ingredients.tea_leaves
])
cooking.simmer(my_potion, duration=2)
return my_potion


if __name__ == "__main__":
my_name = 'ASPP student'
my_potion = make_example_potion(student_name=my_name)
my_name = 'Python expert'
my_potion = make_python_expert_potion(student_name=my_name)
# Let Snape inspect the potion
inspection.inspection_by_Snape(potion=my_potion, target_potion='example_potion')
inspection.inspection_by_Snape(potion=my_potion, target_potion='python_expert')
1 change: 1 addition & 0 deletions brewing/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
copper_cauldron = 'copper_cauldron'
martini_glass = 'martini_glass'
old_kettle = 'old_kettle'
raki_bottle = 'raki_bottle'
8 changes: 8 additions & 0 deletions brewing/example_usage_within_package.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# Task: import make_example_potion from the module brew_potions.py
import brew_potions
brew_potions.make_example_potion("student")

from brew_potions import make_example_potion
make_example_potion("student")

import brew_potions as br
br.make_example_potion("student")
2 changes: 1 addition & 1 deletion brewing/potion_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ def add_ingredients(self, ingredients=None):
if ingredients is None:
print(f'You have added no ingredients - have you spilt them on the floor again?')
else:
self.ingredients = ingredients
self.ingredients += ingredients
self.colour = "transparent"
3 changes: 3 additions & 0 deletions example_usage_outside_package.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Task: import make_example_potion from the module brew_potions.py
import brewing
import brewing.brew_potions
brewing.brew_potions.make_example_potion("student")