jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/633303 )
Change subject: [IMPR] remove deprecated use of fileUrl
......................................................................
[IMPR] remove deprecated use of fileUrl
Use get_file_url in favor of deprecated fileUrl
Change-Id: Ic55bf44b84f9bd7687e8db06fa7cf5b37e5b8712
---
M scripts/imagecopy.py
M scripts/imagecopy_self.py
M scripts/imagetransfer.py
M scripts/match_images.py
M scripts/unusedfiles.py
5 files changed, 10 insertions(+), 21 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py
index 838d92e..aae2751 100644
--- a/scripts/imagecopy.py
+++ b/scripts/imagecopy.py
@@ -61,8 +61,6 @@
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
import codecs
import re
import threading
@@ -280,7 +278,7 @@
'added categories -->', '')
CH += '[[Category:' + self.category + ']]'
- bot = UploadRobot(url=self.imagePage.fileUrl(), description=CH,
+ bot = UploadRobot(url=self.imagePage.get_file_url(), description=CH,
use_filename=self.newname, keep_filename=True,
verify_description=False, ignore_warning=True,
target_site=self.image_repo)
@@ -394,7 +392,7 @@
if isinstance(Tkinter, ImportError):
raise Tkinter
- super(TkdialogIC, self).__init__()
+ super().__init__()
self.root = Tkinter.Tk()
# "%dx%d%+d%+d" % (width, height, xoffset, yoffset)
# Always appear the same size and in the bottom-left corner
diff --git a/scripts/imagecopy_self.py b/scripts/imagecopy_self.py
index 8580388..6fa8706 100644
--- a/scripts/imagecopy_self.py
+++ b/scripts/imagecopy_self.py
@@ -36,13 +36,12 @@
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
import re
import threading
import webbrowser
from datetime import datetime
+from queue import Queue
from textwrap import fill
import pywikibot
@@ -51,15 +50,9 @@
from pywikibot.specialbots import UploadRobot
from pywikibot.textlib import removeCategoryLinks
-from pywikibot.tools import PY2
from scripts import imagerecat, image
-if not PY2:
- from queue import Queue
-else:
- from Queue import Queue
-
try:
from pywikibot.userinterfaces.gui import Tkdialog, Tkinter
except ImportError as _tk_error:
@@ -688,7 +681,7 @@
# to configure this
# Get all the relevant fields
- super(TkdialogICS, self).__init__()
+ super().__init__()
self.imagepage = fields.get('imagepage')
self.filename = fields.get('filename')
@@ -880,7 +873,7 @@
"""Work on a single image."""
cid = self.buildNewImageDescription(fields)
pywikibot.output(cid)
- bot = UploadRobot(url=fields.get('imagepage').fileUrl(),
+ bot = UploadRobot(url=fields.get('imagepage').get_file_url(),
description=cid,
use_filename=fields.get('filename'),
keep_filename=True, verify_description=False,
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index f421889..d251906 100755
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -32,8 +32,6 @@
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
import re
import sys
@@ -150,7 +148,7 @@
@return: the filename which was used to upload the image
"""
sourceSite = sourceImagePage.site
- url = sourceImagePage.fileUrl().encode('utf-8')
+ url = sourceImagePage.get_file_url().encode('utf-8')
pywikibot.output('URL should be: ' + url)
# localize the text that should be printed on image description page
try:
diff --git a/scripts/match_images.py b/scripts/match_images.py
index 5a69099..22e44c1 100755
--- a/scripts/match_images.py
+++ b/scripts/match_images.py
@@ -23,7 +23,7 @@
Expect the code to change a lot!
"""
#
-# (c) Pywikibot team, 2009-2019
+# (c) Pywikibot team, 2009-2020
#
# Distributed under the terms of the MIT license.
#
@@ -108,7 +108,7 @@
def get_image_from_image_page(imagePage):
"""Get the image object to work based on an imagePage object."""
- imageURL = imagePage.fileUrl()
+ imageURL = imagePage.get_file_url()
imageURLopener = http.fetch(imageURL)
imageBuffer = io.BytesIO(imageURLopener.raw[:])
image = Image.open(imageBuffer)
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index 7ee2549..1ccbce5 100755
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -60,9 +60,9 @@
def treat(self, image):
"""Process one image page."""
- # Use fileUrl() and file_is_shared() to confirm it is local media
+ # Use get_file_url() and file_is_shared() to confirm it is local media
# rather than a local page with the same name as shared media.
- if (image.fileUrl() and not image.file_is_shared()
+ if (image.get_file_url() and not image.file_is_shared()
and 'http://' not in image.text):
if self.template_image in image.text:
pywikibot.output('{0} done already'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/633303
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic55bf44b84f9bd7687e8db06fa7cf5b37e5b8712
Gerrit-Change-Number: 633303
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Mpaa <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits