Skip to content

Commit

Permalink
Add bw2io version to cached databases.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Sep 27, 2023
1 parent dda895e commit 34f9022
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ jobs:
os: [ubuntu-latest]

needs: clean

steps:
- uses: actions/checkout@v2

- name: Install python version
uses: gabrielfalcao/pyenv-action@v7
with:
Expand Down Expand Up @@ -71,17 +69,14 @@ jobs:
Pypi:
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v2

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def package_files(directory):

setup(
name="unfold",
version="1.1.1",
version="1.1.2",
python_requires=">=3.9",
packages=packages,
author="Romain Sacchi <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion unfold/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__all__ = ("Unfold", "Fold")
__version__ = (1, 1, 1)
__version__ = (1, 1, 2)

from .fold import Fold
from .unfold import Unfold
12 changes: 9 additions & 3 deletions unfold/unfold.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ def clear_existing_cache(self):
def check_cached_database(self, name) -> list:
# check that directory exists, otherwise create it
Path(DIR_CACHED_DB).mkdir(parents=True, exist_ok=True)

file_name = Path(DIR_CACHED_DB / f"cached_{name}.pickle")
bw2io_version = "".join(tuple(map(str, bw2io.__version__)))
file_name = Path(DIR_CACHED_DB / f"cached_{name}_{bw2io_version}.pickle")

# check that file path leads to an existing file
if file_name.exists():
Expand Down Expand Up @@ -461,13 +461,19 @@ def find_correct_id(self, key: tuple) -> [tuple, None]:
return key[0] + ", in ground", key[1], key[2], key[3]

else:
raise f"Could not find key: {key}"
print(f"Could not find key: {key}")
# return key


def fix_key(self, key: tuple) -> tuple:
if key in self.dependency_mapping:
return self.dependency_mapping[key]
else:
correct_id = self.find_correct_id(key)
if correct_id is None:
print(f"Could not find key: {key}")
return key

return self.dependency_mapping[self.find_correct_id(key)]

def get_exchange(
Expand Down

0 comments on commit 34f9022

Please sign in to comment.