From a97f49ebe3c8e28d2a9ba76711555a3378b62341 Mon Sep 17 00:00:00 2001 From: J08nY Date: Wed, 4 Mar 2020 00:04:53 +0100 Subject: Fix some type issues. --- pyecsca/sca/target/binary.py | 4 ++-- pyecsca/sca/target/chipwhisperer.py | 2 +- pyecsca/sca/target/flash.py | 2 +- pyecsca/sca/target/serial.py | 2 +- pyecsca/sca/target/simpleserial.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'pyecsca/sca/target') diff --git a/pyecsca/sca/target/binary.py b/pyecsca/sca/target/binary.py index 9a469b6..cb4c918 100644 --- a/pyecsca/sca/target/binary.py +++ b/pyecsca/sca/target/binary.py @@ -14,7 +14,7 @@ class BinaryTarget(SerialTarget): debug_output: bool def __init__(self, binary: Union[str, List[str]], debug_output: bool = False, **kwargs): - super().__init__(**kwargs) + super().__init__() if not isinstance(binary, (str, list)): raise TypeError if isinstance(binary, str): @@ -34,7 +34,7 @@ class BinaryTarget(SerialTarget): self.process.stdin.write(data.decode()) self.process.stdin.flush() - def read(self, num: Optional[int] = 0, timeout: Optional[int] = 0) -> bytes: + def read(self, num: int = 0, timeout: int = 0) -> bytes: if self.process is None: raise ValueError if num != 0: diff --git a/pyecsca/sca/target/chipwhisperer.py b/pyecsca/sca/target/chipwhisperer.py index 3710195..3dd5686 100644 --- a/pyecsca/sca/target/chipwhisperer.py +++ b/pyecsca/sca/target/chipwhisperer.py @@ -36,7 +36,7 @@ class ChipWhispererTarget(Flashable, SimpleSerialTarget): # pragma: no cover self.target.flush() self.target.write(data.decode()) - def read(self, num: Optional[int] = 0, timeout: Optional[int] = 0) -> bytes: + def read(self, num: int = 0, timeout: int = 0) -> bytes: return self.target.read(num, timeout).encode() def reset(self): diff --git a/pyecsca/sca/target/flash.py b/pyecsca/sca/target/flash.py index be3cfb0..bfdb79f 100644 --- a/pyecsca/sca/target/flash.py +++ b/pyecsca/sca/target/flash.py @@ -8,4 +8,4 @@ class Flashable(ABC): @abstractmethod def flash(self, fw_path: str) -> bool: - ... \ No newline at end of file + ... diff --git a/pyecsca/sca/target/serial.py b/pyecsca/sca/target/serial.py index 3c0b5c4..ccde326 100644 --- a/pyecsca/sca/target/serial.py +++ b/pyecsca/sca/target/serial.py @@ -14,5 +14,5 @@ class SerialTarget(Target): ... @abstractmethod - def read(self, num: Optional[int] = 0, timeout: Optional[int] = 0) -> bytes: + def read(self, num: int = 0, timeout: int = 0) -> bytes: ... diff --git a/pyecsca/sca/target/simpleserial.py b/pyecsca/sca/target/simpleserial.py index 9e26b79..1ad0b68 100644 --- a/pyecsca/sca/target/simpleserial.py +++ b/pyecsca/sca/target/simpleserial.py @@ -63,7 +63,7 @@ class SimpleSerialTarget(SerialTarget): """ data = bytes(cmd) for i in range(0, len(data), 64): - chunk = data[i:i+64] + chunk = data[i:i + 64] sleep(0.010) self.write(chunk) self.write(b"\n") -- cgit v1.2.3-70-g09d2