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