jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
Add docstrings to catall.py, change_pagelang.py, claimit.py

Bug: T184115
Change-Id: I6c2cec6bd6bcd49857aed6b61b61d76bd02718a2
---
M scripts/catall.py
M scripts/change_pagelang.py
M scripts/claimit.py
3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/scripts/catall.py b/scripts/catall.py
index cb0ea9b..9fa5ced 100755
--- a/scripts/catall.py
+++ b/scripts/catall.py
@@ -32,12 +32,17 @@

if PYTHON_VERSION >= (3, 9):
Tuple = tuple
+ List = list
else:
- from typing import Tuple
+ from typing import List, Tuple


-def choosecats(pagetext):
- """Coose categories."""
+def choosecats(pagetext: str) -> List[str]:
+ """Choose categories.
+
+ @param pagetext: The text of the page
+ @return: chosen list which contains all the choices
+ """
chosen = []
done = False
length = 1000
@@ -73,8 +78,13 @@
return chosen


-def make_categories(page, list, site=None):
- """Make categories."""
+def make_categories(page, list: list, site=None):
+ """Make categories.
+
+ @param page: The page to update and save
+ @type page: pywikibot.page.BasePage
+ @param list: The list which contains categories
+ """
if site is None:
site = pywikibot.Site()
pllist = []
diff --git a/scripts/change_pagelang.py b/scripts/change_pagelang.py
index d914485..4060c7b 100755
--- a/scripts/change_pagelang.py
+++ b/scripts/change_pagelang.py
@@ -51,7 +51,11 @@
'Either "always" or "never" must be set but not both'

def changelang(self, page):
- """Set page language."""
+ """Set page language.
+
+ @param page: The page to update and save
+ @type page: pywikibot.page.BasePage
+ """
token = self.site.get_tokens(['csrf']).get('csrf')
parameters = {'action': 'setpagelanguage',
'title': page.title(),
@@ -65,7 +69,11 @@
page.title(as_link=True), self.opt.setlang))

def treat(self, page):
- """Treat a page."""
+ """Treat a page.
+
+ @param page: The page to treat
+ @type page: pywikibot.page.BasePage
+ """
# Current content language of the page and site language
parameters = {'action': 'query',
'prop': 'info',
diff --git a/scripts/claimit.py b/scripts/claimit.py
index 6825d17..58652da 100755
--- a/scripts/claimit.py
+++ b/scripts/claimit.py
@@ -87,7 +87,13 @@
.format(self.exists_arg))

def treat_page_and_item(self, page, item) -> None:
- """Treat each page."""
+ """Treat each page.
+
+ @param page: The page to update and change
+ @type page: pywikibot.page.BasePage
+ @param item: The item to treat
+ @type item: pywikibot.page.ItemPage
+ """
for claim in self.claims:
# The generator might yield pages from multiple sites
site = page.site if page is not None else None

To view, visit change 644961. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I6c2cec6bd6bcd49857aed6b61b61d76bd02718a2
Gerrit-Change-Number: 644961
Gerrit-PatchSet: 5
Gerrit-Owner: Shubham656jain <shubham656jain@gmail.com>
Gerrit-Reviewer: Ammarpad <ammarpad@yahoo.com>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999@gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged