Skip to content

Commit

Permalink
Add extra fields for hops and fermentables
Browse files Browse the repository at this point in the history
  • Loading branch information
scheb committed Sep 28, 2020
1 parent 725214b commit 5a970df
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pybeerxml/fermentable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import logging
from typing import Pattern, Text, Optional, List, Tuple

from pybeerxml.utils import cast_to_bool

logger = logging.getLogger(__name__)


Expand All @@ -25,6 +27,18 @@ def __init__(self):
self._yield: Optional[float] = None
self.color: Optional[float] = None
self._add_after_boil: Optional[bool] = None # Should be Bool
self.version: Optional[int] = None
self.type: Optional[Text] = None
self.origin: Optional[Text] = None
self.supplier: Optional[Text] = None
self.notes: Optional[Text] = None
self.coarse_fine_diff: Optional[float] = None
self.moisture: Optional[float] = None
self.diastatic_power: Optional[float] = None
self.protein: Optional[float] = None
self.max_in_batch: Optional[float] = None
self._recommend_mash: Optional[bool] = None
self.ibu_gal_per_lb: Optional[float] = None

@property
def add_after_boil(self) -> bool:
Expand Down Expand Up @@ -93,3 +107,11 @@ def gu(self, liters: float = 1.0) -> Optional[float]:
weight_lb = self.amount * 2.20462
volume_gallons = liters * 0.264172
return self.ppg * weight_lb / volume_gallons

@property
def recommend_mash(self):
return self._recommend_mash

@recommend_mash.setter
def recommend_mash(self, value):
self._recommend_mash = cast_to_bool(value)
10 changes: 10 additions & 0 deletions pybeerxml/hop.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ def __init__(self):
self.form: Optional[Text] = None
self.notes: Optional[Text] = None
self.time: Optional[float] = None
self.version: Optional[int] = None
self.type: Optional[Text] = None
self.beta: Optional[float] = None
self.hsi: Optional[float] = None
self.origin: Optional[Text] = None
self.substitutes: Optional[Text] = None
self.humulene: Optional[float] = None
self.caryophyllene: Optional[float] = None
self.cohumulone: Optional[float] = None
self.myrcene: Optional[float] = None

def utilization_factor(self):
"Account for better utilization from pellets vs. whole"
Expand Down

0 comments on commit 5a970df

Please sign in to comment.