From d0964b17a23de731dce479a26eb436dde68d12a3 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Mon, 17 Nov 2025 10:38:49 +0000 Subject: [PATCH 01/21] Added global macros to the configuration --- BlockServer/config/configuration.py | 26 ++++++ BlockServer/config/globalmacros.py | 119 ++++++++++++++++++++++++++++ BlockServer/core/config_holder.py | 11 +++ BlockServer/core/constants.py | 1 + BlockServer/fileIO/file_manager.py | 14 ++++ 5 files changed, 171 insertions(+) create mode 100644 BlockServer/config/globalmacros.py diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index 93fa3055..52321b9e 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -20,6 +20,7 @@ from typing import Dict from BlockServer.config.block import Block +from BlockServer.config.globalmacros import Globalmacro from BlockServer.config.group import Group from BlockServer.config.ioc import IOC from BlockServer.config.metadata import MetaData @@ -39,6 +40,7 @@ class Configuration: meta (MetaData): The meta-data for the configuration components (OrderedDict): The components which are part of the configuration is_component (bool): Whether it is actually a component + globalmacros (OrderedDict): The globalmacros for the configuration """ def __init__(self, macros: Dict): @@ -55,6 +57,7 @@ def __init__(self, macros: Dict): self.meta = MetaData("") self.components = OrderedDict() self.is_component = False + self.globalmacros = OrderedDict() def add_block(self, name: str, pv: str, group: str = GRP_NONE, local: bool = True, **kwargs): """Add a block to the configuration. @@ -135,3 +138,26 @@ def set_name(self, name: str): name: The new name for the configuration """ self.meta.name = name + + def add_globalmacro( + self, + name: str, + macros: Dict = None, + ): + """Add an IOC with its global macros to the configuration. + + Args: + name (string): The name of the IOC to add + macros: The macro sets relating to the IOC + + """ + # Only add it if it has not been added before + if name.upper() in self.globalmacros.keys(): + print_and_log( + f"Warning: IOC '{name}' is already part of the configuration. Not adding it again." + ) + else: + print_and_log( + f"Info: Global macros for IOC '{name}' is being added to the configuration." + ) + self.globalmacros[name.upper()] = Globalmacro(name, macros) diff --git a/BlockServer/config/globalmacros.py b/BlockServer/config/globalmacros.py new file mode 100644 index 00000000..d778e6ad --- /dev/null +++ b/BlockServer/config/globalmacros.py @@ -0,0 +1,119 @@ +# This file is part of the ISIS IBEX application. +# Copyright (C) 2012-2016 Science & Technology Facilities Council. +# All rights reserved. +# +# This program is distributed in the hope that it will be useful. +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v1.0 which accompanies this distribution. +# EXCEPT AS EXPRESSLY SET FORTH IN THE ECLIPSE PUBLIC LICENSE V1.0, THE PROGRAM +# AND ACCOMPANYING MATERIALS ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES +# OR CONDITIONS OF ANY KIND. See the Eclipse Public License v1.0 for more details. +# +# You should have received a copy of the Eclipse Public License v1.0 +# along with this program; if not, you can obtain a copy from +# https://www.eclipse.org/org/documents/epl-v10.php or +# http://opensource.org/licenses/eclipse-1.0.php + +import copy +from typing import Any, Dict, List, Union +from collections import OrderedDict +from server_common.utilities import print_and_log + +class Globalmacro: + """Represents an IOC with its global macros. + + Attributes: + name (string): The name of the IOC + macros (dict): The IOC's macros + """ + + def __init__( + self, + name: str, + macros: Dict = None, + ): + """Constructor. + + Args: + name: The name of the IOC + macros: The IOC's macros + """ + self.name = name + + if macros is None: + self.macros = {} + else: + self.macros = macros + + + @staticmethod + def _dict_to_list(in_dict: Dict[str, Any]) -> List[Any]: + """Converts into a format better for the GUI to parse, namely a list. + + Args: + in_dict: The dictionary to be converted + + Returns: + The newly created list + """ + out_list = [] + print_and_log(f"Called for dictionary '{in_dict}'") + for k, v in in_dict.items(): + # Take a copy as we do not want to modify the original + c = copy.deepcopy(v) + c["name"] = k + out_list.append(c) + return out_list + + def __str__(self) -> str: + return f"{self.__class__.__name__}(name={self.name})" + + def to_dict(self) -> Dict[str, Union[str, bool, List[Any]]]: + """Puts the IOC-globalmacro's details into a dictionary. + + Returns: + The IOC-Global Macros' details + """ + return { + "name": self.name, + "macros": self.macros, + } + + def get(self, name): + return self.__getattribute__(name) + + def __getitem__(self, name): + return self.__getattribute__(name) + +class GlobalmacroHelper: + """Converts global macro data to Globalmacro Object. + + Consists of static methods only. + """ + + @staticmethod + def row_to_globalmacro(globalmacros: OrderedDict, row: str): + """converts a row from the globals file to globalmacro data. + + Args: + globalmacros: The current list of global macros + row: The IOC's (or All IOCs) global macro record + """ + IOC_SEPARATOR = "__" + EQUAL_TO = "=" + ALL_IOCS = IOC_SEPARATOR + # Each record is of the form IOC__MACRO=VALUE + # Where there is no __ the Macro is applicable for all IOCs + if EQUAL_TO in row: + ioc_macro, value = row.rsplit(EQUAL_TO, maxsplit=1) + to_add_ioc = {} + if IOC_SEPARATOR in ioc_macro: + ioc, macro = ioc_macro.split(IOC_SEPARATOR, maxsplit=1) + else: + ioc = ALL_IOCS + macro = ioc_macro + + if ioc in globalmacros: + to_add_ioc = globalmacros[ioc] + to_add_ioc[macro] = value.strip() + globalmacros[ioc] = to_add_ioc diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index 9ec2651b..d54d1258 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -325,6 +325,16 @@ def _add_ioc( f"Can't add IOC '{name}' to component '{component}': component does not exist" ) + def _globalmacros_to_list(self): + print_and_log(f"Retrieving cached _globalmacros_to_list...size is '{len(self._config.globalmacros)}'") + #globalmacros = [] + #for iocname, globalmacro in self._config.globalmacros: + # globalmacros.append(b) + #return globalmacros + #return copy.deepcopy(self._config.globalmacros) + #return self._config.globalmacros + return [globalmacro.to_dict() for globalmacro in self._config.globalmacros.values()] + def get_config_details(self) -> Dict[str, Any]: """Get the details of the configuration. @@ -332,6 +342,7 @@ def get_config_details(self) -> Dict[str, Any]: A dictionary containing all the details of the configuration """ return { + "globalmacros": self._globalmacros_to_list(), "blocks": self._blocks_to_list(True), "groups": self._groups_to_list(), "iocs": self._iocs_to_list(), diff --git a/BlockServer/core/constants.py b/BlockServer/core/constants.py index 3620c54d..74639143 100644 --- a/BlockServer/core/constants.py +++ b/BlockServer/core/constants.py @@ -79,5 +79,6 @@ FILENAME_META = "meta.xml" FILENAME_SCREENS = "screens.xml" FILENAME_BANNER = "banner.xml" +FILENAME_GLOBALS = "globals.txt" SCHEMA_FOR = [FILENAME_BLOCKS, FILENAME_GROUPS, FILENAME_IOCS, FILENAME_COMPONENTS, FILENAME_META] diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index e612c59d..134faf3c 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -21,6 +21,7 @@ from BlockServer.config.configuration import Configuration, MetaData from BlockServer.config.group import Group +from BlockServer.config.globalmacros import Globalmacro, GlobalmacroHelper from BlockServer.config.xml_converter import ConfigurationXmlConverter from BlockServer.core.constants import ( DEFAULT_COMPONENT, @@ -32,6 +33,7 @@ FILENAME_IOCS, FILENAME_META, GRP_NONE, + FILENAME_GLOBALS, ) from server_common.file_path_manager import FILEPATH_MANAGER from BlockServer.fileIO.schema_checker import ( @@ -161,12 +163,24 @@ def load_config(self, name, macros, is_component): "Files missing in " + name + " (%s)" % ",".join(list(config_files_missing)) ) + # Import the Global macros + globals_path = os.path.join(FILEPATH_MANAGER.config_root_dir, FILENAME_GLOBALS) + globalmacros = {} + if os.path.isfile(globals_path): + with open(globals_path, 'r') as file: + for line in file: + GlobalmacroHelper.row_to_globalmacro(globalmacros, line.strip()) + # Set properties in the config configuration.blocks = blocks configuration.groups = groups configuration.iocs = iocs configuration.components = components configuration.meta = meta + #configuration.globalmacros = globalmacros + for key, value in globalmacros.items(): + configuration.add_globalmacro(key, value) + print_and_log(f"Configuration ('{name}') loaded.") return configuration From ae34053ca26a17d9862775c25f82aa26bbb06d61 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Mon, 17 Nov 2025 16:13:48 +0000 Subject: [PATCH 02/21] Removed print lines --- BlockServer/config/configuration.py | 2 +- BlockServer/config/globalmacros.py | 15 +++++++-------- BlockServer/core/config_holder.py | 9 +-------- BlockServer/core/constants.py | 2 +- BlockServer/fileIO/file_manager.py | 2 +- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index 52321b9e..63f2b2d6 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -1,5 +1,5 @@ # This file is part of the ISIS IBEX application. -# Copyright (C) 2012-2016 Science & Technology Facilities Council. +# Copyright (C) 2012-2025 Science & Technology Facilities Council. # All rights reserved. # # This program is distributed in the hope that it will be useful. diff --git a/BlockServer/config/globalmacros.py b/BlockServer/config/globalmacros.py index d778e6ad..54b7ead3 100644 --- a/BlockServer/config/globalmacros.py +++ b/BlockServer/config/globalmacros.py @@ -1,5 +1,5 @@ # This file is part of the ISIS IBEX application. -# Copyright (C) 2012-2016 Science & Technology Facilities Council. +# Copyright (C) 2012-2025 Science & Technology Facilities Council. # All rights reserved. # # This program is distributed in the hope that it will be useful. @@ -17,7 +17,6 @@ import copy from typing import Any, Dict, List, Union from collections import OrderedDict -from server_common.utilities import print_and_log class Globalmacro: """Represents an IOC with its global macros. @@ -57,12 +56,12 @@ def _dict_to_list(in_dict: Dict[str, Any]) -> List[Any]: The newly created list """ out_list = [] - print_and_log(f"Called for dictionary '{in_dict}'") - for k, v in in_dict.items(): - # Take a copy as we do not want to modify the original - c = copy.deepcopy(v) - c["name"] = k - out_list.append(c) + if in_dict: + for k, v in in_dict.items(): + # Take a copy as we do not want to modify the original + c = copy.deepcopy(v) + c["name"] = k + out_list.append(c) return out_list def __str__(self) -> str: diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index d54d1258..a638771f 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -1,5 +1,5 @@ # This file is part of the ISIS IBEX application. -# Copyright (C) 2012-2016 Science & Technology Facilities Council. +# Copyright (C) 2012-2025 Science & Technology Facilities Council. # All rights reserved. # # This program is distributed in the hope that it will be useful. @@ -326,13 +326,6 @@ def _add_ioc( ) def _globalmacros_to_list(self): - print_and_log(f"Retrieving cached _globalmacros_to_list...size is '{len(self._config.globalmacros)}'") - #globalmacros = [] - #for iocname, globalmacro in self._config.globalmacros: - # globalmacros.append(b) - #return globalmacros - #return copy.deepcopy(self._config.globalmacros) - #return self._config.globalmacros return [globalmacro.to_dict() for globalmacro in self._config.globalmacros.values()] def get_config_details(self) -> Dict[str, Any]: diff --git a/BlockServer/core/constants.py b/BlockServer/core/constants.py index 74639143..b5528dd9 100644 --- a/BlockServer/core/constants.py +++ b/BlockServer/core/constants.py @@ -1,5 +1,5 @@ # This file is part of the ISIS IBEX application. -# Copyright (C) 2012-2016 Science & Technology Facilities Council. +# Copyright (C) 2012-2025 Science & Technology Facilities Council. # All rights reserved. # # This program is distributed in the hope that it will be useful. diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index 134faf3c..e59460a0 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -1,5 +1,5 @@ # This file is part of the ISIS IBEX application. -# Copyright (C) 2012-2016 Science & Technology Facilities Council. +# Copyright (C) 2012-2025 Science & Technology Facilities Council. # All rights reserved. # # This program is distributed in the hope that it will be useful. From 9a64cedc0aa7cb24c18c0dd568391adf8162827d Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Mon, 17 Nov 2025 22:42:57 +0000 Subject: [PATCH 03/21] Reformatted some files --- BlockServer/config/configuration.py | 2 +- BlockServer/config/globalmacros.py | 5 +++-- BlockServer/fileIO/file_manager.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index 63f2b2d6..34519f0f 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -138,7 +138,7 @@ def set_name(self, name: str): name: The new name for the configuration """ self.meta.name = name - + def add_globalmacro( self, name: str, diff --git a/BlockServer/config/globalmacros.py b/BlockServer/config/globalmacros.py index 54b7ead3..203b39c2 100644 --- a/BlockServer/config/globalmacros.py +++ b/BlockServer/config/globalmacros.py @@ -18,6 +18,7 @@ from typing import Any, Dict, List, Union from collections import OrderedDict + class Globalmacro: """Represents an IOC with its global macros. @@ -44,7 +45,6 @@ def __init__( else: self.macros = macros - @staticmethod def _dict_to_list(in_dict: Dict[str, Any]) -> List[Any]: """Converts into a format better for the GUI to parse, namely a list. @@ -84,6 +84,7 @@ def get(self, name): def __getitem__(self, name): return self.__getattribute__(name) + class GlobalmacroHelper: """Converts global macro data to Globalmacro Object. @@ -111,7 +112,7 @@ def row_to_globalmacro(globalmacros: OrderedDict, row: str): else: ioc = ALL_IOCS macro = ioc_macro - + if ioc in globalmacros: to_add_ioc = globalmacros[ioc] to_add_ioc[macro] = value.strip() diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index e59460a0..72a73c81 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -167,7 +167,7 @@ def load_config(self, name, macros, is_component): globals_path = os.path.join(FILEPATH_MANAGER.config_root_dir, FILENAME_GLOBALS) globalmacros = {} if os.path.isfile(globals_path): - with open(globals_path, 'r') as file: + with open(globals_path, "r") as file: for line in file: GlobalmacroHelper.row_to_globalmacro(globalmacros, line.strip()) @@ -177,7 +177,7 @@ def load_config(self, name, macros, is_component): configuration.iocs = iocs configuration.components = components configuration.meta = meta - #configuration.globalmacros = globalmacros + # configuration.globalmacros = globalmacros for key, value in globalmacros.items(): configuration.add_globalmacro(key, value) From 2fb2aa5a9c585f195085c39a1f1ea26bddcbdf0b Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Mon, 17 Nov 2025 23:23:48 +0000 Subject: [PATCH 04/21] Reformatted some files --- BlockServer/config/configuration.py | 2 +- BlockServer/config/globalmacros.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index 34519f0f..235a21ce 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -142,7 +142,7 @@ def set_name(self, name: str): def add_globalmacro( self, name: str, - macros: Dict = None, + macros: Dict, ): """Add an IOC with its global macros to the configuration. diff --git a/BlockServer/config/globalmacros.py b/BlockServer/config/globalmacros.py index 203b39c2..38e3b0e7 100644 --- a/BlockServer/config/globalmacros.py +++ b/BlockServer/config/globalmacros.py @@ -92,7 +92,7 @@ class GlobalmacroHelper: """ @staticmethod - def row_to_globalmacro(globalmacros: OrderedDict, row: str): + def row_to_globalmacro(globalmacros: Dict, row: str): """converts a row from the globals file to globalmacro data. Args: From 964a846da059ca8fd3795c7175211ef820172394 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Mon, 17 Nov 2025 23:42:08 +0000 Subject: [PATCH 05/21] Reformatted some files --- BlockServer/config/globalmacros.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BlockServer/config/globalmacros.py b/BlockServer/config/globalmacros.py index 38e3b0e7..9127b37d 100644 --- a/BlockServer/config/globalmacros.py +++ b/BlockServer/config/globalmacros.py @@ -30,7 +30,7 @@ class Globalmacro: def __init__( self, name: str, - macros: Dict = None, + macros: Dict[str, str], ): """Constructor. From f7246bd404074c69e5776e65818a3cfcebee0252 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 00:08:06 +0000 Subject: [PATCH 06/21] Reformatted some files --- BlockServer/config/globalmacros.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BlockServer/config/globalmacros.py b/BlockServer/config/globalmacros.py index 9127b37d..b0df197b 100644 --- a/BlockServer/config/globalmacros.py +++ b/BlockServer/config/globalmacros.py @@ -67,7 +67,7 @@ def _dict_to_list(in_dict: Dict[str, Any]) -> List[Any]: def __str__(self) -> str: return f"{self.__class__.__name__}(name={self.name})" - def to_dict(self) -> Dict[str, Union[str, bool, List[Any]]]: + def to_dict(self) -> Dict[str, Dict[str, str]]: """Puts the IOC-globalmacro's details into a dictionary. Returns: From 5cc6e1a607bbbfb56d66b0b428afcb1288afbaa9 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 00:11:37 +0000 Subject: [PATCH 07/21] Reformatted some files --- BlockServer/config/globalmacros.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BlockServer/config/globalmacros.py b/BlockServer/config/globalmacros.py index b0df197b..f4bfdd42 100644 --- a/BlockServer/config/globalmacros.py +++ b/BlockServer/config/globalmacros.py @@ -15,7 +15,7 @@ # http://opensource.org/licenses/eclipse-1.0.php import copy -from typing import Any, Dict, List, Union +from typing import Any, Dict, List from collections import OrderedDict From 71873dfa0487dafdc089fed54d699bef9ad0bd79 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 00:29:55 +0000 Subject: [PATCH 08/21] Reformatted some files --- BlockServer/config/globalmacros.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BlockServer/config/globalmacros.py b/BlockServer/config/globalmacros.py index f4bfdd42..714871bb 100644 --- a/BlockServer/config/globalmacros.py +++ b/BlockServer/config/globalmacros.py @@ -67,7 +67,7 @@ def _dict_to_list(in_dict: Dict[str, Any]) -> List[Any]: def __str__(self) -> str: return f"{self.__class__.__name__}(name={self.name})" - def to_dict(self) -> Dict[str, Dict[str, str]]: + def to_dict(self) -> Dict[str, str | Dict[str, str]]: """Puts the IOC-globalmacro's details into a dictionary. Returns: From 17776bea07a96a1aa011765dfd27a861b56de96b Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 12:50:04 +0000 Subject: [PATCH 09/21] Fixed some ruff comments --- BlockServer/config/configuration.py | 6 +----- BlockServer/config/globalmacros.py | 25 ++++++++++++------------- BlockServer/core/config_holder.py | 9 ++++----- BlockServer/fileIO/file_manager.py | 7 +++---- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index 235a21ce..b7578036 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -142,8 +142,7 @@ def set_name(self, name: str): def add_globalmacro( self, name: str, - macros: Dict, - ): + macros: Dict) -> None: """Add an IOC with its global macros to the configuration. Args: @@ -157,7 +156,4 @@ def add_globalmacro( f"Warning: IOC '{name}' is already part of the configuration. Not adding it again." ) else: - print_and_log( - f"Info: Global macros for IOC '{name}' is being added to the configuration." - ) self.globalmacros[name.upper()] = Globalmacro(name, macros) diff --git a/BlockServer/config/globalmacros.py b/BlockServer/config/globalmacros.py index 714871bb..57004267 100644 --- a/BlockServer/config/globalmacros.py +++ b/BlockServer/config/globalmacros.py @@ -16,7 +16,6 @@ import copy from typing import Any, Dict, List -from collections import OrderedDict class Globalmacro: @@ -31,7 +30,7 @@ def __init__( self, name: str, macros: Dict[str, str], - ): + ) -> None: """Constructor. Args: @@ -78,10 +77,10 @@ def to_dict(self) -> Dict[str, str | Dict[str, str]]: "macros": self.macros, } - def get(self, name): + def get(self, name: str) -> None: return self.__getattribute__(name) - def __getitem__(self, name): + def __getitem__(self, name: str) -> None: return self.__getattribute__(name) @@ -92,25 +91,25 @@ class GlobalmacroHelper: """ @staticmethod - def row_to_globalmacro(globalmacros: Dict, row: str): + def row_to_globalmacro(globalmacros: Dict, row: str) -> None: """converts a row from the globals file to globalmacro data. Args: globalmacros: The current list of global macros row: The IOC's (or All IOCs) global macro record """ - IOC_SEPARATOR = "__" - EQUAL_TO = "=" - ALL_IOCS = IOC_SEPARATOR + ioc_separator = "__" + equal_to = "=" + all_iocs = ioc_separator # Each record is of the form IOC__MACRO=VALUE # Where there is no __ the Macro is applicable for all IOCs - if EQUAL_TO in row: - ioc_macro, value = row.rsplit(EQUAL_TO, maxsplit=1) + if equal_to in row: + ioc_macro, value = row.rsplit(equal_to, maxsplit=1) to_add_ioc = {} - if IOC_SEPARATOR in ioc_macro: - ioc, macro = ioc_macro.split(IOC_SEPARATOR, maxsplit=1) + if ioc_separator in ioc_macro: + ioc, macro = ioc_macro.split(ioc_separator, maxsplit=1) else: - ioc = ALL_IOCS + ioc = all_iocs macro = ioc_macro if ioc in globalmacros: diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index a638771f..cba3ce65 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -21,15 +21,14 @@ from collections import OrderedDict from typing import Any, Dict, List -from server_common.file_path_manager import FILEPATH_MANAGER -from server_common.helpers import PVPREFIX_MACRO -from server_common.utilities import print_and_log - from BlockServer.config.configuration import Configuration from BlockServer.config.group import Group from BlockServer.config.metadata import MetaData from BlockServer.core.constants import DEFAULT_COMPONENT, GRP_NONE from BlockServer.fileIO.file_manager import ConfigurationFileManager +from server_common.file_path_manager import FILEPATH_MANAGER +from server_common.helpers import PVPREFIX_MACRO +from server_common.utilities import print_and_log class ConfigHolder: @@ -325,7 +324,7 @@ def _add_ioc( f"Can't add IOC '{name}' to component '{component}': component does not exist" ) - def _globalmacros_to_list(self): + def _globalmacros_to_list(self) -> Dict[str, str | Dict[str, str]]: return [globalmacro.to_dict() for globalmacro in self._config.globalmacros.values()] def get_config_details(self) -> Dict[str, Any]: diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index 72a73c81..b4d0941c 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -20,8 +20,8 @@ from xml.etree import ElementTree from BlockServer.config.configuration import Configuration, MetaData +from BlockServer.config.globalmacros import GlobalmacroHelper from BlockServer.config.group import Group -from BlockServer.config.globalmacros import Globalmacro, GlobalmacroHelper from BlockServer.config.xml_converter import ConfigurationXmlConverter from BlockServer.core.constants import ( DEFAULT_COMPONENT, @@ -29,18 +29,18 @@ FILENAME_BANNER, FILENAME_BLOCKS, FILENAME_COMPONENTS, + FILENAME_GLOBALS, FILENAME_GROUPS, FILENAME_IOCS, FILENAME_META, GRP_NONE, - FILENAME_GLOBALS, ) -from server_common.file_path_manager import FILEPATH_MANAGER from BlockServer.fileIO.schema_checker import ( ConfigurationIncompleteException, ConfigurationSchemaChecker, ) from server_common.common_exceptions import MaxAttemptsExceededException +from server_common.file_path_manager import FILEPATH_MANAGER from server_common.utilities import print_and_log, retry RETRY_MAX_ATTEMPTS = 20 @@ -177,7 +177,6 @@ def load_config(self, name, macros, is_component): configuration.iocs = iocs configuration.components = components configuration.meta = meta - # configuration.globalmacros = globalmacros for key, value in globalmacros.items(): configuration.add_globalmacro(key, value) From f4aa70522b317938aa95f5515537322ee8562d40 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 13:56:14 +0000 Subject: [PATCH 10/21] Fixed some ruff comments --- BlockServer/core/config_holder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index cba3ce65..960c967d 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -324,7 +324,7 @@ def _add_ioc( f"Can't add IOC '{name}' to component '{component}': component does not exist" ) - def _globalmacros_to_list(self) -> Dict[str, str | Dict[str, str]]: + def _globalmacros_to_list(self) -> List[Any]: return [globalmacro.to_dict() for globalmacro in self._config.globalmacros.values()] def get_config_details(self) -> Dict[str, Any]: From 615ff3064d11331ade35a744ea5307b63ab54357 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 14:19:36 +0000 Subject: [PATCH 11/21] Fixed some ruff comments --- BlockServer/config/configuration.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index b7578036..cfd9c668 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -43,7 +43,7 @@ class Configuration: globalmacros (OrderedDict): The globalmacros for the configuration """ - def __init__(self, macros: Dict): + def __init__(self, macros: Dict) -> None: """Constructor. Args: @@ -59,7 +59,14 @@ def __init__(self, macros: Dict): self.is_component = False self.globalmacros = OrderedDict() - def add_block(self, name: str, pv: str, group: str = GRP_NONE, local: bool = True, **kwargs): + def add_block( + self, + name: str, + pv: str, + group: str = GRP_NONE, + local: bool = True, + **kwargs: bool | float | None, + ) -> None: """Add a block to the configuration. Args: @@ -95,8 +102,8 @@ def add_ioc( pvs: Dict = None, pvsets: Dict = None, simlevel: str = None, - remotePvPrefix: str = None, - ): + remotePvPrefix: str = None, # Has to match the mapped Java attribute #noqa: N803 + ) -> None: """Add an IOC to the configuration. Args: @@ -131,7 +138,7 @@ def get_name(self) -> str: self.meta.name.decode("utf-8") if isinstance(self.meta.name, bytes) else self.meta.name ) - def set_name(self, name: str): + def set_name(self, name: str) -> None: """Sets the configuration's name. Args: @@ -139,10 +146,7 @@ def set_name(self, name: str): """ self.meta.name = name - def add_globalmacro( - self, - name: str, - macros: Dict) -> None: + def add_globalmacro(self, name: str, macros: Dict) -> None: """Add an IOC with its global macros to the configuration. Args: From 7aa2e58ec8c405a3e4a18fc47eb0399fb6426068 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 14:43:42 +0000 Subject: [PATCH 12/21] Fixed some ruff comments --- BlockServer/core/config_holder.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index 960c967d..5ccd5e00 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -126,7 +126,7 @@ def get_blocknames(self) -> List[str]: names.append(block.name) return names - def get_block_details(self): + def get_block_details(self) -> OrderedDict: """Get the configuration details for all the blocks including any in components. Returns: @@ -182,7 +182,7 @@ def get_group_details(self) -> Dict[str, Group]: return groups - def _set_group_details(self, redefinition) -> None: + def _set_group_details(self, redefinition: List) -> None: # Any redefinition only affects the main configuration homeless_blocks = self.get_blocknames() for grp in redefinition: @@ -244,7 +244,7 @@ def get_ioc_names(self, include_base: bool = False) -> List[str]: iocs.extend(cv.iocs) return iocs - def get_ioc_details(self): + def get_ioc_details(self) -> OrderedDict: """Get the details of the IOCs in the configuration. Returns: @@ -252,7 +252,7 @@ def get_ioc_details(self): """ return copy.deepcopy(self._config.iocs) - def get_component_ioc_details(self): + def get_component_ioc_details(self) -> Dict: """Get the details of the IOCs in any components. Returns: @@ -265,7 +265,7 @@ def get_component_ioc_details(self): iocs[ioc_name] = ioc return iocs - def get_all_ioc_details(self): + def get_all_ioc_details(self) -> Dict: """Get the details of the IOCs in the configuration and any components. Returns: @@ -367,7 +367,7 @@ def is_dynamic(self) -> bool: """ return self._config.meta.isDynamic - def configures_block_gateway_and_archiver(self): + def configures_block_gateway_and_archiver(self) -> bool: """ Returns: (bool): Whether this config has a gwblock.pvlist and block_config.xml to configure the @@ -375,14 +375,14 @@ def configures_block_gateway_and_archiver(self): """ return self._config.meta.configuresBlockGWAndArchiver - def _comps_to_list(self): + def _comps_to_list(self) -> List: comps = [] for component_name, component_value in self._components.items(): if component_name.lower() != DEFAULT_COMPONENT.lower(): comps.append({"name": component_value.get_name()}) return comps - def _blocks_to_list(self, expand_macro: bool = False): + def _blocks_to_list(self, expand_macro: bool = False) -> List: blocks = self.get_block_details() blks = [] if blocks is not None: @@ -394,7 +394,7 @@ def _blocks_to_list(self, expand_macro: bool = False): blks.append(b) return blks - def _groups_to_list(self): + def _groups_to_list(self) -> List: groups = self.get_group_details() grps = [] if groups is not None: @@ -407,10 +407,10 @@ def _groups_to_list(self): grps.append(groups[GRP_NONE.lower()].to_dict()) return grps - def _iocs_to_list(self): + def _iocs_to_list(self) -> List: return [ioc.to_dict() for ioc in self._config.iocs.values()] - def _iocs_to_list_with_components(self): + def _iocs_to_list_with_components(self) -> List: ioc_list = self._iocs_to_list() for component in self._components.values(): @@ -418,7 +418,7 @@ def _iocs_to_list_with_components(self): ioc_list.append(ioc.to_dict()) return ioc_list - def _to_dict(self, data_list): + def _to_dict(self, data_list: List) -> Dict: return None if data_list is None else {item["name"]: item for item in data_list} def set_config(self, config: Configuration, is_component: bool = False) -> None: From 58a35af3fe5e0ecd9ddf4f54acaa453d04d4caee Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 15:20:15 +0000 Subject: [PATCH 13/21] Fixed some more ruff findings --- BlockServer/fileIO/file_manager.py | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index b4d0941c..7bd35193 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -53,7 +53,7 @@ class ConfigurationFileManager: Contains utilities to save and load configurations. """ - def find_ci(self, root_path, name): + def find_ci(self, root_path: str, name: str) -> str: """find a file with a case insensitive match""" res = "" for f in os.listdir(root_path): @@ -61,7 +61,7 @@ def find_ci(self, root_path, name): res = f return res - def load_config(self, name, macros, is_component): + def load_config(self, name: str, macros: dict, is_component: bool) -> Configuration: """Loads the configuration from the specified folder. Args: @@ -184,13 +184,13 @@ def load_config(self, name, macros, is_component): return configuration @staticmethod - def _check_against_schema(xml, filename): + def _check_against_schema(xml: bytes, filename: str) -> None: regex = re.compile(re.escape(".xml"), re.IGNORECASE) name = regex.sub(".xsd", filename) schema_path = os.path.join(FILEPATH_MANAGER.schema_dir, name) ConfigurationSchemaChecker.check_xml_data_matches_schema(schema_path, xml) - def save_config(self, configuration, is_component): + def save_config(self, configuration: Configuration, is_component: bool) -> None: """Saves the current configuration with the specified name. Args: @@ -211,7 +211,7 @@ def save_config(self, configuration, is_component): meta_xml = ConfigurationXmlConverter.meta_to_xml(configuration.meta) try: components_xml = ConfigurationXmlConverter.components_to_xml(configuration.components) - except: + except Exception: # Is a component, so no components components_xml = ConfigurationXmlConverter.components_to_xml(dict()) @@ -236,14 +236,14 @@ def save_config(self, configuration, is_component): self._write_to_file(current_file, meta_xml) @retry(RETRY_MAX_ATTEMPTS, RETRY_INTERVAL, (OSError, IOError)) - def delete(self, name, is_component): + def delete(self, name: str, is_component: bool) -> None: path = self.get_path(name, is_component) if not os.path.exists(path): print_and_log(f"Directory {path} not found on filesystem.", "MINOR") return shutil.rmtree(path) - def component_exists(self, root_path, name): + def component_exists(self, root_path: str, name: str) -> None: """Checks to see if a component exists. root_path (string): The root folder where components are stored @@ -256,7 +256,7 @@ def component_exists(self, root_path, name): raise Exception("Component does not exist") @staticmethod - def copy_default(dest_path): + def copy_default(dest_path: str) -> None: """Copies the default/base component in if it does exist. Args: @@ -268,7 +268,7 @@ def copy_default(dest_path): ) @staticmethod - def _read_element_tree(file_path): + def _read_element_tree(file_path: str) -> ElementTree.Element: try: return ConfigurationFileManager._attempt_read(file_path) except MaxAttemptsExceededException: @@ -277,7 +277,7 @@ def _read_element_tree(file_path): f"is not in use by another process." ) - def _write_to_file(self, file_path, data): + def _write_to_file(self, file_path: str, data: str) -> None: try: return self._attempt_write(file_path, data) except MaxAttemptsExceededException: @@ -288,7 +288,7 @@ def _write_to_file(self, file_path, data): @staticmethod @retry(RETRY_MAX_ATTEMPTS, RETRY_INTERVAL, (OSError, IOError)) - def _attempt_read(file_path): + def _attempt_read(file_path: str) -> ElementTree.Element: """Read and return the element tree from a given xml file. Args: @@ -298,7 +298,7 @@ def _attempt_read(file_path): @staticmethod @retry(RETRY_MAX_ATTEMPTS, RETRY_INTERVAL, (OSError, IOError)) - def _attempt_write(file_path, data): + def _attempt_write(file_path: str, data: str) -> None: """Write xml data to a given configuration file. Args: @@ -324,7 +324,7 @@ def get_files_in_directory(self, path: str) -> list[str]: return files @staticmethod - def get_path(name, is_component): + def get_path(name: str, is_component: bool) -> str: if is_component: path = FILEPATH_MANAGER.get_component_path(name) else: @@ -333,10 +333,10 @@ def get_path(name, is_component): return path @staticmethod - def get_banner_config(): + def get_banner_config() -> dict: """ - Parses the banner config file into a dictionary of lists of dictionaries containing the items and buttons. - + Parses the banner config file into a dictionary of lists of dictionaries + containing the items and buttons. Returns: Dictionary containing information about banner items and buttons, empty dictionary if it doesn't exist or fails to parse. From e01cebb599895b9192748682a544c03a607cce75 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 15:59:25 +0000 Subject: [PATCH 14/21] Ruff fixes --- BlockServer/core/config_holder.py | 2 +- BlockServer/fileIO/file_manager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index 5ccd5e00..b2b8bb26 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -418,7 +418,7 @@ def _iocs_to_list_with_components(self) -> List: ioc_list.append(ioc.to_dict()) return ioc_list - def _to_dict(self, data_list: List) -> Dict: + def _to_dict(self, data_list: List) -> dict | None: return None if data_list is None else {item["name"]: item for item in data_list} def set_config(self, config: Configuration, is_component: bool = False) -> None: diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index 7bd35193..97f78116 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -335,7 +335,7 @@ def get_path(name: str, is_component: bool) -> str: @staticmethod def get_banner_config() -> dict: """ - Parses the banner config file into a dictionary of lists of dictionaries + Parses the banner config file into a dictionary of lists of dictionaries containing the items and buttons. Returns: Dictionary containing information about banner items and buttons, From 6521e05417117f0e2ceccb35b5c8c42e0651b1f4 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 16:22:02 +0000 Subject: [PATCH 15/21] More Ruff fixes --- BlockServer/config/configuration.py | 4 ++-- BlockServer/core/config_holder.py | 6 +++--- BlockServer/fileIO/file_manager.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index cfd9c668..1b1bd320 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -17,6 +17,8 @@ """Contains all the code for defining a configuration or component""" from collections import OrderedDict +from server_common.helpers import PVPREFIX_MACRO +from server_common.utilities import print_and_log from typing import Dict from BlockServer.config.block import Block @@ -25,8 +27,6 @@ from BlockServer.config.ioc import IOC from BlockServer.config.metadata import MetaData from BlockServer.core.constants import GRP_NONE -from server_common.helpers import PVPREFIX_MACRO -from server_common.utilities import print_and_log class Configuration: diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index b2b8bb26..b49c4fd0 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -19,6 +19,9 @@ import copy import re from collections import OrderedDict +from server_common.file_path_manager import FILEPATH_MANAGER +from server_common.helpers import PVPREFIX_MACRO +from server_common.utilities import print_and_log from typing import Any, Dict, List from BlockServer.config.configuration import Configuration @@ -26,9 +29,6 @@ from BlockServer.config.metadata import MetaData from BlockServer.core.constants import DEFAULT_COMPONENT, GRP_NONE from BlockServer.fileIO.file_manager import ConfigurationFileManager -from server_common.file_path_manager import FILEPATH_MANAGER -from server_common.helpers import PVPREFIX_MACRO -from server_common.utilities import print_and_log class ConfigHolder: diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index 97f78116..843e817b 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -17,6 +17,9 @@ import re import shutil from collections import OrderedDict +from server_common.common_exceptions import MaxAttemptsExceededException +from server_common.file_path_manager import FILEPATH_MANAGER +from server_common.utilities import print_and_log, retry from xml.etree import ElementTree from BlockServer.config.configuration import Configuration, MetaData @@ -39,9 +42,6 @@ ConfigurationIncompleteException, ConfigurationSchemaChecker, ) -from server_common.common_exceptions import MaxAttemptsExceededException -from server_common.file_path_manager import FILEPATH_MANAGER -from server_common.utilities import print_and_log, retry RETRY_MAX_ATTEMPTS = 20 RETRY_INTERVAL = 0.5 From 7d6e2af740b76b1aef38d2ed901681d7e357c434 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Tue, 18 Nov 2025 16:27:10 +0000 Subject: [PATCH 16/21] More Ruff fixes --- BlockServer/config/configuration.py | 4 ++-- BlockServer/core/config_holder.py | 6 +++--- BlockServer/fileIO/file_manager.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index 1b1bd320..cfd9c668 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -17,8 +17,6 @@ """Contains all the code for defining a configuration or component""" from collections import OrderedDict -from server_common.helpers import PVPREFIX_MACRO -from server_common.utilities import print_and_log from typing import Dict from BlockServer.config.block import Block @@ -27,6 +25,8 @@ from BlockServer.config.ioc import IOC from BlockServer.config.metadata import MetaData from BlockServer.core.constants import GRP_NONE +from server_common.helpers import PVPREFIX_MACRO +from server_common.utilities import print_and_log class Configuration: diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index b49c4fd0..b2b8bb26 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -19,9 +19,6 @@ import copy import re from collections import OrderedDict -from server_common.file_path_manager import FILEPATH_MANAGER -from server_common.helpers import PVPREFIX_MACRO -from server_common.utilities import print_and_log from typing import Any, Dict, List from BlockServer.config.configuration import Configuration @@ -29,6 +26,9 @@ from BlockServer.config.metadata import MetaData from BlockServer.core.constants import DEFAULT_COMPONENT, GRP_NONE from BlockServer.fileIO.file_manager import ConfigurationFileManager +from server_common.file_path_manager import FILEPATH_MANAGER +from server_common.helpers import PVPREFIX_MACRO +from server_common.utilities import print_and_log class ConfigHolder: diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index 843e817b..97f78116 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -17,9 +17,6 @@ import re import shutil from collections import OrderedDict -from server_common.common_exceptions import MaxAttemptsExceededException -from server_common.file_path_manager import FILEPATH_MANAGER -from server_common.utilities import print_and_log, retry from xml.etree import ElementTree from BlockServer.config.configuration import Configuration, MetaData @@ -42,6 +39,9 @@ ConfigurationIncompleteException, ConfigurationSchemaChecker, ) +from server_common.common_exceptions import MaxAttemptsExceededException +from server_common.file_path_manager import FILEPATH_MANAGER +from server_common.utilities import print_and_log, retry RETRY_MAX_ATTEMPTS = 20 RETRY_INTERVAL = 0.5 From 6e3aa66a793f9774cdbb17d82caa0f109ececdc9 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Wed, 19 Nov 2025 10:31:15 +0000 Subject: [PATCH 17/21] More Ruff fixes --- BlockServer/config/configuration.py | 2 +- BlockServer/core/config_holder.py | 2 +- BlockServer/fileIO/file_manager.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index cfd9c668..157e42f7 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -15,7 +15,7 @@ # http://opensource.org/licenses/eclipse-1.0.php """Contains all the code for defining a configuration or component""" - +# noqa: I001 from collections import OrderedDict from typing import Dict diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index b2b8bb26..ed46f632 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -15,7 +15,7 @@ # http://opensource.org/licenses/eclipse-1.0.php """Contains the code for the ConfigHolder class""" - +# noqa: I001 import copy import re from collections import OrderedDict diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index 97f78116..958a5f9a 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -13,6 +13,7 @@ # along with this program; if not, you can obtain a copy from # https://www.eclipse.org/org/documents/epl-v10.php or # http://opensource.org/licenses/eclipse-1.0.php +# noqa: I001 import os import re import shutil From 7b09e37f56fa4d3b2af3f80e802d494b58c62d34 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Wed, 19 Nov 2025 10:41:17 +0000 Subject: [PATCH 18/21] More Ruff fixes --- BlockServer/config/configuration.py | 2 +- BlockServer/core/config_holder.py | 2 +- BlockServer/fileIO/file_manager.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index 157e42f7..b42b9a5e 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -15,7 +15,7 @@ # http://opensource.org/licenses/eclipse-1.0.php """Contains all the code for defining a configuration or component""" -# noqa: I001 +#noqa: I001 from collections import OrderedDict from typing import Dict diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index ed46f632..8cc37c37 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -15,7 +15,7 @@ # http://opensource.org/licenses/eclipse-1.0.php """Contains the code for the ConfigHolder class""" -# noqa: I001 +#noqa: I001 import copy import re from collections import OrderedDict diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index 958a5f9a..338f3f63 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -13,7 +13,7 @@ # along with this program; if not, you can obtain a copy from # https://www.eclipse.org/org/documents/epl-v10.php or # http://opensource.org/licenses/eclipse-1.0.php -# noqa: I001 +#noqa: I001 import os import re import shutil From cd5551db076ce8c6ee8c763694a10eb2fa37e7bd Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Wed, 19 Nov 2025 10:51:21 +0000 Subject: [PATCH 19/21] More Ruff fixes --- BlockServer/fileIO/file_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BlockServer/fileIO/file_manager.py b/BlockServer/fileIO/file_manager.py index 338f3f63..705ba8c7 100644 --- a/BlockServer/fileIO/file_manager.py +++ b/BlockServer/fileIO/file_manager.py @@ -13,7 +13,7 @@ # along with this program; if not, you can obtain a copy from # https://www.eclipse.org/org/documents/epl-v10.php or # http://opensource.org/licenses/eclipse-1.0.php -#noqa: I001 +# ruff: noqa: I001 import os import re import shutil From 4d471c71542b492caf7139aba39b42078b437f5a Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Wed, 19 Nov 2025 10:53:30 +0000 Subject: [PATCH 20/21] More Ruff fixes --- BlockServer/config/configuration.py | 2 +- BlockServer/core/config_holder.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index b42b9a5e..569aae54 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -15,7 +15,7 @@ # http://opensource.org/licenses/eclipse-1.0.php """Contains all the code for defining a configuration or component""" -#noqa: I001 +# ruff: noqa: I001 from collections import OrderedDict from typing import Dict diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index 8cc37c37..9a1a6487 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -15,7 +15,7 @@ # http://opensource.org/licenses/eclipse-1.0.php """Contains the code for the ConfigHolder class""" -#noqa: I001 +# ruff: noqa: I001 import copy import re from collections import OrderedDict From 06ce22e764db146e76b052bf5d07893f5e903b0c Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Wed, 19 Nov 2025 11:04:29 +0000 Subject: [PATCH 21/21] More Ruff fixes --- BlockServer/config/configuration.py | 1 + BlockServer/core/config_holder.py | 1 + 2 files changed, 2 insertions(+) diff --git a/BlockServer/config/configuration.py b/BlockServer/config/configuration.py index 569aae54..24c57188 100644 --- a/BlockServer/config/configuration.py +++ b/BlockServer/config/configuration.py @@ -15,6 +15,7 @@ # http://opensource.org/licenses/eclipse-1.0.php """Contains all the code for defining a configuration or component""" + # ruff: noqa: I001 from collections import OrderedDict from typing import Dict diff --git a/BlockServer/core/config_holder.py b/BlockServer/core/config_holder.py index 9a1a6487..ac34356f 100644 --- a/BlockServer/core/config_holder.py +++ b/BlockServer/core/config_holder.py @@ -15,6 +15,7 @@ # http://opensource.org/licenses/eclipse-1.0.php """Contains the code for the ConfigHolder class""" + # ruff: noqa: I001 import copy import re