From 49b6a4550210f297c2d8f5992a31c854f3bbbbc3 Mon Sep 17 00:00:00 2001 From: Yun Zheng Hu Date: Thu, 9 Jun 2022 14:38:06 +0200 Subject: [PATCH] Ensure that keys are sorted in the returned `_to_feed()` dictionary This allows for better deterministic feed output generation. --- pymisp/abstract.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymisp/abstract.py b/pymisp/abstract.py index f6b5d66..523433a 100644 --- a/pymisp/abstract.py +++ b/pymisp/abstract.py @@ -231,7 +231,7 @@ class AbstractMISP(MutableMapping, MISPFileCache, metaclass=ABCMeta): if hasattr(self, '_set_default') and callable(self._set_default): # type: ignore self._set_default() # type: ignore to_return = {} - for field in self._fields_for_feed: + for field in sorted(self._fields_for_feed): if getattr(self, field, None) is not None: if field in ['timestamp', 'publish_timestamp']: to_return[field] = self._datetime_to_timestamp(getattr(self, field))