jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/800924 )

Change subject: [PEP8] rename FilePage.usingPages to using_pages
......................................................................

[PEP8] rename FilePage.usingPages to using_pages

This method identifier was already used by accident (T309473).
Rename the method due to PEP8.

Change-Id: Ib976a8d58eecf9950464df5566dbdfeb8559c30c
---
M HISTORY.rst
M ROADMAP.rst
M pywikibot/page/_filepage.py
M pywikibot/pagegenerators.py
M scripts/checkimages.py
M scripts/delinker.py
M scripts/image.py
M scripts/nowcommons.py
M tests/file_tests.py
9 files changed, 26 insertions(+), 14 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/HISTORY.rst b/HISTORY.rst
index 2b27147..8bb7618 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -58,7 +58,7 @@
 * Don't try to upcast timestamp from global userinfo if global account does 
not exists (:phab:`T305351`)
 * Archived scripts were removed; create a Phabricator task to restore some 
(:phab:`T223826`)
 * Add Lexeme support for Lexicographical data (:phab:`T189321`, 
:phab:`T305297`)
-* enable all parameters of `APISite.imageusage()` with `FilePage.usingPages()`
+* enable all parameters of `APISite.imageusage()` with `FilePage.using_pages()`
 * Don't raise `NoPageError` with `file_is_shared` (:phab:`T305182`)
 * Fix URL of GoogleOCR
 * Handle ratelimit with purgepages() (:phab:`T152597`)
diff --git a/ROADMAP.rst b/ROADMAP.rst
index a2eeb86..3e9a9b5 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -6,6 +6,7 @@
 Deprecations
 ^^^^^^^^^^^^

+* 7.4.0: `FilePage.usingPages()` was renamed to `using_pages()`
 * 7.2.0: ``tb`` parameter of ``exception()`` function was renamed to 
``exc_info``
 * 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a `content` 
parameter (:phab:`T306134`)
 * 7.2.0: RedirectPageBot and NoRedirectPageBot bot classes are deprecated in 
favour of `use_redirects` attribute
diff --git a/pywikibot/page/_filepage.py b/pywikibot/page/_filepage.py
index 170626a..7cc6b58 100644
--- a/pywikibot/page/_filepage.py
+++ b/pywikibot/page/_filepage.py
@@ -17,7 +17,7 @@
 from pywikibot.comms import http
 from pywikibot.exceptions import NoPageError
 from pywikibot.page._pages import Page
-from pywikibot.tools import compute_file_hash
+from pywikibot.tools import compute_file_hash, deprecated

 __all__ = (
     'FileInfo',
@@ -175,7 +175,7 @@
                 '| {{int:filehist-dimensions}} || {{int:filehist-comment}}\n'
                 '|-\n%s\n|}\n' % '\n|-\n'.join(lines))

-    def usingPages(self, **kwargs):  # noqa: N802
+    def using_pages(self, **kwargs):
         """Yield Pages on which the file is displayed.

         For parameters refer
@@ -187,9 +187,20 @@
            all parameters from :meth:`APISite.imageusage()
            <pywikibot.site._generators.GeneratorsMixin.imageusage>`
            are available.
+        .. versionchanged:: 7.4
+           renamed from :meth:`usingPages`.
         """
         return self.site.imageusage(self, **kwargs)

+    @deprecated('using_pages', since='7.4.0')
+    def usingPages(self, **kwargs):  # noqa: N802
+        """Yield Pages on which the file is displayed.
+
+        .. deprecated:: 7.4.0
+           Use :meth:`using_pages` instead.
+        """
+        return self.using_pages(**kwargs)
+
     @property
     def file_is_used(self) -> bool:
         """Check whether the file is used at this site.
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index bd1374a..fd413bf 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -811,7 +811,7 @@
         if not value.startswith(self.site.namespace(6) + ':'):
             value = 'Image:' + value
         file_page = pywikibot.FilePage(self.site, value)
-        return file_page.usingPages()
+        return file_page.using_pages()

     def _handle_linter(self, value: str) -> HANDLER_RETURN_TYPE:
         """Handle `-linter` argument."""
@@ -1521,7 +1521,7 @@
     content: bool = False
 ) -> Iterable['pywikibot.page.Page']:
     """Yield Pages on which referredFilePage file is displayed."""
-    return referredFilePage.usingPages(total=total, content=content)
+    return referredFilePage.using_pages(total=total, content=content)


 def ImagesPageGenerator(
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 55f6a5d..9f6e3f0 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -806,7 +806,7 @@
         """
         # find the most used image
         images = [image for _, image in list_given]
-        iterables = [image.usingPages() for image in images]
+        iterables = [image.using_pages() for image in images]
         curr_images = []
         for values in zip_longest(*iterables, fillvalue=False):
             curr_images = values
diff --git a/scripts/delinker.py b/scripts/delinker.py
index bad4000..507e56e 100644
--- a/scripts/delinker.py
+++ b/scripts/delinker.py
@@ -109,7 +109,7 @@
             .format('|'.join(ignore_case(s) for s in namespace), escaped))

         shown = False
-        for page in file_page.usingPages(content=True, namespaces=0):
+        for page in file_page.using_pages(content=True, namespaces=0):
             if not shown:
                 pywikibot.output(
                     '\n>>> <<lightgreen>>Delinking {}<<default>> <<<'
diff --git a/scripts/image.py b/scripts/image.py
index f29c5f7..363707d 100755
--- a/scripts/image.py
+++ b/scripts/image.py
@@ -140,7 +140,7 @@
     if old_image:
         site = pywikibot.Site()
         old_imagepage = pywikibot.FilePage(site, old_image)
-        gen = old_imagepage.usingPages()
+        gen = old_imagepage.using_pages()
         preloading_gen = pagegenerators.PreloadingGenerator(gen)
         bot = ImageRobot(preloading_gen, old_image, new_image,
                          site=site, **options)
diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py
index eeb3fc4..e029fbe 100755
--- a/scripts/nowcommons.py
+++ b/scripts/nowcommons.py
@@ -281,7 +281,7 @@
                                                'File:' + file_on_commons)
         if (local_file_page.title(with_ns=False)
                 != commons_file_page.title(with_ns=False)):
-            using_pages = list(local_file_page.usingPages())
+            using_pages = list(local_file_page.using_pages())

             if using_pages and using_pages != [local_file_page]:
                 pywikibot.output(
@@ -296,7 +296,7 @@
                         .format(local_file_page.title(with_ns=False),
                                 commons_file_page.title(with_ns=False)))

-                    bot = ImageBot(local_file_page.usingPages(),
+                    bot = ImageBot(local_file_page.using_pages(),
                                    local_file_page.title(with_ns=False),
                                    commons_file_page.title(with_ns=False),
                                    always=self.opt.replacealways,
@@ -306,7 +306,7 @@
                     # If the image is used with the urlname
                     # the previous function won't work
                     if local_file_page.file_is_used and self.opt.replaceloose:
-                        bot = ImageBot(local_file_page.usingPages(),
+                        bot = ImageBot(local_file_page.using_pages(),
                                        local_file_page.title(with_ns=False,
                                                              as_url=True),
                                        commons_file_page.title(with_ns=False),
diff --git a/tests/file_tests.py b/tests/file_tests.py
index 5293292..8063d34 100755
--- a/tests/file_tests.py
+++ b/tests/file_tests.py
@@ -52,7 +52,7 @@
         commons = self.get_site('commons')
         itwp = self.get_site('itwiki')
         itwp_file = pywikibot.FilePage(itwp, title)
-        for using in itwp_file.usingPages():
+        for using in itwp_file.using_pages():
             self.assertIsInstance(using, pywikibot.Page)

         commons_file = pywikibot.FilePage(commons, title)
@@ -81,7 +81,7 @@
         commons = self.get_site('commons')
         enwp = self.get_site('enwiki')
         enwp_file = pywikibot.FilePage(enwp, title)
-        for using in enwp_file.usingPages():
+        for using in enwp_file.using_pages():
             self.assertIsInstance(using, pywikibot.Page)

         commons_file = pywikibot.FilePage(commons, title)
@@ -113,7 +113,7 @@
         commons = self.get_site('commons')
         testwp = self.get_site('testwiki')
         testwp_file = pywikibot.FilePage(testwp, title)
-        for using in testwp_file.usingPages():
+        for using in testwp_file.using_pages():
             self.assertIsInstance(using, pywikibot.Page)

         commons_file = pywikibot.FilePage(commons, title)

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/800924
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: Ib976a8d58eecf9950464df5566dbdfeb8559c30c
Gerrit-Change-Number: 800924
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: DannyS712 <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to