jenkins-bot merged this change.

View Change

Approvals: Dalba: Looks good to me, approved jenkins-bot: Verified
[style] use flake8-quotes to enforce single quotes

also fix some scripts

Change-Id: I91e67a46fa859e5f29eab88863e6a53d83ec4cca
---
M docs/conf.py
M pwb.py
M pywikibot/bot.py
M pywikibot/page.py
M scripts/solve_disambiguation.py
M setup.py
M tests/diff_tests.py
M tox.ini
8 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index d10f7b9..c78193d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -263,7 +263,7 @@
"""Pywikibot specific conversions."""
from scripts.cosmetic_changes import warning

- if what != "module":
+ if what != 'module':
return

if not name.startswith('scripts.'):
diff --git a/pwb.py b/pwb.py
index 2ed6a9b..c77ebdb 100755
--- a/pwb.py
+++ b/pwb.py
@@ -115,7 +115,7 @@
try:
with open(filename, 'rb') as f:
source = f.read()
- exec(compile(source, filename, "exec", dont_inherit=True),
+ exec(compile(source, filename, 'exec', dont_inherit=True),
main_mod.__dict__)
finally:
# Restore the old __main__
@@ -181,7 +181,7 @@
if filename is not None and not (filename.startswith('generate_')
or filename == 'version.py'):
print("NOTE: 'user-config.py' was not found!")
- print("Please follow the prompts to create it:")
+ print('Please follow the prompts to create it:')
run_python_file(os.path.join(_pwb_dir, 'generate_user_files.py'),
['generate_user_files.py'],
['generate_user_files.py'])
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 1dccc0d..0fd9da6 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -135,7 +135,7 @@
ui = uiModule.UI()
pywikibot.argvu = ui.argvu()

-_GLOBAL_HELP = '''
+_GLOBAL_HELP = """
GLOBAL OPTIONS
==============
(Global arguments available for all bots)
@@ -193,7 +193,7 @@
-<config var>:n You may use all given numeric config variables as option and
modify it with command line.

-'''
+"""


# It's not possible to use pywikibot.exceptions.PageRelatedError as that is
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 5677333..24a96ce 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -5450,14 +5450,14 @@

illegal_titles_pattern = re.compile(
# Matching titles will be held as illegal.
- r'''[\x00-\x1f\x23\x3c\x3e\x5b\x5d\x7b\x7c\x7d\x7f]'''
+ r'[\x00-\x1f\x23\x3c\x3e\x5b\x5d\x7b\x7c\x7d\x7f]'
# URL percent encoding sequences interfere with the ability
# to round-trip titles -- you can't link to them consistently.
- u'|%[0-9A-Fa-f]{2}'
+ '|%[0-9A-Fa-f]{2}'
# XML/HTML character references produce similar issues.
- u'|&[A-Za-z0-9\x80-\xff]+;'
- u'|&#[0-9]+;'
- u'|&#x[0-9A-Fa-f]+;'
+ '|&[A-Za-z0-9\x80-\xff]+;'
+ '|&#[0-9]+;'
+ '|&#x[0-9A-Fa-f]+;'
)

@deprecated_args(defaultNamespace='default_namespace')
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 9196e66..3ba4d4f 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -696,12 +696,11 @@
# group linktrail is the link trail, that's letters after ]] which
# are part of the word.
# note: the definition of 'letter' varies from language to language.
- self.linkR = re.compile(r'''
+ self.linkR = re.compile(r"""
\[\[ (?P<title> [^\[\]\|#]*)
(?P<section> \#[^\]\|]*)?
(\|(?P<label> [^\]]*))? \]\]
- (?P<linktrail>%s)''' % linktrail,
- flags=re.X)
+ (?P<linktrail>{})""".format(linktrail), flags=re.X)

@staticmethod
def firstlinks(page):
diff --git a/setup.py b/setup.py
index 1148044..8e0515e 100644
--- a/setup.py
+++ b/setup.py
@@ -72,6 +72,7 @@
'flake8-mock>=0.3',
'flake8-per-file-ignores',
'flake8-print>=2.0.1',
+ 'flake8-quotes',
'flake8-string-format',
'flake8-tuple>=0.2.8',
'pep8-naming>=0.7',
@@ -246,7 +247,7 @@
extras_require=extra_deps,
url='https://www.mediawiki.org/wiki/Manual:Pywikibot',
download_url='https://tools.wmflabs.org/pywikibot/',
- test_suite="tests.collector",
+ test_suite='tests.collector',
tests_require=test_deps,
classifiers=[
'Development Status :: 5 - Production/Stable',
diff --git a/tests/diff_tests.py b/tests/diff_tests.py
index 2d49d52..9bba2ce 100644
--- a/tests/diff_tests.py
+++ b/tests/diff_tests.py
@@ -23,7 +23,7 @@

def test_added_context(self):
"""Test html_comparator's detection of added-context."""
- output = html_comparator('''
+ output = html_comparator("""
<tr>
<td class="diff-addedline">line 1a</td>
<td class="diff-addedline">line \n2a</td>
@@ -31,13 +31,13 @@
<tr>
<td class="diff-addedline"><span>line 1b</span></td>
<td class="diff-addedline">line 2b<i><span></i></span></td>
-</tr>''')
+</tr>""")
self.assertEqual(output['added-context'],
['line 1a', 'line \n2a', 'line 1b', 'line 2b'])

def test_deleted_context(self):
"""Test html_comparator's detection of deleted-context."""
- output = html_comparator('''
+ output = html_comparator("""
<tr>
<td class="diff-deletedline">line 1a</td>
<td class="diff-deletedline">line \n2a</td>
@@ -45,7 +45,7 @@
<tr>
<td class="diff-deletedline"><span>line 1b</span></td>
<td class="diff-deletedline">line 2b<i><span></i></span></td>
-</tr>''')
+</tr>""")
self.assertEqual(output['deleted-context'],
['line 1a', 'line \n2a', 'line 1b', 'line 2b'])

diff --git a/tox.ini b/tox.ini
index d4c61c5..6d1c78d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -156,8 +156,10 @@
require-code = true
classmethod-decorators = classmethod,classproperty
per-file-ignores =
- generate_family_file.py : T001
+ generate_family_file.py : T001, Q000
+ generate_user_files.py : Q000
pwb.py : T001
+ pywikibot/** : Q000
# pydocstyle cannot handle multiple __all__ variables
pywikibot/__init__.py : D999, N806, N802
pywikibot/_wbtypes.py: N802
@@ -244,6 +246,7 @@
scripts/welcome.py: N802
setup.py : T001
tests/* : N813
+ tests/** : Q000
tests/api_tests.py: N802
tests/archivebot_tests.py: N802
tests/aspects.py: N802

To view, visit change 463289. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I91e67a46fa859e5f29eab88863e6a53d83ec4cca
Gerrit-Change-Number: 463289
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)