Commits

Chris Mutel committed 4e5859b

Add DatabaseExplorer

  • Participants
  • Parent commits 31ec5aa

Comments (0)

Files changed (2)

File bw2analyzer/__init__.py

 # encoding: utf-8
 from contribution import ContributionAnalysis
 from page_rank import PageRank
+from explorer import DatabaseExplorer

File bw2analyzer/explorer.py

+# encoding: utf-8
+from brightway2 import *
+
+
+class DatabaseExplorer(object):
+    def __init__(self, name):
+        self.db = Database(name)
+
+    def uses_this_process(self, key):
+        data = db.load()
+        return [k for k in data if key in [e["input"] for e in \
+            data[k]["exchanges"]]]