unnecessary return None (auto-fix)

ruff 'RET501'
This commit is contained in:
un-pogaz 2025-01-24 11:14:24 +01:00
parent 59cd38256a
commit 0ee26c5e75
3 changed files with 10 additions and 5 deletions

View File

@ -29,7 +29,7 @@ ignore = [
] ]
select = [ select = [
'E', 'F', 'I', 'W', 'INT', 'E', 'F', 'I', 'W', 'INT',
'Q', 'UP', 'YTT', 'TID', 'C4', 'COM818', 'PIE', 'Q', 'UP', 'YTT', 'TID', 'C4', 'COM818', 'PIE', 'RET501',
'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 'RUF051', 'RUF056', # useless dict operation
@ -43,19 +43,24 @@ select = [
] ]
unfixable = ['PIE794'] unfixable = ['PIE794']
[lint.per-file-ignores] [lint.per-file-ignores]
"recipes/*" = ['UP'] "recipes/*" = ['UP']
"manual/plugin_examples/*" = ['UP'] "manual/plugin_examples/*" = ['UP']
"setup/commands.py" = ['RUF022'] "setup/commands.py" = ['RUF022']
"src/calibre/*" = ['UP031'] "src/calibre/*" = ['UP031']
"src/calibre/customize/__init__.py" = ['RET501']
"src/calibre/devices/interface.py" = ['RET501']
"src/calibre/devices/kobo/driver.py" = ['E116'] "src/calibre/devices/kobo/driver.py" = ['E116']
"src/calibre/ebooks/unihandecode/*codepoints.py" = ['E501'] "src/calibre/ebooks/unihandecode/*codepoints.py" = ['E501']
"src/calibre/ebooks/metadata/sources/*" = ['UP'] "src/calibre/ebooks/metadata/sources/*" = ['UP']
"src/calibre/ebooks/metadata/sources/base.py" = ['RET501']
"src/calibre/ebooks/pdf/reflow.py" = ['E114'] "src/calibre/ebooks/pdf/reflow.py" = ['E114']
"src/calibre/gui2/store/stores/*" = ['UP'] "src/calibre/gui2/store/stores/*" = ['UP']
"src/calibre/gui2/tts/manager.py" = ['UP037'] "src/calibre/gui2/tts/manager.py" = ['UP037']
"src/calibre/utils/copy_files.py" = ['UP037'] "src/calibre/utils/copy_files.py" = ['UP037']
"src/calibre/utils/smartypants.py" = ['RUF039', 'RUF055'] "src/calibre/utils/smartypants.py" = ['RUF039', 'RUF055']
"src/calibre/web/feeds/news.py" = ['RET501']
"src/qt/*.py" = ['I', 'E302'] "src/qt/*.py" = ['I', 'E302']
"src/qt/*.pyi" = ['I'] "src/qt/*.pyi" = ['I']

View File

@ -405,7 +405,7 @@ class IndexRecord: # {{{
def get_parent(self, index): def get_parent(self, index):
if index.depth < 1: if index.depth < 1:
return None return
parent_depth = index.depth - 1 parent_depth = index.depth - 1
for p in self.indices: for p in self.indices:
if p.depth != parent_depth: if p.depth != parent_depth:

View File

@ -610,7 +610,7 @@ class CcLongTextDelegate(StyledItemDelegate): # {{{
d = PlainTextDialog(parent, text, column_name=m.custom_columns[col]['name']) d = PlainTextDialog(parent, text, column_name=m.custom_columns[col]['name'])
if d.exec() == QDialog.DialogCode.Accepted: if d.exec() == QDialog.DialogCode.Accepted:
m.setData(index, d.text, Qt.ItemDataRole.EditRole) m.setData(index, d.text, Qt.ItemDataRole.EditRole)
return None return
def setModelData(self, editor, model, index): def setModelData(self, editor, model, index):
model.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole) model.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole)
@ -665,7 +665,7 @@ class CcMarkdownDelegate(StyledItemDelegate): # {{{
base_url=base_url) base_url=base_url)
if d.exec() == QDialog.DialogCode.Accepted: if d.exec() == QDialog.DialogCode.Accepted:
m.setData(index, (d.text), Qt.ItemDataRole.EditRole) m.setData(index, (d.text), Qt.ItemDataRole.EditRole)
return None return
def setModelData(self, editor, model, index): def setModelData(self, editor, model, index):
model.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole) model.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole)
@ -816,7 +816,7 @@ class CcCommentsDelegate(StyledItemDelegate): # {{{
d = editor.exec() d = editor.exec()
if d: if d:
m.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole) m.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole)
return None return
def setModelData(self, editor, model, index): def setModelData(self, editor, model, index):
model.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole) model.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole)