jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/487118 )
Change subject: [tests] Require flake8 release 3.6.0 ......................................................................
[tests] Require flake8 release 3.6.0
flake8 tests fails with OptionConflictError for release 3.7.0-3.7.2 because flake8-per-file-ignores is part of flake8 now.
This problem has been solved with 3.7.3 but doctests often needs 15 minutes and more and test will be aborted.
Therefore use flake8 release 3.6.0 further.
Also fix some pep issues found by flake8 3.7
Bug: T214962 Change-Id: I00f7ed97d73344480f12194de6b102b70f0d6d48 --- M dev-requirements.txt M pywikibot/families/wowwiki_family.py M pywikibot/pagegenerators.py M pywikibot/site.py M scripts/casechecker.py M scripts/followlive.py M scripts/nowcommons.py M setup.py M tox.ini 9 files changed, 57 insertions(+), 51 deletions(-)
Approvals: Dalba: Looks good to me, approved jenkins-bot: Verified
diff --git a/dev-requirements.txt b/dev-requirements.txt index ea8424c..30118ff 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -16,7 +16,7 @@
pep257>=0.6 pyflakes>=0.9 -flake8 +flake8==3.6.0 flake8-docstrings>=0.2.6 flake8-mock>=0.3 codecov diff --git a/pywikibot/families/wowwiki_family.py b/pywikibot/families/wowwiki_family.py index 5a5f429..b27a93e 100644 --- a/pywikibot/families/wowwiki_family.py +++ b/pywikibot/families/wowwiki_family.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Family module for WOW Wiki.""" # -# (C) Pywikibot team, 2009-2018 +# (C) Pywikibot team, 2009-2019 # # Distributed under the terms of the MIT license. # @@ -30,12 +30,14 @@ # The interwikimap in this family map 'sv' to this empty wiki. @classproperty def langs(cls): + """Property listing family languages.""" cls.langs = super(Family, cls).langs cls.langs['sv'] = 'sv.warcraft.wikia.com' return cls.langs
@classproperty def disambiguationTemplates(cls): + """Property listing disambiguation templates.""" cls.disambiguationTemplates = \ super(Family, cls).disambiguationTemplates cls.disambiguationTemplates['en'] = ['disambig', 'disambig/quest', @@ -45,6 +47,7 @@
@classproperty def disambcatname(cls): + """Property listing disambiguation category name.""" cls.disambcatname = super(Family, cls).disambcatname cls.disambcatname['en'] = 'Disambiguations' return cls.disambcatname @@ -52,6 +55,7 @@ # Wikia's default CategorySelect extension always puts categories last @classproperty def categories_last(cls): + """Property listing site keys for categories at last position.""" return cls.langs.keys()
@classproperty diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index 81927e4..c814fee 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -1656,8 +1656,8 @@
user = pywikibot.User(site, username) if not (user.isAnonymous() or user.isRegistered()): - pywikibot.warning('User "{}" does not exist on site "{}".' - .format(user.username, site)) + pywikibot.warning('User "{}" does not exist on site "{}".' + .format(user.username, site))
gen = (contrib[0] for contrib in user.contributions( namespaces=namespaces, total=total)) diff --git a/pywikibot/site.py b/pywikibot/site.py index c1cc3aa..bf135f5 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -1809,7 +1809,7 @@
if (key not in user_tokens and failed_cache_key not in self.failed_cache): - self.load_tokens([key], all=False if user_tokens else None) + self.load_tokens([key], all=False if user_tokens else None)
if key in user_tokens: return user_tokens[key] @@ -3091,7 +3091,7 @@ for pageitem in query: if not self.sametitle(pageitem['title'], page.title(with_section=False)): - raise InconsistentTitleReceived(page, pageitem['title']) + raise InconsistentTitleReceived(page, pageitem['title'])
api.update_page(page, pageitem, query.props)
diff --git a/scripts/casechecker.py b/scripts/casechecker.py index edce6e7..7f88d44 100755 --- a/scripts/casechecker.py +++ b/scripts/casechecker.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """Bot to find all pages on the wiki with mixed latin and cyrilic alphabets.""" # -# (C) Pywikibot team, 2006-2018 +# (C) Pywikibot team, 2006-2019 # # Distributed under the terms of the MIT license. # @@ -441,8 +441,8 @@ .format(err[0])) if pageObj is not None: if self.PutNewPage(pageObj, pageTxt, msg): - # done, no need to log anything - foundSuggestions = False + # done, no need to log anything + foundSuggestions = False
if foundSuggestions: self.AppendLineToLog(self.failedTitles, title) diff --git a/scripts/followlive.py b/scripts/followlive.py index ed79bc6..e18b5ad 100644 --- a/scripts/followlive.py +++ b/scripts/followlive.py @@ -471,9 +471,9 @@ try: choices = answer.split(',') except ValueError: - # User entered wrong value - pywikibot.error('"{}" is not valid'.format(answer)) - continue + # User entered wrong value + pywikibot.error('"{}" is not valid'.format(answer)) + continue # test input for choice in choices: try: diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py index 5f12583..f2ba56f 100755 --- a/scripts/nowcommons.py +++ b/scripts/nowcommons.py @@ -48,8 +48,8 @@ # # (C) Wikipedian, 2006-2007 # (C) Siebrand Mazeland, 2007-2008 -# (C) xqt, 2010-2018 -# (C) Pywikibot team, 2006-2018 +# (C) xqt, 2010-2019 +# (C) Pywikibot team, 2006-2019 # # Distributed under the terms of the MIT license. # @@ -285,36 +285,36 @@ localImagePage.title(with_ns=False), len(usingPages))) if self.getOption('replace') is True: - pywikibot.output(color_format( - 'Replacing "{lightred}{0}{default}" by ' - '"{lightgreen}{1}{default}".', - localImagePage.title(with_ns=False), - commonsImagePage.title(with_ns=False))) + pywikibot.output(color_format( + 'Replacing "{lightred}{0}{default}" by ' + '"{lightgreen}{1}{default}".', + localImagePage.title(with_ns=False), + commonsImagePage.title(with_ns=False))) + bot = ImageBot( + pg.FileLinksGenerator(localImagePage), + localImagePage.title(with_ns=False), + commonsImagePage.title(with_ns=False), + '', self.getOption('replacealways'), + self.getOption('replaceloose')) + bot.run() + # If the image is used with the urlname the + # previous function won't work + is_used = bool(list(pywikibot.FilePage( + self.site, + page.title()).usingPages(total=1))) + if is_used and self.getOption('replaceloose'): bot = ImageBot( - pg.FileLinksGenerator(localImagePage), - localImagePage.title(with_ns=False), + pg.FileLinksGenerator( + localImagePage), + localImagePage.title( + with_ns=False, as_url=True), commonsImagePage.title(with_ns=False), '', self.getOption('replacealways'), self.getOption('replaceloose')) bot.run() - # If the image is used with the urlname the - # previous function won't work - is_used = bool(list(pywikibot.FilePage( - self.site, - page.title()).usingPages(total=1))) - if is_used and self.getOption('replaceloose'): - bot = ImageBot( - pg.FileLinksGenerator( - localImagePage), - localImagePage.title( - with_ns=False, as_url=True), - commonsImagePage.title(with_ns=False), - '', self.getOption('replacealways'), - self.getOption('replaceloose')) - bot.run() - # refresh because we want the updated list - usingPages = len(list(pywikibot.FilePage( - self.site, page.title()).usingPages())) + # refresh because we want the updated list + usingPages = len(list(pywikibot.FilePage( + self.site, page.title()).usingPages()))
else: pywikibot.output('Please change them manually.') diff --git a/setup.py b/setup.py index a73a804..f7db7fe 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Installer script for Pywikibot 3.0 framework.""" # -# (C) Pywikibot team, 2009-2018 +# (C) Pywikibot team, 2009-2019 # # Distributed under the terms of the MIT license. # @@ -61,7 +61,7 @@ 'mwoauth': ['mwoauth>=0.2.4,!=0.3.1'], 'html': ['BeautifulSoup4'], 'flake8': [ # Due to incompatibilities between packages the order matters. - 'flake8>=3.6.0', + 'flake8==3.6.0', # T214962 'pydocstyle', 'hacking', 'flake8-coding', diff --git a/tox.ini b/tox.ini index 9ef8281..7ed4c0b 100644 --- a/tox.ini +++ b/tox.ini @@ -236,9 +236,8 @@ scripts/weblinkchecker.py : N803, N806, N802 scripts/welcome.py: N802, N815 setup.py : T001 - tests/* : N813 tests/api_tests.py: N802 - tests/archivebot_tests.py: N802 + tests/archivebot_tests.py: N802, N813 tests/aspects.py: N802 tests/bot_tests.py: N802 tests/cosmetic_changes_tests.py: N802 @@ -247,23 +246,26 @@ tests/dry_site_tests.py: N802 tests/edit_failure_tests.py: N802 tests/exceptions_tests.py: N802 - tests/family_tests.py: N802 - tests/file_tests.py: N802 + tests/family_tests.py: N802, N813 + tests/file_tests.py: N802, N813 + tests/flow_edit_tests.py: N813 + tests/flow_tests.py: N813 + tests/http_tests.py: N813 tests/i18n_tests.py: N802 tests/imagecopy_tests.py: N802 tests/interwiki_link_tests.py: N802 tests/isbn_tests.py: N802 tests/link_tests.py: N802 - tests/logentry_tests.py: N802 + tests/logentry_tests.py: N802, N813 tests/login_tests.py: N802 - tests/namespace_tests.py: N802 - tests/page_tests.py : E241, N802 + tests/namespace_tests.py: N802, N813 + tests/page_tests.py : E241, N802, N813 tests/pagegenerators_tests.py: N802 tests/pwb/* : T001 tests/reflinks_tests.py: N802 tests/script_tests.py: N802 tests/site_detect_tests.py: N802 - tests/site_tests.py: N802 + tests/site_tests.py: N802, N813 tests/sparql_tests.py: N802 tests/tests_tests.py: N802 tests/textlib_tests.py: N802 @@ -273,8 +275,8 @@ tests/tools_ip_tests.py: N802 tests/tools_tests.py: N802 tests/ui_options_tests.py: N802 - tests/ui_tests.py : D102, D103, N801, N802 - tests/utils.py: N802 + tests/ui_tests.py : D102, D103, N801, N802, N813 + tests/utils.py: N802, N813 tests/weblib_tests.py: N802 tests/wikibase_edit_tests.py: N802 tests/wikibase_tests.py: N802
pywikibot-commits@lists.wikimedia.org