openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #32909
[Merge] lp:~tomasgroth/openlp/pycodestyle1 into lp:openlp
Tomas Groth has proposed merging lp:~tomasgroth/openlp/pycodestyle1 into lp:openlp.
Commit message:
Fix pep8 and pylint errors detected by new version.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/pycodestyle1/+merge/349024
--
Your team OpenLP Core is requested to review the proposed merge of lp:~tomasgroth/openlp/pycodestyle1 into lp:openlp.
=== modified file 'openlp/core/api/endpoint/pluginhelpers.py'
--- openlp/core/api/endpoint/pluginhelpers.py 2018-01-27 11:15:49 +0000
+++ openlp/core/api/endpoint/pluginhelpers.py 2018-07-05 21:06:13 +0000
@@ -115,7 +115,7 @@
height = -1
image = None
if dimensions:
- match = re.search('(\d+)x(\d+)', dimensions)
+ match = re.search(r'(\d+)x(\d+)', dimensions)
if match:
# let's make sure that the dimensions are within reason
width = sorted([10, int(match.group(1)), 1000])[1]
=== modified file 'openlp/core/api/http/wsgiapp.py'
--- openlp/core/api/http/wsgiapp.py 2018-01-27 11:15:49 +0000
+++ openlp/core/api/http/wsgiapp.py 2018-07-05 21:06:13 +0000
@@ -39,7 +39,7 @@
def _route_to_regex(route):
- """
+ r"""
Convert a route to a regular expression
For example:
=== modified file 'openlp/core/api/tab.py'
--- openlp/core/api/tab.py 2018-02-11 21:52:04 +0000
+++ openlp/core/api/tab.py 2018-07-05 21:06:13 +0000
@@ -55,7 +55,7 @@
self.address_label.setObjectName('address_label')
self.address_edit = QtWidgets.QLineEdit(self.server_settings_group_box)
self.address_edit.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
- self.address_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'),
+ self.address_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'),
self))
self.address_edit.setObjectName('address_edit')
self.server_settings_layout.addRow(self.address_label, self.address_edit)
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2017-12-29 09:15:48 +0000
+++ openlp/core/lib/__init__.py 2018-07-05 21:06:13 +0000
@@ -415,7 +415,7 @@
chords_on_prev_line = True
# Matches a chord, a tail, a remainder and a line end. See expand_and_align_chords_in_line() for more info.
new_line += re.sub(r'\[(.*?)\]([\u0080-\uFFFF,\w]*)'
- '([\u0080-\uFFFF,\w,\s,\.,\,,\!,\?,\;,\:,\|,\",\',\-,\_]*)(\Z)?',
+ r'([\u0080-\uFFFF,\w,\s,\.,\,,\!,\?,\;,\:,\|,\",\',\-,\_]*)(\Z)?',
expand_and_align_chords_in_line, line)
new_line += '</span>'
expanded_text_lines.append(new_line)
=== modified file 'openlp/core/lib/htmlbuilder.py'
--- openlp/core/lib/htmlbuilder.py 2017-12-29 09:15:48 +0000
+++ openlp/core/lib/htmlbuilder.py 2018-07-05 21:06:13 +0000
@@ -19,7 +19,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-"""
+r"""
This module is responsible for generating the HTML for :class:`~openlp.core.ui.maindisplay`. The ``build_html`` function
is the function which has to be called from outside. The generated and returned HTML will look similar to this::
@@ -416,7 +416,7 @@
log = logging.getLogger(__name__)
-HTML_SRC = Template("""
+HTML_SRC = Template(r"""
<!DOCTYPE html>
<html>
<head>
=== modified file 'openlp/core/projectors/pjlink.py'
--- openlp/core/projectors/pjlink.py 2018-06-28 15:37:37 +0000
+++ openlp/core/projectors/pjlink.py 2018-07-05 21:06:13 +0000
@@ -338,7 +338,7 @@
# Due to stupid projectors not following standards (Optoma, BenQ comes to mind),
# AND the different responses that can be received, the semi-permanent way to
# fix the class reply is to just remove all non-digit characters.
- chk = re.findall('\d', data)
+ chk = re.findall(r'\d', data)
if len(chk) < 1:
log.error('({ip}) No numbers found in class version reply "{data}" - '
'defaulting to class "1"'.format(ip=self.entry.name, data=data))
=== modified file 'openlp/core/ui/media/__init__.py'
--- openlp/core/ui/media/__init__.py 2017-12-29 09:15:48 +0000
+++ openlp/core/ui/media/__init__.py 2018-07-05 21:06:13 +0000
@@ -80,7 +80,7 @@
"""
log.debug('get_media_players')
saved_players = Settings().value('media/players')
- reg_ex = QtCore.QRegExp(".*\[(.*)\].*")
+ reg_ex = QtCore.QRegExp(r'.*\[(.*)\].*')
if Settings().value('media/override player') == QtCore.Qt.Checked:
if reg_ex.exactMatch(saved_players):
overridden_player = '{text}'.format(text=reg_ex.cap(1))
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2018-03-18 07:45:46 +0000
+++ openlp/core/ui/slidecontroller.py 2018-07-05 21:06:13 +0000
@@ -1126,7 +1126,7 @@
# done by the thread holding the lock. If it is a "start" slide, we must wait for the lock, but only for 0.2
# seconds, since we don't want to cause a deadlock
timeout = 0.2 if start else -1
- if not self.slide_selected_lock.acquire(start, timeout):
+ if not self.slide_selected_lock.acquire(start, timeout): # pylint: disable=too-many-function-args
if start:
self.log_debug('Could not get lock in slide_selected after waiting %f, skip to avoid deadlock.'
% timeout)
=== modified file 'openlp/plugins/bibles/forms/editbibleform.py'
--- openlp/plugins/bibles/forms/editbibleform.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/bibles/forms/editbibleform.py 2018-07-05 21:06:13 +0000
@@ -183,7 +183,7 @@
"""
Validate a book.
"""
- book_regex = re.compile('[\d]*[^\d]+$')
+ book_regex = re.compile(r'[\d]*[^\d]+$')
if not new_book_name:
self.book_name_edit[abbreviation].setFocus()
critical_error_message_box(
=== modified file 'openlp/plugins/bibles/lib/__init__.py'
--- openlp/plugins/bibles/lib/__init__.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/bibles/lib/__init__.py 2018-07-05 21:06:13 +0000
@@ -217,7 +217,7 @@
# add various Unicode alternatives
source_string = source_string.replace('-', '(?:[-\u00AD\u2010\u2011\u2012\u2014\u2014\u2212\uFE63\uFF0D])')
source_string = source_string.replace(',', '(?:[,\u201A])')
- REFERENCE_SEPARATORS['sep_{role}'.format(role=role)] = '\s*(?:{source})\s*'.format(source=source_string)
+ REFERENCE_SEPARATORS['sep_{role}'.format(role=role)] = r'\s*(?:{source})\s*'.format(source=source_string)
REFERENCE_SEPARATORS['sep_{role}_default'.format(role=role)] = default_separators[index]
# verse range match: (<chapter>:)?<verse>(-((<chapter>:)?<verse>|end)?)?
range_regex = '(?:(?P<from_chapter>[0-9]+){sep_v})?' \
@@ -255,7 +255,7 @@
def parse_reference(reference, bible, language_selection, book_ref_id=False):
- """
+ r"""
This is the next generation über-awesome function that takes a person's typed in string and converts it to a list
of references to be queried from the Bible database files.
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2018-01-27 09:41:11 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2018-07-05 21:06:13 +0000
@@ -41,7 +41,7 @@
log = logging.getLogger(__name__)
-VALID_TEXT_SEARCH = re.compile('\w\w\w')
+VALID_TEXT_SEARCH = re.compile(r'\w\w\w')
def get_reference_separators():
=== modified file 'openlp/plugins/media/forms/mediaclipselectorform.py'
--- openlp/plugins/media/forms/mediaclipselectorform.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/media/forms/mediaclipselectorform.py 2018-07-05 21:06:13 +0000
@@ -210,7 +210,7 @@
# detect if we're dealing with a DVD or CD, so we use different loading approaches depending on the OS.
if is_win():
# If the given path is in the format "D:\" or "D:", prefix it with "/" to make VLC happy
- pattern = re.compile('^\w:\\\\*$')
+ pattern = re.compile(r'^\w:\\\\*$')
if pattern.match(path):
path = '/' + path
self.vlc_media = self.vlc_instance.media_new_location('dvd://' + path)
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2018-07-05 21:06:13 +0000
@@ -105,7 +105,7 @@
self.topics_list_view.setSortingEnabled(False)
self.topics_list_view.setAlternatingRowColors(True)
self.audio_list_widget.setAlternatingRowColors(True)
- self.find_verse_split = re.compile('---\[\]---\n')
+ self.find_verse_split = re.compile(r'---\[\]---\n')
self.whitespace = re.compile(r'\W+')
self.find_tags = re.compile(r'\{/?\w+\}')
@@ -316,7 +316,7 @@
multiple.append(verse_tag)
self.song.lyrics = str(sxml.extract_xml(), 'utf-8')
for verse in multiple:
- self.song.verse_order = re.sub('([' + verse.upper() + verse.lower() + '])(\W|$)',
+ self.song.verse_order = re.sub(r'([' + verse.upper() + verse.lower() + r'])(\W|$)',
r'\g<1>1\2', self.song.verse_order)
except:
log.exception('Problem processing song Lyrics \n{xml}'.format(xml=sxml.dump_xml()))
=== modified file 'openlp/plugins/songs/lib/__init__.py'
--- openlp/plugins/songs/lib/__init__.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/__init__.py 2018-07-05 21:06:13 +0000
@@ -557,7 +557,7 @@
:return: The transposed lyrics
"""
# Split text by verse delimiter - both normal and optional
- verse_list = re.split('(---\[.+?:.+?\]---|\[---\])', lyrics)
+ verse_list = re.split(r'(---\[.+?:.+?\]---|\[---\])', lyrics)
transposed_lyrics = ''
notation = Settings().value('songs/chord notation')
for verse in verse_list:
@@ -580,7 +580,7 @@
if '[' not in verse_text:
return verse_text
# Split the lyrics based on chord tags
- lyric_list = re.split('(\[|\]|/)', verse_text)
+ lyric_list = re.split(r'(\[|\]|/)', verse_text)
transposed_lyrics = ''
in_tag = False
for word in lyric_list:
=== modified file 'openlp/plugins/songs/lib/importers/dreambeam.py'
--- openlp/plugins/songs/lib/importers/dreambeam.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/importers/dreambeam.py 2018-07-05 21:06:13 +0000
@@ -73,7 +73,7 @@
Valid extensions for a DreamBeam song file are:
- * \*.xml
+ * .xml
"""
def do_import(self):
=== modified file 'openlp/plugins/songs/lib/importers/easyslides.py'
--- openlp/plugins/songs/lib/importers/easyslides.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/importers/easyslides.py 2018-07-05 21:06:13 +0000
@@ -37,7 +37,7 @@
Import songs exported from EasySlides
The format example is here:
- http://wiki.openlp.org/Development:EasySlides\_-_Song_Data_Format
+ http://wiki.openlp.org/Development:EasySlides_-_Song_Data_Format
"""
def __init__(self, manager, **kwargs):
"""
@@ -210,7 +210,7 @@
vn = '1'
# have we got any digits?
# If so, versenumber is everything from the digits to the end
- match = re.match('(.*)(\d+.*)', marker)
+ match = re.match(r'(.*)(\d+.*)', marker)
if match:
marker = match.group(1).strip()
vn = match.group(2)
=== modified file 'openlp/plugins/songs/lib/importers/foilpresenter.py'
--- openlp/plugins/songs/lib/importers/foilpresenter.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/importers/foilpresenter.py 2018-07-05 21:06:13 +0000
@@ -273,15 +273,15 @@
elif copyright.find('C,)') != -1:
temp = copyright.partition('C,)')
copyright = temp[0]
- copyright = re.compile('\\n').sub(' ', copyright)
- copyright = re.compile('\(.*\)').sub('', copyright)
+ copyright = re.compile(r'\\n').sub(' ', copyright)
+ copyright = re.compile(r'\(.*\)').sub('', copyright)
if copyright.find('Rechte') != -1:
temp = copyright.partition('Rechte')
copyright = temp[0]
- markers = ['Text +u\.?n?d? +Melodie[\w\,\. ]*:',
- 'Text +u\.?n?d? +Musik', 'T & M', 'Melodie und Satz',
- 'Text[\w\,\. ]*:', 'Melodie', 'Musik', 'Satz',
- 'Weise', '[dD]eutsch', '[dD]t[\.\:]', 'Englisch',
+ markers = [r'Text +u\.?n?d? +Melodie[\w\,\. ]*:',
+ r'Text +u\.?n?d? +Musik', 'T & M', 'Melodie und Satz',
+ r'Text[\w\,\. ]*:', 'Melodie', 'Musik', 'Satz',
+ 'Weise', '[dD]eutsch', r'[dD]t[\.\:]', 'Englisch',
'[oO]riginal', 'Bearbeitung', '[R|r]efrain']
for marker in markers:
copyright = re.compile(marker).sub('<marker>', copyright, re.U)
@@ -301,17 +301,17 @@
break
author_temp = []
for author in strings:
- temp = re.split(',(?=\D{2})|(?<=\D),|\/(?=\D{3,})|(?<=\D);', author)
+ temp = re.split(r',(?=\D{2})|(?<=\D),|\/(?=\D{3,})|(?<=\D);', author)
for tempx in temp:
author_temp.append(tempx)
for author in author_temp:
- regex = '^[\/,;\-\s\.]+|[\/,;\-\s\.]+$|\s*[0-9]{4}\s*[\-\/]?\s*([0-9]{4})?[\/,;\-\s\.]*$'
+ regex = r'^[\/,;\-\s\.]+|[\/,;\-\s\.]+$|\s*[0-9]{4}\s*[\-\/]?\s*([0-9]{4})?[\/,;\-\s\.]*$'
author = re.compile(regex).sub('', author)
- author = re.compile('[0-9]{1,2}\.\s?J(ahr)?h\.|um\s*$|vor\s*$').sub('', author)
- author = re.compile('[N|n]ach.*$').sub('', author)
+ author = re.compile(r'[0-9]{1,2}\.\s?J(ahr)?h\.|um\s*$|vor\s*$').sub('', author)
+ author = re.compile(r'[N|n]ach.*$').sub('', author)
author = author.strip()
- if re.search('\w+\.?\s+\w{3,}\s+[a|u]nd\s|\w+\.?\s+\w{3,}\s+&\s', author, re.U):
- temp = re.split('\s[a|u]nd\s|\s&\s', author)
+ if re.search(r'\w+\.?\s+\w{3,}\s+[a|u]nd\s|\w+\.?\s+\w{3,}\s+&\s', author, re.U):
+ temp = re.split(r'\s[a|u]nd\s|\s&\s', author)
for tempx in temp:
tempx = tempx.strip()
authors.append(tempx)
=== modified file 'openlp/plugins/songs/lib/importers/lyrix.py'
--- openlp/plugins/songs/lib/importers/lyrix.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/importers/lyrix.py 2018-07-05 21:06:13 +0000
@@ -80,7 +80,7 @@
continue
# Detect and get CCLI number
if line.lower().startswith('ccli'):
- ccli = re.findall('\d+', line)[0]
+ ccli = re.findall(r'\d+', line)[0]
try:
# If the CCLI was found, we are near the end
# Find author
=== modified file 'openlp/plugins/songs/lib/importers/opensong.py'
--- openlp/plugins/songs/lib/importers/opensong.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/importers/opensong.py 2018-07-05 21:06:13 +0000
@@ -156,7 +156,7 @@
ustring = str(root.__getattr__(attr))
if isinstance(fn_or_string, str):
if attr in ['ccli']:
- ustring = ''.join(re.findall('\d+', ustring))
+ ustring = ''.join(re.findall(r'\d+', ustring))
if ustring:
setattr(self, fn_or_string, int(ustring))
else:
@@ -231,7 +231,7 @@
content = this_line[1:right_bracket].lower()
# have we got any digits? If so, verse number is everything from the digits to the end (openlp does not
# have concept of part verses, so just ignore any non integers on the end (including floats))
- match = re.match('(\D*)(\d+)', content)
+ match = re.match(r'(\D*)(\d+)', content)
if match is not None:
verse_tag = match.group(1)
verse_num = match.group(2)
@@ -303,7 +303,7 @@
# whitespace.
order = order.lower().split()
for verse_def in order:
- match = re.match('(\D*)(\d+.*)', verse_def)
+ match = re.match(r'(\D*)(\d+.*)', verse_def)
if match is not None:
verse_tag = match.group(1)
verse_num = match.group(2)
=== modified file 'openlp/plugins/songs/lib/importers/opspro.py'
--- openlp/plugins/songs/lib/importers/opspro.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/importers/opspro.py 2018-07-05 21:06:13 +0000
@@ -122,7 +122,7 @@
# Try to split lyrics based on various rules
if lyrics:
lyrics_text = lyrics.Lyrics
- verses = re.split('\r\n\s*?\r\n', lyrics_text)
+ verses = re.split(r'\r\n\s*?\r\n', lyrics_text)
verse_tag_defs = {}
verse_tag_texts = {}
for verse_text in verses:
@@ -130,13 +130,13 @@
continue
verse_def = 'v'
# Detect verse number
- verse_number = re.match('^(\d+)\r\n', verse_text)
+ verse_number = re.match(r'^(\d+)\r\n', verse_text)
if verse_number:
- verse_text = re.sub('^\d+\r\n', '', verse_text)
+ verse_text = re.sub(r'^\d+\r\n', '', verse_text)
verse_def = 'v' + verse_number.group(1)
# Detect verse tags
- elif re.match('^.+?\:\r\n', verse_text):
- tag_match = re.match('^(.+?)\:\r\n(.*)', verse_text, flags=re.DOTALL)
+ elif re.match(r'^.+?\:\r\n', verse_text):
+ tag_match = re.match(r'^(.+?)\:\r\n(.*)', verse_text, flags=re.DOTALL)
tag = tag_match.group(1).lower()
tag = tag.split(' ')[0]
verse_text = tag_match.group(2)
@@ -147,25 +147,25 @@
verse_tag_defs[tag] = verse_def
verse_tag_texts[tag] = verse_text
# Detect tag reference
- elif re.match('^\(.*?\)$', verse_text):
- tag_match = re.match('^\((.*?)\)$', verse_text)
+ elif re.match(r'^\(.*?\)$', verse_text):
+ tag_match = re.match(r'^\((.*?)\)$', verse_text)
tag = tag_match.group(1).lower()
if tag in verse_tag_defs:
verse_text = verse_tag_texts[tag]
verse_def = verse_tag_defs[tag]
# Detect end tag
- elif re.match('^\[slot\]\r\n', verse_text, re.IGNORECASE):
+ elif re.match(r'^\[slot\]\r\n', verse_text, re.IGNORECASE):
verse_def = 'e'
- verse_text = re.sub('^\[slot\]\r\n', '', verse_text, flags=re.IGNORECASE)
+ verse_text = re.sub(r'^\[slot\]\r\n', '', verse_text, flags=re.IGNORECASE)
# Replace the join tag with line breaks
verse_text = verse_text.replace('[join]', '')
# Replace the split tag with line breaks and an optional split
- verse_text = re.sub('\[splits?\]', '\r\n[---]', verse_text)
+ verse_text = re.sub(r'\[splits?\]', '\r\n[---]', verse_text)
# Handle translations
if lyrics.IsDualLanguage:
verse_text = self.handle_translation(verse_text)
# Remove comments
- verse_text = re.sub('\(.*?\)\r\n', '', verse_text, flags=re.IGNORECASE)
+ verse_text = re.sub(r'\(.*?\)\r\n', '', verse_text, flags=re.IGNORECASE)
self.add_verse(verse_text, verse_def)
self.finish()
=== modified file 'openlp/plugins/songs/lib/importers/powersong.py'
--- openlp/plugins/songs/lib/importers/powersong.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/importers/powersong.py 2018-07-05 21:06:13 +0000
@@ -70,7 +70,7 @@
"""
Checks if source is a PowerSong 1.0 folder:
* is a directory
- * contains at least one \*.song file
+ * contains at least one * .song file
:param openlp.core.common.path.Path import_source: Should be a Path object that fulfills the above criteria
:return: If the source is valid
=== modified file 'openlp/plugins/songs/lib/importers/presentationmanager.py'
--- openlp/plugins/songs/lib/importers/presentationmanager.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/importers/presentationmanager.py 2018-07-05 21:06:13 +0000
@@ -51,7 +51,7 @@
encoding = get_file_encoding(file_path)['encoding']
# Open file with detected encoding and remove encoding declaration
text = file_path.read_text(encoding=encoding)
- text = re.sub('.+\?>\n', '', text)
+ text = re.sub(r'.+\?>\n', '', text)
try:
tree = etree.fromstring(text, parser=etree.XMLParser(recover=True))
except ValueError:
=== modified file 'openlp/plugins/songs/lib/importers/songsoffellowship.py'
--- openlp/plugins/songs/lib/importers/songsoffellowship.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/importers/songsoffellowship.py 2018-07-05 21:06:13 +0000
@@ -333,7 +333,7 @@
There is a complicated word "One", which is sometimes lower and
sometimes upper depending on context. Never mind, keep it lower.
"""
- text_arr = re.split('(\W+)', text)
+ text_arr = re.split(r'(\W+)', text)
text_arr[0] = text_arr[0].capitalize()
for i in range(1, len(text_arr)):
# Do not translate these. Fixed strings in SOF song file
=== modified file 'openlp/plugins/songs/lib/importers/worshipassistant.py'
--- openlp/plugins/songs/lib/importers/worshipassistant.py 2017-12-29 09:15:48 +0000
+++ openlp/plugins/songs/lib/importers/worshipassistant.py 2018-07-05 21:06:13 +0000
@@ -142,7 +142,7 @@
# drop the square brackets
right_bracket = line.find(']')
content = line[1:right_bracket].lower()
- match = re.match('(\D*)(\d+)', content)
+ match = re.match(r'(\D*)(\d+)', content)
if match is not None:
verse_tag = match.group(1)
verse_num = match.group(2)
=== modified file 'scripts/lp-merge.py'
--- scripts/lp-merge.py 2018-06-28 15:37:37 +0000
+++ scripts/lp-merge.py 2018-07-05 21:06:13 +0000
@@ -124,7 +124,7 @@
script_tag = soup.find('script', attrs={"id": "codereview-script"})
content = script_tag.contents[0]
start_pos = content.find('source_revid') + 16
- pattern = re.compile('.*\w-\d\d\d\d\d+')
+ pattern = re.compile(r'.*\w-\d\d\d\d\d+')
match = pattern.match(content[start_pos:])
merge_info['author_email'] = match.group()[:-15]
# Launchpad doesn't supply the author's true name, so we'll just grab whatever they use for display on LP
=== modified file 'setup.cfg'
--- setup.cfg 2018-06-28 15:37:37 +0000
+++ setup.cfg 2018-07-05 21:06:13 +0000
@@ -15,5 +15,10 @@
[pycodestyle]
exclude = resources.py,vlc.py
max-line-length = 120
-ignore = E402
+# Ignoring:
+# E402...
+# E722 do not use bare 'except'
+# W503 line break before binary operator
+# W504 line break after binary operator
+ignore = E402,E722,W503,W504
=== modified file 'tests/functional/openlp_core/api/test_tab.py'
--- tests/functional/openlp_core/api/test_tab.py 2018-02-11 21:52:04 +0000
+++ tests/functional/openlp_core/api/test_tab.py 2018-07-05 21:06:13 +0000
@@ -87,7 +87,7 @@
ip_address = self.form.get_ip_address(ZERO_URL)
# THEN: the default ip address will be returned
- assert re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', ip_address), \
+ assert re.match(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', ip_address), \
'The return value should be a valid ip address'
assert ip_address in ip4_list, 'The return address should be in the list of local IP addresses'
=== modified file 'tests/functional/openlp_core/common/test_init.py'
--- tests/functional/openlp_core/common/test_init.py 2017-12-28 08:22:55 +0000
+++ tests/functional/openlp_core/common/test_init.py 2018-07-05 21:06:13 +0000
@@ -238,13 +238,14 @@
Test the clean_filename() function
"""
# GIVEN: A invalid file name and the valid file name.
- invalid_name = 'A_file_with_invalid_characters_[\\/:\*\?"<>\|\+\[\]%].py'
- wanted_name = 'A_file_with_invalid_characters______________________.py'
+ invalid_name = 'A_file_with_invalid_characters_[\\/:*?"<>|+[]%].py'
+ wanted_name = 'A_file_with_invalid_characters________________.py'
# WHEN: Clean the name.
result = clean_filename(invalid_name)
# THEN: The file name should be cleaned.
+ print(result)
assert wanted_name == result, 'The file name should not contain any special characters.'
def test_delete_file_no_path(self):
=== modified file 'tests/functional/openlp_core/lib/test_htmlbuilder.py'
--- tests/functional/openlp_core/lib/test_htmlbuilder.py 2017-12-28 08:22:55 +0000
+++ tests/functional/openlp_core/lib/test_htmlbuilder.py 2018-07-05 21:06:13 +0000
@@ -12,7 +12,7 @@
from openlp.core.lib.theme import HorizontalType, VerticalType
from tests.helpers.testmixin import TestMixin
-HTML = """
+HTML = r"""
<!DOCTYPE html>
<html>
<head>
@@ -121,7 +121,7 @@
}
function show_text(new_text){
- var match = /-webkit-text-fill-color:[^;"]+/gi;
+ var match = /-webkit-text-fill-color:[^;\"]+/gi;
if(timer != null)
clearTimeout(timer);
/*
=== modified file 'tests/interfaces/openlp_core/ui/test_filerenamedialog.py'
--- tests/interfaces/openlp_core/ui/test_filerenamedialog.py 2017-12-29 09:15:48 +0000
+++ tests/interfaces/openlp_core/ui/test_filerenamedialog.py 2018-07-05 21:06:13 +0000
@@ -99,7 +99,7 @@
# GIVEN: QLineEdit with a validator set with illegal file name characters.
# WHEN: 'Typing' a string containing invalid file characters.
- QtTest.QTest.keyClicks(self.form.file_name_edit, 'I/n\\v?a*l|i<d> \F[i\l]e" :N+a%me')
+ QtTest.QTest.keyClicks(self.form.file_name_edit, r'I/n\\v?a*l|i<d> \F[i\l]e" :N+a%me')
# THEN: The text in the QLineEdit should be the same as the input string with the invalid characters filtered
# out.
=== modified file 'tests/utils/test_pylint.py'
--- tests/utils/test_pylint.py 2017-12-29 09:15:48 +0000
+++ tests/utils/test_pylint.py 2018-07-05 21:06:13 +0000
@@ -68,7 +68,7 @@
# WHEN: Running pylint
(pylint_stdout, pylint_stderr) = \
- lint.py_run('openlp --errors-only --disable={disabled} --enable={enabled} '
+ lint.py_run('openlp --errors-only -j 4 --disable={disabled} --enable={enabled} '
'--reports=no --output-format=parseable'.format(disabled=disabled_checks,
enabled=enabled_checks),
**pylint_kwargs)
@@ -88,7 +88,7 @@
filtered_output = ''
for line in pylint_output.splitlines():
# Filter out module info lines
- if line.startswith('**'):
+ if '***' in line:
continue
# Filter out undefined-variable error releated to WindowsError
elif 'undefined-variable' in line and 'WindowsError' in line:
References