Skip to content

Commit

Permalink
Black reformating
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Oct 2, 2023
1 parent abd15cc commit 1270b24
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion premise/data_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import csv
import os
from functools import lru_cache
from io import StringIO, BytesIO
from io import BytesIO, StringIO
from itertools import chain
from pathlib import Path
from typing import Dict, List, Union
Expand Down
33 changes: 22 additions & 11 deletions premise/inventory_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,32 +581,43 @@ def lower_case_technosphere_exchanges(self) -> None:
# lower case name and reference product
# only if they are not in the blacklist
# and if the first word is not an acronym
if (not any([x in ds["name"] for x in blakclist]) and
not ds["name"].split(" ")[0].isupper()):
if (
not any([x in ds["name"] for x in blakclist])
and not ds["name"].split(" ")[0].isupper()
):
ds["name"] = ds["name"][0].lower() + ds["name"][1:]
if (not any([x in ds["reference product"] for x in blakclist])
and not ds["reference product"].split(" ")[0].isupper()):
if (
not any([x in ds["reference product"] for x in blakclist])
and not ds["reference product"].split(" ")[0].isupper()
):
ds["reference product"] = (
ds["reference product"][0].lower() + ds["reference product"][1:]
)

for exc in ds["exchanges"]:
if exc["type"] in ["technosphere", "production"]:
if (not any([x in exc["name"] for x in blakclist])
and not exc["name"].split(" ")[0].isupper()):
if (
not any([x in exc["name"] for x in blakclist])
and not exc["name"].split(" ")[0].isupper()
):
exc["name"] = exc["name"][0].lower() + exc["name"][1:]

if (not any(
[x in exc.get("reference product", "") for x in blakclist]
) and not exc.get("reference product", "").split(" ")[0].isupper()):
if (
not any(
[x in exc.get("reference product", "") for x in blakclist]
)
and not exc.get("reference product", "").split(" ")[0].isupper()
):
if exc.get("reference product") is not None:
exc["reference product"] = (
exc["reference product"][0].lower()
+ exc["reference product"][1:]
)

if (not any([x in exc.get("product", "") for x in blakclist])
and not exc.get("product", "").split(" ")[0].isupper()):
if (
not any([x in exc.get("product", "") for x in blakclist])
and not exc.get("product", "").split(" ")[0].isupper()
):
if exc.get("product") is not None:
exc["product"] = (
exc["product"][0].lower() + exc["product"][1:]
Expand Down

0 comments on commit 1270b24

Please sign in to comment.