aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyecsca/misc
diff options
context:
space:
mode:
authorJ08nY2025-03-13 19:38:48 +0100
committerJ08nY2025-03-13 19:38:48 +0100
commit7c2f12a0111de33330870b2179b71281b59ada29 (patch)
tree80beb7f4e3090a4805d7aa20ffba5cbcc0078902 /pyecsca/misc
parenteccc58127b4c0c10f50e4d05e699d3585391e8a1 (diff)
downloadpyecsca-7c2f12a0111de33330870b2179b71281b59ada29.tar.gz
pyecsca-7c2f12a0111de33330870b2179b71281b59ada29.tar.zst
pyecsca-7c2f12a0111de33330870b2179b71281b59ada29.zip
Blacken.
Diffstat (limited to 'pyecsca/misc')
-rw-r--r--pyecsca/misc/cache.py21
-rw-r--r--pyecsca/misc/cfg.py5
-rw-r--r--pyecsca/misc/utils.py1
3 files changed, 24 insertions, 3 deletions
diff --git a/pyecsca/misc/cache.py b/pyecsca/misc/cache.py
index 5f388ad..acde6bf 100644
--- a/pyecsca/misc/cache.py
+++ b/pyecsca/misc/cache.py
@@ -1,4 +1,5 @@
"""Cache some things."""
+
from functools import lru_cache
from sympy import sympify as _orig_sympify, simplify as _orig_simplify, count_ops
from public import public
@@ -14,5 +15,21 @@ def sympify(
@public
@lru_cache(maxsize=256, typed=True)
-def simplify(expr, ratio=1.7, measure=count_ops, rational=False, inverse=False, doit=True, **kwargs):
- return _orig_simplify(expr, ratio=ratio, measure=measure, rational=rational, inverse=inverse, doit=doit, **kwargs)
+def simplify(
+ expr,
+ ratio=1.7,
+ measure=count_ops,
+ rational=False,
+ inverse=False,
+ doit=True,
+ **kwargs,
+):
+ return _orig_simplify(
+ expr,
+ ratio=ratio,
+ measure=measure,
+ rational=rational,
+ inverse=inverse,
+ doit=doit,
+ **kwargs,
+ )
diff --git a/pyecsca/misc/cfg.py b/pyecsca/misc/cfg.py
index 037074d..a7101fa 100644
--- a/pyecsca/misc/cfg.py
+++ b/pyecsca/misc/cfg.py
@@ -3,6 +3,7 @@ Provides functions for runtime configuration of the toolkit.
This includes how errors are handled, or which :py:class:`~pyecsca.ec.mod.Mod` implementation is used.
"""
+
from copy import deepcopy
from contextvars import ContextVar, Token
from typing import Optional
@@ -119,7 +120,9 @@ class ECConfig:
@mod_implementation.setter
def mod_implementation(self, value: str):
if value not in ("python", "gmp", "flint", "symbolic"):
- raise ValueError("Bad Mod implementaiton, can be one of 'python', 'gmp', 'flint' or 'symbolic'.")
+ raise ValueError(
+ "Bad Mod implementaiton, can be one of 'python', 'gmp', 'flint' or 'symbolic'."
+ )
self._mod_implementation = value
diff --git a/pyecsca/misc/utils.py b/pyecsca/misc/utils.py
index 060208f..eb52614 100644
--- a/pyecsca/misc/utils.py
+++ b/pyecsca/misc/utils.py
@@ -1,4 +1,5 @@
"""Just some utilities I promise."""
+
import sys
from ast import parse
from contextlib import contextmanager