From e2e9a02f9c98768b3b7c609afc8d40928e5ded01 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Mon, 18 Aug 2025 12:00:36 +0100 Subject: [PATCH 1/4] Added schema changes for configuring alarms --- src/server_common/schema/blocks.xsd | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/server_common/schema/blocks.xsd b/src/server_common/schema/blocks.xsd index fea0e51..86f1f92 100644 --- a/src/server_common/schema/blocks.xsd +++ b/src/server_common/schema/blocks.xsd @@ -26,6 +26,13 @@ + + + + + + + @@ -42,4 +49,10 @@ + + + + + + From d9cb590958556da5da1ce01aaaf3073e0620b256 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Mon, 8 Sep 2025 15:48:50 +0100 Subject: [PATCH 2/4] Ticket8780: Added methdo to dehexed PV value --- src/server_common/utilities.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/server_common/utilities.py b/src/server_common/utilities.py index d31d3ab..dcb98dd 100644 --- a/src/server_common/utilities.py +++ b/src/server_common/utilities.py @@ -371,3 +371,14 @@ def parse_date_time_arg_exit_on_fail(date_arg, error_code=1): except (ValueError, TypeError) as ex: print(f"Can not interpret date '{date_arg}' error: {ex}") exit(error_code) + +def dehex_and_decompress_waveform_value(value): + """Decompresses the inputted waveform, assuming it is available as string. + + Args: + value (str): The string to be decompressed + + Returns: + str : A decompressed and unhexed version of the input string + """ + return zlib.decompress(binascii.unhexlify(value)) From 54f7e2a3b8fa37345781780e883fcfd0f2487ec0 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Thu, 11 Sep 2025 11:20:08 +0100 Subject: [PATCH 3/4] Modified the XSD --- src/server_common/schema/blocks.xsd | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/server_common/schema/blocks.xsd b/src/server_common/schema/blocks.xsd index 86f1f92..6b8f7d0 100644 --- a/src/server_common/schema/blocks.xsd +++ b/src/server_common/schema/blocks.xsd @@ -28,8 +28,6 @@ - - @@ -51,8 +49,6 @@ - - From 118dcd02f6a717251dc02db9242c089c3ce89214 Mon Sep 17 00:00:00 2001 From: Chsudeepta Date: Thu, 20 Nov 2025 15:44:57 +0000 Subject: [PATCH 4/4] Fixes ruff stuffs --- src/server_common/utilities.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/server_common/utilities.py b/src/server_common/utilities.py index dcb98dd..98d72e8 100644 --- a/src/server_common/utilities.py +++ b/src/server_common/utilities.py @@ -29,6 +29,7 @@ from server_common.common_exceptions import MaxAttemptsExceededException from server_common.loggers.logger import Logger +# ruff: noqa: ANN001, ANN201, ANN002, ANN003, ANN202, E721 # Default to base class - does not actually log anything LOGGER = Logger() _LOGGER_LOCK = threading.RLock() # To prevent message interleaving between different threads. @@ -72,8 +73,8 @@ def print_and_log(message, severity=SEVERITY.INFO, src="BLOCKSVR"): Args: message (string|exception): The message to log - severity (string, optional): Gives the severity of the message. Expected serverities are MAJOR, MINOR and INFO. - Default severity is INFO. + severity (string, optional): Gives the severity of the message. Expected serverities are + MAJOR, MINOR and INFO. Default severity is INFO. src (string, optional): Gives the source of the message. Default source is BLOCKSVR. """ with _LOGGER_LOCK: @@ -115,7 +116,8 @@ def dehex_and_decompress(value): def dehex_and_decompress_waveform(value): - """Decompresses the inputted waveform, assuming it is a array of integers representing characters (null terminated). + """Decompresses the inputted waveform, assuming it is a array of integers + representing characters (null terminated). Args: value (list[int]): The string to be decompressed @@ -181,11 +183,11 @@ def value_list_to_xml(value_list, grp, group_tag, item_tag): """Converts a list of values to corresponding xml. Args: - value_list (dist[str, dict[object, object]]): The dictionary of names and their values, values are in turn a - dictonary of names and value {name: {parameter : value, parameter : value}} + value_list (dist[str, dict[object, object]]): The dictionary of names and their values, + values are in turn a dictonary of names and value {name:{parameter:value,parameter:value}} grp (ElementTree.SubElement): The SubElement object to append the list on to - group_tag (string): The tag that corresponds to the group for the items given in the list e.g. macros - item_tag (string): The tag that corresponds to each item in the list e.g. macro + group_tag (string): The tag that corresponds to the group for the items given in the list + e.g. macros item_tag (string): The tag that corresponds to each item in the list e.g. macro """ xml_list = ElementTree.SubElement(grp, group_tag) if len(value_list) > 0: @@ -218,7 +220,7 @@ def create_pv_name(name, current_pvs, default_pv, limit=6, allow_colon=False): current_pvs (list): List of already allocated pvs default_pv (string): Basis for the PV if name is unreasonable, must be a valid PV name limit (integer): Character limit for the PV - allow_colon (bool): If True, pv name is allowed to contain colons; if False, remove the colons + allow_colon (bool): If True,pv name is allowed to contain colons;if False,remove the colons Returns: string : A valid PV @@ -344,7 +346,8 @@ def remove_from_end(string, text_to_remove): def lowercase_and_make_unique(in_list): """ - Takes a collection of strings, and returns it with all strings lowercased and with duplicates removed. + Takes a collection of strings, and returns it with all strings lowercased and with duplicates + removed. Args: in_list (List[str]): the collection of strings to operate on @@ -372,6 +375,7 @@ def parse_date_time_arg_exit_on_fail(date_arg, error_code=1): print(f"Can not interpret date '{date_arg}' error: {ex}") exit(error_code) + def dehex_and_decompress_waveform_value(value): """Decompresses the inputted waveform, assuming it is available as string.