Get rid of Config.read_configdata()
No need for this indirection
This commit is contained in:
parent
252c5396f3
commit
2c3981e57e
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user