satisfactory: Add docstrings for all Cookbook functions
This commit is contained in:
parent
10a3438472
commit
5c4393b999
@ -21,19 +21,40 @@ class Cookbook(object):
|
|||||||
return self.__recipes[item]
|
return self.__recipes[item]
|
||||||
|
|
||||||
def all(self) -> Iterable[str]:
|
def all(self) -> Iterable[str]:
|
||||||
|
"""
|
||||||
|
:return: An iterable of all available recipe names
|
||||||
|
"""
|
||||||
return self.__recipes.keys()
|
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']
|
return self.__recipes[name]['recipes']
|
||||||
|
|
||||||
def is_component(self, name: str) -> bool:
|
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']
|
return 'component' in self.__recipes[name]['type']
|
||||||
|
|
||||||
def components(self) -> Generator[str, None, None]:
|
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))
|
return (i for i in self.all() if self.is_component(i))
|
||||||
|
|
||||||
def is_resource(self, name: str) -> bool:
|
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']
|
return 'resource' in self.__recipes[name]['type']
|
||||||
|
|
||||||
def resources(self) -> Generator[str, None, None]:
|
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))
|
return (i for i in self.all() if self.is_resource(i))
|
||||||
|
Loading…
Reference in New Issue
Block a user