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>'),
(re.compile(r'(<br[^>]*>[ \t\r\n]*)*</i>', re.DOTALL | re.IGNORECASE),
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>'),
(re.compile(r'(<br[^>]*>[ \t\r\n]*)*<div', re.DOTALL | re.IGNORECASE),
lambda match: '<div'),

View File

@ -35,8 +35,8 @@ class LaStampa(BasicNewsRecipe):
keep_only_tags = [
dict(attrs={'class': ['boxocchiello2', 'titoloRub', 'titologir', 'autore-girata', 'luogo-girata', 'catenaccio', 'sezione', 'articologirata', 'bodytext', 'news-single-img', 'ls-articoloCorpo', 'ls-blog-list-1col']}), # noqa
dict(name='div', attrs={'id': 'corpoarticolo'})
]
dict(name='div', attrs={'id': 'corpoarticolo'})
]
remove_tags = [dict(name='div', attrs={'id': ['menutop', 'fwnetblocco']}),
dict(

View File

@ -267,7 +267,7 @@ def main():
parser = OptionParser(usage="usage: %prog ls [options] path\nList files on the device\n\npath must begin with / or card:/")
parser.add_option(
"-l", help="In addition to the name of each file, print the file type, permissions, and timestamp (the modification time, in the local timezone). Times are local.", # noqa
dest="ll", action="store_true", default=False)
dest="ll", action="store_true", default=False)
parser.add_option("-R", help="Recursively list subdirectories encountered. /dev and /proc are omitted",
dest="recurse", action="store_true", default=False)
parser.remove_option("-h")

View File

@ -64,7 +64,7 @@ class Ozon(Source):
res = None
if ozon_id:
# 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)
return res

View File

@ -129,7 +129,7 @@ class Index(object): # {{{
shifts = mask_to_bit_shifts[mask]
ans |= mask & (nentries << shifts)
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)
return control_bytes

View File

@ -144,7 +144,7 @@ def transform_declaration(decl):
changed = False
nonstandard_writing_mode_props = {}
standard_writing_mode_props = {}
for prop, parent_prop in tuple(decl):
if prop.name in page_break_properties:
changed = True

View File

@ -4,7 +4,7 @@ from __python__ import bound_methods, hash_literals
import traceback
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 iframe_comm import IframeClient
@ -12,20 +12,17 @@ from range_utils import (
highlight_associated_with_selection, reset_highlight_counter, select_crw,
unwrap_all_crw, unwrap_crw, wrap_text_in_range
)
from read_book.cfi import (
cfi_for_selection, range_from_cfi, scroll_to as scroll_to_cfi
)
from read_book.cfi import cfi_for_selection, range_from_cfi
from read_book.extract import get_elements
from read_book.find import reset_find_caches, select_search_result
from read_book.flow_mode import (
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,
flow_onwheel, flow_to_scroll_fraction, handle_gesture as flow_handle_gesture,
handle_shortcut as flow_handle_shortcut, layout as flow_layout,
scroll_by_page as flow_scroll_by_page,
handle_shortcut as flow_handle_shortcut, jump_to_cfi as flow_jump_to_cfi,
layout as flow_layout, scroll_by_page as flow_scroll_by_page,
scroll_to_extend_annotation as flow_annotation_scroll,
start_drag_scroll as start_drag_scroll_flow,
jump_to_cfi as flow_jump_to_cfi
start_drag_scroll as start_drag_scroll_flow
)
from read_book.footnotes import is_footnote_link
from read_book.globals import (

View File

@ -284,8 +284,6 @@ def layout(is_single_page, on_resize):
nonlocal number_of_cols
ncols = number_of_cols = (scroll_viewport.paged_content_inline_size() + gap) / col_and_gap
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}
return data
@ -458,7 +456,7 @@ def scroll_to_elem(elem):
# elem.scrollIntoView(). However, in some cases it gives
# inaccurate results, so we prefer the bounding client rect,
# when possible.
# In horizontal writing, the inline start position depends on the direction
if scroll_viewport.horizontal_writing_mode:
inline_start = elem.scrollLeft if scroll_viewport.ltr else elem.scrollRight