mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
useless dict operation (auto-fix)
ruff 'RUF051,RUF056'
This commit is contained in:
parent
4aa2c3a342
commit
7f6a11a368
@ -98,8 +98,7 @@ class BT(BasicNewsRecipe):
|
||||
# Done with the sorted feeds
|
||||
|
||||
for i in feedSort:
|
||||
if i in sections:
|
||||
del sections[i]
|
||||
sections.pop(i, None)
|
||||
|
||||
# Append what is left over...
|
||||
|
||||
|
@ -32,6 +32,7 @@ select = [
|
||||
'Q', 'UP', 'YTT', 'TID', 'C4', 'COM818',
|
||||
'RUF', # nota: RUF can flag many unsolicited errors
|
||||
# preview rules
|
||||
'RUF051', 'RUF056', # useless dict operation
|
||||
]
|
||||
|
||||
[lint.per-file-ignores]
|
||||
|
@ -517,7 +517,7 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
devnodes.append(node)
|
||||
|
||||
devnodes += list(repeat(None, 3))
|
||||
ans = ['/dev/'+x if ok.get(x, False) else None for x in devnodes]
|
||||
ans = ['/dev/'+x if ok.get(x) else None for x in devnodes]
|
||||
ans.sort(key=lambda x: x[5:] if x else 'zzzzz')
|
||||
return self.linux_swap_drives(ans[:3])
|
||||
|
||||
|
@ -119,19 +119,19 @@ def get_metadata(stream, extract_cover=True):
|
||||
if data.get('opf.metadata'):
|
||||
# custom metadata contains OPF information
|
||||
opfmeta = True
|
||||
if data.get('opf.titlesort', ''):
|
||||
if data.get('opf.titlesort'):
|
||||
mi.title_sort = data['opf.titlesort']
|
||||
if data.get('opf.authors', ''):
|
||||
if data.get('opf.authors'):
|
||||
mi.authors = string_to_authors(data['opf.authors'])
|
||||
if data.get('opf.authorsort', ''):
|
||||
if data.get('opf.authorsort'):
|
||||
mi.author_sort = data['opf.authorsort']
|
||||
if data.get('opf.isbn', ''):
|
||||
if data.get('opf.isbn'):
|
||||
isbn = check_isbn(data['opf.isbn'])
|
||||
if isbn is not None:
|
||||
mi.isbn = isbn
|
||||
if data.get('opf.publisher', ''):
|
||||
if data.get('opf.publisher'):
|
||||
mi.publisher = data['opf.publisher']
|
||||
if data.get('opf.pubdate', ''):
|
||||
if data.get('opf.pubdate'):
|
||||
mi.pubdate = parse_date(data['opf.pubdate'], assume_utc=True)
|
||||
if data.get('opf.identifiers'):
|
||||
try:
|
||||
@ -143,14 +143,14 @@ def get_metadata(stream, extract_cover=True):
|
||||
mi.rating = max(0, min(float(data['opf.rating']), 10))
|
||||
except Exception:
|
||||
pass
|
||||
if data.get('opf.series', ''):
|
||||
if data.get('opf.series'):
|
||||
mi.series = data['opf.series']
|
||||
if data.get('opf.seriesindex', ''):
|
||||
if data.get('opf.seriesindex'):
|
||||
try:
|
||||
mi.series_index = float(data['opf.seriesindex'])
|
||||
except Exception:
|
||||
mi.series_index = 1.0
|
||||
if data.get('opf.language', ''):
|
||||
if data.get('opf.language'):
|
||||
cl = canonicalize_lang(data['opf.language'])
|
||||
if cl:
|
||||
mi.languages = [cl]
|
||||
|
@ -318,10 +318,8 @@ class ConfigModel(SearchQueryParser, QAbstractItemModel):
|
||||
sc = node.data
|
||||
un = sc['unique_name']
|
||||
if sc['set_to_default']:
|
||||
if un in kmap:
|
||||
del kmap[un]
|
||||
if un in options_map:
|
||||
del options_map[un]
|
||||
kmap.pop(un, None)
|
||||
options_map.pop(un, None)
|
||||
else:
|
||||
if sc['persist_shortcut']:
|
||||
options_map[un] = options_map.get(un, {})
|
||||
|
Loading…
x
Reference in New Issue
Block a user