Skip to content

Commit

Permalink
Reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Nov 9, 2023
1 parent 09fc8f6 commit 22994eb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions bw2io/ecoinvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def import_ecoinvent_release(
lci: bool = True,
lcia: bool = True,
biosphere_name: str | None = None,
use_existing_biosphere: bool = False
use_existing_biosphere: bool = False,
) -> None:
"""
Import an ecoinvent LCI and/or LCIA release.
Expand Down Expand Up @@ -216,7 +216,11 @@ def import_ecoinvent_release(
eb.write_database(overwrite=False)
bd.preferences["biosphere_database"] = biosphere_name

soup = SingleOutputEcospold2Importer(dirpath=lci_path / "datasets", db_name=db_name, biosphere_database_name=biosphere_name)
soup = SingleOutputEcospold2Importer(
dirpath=lci_path / "datasets",
db_name=db_name,
biosphere_database_name=biosphere_name,
)
soup.apply_strategies()
if not soup.all_linked:
raise ValueError(
Expand Down Expand Up @@ -311,9 +315,13 @@ def import_ecoinvent_release(
for name in same_context
]
)
if candidates[0][0] < 3 and candidates[0][0] != candidates[1][0] and candidates[0][1][0].lower() == row['name'][0].lower():
if (
candidates[0][0] < 3
and candidates[0][0] != candidates[1][0]
and candidates[0][1][0].lower() == row["name"][0].lower()
):
new_name = candidates[0][1]
pair = (new_name, row['name'])
pair = (new_name, row["name"])
if pair not in substituted:
print(f"Substituting {new_name} for {row['name']}")
substituted.add(pair)
Expand Down

0 comments on commit 22994eb

Please sign in to comment.