Fix various issues as suggested by pylint

This commit is contained in:
Tomas Groth 2016-07-05 22:31:29 +02:00
parent 9294aadae9
commit 99e6ab6657
9 changed files with 12 additions and 6 deletions

View File

@ -164,6 +164,7 @@ class ThemeXML(object):
jsn = get_text_file_string(json_file) jsn = get_text_file_string(json_file)
jsn = json.loads(jsn) jsn = json.loads(jsn)
self.expand_json(jsn) self.expand_json(jsn)
self.background_filename = None
def expand_json(self, var, prev=None): def expand_json(self, var, prev=None):
""" """

View File

@ -370,7 +370,7 @@ class BibleManager(RegistryProperties):
""" """
log.debug('save_meta data {bible}, {version}, {copyright}, {perms}'.format(bible=bible, log.debug('save_meta data {bible}, {version}, {copyright}, {perms}'.format(bible=bible,
version=version, version=version,
cr=copyright, copyright=copyright,
perms=permissions)) perms=permissions))
self.db_cache[bible].save_meta('name', version) self.db_cache[bible].save_meta('name', version)
self.db_cache[bible].save_meta('copyright', copyright) self.db_cache[bible].save_meta('copyright', copyright)

View File

@ -117,7 +117,7 @@ class OpenSongBible(BibleDB):
if len(verse_parts) > 1: if len(verse_parts) > 1:
number = int(verse_parts[0]) number = int(verse_parts[0])
except TypeError: 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 verse_number = number
else: else:
verse_number += 1 verse_number += 1

View File

@ -255,6 +255,7 @@ class CCLIFileImport(SongImport):
song_author = '' song_author = ''
verse_start = False verse_start = False
for line in text_list: for line in text_list:
verse_type= 'v'
clean_line = line.strip() clean_line = line.strip()
if not clean_line: if not clean_line:
if line_number == 0: if line_number == 0:

View File

@ -124,8 +124,8 @@ class DreamBeamImport(SongImport):
if hasattr(song_xml, 'Sequence'): if hasattr(song_xml, 'Sequence'):
for lyrics_sequence_item in (song_xml.Sequence.iterchildren()): for lyrics_sequence_item in (song_xml.Sequence.iterchildren()):
item = lyrics_sequence_item.get('Type')[:1] item = lyrics_sequence_item.get('Type')[:1]
self.verse_order_list.append("{item}{number}".format(item=item), number = lyrics_sequence_item.get('Number')
lyrics_sequence_item.get('Number')) self.verse_order_list.append("{item}{number}".format(item=item, number=number))
if hasattr(song_xml, 'Notes'): if hasattr(song_xml, 'Notes'):
self.comments = str(song_xml.Notes.text) self.comments = str(song_xml.Notes.text)
else: else:

View File

@ -27,6 +27,7 @@ import os
import struct import struct
import re import re
import zlib import zlib
import logging
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.lib import VerseType 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]+') NUMBER_REGEX = re.compile(r'[0-9]+')
NOTE_REGEX = re.compile(r'\(.*?\)') NOTE_REGEX = re.compile(r'\(.*?\)')
log = logging.getLogger(__name__)
class FieldDescEntry: class FieldDescEntry:
def __init__(self, name, field_type, size): def __init__(self, name, field_type, size):

View File

@ -67,7 +67,7 @@ class OpenLyricsImport(SongImport):
xml = etree.tostring(parsed_file).decode() xml = etree.tostring(parsed_file).decode()
self.open_lyrics.xml_to_song(xml) self.open_lyrics.xml_to_song(xml)
except etree.XMLSyntaxError: 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) self.log_error(file_path, SongStrings.XMLSyntaxError)
except OpenLyricsError as exception: except OpenLyricsError as exception:
log.exception('OpenLyricsException {error:d} in file {name}: {text}'.format(error=exception.type, log.exception('OpenLyricsException {error:d} in file {name}: {text}'.format(error=exception.type,

View File

@ -30,6 +30,7 @@ import re
import chardet import chardet
from lxml import objectify, etree from lxml import objectify, etree
from openlp.core.common import translate
from openlp.core.ui.lib.wizard import WizardStrings from openlp.core.ui.lib.wizard import WizardStrings
from .songimport import SongImport from .songimport import SongImport

View File

@ -19,7 +19,7 @@ persistent=yes
load-plugins= load-plugins=
# Use multiple processes to speed up Pylint. # Use multiple processes to speed up Pylint.
jobs=4 #jobs=4
# Allow loading of arbitrary C extensions. Extensions are imported into the # Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code. # active Python interpreter and may run arbitrary code.