Sn1per has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/262420

Change subject: Add/improve docstrings for miscellaneous functions
......................................................................

Add/improve docstrings for miscellaneous functions

Docstrings updated for:
* pywikibot.cosmetic_changes.CosmeticChangesToolkit.cleanUpLinks
* pywikibot.page.BasePage.linkedPages
* pywikibot.pagegenerators.LinkedPageGenerator

Bug: T118423
Change-Id: Ie0409fd8231a5ff800f107de11511426078b6f3e
---
M pywikibot/cosmetic_changes.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
3 files changed, 31 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/20/262420/1

diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 8aabc09..b71072c 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -467,6 +467,22 @@
         return text
 
     def cleanUpLinks(self, text):
+        """Tidies up wikilinks found in a string.
+
+        This function will:
+        * Replace underscores with spaces
+        * Move leading and trailing spaces out of the wikilink and into
+          the surrounding text
+        * Convert URL-encoded characters into Unicode-encoded characters
+        * Move trailing characters out of the link and make the link without
+          using a pipe, if possible
+        * Capitalize the article title of the link, if appropriate
+
+        @param text: string to perform the clean-up on
+        @type text: str
+        @return: text with tidied wikilinks
+        @rtype: str"""
+
         # helper function which works on one link and either returns it
         # unmodified, or returns a replacement.
         def handleOneLink(match):
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 34f30b6..62f4023 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1291,6 +1291,7 @@
         @type content: bool
 
         @return: a generator that yields Page objects.
+        @rtype: generator
         """
         return self.site.pagelinks(self, namespaces=namespaces, step=step,
                                    total=total, content=content)
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 0d5afdf..125554d 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -1218,7 +1218,20 @@
 
 
 def LinkedPageGenerator(linkingPage, step=None, total=None, content=False):
-    """Yield all pages linked from a specific page."""
+    """Yield all pages linked from a specific page.
+
+    See :py:func:pywikibot.page.BasePage.linkedPages for details.
+
+    @param linkingPage: the page that links to the pages we want
+    @type linkingPage: L{pywikibot.Page}
+    @param step: the limit number of pages to retrieve per API call
+    @type step: int
+    @param total: the total number of pages to iterate
+    @type total: int
+    @param content: if True, retrieve the current content of each linked page
+    @type content: bool
+    @return: a generator that yields Page objects of pages linked to 
linkingPage
+    @rtype: generator"""
     return linkingPage.linkedPages(step=step, total=total, content=content)
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/262420
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie0409fd8231a5ff800f107de11511426078b6f3e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Sn1per <geof...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to