From c3dd1f5efc12dc91135c116f527fd3957acb88e4 Mon Sep 17 00:00:00 2001 From: ahmedk <karim.ahmed@xfel.eu> Date: Wed, 27 Nov 2024 15:13:18 +0100 Subject: [PATCH] rebase onto master --- src/cal_tools/constants.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/cal_tools/constants.py b/src/cal_tools/constants.py index 2df93dbcd..98bc70a15 100644 --- a/src/cal_tools/constants.py +++ b/src/cal_tools/constants.py @@ -1,10 +1,13 @@ import binascii import time +from dataclasses import asdict, dataclass + +from datetime import datetime, timezone from hashlib import md5 from pathlib import Path from shutil import copyfile from struct import pack, unpack -from typing import List, Union +from typing import List, Tuple, Union import h5py import numpy as np @@ -13,9 +16,9 @@ from cal_tools.calcat_interface2 import ( CalCatAPIError, get_default_caldb_root, ) -from dataclasses import asdict, dataclass -from typing import List, Tuple, Union -from datetime import datetime, timezone + +CONDITION_NAME_MAX_LENGTH = 60 + @dataclass class ParameterConditionAttribute: @@ -26,11 +29,6 @@ class ParameterConditionAttribute: flg_available: str = 'true' description: str = '' - def validate(self): - if not self.parameter_id: - raise ValueError(f"The parameter_id for '{self.parameter_name}' is not set.") - - def generate_unique_cond_name(detector_type, pdu_name, pdu_uuid, cond_params): # Generate condition name. @@ -53,9 +51,8 @@ def create_unique_cc_name(det_type, calibration, condition_name): detector type, and calibration name. """ cc_name_1 = f'{det_type}_{calibration}' - return f'{cc_name_1[:40]}_{condition_name}' # I guess there is a limit to the name characters? - -CONDITION_NAME_MAX_LENGTH = 60 + # I guess there is a limit to the name characters? + return f'{cc_name_1[:40]}_{condition_name}' class InjectAPIError(CalCatAPIError): -- GitLab