Skip to content

Commit

Permalink
Restore 3.9 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Jul 5, 2024
1 parent e315f08 commit 0d583be
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, ubuntu-20.04, macos-latest, windows-2019]
py-version: ["3.10", "3.11", "3.12"]
py-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions bw2io/extractors/ecospold1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
from io import StringIO
from pathlib import Path
from typing import Any, Union
from typing import Any, Union, Optional

import numpy as np
import pyecospold
Expand All @@ -18,7 +18,7 @@
from tqdm import tqdm


def robust_text(root: etree.ElementBase, attribute: str) -> str | None:
def robust_text(root: etree.ElementBase, attribute: str) -> Optional[str]:
"""Just because the spec says it must be there doesn't mean it will be."""
try:
return getattr(root, attribute).text
Expand Down
3 changes: 2 additions & 1 deletion bw2io/importers/ecoinvent_lcia.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import functools
import warnings
from numbers import Number
from typing import Optional

from bw2data import Database, config

Expand All @@ -21,7 +22,7 @@ class EcoinventLCIAImporter(LCIAImporter):
"""

def __init__(self, biosphere_database: str | None = None):
def __init__(self, biosphere_database: Optional[str] = None):
"""Initialize an instance of EcoinventLCIAImporter.
Defines strategies in ``__init__`` because ``config.biosphere`` is dynamic.
Expand Down
4 changes: 2 additions & 2 deletions bw2io/importers/ecospold2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from functools import partial
from pathlib import Path
from time import time
from typing import Any
from typing import Any, Optional

from bw2data import Database, config

Expand Down Expand Up @@ -52,7 +52,7 @@ def __init__(
self,
dirpath: str,
db_name: str,
biosphere_database_name: str | None = None,
biosphere_database_name: Optional[str] = None,
extractor: Any = Ecospold2DataExtractor,
use_mp: bool = True,
signal: Any = None,
Expand Down
3 changes: 2 additions & 1 deletion bw2io/importers/ecospold2_biosphere.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import os
from pathlib import Path
from typing import Optional

from bw2data.utils import recursive_str_to_unicode
from lxml import objectify
Expand Down Expand Up @@ -46,7 +47,7 @@ def __init__(
self,
name: str = "biosphere3",
version: str = "3.9",
filepath: Path | None = None,
filepath: Optional[Path] = None,
):
"""
Initialize the importer.
Expand Down

0 comments on commit 0d583be

Please sign in to comment.