jenkins-bot submitted this change.
[cleanup] Remove deprecated code parts in data_ingestion.py
- remove deprecated site parameter fo findDuplicateImages method
- remove deprecated 'deprecated_default_commons' site parameter
- use Bot's defaults for site and generator
Change-Id: I497d745eed477abee6b5e5838c89285e33579931
---
M scripts/archive/data_ingestion.py
1 file changed, 4 insertions(+), 19 deletions(-)
diff --git a/scripts/archive/data_ingestion.py b/scripts/archive/data_ingestion.py
index 49f1521..27b4a8b 100755
--- a/scripts/archive/data_ingestion.py
+++ b/scripts/archive/data_ingestion.py
@@ -113,7 +113,6 @@
from pywikibot.comms.http import fetch
from pywikibot.exceptions import NoPageError
from pywikibot.specialbots import UploadRobot
-from pywikibot.tools import deprecated_args
class Photo(pywikibot.FilePage):
@@ -158,7 +157,6 @@
self.contents = io.BytesIO(imageFile)
return self.contents
- @deprecated_args(site=True)
def findDuplicateImages(self):
"""
Find duplicates of the photo.
@@ -218,8 +216,7 @@
"""Data ingestion bot."""
- def __init__(self, reader, titlefmt: str, pagefmt: str,
- site='deprecated_default_commons'):
+ def __init__(self, titlefmt: str, pagefmt: str, **kwargs):
"""
Initializer.
@@ -227,19 +224,8 @@
:type reader: Photo page generator
:param titlefmt: Title format
:param pagefmt: Page format
- :param site: Target site for image upload.
- Use None to determine the site from the pages treated.
- Defaults to 'deprecated_default_commons' to use Wikimedia Commons
- for backwards compatibility reasons. Deprecated.
- :type site: pywikibot.site.APISite, 'deprecated_default_commons' or
- None
"""
- if site == 'deprecated_default_commons':
- warn("site='deprecated_default_commons' is deprecated; "
- 'please specify a site or use site=None',
- DeprecationWarning, 2)
- site = pywikibot.Site('commons', 'commons')
- super().__init__(generator=reader, site=site)
+ super().__init__(**kwargs)
self.titlefmt = titlefmt
self.pagefmt = pagefmt
@@ -354,10 +340,9 @@
dialect=configuration['csvDialect'],
delimiter=str(configuration['csvDelimiter']))
- bot = DataIngestionBot(files,
- configuration['titleFormat'],
+ bot = DataIngestionBot(configuration['titleFormat'],
configuration['formattingTemplate'],
- site=None)
+ generator=files)
bot.run()
To view, visit change 721991. To unsubscribe, or for help writing mail filters, visit settings.