bw-functional 0b82__tar.gz → 0b83__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {bw_functional-0b82/bw_functional.egg-info → bw_functional-0b83}/PKG-INFO +1 -1
  2. {bw_functional-0b82 → bw_functional-0b83}/bw_functional/__init__.py +3 -0
  3. {bw_functional-0b82 → bw_functional-0b83}/bw_functional/convert.py +9 -20
  4. {bw_functional-0b82 → bw_functional-0b83/bw_functional.egg-info}/PKG-INFO +1 -1
  5. {bw_functional-0b82 → bw_functional-0b83}/LICENSE +0 -0
  6. {bw_functional-0b82 → bw_functional-0b83}/MANIFEST.in +0 -0
  7. {bw_functional-0b82 → bw_functional-0b83}/README.md +0 -0
  8. {bw_functional-0b82 → bw_functional-0b83}/bw_functional/allocation.py +0 -0
  9. {bw_functional-0b82 → bw_functional-0b83}/bw_functional/database.py +0 -0
  10. {bw_functional-0b82 → bw_functional-0b83}/bw_functional/edge_classes.py +0 -0
  11. {bw_functional-0b82 → bw_functional-0b83}/bw_functional/node_classes.py +0 -0
  12. {bw_functional-0b82 → bw_functional-0b83}/bw_functional.egg-info/SOURCES.txt +0 -0
  13. {bw_functional-0b82 → bw_functional-0b83}/bw_functional.egg-info/dependency_links.txt +0 -0
  14. {bw_functional-0b82 → bw_functional-0b83}/bw_functional.egg-info/requires.txt +0 -0
  15. {bw_functional-0b82 → bw_functional-0b83}/bw_functional.egg-info/top_level.txt +0 -0
  16. {bw_functional-0b82 → bw_functional-0b83}/pyproject.toml +0 -0
  17. {bw_functional-0b82 → bw_functional-0b83}/setup.cfg +0 -0
  18. {bw_functional-0b82 → bw_functional-0b83}/setup.py +0 -0
  19. {bw_functional-0b82 → bw_functional-0b83}/tests/test_allocation.py +0 -0
  20. {bw_functional-0b82 → bw_functional-0b83}/tests/test_database.py +0 -0
  21. {bw_functional-0b82 → bw_functional-0b83}/tests/test_mf_node.py +0 -0
  22. {bw_functional-0b82 → bw_functional-0b83}/tests/test_process_node.py +0 -0
  23. {bw_functional-0b82 → bw_functional-0b83}/tests/test_product_node.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-functional
3
- Version: 0b82
3
+ Version: 0b83
4
4
  Summary: Code for handling multifunctional activities in Brightway
5
5
  Author-email: Chris Mutel <cmutel@gmail.com>, Marin Visscher <m.r.visscher@cml.leidenuniv.nl>
6
6
  Maintainer-email: Marin Visscher <m.r.visscher@cml.leidenuniv.nl>
@@ -8,6 +8,8 @@ __all__ = (
8
8
  "MFExchanges",
9
9
  "FunctionalSQLiteDatabase",
10
10
  "property_allocation",
11
+ "convert_sqlite_to_functional_sqlite",
12
+ "convert_functional_sqlite_to_sqlite"
11
13
  )
12
14
  # import os
13
15
  __version__ = "0.0.2"
@@ -21,6 +23,7 @@ from .allocation import allocation_strategies, generic_allocation, property_allo
21
23
  from .database import FunctionalSQLiteDatabase
22
24
  from .node_classes import Process, Product
23
25
  from .edge_classes import MFExchange, MFExchanges
26
+ from .convert import convert_sqlite_to_functional_sqlite, convert_functional_sqlite_to_sqlite
24
27
 
25
28
  log = getLogger(__name__)
26
29
 
@@ -9,21 +9,16 @@ from .database import FunctionalSQLiteDatabase
9
9
  log = getLogger(__name__)
10
10
 
11
11
 
12
- def convert_sqlite_to_functional_sqlite(database_name: str) -> dict:
13
- return SQLiteToFunctionalSQLite.convert(database_name)
12
+ def convert_sqlite_to_functional_sqlite(database_dict: dict) -> dict:
13
+ return SQLiteToFunctionalSQLite.convert(database_dict)
14
14
 
15
15
 
16
16
  class SQLiteToFunctionalSQLite:
17
17
  @classmethod
18
- def convert(cls, database_name: str):
19
- db = bd.Database(database_name)
20
-
21
- if not isinstance(db, SQLiteBackend):
22
- raise TypeError("Database is not of type SQLite.")
23
-
18
+ def convert(cls, database_dict: dict):
24
19
  converted = {}
25
20
 
26
- for key, ds in tqdm.tqdm(db.load().items()):
21
+ for key, ds in tqdm.tqdm(database_dict.items()):
27
22
  if ds["type"] in ["process", "processwithreferenceproduct"]:
28
23
  converted.update(cls.convert_process(key, ds))
29
24
 
@@ -87,24 +82,18 @@ class SQLiteToFunctionalSQLite:
87
82
  exc["input"] = (database, exc["input"][1] + "_function")
88
83
 
89
84
 
90
- def convert_functional_sqlite_to_sqlite(database_name: str):
91
- return FunctionalSQLiteToSQLite.convert(database_name)
85
+ def convert_functional_sqlite_to_sqlite(database_dict: dict):
86
+ return FunctionalSQLiteToSQLite.convert(database_dict)
92
87
 
93
88
 
94
89
  class FunctionalSQLiteToSQLite:
95
90
  @classmethod
96
- def convert(cls, database_name: str):
97
- db = bd.Database(database_name)
98
-
99
- if not isinstance(db, FunctionalSQLiteDatabase):
100
- raise TypeError("Database is not of type functional_sqlite.")
101
-
102
- raw = db.load()
91
+ def convert(cls, database_dict: dict):
103
92
  converted = {}
104
93
 
105
- for key, ds in tqdm.tqdm(raw.items()):
94
+ for key, ds in tqdm.tqdm(database_dict.items()):
106
95
  if ds["type"] in ["product", "waste"]:
107
- processor = raw[ds["processor"]]
96
+ processor = database_dict[ds["processor"]]
108
97
  converted[key] = cls.convert_function(key, ds, processor)
109
98
 
110
99
  return converted
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-functional
3
- Version: 0b82
3
+ Version: 0b83
4
4
  Summary: Code for handling multifunctional activities in Brightway
5
5
  Author-email: Chris Mutel <cmutel@gmail.com>, Marin Visscher <m.r.visscher@cml.leidenuniv.nl>
6
6
  Maintainer-email: Marin Visscher <m.r.visscher@cml.leidenuniv.nl>
File without changes
File without changes
File without changes
File without changes
File without changes