diff --git a/graph.py b/graph.py index 34f129b..1568d09 100755 --- a/graph.py +++ b/graph.py @@ -1,5 +1,10 @@ #!/usr/bin/env python3 +""" +This script takes a target item and produces GraphViz formatted output that +describes the gross production dependencies required to produce the item. +""" + import satisfactory import os @@ -8,6 +13,14 @@ from typing import Iterable def graph(cookbook: satisfactory.Cookbook, targets: Iterable[str]): + """ + Output the directed graph representing the production chain needed to + produce all the provided targets. + + :param cookbook: + :param targets: + :return: + """ print("digraph G {") seen = set() @@ -22,17 +35,10 @@ def graph(cookbook: satisfactory.Cookbook, targets: Iterable[str]): remain.add(need) seen.add(output) + print("}") -def graph_all(recipes: dict) -> None: - graph(recipes, recipes.all()) - - -def graph_one(recipes: dict, target: str) -> None: - graph(recipes, [target]) - - if __name__ == '__main__': def main(): import argparse