Fix linting issues

This commit is contained in:
Raoul Snyman 2018-10-26 18:40:20 -07:00
parent ec479e589b
commit d1c4cea777
51 changed files with 87 additions and 127 deletions

View File

@ -19,10 +19,3 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from openlp.core.api.http import register_endpoint, requires_auth
from openlp.core.api.http.endpoint import Endpoint
from openlp.core.api.poll import Poller
from openlp.core.api.tab import ApiTab
__all__ = ['Endpoint', 'ApiTab', 'register_endpoint', 'requires_auth']

View File

@ -22,4 +22,3 @@
""" """
The Endpoint class, which provides plugins with a way to serve their own portion of the API The Endpoint class, which provides plugins with a way to serve their own portion of the API
""" """
from .pluginhelpers import search, live, service

View File

@ -27,7 +27,6 @@ from webob import Response
from openlp.core.api.http.wsgiapp import WSGIApplication from openlp.core.api.http.wsgiapp import WSGIApplication
from openlp.core.common.settings import Settings from openlp.core.common.settings import Settings
from .errors import NotFound, ServerError, HttpError
application = WSGIApplication('api') application = WSGIApplication('api')

View File

@ -90,7 +90,7 @@ class Poller(RegistryProperties):
if self.stage_cache is None: if self.stage_cache is None:
try: try:
page = get_web_page("http://localhost:4316/stage") page = get_web_page("http://localhost:4316/stage")
except: except Exception:
page = None page = None
if page: if page:
self.stage_cache = True self.stage_cache = True
@ -106,7 +106,7 @@ class Poller(RegistryProperties):
if self.live_cache is None: if self.live_cache is None:
try: try:
page = get_web_page("http://localhost:4316/main") page = get_web_page("http://localhost:4316/main")
except: except Exception:
page = None page = None
if page: if page:
self.live_cache = True self.live_cache = True
@ -122,7 +122,7 @@ class Poller(RegistryProperties):
if self.chords_cache is None: if self.chords_cache is None:
try: try:
page = get_web_page("http://localhost:4316/chords") page = get_web_page("http://localhost:4316/chords")
except: except Exception:
page = None page = None
if page: if page:
self.chords_cache = True self.chords_cache = True

View File

@ -522,7 +522,7 @@ def get_locale_key(string):
icu_locale = icu.Locale(language) icu_locale = icu.Locale(language)
ICU_COLLATOR = icu.Collator.createInstance(icu_locale) ICU_COLLATOR = icu.Collator.createInstance(icu_locale)
return ICU_COLLATOR.getSortKey(string) return ICU_COLLATOR.getSortKey(string)
except: except Exception:
return locale.strxfrm(string).encode() return locale.strxfrm(string).encode()

View File

@ -408,7 +408,7 @@ class Manager(object):
self.session.rollback() self.session.rollback()
log.exception('Object list save failed') log.exception('Object list save failed')
return False return False
except: except Exception:
self.session.rollback() self.session.rollback()
raise raise
@ -438,7 +438,7 @@ class Manager(object):
self.session.rollback() self.session.rollback()
log.exception('Object list save failed') log.exception('Object list save failed')
return False return False
except: except Exception:
self.session.rollback() self.session.rollback()
raise raise
@ -555,7 +555,7 @@ class Manager(object):
self.session.rollback() self.session.rollback()
log.exception('Failed to delete object') log.exception('Failed to delete object')
return False return False
except: except Exception:
self.session.rollback() self.session.rollback()
raise raise
else: else:
@ -590,7 +590,7 @@ class Manager(object):
self.session.rollback() self.session.rollback()
log.exception('Failed to delete {name} records'.format(name=object_class.__name__)) log.exception('Failed to delete {name} records'.format(name=object_class.__name__))
return False return False
except: except Exception:
self.session.rollback() self.session.rollback()
raise raise

View File

@ -39,7 +39,7 @@ from openlp.core.ui.icons import UiIcons
from openlp.core.common.mixins import RegistryProperties from openlp.core.common.mixins import RegistryProperties
from openlp.core.common.path import Path from openlp.core.common.path import Path
from openlp.core.common.settings import Settings from openlp.core.common.settings import Settings
from openlp.core.lib import ImageSource, build_icon, clean_tags, expand_tags, expand_chords from openlp.core.lib import ImageSource, clean_tags, expand_tags, expand_chords
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -470,7 +470,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
projector = list_item.data(QtCore.Qt.UserRole) projector = list_item.data(QtCore.Qt.UserRole)
try: try:
projector.link.set_shutter_closed() projector.link.set_shutter_closed()
except: except Exception:
continue continue
def on_doubleclick_item(self, item, opt=None): def on_doubleclick_item(self, item, opt=None):
@ -485,7 +485,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
try: try:
log.debug('ProjectorManager: Calling connect_to_host() on "{ip}"'.format(ip=projector.link.ip)) log.debug('ProjectorManager: Calling connect_to_host() on "{ip}"'.format(ip=projector.link.ip))
projector.link.connect_to_host() projector.link.connect_to_host()
except: except Exception:
log.debug('ProjectorManager: "{ip}" already connected - skipping'.format(ip=projector.link.ip)) log.debug('ProjectorManager: "{ip}" already connected - skipping'.format(ip=projector.link.ip))
return return
@ -504,7 +504,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
projector = list_item.data(QtCore.Qt.UserRole) projector = list_item.data(QtCore.Qt.UserRole)
try: try:
projector.link.connect_to_host() projector.link.connect_to_host()
except: except Exception:
continue continue
def on_delete_projector(self, opt=None): def on_delete_projector(self, opt=None):
@ -586,7 +586,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
projector = list_item.data(QtCore.Qt.UserRole) projector = list_item.data(QtCore.Qt.UserRole)
try: try:
projector.link.disconnect_from_host() projector.link.disconnect_from_host()
except: except Exception:
continue continue
def on_edit_projector(self, opt=None): def on_edit_projector(self, opt=None):
@ -619,7 +619,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
projector = list_item.data(QtCore.Qt.UserRole) projector = list_item.data(QtCore.Qt.UserRole)
try: try:
projector.link.set_power_off() projector.link.set_power_off()
except: except Exception:
continue continue
def on_poweron_projector(self, opt=None): def on_poweron_projector(self, opt=None):
@ -637,7 +637,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
projector = list_item.data(QtCore.Qt.UserRole) projector = list_item.data(QtCore.Qt.UserRole)
try: try:
projector.link.set_power_on() projector.link.set_power_on()
except: except Exception:
continue continue
def on_show_projector(self, opt=None): def on_show_projector(self, opt=None):
@ -655,7 +655,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
projector = list_item.data(QtCore.Qt.UserRole) projector = list_item.data(QtCore.Qt.UserRole)
try: try:
projector.link.set_shutter_open() projector.link.set_shutter_open()
except: except Exception:
continue continue
def on_status_projector(self, opt=None): def on_status_projector(self, opt=None):

