aboutsummaryrefslogtreecommitdiff
path: root/pyecsca/ec/op.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyecsca/ec/op.py')
-rw-r--r--pyecsca/ec/op.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/pyecsca/ec/op.py b/pyecsca/ec/op.py
index 11c3079..cb186e1 100644
--- a/pyecsca/ec/op.py
+++ b/pyecsca/ec/op.py
@@ -5,17 +5,10 @@ from typing import FrozenSet, Optional
from .mod import Mod
-class Op(object):
+class CodeOp(object):
result: str
parameters: FrozenSet[str]
variables: FrozenSet[str]
-
- def __call__(self, *args, **kwargs: Mod) -> Mod:
- """Execute this operation with kwargs."""
- raise NotImplementedError
-
-
-class CodeOp(Op):
code: Module
operator: Optional[operator]
compiled: CodeType
@@ -75,6 +68,7 @@ class CodeOp(Op):
return f"CodeOp({self.result} = f(params={self.parameters}, vars={self.variables}, consts={self.constants}))"
def __call__(self, *args, **kwargs: Mod) -> Mod:
+ """Execute this operation with kwargs."""
loc = dict(kwargs)
exec(self.compiled, {}, loc)
return loc[self.result]