tr11 / python-configuration

A Python library to load configuration parameters

Home Page:https://tr11.github.io/python-configuration/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: add flat keyword to as_dict()

programus opened this issue · comments

{
    'a': {
        'b': 'value'
    }
}

create a config from this and while I use as_dict(), it becomes

{
  'a.b': 'value'
}

I hope this could be possible:

cfg.as_dict() == {'a.b': 'value'}
cfg.as_dict(flat=True) == {'a.b': 'value'}
cfg.as_dict(flat=False) == {'a': {'b': 'value'}}

Sorry, I didn't notice that there is an as_attrdict() which do exactly what I want. Close this.