Skip to content

Commit

Permalink
s1
Browse files Browse the repository at this point in the history
  • Loading branch information
sadielbartholomew committed Feb 18, 2019
1 parent 25721ff commit b5c0a2e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/python/rose/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from rose.config import *
.. testcleanup:: rose.config
try:
os.remove('config.conf')
except OSError:
Expand All @@ -45,6 +46,7 @@
... except ConfigSyntaxError:
... # Handle exception.
... pass
>>> # Retrieve config settings.
>>> config_node.get(['foo', 'bar'])
{'state': '', 'comments': [], 'value': 'Bar'}
Expand Down Expand Up @@ -154,6 +156,7 @@ class ConfigNode(object):
>>> # Walk over the config skipping ignored sections.
>>> [keys for keys, sub_node in config_node.walk(no_ignore=True)]
[['foo'], ['foo', 'baz']]
>>> # Add two ConfigNode instances to create a new "merged" node.
>>> another_config_node = ConfigNode()
>>> _ = another_config_node.set(keys=['new'], value='New')
Expand Down Expand Up @@ -1251,14 +1254,14 @@ def load_with_opts(self, source, node=None, more_keys=None,
... [foo]
... bar=Bar
... ''')
>>> # Write optional config file (foo).
>>> os.mkdir('opt')
>>> with open('opt/config-foo.conf', 'w+') as opt_config_file:
... opt_config_file.write('''
... [foo]
... bar=Baz
... ''')
>>> loader = ConfigLoader()
>>> config_node, config_map = loader.load_with_opts(
... 'config.conf', more_keys=['foo'], return_config_map=True)
Expand Down Expand Up @@ -1322,10 +1325,12 @@ def load_with_opts(self, source, node=None, more_keys=None,

def load_defines(self, defines, node=None):
"""Read configuration from a list of command line defines.
Arguments:
defines (list): A list of [SECTION]KEY=VALUE items.
node (ConfigNode - optional): A ConfigNode object if specified,
otherwise one is created.
Returns:
ConfigNode: A new ConfigNode object.
"""
Expand Down

0 comments on commit b5c0a2e

Please sign in to comment.