From 6ca2f718dad142e8a49757a8408e90dcdc396145 Mon Sep 17 00:00:00 2001 From: nsheff Date: Thu, 18 May 2023 07:57:59 -0400 Subject: [PATCH] skip attrs for built-in types --- attmap/attmap.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/attmap/attmap.py b/attmap/attmap.py index 2442b12..0340ca0 100644 --- a/attmap/attmap.py +++ b/attmap/attmap.py @@ -111,21 +111,21 @@ def _metamorph_maplike(self, m): ) to_return = self._lower_type_bound(m.items()) - # Don't forget any attributes included in this item - for attr in dir(m): - if attr in m.items(): - continue - if attr[:1] == "_": - continue - to_return.__setattr__(attr, m.__getattribute__(attr)) + # Don't forget any attributes included in this item, for non-builtin items + if ( + m.__class__.__module__ != "builtins" + and m.__class__.__module__ != "collections" + ): + print(f"Class:{m.__class__.__module__}") + for attr in dir(m): + if attr in m.items(): + continue + if attr[:1] == "_": + continue + to_return.__setattr__(attr, m.__getattribute__(attr)) return to_return - - - - - def _new_empty_basic_map(self): """Return the empty collection builder for Mapping type simplification.""" return dict()