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

Python expert #5

Open
wants to merge 7 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
40 changes: 29 additions & 11 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

import brewing.potion_class as potion_class
import brewing.containers as containers
import brewing.cooking as cooking
import brewing.inspection as inspection
from brewing.ingredients import fish_eyes, unicorn_hair, tea_leaves

def make_example_potion(student_name):
my_potion = potion_class.Potion(student_name=student_name)
Expand All @@ -14,15 +14,33 @@ def make_example_potion(student_name):
return my_potion


def make_python_expert_potion(student_name):
print("I am a Python Expert")
# todo: write this function!
def make_python_expert_potion(student_name='Harry'):
"""Make an expert potion.

return
Makes a potion in a pewter cauldron container over fire.
Adds fish eyes, unicorn hair and tea leaves.
Cooks for 2 hours.

Parameters
----------
student_name : str, default='Harry'

Returns
-------
python_expert : potion_class.Potion
Potion class instance for expert_potion
"""
print("I am a Python Expert")
python_expert = potion_class.Potion(student_name=student_name)
python_expert.setup(container=containers.pewter_cauldron, heat_source=cooking.fire)
python_expert.add_ingredients([fish_eyes, unicorn_hair, tea_leaves])
cooking.simmer(python_expert, duration=2)
print("You have successfully run make_python_expert_potion, well done :).")
return python_expert


if __name__ == "__main__":
my_name = 'ASPP student'
my_potion = make_example_potion(student_name=my_name)
python_expert = 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=python_expert, target_potion='python_expert')
3 changes: 3 additions & 0 deletions brewing/example_usage_within_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 brew_potions as br

br.make_example_potion('HARRY')
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
from brewing.brew_potions import make_example_potion

make_example_potion('harry')
3 changes: 3 additions & 0 deletions scripts_and_notebooks/example_usage_different_folder.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
from brewing.brew_potions import make_example_potion

make_example_potion('harry')