jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/697053 )
Change subject: [doc] Update docs
......................................................................
[doc] Update docs
Change-Id: I0c13c9634e96641b47dd5ba913a3317f2e854ff7
---
M pywikibot/bot.py
M pywikibot/site/_generators.py
2 files changed, 6 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 619e24a..3112344 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -303,6 +303,9 @@
Accordingly, do **not** use print statements in bot code; instead,
use pywikibot.output function.
+ *New in version 6.2:* different logfiles are uses if multiple
+ processes of the same script are are running.
+
@param strm: Output stream. If None, re-uses the last stream if one
was defined, otherwise uses sys.stderr
@@ -1675,6 +1678,8 @@
The bot should accommodate for that case and not store site specific
information on only one site.
+
+ *New in version 6.2:* site attribute has been dropped.
"""
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index cfa7bf8..484afb9 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -736,7 +736,7 @@
include_empty_titles: bool = False):
"""Iterate all interlanguage links on page, yielding Link objects.
- *New in 6.2:* *include_empty_titles* parameter was added.
+ *New in version 6.2:* *include_empty_titles* parameter was added.
@see: U{https://www.mediawiki.org/wiki/API:Langlinks}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/697053
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: I0c13c9634e96641b47dd5ba913a3317f2e854ff7
Gerrit-Change-Number: 697053
Gerrit-PatchSet: 1
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/+/697048 )
Change subject: [doc] Update ROADMAP.rst
......................................................................
[doc] Update ROADMAP.rst
Change-Id: I998865c4dc08a66aa696c72c3f4226677bca4c41
---
M ROADMAP.rst
1 file changed, 14 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index c39575b..a4c4dc5 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -4,6 +4,9 @@
Improvements and Bugfixes
-------------------------
+* Use different logfiles for multiple processes of the same script (T56685)
+* throttle.pip will be reused as soon as possbile
+* terminal_interface_base.TerminalHandler is subclassed from logging.StreamHandler
* Fix iterating of SizedKeyCollection (T282865)
* An abstract base user interface module was added
* APISite method pagelanglinks() may skip links with empty titles (T223157)
@@ -17,6 +20,16 @@
Code cleanups
-------------
+* MultipleSitesBot.site attribute was removed (T283209)
+* Deprecated BaseSite.category_namespaces() method was removed
+* i18n.twntranslate() function was removed in favour of twtranslate()
+* siteinfo must be used as a dictionary ad cannot be called anymore
+* APISite.has_transcluded_data() method was removed
+* Deprecated LogEntry.title() method was removed
+* Deprecated APISite.watchpage() method was removed
+* OptionHandler.options dict has been removed in favour of OptionHandler.opt
+* The toStdout parameter of ui.output has been dropped
+* terminal_interface_base.TerminalFormatter was removed
* Move page functions UnicodeToAsciiHtml, unicode2html, url2unicode to tools.chars with renaming them
* Rename _MultiTemplateMatchBuilder to MultiTemplateMatchBuilder
* User.name() method was removed in favour of User.username property
@@ -31,6 +44,7 @@
Deprecations
^^^^^^^^^^^^
+* 6.2.0: Bot's availableOptions will be removed in favour of available_options
* 6.2.0: deprecated tools.is_IP will be removed
* 6.2.0: Usage of pywikibot.config2 is deprecated and will be dropped
* 6.2.0: Exceptions must be imported from exceptions namespace (T280227)
@@ -43,5 +57,4 @@
* 6.0.1: Site.undeletepage() and Site.undelete_file_versions() will be removed in favour of Site.undelete() method
* 6.0.1: Site.deletepage() and Site.deleteoldimage() will be removed in favour of Site.delete() method
* 6.0.1: DataSite.createNewItemFromPage() method will be removed in favour of ImagePage.fromPage() (T98663)
-* 5.0.0: OptionHandler.options dict will be removed in favour of OptionHandler.opt
* 5.0.0: Methods deprecated for 5 years or longer will be removed
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/697048
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: I998865c4dc08a66aa696c72c3f4226677bca4c41
Gerrit-Change-Number: 697048
Gerrit-PatchSet: 1
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/+/696935 )
Change subject: [bugfix] Enable replacements with bool(replacements) is False to be imported
......................................................................
[bugfix] Enable replacements with bool(replacements) is False to be imported
If a replacement is given with _add_deprecated_attr method and its
boolean result is false it cannot be imported and an ImportError occurs:
ImportError: cannot import name '<replacement>' from '<module>'.
Therefore check whether a replacement was given explicitly.
Change-Id: I1158e83c8a40857766d43158e636412701ae6b74
---
M pywikibot/tools/__init__.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index cfa3859..877d447 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -1886,7 +1886,7 @@
warn(warning_message.format(self._module.__name__, attr, name),
FutureWarning if future else DeprecationWarning, 2)
- if repl:
+ if repl is not None:
return repl
if '.' in name:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/696935
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: I1158e83c8a40857766d43158e636412701ae6b74
Gerrit-Change-Number: 696935
Gerrit-PatchSet: 1
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/+/696531 )
Change subject: [doc] Update documentation
......................................................................
[doc] Update documentation
* Use Better English
Change-Id: I8a9275b8752e1dc08dadaee912b1f0c7b657f284
---
M pywikibot/cosmetic_changes.py
1 file changed, 6 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index c9c0ee1..9d7e684 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -775,8 +775,8 @@
== Section title ==
:NOTE: This space is recommended in the syntax help on the
- English and German Wikipedia. It is not wanted on Lojban and
- English Wiktionary (T168399, T169064) and it might be that
+ English and German Wikipedias. It is not wanted on Lojban and
+ English Wiktionaries (T168399, T169064) and it might be that
it is not wanted on other wikis. If there are any complaints,
please file a bug report.
"""
@@ -793,7 +793,7 @@
Add a space between the * or # and the text.
:NOTE: This space is recommended in the syntax help on the
- English, German, and French Wikipedia. It might be that it
+ English, German and French Wikipedias. It might be that it
is not wanted on other wikis. If there are any complaints,
please file a bug report.
"""
@@ -1028,10 +1028,10 @@
def commonsfiledesc(self, text):
"""
- Clean up file descriptions on the Wikimedia Commons.
+ Clean up file descriptions on Wikimedia Commons.
- It is working according to [1] and works only on pages in the file
- namespace on the Wikimedia Commons.
+ It works according to [1] and works only on pages in the file
+ namespace on Wikimedia Commons.
[1]:
https://commons.wikimedia.org/wiki/Commons:Tools/pywiki_file_description_cl…
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/696531
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: I8a9275b8752e1dc08dadaee912b1f0c7b657f284
Gerrit-Change-Number: 696531
Gerrit-PatchSet: 5
Gerrit-Owner: Meno25 <meno25mail(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/+/696497 )
Change subject: [bugfix] postpone hte cached output implementation
......................................................................
[bugfix] postpone hte cached output implementation
Bug: T282962
Change-Id: I0dc8cee5512840b559c76458c02533d598a93c24
---
M ROADMAP.rst
M pywikibot/userinterfaces/terminal_interface_base.py
M tests/i18n_tests.py
3 files changed, 61 insertions(+), 93 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index eb79753..c39575b 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -5,7 +5,6 @@
-------------------------
* Fix iterating of SizedKeyCollection (T282865)
-* The cached output functionality from compat relase was re-implemented (T151727, T73646, T74942, T132135, T144698, T196039, T280466)
* An abstract base user interface module was added
* APISite method pagelanglinks() may skip links with empty titles (T223157)
* Fix Page.getDeletedRevision() method which always returned an empty list
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py
index 4adcac6..1b12f26 100755
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -13,7 +13,7 @@
import pywikibot
from pywikibot import config
-from pywikibot.backports import Sequence, SimpleQueue
+from pywikibot.backports import Sequence
from pywikibot.bot_choice import (
ChoiceException,
Option,
@@ -22,7 +22,7 @@
StandardOption,
)
from pywikibot.logging import INFO, INPUT, STDOUT, VERBOSE, WARNING
-from pywikibot.tools import deprecated_args, RLock
+from pywikibot.tools import deprecated_args
from pywikibot.userinterfaces import transliteration
from pywikibot.userinterfaces._interface_base import ABUIC
@@ -77,9 +77,6 @@
self.encoding = config.console_encoding
self.transliteration_target = config.transliteration_target
- self.cache = SimpleQueue()
- self.lock = RLock()
-
def init_handlers(self, root_logger, default_stream='stderr'):
"""Initialize the handlers for user output.
@@ -188,38 +185,12 @@
self.encounter_color(color_stack[-1], target_stream)
def output(self, text, targetStream=None):
- """Forward text to cache and flush if output is not locked.
-
- All input methods locks the output to a stream but collect them
- in cache. They will be printed with next unlocked output call or
- at termination time.
- """
- self.cache_output(text, targetStream=targetStream)
- if not self.lock.locked():
- self.flush()
-
- def flush(self):
- """Output cached text."""
- while not self.cache.empty():
- args, kwargs = self.cache.get_nowait()
- self.stream_output(*args, **kwargs)
-
- def cache_output(self, *args, **kwargs):
- """Put text to cache.
-
- *New in version 6.2*
- """
- self.cache.put_nowait((args, kwargs))
-
- def stream_output(self, text, targetStream=None):
"""
Output text to a stream.
If a character can't be displayed in the encoding used by the user's
terminal, it will be replaced with a question mark or by a
transliteration.
-
- *New in version 6.2*
"""
if config.transliterate:
# Encode our unicode string in the encoding used by the user's
@@ -305,26 +276,26 @@
question += end_marker
# lock stream output
- with self.lock:
- if force:
- self.stream_output(question + '\n')
+ # with self.lock: (T282962)
+ if force:
+ self.output(question + '\n')
+ return default
+ # sound the terminal bell to notify the user
+ if config.ring_bell:
+ sys.stdout.write('\07')
+ # TODO: make sure this is logged as well
+ while True:
+ self.output(question + ' ')
+ text = self._input_reraise_cntl_c(password)
+
+ if text is None:
+ continue
+
+ if text:
+ return text
+
+ if default is not None:
return default
- # sound the terminal bell to notify the user
- if config.ring_bell:
- sys.stdout.write('\07')
- # TODO: make sure this is logged as well
- while True:
- self.stream_output(question + ' ')
- text = self._input_reraise_cntl_c(password)
-
- if text is None:
- continue
-
- if text:
- return text
-
- if default is not None:
- return default
def _input_reraise_cntl_c(self, password):
"""Input and decode, and re-raise Control-C."""
@@ -377,7 +348,7 @@
"""Print an OutputOption before or after question."""
if isinstance(option, OutputOption) \
and option.before_question is before_question:
- self.stream_output(option.out + '\n')
+ self.output(option.out + '\n')
if force and default is None:
raise ValueError('With no default option it cannot be forced')
@@ -402,24 +373,24 @@
handled = False
# lock stream output
- with self.lock:
- while not handled:
- for option in options:
- output_option(option, before_question=True)
- output = Option.formatted(question, options, default)
- if force:
- self.stream_output(output + '\n')
- answer = default
- else:
- answer = self.input(output) or default
- # something entered or default is defined
- if answer:
- for index, option in enumerate(options):
- if option.handled(answer):
- answer = option.result(answer)
- output_option(option, before_question=False)
- handled = option.stop
- break
+ # with self.lock: (T282962)
+ while not handled:
+ for option in options:
+ output_option(option, before_question=True)
+ output = Option.formatted(question, options, default)
+ if force:
+ self.output(output + '\n')
+ answer = default
+ else:
+ answer = self.input(output) or default
+ # something entered or default is defined
+ if answer:
+ for index, option in enumerate(options):
+ if option.handled(answer):
+ answer = option.result(answer)
+ output_option(option, before_question=False)
+ handled = option.stop
+ break
if isinstance(answer, ChoiceException):
raise answer
@@ -440,33 +411,31 @@
@return: Return a single Sequence entry.
"""
# lock stream output
- with self.lock:
- if not force:
- line_template = '{{0: >{}}}: {{1}}'.format(
- len(str(len(answers))))
- for i, entry in enumerate(answers, start=1):
- self.stream_output(line_template.format(i, entry))
+ # with self.lock: (T282962)
+ if not force:
+ line_template = '{{0: >{}}}: {{1}}'.format(len(str(len(answers))))
+ for i, entry in enumerate(answers, start=1):
+ self.output(line_template.format(i, entry))
- while True:
- choice = self.input(question, default=default, force=force)
+ while True:
+ choice = self.input(question, default=default, force=force)
- try:
- choice = int(choice) - 1
- except (TypeError, ValueError):
- if choice in answers:
- return choice
- choice = -1
+ try:
+ choice = int(choice) - 1
+ except (TypeError, ValueError):
+ if choice in answers:
+ return choice
+ choice = -1
- # User typed choice number
- if 0 <= choice < len(answers):
- return answers[choice]
+ # User typed choice number
+ if 0 <= choice < len(answers):
+ return answers[choice]
- if force:
- raise ValueError(
- 'Invalid value "{}" for default during force.'
- .format(default))
+ if force:
+ raise ValueError('Invalid value "{}" for default during force.'
+ .format(default))
- pywikibot.error('Invalid response')
+ pywikibot.error('Invalid response')
def editText(self, text: str, jumpIndex: Optional[int] = None,
highlight: Optional[str] = None):
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py
index b80d6fb..74c2be5 100644
--- a/tests/i18n_tests.py
+++ b/tests/i18n_tests.py
@@ -342,7 +342,7 @@
self.orig_raw_input = bot.ui._raw_input
self.orig_output = bot.ui.output
bot.ui._raw_input = lambda *args, **kwargs: 'dummy input'
- bot.ui.stream_output = self._capture_output
+ bot.ui.output = self._capture_output
self.old_cc_setting = config.cosmetic_changes_mylang_only
def tearDown(self):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/696497
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: I0dc8cee5512840b559c76458c02533d598a93c24
Gerrit-Change-Number: 696497
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/+/693651 )
Change subject: fixing_redirects.py: Ignore ValueError
......................................................................
fixing_redirects.py: Ignore ValueError
Bug: T283403
Bug: T111513
Change-Id: Ic21cb6e0170734c653fbe9dafec7ea7fc25370ac
---
M scripts/fixing_redirects.py
1 file changed, 7 insertions(+), 1 deletion(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/fixing_redirects.py b/scripts/fixing_redirects.py
index 7cf01a8..f80e326 100755
--- a/scripts/fixing_redirects.py
+++ b/scripts/fixing_redirects.py
@@ -72,10 +72,16 @@
break
# Make sure that next time around we will not find this same hit.
curpos = m.start() + 1
+ # T283403
+ try:
+ is_interwikilink = mysite.isInterwikiLink(m.group('title'))
+ except ValueError:
+ pywikibot.exception()
+ continue
# ignore interwiki links, links in the disabled area
# and links to sections of the same page
if (m.group('title').strip() == ''
- or mysite.isInterwikiLink(m.group('title'))
+ or is_interwikilink
or isDisabled(text, m.start())):
continue
actualLinkPage = pywikibot.Page(targetPage.site, m.group('title'))
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/693651
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: Ic21cb6e0170734c653fbe9dafec7ea7fc25370ac
Gerrit-Change-Number: 693651
Gerrit-PatchSet: 7
Gerrit-Owner: Meno25 <meno25mail(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(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/+/693497 )
Change subject: [cleanup] Remove deprecated MultipleSitesBot site attribute
......................................................................
[cleanup] Remove deprecated MultipleSitesBot site attribute
Our MultipleSitesBot's site attribute has been deprecated for almost six years.
Without it the class is no different from a BaseBot.
The bot module's class hierarchy could probably due with some rethought, but
for the moment simply cleaning up the deprecated code.
Bug: T283209
Change-Id: If241556cba23eb34e3a5835d5c285e4973bf8c2f
---
M pywikibot/bot.py
M tests/bot_tests.py
2 files changed, 4 insertions(+), 41 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 33b89d4..54918d4 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1677,37 +1677,6 @@
information on only one site.
"""
- def __init__(self, **kwargs):
- """Initializer."""
- self._site = None
- super().__init__(**kwargs)
-
- @property
- @deprecated("the page's site property", since='20150615',
- future_warning=True)
- def site(self):
- """
- Return the site if it's set and ValueError otherwise.
-
- The site is only defined while in treat and it is preferred to use
- the page's site instead.
- """
- if self._site is None:
- raise ValueError('Requesting the site not while in treat is not '
- 'allowed.')
- return self._site
-
- def run(self):
- """Reset the bot's site after run."""
- super().run()
- self._site = None
-
- def init_page(self, item):
- """Define the site for this page."""
- page = super().init_page(item)
- self._site = page.site
- return page
-
class ConfigParserBot(BaseBot):
diff --git a/tests/bot_tests.py b/tests/bot_tests.py
index 53d9b96..df13919 100644
--- a/tests/bot_tests.py
+++ b/tests/bot_tests.py
@@ -10,7 +10,6 @@
import pywikibot
import pywikibot.bot
from pywikibot import i18n
-from pywikibot.tools import suppress_warnings
from tests.aspects import (
DefaultSiteTestCase,
@@ -120,13 +119,16 @@
Afterwards it calls post_treat so it's possible to do additional
checks.
+
+ Site attributes are only present on Bot and SingleSitesBot, not
+ MultipleSitesBot.
"""
def treat(page):
self.assertEqual(page, next(self._page_iter))
if self._treat_site is None:
self.assertFalse(hasattr(self.bot, 'site'))
self.assertFalse(hasattr(self.bot, '_site'))
- else:
+ elif not isinstance(self.bot, pywikibot.bot.MultipleSitesBot):
self.assertIsNotNone(self.bot._site)
self.assertEqual(self.bot.site, self.bot._site)
if self._treat_site:
@@ -223,23 +225,15 @@
self.bot.run()
self.assertEqual(self.bot.site, self._treat_site)
- @suppress_warnings('pywikibot.bot.MultipleSitesBot.site is deprecated')
def test_MultipleSitesBot(self):
"""Test MultipleSitesBot class."""
# Assert no specific site
self._treat_site = False
self.bot = pywikibot.bot.MultipleSitesBot(generator=self._generator())
- with self.assertRaisesRegex(AttributeError,
- self.CANT_SET_ATTRIBUTE_RE):
- self.bot.site = self.de
- with self.assertRaisesRegex(ValueError, self.NOT_IN_TREAT_RE):
- self.bot.site
self.bot.treat = self._treat(self._generator())
self.bot.exit = self._exit(4)
self.bot.run()
- with self.assertRaisesRegex(ValueError, self.NOT_IN_TREAT_RE):
- self.bot.site
def test_Bot(self):
"""Test normal Bot class."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/693497
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: If241556cba23eb34e3a5835d5c285e4973bf8c2f
Gerrit-Change-Number: 693497
Gerrit-PatchSet: 4
Gerrit-Owner: Damian <atagar1(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/693580 )
Change subject: [cleanup] Remove category_namespaces
......................................................................
[cleanup] Remove category_namespaces
Xqt reverted this because I deleted several other methods that didn't provide
a FutureWarning. This narrows the change just to the one method that did.
Change-Id: I467b533602bbe2d33b79db57a876fdc2dac5a943
---
M pywikibot/site/_basesite.py
M tests/site_tests.py
2 files changed, 0 insertions(+), 8 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/_basesite.py b/pywikibot/site/_basesite.py
index eecc0d9..32c36a1 100644
--- a/pywikibot/site/_basesite.py
+++ b/pywikibot/site/_basesite.py
@@ -435,12 +435,6 @@
"""Return local name for the Category namespace."""
return self.namespace(14)
- @deprecated('list(namespaces.CATEGORY)', since='20150829',
- future_warning=True)
- def category_namespaces(self): # pragma: no cover
- """Return names for the Category namespace."""
- return list(self.namespace(14, all=True))
-
# site-specific formatting preferences
def category_on_one_line(self):
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 69ec6da..f2bd76c 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -69,8 +69,6 @@
self.site.namespace(10))
self.assertEqual(self.site.category_namespace(),
self.site.namespace(14))
- self.assertEqual(self.site.category_namespaces(),
- list(self.site.namespace(14, all=True)))
class TestSiteDryDeprecatedFunctions(DefaultDrySiteTestCase,
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/693580
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: I467b533602bbe2d33b79db57a876fdc2dac5a943
Gerrit-Change-Number: 693580
Gerrit-PatchSet: 4
Gerrit-Owner: Damian <atagar1(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/694318 )
Change subject: Revert "[IMPR] Use different logfiles for multiple processes (Step 2)"
......................................................................
Revert "[IMPR] Use different logfiles for multiple processes (Step 2)"
This reverts commit d0ae0ff3bded6b271557dccf88dd5c96ab7dada3.
Reason for revert: This splits logs for the same script across multiple files
even when multiple copies of that script aren't being run at the same time.
Example:
python t1.py -log # pid: 1; logs to t1-bot.log; OK
# t1.py ends
python t2.py -log # pid: 1; logs to t2-bot.log; OK
python t1.py -log # pid: 2; logs to t1-2-bot.log; should be t1-bot.log
# t1.py and t2.py end
python t1.py -log # pid: 1; logs to t1-bot.log; OK
This makes it difficult to read the log chronologically across multiple runs
when other scripts may run at overlapping times.
Change-Id: Iae8311b0c3ec40acccb400a30f1de4efea1e37fc
---
M pywikibot/bot.py
1 file changed, 3 insertions(+), 11 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 219601d..86ab1d7 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -103,7 +103,7 @@
from warnings import warn
import pywikibot
-from pywikibot import config, daemonize, i18n, throttle, version
+from pywikibot import config, daemonize, i18n, version
from pywikibot.backports import Dict, Iterable, List, Sequence
from pywikibot.bot_choice import (
AlwaysChoice,
@@ -346,19 +346,11 @@
# if user has enabled file logging, configure file handler
if module_name in config.log or '*' in config.log:
- # get PID
- pywikibot.Site().throttle # initialize a Throttle object and set PID
- pid = throttle.pid # get the global PID
- pid = str(pid) + '-' if pid > 1 else ''
-
if config.logfilename:
- # keep config.logfilename unchanged
logfile = config.datafilepath('logs', config.logfilename)
else:
- # add PID to logfle name
- logfile = config.datafilepath('logs', '{}-{}bot.log'
- .format(module_name, pid))
-
+ logfile = config.datafilepath('logs', '{}-bot.log'
+ .format(module_name))
file_handler = RotatingFileHandler(filename=logfile,
maxBytes=1024 * config.logfilesize,
backupCount=config.logfilecount,
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/694318
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: Iae8311b0c3ec40acccb400a30f1de4efea1e37fc
Gerrit-Change-Number: 694318
Gerrit-PatchSet: 2
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Bináris <wikiposta(a)gmail.com>
Gerrit-Reviewer: JAn Dudík <jan.dudik(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(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/+/693947 )
Change subject: [bugfix] Show OutputOption if before_question attribute is not set
......................................................................
[bugfix] Show OutputOption if before_question attribute is not set
OutputOption has before_question attribute. The output statement
inside option.result has been dropped to enable redirecting the
output stream. Therefore output the option.out after result is
called.
Bug: T283488
Change-Id: I7e64dddaecb1c89f8293f9748c3ad0c26e1c906f
---
M pywikibot/userinterfaces/terminal_interface_base.py
1 file changed, 9 insertions(+), 4 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/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py
index c4abe8b..d8ff5d2 100755
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -373,6 +373,12 @@
options. If default is not a shortcut, it'll return -1.
@rtype: int (if not return_shortcut), lowercased str (otherwise)
"""
+ def output_option(option, before_question):
+ """Print an OutputOption before or after question."""
+ if isinstance(option, OutputOption) \
+ and option.before_question is before_question:
+ self.stream_output(option.out + '\n')
+
if force and default is None:
raise ValueError('With no default option it cannot be forced')
if isinstance(options, Option):
@@ -399,9 +405,7 @@
with self.lock:
while not handled:
for option in options:
- if isinstance(option, OutputOption) \
- and option.before_question:
- self.stream_output(option.out + '\n')
+ output_option(option, before_question=True)
output = Option.formatted(question, options, default)
if force:
self.stream_output(output + '\n')
@@ -413,6 +417,7 @@
for index, option in enumerate(options):
if option.handled(answer):
answer = option.result(answer)
+ output_option(option, before_question=False)
handled = option.stop
break
@@ -527,7 +532,7 @@
# Each warning appears twice
# the second time it has a 'message'
if 'message' in record.__dict__:
- return None
+ return
record.__dict__.setdefault('newline', '\n')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/693947
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: I7e64dddaecb1c89f8293f9748c3ad0c26e1c906f
Gerrit-Change-Number: 693947
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(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/+/693983 )
Change subject: [cleanup] Minor add_text documentation revisions
......................................................................
[cleanup] Minor add_text documentation revisions
To better acquaint myself with the codebase I'm focusing on one
of our scripts. This is just some benign adjustments from a first
pass...
* Add an example that amends the sandbox page so users have a
simple, innocuous command to practice with.
* Drop the 'put it in one line' warnings. I tried it and multiple
lines works just fine.
* Minor get_text simplification so we don't indent as much.
* The documented behavior of get_text's create argument was
incorrect.
* Add the page's type hint.
* Minor grammatical corrections.
Change-Id: I65a05217b2704ba09c6916c694cf28fdd546ed61
---
M scripts/add_text.py
1 file changed, 55 insertions(+), 57 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/add_text.py b/scripts/add_text.py
index f937434..1cfa980 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -1,20 +1,19 @@
#!/usr/bin/python
r"""
-This is a Bot to add a text at the end of the content of the page.
+This is a Bot to add text to the top or bottom of a page.
-By default it adds the text above categories and interwiki.
+By default this adds the text to the bottom above the categories and interwiki.
-Alternatively it may also add a text at the top of the page.
These command line parameters can be used to specify which pages to work on:
¶ms;
Furthermore, the following command line parameters are supported:
--talkpage Put the text onto the talk page instead the generated on
+-talkpage Put the text onto the talk page instead
-talk
--text Define which text to add. "\n" are interpreted as newlines.
+-text Define what text to add. "\n" are interpreted as newlines.
-textfile Define a texfile name which contains the text to add
@@ -25,26 +24,28 @@
-newimages Add text in the new images
--always If used, the bot won't ask if it should add the text
- specified
+-always If used, the bot won't ask if it should add the specified
+ text
-up If used, put the text at the top of the page
--noreorder Avoid to reorder cats and interwiki
+-noreorder Avoid reordering cats and interwiki
Example
-------
-1. This is a script to add a template to the top of the pages with
-category:catname
-Warning! Put it in one line, otherwise it won't work correctly:
+1. Append 'hello world' to the bottom of the sandbox:
+
+ python pwb.py add_text -page:Wikipedia:Sandbox \
+ -summary:"Bot: pywikibot practice" -text:"hello world"
+
+2. Add a template to the top of the pages with 'category:catname':
python pwb.py add_text -cat:catname -summary:"Bot: Adding a template" \
-text:"{{Something}}" -except:"\{\{([Tt]emplate:|)[Ss]omething" -up
-2. Command used on it.wikipedia to put the template in the page without any
-category.
-Warning! Put it in one line, otherwise it won't work correctly:
+3. Command used on it.wikipedia to put the template in the page without any
+ category:
python pwb.py add_text -except:"\{\{([Tt]emplate:|)[Cc]ategorizzare" \
-text:"{{Categorizzare}}" -excepturl:"class='catlinks'>" -uncat \
@@ -81,50 +82,46 @@
docuReplacements = {'¶ms;': pagegenerators.parameterHelp} # noqa: N816
-def get_text(page, old: str, create: bool) -> str:
+def get_text(page: pywikibot.page.BasePage, old: Optional[str],
+ create: bool) -> str:
"""
Get text on page. If old is not None, return old.
@param page: The page to get text from
- @type page: pywikibot.page.BasePage
- @param old: If not None, this parameter is returned instead
- of fetching text from the page
- @param create: Create the page if it doesn't exist
- @return: The page's text or old parameter if not None
+ @param old: If not None, return this rather than the page's text
+ @param create: Declare that the page will be created if it doesn't exist
+ @return: The page's text or the old parameter if not None
"""
- if old is None:
- try:
- text = page.get()
- except NoPageError:
- if create:
- pywikibot.output(
- "{} doesn't exist, creating it!".format(page.title()))
- text = ''
- else:
- pywikibot.output(
- "{} doesn't exist, skip!".format(page.title()))
- return None
- except IsRedirectPageError:
- pywikibot.output('{} is a redirect, skip!'.format(page.title()))
+ if old is not None:
+ return old
+
+ try:
+ return page.get()
+ except NoPageError:
+ if create:
+ pywikibot.output("{} doesn't exist, creating it!"
+ .format(page.title()))
+ return ''
+ else:
+ pywikibot.output("{} doesn't exist, skip!".format(page.title()))
return None
- else:
- text = old
- return text
+ except IsRedirectPageError:
+ pywikibot.output('{} is a redirect, skip!'.format(page.title()))
+ return None
-def put_text(page, new: str, summary: str, count: int,
+def put_text(page: pywikibot.page.BasePage, new: str, summary: str, count: int,
asynchronous: bool = False) -> Optional[bool]:
"""
Save the new text.
- @param page: The page to update and save
- @type page: pywikibot.page.BasePage
+ @param page: The page to change the text of
@param new: The new text for the page
- @param summary: Summary of page changes.
- @param count: Maximum num attempts to reach the server
- @param asynchronous: Save the page asynchronously
- @return: True if successful, False if unsuccessful, None if
- waiting for server
+ @param summary: Summary of the page change
+ @param count: Maximum number of attempts to reach the server
+ @param asynchronous: If True, saves the page asynchronously
+ @return: True if successful, False if unsuccessful, and None if
+ awaiting the server
"""
page.text = new
try:
@@ -152,7 +149,8 @@
return False
-def add_text(page, addText: str, summary: Optional[str] = None,
+def add_text(page: pywikibot.page.BasePage, addText: str,
+ summary: Optional[str] = None,
regexSkip: Optional[str] = None,
regexSkipUrl: Optional[str] = None,
always: bool = False, up: bool = False,
@@ -163,21 +161,21 @@
Add text to a page.
@param page: The page to add text to
- @type page: pywikibot.page.BasePage
@param addText: Text to add
- @param summary: Summary of changes. If None, beginning of addText is used.
- @param regexSkip: Abort if text on page matches
- @param regexSkipUrl: Abort if full url matches
- @param always: Always add text without user confirmation
- @param up: If True, add text to top of page, else add at bottom.
- @param putText: If True, save changes to the page, else return
+ @param summary: Change summary, if None this uses the beginning of addText
+ @param regexSkip: Abort if the text on the page matches this
+ @param regexSkipUrl: Abort if the url matches this
+ @param always: Edit without user confirmation
+ @param up: Append text to the top of the page if True, otherwise the
+ bottom
+ @param putText: Save changes to the page if True, otherwise return
(text, newtext, always)
@param oldTextGiven: If None fetch page text, else use this text
@param reorderEnabled: If True place text above categories and
interwiki, else place at page bottom. No effect if up = False.
- @param create: Create page if it does not exist
- @return: If putText=True: (success, success, always)
- else: (text, newtext, always)
+ @param create: Create the page if it does not exist
+ @return: (success, success, always) if putText is True, otherwise
+ (text, newtext, always)
"""
site = page.site
if not summary:
@@ -282,7 +280,7 @@
If args is an empty list, sys.argv is used.
- @param args: command line arguments
+ @param args: Command line arguments
"""
# If none, the var is set only for check purpose.
summary = None
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/693983
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: I65a05217b2704ba09c6916c694cf28fdd546ed61
Gerrit-Change-Number: 693983
Gerrit-PatchSet: 3
Gerrit-Owner: Damian <atagar1(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.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/+/692624 )
Change subject: [IMPR] Use different logfiles for multiple processes (Step 2)
......................................................................
[IMPR] Use different logfiles for multiple processes (Step 2)
Use different logfiles if multiple processes of the same script are running
to prevent WindowsError/PermissionError when renaming a file. This also
prevents having different mixed logs in the same file.
- if config.logfilename is used this will be kept unchanged
- otherwise the logfilename is changed from <scriptname>-bot.log
to <scriptname>-<pid>-bot.log if PID is not 1
Bug: T56685
Change-Id: I38937c3060d4653d1ffe8a8d9b918a8548907ab0
---
M pywikibot/bot.py
1 file changed, 11 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 86ab1d7..219601d 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -103,7 +103,7 @@
from warnings import warn
import pywikibot
-from pywikibot import config, daemonize, i18n, version
+from pywikibot import config, daemonize, i18n, throttle, version
from pywikibot.backports import Dict, Iterable, List, Sequence
from pywikibot.bot_choice import (
AlwaysChoice,
@@ -346,11 +346,19 @@
# if user has enabled file logging, configure file handler
if module_name in config.log or '*' in config.log:
+ # get PID
+ pywikibot.Site().throttle # initialize a Throttle object and set PID
+ pid = throttle.pid # get the global PID
+ pid = str(pid) + '-' if pid > 1 else ''
+
if config.logfilename:
+ # keep config.logfilename unchanged
logfile = config.datafilepath('logs', config.logfilename)
else:
- logfile = config.datafilepath('logs', '{}-bot.log'
- .format(module_name))
+ # add PID to logfle name
+ logfile = config.datafilepath('logs', '{}-{}bot.log'
+ .format(module_name, pid))
+
file_handler = RotatingFileHandler(filename=logfile,
maxBytes=1024 * config.logfilesize,
backupCount=config.logfilecount,
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/692624
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: I38937c3060d4653d1ffe8a8d9b918a8548907ab0
Gerrit-Change-Number: 692624
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Bináris <wikiposta(a)gmail.com>
Gerrit-Reviewer: JAn Dudík <jan.dudik(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(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/+/692617 )
Change subject: [IMPR] re-use throttle PID (Step 1)
......................................................................
[IMPR] re-use throttle PID (Step 1)
After dropping a throttle PID it can be reused for a next process.
PID (Process IDentifier) is to be used for logging filenames to
prevent WindowsError/PermissionError if runnng more than one script
with the same name.
Bug: T56685
Change-Id: I7588e81c15c77b63fe919c653a33430f71f5c538
---
M pywikibot/throttle.py
1 file changed, 10 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/throttle.py b/pywikibot/throttle.py
index 33dff52..edb6625 100644
--- a/pywikibot/throttle.py
+++ b/pywikibot/throttle.py
@@ -4,14 +4,17 @@
#
# Distributed under the terms of the MIT license.
#
+import itertools
import math
import threading
import time
+
from collections import namedtuple
from contextlib import suppress
from typing import Optional, Union
import pywikibot
+
from pywikibot import config
@@ -117,11 +120,12 @@
_logger)
with self.lock:
processes = []
- my_pid = pid or 1 # start at 1 if global pid not yet set
+ used_pids = set()
count = 1
now = time.time()
for proc in self._read_file(raise_exc=True):
+ used_pids.add(proc.pid)
if now - proc.time > self.releasepid:
continue # process has expired, drop from file
if now - proc.time <= self.dropdelay \
@@ -130,16 +134,17 @@
count += 1
if proc.site != self.mysite or proc.pid != pid:
processes.append(proc)
- if not pid and proc.pid >= my_pid:
- my_pid = proc.pid + 1 # next unused process id
+ free_pid = (i for i in itertools.count(start=1)
+ if i not in used_pids)
if not pid:
- pid = my_pid
+ pid = next(free_pid)
+
self.checktime = time.time()
processes.append(
ProcEntry(pid=pid, time=self.checktime, site=mysite))
- self._write_file(processes)
+ self._write_file(sorted(processes, key=lambda x: x.pid))
self.process_multiplicity = count
pywikibot.log('Found {} {} processes running, including this one.'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/692617
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: I7588e81c15c77b63fe919c653a33430f71f5c538
Gerrit-Change-Number: 692617
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Bináris <wikiposta(a)gmail.com>
Gerrit-Reviewer: JAn Dudík <jan.dudik(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(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/+/693659 )
Change subject: [doc] Update documentation
......................................................................
[doc] Update documentation
* Mediawiki --> MediaWiki
* unix --> Unix
** See https://en.wikipedia.org/wiki/Unix
* unicode --> Unicode
** See https://en.wikipedia.org/wiki/Unicode
Change-Id: Iba0e373beb0d94a6eb27e44cff0d61f14e6c4408
---
M pywikibot/CONTENT.rst
M pywikibot/userinterfaces/terminal_interface_unix.py
M scripts/maintenance/cache.py
M tests/ui_tests.py
4 files changed, 11 insertions(+), 11 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/CONTENT.rst b/pywikibot/CONTENT.rst
index 7f977f5..80c8fc1 100644
--- a/pywikibot/CONTENT.rst
+++ b/pywikibot/CONTENT.rst
@@ -47,7 +47,7 @@
+----------------------------+------------------------------------------------------+
| interwiki_graph.py | Possible create graph with interwiki.py script |
+----------------------------+------------------------------------------------------+
- | logentries.py | Objects representing Mediawiki log entries |
+ | logentries.py | Objects representing MediaWiki log entries |
+----------------------------+------------------------------------------------------+
| logging.py | Logging and output functions |
+----------------------------+------------------------------------------------------+
@@ -89,7 +89,7 @@
+----------------------------+------------------------------------------------------+
| data | Module providing layers of data access to wiki |
+============================+======================================================+
- | api.py | Interface to Mediawiki's api.php |
+ | api.py | Interface to MediaWiki's api.php |
+----------------------------+------------------------------------------------------+
| mysql.py | Miscellaneous helper functions for mysql queries |
+----------------------------+------------------------------------------------------+
@@ -174,19 +174,19 @@
+============================+======================================================+
| _interface_base.py | Abstract base user interface module |
+----------------------------+------------------------------------------------------+
- | gui.py | GUI with a unicode textfield where the user can edit |
+ | gui.py | GUI with a Unicode textfield where the user can edit |
+----------------------------+------------------------------------------------------+
| terminal_interface.py | Platform independent terminal interface module |
+----------------------------+------------------------------------------------------+
| terminal_interface_base.py | Base for terminal user interfaces |
+----------------------------+------------------------------------------------------+
- | terminal_interface_unix.py | User interface for unix terminals |
+ | terminal_interface_unix.py | User interface for Unix terminals |
+----------------------------+------------------------------------------------------+
| terminal_interface_win32.py| User interface for Win32 terminals |
+----------------------------+------------------------------------------------------+
| transliteration.py | Module to transliterate text |
+----------------------------+------------------------------------------------------+
- | win32_unicode.py | Stdout, stderr and argv support for unicode |
+ | win32_unicode.py | Stdout, stderr and argv support for Unicode |
+----------------------------+------------------------------------------------------+
diff --git a/pywikibot/userinterfaces/terminal_interface_unix.py b/pywikibot/userinterfaces/terminal_interface_unix.py
index a23ce78..8d82f32 100755
--- a/pywikibot/userinterfaces/terminal_interface_unix.py
+++ b/pywikibot/userinterfaces/terminal_interface_unix.py
@@ -1,6 +1,6 @@
-"""User interface for unix terminals."""
+"""User interface for Unix terminals."""
#
-# (C) Pywikibot team, 2003-2020
+# (C) Pywikibot team, 2003-2021
#
# Distributed under the terms of the MIT license.
#
@@ -32,7 +32,7 @@
class UnixUI(terminal_interface_base.UI):
- """User interface for unix terminals."""
+ """User interface for Unix terminals."""
def support_color(self, target_stream):
"""Return that the target stream supports colors."""
@@ -44,7 +44,7 @@
return chr(27) + '[' + str(int(code) + 10) + 'm'
def encounter_color(self, color, target_stream):
- """Write the unix color directly to the stream."""
+ """Write the Unix color directly to the stream."""
fg, bg = self.divide_color(color)
fg = unixColors[fg]
self._write(fg, target_stream)
diff --git a/scripts/maintenance/cache.py b/scripts/maintenance/cache.py
index 125f2a6..01247e2 100755
--- a/scripts/maintenance/cache.py
+++ b/scripts/maintenance/cache.py
@@ -218,7 +218,7 @@
whether cache files are being used.
However file access times are not always usable.
On many modern filesystems, they have been disabled.
- On unix, check the filesystem mount options. You may
+ On Unix, check the filesystem mount options. You may
need to remount with 'strictatime'.
@param use_accesstime: Whether access times should be used.
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index f9c76c9..e1bb12a 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -333,7 +333,7 @@
@unittest.skipUnless(os.name == 'posix', 'requires Unix console')
class TestTerminalUnicodeUnix(UITestCase):
- """Terminal output tests for unix."""
+ """Terminal output tests for Unix."""
def testOutputUnicodeText(self):
pywikibot.output('Заглавная_страница')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/693659
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: Iba0e373beb0d94a6eb27e44cff0d61f14e6c4408
Gerrit-Change-Number: 693659
Gerrit-PatchSet: 3
Gerrit-Owner: Meno25 <meno25mail(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged