diff options
author | Tim Brown <stimut@gmail.com> | 2020-10-26 23:08:35 +1000 |
---|---|---|
committer | Tim Brown <stimut@gmail.com> | 2020-10-27 13:49:24 +1000 |
commit | 4279a4da6f16e851497dbc75e342ebb0bf0e3b59 (patch) | |
tree | dd633aaaad3bca80eceaffdd8d598e99bd6bfa7d /qutebrowser/browser/greasemonkey.py | |
parent | 37d7a195a9e47c8d6e3b603d90ad2130a7ce683e (diff) | |
download | qutebrowser-4279a4da6f16e851497dbc75e342ebb0bf0e3b59.tar.gz qutebrowser-4279a4da6f16e851497dbc75e342ebb0bf0e3b59.zip |
mypy: use from-import for typing in remaining files in `browser`
The type comments have also been changed to annotations, since Python
3.5 support will be dropped with the next release.
See #5396
Diffstat (limited to 'qutebrowser/browser/greasemonkey.py')
-rw-r--r-- | qutebrowser/browser/greasemonkey.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/qutebrowser/browser/greasemonkey.py b/qutebrowser/browser/greasemonkey.py index 89d720682..5a5d55a6d 100644 --- a/qutebrowser/browser/greasemonkey.py +++ b/qutebrowser/browser/greasemonkey.py @@ -26,7 +26,7 @@ import fnmatch import functools import glob import textwrap -import typing +from typing import cast, List, Sequence import attr from PyQt5.QtCore import pyqtSignal, QObject, QUrl @@ -39,7 +39,7 @@ from qutebrowser.browser import downloads from qutebrowser.misc import objects -gm_manager = typing.cast('GreasemonkeyManager', None) +gm_manager = cast('GreasemonkeyManager', None) def _scripts_dir(): @@ -54,10 +54,10 @@ class GreasemonkeyScript: def __init__(self, properties, code, # noqa: C901 pragma: no mccabe filename=None): self._code = code - self.includes = [] # type: typing.Sequence[str] - self.matches = [] # type: typing.Sequence[str] - self.excludes = [] # type: typing.Sequence[str] - self.requires = [] # type: typing.Sequence[str] + self.includes: Sequence[str] = [] + self.matches: Sequence[str] = [] + self.excludes: Sequence[str] = [] + self.requires: Sequence[str] = [] self.description = None self.namespace = None self.run_at = None @@ -259,11 +259,10 @@ class GreasemonkeyManager(QObject): def __init__(self, parent=None): super().__init__(parent) - self._run_start = [] # type: typing.List[GreasemonkeyScript] - self._run_end = [] # type: typing.List[GreasemonkeyScript] - self._run_idle = [] # type: typing.List[GreasemonkeyScript] - self._in_progress_dls = [ - ] # type: typing.List[downloads.AbstractDownloadItem] + self._run_start: List[GreasemonkeyScript] = [] + self._run_end: List[GreasemonkeyScript] = [] + self._run_idle: List[GreasemonkeyScript] = [] + self._in_progress_dls: List[downloads.AbstractDownloadItem] = [] self.load_scripts() |