From fec4fa60706210f1381bad0e922a36e42bf4b010 Mon Sep 17 00:00:00 2001 From: novirium Date: Thu, 2 Jan 2020 12:20:26 +0800 Subject: [PATCH] Added default to multi-bundle methods. Closes #15 --- configspec/manager.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configspec/manager.py b/configspec/manager.py index ef095eb..9e20f7d 100644 --- a/configspec/manager.py +++ b/configspec/manager.py @@ -186,7 +186,7 @@ class ConfigManager(): self.root_config[bundle_name] = bundle_source return deepcopy(bundle_source) - def validate_bundles(self, bundle_names): + def validate_bundles(self, bundle_names=None): """ Validate multiple config bundles at once, validating each one with the corresponding ConfigSpecification stored in the ConfigManager. See ``validate_bundle()``. @@ -200,6 +200,8 @@ class ConfigManager(): dict: A dict of deepcopied config bundles, with keys matching those passed in ``bundle_names``. """ + if bundle_names is None: + bundle_names = self.get_bundle_names() config_values = {} if isinstance(bundle_names, dict): @@ -233,7 +235,7 @@ class ConfigManager(): return self.root_config[bundle_name] - def get_config_bundles(self, bundle_names): + def get_config_bundles(self, bundle_names=None): """ Get multiple config bundles at once. If not yet validated, each will validate their config source against the corresponding config specification stored in the @@ -246,6 +248,8 @@ class ConfigManager(): dict: A dict of validated config bundles, with keys matching those passed in ``bundle_names``. """ + if bundle_names is None: + bundle_names = self.get_bundle_names() config_values = {} if isinstance(bundle_names, str):