From 066a693d77b0b950653cf5b577d308da594fa471 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 11 Oct 2014 08:06:17 -0400 Subject: Can change config after construction. --- coverage/config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'coverage/config.py') diff --git a/coverage/config.py b/coverage/config.py index ece68ba8..f262a043 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -266,3 +266,18 @@ class CoverageConfig(object): def get_plugin_options(self, plugin): """Get a dictionary of options for the plugin named `plugin`.""" return self.plugin_options.get(plugin, {}) + + # TODO: docs for this. + def __setitem__(self, names, value): + for option_spec in self.CONFIG_FILE_OPTIONS: + attr, where = option_spec[:2] + if where == names: + setattr(self, attr, value) + return + + # TODO: docs for this. + def __getitem__(self, names): + for option_spec in self.CONFIG_FILE_OPTIONS: + attr, where = option_spec[:2] + if where == names: + return getattr(self, attr) -- cgit v1.2.1