mypy: Ignore ImportError handling
See https://github.com/python/mypy/issues/1153
This commit is contained in:
parent
4d1b3df5e0
commit
97d0cff93b
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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!
|
||||||
|
@ -25,4 +25,4 @@
|
|||||||
try:
|
try:
|
||||||
from PyQt5 import sip
|
from PyQt5 import sip
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import sip
|
import sip # type: ignore
|
||||||
|
@ -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 = {
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user