From 5c4393b999f1c77648a800c143db19595bbec198 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sun, 14 Jul 2019 11:22:45 +1000 Subject: [PATCH] satisfactory: Add docstrings for all Cookbook functions --- satisfactory/__init__.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/satisfactory/__init__.py b/satisfactory/__init__.py index 0b5dda9..d7aa1cd 100644 --- a/satisfactory/__init__.py +++ b/satisfactory/__init__.py @@ -21,19 +21,40 @@ class Cookbook(object): return self.__recipes[item] def all(self) -> Iterable[str]: + """ + :return: An iterable of all available recipe names + """ return self.__recipes.keys() - def recipes(self, name: str) -> Dict: + def recipes(self, name: str) -> Iterable[Dict]: + """ + :param name: The target item name + :return: A sequence of possible recipes for the target item + """ return self.__recipes[name]['recipes'] def is_component(self, name: str) -> bool: + """ + :param name: The name of an item + :return: Whether the item is a component; ie, craftable. + """ return 'component' in self.__recipes[name]['type'] def components(self) -> Generator[str, None, None]: + """ + :return: The names of all items that are resources. + """ return (i for i in self.all() if self.is_component(i)) def is_resource(self, name: str) -> bool: + """ + :param name: The name of an item + :return: Whether the item must have harvested (rather than crafted) + """ return 'resource' in self.__recipes[name]['type'] def resources(self) -> Generator[str, None, None]: + """ + :return: The names of all items that are resources. + """ return (i for i in self.all() if self.is_resource(i))