From 3814d6add17bdf0c5318f764e02dec70671a6e66 Mon Sep 17 00:00:00 2001 From: Justin Austin Date: Sun, 7 Jun 2020 12:00:44 -0400 Subject: [PATCH] Move FieldOverrides creation outside of _user_overrides_or_exts (#225) * add lru_cache to useroverrides function * remove lru_cache due to hashing issue, move namedtuple creation to outside of function Co-authored-by: Justin Austin --- dataclasses_json/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dataclasses_json/core.py b/dataclasses_json/core.py index 94037d22..38d190f8 100644 --- a/dataclasses_json/core.py +++ b/dataclasses_json/core.py @@ -25,6 +25,9 @@ Json = Union[dict, list, str, int, float, bool, None] +confs = ['encoder', 'decoder', 'mm_field', 'letter_case', 'exclude'] +FieldOverride = namedtuple('FieldOverride', confs) + class _ExtendedEncoder(json.JSONEncoder): def default(self, o) -> Json: @@ -48,9 +51,6 @@ def default(self, o) -> Json: def _user_overrides_or_exts(cls): - confs = ['encoder', 'decoder', 'mm_field', 'letter_case', 'exclude'] - FieldOverride = namedtuple('FieldOverride', confs) - global_metadata = defaultdict(dict) encoders = cfg.global_config.encoders decoders = cfg.global_config.decoders