aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-03-18 21:39:51 +0100
committerNao Pross <np@0hm.ch>2024-03-18 21:39:51 +0100
commit0fc1a67377ece682124e84c4e57514e2349ed71d (patch)
tree9bbcf827761d90ed7b2f44a9dccce2428363986b
parentRemove use of replace from example (diff)
downloadmdpoly-0fc1a67377ece682124e84c4e57514e2349ed71d.tar.gz
mdpoly-0fc1a67377ece682124e84c4e57514e2349ed71d.zip
Fix MatParam.to_repr
-rw-r--r--mdpoly/expressions.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/mdpoly/expressions.py b/mdpoly/expressions.py
index dd033f0..d7315b0 100644
--- a/mdpoly/expressions.py
+++ b/mdpoly/expressions.py
@@ -86,13 +86,8 @@ class MatParam(Param):
shape: Shape
def to_repr(self, repr_type: Type[ReprT], state: State) -> tuple[ReprT, State]:
- if self not in state.parameters:
- raise MissingParameters("Cannot construct representation because "
- f"value for parameter {self} was not given.")
-
- # FIXME: add conversion to scalar variables
- # Ignore typecheck because dataclassabc has not type stub
- return MatConst(state.parameters[self]).to_repr(repr_type, state) # type: ignore[call-arg]
+ p = state.parameter(self)
+ return MatConst(p).to_repr(repr_type, state) # type: ignore[call-arg]
def __str__(self) -> str:
return self.name