new: Add AbstractMISP._remove_from_not_jsonable

pull/595/head
louis 2020-06-29 18:30:00 +02:00
parent f176fb0884
commit 0bbfac6143
1 changed files with 8 additions and 0 deletions

View File

@ -170,6 +170,14 @@ class AbstractMISP(MutableMapping, MISPFileCache, metaclass=ABCMeta):
"""Set __not_jsonable to a new list"""
self.__not_jsonable = args
def _remove_from_not_jsonable(self, *args) -> None:
"""Remove the entries that are in the __not_jsonable list"""
for entry in args:
try:
self.__not_jsonable.remove(entry)
except ValueError:
pass
def from_json(self, json_string: str) -> None:
"""Load a JSON string"""
self.from_dict(**loads(json_string))