Skip to content

Commit

Permalink
Fixes a circular import issue in excelimporter (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvisscher committed Jan 23, 2024
1 parent 7e132a4 commit 96a60fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion activity_browser/bwutils/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
TECHNOSPHERE_TYPES = {"technosphere", "substitution", "production"}
BIOSPHERE_TYPES = {"economic", "emission", "natural resource", "social"}

RELINK_FIELDS = ("name", "database", "categories", "unit", "reference product", "location")


def relink_exchanges_dbs(data: Collection, relink: dict) -> Collection:
"""Use this to relink exchanges during an actual import."""
Expand Down Expand Up @@ -62,7 +64,7 @@ def _relink_exchanges(data: list, other: str) -> list:
act = other.random()
is_technosphere = act.get("type", "process") == "process"
kind = TECHNOSPHERE_TYPES if is_technosphere else BIOSPHERE_TYPES
return link_iterable_by_fields(data, other=other, kind=kind)
return link_iterable_by_fields(data, other=other, kind=kind, fields=RELINK_FIELDS, relink=True)


def relink_exchanges_bw2package(data: dict, relink: dict) -> dict:
Expand Down

0 comments on commit 96a60fd

Please sign in to comment.