mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-03-09 19:33:40 -04:00
redeclared assigned name (manual)
ruff 'PLW0127'
This commit is contained in:
parent
ab210188b0
commit
53c2f34a4c
@ -107,7 +107,7 @@ ignore = [
|
||||
'E402', 'E741',
|
||||
'UP012', 'UP030', 'C413', 'C420', 'PIE790', 'ISC003',
|
||||
'RUF001', 'RUF002', 'RUF003', 'RUF005', 'RUF012', 'RUF013', 'RUF015', 'RUF031', 'RUF100',
|
||||
'PLE1205', 'PLW0602', 'PLW0603', 'PLW1510', 'PLW1641', 'PLW2901', 'PLW0127',
|
||||
'PLE1205', 'PLW0602', 'PLW0603', 'PLW1510', 'PLW1641', 'PLW2901',
|
||||
'RUF059', # unused unpacked variable
|
||||
]
|
||||
select = [
|
||||
|
||||
@ -1222,7 +1222,6 @@ class KOBO(USBMS):
|
||||
if bookmark_extension:
|
||||
for vol in storage:
|
||||
bkmk_path = path_map[book_id]['path']
|
||||
bkmk_path = bkmk_path
|
||||
if os.path.exists(bkmk_path):
|
||||
path_map[book_id] = bkmk_path
|
||||
book_ext[book_id] = book_extension
|
||||
|
||||
@ -201,7 +201,6 @@ def unit_convert(value, base, font, dpi, body_font_size=12):
|
||||
elif unit in ('ex', 'en'):
|
||||
# This is a hack for ex since we have no way to know
|
||||
# the x-height of the font
|
||||
font = font
|
||||
result = value * font * 0.5
|
||||
elif unit == 'pc':
|
||||
result = value * 12.0
|
||||
|
||||
@ -220,7 +220,6 @@ class Block:
|
||||
|
||||
def layout_text(prefs, img, title, subtitle, footer, max_height, style):
|
||||
width = img.width() - 2 * style.hmargin
|
||||
title, subtitle, footer = title, subtitle, footer
|
||||
title_font = QFont(prefs.title_font_family or 'Liberation Serif')
|
||||
title_font.setPixelSize(prefs.title_font_size)
|
||||
title_font.setStyleStrategy(QFont.StyleStrategy.PreferAntialias)
|
||||
|
||||
@ -299,8 +299,6 @@ class Convert:
|
||||
if name is None:
|
||||
cname = self.docx.document_name.split('/')
|
||||
cname[-1] = defname
|
||||
if self.docx.exists('/'.join(cname)):
|
||||
name = name
|
||||
if name and name.startswith('word/word') and not self.docx.exists(name):
|
||||
name = name.partition('/')[2]
|
||||
return name
|
||||
|
||||
@ -89,7 +89,6 @@ class Resource: # {{{
|
||||
path = path.decode(filesystem_encoding)
|
||||
self.path = path
|
||||
else:
|
||||
href_or_path = href_or_path
|
||||
url = urlparse(href_or_path)
|
||||
if url[0] not in ('', 'file'):
|
||||
self._href = href_or_path
|
||||
|
||||
@ -83,7 +83,6 @@ def find_portable_library():
|
||||
lib = None
|
||||
q = os.path.basename(lp)
|
||||
for c in candidates:
|
||||
c = c
|
||||
if c.lower() == q.lower():
|
||||
lib = os.path.join(base, c)
|
||||
break
|
||||
|
||||
@ -40,7 +40,6 @@ def bf():
|
||||
if _bf is None:
|
||||
_bf = QFont()
|
||||
_bf.setBold(True)
|
||||
_bf = (_bf)
|
||||
return _bf
|
||||
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ def find_closest_containing_tag(block, offset, max_tags=sys.maxsize):
|
||||
return Tag(block, boundary, eblock, eboundary, self_closing=True)
|
||||
return find_closest_containing_tag(eblock, eboundary.offset + 1)
|
||||
stack = []
|
||||
block, tag_end = block, boundary
|
||||
tag_end = boundary
|
||||
while block is not None and max_tags > 0:
|
||||
sblock, tag_start = prev_tag_boundary(block, tag_end.offset)
|
||||
if sblock is None or not tag_start.is_start:
|
||||
|
||||
@ -71,8 +71,6 @@ class GlobalUndoHistory(QAbstractListModel):
|
||||
msg = _('Current state') + ('' if not msg else _(' [was %s]') % msg)
|
||||
elif not msg:
|
||||
msg = _('[Unnamed state]')
|
||||
else:
|
||||
msg = msg
|
||||
return msg
|
||||
|
||||
def label_for_container(self, container):
|
||||
|
||||
@ -1602,7 +1602,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
return self.add_format(book_id, nfmt, f, index_is_id=True, notify=notify)
|
||||
|
||||
def original_fmt(self, book_id, fmt):
|
||||
fmt = fmt
|
||||
nfmt = (f'ORIGINAL_{fmt}').upper()
|
||||
opath = self.format_abspath(book_id, nfmt, index_is_id=True)
|
||||
return fmt if opath is None else nfmt
|
||||
|
||||
@ -145,7 +145,6 @@ elif islinux:
|
||||
name = '{}-singleinstance-{}-{}'.format(
|
||||
__appname__, (os.geteuid() if per_user else ''), name
|
||||
)
|
||||
name = name
|
||||
address = '\0' + name.replace(' ', '_')
|
||||
sock = socket.socket(family=socket.AF_UNIX)
|
||||
try:
|
||||
|
||||
@ -525,7 +525,6 @@ def create_pot(source_files):
|
||||
for fname in source_files:
|
||||
with open(fname, 'rb') as f:
|
||||
code = f.read().decode('utf-8')
|
||||
fname = fname
|
||||
c.eval('RapydScript.gettext_parse(window.catalog, {}, {}); 1'.format(*map(json.dumps, (code, fname))))
|
||||
|
||||
buf = c.eval('ans = []; RapydScript.gettext_output(window.catalog, window.gettext_options, ans.push.bind(ans)); ans;')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user