Coverage for qutebrowser/config/configdata.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # # qutebrowser is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # qutebrowser is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
Module attributes:
DATA: A dict of Option objects after init() has been called. """
class Option:
"""Description of an Option in the config.
Note that this is just an option which exists, with no value associated. """
class Migrations:
"""Nigrated options in configdata.yml.
Attributes: renamed: A dict mapping old option names to new names. deleted: A list of option names which have been removed. """
"""Raise an exception for an invalid configdata YAML node.
Args: name: The name of the setting being parsed. what: The name of the thing being parsed. node: The invalid node. """ name, what, node))
# e.g: # type: Bool # -> create the type object without any arguments # e.g: # type: # name: String # none_ok: true # -> create the type object and pass arguments else:
type_name, name))
# Parse sub-types
type_name, node, e))
"""Parse a dict definition for backends.
Example:
backends: QtWebKit: true QtWebEngine: Qt 5.9 """ 'QtWebKit': usertypes.Backend.QtWebKit, 'QtWebEngine': usertypes.Backend.QtWebEngine, }
# The value associated to the key, and whether we should add that backend # or not. True: True, False: False, 'Qt 5.8': qtutils.version_check('5.8'), 'Qt 5.9': qtutils.version_check('5.9'), }
"""Parse a backend node in the yaml.
It can have one of those four forms: - Not present -> setting applies to both backends. - backend: QtWebKit -> setting only available with QtWebKit - backend: QtWebEngine -> setting only available with QtWebEngine - backend: QtWebKit: true QtWebEngine: Qt 5.9 -> setting available based on the given conditionals.
Return: A list of backends. """ raise utils.Unreachable
"""Read config data from a YAML file.
Args: yaml_data: The YAML string to parse.
Return: A tuple with two elements: - A dict mapping option names to Option elements. - A Migrations object. """
option.keys(), name))
name=name, typ=_parse_yaml_type(name, option['type']), default=option['default'], backends=_parse_yaml_backends(name, backends), raw_backends=backends if isinstance(backends, dict) else None, description=option['desc'], restart=option.get('restart', False))
# Make sure no key shadows another.
# Make sure rename targets actually exist.
def is_valid_prefix(prefix): """Check whether the given prefix is a valid prefix for some option."""
"""Initialize configdata from the YAML file.""" global DATA, MIGRATIONS |