|
|
@ -74,6 +74,27 @@ class NagObject:
|
|
|
|
wrap(dir[1], ws_base).strip().strip('\\\n').strip())
|
|
|
|
wrap(dir[1], ws_base).strip().strip('\\\n').strip())
|
|
|
|
return string + '}\n'
|
|
|
|
return string + '}\n'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def from_object(self, object: dict) -> None:
|
|
|
|
|
|
|
|
self.m_type.value = object['type']
|
|
|
|
|
|
|
|
self.m_config_file = object['config_file']
|
|
|
|
|
|
|
|
self.m_directives = object['directives']
|
|
|
|
|
|
|
|
self.m_line_no = object['line_number']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def to_object(self) -> dict:
|
|
|
|
|
|
|
|
object = {
|
|
|
|
|
|
|
|
'type': self.m_type.value,
|
|
|
|
|
|
|
|
'config_file': self.m_config_file,
|
|
|
|
|
|
|
|
'directives': self.m_directives,
|
|
|
|
|
|
|
|
'line_number': self.m_line_no
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return object
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def from_json(self, string: str) -> None:
|
|
|
|
|
|
|
|
self.from_object(json.loads(string))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def to_json(self) -> str:
|
|
|
|
|
|
|
|
return json.dumps(self.to_object)
|
|
|
|
|
|
|
|
|
|
|
|
def get_type(self) -> NagObjectType:
|
|
|
|
def get_type(self) -> NagObjectType:
|
|
|
|
return self.m_type
|
|
|
|
return self.m_type
|
|
|
|
|
|
|
|
|
|
|
|