jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/703500 )
Change subject: [IMPR] Cleanup _logging.Formatter
......................................................................
[IMPR] Cleanup _logging.Formatter
- move RotatingFileHandler.format method to the LoggingFormatter:
each Handler may have its own Formatter. Handler.format calls the
Formatter format:
https://github.com/python/cpython/blob/3.9/Lib/logging/__init__.py
- remove formatException because newline is already appended inside
Formatter.format method it it is missing.
Bug: T286337
Change-Id: Ida4402af4424bc1075d3eda967a6d5d51f93cb85
---
M pywikibot/tools/_logging.py
1 file changed, 6 insertions(+), 15 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/_logging.py b/pywikibot/tools/_logging.py
index c6890aa..c3b79df 100644
--- a/pywikibot/tools/_logging.py
+++ b/pywikibot/tools/_logging.py
@@ -1,6 +1,6 @@
"""Logging tools."""
#
-# (C) Pywikibot team, 2009-2020
+# (C) Pywikibot team, 2009-2021
#
# Distributed under the terms of the MIT license.
#
@@ -71,6 +71,11 @@
if not self.delay:
self.stream = self._open()
+
+class LoggingFormatter(logging.Formatter):
+
+ """Format LogRecords for output to file."""
+
def format(self, record):
"""Strip trailing newlines before outputting text to file."""
# Warnings captured from the warnings system are not processed by
@@ -88,17 +93,3 @@
record.args = (msg,)
return super().format(record).rstrip()
-
-
-class LoggingFormatter(logging.Formatter):
-
- """Format LogRecords for output to file.
-
- This formatter *ignores* the 'newline' key of the LogRecord, because
- every record written to a file must end with a newline, regardless of
- whether the output to the user's console does.
- """
-
- def formatException(self, ei):
- """Format and return the specified exception with newline."""
- return super().formatException(ei) + '\n'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/703500
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: Ida4402af4424bc1075d3eda967a6d5d51f93cb85
Gerrit-Change-Number: 703500
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/704967 )
Change subject: [doc] Fix doc of bot.input_choice answers parameter
......................................................................
[doc] Fix doc of bot.input_choice answers parameter
bot.input_choice answers parameter is a bot.Option
rather than a bot.ChoiceException.
Also fix bullet list in bot.Option dict.
Change-Id: I35aa7f1c28c0c606a7d2907fb1bd16212063ed7b
---
M pywikibot/bot.py
M pywikibot/bot_choice.py
2 files changed, 6 insertions(+), 5 deletions(-)
Approvals:
Damian: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index b261d09..e49315f 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -520,8 +520,8 @@
:param question: The question asked without trailing spaces.
:param answers: The valid answers each containing a full length answer and
a shortcut. Each value must be unique.
- :type answers: iterable containing a sequence of length two or instances of
- ChoiceException
+ :type answers: iterable containing a sequence of length two or
+ instances of :py:class:`pywikibot.bot.Option`
:param default: The result if no answer was entered. It must not be in the
valid answers and can be disabled by setting it to None. If it should
be linked with the valid answers it must be its shortcut.
diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index 89daa17..943db8a 100755
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -27,9 +27,10 @@
A basic option for input_choice.
The following methods need to be implemented:
- * format(default=None)
- * result(value)
- * test(value)
+
+ - format(default=None)
+ - result(value)
+ - test(value)
The methods ``test`` and ``handled`` are in such a relationship that
when ``handled`` returns itself that ``test`` must return True for
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/704967
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: I35aa7f1c28c0c606a7d2907fb1bd16212063ed7b
Gerrit-Change-Number: 704967
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Damian <atagar1(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/705104 )
Change subject: Typo fix: "the the" -> "the"
......................................................................
Typo fix: "the the" -> "the"
Bug: T201491
Change-Id: I6ae87dd9614f108e098d420459167194e31ff8ff
---
M pywikibot/family.py
M pywikibot/page/__init__.py
2 files changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 143bc81..f3222b8 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -814,7 +814,7 @@
"""
Return whether this family matches the given url.
- It is first checking if a domain of this family is in the the domain of
+ It is first checking if a domain of this family is in the domain of
the URL. If that is the case it's checking all codes and verifies that
a path generated via :py:obj:`APISite.article_path` and
:py:obj:`Family.path` matches the path of the URL together with
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 12ca00e..ee06a02 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -832,7 +832,7 @@
"""
Return True if this is a disambiguation page, False otherwise.
- By default, it uses the the Disambiguator extension's result. The
+ By default, it uses the Disambiguator extension's result. The
identification relies on the presence of the __DISAMBIG__ magic word
which may also be transcluded.
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/705104
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: I6ae87dd9614f108e098d420459167194e31ff8ff
Gerrit-Change-Number: 705104
Gerrit-PatchSet: 2
Gerrit-Owner: DannyS712 <dannys712.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged