fixes from static checking

This commit is contained in:
Kovid Goyal 2020-08-13 09:04:44 +05:30
parent 8b39fea8f8
commit 200a3cba71
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
8 changed files with 13 additions and 18 deletions

View File

@ -45,7 +45,7 @@ class MediaDaumRecipe(BasicNewsRecipe):
lambda match: '</em>'), lambda match: '</em>'),
(re.compile(r'(<br[^>]*>[ \t\r\n]*)*</i>', re.DOTALL | re.IGNORECASE), (re.compile(r'(<br[^>]*>[ \t\r\n]*)*</i>', re.DOTALL | re.IGNORECASE),
lambda match: '</i>'), lambda match: '</i>'),
(re.compile(u'\(\uB05D\)[ \t\r\n]*<br[^>]*>.*</div>', re.DOTALL | re.IGNORECASE), (re.compile(r'\(\uB05D\)[ \t\r\n]*<br[^>]*>.*</div>', re.DOTALL | re.IGNORECASE),
lambda match: '</div>'), lambda match: '</div>'),
(re.compile(r'(<br[^>]*>[ \t\r\n]*)*<div', re.DOTALL | re.IGNORECASE), (re.compile(r'(<br[^>]*>[ \t\r\n]*)*<div', re.DOTALL | re.IGNORECASE),
lambda match: '<div'), lambda match: '<div'),

View File

@ -64,7 +64,7 @@ class Ozon(Source):
res = None res = None
if ozon_id: if ozon_id:
# no affiliateId is used in search/detail # no affiliateId is used in search/detail
url = '{}/context/detail/id/{}'.format(self.ozon_url, quote(ozon_id), _get_affiliateId()) url = '{}/context/detail/id/{}'.format(self.ozon_url, quote(ozon_id))
res = ('ozon', ozon_id, url) res = ('ozon', ozon_id, url)
return res return res

View File

@ -129,7 +129,7 @@ class Index(object): # {{{
shifts = mask_to_bit_shifts[mask] shifts = mask_to_bit_shifts[mask]
ans |= mask & (nentries << shifts) ans |= mask & (nentries << shifts)
if len(cbs) != cls.control_byte_count: if len(cbs) != cls.control_byte_count:
raise ValueError('The entry %r is invalid'%[lead_text, tags]) raise ValueError('The entry {!r} is invalid'.format([lead_text, tags]))
control_bytes.append(cbs) control_bytes.append(cbs)
return control_bytes return control_bytes

View File

@ -4,7 +4,7 @@ from __python__ import bound_methods, hash_literals
import traceback import traceback
from gettext import gettext as _ from gettext import gettext as _
from select import selection_extents, move_end_of_selection, word_at_point from select import move_end_of_selection, selection_extents, word_at_point
from fs_images import fix_fullscreen_svg_images from fs_images import fix_fullscreen_svg_images
from iframe_comm import IframeClient from iframe_comm import IframeClient
@ -12,20 +12,17 @@ from range_utils import (
highlight_associated_with_selection, reset_highlight_counter, select_crw, highlight_associated_with_selection, reset_highlight_counter, select_crw,
unwrap_all_crw, unwrap_crw, wrap_text_in_range unwrap_all_crw, unwrap_crw, wrap_text_in_range
) )
from read_book.cfi import ( from read_book.cfi import cfi_for_selection, range_from_cfi
cfi_for_selection, range_from_cfi, scroll_to as scroll_to_cfi
)
from read_book.extract import get_elements from read_book.extract import get_elements
from read_book.find import reset_find_caches, select_search_result from read_book.find import reset_find_caches, select_search_result
from read_book.flow_mode import ( from read_book.flow_mode import (
anchor_funcs as flow_anchor_funcs, auto_scroll_action as flow_auto_scroll_action, anchor_funcs as flow_anchor_funcs, auto_scroll_action as flow_auto_scroll_action,
cancel_drag_scroll as cancel_drag_scroll_flow, ensure_selection_visible, cancel_drag_scroll as cancel_drag_scroll_flow, ensure_selection_visible,
flow_onwheel, flow_to_scroll_fraction, handle_gesture as flow_handle_gesture, flow_onwheel, flow_to_scroll_fraction, handle_gesture as flow_handle_gesture,
handle_shortcut as flow_handle_shortcut, layout as flow_layout, handle_shortcut as flow_handle_shortcut, jump_to_cfi as flow_jump_to_cfi,
scroll_by_page as flow_scroll_by_page, layout as flow_layout, scroll_by_page as flow_scroll_by_page,
scroll_to_extend_annotation as flow_annotation_scroll, scroll_to_extend_annotation as flow_annotation_scroll,
start_drag_scroll as start_drag_scroll_flow, start_drag_scroll as start_drag_scroll_flow
jump_to_cfi as flow_jump_to_cfi
) )
from read_book.footnotes import is_footnote_link from read_book.footnotes import is_footnote_link
from read_book.globals import ( from read_book.globals import (

View File

@ -284,8 +284,6 @@ def layout(is_single_page, on_resize):
nonlocal number_of_cols nonlocal number_of_cols
ncols = number_of_cols = (scroll_viewport.paged_content_inline_size() + gap) / col_and_gap ncols = number_of_cols = (scroll_viewport.paged_content_inline_size() + gap) / col_and_gap
if ncols is not Math.floor(ncols): if ncols is not Math.floor(ncols):
n = number_of_cols = Math.floor(ncols)
dw = n*col_size + (n-1)*gap
data = {'col_size':col_size, 'gap':gap, 'scrollWidth':scroll_viewport.paged_content_inline_size(), 'ncols':ncols, 'desired_inline_size':dis} data = {'col_size':col_size, 'gap':gap, 'scrollWidth':scroll_viewport.paged_content_inline_size(), 'ncols':ncols, 'desired_inline_size':dis}
return data return data