From 052c3f92ada0ad3a09aa46dd1fcc335baa2eb496 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 22 Nov 2018 14:34:57 +0100 Subject: [PATCH] mypy: Fix issues with config default values --- qutebrowser/config/config.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 1f2e45741..41309d352 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -22,6 +22,7 @@ import copy import contextlib import functools +import typing from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject @@ -30,11 +31,15 @@ from qutebrowser.utils import utils, log, jinja from qutebrowser.misc import objects from qutebrowser.keyinput import keyutils +MYPY = False +if MYPY: + from qutebrowser.config import configcache + # An easy way to access the config from other code via config.val.foo -val = None -instance = None -key_instance = None -cache = None +val = typing.cast('ConfigContainer', None) +instance = typing.cast('Config', None) +key_instance = typing.cast('KeyConfig', None) +cache = typing.cast('configcache.ConfigCache', None) # Keeping track of all change filters to validate them later. change_filters = []