aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyecsca/ec/formula/base.py6
-rw-r--r--pyecsca/ec/mod.py10
-rw-r--r--pyecsca/ec/params.py2
-rw-r--r--test/ec/test_divpoly.py4
4 files changed, 6 insertions, 16 deletions
diff --git a/pyecsca/ec/formula/base.py b/pyecsca/ec/formula/base.py
index faccd97..d4c5ec8 100644
--- a/pyecsca/ec/formula/base.py
+++ b/pyecsca/ec/formula/base.py
@@ -8,7 +8,7 @@ from astunparse import unparse
from typing import List, Any, ClassVar, MutableMapping, Tuple, Union, Dict
from public import public
-from sympy import FF, symbols, Poly, parse_expr
+from sympy import FF, symbols, Poly
from pyecsca.ec.context import ResultAction
from pyecsca.ec import context
@@ -16,7 +16,7 @@ from pyecsca.ec.error import UnsatisfiedAssumptionError, raise_unsatisified_assu
from pyecsca.ec.mod import Mod, SymbolicMod
from pyecsca.ec.op import CodeOp, OpType
from pyecsca.misc.cfg import getconfig
-from pyecsca.misc.cache import sympify, simplify
+from pyecsca.misc.cache import sympify
@public
@@ -199,7 +199,7 @@ class Formula(ABC):
raise ValueError(
f"This formula couldn't be executed due to an unsupported assumption ({assumption_string})."
)
- numerator, denominator = expr.as_numer_denom()
+ numerator, _ = expr.as_numer_denom()
domain = FF(field)
poly = Poly(numerator, symbols(param), domain=domain)
roots = poly.ground_roots()
diff --git a/pyecsca/ec/mod.py b/pyecsca/ec/mod.py
index 4657190..4d841ff 100644
--- a/pyecsca/ec/mod.py
+++ b/pyecsca/ec/mod.py
@@ -248,10 +248,6 @@ class Mod:
def __rfloordiv__(self, other) -> "Mod":
return ~self * other
- @_check
- def __divmod__(self, divisor):
- raise NotImplementedError
-
def __bytes__(self) -> bytes:
raise NotImplementedError
@@ -448,9 +444,6 @@ class Undefined(Mod):
def __rfloordiv__(self, other):
return NotImplemented
- def __divmod__(self, divisor):
- return NotImplemented
-
def __bytes__(self):
raise NotImplementedError
@@ -546,9 +539,6 @@ class SymbolicMod(Mod):
def __rfloordiv__(self, other) -> "SymbolicMod":
return ~self * other
- def __divmod__(self, divisor) -> "SymbolicMod":
- return NotImplemented
-
def __bytes__(self):
return int(self.x).to_bytes((self.n.bit_length() + 7) // 8, byteorder="big")
diff --git a/pyecsca/ec/params.py b/pyecsca/ec/params.py
index d5477b6..6693581 100644
--- a/pyecsca/ec/params.py
+++ b/pyecsca/ec/params.py
@@ -229,7 +229,7 @@ def _create_params(curve, coords, infty):
raise ValueError(
f"This coordinate model couldn't be loaded due to an unsupported assumption ({assumption_string})."
)
- numerator, denominator = expr.as_numer_denom()
+ numerator, _ = expr.as_numer_denom()
poly = Poly(numerator, symbols(param), domain=k)
roots = poly.ground_roots()
for root in roots:
diff --git a/test/ec/test_divpoly.py b/test/ec/test_divpoly.py
index 44134de..76b5f29 100644
--- a/test/ec/test_divpoly.py
+++ b/test/ec/test_divpoly.py
@@ -165,8 +165,8 @@ def test_mult_by_n(secp128r1):
}
mx, my = mult_by_n(secp128r1.curve, 2)
mx_num, mx_denom = mx
- assert coeffs_mx_num == list(map(lambda x: K.from_sympy(x), mx_num.all_coeffs()))
- assert coeffs_mx_denom == list(map(lambda x: K.from_sympy(x), mx_denom.all_coeffs()))
+ assert coeffs_mx_num == list(map(K.from_sympy, mx_num.all_coeffs()))
+ assert coeffs_mx_denom == list(map(K.from_sympy, mx_denom.all_coeffs()))
my_num, my_denom = my
assert {i: K.from_sympy(d) for i, d in my_num.as_dict().items()} == coeffs_my_num
assert {i: K.from_sympy(d) for i, d in my_denom.as_dict().items()} == coeffs_my_denom