Removed unnecessary imports and fixed type hints

This commit is contained in:
Andreas Tsouchlos 2022-11-16 19:47:56 +01:00
parent 6c945e6fa1
commit e9faba01d2

View File

@ -1,12 +1,10 @@
"""This file contains utility functions relating to tests and simulations of the decoders."""
import time
import numpy as np
import typing
from tqdm import tqdm
from timeit import default_timer
import signal
from dataclasses import dataclass
import pickle
import os.path
from pathlib import Path
@ -94,7 +92,7 @@ class Simulator:
leave=False,
bar_format="{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}]")
def __getstate__(self):
def __getstate__(self) -> typing.Dict:
"""Custom serialization function called by the 'pickle' module
when saving the state of a currently running simulation
"""
@ -104,9 +102,11 @@ class Simulator:
del state['_snr_pbar']
return state
def __setstate__(self, state):
def __setstate__(self, state) -> None:
"""Custom deserialization function called by the 'pickle' module
when loading a previously saved simulation
:param state: Dictionary storing the serialized version of an object of this class
"""
self.__dict__.update(state)
@ -331,7 +331,7 @@ class SimulationManager:
self._simulator.start()
@property
def simulation_done(self):
def simulation_done(self) -> None:
"""Check whether the configured simulation has been completed."""
return self._simulator.simulation_done