View File

@ -23,7 +23,7 @@
The GUI widgets of the exception dialog. The GUI widgets of the exception dialog.
""" """
from PyQt5 import QtGui, QtWidgets from PyQt5 import QtWidgets
from openlp.core.common.i18n import translate from openlp.core.common.i18n import translate
from openlp.core.ui.icons import UiIcons from openlp.core.ui.icons import UiIcons

View File

@ -241,5 +241,5 @@ class ExceptionForm(QtWidgets.QDialog, Ui_ExceptionDialog, RegistryProperties):
return node.getByName('ooSetupVersion') return node.getByName('ooSetupVersion')
except ImportError: except ImportError:
return '-' return '-'
except: except Exception:
return '- (Possible non-standard UNO installation)' return '- (Possible non-standard UNO installation)'

View File

@ -175,7 +175,7 @@ class UiIcons(object):
import sys import sys
log.error("Unexpected error: %s" % sys.exc_info()) log.error("Unexpected error: %s" % sys.exc_info())
setattr(self, key, qta.icon('fa.plus-circle', color='red')) setattr(self, key, qta.icon('fa.plus-circle', color='red'))
except: except KeyError:
setattr(self, key, qta.icon('fa.plus-circle', color='red')) setattr(self, key, qta.icon('fa.plus-circle', color='red'))
self.main_icon = build_icon(':/icon/openlp-logo.svg') self.main_icon = build_icon(':/icon/openlp-logo.svg')

View File

@ -172,7 +172,7 @@ class MainDisplay(Display, LogMixin, RegistryProperties):
# Get a pointer to the underlying NSView # Get a pointer to the underlying NSView
try: try:
nsview_pointer = self.winId().ascapsule() nsview_pointer = self.winId().ascapsule()
except: except Exception:
nsview_pointer = voidptr(self.winId()).ascapsule() nsview_pointer = voidptr(self.winId()).ascapsule()
# Set PyCapsule name so pyobjc will accept it # Set PyCapsule name so pyobjc will accept it
pythonapi.PyCapsule_SetName.restype = c_void_p pythonapi.PyCapsule_SetName.restype = c_void_p
@ -582,7 +582,7 @@ class MainDisplay(Display, LogMixin, RegistryProperties):
window_id = window.winId().__int__() window_id = window.winId().__int__()
main_window_id = self.main_window.winId().__int__() main_window_id = self.main_window.winId().__int__()
self_id = self.winId().__int__() self_id = self.winId().__int__()
except: except Exception:
return return
# If the passed window has the same id as our window make sure the display has the proper level and # If the passed window has the same id as our window make sure the display has the proper level and
# collection behavior. # collection behavior.

View File

@ -142,10 +142,3 @@ def format_milliseconds(milliseconds):
minutes=minutes, minutes=minutes,
seconds=seconds, seconds=seconds,
millis=millis) millis=millis)
from .mediacontroller import MediaController
from .playertab import PlayerTab
from .endpoint import media_endpoint
__all__ = ['MediaController', 'PlayerTab']

View File

@ -37,7 +37,7 @@ class Track(object):
def __getattribute__(self, name): def __getattribute__(self, name):
try: try:
return object.__getattribute__(self, name) return object.__getattribute__(self, name)
except: except Exception:
pass pass
return None return None
@ -63,14 +63,14 @@ class Track(object):
try: try:
primary = o.replace('other_', '') primary = o.replace('other_', '')
setattr(self, primary, int(getattr(self, primary))) setattr(self, primary, int(getattr(self, primary)))
except: except Exception:
for v in getattr(self, o): for v in getattr(self, o):
try: try:
current = getattr(self, primary) current = getattr(self, primary)
setattr(self, primary, int(v)) setattr(self, primary, int(v))
getattr(self, o).append(current) getattr(self, o).append(current)
break break
except: except Exception:
pass pass
def __repr__(self): def __repr__(self):

View File

@ -69,7 +69,7 @@ def get_vlc():
is_vlc_available = False is_vlc_available = False
try: try:
is_vlc_available = bool(sys.modules['openlp.core.ui.media.vendor.vlc'].get_default_instance()) is_vlc_available = bool(sys.modules['openlp.core.ui.media.vendor.vlc'].get_default_instance())
except: except Exception:
pass pass
if is_vlc_available: if is_vlc_available:
return sys.modules['openlp.core.ui.media.vendor.vlc'] return sys.modules['openlp.core.ui.media.vendor.vlc']
@ -106,7 +106,7 @@ def get_vlc():
if is_vlc_available: if is_vlc_available:
try: try:
VERSION = vlc.libvlc_get_version().decode('UTF-8') VERSION = vlc.libvlc_get_version().decode('UTF-8')
except: except Exception:
VERSION = '0.0.0' VERSION = '0.0.0'
# LooseVersion does not work when a string contains letter and digits (e. g. 2.0.5 Twoflower). # LooseVersion does not work when a string contains letter and digits (e. g. 2.0.5 Twoflower).
# http://bugs.python.org/issue14894 # http://bugs.python.org/issue14894
@ -130,7 +130,7 @@ if is_linux() and 'nose' not in sys.argv[0] and get_vlc():
# If libx11.so.6 was not found, fallback to more generic libx11.so # If libx11.so.6 was not found, fallback to more generic libx11.so
x11 = ctypes.cdll.LoadLibrary('libX11.so') x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads() x11.XInitThreads()
except: except Exception:
log.exception('Failed to run XInitThreads(), VLC might not work properly!') log.exception('Failed to run XInitThreads(), VLC might not work properly!')

