jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/625665 )
Change subject: [cleanup] Replace deprecated file_djvu with DjVuFile.file attribute ......................................................................
[cleanup] Replace deprecated file_djvu with DjVuFile.file attribute
Change-Id: I10481584821ba1b9105c2c9cb0228478d339273a --- M scripts/djvutext.py M tests/djvu_tests.py 2 files changed, 6 insertions(+), 10 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/djvutext.py b/scripts/djvutext.py index 0ef9519..36427e4 100644 --- a/scripts/djvutext.py +++ b/scripts/djvutext.py @@ -28,12 +28,10 @@
""" # -# (C) Pywikibot team, 2008-2019 +# (C) Pywikibot team, 2008-2020 # # Distributed under the terms of the MIT license. # -from __future__ import absolute_import, division, unicode_literals - import os.path
import pywikibot @@ -68,7 +66,7 @@ 'force': False, 'summary': None }) - super(DjVuTextBot, self).__init__(site=index.site, **kwargs) + super().__init__(site=index.site, **kwargs) self._djvu = djvu self._index = index self._prefix = self._index.title(with_ns=False) @@ -92,8 +90,7 @@ for start, end in sorted(self._pages): start = max(last, start) last = end + 1 - for page_number in range(start, last): - yield page_number + yield from range(start, last)
def gen(self): """Generate pages from specified page interval.""" @@ -174,8 +171,7 @@ djvu = DjVuFile(djvu_path)
if not djvu.has_text(): - pywikibot.error('No text layer in djvu file {}' - .format(djvu.file_djvu)) + pywikibot.error('No text layer in djvu file {}'.format(djvu.file)) return
# Parse pages param. @@ -201,7 +197,7 @@ raise pywikibot.NoPage(index)
pywikibot.output('uploading text from {} to {}' - .format(djvu.file_djvu, index_page.title(as_link=True))) + .format(djvu.file, index_page.title(as_link=True)))
bot = DjVuTextBot(djvu, index_page, pages, **options) bot.run() diff --git a/tests/djvu_tests.py b/tests/djvu_tests.py index 5f8b658..4ce9d55 100644 --- a/tests/djvu_tests.py +++ b/tests/djvu_tests.py @@ -34,7 +34,7 @@ @classmethod def setUpClass(cls): """Setup tests.""" - super(TestDjVuFile, cls).setUpClass() + super().setUpClass() try: dp = subprocess.Popen(['djvudump'], stdout=subprocess.PIPE,
pywikibot-commits@lists.wikimedia.org