bw-functional 0b84__tar.gz → 0b87__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-0b84/bw_functional.egg-info → bw_functional-0b87}/PKG-INFO +1 -1
  2. {bw_functional-0b84 → bw_functional-0b87}/bw_functional/allocation.py +4 -4
  3. {bw_functional-0b84 → bw_functional-0b87}/bw_functional/node_classes.py +6 -4
  4. {bw_functional-0b84 → bw_functional-0b87/bw_functional.egg-info}/PKG-INFO +1 -1
  5. {bw_functional-0b84 → bw_functional-0b87}/LICENSE +0 -0
  6. {bw_functional-0b84 → bw_functional-0b87}/MANIFEST.in +0 -0
  7. {bw_functional-0b84 → bw_functional-0b87}/README.md +0 -0
  8. {bw_functional-0b84 → bw_functional-0b87}/bw_functional/__init__.py +0 -0
  9. {bw_functional-0b84 → bw_functional-0b87}/bw_functional/convert.py +0 -0
  10. {bw_functional-0b84 → bw_functional-0b87}/bw_functional/database.py +0 -0
  11. {bw_functional-0b84 → bw_functional-0b87}/bw_functional/edge_classes.py +0 -0
  12. {bw_functional-0b84 → bw_functional-0b87}/bw_functional.egg-info/SOURCES.txt +0 -0
  13. {bw_functional-0b84 → bw_functional-0b87}/bw_functional.egg-info/dependency_links.txt +0 -0
  14. {bw_functional-0b84 → bw_functional-0b87}/bw_functional.egg-info/requires.txt +0 -0
  15. {bw_functional-0b84 → bw_functional-0b87}/bw_functional.egg-info/top_level.txt +0 -0
  16. {bw_functional-0b84 → bw_functional-0b87}/pyproject.toml +0 -0
  17. {bw_functional-0b84 → bw_functional-0b87}/setup.cfg +0 -0
  18. {bw_functional-0b84 → bw_functional-0b87}/setup.py +0 -0
  19. {bw_functional-0b84 → bw_functional-0b87}/tests/test_allocation.py +0 -0
  20. {bw_functional-0b84 → bw_functional-0b87}/tests/test_database.py +0 -0
  21. {bw_functional-0b84 → bw_functional-0b87}/tests/test_mf_node.py +0 -0
  22. {bw_functional-0b84 → bw_functional-0b87}/tests/test_process_node.py +0 -0
  23. {bw_functional-0b84 → bw_functional-0b87}/tests/test_product_node.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-functional
3
- Version: 0b84
3
+ Version: 0b87
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>
@@ -37,10 +37,6 @@ def generic_allocation(
37
37
  if not isinstance(process, Process):
38
38
  raise ValueError("Activity must be a Process instance")
39
39
 
40
- # Return none if the process is not multifunctional
41
- if not process.multifunctional:
42
- return
43
-
44
40
  # Collect products eligible for allocation (functions that are not subsituted)
45
41
  products = []
46
42
  for product in process.products():
@@ -52,6 +48,10 @@ def generic_allocation(
52
48
  # Include functions with non-positive substitution factor
53
49
  products.append(product)
54
50
 
51
+ if not products:
52
+ log.warning(f"No products to allocate in process {process}")
53
+ return
54
+
55
55
  # Calculate the total value for allocation
56
56
  total = sum([getter(product) for product in products])
57
57
 
@@ -333,7 +333,7 @@ class Process(MFActivity):
333
333
  Raises:
334
334
  ValueError: If no allocation strategy is found.
335
335
  """
336
- if self.get("skip_allocation") or not self.multifunctional:
336
+ if self.get("skip_allocation"):
337
337
  log.debug(f"Skipping allocation for {repr(self)} (id: {self.id})")
338
338
  return
339
339
 
@@ -508,15 +508,17 @@ class Product(MFActivity):
508
508
  list[dict]: A list of dictionaries representing the virtual edges.
509
509
  """
510
510
  virtual_exchanges = []
511
+
512
+ production = self.processing_edge.as_dict()
513
+ production["output"] = self.key
514
+ virtual_exchanges.append(production)
515
+
511
516
  for exchange in self._edges_class(self.processor.key, ["technosphere", "biosphere"]):
512
517
  ds = exchange.as_dict()
513
518
  ds["amount"] = ds["amount"] * self.get("allocation_factor", 1)
514
519
  ds["output"] = self.key
515
520
  virtual_exchanges.append(ds)
516
521
 
517
- production = self.processing_edge.as_dict()
518
- production["output"] = self.key
519
-
520
522
  return virtual_exchanges
521
523
 
522
524
  # def substitute(self, substitute_key: tuple | None = None, substitution_factor=1.0):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-functional
3
- Version: 0b84
3
+ Version: 0b87
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