View File

@ -36,7 +36,7 @@ from openlp.core.common.mixins import LogMixin, RegistryProperties
from openlp.core.common.registry import Registry, RegistryBase from openlp.core.common.registry import Registry, RegistryBase
from openlp.core.common.settings import Settings from openlp.core.common.settings import Settings
from openlp.core.display.screens import ScreenList from openlp.core.display.screens import ScreenList
from openlp.core.lib import ImageSource, ServiceItemAction, build_icon from openlp.core.lib import ImageSource, ServiceItemAction
from openlp.core.lib.htmlbuilder import build_html from openlp.core.lib.htmlbuilder import build_html
from openlp.core.lib.serviceitem import ServiceItem, ItemCapabilities from openlp.core.lib.serviceitem import ServiceItem, ItemCapabilities
from openlp.core.lib.ui import create_action from openlp.core.lib.ui import create_action

View File

@ -24,11 +24,8 @@ The :mod:`openlp.core.version` module downloads the version details for OpenLP.
""" """
import logging import logging
import platform import platform
import sys
import time
from datetime import date from datetime import date
from distutils.version import LooseVersion from distutils.version import LooseVersion
from subprocess import Popen, PIPE
import requests import requests
from PyQt5 import QtCore from PyQt5 import QtCore

View File

@ -31,7 +31,6 @@ from openlp.core.common import CONTROL_CHARS
from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.i18n import UiStrings, translate
from openlp.core.common.path import Path, path_to_str, str_to_path from openlp.core.common.path import Path, path_to_str, str_to_path
from openlp.core.common.settings import Settings from openlp.core.common.settings import Settings
from openlp.core.lib import build_icon
from openlp.core.lib.formattingtags import FormattingTags from openlp.core.lib.formattingtags import FormattingTags
from openlp.core.lib.ui import create_widget_action, create_action from openlp.core.lib.ui import create_widget_action, create_action
from openlp.core.ui.icons import UiIcons from openlp.core.ui.icons import UiIcons

View File

@ -135,7 +135,7 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
# Get and validate label widget containing slide & adjust max width # Get and validate label widget containing slide & adjust max width
try: try:
self.cellWidget(row, 0).children()[1].setMaximumWidth(new_height * self.screen_ratio) self.cellWidget(row, 0).children()[1].setMaximumWidth(new_height * self.screen_ratio)
except: except Exception:
return return
def screen_size_changed(self, screen_ratio): def screen_size_changed(self, screen_ratio):

View File

@ -32,7 +32,6 @@ from openlp.core.ui.icons import UiIcons
from openlp.core.common.mixins import RegistryProperties from openlp.core.common.mixins import RegistryProperties
from openlp.core.common.registry import Registry from openlp.core.common.registry import Registry
from openlp.core.common.settings import Settings from openlp.core.common.settings import Settings
from openlp.core.lib import build_icon
from openlp.core.lib.ui import add_welcome_page from openlp.core.lib.ui import add_welcome_page
from openlp.core.widgets.dialogs import FileDialog from openlp.core.widgets.dialogs import FileDialog

View File

@ -22,7 +22,6 @@
import json import json
import logging import logging
import urllib import urllib
from urllib.parse import urlparse
from openlp.core.api.http import requires_auth from openlp.core.api.http import requires_auth
from openlp.core.api.http.endpoint import Endpoint from openlp.core.api.http.endpoint import Endpoint

View File

@ -40,5 +40,3 @@ mentioned above, like so::
This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality, This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality,
so that it is easier to recreate the GUI from the .ui files later if necessary. so that it is easier to recreate the GUI from the .ui files later if necessary.
""" """
from .alertform import AlertForm

View File

@ -19,6 +19,3 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from .alertsmanager import AlertsManager
from .alertstab import AlertsTab

View File

@ -31,7 +31,7 @@ from lxml import etree
try: try:
from pysword import modules from pysword import modules
PYSWORD_AVAILABLE = True PYSWORD_AVAILABLE = True
except: except ImportError:
PYSWORD_AVAILABLE = False PYSWORD_AVAILABLE = False
from openlp.core.common import trace_error_handler from openlp.core.common import trace_error_handler
@ -613,7 +613,7 @@ class BibleImportForm(OpenLPWizard):
self.sword_bible_combo_box.clear() self.sword_bible_combo_box.clear()
for key in bible_keys: for key in bible_keys:
self.sword_bible_combo_box.addItem(self.pysword_folder_modules_json[key]['description'], key) self.sword_bible_combo_box.addItem(self.pysword_folder_modules_json[key]['description'], key)
except: except Exception:
self.sword_bible_combo_box.clear() self.sword_bible_combo_box.clear()
def on_sword_zipfile_path_edit_path_changed(self, new_path): def on_sword_zipfile_path_edit_path_changed(self, new_path):
@ -628,7 +628,7 @@ class BibleImportForm(OpenLPWizard):
self.sword_zipbible_combo_box.clear() self.sword_zipbible_combo_box.clear()
for key in bible_keys: for key in bible_keys:
self.sword_zipbible_combo_box.addItem(self.pysword_zip_modules_json[key]['description'], key) self.sword_zipbible_combo_box.addItem(self.pysword_zip_modules_json[key]['description'], key)
except: except Exception:
self.sword_zipbible_combo_box.clear() self.sword_zipbible_combo_box.clear()
def register_fields(self): def register_fields(self):

