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

Change subject: Update add_text for py3
......................................................................

Update add_text for py3

Bug: T257399
Change-Id: I52cca222398974f778578da778bc07fefe8920bc
---
M scripts/add_text.py
1 file changed, 7 insertions(+), 10 deletions(-)

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



diff --git a/scripts/add_text.py b/scripts/add_text.py
index 42a5c80..649090e 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -59,12 +59,12 @@
 #
 # Distributed under the terms of the MIT license.
 #
-from __future__ import absolute_import, division, unicode_literals
-
 import codecs
 import re
 import sys

+from typing import Optional, Tuple, Union
+
 import pywikibot

 from pywikibot import config, i18n, pagegenerators, textlib
@@ -74,7 +74,7 @@
 docuReplacements = {'&params;': pagegenerators.parameterHelp}  # noqa: N816


-def get_text(page, old, create):
+def get_text(page, old, create) -> str:
     """
     Get text on page. If old is not None, return old.

@@ -86,7 +86,6 @@
     @param create: Create the page if it doesn't exist
     @type create: bool
     @return: The page's text or old parameter if not None
-    @rtype: str
     """
     if old is None:
         try:
@@ -108,7 +107,7 @@
     return text


-def put_text(page, new, summary, count, asynchronous=False):
+def put_text(page, new, summary, count, asynchronous=False) -> Optional[bool]:
     """
     Save the new text.

@@ -124,7 +123,6 @@
     @type asynchronous: bool
     @return: True if successful, False if unsuccessful, None if
         waiting for server
-    @rtype: bool / None
     """
     page.text = new
     try:
@@ -155,7 +153,8 @@

 def add_text(page, addText, summary=None, regexSkip=None,
              regexSkipUrl=None, always=False, up=False, putText=True,
-             oldTextGiven=None, reorderEnabled=True, create=False):
+             oldTextGiven=None, reorderEnabled=True, create=False
+             ) -> Union[Tuple[bool, bool, bool], Tuple[str, str, bool]]:
     """
     Add text to a page.

@@ -185,8 +184,6 @@
     @type create: bool
     @return: If putText=True: (success, success, always)
         else: (text, newtext, always)
-    @rtype: Tuple of (bool, bool, bool) or (str, str, bool)
-        depending on value of putText parameter
     """
     site = page.site
     if not summary:
@@ -284,7 +281,7 @@
             error_count += 1


-def main(*args):
+def main(*args) -> None:
     """
     Process command line arguments and invoke bot.


--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/611565
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: I52cca222398974f778578da778bc07fefe8920bc
Gerrit-Change-Number: 611565
Gerrit-PatchSet: 3
Gerrit-Owner: JJMC89 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to