Skip to content

Commit

Permalink
Py3.9 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed May 12, 2024
1 parent 6bf4af4 commit eb9c87b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 8 additions & 7 deletions bw_graph_tools/graph_traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from dataclasses import dataclass
from functools import lru_cache
from heapq import heappop, heappush
from typing import Optional

from bw2calc import LCA
from scipy.sparse import spmatrix
Expand Down Expand Up @@ -176,13 +177,13 @@ class NewNodeEachVisitGraphTraversal:
def calculate(
cls,
lca_object: LCA,
cutoff: float | None = 5e-3,
biosphere_cutoff: float | None = 1e-4,
max_calc: int | None = 1e5,
skip_coproducts: bool | None = False,
separate_biosphere_flows: bool | None = True,
static_activity_indices: set[int] | None = set(),
functional_unit_unique_id: int | None = -1,
cutoff: Optional[float] = 5e-3,
biosphere_cutoff: Optional[float] = 1e-4,
max_calc: Optional[int] = 10000,
skip_coproducts: Optional[bool] = False,
separate_biosphere_flows: Optional[bool] = True,
static_activity_indices: Optional[set[int]] = set(),
functional_unit_unique_id: Optional[int] = -1,
) -> dict:
"""
Priority-first traversal (i.e. follow the past of highest score) of the supply chain graph. This class unrolls
Expand Down
3 changes: 2 additions & 1 deletion bw_graph_tools/testing.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from numbers import Number
from typing import Union
import numpy as np

from . import Node, Edge, Flow


def equal_dict(a: Node | Edge | Flow, b: dict, fields: list[str]):
def equal_dict(a: Union[Node, Edge, Flow], b: dict, fields: list[str]):
for field in fields:
if field in b:
if isinstance(b[field], Number):
Expand Down

0 comments on commit eb9c87b

Please sign in to comment.