openepd 0.11.0__tar.gz → 0.11.1__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.
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openepd
3
- Version: 0.11.0
3
+ Version: 0.11.1
4
4
  Summary: Python library to work with OpenEPD format
5
5
  Home-page: https://github.com/cchangelabs/openepd
6
6
  License: Apache-2.0
7
7
  Author: C-Change Labs
8
8
  Author-email: support@c-change-labs.com
9
9
  Maintainer: C-Change Labs
10
- Maintainer-email: support@c-change-labs.com
10
+ Maintainer-email: open-source@c-change-labs.com
11
11
  Requires-Python: >=3.11,<4.0
12
12
  Classifier: Development Status :: 3 - Alpha
13
13
  Classifier: Intended Audience :: Developers
@@ -1,10 +1,10 @@
1
1
  [tool.poetry]
2
2
  name = "openepd"
3
- version = "0.11.0"
3
+ version = "0.11.1"
4
4
  license = "Apache-2.0"
5
5
  description = "Python library to work with OpenEPD format"
6
6
  authors = ["C-Change Labs <support@c-change-labs.com>"]
7
- maintainers = ["C-Change Labs <support@c-change-labs.com>"]
7
+ maintainers = ["C-Change Labs <open-source@c-change-labs.com>"]
8
8
  repository = "https://github.com/cchangelabs/openepd"
9
9
  keywords = []
10
10
  classifiers = [
@@ -56,7 +56,7 @@ types-deprecated = ">=1.2.9"
56
56
 
57
57
 
58
58
  [tool.commitizen]
59
- version = "0.11.0"
59
+ version = "0.11.1"
60
60
  bump_version = "bump: version $current_version → $new_version"
61
61
  update_changelog_on_bump = true
62
62
  pre_bump_hooks = []
@@ -17,4 +17,4 @@
17
17
  # Charles Pankow Foundation, Microsoft Sustainability Fund, Interface, MKA Foundation, and others.
18
18
  # Find out more at www.BuildingTransparency.org
19
19
  #
20
- VERSION = "0.11.0"
20
+ VERSION = "0.11.1"
@@ -296,12 +296,14 @@ class LCIAMethod(StrEnum):
296
296
  return cls.UNKNOWN
297
297
 
298
298
 
299
- class Impacts(dict[LCIAMethod, ImpactSet]):
299
+ class Impacts(pyd.BaseModel):
300
300
  """List of environmental impacts, compiled per one of the standard Impact Assessment methods."""
301
301
 
302
+ __root__: dict[LCIAMethod, ImpactSet]
303
+
302
304
  def set_unknown_lcia(self, impact_set: ImpactSet):
303
305
  """Set the impact set as an unknown LCIA method."""
304
- self[LCIAMethod.UNKNOWN] = impact_set
306
+ self.__root__[LCIAMethod.UNKNOWN] = impact_set
305
307
 
306
308
  def set_impact_set(self, lcia_method: LCIAMethod | str | None, impact_set: ImpactSet):
307
309
  """
@@ -314,11 +316,25 @@ class Impacts(dict[LCIAMethod, ImpactSet]):
314
316
  else:
315
317
  if isinstance(lcia_method, str):
316
318
  lcia_method = LCIAMethod.get_by_name(lcia_method)
317
- self[lcia_method] = impact_set
319
+ self.__root__[lcia_method] = impact_set
320
+
321
+ def get_impact_set(
322
+ self, lcia_method: LCIAMethod | str | None, default_val: ImpactSet | None = None
323
+ ) -> ImpactSet | None:
324
+ """Return the impact set for the given LCIA method."""
325
+ if lcia_method is None:
326
+ return self.__root__.get(LCIAMethod.UNKNOWN, default_val)
327
+ if isinstance(lcia_method, str):
328
+ lcia_method = LCIAMethod.get_by_name(lcia_method)
329
+ return self.__root__.get(lcia_method, default_val)
318
330
 
319
331
  def available_methods(self) -> set[LCIAMethod]:
320
332
  """Return a list of available LCIA methods."""
321
- return set(self.keys())
333
+ return set(self.__root__.keys())
334
+
335
+ def as_dict(self) -> dict[LCIAMethod, ImpactSet]:
336
+ """Return the impacts as a dictionary."""
337
+ return self.__root__
322
338
 
323
339
 
324
340
  class ResourceUseSet(BaseOpenEpdSchema):
File without changes
File without changes
File without changes