From f8b19017cea3d97551241b618353813dae1977f3 Mon Sep 17 00:00:00 2001 From: Fabio Caccamo Date: Mon, 10 Jun 2019 17:18:06 +0200 Subject: [PATCH] Fixed casting to benedict to all dicts returned by any public method on Python 2.7. --- benedict/dicts/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/benedict/dicts/__init__.py b/benedict/dicts/__init__.py index 57cbee6..31b9b63 100644 --- a/benedict/dicts/__init__.py +++ b/benedict/dicts/__init__.py @@ -14,13 +14,13 @@ class benedict(KeypathDict, ParseDict): def __getattribute__(self, name): attr = super(benedict, self).__getattribute__(name) - if hasattr(attr, '__call__'): + if name.startswith('_'): + return attr + elif hasattr(attr, '__call__'): + # print(attr, name) def attr_wrapper(*args, **kwargs): value = attr(*args, **kwargs) - if name.startswith('_'): - return value - else: - return benedict._cast(value) + return benedict._cast(value) return attr_wrapper else: return attr