From 0f0e281db87a5bd67b7df6c91f0980e156633c12 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sun, 14 Jul 2019 11:35:09 +1000 Subject: [PATCH] plan: document 'basic_rate' --- plan.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plan.py b/plan.py index d9b516e..ed696f9 100755 --- a/plan.py +++ b/plan.py @@ -4,8 +4,11 @@ import math import fractions import collections +from typing import Dict + import satisfactory + def calculate_rates(recipes, remain): required_items = collections.defaultdict(fractions.Fraction) @@ -37,7 +40,12 @@ def calculate_rates(recipes, remain): return required_items -def basic_rate(recipe): +def basic_rate(recipe: Dict) -> fractions.Fraction: + """ + Calculate the rate at which the item is crafted with the default recipe. + :param recipe: + :return: + """ for output, count in recipe['output'].items(): return fractions.Fraction( count, recipe['crafting_time']