Index: dialin/ui/hd_simulator.py =================================================================== diff -u -rd3a22e97fad0b715b1e9fba138236334ae7dbb6d -rdb2b8f2dbb5876c6d02a9d2140b52322ae7dce4e --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision d3a22e97fad0b715b1e9fba138236334ae7dbb6d) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision db2b8f2dbb5876c6d02a9d2140b52322ae7dce4e) @@ -26,13 +26,7 @@ from random import random from copy import deepcopy import threading as threadsHere -# from threading import Timer -# from PySide2.QtCore import QTimer # TBD! Slot, Qt -from functools import wraps - - - def catch_exception(f): @functools.wraps(f) def func(*args, **kwargs): @@ -593,7 +587,7 @@ def run_demoTimer_timeout(self) -> None: while self.demoTimer.is_alive(): self.do_demoTimer_timeout() - time.sleep(1) + sleep(1) self.demoTimer.cancel() def do_demoTimer_timeout(self) -> None: Index: dialin/utils/__init__.py =================================================================== diff -u -rd3a22e97fad0b715b1e9fba138236334ae7dbb6d -rdb2b8f2dbb5876c6d02a9d2140b52322ae7dce4e --- dialin/utils/__init__.py (.../__init__.py) (revision d3a22e97fad0b715b1e9fba138236334ae7dbb6d) +++ dialin/utils/__init__.py (.../__init__.py) (revision db2b8f2dbb5876c6d02a9d2140b52322ae7dce4e) @@ -2,8 +2,6 @@ from .checks import * from .helpers import * from .conversions import * -from .excel_ops import * -from .nv_ops_utils import * from .singleton import * from .data_logger import DataLogger YES = 1 Index: dialin/utils/data_logger.py =================================================================== diff -u -rd3a22e97fad0b715b1e9fba138236334ae7dbb6d -rdb2b8f2dbb5876c6d02a9d2140b52322ae7dce4e --- dialin/utils/data_logger.py (.../data_logger.py) (revision d3a22e97fad0b715b1e9fba138236334ae7dbb6d) +++ dialin/utils/data_logger.py (.../data_logger.py) (revision db2b8f2dbb5876c6d02a9d2140b52322ae7dce4e) @@ -21,9 +21,7 @@ from logging import Logger from time import sleep from typing import Tuple -from multiprocessing import Process from pathlib import Path -import pandas as pd from dialin.utils.base import _FauxLogger @@ -100,52 +98,6 @@ if i >= self.MAX_CHUNK_SIZE: break - def export_to_xlsx(self, output_path: str) -> None: - """ - Called when the user wishes to export all captured logs to a xlsx file - - @param output_path: (str) the destination output path - @return: None - """ - process = Process(target=self._do_export_to_xlsx, args=(output_path,)) - process.start() - - def _do_export_to_xlsx(self, output_path: str) -> None: - """ - Performs the actual export to xlsx - - @param output_path: (str) the destination output path - @return: None - """ - - Path(self.path_disable_logging).touch() - self.logger.debug("Starting data export to {0}".format(output_path)) - log_path = os.path.join(self.base_folder, "*Log") - folders = glob.glob(log_path) - if len(folders) == 0: - self.logger.debug("No folder with data to export") - os.remove(self.path_disable_logging) - return - writer = pd.ExcelWriter(output_path) - for folder in folders: - files = os.path.join(folder, "*.csv") - csv_files = glob.glob(files) - module_name = os.path.basename(folder) - df = pd.DataFrame() - for csv_file in csv_files: - df_data = pd.read_csv(csv_file) - df_data = df_data.set_index("timestamp") - df = df.join(df_data, how="outer") - try: - df.to_excel(writer, sheet_name=module_name) - self.logger.debug("Added {0} to {1}".format(module_name, output_path)) - except ValueError as e: - self.logger.error("Error during write to excel: {0}".format(e)) - - writer.save() - self.logger.debug("Finished data export to {0}".format(output_path)) - os.remove(self.path_disable_logging) - def clear_logs(self): """ Called when the user clears the logs Index: dialin/utils/nv_ops_utils.py =================================================================== diff -u -rd3a22e97fad0b715b1e9fba138236334ae7dbb6d -rdb2b8f2dbb5876c6d02a9d2140b52322ae7dce4e --- dialin/utils/nv_ops_utils.py (.../nv_ops_utils.py) (revision d3a22e97fad0b715b1e9fba138236334ae7dbb6d) +++ dialin/utils/nv_ops_utils.py (.../nv_ops_utils.py) (revision db2b8f2dbb5876c6d02a9d2140b52322ae7dce4e) @@ -20,7 +20,6 @@ from logging import Logger from typing import List from collections import OrderedDict -from .excel_ops import * from dialin.utils.base import AbstractObserver, DialinEnum @@ -152,249 +151,6 @@ # of the group. self._temp_groups_data_to_calculate_crc = [] - def _create_workspace(self, dir_name): - """ - Publicly accessible function to get create a workspace for the script that is running. - - @param dir_name: Name of the workspace directory - - @return none - """ - # Get the root directory of the current script - scripts_root_dir = os.path.dirname(os.path.dirname(__file__)) - # Get the root directory of the entire scripts folder. The workspace that holds the - # code review reports and clones other scripts and repositories must be outside of the scripts - root_dir = os.path.dirname(os.path.dirname(scripts_root_dir)) - # Create the address of the workspace - self._workspace_dir = os.path.join(root_dir, dir_name) - # If the path does not exist, make it, otherwise, change to that directory - if not os.path.isdir(self._workspace_dir): - # Create the directory and go to it - os.mkdir(self._workspace_dir) - os.chdir(self._workspace_dir) - - def prepare_excel_report(self, firmware_stack: str, record_name: str, directory: str, protect_sheet: bool = False): - """ - Publicly accessible function to prepare the excel report - - @param firmware_stack: (str) firmware stack name (e.g. "HD" or "DG") - @param record_name: (str) record type to check such as calibration, system, ... - @param directory: (str) the directory in which to write the excel document. - @param protect_sheet: (bool) flag to indicate whether to write protect the sheet or not (default False) - @return none - """ - path = '' - is_report_found = False - - # If a directory is provided and there is not a folder in that address, create the - # directory. Set the workspace directory to the provided directory. If a directory was not - # provided, create a workspace in the default position - default_nv_directory = firmware_stack + '_NV_Records' - - if directory is not None: - directory = os.path.join(directory, default_nv_directory) - if not os.path.isdir(directory): - # Create the directory and go to it - os.mkdir(directory) - - self._workspace_dir = directory - os.chdir(self._workspace_dir) - else: - self._create_workspace(default_nv_directory) - - self._record_name = record_name - self._firmware_stack = firmware_stack - - # List all the files in the workspace directory - for file in os.listdir(self._workspace_dir): - # If the file has an extension of .xlsx - if file.endswith('.xlsx'): - # Check if the firmware stack (i.e. DG) is in the file and name of the file - # does not have lock in it. When the file is open, there is a hidden lock file - # in there and it is ignored - file = str(file) - if self._firmware_stack in file and 'lock' not in file: - if str(datetime.datetime.now().date()) in file: - if self._SW_CONFIGS_REPORT_NAME in file and self.NON_VOLATILE_RECORD_NAME == record_name: - # Create the file path and exit the loop - path = os.path.join(self._workspace_dir, file) - is_report_found = True - break - elif self._SW_CONFIGS_REPORT_NAME not in file and self.NON_VOLATILE_RECORD_NAME not in \ - record_name: - # Create the file path and exit the loop - path = os.path.join(self._workspace_dir, file) - is_report_found = True - break - - if is_report_found: - # Load the excel workbook - self._excel_workbook = load_excel_report(path) - else: - # Get an excel workbook object - self._excel_workbook = get_an_excel_workbook() - - # Setup worksheet and create the current tab - setup_excel_worksheet(self._excel_workbook, self._record_name, protection=protect_sheet) - - def write_fw_record_to_excel(self, calibration_record: OrderedDict): - """ - Writes a calibration record to excel - @param calibration_record: (dict) the record to write to excel - @return: None - """ - try: - row = 1 - # Let's say the calibration record is: - # Get the keys of the calibration group {'pressure_sensors': 'ppi', {'fourth_order': [' bytearray: """ @@ -465,7 +221,7 @@ value_in_bytes = b'' temp = [] for key, value in group_record.items(): - if key is not 'crc': + if key != 'crc': data_type = value[0] if data_type == '