Skip to content

Commit

Permalink
Merge branch 'main' into prepare_libecalc_release_9.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TeeeJay authored Jan 15, 2025
2 parents 55fe4b2 + 05d079a commit 92bb592
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 106 deletions.
10 changes: 10 additions & 0 deletions docs/docs/changelog/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [9.7.0](https://github.com/equinor/ecalc/compare/v9.6.0...v9.7.0) (2025-01-15)


### Miscellaneous Chores

* remove pydantic validation from dto classes ([#740](https://github.com/equinor/ecalc/issues/740)) ([4eff086](https://github.com/equinor/ecalc/commit/4eff0860cdb5136cfa78b0dd9a47230e842f6ed3))
* revert changes in validation error and update dto exceptions ([#764](https://github.com/equinor/ecalc/issues/764)) ([0537f20](https://github.com/equinor/ecalc/commit/0537f2075bf01feae8fd28f0142951957e85b63c))
* update validation error to allow string or none ([#763](https://github.com/equinor/ecalc/issues/763)) ([a5b491d](https://github.com/equinor/ecalc/commit/a5b491d4f8cf4ac3060c14b132de32775bca0b3c))
* upgrade dependencies for week 03. Auto-generated by devCalc ([#761](https://github.com/equinor/ecalc/issues/761)) ([b9017c5](https://github.com/equinor/ecalc/commit/b9017c5ad731ef93e12d363e28624bddbe804aa6))

## [9.6.0](https://github.com/equinor/ecalc/compare/v9.5.0...v9.6.0) (2025-01-10)


Expand Down
176 changes: 88 additions & 88 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "libecalc"
# DO_NOT_EDIT: Version number automatically changed in CICD
version = "9.6.0" # x-release-please-version
version = "9.7.0" # x-release-please-version
# END_DO_NOT_EDIT
description = "eCalc™ is a software tool for calculation of energy demand and greenhouse gas (GHG) emissions from oil and gas production and processing."
keywords = ["energy", "emission", "scientific", "engineering"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from libecalc.dto.types import ConsumerUserDefinedCategoryType
from libecalc.dto.utils.validators import validate_temporal_model
from libecalc.expression import Expression
from libecalc.presentation.yaml.validation_errors import Location


class FuelConsumer(Emitter, EnergyComponent):
Expand Down Expand Up @@ -158,6 +159,7 @@ def validate_fuel_exist(cls, name: str, fuel: Optional[dict[Period, FuelType]],
errors=[
ModelValidationError(
name=name,
location=Location([name]), # for now, we will use the name as the location
message=str(msg),
)
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
validate_temporal_model,
)
from libecalc.expression import Expression
from libecalc.presentation.yaml.validation_errors import Location


class GeneratorSet(Emitter, EnergyComponent):
Expand Down Expand Up @@ -162,6 +163,7 @@ def check_fuel(self, fuel: dict[Period, FuelType]):
errors=[
ModelValidationError(
name=self.name,
location=Location([self.name]), # for now, we will use the name as the location
message=str(msg),
)
],
Expand Down
13 changes: 1 addition & 12 deletions src/libecalc/presentation/yaml/validation_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,7 @@ def from_pydantic_loc(cls, loc: PydanticLoc) -> Self:


class ValidationError(Exception):
def __init__(self, message: Optional[str] = None, location: Optional[Location] = None):
super().__init__(message)
self._location = location
self._message = message

@property
def location(self) -> Optional[str]:
return self._location

@property
def message(self) -> Optional[str]:
return self._message
pass


def dict_node_representer(dumper: Dumper, data):
Expand Down
2 changes: 1 addition & 1 deletion src/libecalc/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from libecalc.common.version import Version

# DO NOT EDIT - replaced in CI with release please
__version__ = "9.6.0" # x-release-please-version
__version__ = "9.7.0" # x-release-please-version
# END DO NOT EDIT


Expand Down
4 changes: 3 additions & 1 deletion tests/libecalc/dto/test_fuel_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ def test_no_fuel_installation_and_blank_reference_consumer(self, yaml_model_fact
with pytest.raises(ModelValidationException) as exc_info:
yaml_model_factory(resource_stream=asset_stream, resources={}, frequency=Frequency.YEAR).validate_for_run()

assert "Validation error\n\n\tName: flare\n\tMessage: Missing fuel for fuel consumer\n" in str(exc_info.value)
assert (
"Validation error\n\n\tLocation: flare\n\tName: flare\n\t" "Message: Missing fuel for fuel consumer\n"
) in str(exc_info.value)
7 changes: 4 additions & 3 deletions tests/libecalc/dto/test_generator_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def test_missing_installation_fuel(self, yaml_model_factory, test_generator_set_
resource_stream=asset_data.resource_stream, resources=asset_data.resources, frequency=Frequency.YEAR
).validate_for_run()

assert "Validation error\n\n\tName: DefaultGeneratorSet\n\tMessage: Missing fuel for generator set\n" in str(
exc_info.value
)
assert (
"Validation error\n\n\tLocation: DefaultGeneratorSet\n\tName: "
"DefaultGeneratorSet\n\tMessage: Missing fuel for generator set\n"
) in str(exc_info.value)

0 comments on commit 92bb592

Please sign in to comment.