diff options
| author | J08nY | 2020-02-10 15:44:10 +0100 |
|---|---|---|
| committer | J08nY | 2020-02-10 15:44:10 +0100 |
| commit | 6dea38052b68df2bbfb7a1e21e569f7f22bbc7a8 (patch) | |
| tree | cf933258db88db521433a9cd34c3048414c89d16 /pyecsca/ec/context.py | |
| parent | 75805f4c8b7521bb031024e1576c8c6b2d2099cf (diff) | |
| download | pyecsca-6dea38052b68df2bbfb7a1e21e569f7f22bbc7a8.tar.gz pyecsca-6dea38052b68df2bbfb7a1e21e569f7f22bbc7a8.tar.zst pyecsca-6dea38052b68df2bbfb7a1e21e569f7f22bbc7a8.zip | |
Diffstat (limited to 'pyecsca/ec/context.py')
| -rw-r--r-- | pyecsca/ec/context.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/pyecsca/ec/context.py b/pyecsca/ec/context.py index b5ae389..8f797a8 100644 --- a/pyecsca/ec/context.py +++ b/pyecsca/ec/context.py @@ -8,7 +8,7 @@ from public import public from .formula import Formula from .mod import Mod -from .op import CodeOp +from .op import CodeOp, OpType from .point import Point @@ -16,11 +16,11 @@ from .point import Point class OpResult(object): """A result of an operation.""" parents: Tuple - op: Optional[ast.operator] + op: OpType name: str value: Mod - def __init__(self, name: str, value: Mod, op: Optional[ast.operator], *parents: Any): + def __init__(self, name: str, value: Mod, op: OpType, *parents: Any): self.parents = tuple(parents) self.name = name self.value = value @@ -30,15 +30,7 @@ class OpResult(object): return self.name def __repr__(self): - char = "" - if isinstance(self.op, ast.Mult): - char = "*" - elif isinstance(self.op, ast.Add): - char = "+" - elif isinstance(self.op, ast.Sub): - char = "-" - elif isinstance(self.op, ast.Div): - char = "/" + char = self.op.op_str parents = char.join(str(parent) for parent in self.parents) return f"{self.name} = {parents}" |