View File

@ -38,7 +38,7 @@ from .importers.zefania import ZefaniaBible
try: try:
from .importers.sword import SwordBible from .importers.sword import SwordBible
except: except ImportError:
pass pass
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -19,8 +19,3 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from .mediaitem import MediaMediaItem
from .mediatab import MediaTab
__all__ = ['MediaMediaItem']

View File

@ -121,7 +121,7 @@ class ImpressController(PresentationController):
while uno_instance is None and loop < 3: while uno_instance is None and loop < 3:
try: try:
uno_instance = get_uno_instance(resolver) uno_instance = get_uno_instance(resolver)
except: except Exception:
log.warning('Unable to find running instance ') log.warning('Unable to find running instance ')
self.start_process() self.start_process()
loop += 1 loop += 1
@ -130,7 +130,7 @@ class ImpressController(PresentationController):
log.debug('get UNO Desktop Openoffice - createInstanceWithContext - Desktop') log.debug('get UNO Desktop Openoffice - createInstanceWithContext - Desktop')
desktop = self.manager.createInstanceWithContext("com.sun.star.frame.Desktop", uno_instance) desktop = self.manager.createInstanceWithContext("com.sun.star.frame.Desktop", uno_instance)
return desktop return desktop
except: except Exception:
log.warning('Failed to get UNO desktop') log.warning('Failed to get UNO desktop')
return None return None
@ -172,7 +172,7 @@ class ImpressController(PresentationController):
desktop = self.get_uno_desktop() desktop = self.get_uno_desktop()
else: else:
desktop = self.get_com_desktop() desktop = self.get_com_desktop()
except: except Exception:
log.warning('Failed to find an OpenOffice desktop to terminate') log.warning('Failed to find an OpenOffice desktop to terminate')
if not desktop: if not desktop:
return return
@ -190,7 +190,7 @@ class ImpressController(PresentationController):
try: try:
desktop.terminate() desktop.terminate()
log.debug('OpenOffice killed') log.debug('OpenOffice killed')
except: except Exception:
log.warning('Failed to terminate OpenOffice') log.warning('Failed to terminate OpenOffice')
@ -235,7 +235,7 @@ class ImpressDocument(PresentationDocument):
properties = tuple(properties) properties = tuple(properties)
try: try:
self.document = desktop.loadComponentFromURL(url, '_blank', 0, properties) self.document = desktop.loadComponentFromURL(url, '_blank', 0, properties)
except: except Exception:
log.warning('Failed to load presentation {url}'.format(url=url)) log.warning('Failed to load presentation {url}'.format(url=url))
return False return False
self.presentation = self.document.getPresentation() self.presentation = self.document.getPresentation()
@ -274,7 +274,7 @@ class ImpressDocument(PresentationDocument):
delete_file(path) delete_file(path)
except ErrorCodeIOException as exception: except ErrorCodeIOException as exception:
log.exception('ERROR! ErrorCodeIOException {error:d}'.format(error=exception.ErrCode)) log.exception('ERROR! ErrorCodeIOException {error:d}'.format(error=exception.ErrCode))
except: except Exception:
log.exception('{path} - Unable to store openoffice preview'.format(path=path)) log.exception('{path} - Unable to store openoffice preview'.format(path=path))
def create_property(self, name, value): def create_property(self, name, value):
@ -302,7 +302,7 @@ class ImpressDocument(PresentationDocument):
self.presentation.end() self.presentation.end()
self.presentation = None self.presentation = None
self.document.dispose() self.document.dispose()
except: except Exception:
log.warning("Closing presentation failed") log.warning("Closing presentation failed")
self.document = None self.document = None
self.controller.remove_doc(self) self.controller.remove_doc(self)
@ -319,7 +319,7 @@ class ImpressDocument(PresentationDocument):
if self.document.getPresentation() is None: if self.document.getPresentation() is None:
log.debug("getPresentation failed to find a presentation") log.debug("getPresentation failed to find a presentation")
return False return False
except: except Exception:
log.warning("getPresentation failed to find a presentation") log.warning("getPresentation failed to find a presentation")
return False return False
return True return True

View File

@ -326,14 +326,14 @@ class PresentationDocument(object):
titles_path = self.get_thumbnail_folder() / 'titles.txt' titles_path = self.get_thumbnail_folder() / 'titles.txt'
try: try:
titles = titles_path.read_text().splitlines() titles = titles_path.read_text().splitlines()
except: except Exception:
log.exception('Failed to open/read existing titles file') log.exception('Failed to open/read existing titles file')
titles = [] titles = []
for slide_no, title in enumerate(titles, 1): for slide_no, title in enumerate(titles, 1):
notes_path = self.get_thumbnail_folder() / 'slideNotes{number:d}.txt'.format(number=slide_no) notes_path = self.get_thumbnail_folder() / 'slideNotes{number:d}.txt'.format(number=slide_no)
try: try:
note = notes_path.read_text() note = notes_path.read_text()
except: except Exception:
log.exception('Failed to open/read notes file') log.exception('Failed to open/read notes file')
note = '' note = ''
notes.append(note) notes.append(note)

View File

@ -319,7 +319,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
for verse in multiple: for verse in multiple:
self.song.verse_order = re.sub(r'([' + verse.upper() + verse.lower() + r'])(\W|$)', self.song.verse_order = re.sub(r'([' + verse.upper() + verse.lower() + r'])(\W|$)',
r'\g<1>1\2', self.song.verse_order) r'\g<1>1\2', self.song.verse_order)
except: except Exception:
log.exception('Problem processing song Lyrics \n{xml}'.format(xml=sxml.dump_xml())) log.exception('Problem processing song Lyrics \n{xml}'.format(xml=sxml.dump_xml()))
raise raise
@ -1087,7 +1087,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
if audio_path not in file_paths: if audio_path not in file_paths:
try: try:
audio_path.unlink() audio_path.unlink()
except: except Exception:
log.exception('Could not remove file: {audio}'.format(audio=audio_path)) log.exception('Could not remove file: {audio}'.format(audio=audio_path))
if not file_paths: if not file_paths:
try: try:

View File

@ -134,7 +134,7 @@ class OpenOfficeImport(SongImport):
process = QtCore.QProcess() process = QtCore.QProcess()
process.startDetached(cmd) process.startDetached(cmd)
self.process_started = True self.process_started = True
except: except Exception:
log.exception("start_ooo_process failed") log.exception("start_ooo_process failed")
def open_ooo_file(self, file_path): def open_ooo_file(self, file_path):
@ -176,7 +176,7 @@ class OpenOfficeImport(SongImport):
""" """
try: try:
self.document.close(True) self.document.close(True)
except: except Exception:
log.exception('Exception in close_ooo_file - trying to ignore it.') log.exception('Exception in close_ooo_file - trying to ignore it.')
self.document = None self.document = None
@ -187,7 +187,7 @@ class OpenOfficeImport(SongImport):
if self.process_started: if self.process_started:
try: try:
self.desktop.terminate() self.desktop.terminate()
except: except Exception:
log.exception('Exception in close_ooo - trying to ignore it.') log.exception('Exception in close_ooo - trying to ignore it.')
def process_presentation(self): def process_presentation(self):

View File

@ -223,5 +223,5 @@ class SongShowPlusImport(SongImport):
try: try:
# Don't question this, it works... # Don't question this, it works...
return data.decode('utf-8').encode('cp1251').decode('cp1251') return data.decode('utf-8').encode('cp1251').decode('cp1251')
except: except Exception:
return data.decode(retrieve_windows_encoding()) return data.decode(retrieve_windows_encoding())

View File

@ -24,7 +24,6 @@ This module contains tests for the lib submodule of the Remotes plugin.
""" """
import re import re
from unittest import TestCase from unittest import TestCase
from unittest.mock import patch
from PyQt5 import QtWidgets from PyQt5 import QtWidgets

View File

@ -63,7 +63,7 @@ class TestUtilsDBFunctions(TestCase):
if os.path.exists(self.tmp_folder): if os.path.exists(self.tmp_folder):
shutil.rmtree(self.tmp_folder) shutil.rmtree(self.tmp_folder)
break break
except: except Exception:
time.sleep(1) time.sleep(1)
retries += 1 retries += 1

View File

@ -397,7 +397,7 @@ class TestPath(TestCase):
try: try:
create_paths(mocked_path) create_paths(mocked_path)
assert False, 'create_paths should have thrown an exception' assert False, 'create_paths should have thrown an exception'
except: except Exception:
# THEN: `create_paths` raises an exception # THEN: `create_paths` raises an exception
pass pass

View File

@ -280,7 +280,7 @@ class TestLib(TestCase):
# last test. # last test.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
# Only continue when the thumb does not exist. # Only continue when the thumb does not exist.
@ -298,7 +298,7 @@ class TestLib(TestCase):
# Remove the thumb so that the test actually tests if the thumb will be created. # Remove the thumb so that the test actually tests if the thumb will be created.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
def test_create_thumb_no_size(self): def test_create_thumb_no_size(self):
@ -314,7 +314,7 @@ class TestLib(TestCase):
# last test. # last test.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
# Only continue when the thumb does not exist. # Only continue when the thumb does not exist.
@ -332,7 +332,7 @@ class TestLib(TestCase):
# Remove the thumb so that the test actually tests if the thumb will be created. # Remove the thumb so that the test actually tests if the thumb will be created.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
def test_create_thumb_invalid_size(self): def test_create_thumb_invalid_size(self):
@ -349,7 +349,7 @@ class TestLib(TestCase):
# last test. # last test.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
# Only continue when the thumb does not exist. # Only continue when the thumb does not exist.
@ -367,7 +367,7 @@ class TestLib(TestCase):
# Remove the thumb so that the test actually tests if the thumb will be created. # Remove the thumb so that the test actually tests if the thumb will be created.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
def test_create_thumb_width_only(self): def test_create_thumb_width_only(self):
@ -384,7 +384,7 @@ class TestLib(TestCase):
# last test. # last test.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
# Only continue when the thumb does not exist. # Only continue when the thumb does not exist.
@ -402,7 +402,7 @@ class TestLib(TestCase):
# Remove the thumb so that the test actually tests if the thumb will be created. # Remove the thumb so that the test actually tests if the thumb will be created.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
def test_create_thumb_height_only(self): def test_create_thumb_height_only(self):
@ -419,7 +419,7 @@ class TestLib(TestCase):
# last test. # last test.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
# Only continue when the thumb does not exist. # Only continue when the thumb does not exist.
@ -437,7 +437,7 @@ class TestLib(TestCase):
# Remove the thumb so that the test actually tests if the thumb will be created. # Remove the thumb so that the test actually tests if the thumb will be created.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
def test_create_thumb_empty_img(self): def test_create_thumb_empty_img(self):
@ -455,7 +455,7 @@ class TestLib(TestCase):
# last test. # last test.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
# Only continue when the thumb does not exist. # Only continue when the thumb does not exist.
@ -485,7 +485,7 @@ class TestLib(TestCase):
# Remove the thumb so that the test actually tests if the thumb will be created. # Remove the thumb so that the test actually tests if the thumb will be created.
try: try:
thumb_path.unlink() thumb_path.unlink()
except: except Exception:
pass pass
def test_check_item_selected_true(self): def test_check_item_selected_true(self):

View File

@ -412,7 +412,7 @@ class TestVLCPlayer(TestCase, TestMixin):
# WHEN: An audio CD is loaded into VLC # WHEN: An audio CD is loaded into VLC
with patch.object(vlc_player, 'volume') as mocked_volume, \ with patch.object(vlc_player, 'volume') as mocked_volume, \
patch.object(vlc_player, 'media_state_wait') as mocked_media_state_wait: patch.object(vlc_player, 'media_state_wait'):
result = vlc_player.load(mocked_display) result = vlc_player.load(mocked_display)
# THEN: The video should be loaded # THEN: The video should be loaded
@ -457,7 +457,7 @@ class TestVLCPlayer(TestCase, TestMixin):
# WHEN: An audio CD is loaded into VLC # WHEN: An audio CD is loaded into VLC
with patch.object(vlc_player, 'volume') as mocked_volume, \ with patch.object(vlc_player, 'volume') as mocked_volume, \
patch.object(vlc_player, 'media_state_wait') as mocked_media_state_wait: patch.object(vlc_player, 'media_state_wait'):
result = vlc_player.load(mocked_display) result = vlc_player.load(mocked_display)
# THEN: The video should be loaded # THEN: The video should be loaded
@ -501,8 +501,7 @@ class TestVLCPlayer(TestCase, TestMixin):
vlc_player = VlcPlayer(None) vlc_player = VlcPlayer(None)
# WHEN: An audio CD is loaded into VLC # WHEN: An audio CD is loaded into VLC
with patch.object(vlc_player, 'volume') as mocked_volume, \ with patch.object(vlc_player, 'volume'), patch.object(vlc_player, 'media_state_wait'):
patch.object(vlc_player, 'media_state_wait') as mocked_media_state_wait:
result = vlc_player.load(mocked_display) result = vlc_player.load(mocked_display)
# THEN: The video should be loaded # THEN: The video should be loaded
@ -657,7 +656,7 @@ class TestVLCPlayer(TestCase, TestMixin):
# WHEN: play() is called # WHEN: play() is called
with patch.object(vlc_player, 'media_state_wait') as mocked_media_state_wait, \ with patch.object(vlc_player, 'media_state_wait') as mocked_media_state_wait, \
patch.object(vlc_player, 'volume') as mocked_volume: patch.object(vlc_player, 'volume'):
mocked_media_state_wait.return_value = False mocked_media_state_wait.return_value = False
result = vlc_player.play(mocked_display) result = vlc_player.play(mocked_display)
@ -690,7 +689,7 @@ class TestVLCPlayer(TestCase, TestMixin):
vlc_player.set_state(MediaState.Paused, mocked_display) vlc_player.set_state(MediaState.Paused, mocked_display)
# WHEN: play() is called # WHEN: play() is called
with patch.object(vlc_player, 'media_state_wait', return_value=True) as mocked_media_state_wait, \ with patch.object(vlc_player, 'media_state_wait', return_value=True), \
patch.object(vlc_player, 'volume') as mocked_volume, \ patch.object(vlc_player, 'volume') as mocked_volume, \
patch.object(vlc_player, 'get_live_state', return_value=MediaState.Loaded): patch.object(vlc_player, 'get_live_state', return_value=MediaState.Loaded):
result = vlc_player.play(mocked_display) result = vlc_player.play(mocked_display)

View File

@ -22,8 +22,8 @@
""" """
Package to test the openlp.core.ui.icons package. Package to test the openlp.core.ui.icons package.
""" """
from unittest import TestCase, skipUnless from unittest import TestCase
from unittest.mock import MagicMock, patch from unittest.mock import patch
from PyQt5 import QtGui from PyQt5 import QtGui

View File

@ -172,7 +172,7 @@ class TestMainDisplay(TestCase, TestMixin):
main_display = MainDisplay(display) main_display = MainDisplay(display)
try: try:
nsview_pointer = main_display.winId().ascapsule() nsview_pointer = main_display.winId().ascapsule()
except: except Exception:
nsview_pointer = voidptr(main_display.winId()).ascapsule() nsview_pointer = voidptr(main_display.winId()).ascapsule()
pythonapi.PyCapsule_SetName.restype = c_void_p pythonapi.PyCapsule_SetName.restype = c_void_p
pythonapi.PyCapsule_SetName.argtypes = [py_object, c_char_p] pythonapi.PyCapsule_SetName.argtypes = [py_object, c_char_p]

View File

@ -22,7 +22,6 @@
""" """
Package to test the openlp.core.ui.slidecontroller package. Package to test the openlp.core.ui.slidecontroller package.
""" """
import os
from unittest import TestCase from unittest import TestCase
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch

View File

@ -55,7 +55,7 @@ class TestLib(TestCase, TestMixin):
# WHEN: Calling get_reference_separator # WHEN: Calling get_reference_separator
for key, value in separators.items(): for key, value in separators.items():
_ = lib.get_reference_separator(key) lib.get_reference_separator(key)
# THEN: get_reference_separator should return the correct separator # THEN: get_reference_separator should return the correct separator
assert separators[key] == value assert separators[key] == value

View File

@ -756,7 +756,7 @@ class TestMediaItem(TestCase, TestMixin):
# GIVEN: An instance of :class:`MediaManagerItem` and mocked media_item.settings and select_book_combo_box # GIVEN: An instance of :class:`MediaManagerItem` and mocked media_item.settings and select_book_combo_box
self.media_item.version_combo_box = MagicMock(**{'currentData.return_value': None}) self.media_item.version_combo_box = MagicMock(**{'currentData.return_value': None})
self.media_item.select_book_combo_box = MagicMock() self.media_item.select_book_combo_box = MagicMock()
with patch.object(self.media_item, 'initialise_advanced_bible') as mocked_initialise_advanced_bible: with patch.object(self.media_item, 'initialise_advanced_bible'):
# WHEN: Calling on_version_combo_box_index_changed # WHEN: Calling on_version_combo_box_index_changed
self.media_item.on_version_combo_box_index_changed() self.media_item.on_version_combo_box_index_changed()
@ -774,7 +774,7 @@ class TestMediaItem(TestCase, TestMixin):
mocked_bible_db.name = 'ABC' mocked_bible_db.name = 'ABC'
self.media_item.version_combo_box = MagicMock(**{'currentData.return_value': mocked_bible_db}) self.media_item.version_combo_box = MagicMock(**{'currentData.return_value': mocked_bible_db})
self.media_item.select_book_combo_box = MagicMock() self.media_item.select_book_combo_box = MagicMock()
with patch.object(self.media_item, 'initialise_advanced_bible') as mocked_initialise_advanced_bible: with patch.object(self.media_item, 'initialise_advanced_bible'):
# WHEN: Calling on_version_combo_box_index_changed # WHEN: Calling on_version_combo_box_index_changed
self.media_item.on_version_combo_box_index_changed() self.media_item.on_version_combo_box_index_changed()
@ -792,7 +792,7 @@ class TestMediaItem(TestCase, TestMixin):
self.media_item.list_view = MagicMock(**{'count.return_value': 5}) self.media_item.list_view = MagicMock(**{'count.return_value': 5})
self.media_item.style_combo_box = MagicMock() self.media_item.style_combo_box = MagicMock()
self.media_item.select_book_combo_box = MagicMock() self.media_item.select_book_combo_box = MagicMock()
with patch.object(self.media_item, 'initialise_advanced_bible') as mocked_initialise_advanced_bible, \ with patch.object(self.media_item, 'initialise_advanced_bible'), \
patch('openlp.plugins.bibles.lib.mediaitem.critical_error_message_box') \ patch('openlp.plugins.bibles.lib.mediaitem.critical_error_message_box') \
as mocked_critical_error_message_box: as mocked_critical_error_message_box:
@ -815,7 +815,7 @@ class TestMediaItem(TestCase, TestMixin):
self.media_item.list_view = MagicMock(**{'count.return_value': 5}) self.media_item.list_view = MagicMock(**{'count.return_value': 5})
self.media_item.style_combo_box = MagicMock() self.media_item.style_combo_box = MagicMock()
self.media_item.select_book_combo_box = MagicMock() self.media_item.select_book_combo_box = MagicMock()
with patch.object(self.media_item, 'initialise_advanced_bible') as mocked_initialise_advanced_bible, \ with patch.object(self.media_item, 'initialise_advanced_bible'), \
patch('openlp.plugins.bibles.lib.mediaitem.critical_error_message_box', patch('openlp.plugins.bibles.lib.mediaitem.critical_error_message_box',
return_value=QtWidgets.QMessageBox.No) as mocked_critical_error_message_box: return_value=QtWidgets.QMessageBox.No) as mocked_critical_error_message_box:

View File

@ -22,14 +22,12 @@
""" """
This module contains tests for the upgrade submodule of the Bibles plugin. This module contains tests for the upgrade submodule of the Bibles plugin.
""" """
import os
import shutil import shutil
from pathlib import Path from pathlib import Path
from tempfile import mkdtemp from tempfile import mkdtemp
from unittest import TestCase from unittest import TestCase
from unittest.mock import MagicMock, call, patch from unittest.mock import MagicMock, call, patch
from PyQt5 import QtWidgets
from sqlalchemy import create_engine from sqlalchemy import create_engine
from openlp.core.common.settings import ProxyMode from openlp.core.common.settings import ProxyMode

View File

@ -27,7 +27,6 @@ from tempfile import mkdtemp
from unittest import TestCase from unittest import TestCase
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
from openlp.core.common.path import Path
from openlp.core.common.settings import Settings from openlp.core.common.settings import Settings
from openlp.plugins.presentations.lib.impresscontroller import ImpressController, ImpressDocument, TextType from openlp.plugins.presentations.lib.impresscontroller import ImpressController, ImpressDocument, TextType
from openlp.plugins.presentations.presentationplugin import __default_settings__ from openlp.plugins.presentations.presentationplugin import __default_settings__

View File

@ -313,7 +313,7 @@ class TestLib(TestCase):
# WHEN: Transposing it 1 down # WHEN: Transposing it 1 down
# THEN: An exception should be raised # THEN: An exception should be raised
with self.assertRaises(ValueError) as err: with self.assertRaises(ValueError) as err:
new_chord = transpose_chord(chord, -1, 'english') transpose_chord(chord, -1, 'english')
assert err.exception.args[0] == '\'T\' is not in list', \ assert err.exception.args[0] == '\'T\' is not in list', \
'ValueError exception should have been thrown for invalid chord' 'ValueError exception should have been thrown for invalid chord'

View File

@ -99,7 +99,7 @@ class TestMediaShoutImport(TestCase):
mocked_pyodbc.connect.return_value = mocked_connection mocked_pyodbc.connect.return_value = mocked_connection
# WHEN: do_import is called # WHEN: do_import is called
with patch.object(importer, 'import_wizard') as mocked_import_wizard, \ with patch.object(importer, 'import_wizard'), \
patch.object(importer, 'process_song') as mocked_process_song: patch.object(importer, 'process_song') as mocked_process_song:
importer.do_import() importer.do_import()
@ -133,7 +133,7 @@ class TestMediaShoutImport(TestCase):
mocked_pyodbc.connect.return_value = mocked_connection mocked_pyodbc.connect.return_value = mocked_connection
# WHEN: do_import is called, but cancelled # WHEN: do_import is called, but cancelled
with patch.object(importer, 'import_wizard') as mocked_import_wizard, \ with patch.object(importer, 'import_wizard'), \
patch.object(importer, 'process_song') as mocked_process_song: patch.object(importer, 'process_song') as mocked_process_song:
importer.stop_import_flag = True importer.stop_import_flag = True
importer.do_import() importer.do_import()

View File

@ -25,7 +25,6 @@ Functional tests to test the AppLocation class and related methods.
from unittest import TestCase from unittest import TestCase
from openlp.core.common import is_not_image_file from openlp.core.common import is_not_image_file
from openlp.core.common.path import Path
from tests.utils.constants import RESOURCE_PATH from tests.utils.constants import RESOURCE_PATH
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin

View File

@ -46,7 +46,6 @@ class TestBibleImportForm(TestCase, TestMixin):
self.setup_application() self.setup_application()
self.main_window = QtWidgets.QMainWindow() self.main_window = QtWidgets.QMainWindow()
Registry().register('main_window', self.main_window) Registry().register('main_window', self.main_window)
PYSWORD_AVAILABLE = False
self.mocked_manager = MagicMock() self.mocked_manager = MagicMock()
self.form = BibleImportForm(self.main_window, self.mocked_manager, MagicMock()) self.form = BibleImportForm(self.main_window, self.mocked_manager, MagicMock())

View File

@ -84,7 +84,7 @@ class TestEditCustomForm(TestCase, TestMixin):
Test the on_add_button_clicked_test method / add_button button. Test the on_add_button_clicked_test method / add_button button.
""" """
# GIVEN: A mocked QDialog.exec() method # GIVEN: A mocked QDialog.exec() method
with patch('PyQt5.QtWidgets.QDialog.exec') as mocked_exec: with patch('PyQt5.QtWidgets.QDialog.exec'):
# WHEN: Add a new slide. # WHEN: Add a new slide.
QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton) QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton)

View File

@ -58,7 +58,7 @@ class TestEditCustomSlideForm(TestCase, TestMixin):
Test if the dialog is correctly set up. Test if the dialog is correctly set up.
""" """
# GIVEN: A mocked QDialog.exec() method # GIVEN: A mocked QDialog.exec() method
with patch('PyQt5.QtWidgets.QDialog.exec') as mocked_exec: with patch('PyQt5.QtWidgets.QDialog.exec'):
# WHEN: Show the dialog. # WHEN: Show the dialog.
self.form.exec() self.form.exec()
@ -70,7 +70,7 @@ class TestEditCustomSlideForm(TestCase, TestMixin):
Test the set_text() method. Test the set_text() method.
""" """
# GIVEN: A mocked QDialog.exec() method # GIVEN: A mocked QDialog.exec() method
with patch('PyQt5.QtWidgets.QDialog.exec') as mocked_exec: with patch('PyQt5.QtWidgets.QDialog.exec'):
mocked_set_focus = MagicMock() mocked_set_focus = MagicMock()
self.form.slide_text_edit.setFocus = mocked_set_focus self.form.slide_text_edit.setFocus = mocked_set_focus
wanted_text = 'THIS TEXT SHOULD BE SHOWN.' wanted_text = 'THIS TEXT SHOULD BE SHOWN.'

View File

@ -79,7 +79,7 @@ class TestMediaClipSelectorForm(TestCase, TestMixin):
Test if the dialog is correctly set up. Test if the dialog is correctly set up.
""" """
# GIVEN: A mocked QDialog.exec() method # GIVEN: A mocked QDialog.exec() method
with patch('PyQt5.QtWidgets.QDialog.exec') as mocked_exec: with patch('PyQt5.QtWidgets.QDialog.exec'):
# WHEN: Show the dialog. # WHEN: Show the dialog.
self.form.exec() self.form.exec()
@ -94,7 +94,7 @@ class TestMediaClipSelectorForm(TestCase, TestMixin):
with patch('openlp.plugins.media.forms.mediaclipselectorform.critical_error_message_box') as \ with patch('openlp.plugins.media.forms.mediaclipselectorform.critical_error_message_box') as \
mocked_critical_error_message_box,\ mocked_critical_error_message_box,\
patch('openlp.plugins.media.forms.mediaclipselectorform.os.path.exists') as mocked_os_path_exists,\ patch('openlp.plugins.media.forms.mediaclipselectorform.os.path.exists') as mocked_os_path_exists,\
patch('PyQt5.QtWidgets.QDialog.exec') as mocked_exec: patch('PyQt5.QtWidgets.QDialog.exec'):
self.form.exec() self.form.exec()
# WHEN: The load button is clicked with no path set # WHEN: The load button is clicked with no path set
@ -132,7 +132,7 @@ class TestMediaClipSelectorForm(TestCase, TestMixin):
Test the behavior when the title combobox is updated Test the behavior when the title combobox is updated
""" """
# GIVEN: Mocked methods and some entries in the title combobox. # GIVEN: Mocked methods and some entries in the title combobox.
with patch('PyQt5.QtWidgets.QDialog.exec') as mocked_exec: with patch('PyQt5.QtWidgets.QDialog.exec'):
self.form.exec() self.form.exec()
self.form.vlc_media_player.get_length.return_value = 1000 self.form.vlc_media_player.get_length.return_value = 1000
self.form.audio_tracks_combobox.itemData = MagicMock() self.form.audio_tracks_combobox.itemData = MagicMock()
@ -161,7 +161,7 @@ class TestMediaClipSelectorForm(TestCase, TestMixin):
# GIVEN: Mocked methods. # GIVEN: Mocked methods.
with patch('openlp.plugins.media.forms.mediaclipselectorform.critical_error_message_box') as \ with patch('openlp.plugins.media.forms.mediaclipselectorform.critical_error_message_box') as \
mocked_critical_error_message_box,\ mocked_critical_error_message_box,\
patch('PyQt5.QtWidgets.QDialog.exec') as mocked_exec: patch('PyQt5.QtWidgets.QDialog.exec'):
self.form.exec() self.form.exec()
# WHEN: The save button is clicked with a NoneType in start_time_ms or end_time_ms # WHEN: The save button is clicked with a NoneType in start_time_ms or end_time_ms

View File

@ -91,7 +91,7 @@ class ProjectorSourceFormTest(TestCase, TestMixin):
if os.path.exists(TEST_DB): if os.path.exists(TEST_DB):
os.unlink(TEST_DB) os.unlink(TEST_DB)
break break
except: except Exception:
time.sleep(1) time.sleep(1)
retries += 1 retries += 1
self.destroy_settings() self.destroy_settings()