From 39a0c2a625d8f2870cb007fa339a71e989c3576a Mon Sep 17 00:00:00 2001 From: dtrai2 Date: Tue, 5 Nov 2024 13:12:58 +0100 Subject: [PATCH] fix f-string for python 3.10 --- logprep/processor/generic_resolver/rule.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/logprep/processor/generic_resolver/rule.py b/logprep/processor/generic_resolver/rule.py index 06d18e7af..e2ab14c44 100644 --- a/logprep/processor/generic_resolver/rule.py +++ b/logprep/processor/generic_resolver/rule.py @@ -128,20 +128,21 @@ class Config(FieldManagerRule.Config): def __attrs_post_init__(self): if self.resolve_from_file: + file_path = self.resolve_from_file["path"] if "?P" not in self.resolve_from_file["pattern"]: raise InvalidConfigurationError( f"Mapping group is missing in mapping file pattern! (Rule ID: '{self.id}')" ) - if not Path(self.resolve_from_file["path"]).is_file(): + if not Path(file_path).is_file(): raise InvalidConfigurationError( - f"Additions file '{self.resolve_from_file["path"]}' not found! (Rule ID: '{self.id}')", + f"Additions file '{file_path}' not found! (Rule ID: '{self.id}')", ) - add_dict = GetterFactory.from_string(self.resolve_from_file["path"]).get_yaml() + add_dict = GetterFactory.from_string(file_path).get_yaml() if not isinstance(add_dict, dict) or not all( isinstance(value, str) for value in add_dict.values() ): raise InvalidConfigurationError( - f"Additions file '{self.resolve_from_file["path"]}' must be a dictionary with string values! (Rule ID: '{self.id}')", + f"Additions file '{file_path}' must be a dictionary with string values! (Rule ID: '{self.id}')", ) self.resolve_from_file["additions"] = add_dict