mypy: Add missing annotations

This commit is contained in:
Florian Bruhin 2018-11-22 14:19:31 +01:00
parent a1e83f0773
commit b37dbc4572
5 changed files with 13 additions and 11 deletions

View File

@ -645,7 +645,7 @@ class CommandDispatcher:
inc_or_dec='decrement'),
'increment': functools.partial(navigate.incdec,
inc_or_dec='increment'),
}
} # type: typing.Dict[str, typing.Callable]
try:
if where in ['prev', 'next']:

View File

@ -21,6 +21,7 @@
import collections
import html
import typing
import attr
from PyQt5.QtCore import (pyqtSlot, pyqtSignal, QCoreApplication, QUrl,
@ -28,6 +29,7 @@ from PyQt5.QtCore import (pyqtSlot, pyqtSignal, QCoreApplication, QUrl,
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkReply, QSslSocket
from qutebrowser.config import config
from qutebrowser.mainwindow import prompt
from qutebrowser.utils import (message, log, usertypes, utils, objreg,
urlutils, debug)
from qutebrowser.browser import shared
@ -37,7 +39,7 @@ from qutebrowser.browser.webkit.network import (webkitqutescheme, networkreply,
HOSTBLOCK_ERROR_STRING = '%HOSTBLOCK%'
_proxy_auth_cache = {}
_proxy_auth_cache = {} # type: typing.Dict[ProxyId, prompt.AuthInfo]
@attr.s(frozen=True)

View File

@ -17,18 +17,15 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Contains various command utils and a global command dict.
Module attributes:
cmd_dict: A mapping from command-strings to command objects.
"""
"""Contains various command utils and a global command dict."""
import inspect
import typing
from qutebrowser.utils import qtutils, log
from qutebrowser.commands import command, cmdexc
cmd_dict = {}
cmd_dict = {} # type: typing.Dict[str, command.Command]
def check_overflow(arg, ctype):

View File

@ -20,6 +20,8 @@
"""Implementation of a basic config cache."""
import typing
from qutebrowser.config import config
@ -36,7 +38,7 @@ class ConfigCache:
"""
def __init__(self) -> None:
self._cache = {}
self._cache = {} # type: typing.Dict[str, typing.Any]
config.instance.changed.connect(self._on_config_changed)
def _on_config_changed(self, attr: str) -> None:

View File

@ -52,6 +52,7 @@ import datetime
import functools
import operator
import json
import typing
import attr
import yaml
@ -304,7 +305,7 @@ class MappingType(BaseType):
MAPPING: The mapping to use.
"""
MAPPING = {}
MAPPING = {} # type: typing.Dict[str, typing.Any]
def __init__(self, none_ok=False, valid_values=None):
super().__init__(none_ok)
@ -576,7 +577,7 @@ class FlagList(List):
the valid values of the setting.
"""
combinable_values = None
combinable_values = None # type: typing.Optional[typing.Iterable]
_show_valtype = False