diff options
| author | J08nY | 2025-03-19 14:07:01 +0100 |
|---|---|---|
| committer | J08nY | 2025-03-19 14:07:01 +0100 |
| commit | 25e07e0ae5f74f05edbdd5026a51417333b4679c (patch) | |
| tree | c319ba2315c8389c6f6819b207cbe66b78285de0 | |
| parent | 57434113ec4b0400a5ac7b949536e5edfebddc00 (diff) | |
| download | pyecsca-25e07e0ae5f74f05edbdd5026a51417333b4679c.tar.gz pyecsca-25e07e0ae5f74f05edbdd5026a51417333b4679c.tar.zst pyecsca-25e07e0ae5f74f05edbdd5026a51417333b4679c.zip | |
| -rw-r--r-- | pyecsca/sca/re/tree.py | 6 | ||||
| -rw-r--r-- | pyecsca/sca/stacked_traces/combine.py | 8 | ||||
| -rw-r--r-- | pyecsca/sca/stacked_traces/stacked_traces.py | 8 |
3 files changed, 9 insertions, 13 deletions
diff --git a/pyecsca/sca/re/tree.py b/pyecsca/sca/re/tree.py index 39a7ca7..6307c0f 100644 --- a/pyecsca/sca/re/tree.py +++ b/pyecsca/sca/re/tree.py @@ -45,7 +45,7 @@ Here we grow the trees. from math import ceil, log2 from copy import deepcopy -from typing import Mapping, Any, Set, List, Tuple, Optional, Dict +from typing import Mapping, Any, Set, List, Tuple, Optional, Dict, Union import numpy as np import pandas as pd @@ -548,7 +548,7 @@ class Tree: return tree @classmethod - def build(cls, cfgs: Set[Any], *maps: Map, split: str | SplitCriterion = "largest") -> "Tree": + def build(cls, cfgs: Set[Any], *maps: Map, split: Union[str, SplitCriterion] = "largest") -> "Tree": """ Build a tree. @@ -565,7 +565,7 @@ def _build_tree( maps: Mapping[int, Map], response: Optional[Any] = None, depth: int = 0, - split: str | SplitCriterion = "largest", + split: Union[str, SplitCriterion] = "largest", ) -> Node: pad = " " * depth # If there is only one remaining cfg, we do not need to continue and just return (base case 1). diff --git a/pyecsca/sca/stacked_traces/combine.py b/pyecsca/sca/stacked_traces/combine.py index 33bb1a6..d449d1e 100644 --- a/pyecsca/sca/stacked_traces/combine.py +++ b/pyecsca/sca/stacked_traces/combine.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from abc import ABC, abstractmethod from numba import cuda @@ -227,9 +225,9 @@ class GPUTraceManager(BaseTraceManager): # pragma: no cover @staticmethod def chunk_size_from_ratio( chunk_memory_ratio: float, - element_size: int | None = None, - item_size: int | None = None, - chunk_item_count: int | None = None, + element_size: Optional[int] = None, + item_size: Optional[int] = None, + chunk_item_count: Optional[int] = None, ) -> int: if (element_size is None) == (item_size is None and chunk_item_count is None): raise ValueError( diff --git a/pyecsca/sca/stacked_traces/stacked_traces.py b/pyecsca/sca/stacked_traces/stacked_traces.py index 476375e..3c367e9 100644 --- a/pyecsca/sca/stacked_traces/stacked_traces.py +++ b/pyecsca/sca/stacked_traces/stacked_traces.py @@ -1,8 +1,6 @@ -from __future__ import annotations - import numpy as np from public import public -from typing import Any, Mapping, Sequence +from typing import Any, Mapping, Sequence, Optional from pyecsca.sca.trace_set.base import TraceSet @@ -16,7 +14,7 @@ class StackedTraces: # TODO: Split metadata into common and per-trace def __init__( - self, samples: np.ndarray, meta: Mapping[str, Any] | None = None + self, samples: np.ndarray, meta: Optional[Mapping[str, Any]] = None ) -> None: if meta is None: meta = {} @@ -25,7 +23,7 @@ class StackedTraces: @classmethod def fromarray( - cls, traces: Sequence[np.ndarray], meta: Mapping[str, Any] | None = None + cls, traces: Sequence[np.ndarray], meta: Optional[Mapping[str, Any]] = None ) -> "StackedTraces": if meta is None: meta = {} |
