Skip to content

Commit 691d531

Browse files
eskultetyderasdf
authored andcommitted
models: output: Make EnvironmentVariable a frozen model
EnvironmentVariable instances are never mutated after construction. resolve_value() is a pure function returning a new string. Making the model frozen enforces this invariant and enables hashing, which allows using EnvironmentVariable in sets and as dict keys. Reference: hermetoproject#1629 (comment) Signed-off-by: Erik Skultety <eskultet@redhat.com>
1 parent b5e84c8 commit 691d531

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

hermeto/core/models/output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
log = logging.getLogger(__name__)
1515

1616

17-
class EnvironmentVariable(pydantic.BaseModel):
17+
class EnvironmentVariable(pydantic.BaseModel, frozen=True):
1818
"""An environment variable high-level representation.
1919
2020
An environment variable is represented as a string template that is evaluated (i.e.

0 commit comments

Comments
 (0)