Added automatic benedict casting to methods that return dict instances.

This commit is contained in:
Fabio Caccamo 2020-09-19 14:40:17 +02:00
parent 60d0502466
commit 7e7541cce5
1 changed files with 8 additions and 0 deletions

View File

@ -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.