diff --git a/unfold/fold.py b/unfold/fold.py index 34d9fc6..64884b9 100644 --- a/unfold/fold.py +++ b/unfold/fold.py @@ -84,9 +84,11 @@ def write_formatted_data(name, data, filepath): exc["amount"], exc["unit"], exc.get("location"), - "::".join(list(exc.get("categories", []))) - if exc["type"] == "biosphere" - else None, + ( + "::".join(list(exc.get("categories", []))) + if exc["type"] == "biosphere" + else None + ), exc["type"], exc.get("product"), ] @@ -441,11 +443,13 @@ def get_exchange( "categories": cat, "type": flow_type, "amount": amount if flow_type != "production" else _(amount), - "input": self.dependency_mapping[(name, ref, loc, unit, cat)] - if flow_type == "biosphere" - else ( - self.datapackage_name, - self.fetch_exchange_code(name, ref, loc, unit), + "input": ( + self.dependency_mapping[(name, ref, loc, unit, cat)] + if flow_type == "biosphere" + else ( + self.datapackage_name, + self.fetch_exchange_code(name, ref, loc, unit), + ) ), } diff --git a/unfold/unfold.py b/unfold/unfold.py index 3f61366..2f71ff6 100644 --- a/unfold/unfold.py +++ b/unfold/unfold.py @@ -2,6 +2,7 @@ Contains the Unfold class, to extract datapackage files. """ + import copy import os import pickle @@ -526,11 +527,13 @@ def get_exchange( "categories": cat, "type": flow_type, "amount": amount if flow_type != "production" else _(amount), - "input": self.fix_key((name, ref, loc, cat)) - if flow_type == "biosphere" - else ( - scenario_name, - self.fetch_exchange_code(name, ref, loc), + "input": ( + self.fix_key((name, ref, loc, cat)) + if flow_type == "biosphere" + else ( + scenario_name, + self.fetch_exchange_code(name, ref, loc), + ) ), }