|
None | __init__ (self, Dict flags_dict, Set checked_elements) |
|
None | replace_references (self, GroupingElement element) |
|
None | generate (self, int x_pos=1, structure_dict=None) |
|
List[Element] | group_elements (self, List[Element] structure_list, int x_pos) |
|
List[Element] | get_list (self) |
|
None | filter_by_text (self, str filter_text) |
|
None | sort (self) |
|
Dict | generate_structure_dict (self) |
|
None | generate_for_element (self, GroupingElement grouping_element, Dict structure) |
|
None | add_to_checked (self, Element element) |
|
None | remove_from_checked (self, Element element) |
|
Definition at line 101 of file structure.py.
◆ __init__()
None python.iconfTool.models.structure.ComponentsStructure.__init__ |
( |
|
self, |
|
|
Dict |
flags_dict, |
|
|
Set |
checked_elements |
|
) |
| |
Definition at line 102 of file structure.py.
102 def __init__(self, flags_dict: Dict, checked_elements: Set) ->
None:
103 super().
__init__(flags_dict, checked_elements)
104 self.roots_dict: Dict = {}
105 self.structure_list: List[Element] = []
106 self.filter: ComponentsStructureFilter
◆ add_to_checked()
None python.iconfTool.models.structure.Structure.add_to_checked |
( |
|
self, |
|
|
Element |
element |
|
) |
| |
|
inherited |
Definition at line 91 of file structure.py.
91 def add_to_checked(self, element: Element) ->
None:
92 hash_value = element.hash
93 self.checked_elements.
add(hash_value)
◆ filter_by_text()
None python.iconfTool.models.structure.ComponentsStructure.filter_by_text |
( |
|
self, |
|
|
str |
filter_text |
|
) |
| |
Definition at line 183 of file structure.py.
183 def filter_by_text(self, filter_text: str) ->
None:
184 self.filter.generate_by_text(filter_text)
185 for element
in self.structure_list:
186 assert isinstance(element, GroupingElement)
187 element.children =
list(
189 lambda child: child.get_reference_name()
190 in self.filter.comps_to_save
191 or child
not in self.roots_dict,
◆ generate()
None python.iconfTool.models.structure.ComponentsStructure.generate |
( |
|
self, |
|
|
int |
x_pos = 1 , |
|
|
|
structure_dict = None |
|
) |
| |
Definition at line 121 of file structure.py.
121 def generate(self, x_pos: int = 1, structure_dict=
None) ->
None:
123 self.structure_dict = structure_dict
or self.generate_structure_dict()
124 for root_name
in self.structure_dict:
125 if isinstance(self.structure_dict[root_name], dict):
126 root_group = GroupingElement(root_name, x_pos)
127 if root_group.hash
in self.checked_elements:
128 root_group.set_as_checked()
129 self.generate_for_element(
130 root_group, self.structure_dict[root_name]
132 self.structure_list.
append(root_group)
133 self.roots_dict[root_name] = root_group
135 self.structure_list = self.group_elements(
136 self.structure_list, x_pos - 1
140 self.filter = ComponentsStructureFilter(self.structure_dict)
◆ generate_for_element()
None python.iconfTool.models.structure.Structure.generate_for_element |
( |
|
self, |
|
|
GroupingElement |
grouping_element, |
|
|
Dict
|
structure |
|
) |
| |
|
inherited |
Definition at line 56 of file structure.py.
56 def generate_for_element(
57 self, grouping_element: GroupingElement, structure: Dict
59 child_x_pos = grouping_element.x_pos + INDENT
60 for child
in structure:
63 structure[child] = ast.literal_eval(structure[child])
64 except (ValueError, SyntaxError):
67 if isinstance(structure[child], dict):
68 group = GroupingElement(child, child_x_pos, grouping_element)
69 if group.hash
in self.checked_elements:
70 group.set_as_checked()
71 self.generate_for_element(group, structure[child])
72 grouping_element.add_child(group)
73 elif isinstance(structure[child], list):
74 group = GroupingElement(child, child_x_pos, grouping_element)
75 if group.hash
in self.checked_elements:
76 group.set_as_checked()
77 for el
in structure[child]:
78 no_value_child = SingleElement(el, child_x_pos + INDENT)
79 if no_value_child.hash
in self.checked_elements:
80 no_value_child.set_as_checked()
81 group.add_child(no_value_child)
82 grouping_element.add_child(group)
85 child, child_x_pos, structure[child], grouping_element
87 if flag.hash
in self.checked_elements:
89 grouping_element.add_child(flag)
◆ generate_structure_dict()
Dict python.iconfTool.models.structure.Structure.generate_structure_dict |
( |
|
self | ) |
|
|
inherited |
Split dictionary keys into nested structure
e.g. Test1.Test2: Value -> Test1: {Test2: Value}
Definition at line 27 of file structure.py.
27 def generate_structure_dict(self) -> Dict:
28 """Split dictionary keys into nested structure
29 e.g. Test1.Test2: Value -> Test1: {Test2: Value}
31 structure_dict: Dict = {}
33 for flag, value
in self.flags_dict.
items():
34 groups = flag.split(
".")
35 structure_point = structure_dict
36 for i
in range(len(groups) - 1):
37 if groups[i]
not in structure_point:
38 structure_point[groups[i]] = {}
39 elif isinstance(structure_point[groups[i]], str):
40 structure_point[groups[i]] = {
41 structure_point[groups[i]]: {}
43 structure_point = structure_point[groups[i]]
47 last
in structure_point
48 and isinstance(structure_point[last], dict)
49 and isinstance(value, dict)
51 structure_point[last].
update(value)
53 structure_point[last] = value
◆ get_list()
List[Element] python.iconfTool.models.structure.ComponentsStructure.get_list |
( |
|
self | ) |
|
Definition at line 179 of file structure.py.
179 def get_list(self) -> List[Element]:
181 return self.structure_list
◆ group_elements()
List[Element] python.iconfTool.models.structure.ComponentsStructure.group_elements |
( |
|
self, |
|
|
List[Element] |
structure_list, |
|
|
int
|
x_pos |
|
) |
| |
Definition at line 142 of file structure.py.
143 self, structure_list: List[Element], x_pos: int
146 algs = GroupingElement(
"Algorithms and Sequences", x_pos)
147 tools = GroupingElement(
"Public tools", x_pos)
148 settings = GroupingElement(
"Application Settings and Services", x_pos)
150 new_structure_list: List[Element] = [algs, tools, settings]
154 def get_ath_sequences(el) -> None:
155 if isinstance(el, GroupingElement):
156 members_obj = el.get_child_by_name(
"Members")
158 assert isinstance(members_obj, GroupingElement)
159 for member
in members_obj.children:
160 ref_name = member.get_reference_name()
161 seq_names.append(ref_name)
162 get_ath_sequences(self.roots_dict.
get(ref_name))
164 seq_names.append(
"AthMasterSeq")
165 get_ath_sequences(self.roots_dict[
"AthMasterSeq"])
167 for el
in structure_list:
168 if el.name ==
"AthMasterSeq":
174 elif el.name
not in seq_names:
175 settings.add_child(el)
177 return new_structure_list
◆ remove_from_checked()
None python.iconfTool.models.structure.Structure.remove_from_checked |
( |
|
self, |
|
|
Element |
element |
|
) |
| |
|
inherited |
Definition at line 95 of file structure.py.
95 def remove_from_checked(self, element: Element) ->
None:
96 hash_value = element.hash
97 if hash_value
in self.checked_elements:
98 self.checked_elements.
remove(hash_value)
◆ replace_references()
None python.iconfTool.models.structure.ComponentsStructure.replace_references |
( |
|
self, |
|
|
GroupingElement |
element |
|
) |
| |
Definition at line 108 of file structure.py.
108 def replace_references(self, element: GroupingElement) ->
None:
109 element.replaced =
True
110 for i, child
in enumerate(element.children):
111 if isinstance(child, SingleElement):
112 ref_name = child.get_reference_name()
113 if ref_name
in self.roots_dict
and not element.has_parent(
114 self.roots_dict[ref_name].get_name()
116 element.children[i] = self.roots_dict[ref_name]
118 element.children[i].parent = element
119 element.update_xpos(element.x_pos)
◆ sort()
None python.iconfTool.models.structure.ComponentsStructure.sort |
( |
|
self | ) |
|
Definition at line 196 of file structure.py.
196 def sort(self) -> None:
197 self.structure_list.sort(key=
lambda el: el.get_name().lower())
198 for element
in self.structure_list:
199 element.sort_children()
◆ filter
python.iconfTool.models.structure.ComponentsStructure.filter |
◆ structure_dict
python.iconfTool.models.structure.ComponentsStructure.structure_dict |
◆ structure_list
python.iconfTool.models.structure.ComponentsStructure.structure_list |
The documentation for this class was generated from the following file:
def generate(process_dir='PROC_mssm_0', grid_pack=False, gridpack_compile=False, extlhapath=None, required_accuracy=0.01, runArgs=None, bias_module=None, requirePMGSettings=False)
constexpr std::enable_if_t< is_bitmask_v< E >, E & > reset(E &lhs, E rhs)
Convenience function to clear bits in a class enum bitmask.