From 99e6ab6657eb1dec65d9a31aca04619214798d24 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 5 Jul 2016 22:31:29 +0200 Subject: [PATCH] Fix various issues as suggested by pylint --- openlp/core/lib/theme.py | 1 + openlp/plugins/bibles/lib/manager.py | 2 +- openlp/plugins/bibles/lib/opensong.py | 2 +- openlp/plugins/songs/lib/importers/cclifile.py | 1 + openlp/plugins/songs/lib/importers/dreambeam.py | 4 ++-- openlp/plugins/songs/lib/importers/easyworship.py | 3 +++ openlp/plugins/songs/lib/importers/openlyrics.py | 2 +- openlp/plugins/songs/lib/importers/presentationmanager.py | 1 + pylintrc | 2 +- 9 files changed, 12 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index e24613aa6..fc20037e7 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -164,6 +164,7 @@ class ThemeXML(object): jsn = get_text_file_string(json_file) jsn = json.loads(jsn) self.expand_json(jsn) + self.background_filename = None def expand_json(self, var, prev=None): """ diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index d1465475d..1c55222f2 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -370,7 +370,7 @@ class BibleManager(RegistryProperties): """ log.debug('save_meta data {bible}, {version}, {copyright}, {perms}'.format(bible=bible, version=version, - cr=copyright, + copyright=copyright, perms=permissions)) self.db_cache[bible].save_meta('name', version) self.db_cache[bible].save_meta('copyright', copyright) diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py index af3ef64c0..9c01a1fe0 100644 --- a/openlp/plugins/bibles/lib/opensong.py +++ b/openlp/plugins/bibles/lib/opensong.py @@ -117,7 +117,7 @@ class OpenSongBible(BibleDB): if len(verse_parts) > 1: number = int(verse_parts[0]) except TypeError: - log.warning('Illegal verse number: {verse:d}'.format(verse.attrib['n'])) + log.warning('Illegal verse number: {verse:d}'.format(verse=verse.attrib['n'])) verse_number = number else: verse_number += 1 diff --git a/openlp/plugins/songs/lib/importers/cclifile.py b/openlp/plugins/songs/lib/importers/cclifile.py index 800509ab2..b17f78129 100644 --- a/openlp/plugins/songs/lib/importers/cclifile.py +++ b/openlp/plugins/songs/lib/importers/cclifile.py @@ -255,6 +255,7 @@ class CCLIFileImport(SongImport): song_author = '' verse_start = False for line in text_list: + verse_type= 'v' clean_line = line.strip() if not clean_line: if line_number == 0: diff --git a/openlp/plugins/songs/lib/importers/dreambeam.py b/openlp/plugins/songs/lib/importers/dreambeam.py index 9371adc56..8c435bfd5 100644 --- a/openlp/plugins/songs/lib/importers/dreambeam.py +++ b/openlp/plugins/songs/lib/importers/dreambeam.py @@ -124,8 +124,8 @@ class DreamBeamImport(SongImport): if hasattr(song_xml, 'Sequence'): for lyrics_sequence_item in (song_xml.Sequence.iterchildren()): item = lyrics_sequence_item.get('Type')[:1] - self.verse_order_list.append("{item}{number}".format(item=item), - lyrics_sequence_item.get('Number')) + number = lyrics_sequence_item.get('Number') + self.verse_order_list.append("{item}{number}".format(item=item, number=number)) if hasattr(song_xml, 'Notes'): self.comments = str(song_xml.Notes.text) else: diff --git a/openlp/plugins/songs/lib/importers/easyworship.py b/openlp/plugins/songs/lib/importers/easyworship.py index cdffe9292..9db30838f 100644 --- a/openlp/plugins/songs/lib/importers/easyworship.py +++ b/openlp/plugins/songs/lib/importers/easyworship.py @@ -27,6 +27,7 @@ import os import struct import re import zlib +import logging from openlp.core.lib import translate from openlp.plugins.songs.lib import VerseType @@ -38,6 +39,8 @@ SLIDE_BREAK_REGEX = re.compile(r'\n *?\n[\n ]*') NUMBER_REGEX = re.compile(r'[0-9]+') NOTE_REGEX = re.compile(r'\(.*?\)') +log = logging.getLogger(__name__) + class FieldDescEntry: def __init__(self, name, field_type, size): diff --git a/openlp/plugins/songs/lib/importers/openlyrics.py b/openlp/plugins/songs/lib/importers/openlyrics.py index 84b667ce4..fcbe8fbfb 100644 --- a/openlp/plugins/songs/lib/importers/openlyrics.py +++ b/openlp/plugins/songs/lib/importers/openlyrics.py @@ -67,7 +67,7 @@ class OpenLyricsImport(SongImport): xml = etree.tostring(parsed_file).decode() self.open_lyrics.xml_to_song(xml) except etree.XMLSyntaxError: - log.exception('XML syntax error in file {path}'.format(file_path)) + log.exception('XML syntax error in file {path}'.format(path=file_path)) self.log_error(file_path, SongStrings.XMLSyntaxError) except OpenLyricsError as exception: log.exception('OpenLyricsException {error:d} in file {name}: {text}'.format(error=exception.type, diff --git a/openlp/plugins/songs/lib/importers/presentationmanager.py b/openlp/plugins/songs/lib/importers/presentationmanager.py index 34a94dec2..f10bd0ed6 100644 --- a/openlp/plugins/songs/lib/importers/presentationmanager.py +++ b/openlp/plugins/songs/lib/importers/presentationmanager.py @@ -30,6 +30,7 @@ import re import chardet from lxml import objectify, etree +from openlp.core.common import translate from openlp.core.ui.lib.wizard import WizardStrings from .songimport import SongImport diff --git a/pylintrc b/pylintrc index 367695e13..92d83ffaa 100644 --- a/pylintrc +++ b/pylintrc @@ -19,7 +19,7 @@ persistent=yes load-plugins= # Use multiple processes to speed up Pylint. -jobs=4 +#jobs=4 # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code.