mypy: Ignore ImportError handling

See https://github.com/python/mypy/issues/1153
This commit is contained in:
Florian Bruhin 2018-11-22 13:54:17 +01:00
parent 4d1b3df5e0
commit 97d0cff93b
6 changed files with 10 additions and 10 deletions

View File

@ -37,7 +37,7 @@ try:
import secrets
except ImportError:
# New in Python 3.6
secrets = None
secrets = None # type: ignore
from PyQt5.QtCore import QUrlQuery, QUrl, qVersion

View File

@ -30,12 +30,12 @@ try:
except ImportError: # pragma: no cover
try:
# Python2
from Tkinter import Tk
import tkMessageBox as messagebox
from Tkinter import Tk # type: ignore
import tkMessageBox as messagebox # type: ignore
except ImportError:
# Some Python without Tk
Tk = None
messagebox = None
Tk = None # type: ignore
messagebox = None # type: ignore
# First we check the version of Python. This code should run fine with python2

View File

@ -38,7 +38,7 @@ import datetime
try:
import tkinter
except ImportError:
tkinter = None
tkinter = None # type: ignore
# NOTE: No qutebrowser or PyQt import should be done here, as some early
# initialization needs to take place before that!

View File

@ -25,4 +25,4 @@
try:
from PyQt5 import sip
except ImportError:
import sip
import sip # type: ignore

View File

@ -39,7 +39,7 @@ from PyQt5.QtCore import (qVersion, QEventLoop, QDataStream, QByteArray,
try:
from PyQt5.QtWebKit import qWebKitVersion
except ImportError: # pragma: no cover
qWebKitVersion = None
qWebKitVersion = None # type: ignore
MAXVALS = {

View File

@ -42,12 +42,12 @@ from PyQt5.QtWidgets import QApplication
try:
from PyQt5.QtWebKit import qWebKitVersion
except ImportError: # pragma: no cover
qWebKitVersion = None
qWebKitVersion = None # type: ignore
try:
from PyQt5.QtWebEngineWidgets import QWebEngineProfile
except ImportError: # pragma: no cover
QWebEngineProfile = None
QWebEngineProfile = None # type: ignore
import qutebrowser
from qutebrowser.utils import log, utils, standarddir, usertypes, message