Skip to content
Snippets Groups Projects
Commit 0ac94137 authored by Andre Gunther's avatar Andre Gunther :island:
Browse files

Add filter_lines functionality to config module

parent e3f63a56
No related branches found
No related tags found
2 merge requests!4232Run5: rebase, restructure run5 code, add back examples,!2994HLT2 settings for 2024
......@@ -608,3 +608,22 @@ def dummy_function_for_line_imports():
c_line = SpruceLine(name="UnusedHltLine")
return (b_line, c_line)
def filter_lines(lines_dict: dict[str, Hlt2Line],
pattern_to_remove: str) -> dict[str, Hlt2Line]:
"""Remove lines using regular expression.
Args:
lines_dict (dict[str, Hlt2Line]): Line dictionary to filter.
pattern_to_remove (str): Name pattern to search for using regex.
Returns:
dict[str, Hlt2Line]: Filtered line dictionary.
"""
filtered = {
name: line
for name, line in lines_dict.items()
if re.search(pattern_to_remove, name) is None
}
return filtered
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment