From e9e845035a5c6f054b6aa59fb4b0e82914d54ecd Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sat, 9 Jan 2016 10:09:29 +0100 Subject: [PATCH] pep8 fixes --- openlp/core/common/settings.py | 9 ++++++--- openlp/plugins/custom/lib/mediaitem.py | 2 +- openlp/plugins/songs/lib/importers/sundayplus.py | 6 ++++-- setup.cfg | 2 +- .../functional/openlp_core_lib/test_mediamanageritem.py | 1 - tests/functional/openlp_core_lib/test_projectordb.py | 1 - tests/functional/openlp_plugins/songs/test_songformat.py | 1 - .../openlp_plugins/songs/test_sundayplusimport.py | 2 +- tests/helpers/testmixin.py | 2 +- .../interfaces/openlp_core_ui/test_projectoreditform.py | 2 -- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/openlp/core/common/settings.py b/openlp/core/common/settings.py index 0bedd69b6..68b0763df 100644 --- a/openlp/core/common/settings.py +++ b/openlp/core/common/settings.py @@ -252,7 +252,8 @@ class Settings(QtCore.QSettings): 'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key_Period)], 'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key_Minus)], 'shortcuts/desktopScreen': [QtGui.QKeySequence(QtCore.Qt.Key_D)], - 'shortcuts/delete': [QtGui.QKeySequence(QtGui.QKeySequence.Delete), QtGui.QKeySequence(QtCore.Qt.Key_Delete)], + 'shortcuts/delete': [QtGui.QKeySequence(QtGui.QKeySequence.Delete), + QtGui.QKeySequence(QtCore.Qt.Key_Delete)], 'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key_Down)], 'shortcuts/editSong': [], 'shortcuts/escapeItem': [QtGui.QKeySequence(QtCore.Qt.Key_Escape)], @@ -329,7 +330,8 @@ class Settings(QtCore.QSettings): 'shortcuts/moveBottom': [QtGui.QKeySequence(QtCore.Qt.Key_End)], 'shortcuts/moveDown': [QtGui.QKeySequence(QtCore.Qt.Key_PageDown)], 'shortcuts/nextTrackItem': [], - 'shortcuts/nextItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Down), QtGui.QKeySequence(QtCore.Qt.Key_PageDown)], + 'shortcuts/nextItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Down), + QtGui.QKeySequence(QtCore.Qt.Key_PageDown)], 'shortcuts/nextItem_preview': [QtGui.QKeySequence(QtCore.Qt.Key_Down), QtGui.QKeySequence(QtCore.Qt.Key_PageDown)], 'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key_Right)], @@ -339,7 +341,8 @@ class Settings(QtCore.QSettings): QtGui.QKeySequence(QtCore.Qt.ALT + QtCore.Qt.Key_F1)], 'shortcuts/openService': [], 'shortcuts/saveService': [], - 'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up), QtGui.QKeySequence(QtCore.Qt.Key_PageUp)], + 'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up), + QtGui.QKeySequence(QtCore.Qt.Key_PageUp)], 'shortcuts/playbackPause': [], 'shortcuts/playbackPlay': [], 'shortcuts/playbackStop': [], diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index b5b536603..225226f7d 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -190,7 +190,7 @@ class CustomMediaItem(MediaManagerItem): if QtWidgets.QMessageBox.question( self, UiStrings().ConfirmDelete, translate('CustomPlugin.MediaItem', - 'Are you sure you want to delete the "%d" selected custom slide(s)?') %len(items), + 'Are you sure you want to delete the "%d" selected custom slide(s)?') % len(items), QtWidgets.QMessageBox.StandardButtons( QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No), QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.No: diff --git a/openlp/plugins/songs/lib/importers/sundayplus.py b/openlp/plugins/songs/lib/importers/sundayplus.py index 7d42b9aa1..1f10004e7 100644 --- a/openlp/plugins/songs/lib/importers/sundayplus.py +++ b/openlp/plugins/songs/lib/importers/sundayplus.py @@ -22,6 +22,8 @@ import os import re +import logging + from openlp.plugins.songs.lib import VerseType, retrieve_windows_encoding from openlp.plugins.songs.lib import strip_rtf @@ -86,8 +88,8 @@ class SundayPlusImport(SongImport): :param cell: ? :return: """ - if cell == False and (len(data) == 0 or data[0:1] != b'[' or data.strip()[-1:] != b']'): - log.log_error('File is malformed') + if not cell and (len(data) == 0 or data[0:1] != b'[' or data.strip()[-1:] != b']'): + self.log_error('File is malformed') return False i = 1 verse_type = VerseType.tags[VerseType.Verse] diff --git a/setup.cfg b/setup.cfg index 2abc34df1..79cf971a0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,4 @@ [pep8] exclude=resources.py,vlc.py max-line-length = 120 -ignore = E402 +ignore = E402,W503,E128 diff --git a/tests/functional/openlp_core_lib/test_mediamanageritem.py b/tests/functional/openlp_core_lib/test_mediamanageritem.py index a3674f591..892b67f2d 100644 --- a/tests/functional/openlp_core_lib/test_mediamanageritem.py +++ b/tests/functional/openlp_core_lib/test_mediamanageritem.py @@ -75,7 +75,6 @@ class TestMediaManagerItem(TestCase, TestMixin): self.assertTrue(mmi.has_delete_icon, 'By default a delete icon should be present') self.assertFalse(mmi.add_to_service_item, 'There should be no add_to_service icon by default') - @patch(u'openlp.core.lib.mediamanageritem.Settings') @patch(u'openlp.core.lib.mediamanageritem.MediaManagerItem.on_live_click') def on_double_clicked_go_live_test(self, mocked_on_live_click, MockedSettings): diff --git a/tests/functional/openlp_core_lib/test_projectordb.py b/tests/functional/openlp_core_lib/test_projectordb.py index 3559e9e8c..58eff13bc 100644 --- a/tests/functional/openlp_core_lib/test_projectordb.py +++ b/tests/functional/openlp_core_lib/test_projectordb.py @@ -185,4 +185,3 @@ class TestProjectorDB(TestCase): # THEN: Projector should have the same source entry item = self.projector.get_projector_by_id(item_id) self.assertTrue(compare_source(item.source_list[0], source)) - diff --git a/tests/functional/openlp_plugins/songs/test_songformat.py b/tests/functional/openlp_plugins/songs/test_songformat.py index eab9760b8..0c82b049c 100644 --- a/tests/functional/openlp_plugins/songs/test_songformat.py +++ b/tests/functional/openlp_plugins/songs/test_songformat.py @@ -81,4 +81,3 @@ class TestSongFormat(TestCase): # THEN: Return all attributes that were specified self.assertEquals(len(SongFormat.get(song_format, 'canDisable', 'availability')), 2, "Did not return the correct number of attributes when retrieving multiple attributes at once") - diff --git a/tests/functional/openlp_plugins/songs/test_sundayplusimport.py b/tests/functional/openlp_plugins/songs/test_sundayplusimport.py index 17a00f819..3b01e6ec1 100644 --- a/tests/functional/openlp_plugins/songs/test_sundayplusimport.py +++ b/tests/functional/openlp_plugins/songs/test_sundayplusimport.py @@ -46,6 +46,6 @@ class TestSundayPlusFileImport(SongImportTestHelper): mocked_retrieve_windows_encoding: mocked_retrieve_windows_encoding.return_value = 'cp1252' self.file_import([os.path.join(TEST_PATH, 'Abba Fader.ptf')], - self.load_external_result_data(os.path.join(TEST_PATH, 'abba-fader.json'))) + self.load_external_result_data(os.path.join(TEST_PATH, 'abba-fader.json'))) self.file_import([os.path.join(TEST_PATH, 'Amazing Grace.ptf')], self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json'))) diff --git a/tests/helpers/testmixin.py b/tests/helpers/testmixin.py index 3e933cb39..6aaaccbf2 100644 --- a/tests/helpers/testmixin.py +++ b/tests/helpers/testmixin.py @@ -52,7 +52,7 @@ class TestMixin(object): Settings.set_filename(self.ini_file) Settings().setDefaultFormat(Settings.IniFormat) # Needed on windows to make sure a Settings object is available during the tests - self.setting = Settings() + self.setting = Settings() Settings().setValue('themes/global theme', 'my_theme') def destroy_settings(self): diff --git a/tests/interfaces/openlp_core_ui/test_projectoreditform.py b/tests/interfaces/openlp_core_ui/test_projectoreditform.py index 0f42e38ae..7518f139e 100644 --- a/tests/interfaces/openlp_core_ui/test_projectoreditform.py +++ b/tests/interfaces/openlp_core_ui/test_projectoreditform.py @@ -103,5 +103,3 @@ class TestProjectorEditForm(TestCase, TestMixin): 'Projector edit form should be marked as existing entry') self.assertTrue((item.ip is TEST1_DATA['ip'] and item.name is TEST1_DATA['name']), 'Projector edit form should have TEST1_DATA() instance to edit') - -