From de865f8ab8a4daa48f96c0c9ea4b2c047b19b085 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sat, 27 Apr 2019 18:50:20 +1000 Subject: [PATCH] required: add world resource query --- required.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/required.py b/required.py index 00a0a93..5ef7b62 100755 --- a/required.py +++ b/required.py @@ -5,15 +5,6 @@ import typing import os -def as_graphviz(recipes: dict): - print("digraph G {") - for result, method in recipes.items(): - for variation in method: - for input in variation["input"]: - print(f"{input} -> {result}") - print("}") - - if __name__ == '__main__': root = os.path.dirname(__file__) recipe_root = os.path.join(root, 'data', 'recipes') @@ -29,4 +20,12 @@ if __name__ == '__main__': recipes[name] = variations - as_graphviz(recipes) + + resources = set() + + for output, variations in recipes.items(): + for option in variations: + if len(option['input']) == 0: + resources.add(output) + + print("Resources:", resources)