From 7fdd6bb3e426ffc39f4663559f5fda3b2044c928 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 20 Mar 2021 20:50:52 +0530 Subject: [PATCH] pep8 --- src/calibre/ebooks/conversion/plugins/html_input.py | 2 +- src/calibre/gui2/dialogs/template_dialog.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/calibre/ebooks/conversion/plugins/html_input.py b/src/calibre/ebooks/conversion/plugins/html_input.py index a4fdd05a6b..dd58af869f 100644 --- a/src/calibre/ebooks/conversion/plugins/html_input.py +++ b/src/calibre/ebooks/conversion/plugins/html_input.py @@ -25,7 +25,7 @@ def sanitize_file_name(x): for ch in '?&=;#/\\': ans = ans.replace(ch, '_') q = quote(ch, safe='') - ans = re.sub(f'\{q}', '_', ans, flags=re.I) + ans = re.sub(f'\\{q}', '_', ans, flags=re.I) ans = ans.strip().rstrip('.') ans, ext = ans.rpartition('.')[::2] return (ans.strip() + '.' + ext.strip()).rstrip('.') diff --git a/src/calibre/gui2/dialogs/template_dialog.py b/src/calibre/gui2/dialogs/template_dialog.py index aee5a63ff2..0bd30367b2 100644 --- a/src/calibre/gui2/dialogs/template_dialog.py +++ b/src/calibre/gui2/dialogs/template_dialog.py @@ -332,8 +332,8 @@ class TemplateDialog(QDialog, Ui_TemplateDialog): # Set the height of the table h = tv.rowHeight(0) * min(len(mi), 5) h += 2 * tv.frameWidth() + tv.horizontalHeader().height() - tv.setMinimumHeight(h); - tv.setMaximumHeight(h); + tv.setMinimumHeight(h) + tv.setMaximumHeight(h) # Set the size of the title column if self.table_column_widths: tv.setColumnWidth(0, self.table_column_widths[0]) @@ -416,10 +416,9 @@ class TemplateDialog(QDialog, Ui_TemplateDialog): geom = gprefs.get('template_editor_dialog_geometry', None) if geom is not None: QApplication.instance().safe_restore_geometry(self, QByteArray(geom)) - except: + except Exception: pass - def font_size_changed(self, toWhat): gprefs['gpm_template_editor_font_size'] = toWhat self.highlighter.initializeFormats()