From 2c3981e57e673dbbf82cbef659272b88bf7c2042 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 3 Jul 2017 10:41:39 +0200 Subject: [PATCH] Get rid of Config.read_configdata() No need for this indirection --- qutebrowser/config/config.py | 11 +---------- tests/helpers/fixtures.py | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index b7e285787..cc269491f 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -364,8 +364,6 @@ class Config(QObject): """Main config object. Attributes: - options: A dict mapping setting names to configdata.Option objects. - Those contain the type, default value, etc. _values: A dict mapping setting names to their values. _mutables: A list of mutable objects to be checked for changes. _yaml: A YamlConfig object or None. @@ -378,7 +376,6 @@ class Config(QObject): def __init__(self, yaml_config, parent=None): super().__init__(parent) - self.options = {} self._values = {} self._mutables = [] self._yaml = yaml_config @@ -388,11 +385,6 @@ class Config(QObject): self.changed.emit(name) log.config.debug("Config option changed: {} = {}".format(name, value)) - def read_configdata(self): - """Read the option objects from configdata.""" - for name, option in configdata.DATA.items(): - self.options[name] = option - def read_yaml(self): """Read the YAML settings from self._yaml.""" self._yaml.load() @@ -404,7 +396,7 @@ class Config(QObject): def get_opt(self, name): """Get a configdata.Option object for the given setting.""" try: - return self.options[name] + return configdata.DATA[name] except KeyError: raise configexc.NoOptionError(name) @@ -610,7 +602,6 @@ def init(parent=None): yaml_config = configfiles.YamlConfig() config = Config(yaml_config=yaml_config, parent=parent) - config.read_configdata() objreg.register('config', config) global val, instance, key_instance diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index af080f7b8..001506364 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -209,7 +209,6 @@ def config_stub(stubs, monkeypatch): yaml_config = stubs.FakeYamlConfig() conf = config.Config(yaml_config=yaml_config) - conf.read_configdata() monkeypatch.setattr(config, 'instance', conf) container = config.ConfigContainer(conf)