Skip to content

Commit

Permalink
Black reformating
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Jul 8, 2024
1 parent c4bd4a0 commit 5c8bc5d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 21 deletions.
4 changes: 1 addition & 3 deletions polyviz/choro.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def choro(
filepath = check_filepath(filepath, title, "choro", method)

assert isinstance(method, tuple), "`method` should be a tuple."
assert isinstance(
activity, Activity
), "`activity` should be a Brightway activity."
assert isinstance(activity, Activity), "`activity` should be a Brightway activity."

# fetch unit of method
unit = bw2data.Method(method).metadata["unit"]
Expand Down
4 changes: 2 additions & 2 deletions polyviz/sankey.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""
This module contains the code to generate a Sankey diagram for a given activity and method.
"""
from typing import Optional, Tuple

from typing import Union
from typing import Optional, Tuple, Union

import bw2data
from d3blocks import D3Blocks
Expand All @@ -17,6 +16,7 @@
except ImportError:
from bw2data.backends import Activity


def sankey(
activity: Activity,
method: tuple = None,
Expand Down
4 changes: 1 addition & 3 deletions polyviz/treemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def treemap(
filepath = check_filepath(filepath, title, "treemap", method)

assert isinstance(method, tuple), "`method` should be a tuple."
assert isinstance(
activity, Activity
), "`activity` should be a brightway2 activity."
assert isinstance(activity, Activity), "`activity` should be a brightway2 activity."

# fetch unit of method
unit = bw2data.Method(method).metadata["unit"]
Expand Down
9 changes: 3 additions & 6 deletions polyviz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
except ImportError:
from bw2data.backends import Activity


def calculate_supply_chain(
activity: Activity,
method: tuple,
Expand All @@ -35,9 +36,7 @@ def calculate_supply_chain(
:return: a StringIO object and the reference amount
"""

assert isinstance(
activity, Activity
), "`activity` should be a brightway2 activity."
assert isinstance(activity, Activity), "`activity` should be a brightway2 activity."

amount = amount * -1 if identify_waste_process(activity) else amount

Expand Down Expand Up @@ -70,9 +69,7 @@ def calculate_lcia_score(
:param method: tuple representing a Brightway2 method
:return: LCIA score, C matrix, and reverse dictionary
"""
assert isinstance(
activity, Activity
), "`activity` should be a brightway2 activity."
assert isinstance(activity, Activity), "`activity` should be a brightway2 activity."

print("Calculating LCIA score...")

Expand Down
10 changes: 3 additions & 7 deletions polyviz/violin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from typing import Union

import bw2calc
import bw2data
import numpy as np
import pandas as pd
import bw2calc

try:
from bw2calc.monte_carlo import MultiMonteCarlo
Expand Down Expand Up @@ -46,9 +46,7 @@ def violin(
assert isinstance(method, tuple), "`method` should be a tuple."

for act in activities:
assert isinstance(
act, Activity
), "`activity` should be a Brightway activity."
assert isinstance(act, Activity), "`activity` should be a Brightway activity."

def make_name(activities):
"""
Expand All @@ -73,9 +71,7 @@ def make_name(activities):
).calculate()
else:
lca = bw2calc.LCA(
demand={activities[0]: 1},
method=method,
use_distributions=True
demand={activities[0]: 1}, method=method, use_distributions=True
)
lca.lci()
lca.lcia()
Expand Down

0 comments on commit 5c8bc5d

Please sign in to comment.