mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix errors reported by pyflakes
This commit is contained in:
parent
af59788c71
commit
163f90f083
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
store_version = 5 # Needed for dynamic plugin loading
|
store_version = 6 # Needed for dynamic plugin loading
|
||||||
|
|
||||||
__license__ = 'GPL 3'
|
__license__ = 'GPL 3'
|
||||||
__copyright__ = '2011-2020, Tomasz Długosz <tomek3d@gmail.com>'
|
__copyright__ = '2011-2020, Tomasz Długosz <tomek3d@gmail.com>'
|
||||||
@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
|
from base64 import standard_b64encode
|
||||||
try:
|
try:
|
||||||
from urllib.parse import quote_plus
|
from urllib.parse import quote_plus
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -29,7 +30,7 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
|
|||||||
def as_base64(data):
|
def as_base64(data):
|
||||||
if not isinstance(data, bytes):
|
if not isinstance(data, bytes):
|
||||||
data = data.encode('utf-8')
|
data = data.encode('utf-8')
|
||||||
ans = b64encode(data)
|
ans = standard_b64encode(data)
|
||||||
if isinstance(ans, bytes):
|
if isinstance(ans, bytes):
|
||||||
ans = ans.decode('ascii')
|
ans = ans.decode('ascii')
|
||||||
return ans
|
return ans
|
||||||
|
@ -8,8 +8,6 @@ import textwrap
|
|||||||
import time
|
import time
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from threading import Thread
|
|
||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QApplication, QByteArray, QHBoxLayout, QIcon, QLabel, QMenu, QSize, QSizePolicy,
|
QApplication, QByteArray, QHBoxLayout, QIcon, QLabel, QMenu, QSize, QSizePolicy,
|
||||||
QStackedLayout, Qt, QTimer, QToolBar, QUrl, QVBoxLayout, QWidget, pyqtSignal
|
QStackedLayout, Qt, QTimer, QToolBar, QUrl, QVBoxLayout, QWidget, pyqtSignal
|
||||||
@ -18,6 +16,7 @@ from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler
|
|||||||
from PyQt5.QtWebEngineWidgets import (
|
from PyQt5.QtWebEngineWidgets import (
|
||||||
QWebEnginePage, QWebEngineProfile, QWebEngineScript, QWebEngineView
|
QWebEnginePage, QWebEngineProfile, QWebEngineScript, QWebEngineView
|
||||||
)
|
)
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
from calibre import prints
|
from calibre import prints
|
||||||
from calibre.constants import (
|
from calibre.constants import (
|
||||||
@ -25,7 +24,9 @@ from calibre.constants import (
|
|||||||
)
|
)
|
||||||
from calibre.ebooks.oeb.base import OEB_DOCS, XHTML_MIME, serialize
|
from calibre.ebooks.oeb.base import OEB_DOCS, XHTML_MIME, serialize
|
||||||
from calibre.ebooks.oeb.polish.parsing import parse
|
from calibre.ebooks.oeb.polish.parsing import parse
|
||||||
from calibre.gui2 import NO_URL_FORMATTING, error_dialog, is_dark_theme, safe_open_url
|
from calibre.gui2 import (
|
||||||
|
NO_URL_FORMATTING, error_dialog, is_dark_theme, safe_open_url
|
||||||
|
)
|
||||||
from calibre.gui2.palette import dark_color, dark_link_color, dark_text_color
|
from calibre.gui2.palette import dark_color, dark_link_color, dark_text_color
|
||||||
from calibre.gui2.tweak_book import TOP, actions, current_container, editors, tprefs
|
from calibre.gui2.tweak_book import TOP, actions, current_container, editors, tprefs
|
||||||
from calibre.gui2.tweak_book.file_list import OpenWithHandler
|
from calibre.gui2.tweak_book.file_list import OpenWithHandler
|
||||||
@ -459,7 +460,7 @@ class WebView(RestartingWebEngineView, OpenWithHandler):
|
|||||||
menu.addAction(actions['reload-preview'])
|
menu.addAction(actions['reload-preview'])
|
||||||
menu.addAction(QIcon(I('debug.png')), _('Inspect element'), self.inspect)
|
menu.addAction(QIcon(I('debug.png')), _('Inspect element'), self.inspect)
|
||||||
if url.partition(':')[0].lower() in {'http', 'https'}:
|
if url.partition(':')[0].lower() in {'http', 'https'}:
|
||||||
menu.addAction(_('Open link'), partial(open_url, data.linkUrl()))
|
menu.addAction(_('Open link'), partial(safe_open_url, data.linkUrl()))
|
||||||
if data.MediaTypeImage <= data.mediaType() <= data.MediaTypeFile:
|
if data.MediaTypeImage <= data.mediaType() <= data.MediaTypeFile:
|
||||||
url = data.mediaUrl()
|
url = data.mediaUrl()
|
||||||
if url.scheme() == FAKE_PROTOCOL:
|
if url.scheme() == FAKE_PROTOCOL:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user