| Total Complexity | 2 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | # Copyright 2022, Red Hat, Inc. |
||
| 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
||
| 3 | |||
| 4 | 1 | from ..data_structures import OvalState |
|
| 5 | 1 | from .oval_endpoint_information_parser import OVALEndpointInformation |
|
| 6 | 1 | from .shared_static_methods_of_parser import SharedStaticMethodsOfParser |
|
| 7 | |||
| 8 | |||
| 9 | 1 | class OVALStateParser(OVALEndpointInformation): |
|
| 10 | 1 | def __init__(self, states): |
|
| 11 | 1 | self.states = states |
|
| 12 | |||
| 13 | 1 | def get_state(self, state_id): |
|
| 14 | 1 | xml_state = self.states[state_id] |
|
| 15 | 1 | state_dict = { |
|
| 16 | "state_id": xml_state.attrib.get("id"), |
||
| 17 | "comment": xml_state.attrib.get("comment", ""), |
||
| 18 | "state_type": SharedStaticMethodsOfParser.get_key_of_xml_element(xml_state), |
||
| 19 | "state_data": self._get_items(xml_state), |
||
| 20 | } |
||
| 21 | return OvalState(**state_dict) |
||
| 22 |