jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[flake] fix some flake errors in archive

Change-Id: I9ad68bdfd33d78f13323fdd42345b15aa5bc56de
---
M scripts/archive/capitalize_redirects.py
M scripts/archive/catall.py
M scripts/archive/commons_link.py
M scripts/archive/create_categories.py
M scripts/archive/data_ingestion.py
M scripts/archive/editarticle.py
M scripts/archive/flickrripper.py
M scripts/archive/imagecopy.py
M scripts/archive/imagecopy_self.py
M scripts/archive/imageuncat.py
M scripts/archive/isbn.py
M tox.ini
12 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/scripts/archive/capitalize_redirects.py b/scripts/archive/capitalize_redirects.py
index d16535d..4c97651 100755
--- a/scripts/archive/capitalize_redirects.py
+++ b/scripts/archive/capitalize_redirects.py
@@ -31,7 +31,6 @@
#
import pywikibot
from pywikibot import i18n, pagegenerators
-from pywikibot.backports import Tuple
from pywikibot.bot import (
ExistingPageBot,
FollowRedirectPageBot,
diff --git a/scripts/archive/catall.py b/scripts/archive/catall.py
index 60ef9b9..10c349a 100755
--- a/scripts/archive/catall.py
+++ b/scripts/archive/catall.py
@@ -26,7 +26,7 @@
#
import pywikibot
from pywikibot import i18n, textlib
-from pywikibot.backports import List, Tuple
+from pywikibot.backports import List
from pywikibot.bot import QuitKeyboardInterrupt
from pywikibot.exceptions import IsRedirectPageError

diff --git a/scripts/archive/commons_link.py b/scripts/archive/commons_link.py
index 4c94b9e..b80e444 100755
--- a/scripts/archive/commons_link.py
+++ b/scripts/archive/commons_link.py
@@ -33,7 +33,6 @@

import pywikibot
from pywikibot import Bot, i18n, pagegenerators, textlib
-from pywikibot.backports import Tuple
from pywikibot.exceptions import (
EditConflictError,
IsRedirectPageError,
diff --git a/scripts/archive/create_categories.py b/scripts/archive/create_categories.py
index 41e6743..5097594 100755
--- a/scripts/archive/create_categories.py
+++ b/scripts/archive/create_categories.py
@@ -36,7 +36,6 @@
#
import pywikibot
from pywikibot import pagegenerators
-from pywikibot.backports import Tuple
from pywikibot.bot import AutomaticTWSummaryBot, SingleSiteBot
from pywikibot.site import Namespace

diff --git a/scripts/archive/data_ingestion.py b/scripts/archive/data_ingestion.py
index 27b4a8b..1a7f8b4 100755
--- a/scripts/archive/data_ingestion.py
+++ b/scripts/archive/data_ingestion.py
@@ -105,11 +105,9 @@
import os
import posixpath
from urllib.parse import urlparse
-from warnings import warn

import pywikibot
from pywikibot import pagegenerators
-from pywikibot.backports import Tuple
from pywikibot.comms.http import fetch
from pywikibot.exceptions import NoPageError
from pywikibot.specialbots import UploadRobot
@@ -331,7 +329,7 @@
filename = os.path.join(csv_dir, configuration['csvFile'])
try:
f = codecs.open(filename, 'r', configuration['csvEncoding'])
- except (IOError, OSError) as e:
+ except OSError as e:
pywikibot.error('{} could not be opened: {}'.format(filename, e))
else:
with f:
diff --git a/scripts/archive/editarticle.py b/scripts/archive/editarticle.py
index 2f73464..484e80b 100755
--- a/scripts/archive/editarticle.py
+++ b/scripts/archive/editarticle.py
@@ -34,7 +34,6 @@

import pywikibot
from pywikibot import i18n
-from pywikibot.backports import Tuple
from pywikibot.editor import TextEditor
from pywikibot.exceptions import EditConflictError, NoPageError

diff --git a/scripts/archive/flickrripper.py b/scripts/archive/flickrripper.py
index c12ec7a..2bbb132 100755
--- a/scripts/archive/flickrripper.py
+++ b/scripts/archive/flickrripper.py
@@ -18,7 +18,7 @@
-autonomous run bot in autonomous mode
"""
#
-# (C) Pywikibot team, 2009-2020
+# (C) Pywikibot team, 2009-2021
#
# Distributed under the terms of the MIT license.
#
@@ -143,7 +143,7 @@

def getFlinfoDescription(photo_id):
"""
- Get the description from http://wikipedia.ramselehof.de/flinfo.php
+ Get the description from http://wikipedia.ramselehof.de/flinfo.php.

TODO: Add exception handling, try a couple of times
"""
diff --git a/scripts/archive/imagecopy.py b/scripts/archive/imagecopy.py
index dabf880..49577d0 100755
--- a/scripts/archive/imagecopy.py
+++ b/scripts/archive/imagecopy.py
@@ -225,7 +225,7 @@
return data


-class imageTransfer(threading.Thread):
+class imageTransfer(threading.Thread): # noqa: N801

"""Facilitate transfer of image/file to commons."""

diff --git a/scripts/archive/imagecopy_self.py b/scripts/archive/imagecopy_self.py
index 16e74f9..8a604e8 100755
--- a/scripts/archive/imagecopy_self.py
+++ b/scripts/archive/imagecopy_self.py
@@ -31,7 +31,7 @@
check it yourself.
"""
#
-# (C) Pywikibot team, 2003-2020
+# (C) Pywikibot team, 2003-2021
#
# Distributed under the terms of the MIT license.
#
@@ -358,7 +358,7 @@
return all(site.code in elem for elem in l10n_dicts)


-class imageFetcher(threading.Thread):
+class imageFetcher(threading.Thread): # noqa: N801

"""Tries to fetch information for all images in the generator."""

@@ -633,7 +633,7 @@
return result


-class userInteraction(threading.Thread):
+class userInteraction(threading.Thread): # noqa: N801

"""Prompt all images to the user."""

@@ -867,7 +867,7 @@
webbrowser.open(self.url)


-class uploader(threading.Thread):
+class uploader(threading.Thread): # noqa: N801

"""Upload all images."""

@@ -919,7 +919,7 @@
'|year={{subst:CURRENTYEAR}}'
'|month={{subst:CURRENTMONTHNAME}}'
'|day={{subst:CURRENTDAY}}}}\n'
- % {'lang': lang, 'family': family}
+ % {'lang': lang, 'family': family})
cid += '== {{int:filedesc}} ==\n'
cid += CID_INFO.format_map(fields)
cid += '== {{int:license}} ==\n'
diff --git a/scripts/archive/imageuncat.py b/scripts/archive/imageuncat.py
index 3a00123..f0225b7 100755
--- a/scripts/archive/imageuncat.py
+++ b/scripts/archive/imageuncat.py
@@ -10,20 +10,15 @@
&params;
"""
#
-# (C) Pywikibot team, 2008-2020
+# (C) Pywikibot team, 2008-2021
#
# Distributed under the terms of the MIT license.
#
from contextlib import suppress
-from datetime import timedelta

import pywikibot
from pywikibot import pagegenerators
-from pywikibot.exceptions import (
- ArgumentDeprecationWarning,
- EditConflictError,
- LockedPageError,
-)
+from pywikibot.exceptions import EditConflictError, LockedPageError


docuReplacements = {
diff --git a/scripts/archive/isbn.py b/scripts/archive/isbn.py
index bef6067..2207d28 100755
--- a/scripts/archive/isbn.py
+++ b/scripts/archive/isbn.py
@@ -34,7 +34,7 @@

"""
#
-# (C) Pywikibot team, 2009-2020
+# (C) Pywikibot team, 2009-2021
#
# Distributed under the terms of the MIT license.
#
@@ -201,7 +201,7 @@
.format(page.title()))
except SpamblacklistError as e:
pywikibot.output(
- 'Cannot change {} because of blacklist entry {1}'
+ 'Cannot change {} because of blacklist entry {}'
.format(page.title(), e.url))
except LockedPageError:
pywikibot.output('Skipping {} (locked page)'
diff --git a/tox.ini b/tox.ini
index 442d909..53db0f8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -108,7 +108,7 @@

ignore = B007,C103,D105,D211,D401,D413,D412,FI1,H101,H238,H301,H306,H404,H405,H903,P101,P102,P103,P205,W503
enable-extensions = H203,H204,H205
-exclude = .tox,.git,./*.egg,build,scripts/archive/*,./scripts/i18n/*,./tests/archive/*
+exclude = .tox,.git,./*.egg,build,./scripts/i18n/*
classmethod-decorators = classmethod,classproperty

# flake8-coding
@@ -161,6 +161,7 @@
pywikibot/userinterfaces/terminal_interface_win32.py: E241, N816
pywikibot/userinterfaces/win32_unicode.py: N801, N803, N806, N812, T001
pywikibot/xmlreader.py: N802, N803, N806
+ scripts/archive/*: N802, N803, N806, N815, N816
scripts/add_text.py: N803, N806
scripts/blockpageschecker.py : E501, N802, N803, N806, N816
scripts/category.py: N802, N803, N806
@@ -185,6 +186,7 @@
scripts/weblinkchecker.py: N802, N803, N806
scripts/welcome.py: N802, N815
setup.py: T001
+ tests/archive/*: N802
tests/api_tests.py: N802
tests/archivebot_tests.py: N802
tests/aspects.py: N802

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I9ad68bdfd33d78f13323fdd42345b15aa5bc56de
Gerrit-Change-Number: 722856
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged