From 7e7541cce5051b9c54edbddbf0ee0f02f5513a5a Mon Sep 17 00:00:00 2001 From: Fabio Caccamo Date: Sat, 19 Sep 2020 14:40:17 +0200 Subject: [PATCH] Added automatic benedict casting to methods that return dict instances. --- benedict/dicts/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/benedict/dicts/__init__.py b/benedict/dicts/__init__.py index 4f47749..4c64028 100644 --- a/benedict/dicts/__init__.py +++ b/benedict/dicts/__init__.py @@ -116,6 +116,14 @@ class benedict(KeypathDict, IODict, ParseDict): return self._cast( super(benedict, self).get(key, default)) + def get_dict(self, key, default=None): + return self._cast( + super(benedict, self).get_dict(key, default)) + + def get_list_item(self, key, index=0, default=None, separator=','): + return self._cast( + super(benedict, self).get_list_item(key, index, default, separator)) + def groupby(self, key, by_key): """ Group a list of dicts at key by the value of the given by_key and return a new dict.