diff options
Diffstat (limited to 'cnucnu/config.py')
-rwxr-xr-x | cnucnu/config.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/cnucnu/config.py b/cnucnu/config.py index 13910d0..af497df 100755 --- a/cnucnu/config.py +++ b/cnucnu/config.py @@ -1,6 +1,6 @@ #!/usr/bin/python # vim: fileencoding=utf8 foldmethod=marker -#{{{ License header: GPLv2+ +# {{{ License header: GPLv2+ # This file is part of cnucnu. # # Cnucnu is free software: you can redistribute it and/or modify @@ -15,7 +15,12 @@ # # You should have received a copy of the GNU General Public License # along with cnucnu. If not, see <http://www.gnu.org/licenses/>. -#}}} +# }}} +""" :author: Till Maas + :contact: opensource@till.name + :license: GPLv2+ +""" +__docformat__ = "restructuredtext" from helper import pprint, filter_dict import yaml @@ -64,6 +69,8 @@ package list: """ class Config(object): + """ Config management class for cnucnu. + """ def __init__(self, yaml_file=None, yaml=None, yaml_data=None, config=None, load_default=True): # TODO: remove yaml option if yaml_data: @@ -102,6 +109,15 @@ class Config(object): return old def update(self, new, old=None): + """ Update dictionary with new values recursively. + + :Parameters: + new : dict + new dictionary + old : dict + old dictionary, defaults to self.config + + """ if not old: old = self.config for k, v in new.items(): @@ -115,11 +131,6 @@ class Config(object): self._bugzilla_config = {} return old - -# D.update(E, **F) -> None. Update D from E and F: for k in E: D[k] = E[k] -# (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k] - - @property def bugzilla_config(self): if not self._bugzilla_config: |