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 == '