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 import secrets
except ImportError: except ImportError:
# New in Python 3.6 # New in Python 3.6
secrets = None secrets = None # type: ignore
from PyQt5.QtCore import QUrlQuery, QUrl, qVersion from PyQt5.QtCore import QUrlQuery, QUrl, qVersion

View File

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

View File

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

View File

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

View File

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

View File

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