Skip to content

Commit

Permalink
fix : use Fraction for ratios
Browse files Browse the repository at this point in the history
  • Loading branch information
sepandhaghighi committed Oct 3, 2024
1 parent 9dcacd2 commit 4616ba4
Showing 1 changed file with 35 additions and 34 deletions.
69 changes: 35 additions & 34 deletions mycoffee/params.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""mycoffee params."""
from fractions import Fraction

MY_COFFEE_VERSION = "0.4"
INPUT_ERROR_MESSAGE = "[Error] Wrong input"
Expand Down Expand Up @@ -45,32 +46,32 @@
"v60": {
"coffee_ratio": 3,
"water_ratio": 50,
"ratio_lower_limit": 1/18,
"ratio_upper_limit": 1/14,
"ratio_lower_limit": Fraction(1, 18),
"ratio_upper_limit": Fraction(1, 14),
"water": 250,
"info": "V60 method"
},
"espresso": {
"coffee_ratio": 1,
"water_ratio": 2,
"ratio_lower_limit": 1/2.5,
"ratio_upper_limit": 1/1.5,
"ratio_lower_limit": Fraction(1, 2.5),
"ratio_upper_limit": Fraction(1, 1.5),
"water": 36,
"info": "Espresso method"
},
"ristretto": {
"coffee_ratio": 1,
"water_ratio": 1,
"ratio_lower_limit": 1/1.5,
"ratio_upper_limit": 1,
"ratio_lower_limit": Fraction(1, 1.5),
"ratio_upper_limit": Fraction(1, 1),
"water": 18,
"info": "Ristretto method"
},
"lungo": {
"coffee_ratio": 1,
"water_ratio": 4,
"ratio_lower_limit": 1/4,
"ratio_upper_limit": 1/2.5,
"ratio_lower_limit": Fraction(1, 4),
"ratio_upper_limit": Fraction(1, 2.5),
"water": 72,
"info": "Lungo method"
},
Expand All @@ -85,104 +86,104 @@
"french-press": {
"coffee_ratio": 1,
"water_ratio": 15,
"ratio_lower_limit": 1/18,
"ratio_upper_limit": 1/12,
"ratio_lower_limit": Fraction(1, 18),
"ratio_upper_limit": Fraction(1, 12),
"water": 120,
"info": "French press method"
},
"siphon": {
"coffee_ratio": 1,
"water_ratio": 15,
"ratio_lower_limit": 1/16,
"ratio_upper_limit": 1/12,
"ratio_lower_limit": Fraction(1, 16),
"ratio_upper_limit": Fraction(1, 12),
"water": 240,
"info": "Siphon method"
},
"pour-over": {
"coffee_ratio": 1,
"water_ratio": 15,
"ratio_lower_limit": 1/16,
"ratio_upper_limit": 1/14,
"ratio_lower_limit": Fraction(1, 16),
"ratio_upper_limit": Fraction(1, 14),
"water": 240,
"info": "Pour-over method"
},
"auto-drip": {
"coffee_ratio": 1,
"water_ratio": 16,
"ratio_lower_limit": 1/17,
"ratio_upper_limit": 1/14,
"ratio_lower_limit": Fraction(1, 17),
"ratio_upper_limit": Fraction(1, 14),
"water": 128,
"info": "Auto drip method"
},
"cold-brew": {
"coffee_ratio": 1,
"water_ratio": 11,
"ratio_lower_limit": 1/15,
"ratio_upper_limit": 1/8,
"ratio_lower_limit": Fraction(1, 15),
"ratio_upper_limit": Fraction(1, 8),
"water": 242,
"info": "Cold brew method"
},
"cold-brew-conc": {
"coffee_ratio": 1,
"water_ratio": 5,
"ratio_lower_limit": 1/6,
"ratio_upper_limit": 1/4,
"ratio_lower_limit": Fraction(1, 6),
"ratio_upper_limit": Fraction(1, 4),
"water": 120,
"info": "Cold brew concentrate method"
},
"moka-pot": {
"coffee_ratio": 1,
"water_ratio": 10,
"ratio_lower_limit": 1/12,
"ratio_upper_limit": 1/7,
"ratio_lower_limit": Fraction(1, 12),
"ratio_upper_limit": Fraction(1, 7),
"water": 60,
"info": "Moka pot method"
},
"turkish": {
"coffee_ratio": 1,
"water_ratio": 10,
"ratio_lower_limit": 1/12,
"ratio_upper_limit": 1/8,
"ratio_lower_limit": Fraction(1, 12),
"ratio_upper_limit": Fraction(1, 8),
"water": 50,
"info": "Turkish method"
},
"cupping": {
"coffee_ratio": 11,
"water_ratio": 200,
"ratio_lower_limit": 1/19,
"ratio_upper_limit": 1/17,
"ratio_lower_limit": Fraction(1, 19),
"ratio_upper_limit": Fraction(1, 17),
"water": 150,
"info": "Cupping method"
},
"aero-press": {
"coffee_ratio": 1,
"water_ratio": 15,
"ratio_lower_limit": 1/18,
"ratio_upper_limit": 1/12,
"ratio_lower_limit": Fraction(1, 18),
"ratio_upper_limit": Fraction(1, 12),
"water": 135,
"info": "AeroPress standard method"
},
"aero-press-conc": {
"coffee_ratio": 1,
"water_ratio": 6,
"ratio_lower_limit": 1/7,
"ratio_upper_limit": 1/5,
"ratio_lower_limit": Fraction(1, 7),
"ratio_upper_limit": Fraction(1, 5),
"water": 90,
"info": "AeroPress concentrate method"
},
"aero-press-inv": {
"coffee_ratio": 1,
"water_ratio": 12,
"ratio_lower_limit": 1/14,
"ratio_upper_limit": 1/10,
"ratio_lower_limit": Fraction(1, 14),
"ratio_upper_limit": Fraction(1, 10),
"water": 132,
"info": "AeroPress inverted method"
},
"steep-and-release": {
"coffee_ratio": 1,
"water_ratio": 16,
"ratio_lower_limit": 1/17,
"ratio_upper_limit": 1/14,
"ratio_lower_limit": Fraction(1, 17),
"ratio_upper_limit": Fraction(1, 14),
"water": 255,
"info": "Steep-and-release method"
}
Expand Down

0 comments on commit 4616ba4

Please sign in to comment.