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

Change subject: [cleanup] remove deprecated toStdout parameter in 
pywikibot.output()
......................................................................

[cleanup] remove deprecated toStdout parameter in pywikibot.output()

Change-Id: I29d25a87b7b4dca1e5542b326b9916e220ad3538
---
M pywikibot/logging.py
M tests/ui_tests.py
2 files changed, 8 insertions(+), 28 deletions(-)

Approvals:
  Matěj Suchánek: Looks good to me, but someone else must approve
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/logging.py b/pywikibot/logging.py
index 83a8bcb..ccb92af 100644
--- a/pywikibot/logging.py
+++ b/pywikibot/logging.py
@@ -1,6 +1,6 @@
 """Logging functions."""
 #
-# (C) Pywikibot team, 2010-2020
+# (C) Pywikibot team, 2010-2021
 #
 # Distributed under the terms of the MIT license.
 #
@@ -101,7 +101,7 @@
     logger.log(_level, text, extra=context, **kwargs)


-def output(text, decoder=None, newline=True, toStdout=False, **kwargs):
+def output(text, decoder=None, newline=True, **kwargs):
     r"""Output a message to the user via the userinterface.

     Works like print, but uses the encoding used by the user's console
@@ -112,10 +112,6 @@

     If newline is True, a line feed will be added after printing the text.

-    If toStdout is True, the text will be sent to standard output,
-    so that it can be piped to another process. All other text will
-    be sent to stderr. See: https://en.wikipedia.org/wiki/Pipeline_%28Unix%29
-
     text can contain special sequences to create colored output. These
     consist of the escape character \03 and the color name in curly braces,
     e. g. \03{lightpurple}. \03{default} resets the color. By using the
@@ -126,19 +122,16 @@
     only argument that is useful is "exc_info=True", which causes the
     log message to include an exception traceback.
     """
-    if toStdout:  # maintained for backwards-compatibity only
-        from pywikibot.tools import issue_deprecation_warning
-        issue_deprecation_warning('"toStdout" parameter', 'pywikibot.stdout()',
-                                  warning_class=FutureWarning,
-                                  since='20160228')
-        logoutput(text, decoder, newline, STDOUT, **kwargs)
-    else:
-        logoutput(text, decoder, newline, INFO, **kwargs)
+    logoutput(text, decoder, newline, INFO, **kwargs)


 def stdout(text, decoder=None, newline=True, **kwargs):
     """Output script results to the user via the userinterface.

+    The text will be sent to standard output, so that it can be piped to
+    another process. All other text will be sent to stderr.
+    See: https://en.wikipedia.org/wiki/Pipeline_%28Unix%29
+
     @param text: the message printed via stdout logger to the user.
     @param decoder: If None, text should be a unicode string else it should
         be encoded in the given encoding.
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index d95c06e..8f21ae2 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -29,7 +29,6 @@
 import subprocess
 import sys
 import time
-import warnings

 from contextlib import suppress

@@ -253,22 +252,10 @@
         self.assertEqual(newstderr.getvalue(), 'CRITICAL: CRITICAL\n')

     def test_output(self):
-        pywikibot.output('output', toStdout=False)
+        pywikibot.output('output')
         self.assertEqual(newstdout.getvalue(), '')
         self.assertEqual(newstderr.getvalue(), 'output\n')

-    def test_output_stdout(self):
-        with warnings.catch_warnings(record=True) as w:
-            pywikibot.output('output', toStdout=True)
-            self.assertEqual(newstdout.getvalue(), 'output\n')
-            self.assertLength(w, 1)
-            self.assertEqual(w[0].category, FutureWarning)
-            message = str(w[0].message)
-            self.assertTrue(
-                message.startswith('"toStdout" parameter is deprecated'))
-            self.assertTrue(
-                message.endswith('use pywikibot.stdout() instead.'))
-
     def test_stdout(self):
         pywikibot.stdout('output')
         self.assertEqual(newstdout.getvalue(), 'output\n')

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/661347
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: I29d25a87b7b4dca1e5542b326b9916e220ad3538
Gerrit-Change-Number: 661347
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Matěj Suchánek <[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