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