jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/513670 )
Change subject: [doc] Update Python doc links to PY3
......................................................................
[doc] Update Python doc links to PY3
Change-Id: I04d535e689e5fc8c4c598c03e260599088bf0ef2
---
M pywikibot/config2.py
M pywikibot/logging.py
M pywikibot/textlib.py
M scripts/weblinkchecker.py
M tests/README.rst
5 files changed, 7 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 1540dfe..e8316a2 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -460,7 +460,7 @@
# The encoding in which textfiles are stored, which contain lists of page
# titles. The most used is 'utf-8'; 'utf-8-sig' recognizes BOM.
# For a complete list please see:
-# https://docs.python.org/2/library/codecs.html#standard-encodings
+# https://docs.python.org/3/library/codecs.html#standard-encodings
textfile_encoding = 'utf-8'
# tkinter isn't yet ready
@@ -1161,7 +1161,7 @@
if OSWIN32 and editor:
# single character string literals from
- # https://docs.python.org/2/reference/lexical_analysis.html#string-literals
+ # https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-…
# encode('unicode-escape') also changes Unicode characters
if set(editor) & set('\a\b\f\n\r\t\v'):
warning(
diff --git a/pywikibot/logging.py b/pywikibot/logging.py
index 4cf2691..8976cad 100644
--- a/pywikibot/logging.py
+++ b/pywikibot/logging.py
@@ -159,7 +159,7 @@
@param newline: If True, a line feed will be added after printing the text.
@type newline: bool
@param kwargs: The keyword arguments can be found in the python doc:
- https://docs.python.org/2/howto/logging-cookbook.html#logging-cookbook.
+ https://docs.python.org/3/howto/logging-cookbook.html.
"""
logoutput(text, decoder, newline, WARNING, **kwargs)
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index d92bc93..f595eaa 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -525,7 +525,7 @@
return parser.textdata
-# thanks to https://docs.python.org/2/library/htmlparser.html
+# thanks to https://docs.python.org/3/library/html.parser.html
class _GetDataHTML(HTMLParser):
textdata = ''
keeptags = []
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index a00b34a..958f0d1 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -484,7 +484,7 @@
except httplib.error as error:
return False, 'HTTP Error: {}'.format(error.__class__.__name__)
except socket.error as error:
- # https://docs.python.org/2/library/socket.html :
+ # https://docs.python.org/3/library/socket.html :
# socket.error :
# The accompanying value is either a string telling what went
# wrong or a pair (errno, string) representing an error
diff --git a/tests/README.rst b/tests/README.rst
index 20584d7..b2e8500 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -3,12 +3,12 @@
===============
The Pywikibot tests are based on the `unittest framework
-<https://docs.python.org/2/library/unittest.html>`_,
+<https://docs.python.org/3/library/unittest.html>`_,
and are compatible with `nose <https://nose.readthedocs.org/>`_.
The tests package provides a function load_tests that supports the
`load tests protocol
-<https://docs.python.org/2/library/unittest.html#load-tests-protocol>`_.
+<https://docs.python.org/3/library/unittest.html#load-tests-protocol>`_.
The default ordering begins with tests of underlying components, then tests
site and page semantics, and finishes with tests of the scripts and finally
any tests which have not been inserted into the ordered list of tests.
--
To view, visit https://gerrit.wikimedia.org/r/513670
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I04d535e689e5fc8c4c598c03e260599088bf0ef2
Gerrit-Change-Number: 513670
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/513616 )
Change subject: [doc] Improve docs for removeCategory/LanguageLinks in textlib
......................................................................
[doc] Improve docs for removeCategory/LanguageLinks in textlib
Change-Id: I95597129eefc6d2684fb081778aee386c66225d9
---
M pywikibot/textlib.py
1 file changed, 31 insertions(+), 13 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index d92bc93..f1ae910 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1015,13 +1015,14 @@
def removeLanguageLinks(text, site=None, marker=''):
"""Return text with all inter-language links removed.
- If a link to an unknown language is encountered, a warning is printed.
+ If a link to an unknown language is encountered, a warning
+ is printed.
@param text: The text that needs to be modified.
@type text: str
@param site: The site that the text is coming from.
@type site: pywikibot.Site
- @param marker: If defined, marker is placed after the the last language
+ @param marker: If defined, marker is placed after the last language
link, or at the end of text if there are no language links.
@type marker: str
@return: The modified text.
@@ -1048,17 +1049,18 @@
"""
Return text with inter-language links and preceding separators removed.
- If a link to an unknown language is encountered, a warning is printed.
+ If a link to an unknown language is encountered, a warning
+ is printed.
@param text: The text that needs to be modified.
@type text: str
@param site: The site that the text is coming from.
@type site: pywikibot.Site
- @param marker: If defined, marker is placed after the the last interwiki
- link, or at the end of text if there are no interwiki links.
+ @param marker: If defined, marker is placed after the last language
+ link, or at the end of text if there are no language links.
@type marker: str
- @param separator: The separator string that will be removed if is followed
- by the language links.
+ @param separator: The separator string that will be removed
+ if followed by the language links.
@type separator: str
@return: The modified text
@rtype: str
@@ -1308,8 +1310,15 @@
def removeCategoryLinks(text, site=None, marker=''):
"""Return text with all category links removed.
- Put the string marker after the last replacement (at the end of the text
- if there is no replacement).
+ @param text: The text that needs to be modified.
+ @type text: str
+ @param site: The site that the text is coming from.
+ @type site: pywikibot.Site
+ @param marker: If defined, marker is placed after the last category
+ link, or at the end of text if there are no category links.
+ @type marker: str
+ @return: The modified text.
+ @rtype: str
"""
# This regular expression will find every link that is possibly an
# interwiki link, plus trailing whitespace. The language code is grouped.
@@ -1333,11 +1342,20 @@
def removeCategoryLinksAndSeparator(text, site=None, marker='', separator=''):
"""
- Return text with all category links and preceding separators removed.
+ Return text with category links and preceding separators removed.
- Put the string marker after the last replacement (at the end of the text
- if there is no replacement).
-
+ @param text: The text that needs to be modified.
+ @type text: str
+ @param site: The site that the text is coming from.
+ @type site: pywikibot.Site
+ @param marker: If defined, marker is placed after the last category
+ link, or at the end of text if there are no category links.
+ @type marker: str
+ @param separator: The separator string that will be removed
+ if followed by the category links.
+ @type separator: str
+ @return: The modified text
+ @rtype: str
"""
if site is None:
site = pywikibot.Site()
--
To view, visit https://gerrit.wikimedia.org/r/513616
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I95597129eefc6d2684fb081778aee386c66225d9
Gerrit-Change-Number: 513616
Gerrit-PatchSet: 5
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/513579 )
Change subject: No need to strip already stripped text
......................................................................
No need to strip already stripped text
Textlib method removeCategoryLinks already strips the text, there is no need
to do that again.
Change-Id: Ib89ed199ae7b7985564cfcab53961a4ee5c19b80
---
M scripts/imagecopy_self.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/imagecopy_self.py b/scripts/imagecopy_self.py
index 11880ab..57394c8 100644
--- a/scripts/imagecopy_self.py
+++ b/scripts/imagecopy_self.py
@@ -522,7 +522,7 @@
for (regex, repl) in licenseTemplates[imagepage.site.lang]:
text = re.sub(regex, '', text, flags=re.IGNORECASE)
- text = pywikibot.removeCategoryLinks(text, imagepage.site()).strip()
+ text = pywikibot.removeCategoryLinks(text, imagepage.site())
description = self.convertLinks(text.strip(), imagepage.site())
date = self.getUploadDate(imagepage)
--
To view, visit https://gerrit.wikimedia.org/r/513579
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib89ed199ae7b7985564cfcab53961a4ee5c19b80
Gerrit-Change-Number: 513579
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/513574 )
Change subject: [cleanup] return has_extension result in deprecated hasExtension method
......................................................................
[cleanup] return has_extension result in deprecated hasExtension method
use remove_last_args to ignore the old "unknown" parameter
Change-Id: I53ebe1aa802b4ca18e3c03613a1464cac0af0bf4
---
M pywikibot/site.py
1 file changed, 3 insertions(+), 19 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index c329a87..18a745d 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2660,26 +2660,10 @@
return _namespaces
@deprecated('has_extension', since='20140819')
+ @remove_last_args(('unknown', ))
def hasExtension(self, name, unknown=None):
- """Determine whether extension `name` is loaded.
-
- Use L{has_extension} instead!
-
- @param name: The extension to check for, case insensitive
- @type name: str
- @param unknown: Old parameter which shouldn't be used anymore.
- @return: If the extension is loaded
- @rtype: bool
- """
- if unknown is not None:
- pywikibot.debug('unknown argument of hasExtension is deprecated.',
- _logger)
- extensions = self.siteinfo['extensions']
- name = name.lower()
- for ext in extensions:
- if ext['name'].lower() == name:
- return True
- return False
+ """DEPRECATED. Determine whether extension `name` is loaded."""
+ return self.has_extension(name)
def has_extension(self, name):
"""Determine whether extension `name` is loaded.
--
To view, visit https://gerrit.wikimedia.org/r/513574
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I53ebe1aa802b4ca18e3c03613a1464cac0af0bf4
Gerrit-Change-Number: 513574
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/513569 )
Change subject: [doc] Make class doc string more informative
......................................................................
[doc] Make class doc string more informative
Change-Id: I17f1d33ef0d6190e7564e641ab85ad8ee316ea16
---
M tests/link_tests.py
1 file changed, 11 insertions(+), 11 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/link_tests.py b/tests/link_tests.py
index 0f11ef9..eb1479b 100644
--- a/tests/link_tests.py
+++ b/tests/link_tests.py
@@ -410,7 +410,7 @@
class TestFullyQualifiedExplicitLinkDifferentFamilyParser(LinkTestCase):
- """Link tests."""
+ """Test link to a different family."""
sites = {
'enws': {
@@ -467,7 +467,7 @@
class TestFullyQualifiedExplicitLinkNoLangConfigFamilyParser(LinkTestCase):
- """Link tests."""
+ """Test link from family without lang code to a different family."""
sites = {
'wikidata': {
@@ -524,7 +524,7 @@
class TestFullyQualifiedNoLangFamilyExplicitLinkParser(LinkTestCase):
- """Link tests."""
+ """Test wikibase links."""
sites = {
'wikidata': {
@@ -585,7 +585,7 @@
class TestFullyQualifiedOneSiteFamilyExplicitLinkParser(LinkTestCase):
- """Link tests."""
+ """Test links to one site target family."""
family = 'species'
code = 'species'
@@ -617,7 +617,7 @@
class TestPartiallyQualifiedImplicitLinkSameSiteParser(LinkTestCase):
- """Link tests."""
+ """Test partially qualified links to same site."""
family = 'wikipedia'
code = 'en'
@@ -666,7 +666,7 @@
class TestPartiallyQualifiedImplicitLinkDifferentCodeParser(LinkTestCase):
- """Link tests."""
+ """Test partially qualified links to different code."""
family = 'wikipedia'
code = 'en'
@@ -695,7 +695,7 @@
class TestPartiallyQualifiedImplicitLinkDifferentFamilyParser(LinkTestCase):
- """Link tests."""
+ """Test partially qualified links to different family."""
family = 'wikipedia'
code = 'en'
@@ -753,7 +753,7 @@
class TestFullyQualifiedImplicitLinkDifferentFamilyParser(LinkTestCase):
- """Link tests."""
+ """Test link to a different family without preleading colon."""
sites = {
'enws': {
@@ -810,7 +810,7 @@
class TestFullyQualifiedImplicitLinkNoLangConfigFamilyParser(LinkTestCase):
- """Link tests."""
+ """Test implicit link from family without lang code to other family."""
sites = {
'wikidata': {
@@ -867,7 +867,7 @@
class TestFullyQualifiedNoLangFamilyImplicitLinkParser(LinkTestCase):
- """Link tests."""
+ """Test wikibase links without preleading colon."""
family = 'wikidata'
code = 'test'
@@ -916,7 +916,7 @@
class TestFullyQualifiedOneSiteFamilyImplicitLinkParser(LinkTestCase):
- """Link tests."""
+ """Test links to one site target family without preleading colon."""
family = 'species'
code = 'species'
--
To view, visit https://gerrit.wikimedia.org/r/513569
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I17f1d33ef0d6190e7564e641ab85ad8ee316ea16
Gerrit-Change-Number: 513569
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/513551 )
Change subject: [cleanup] remove login.showCaptchaWindow() method
......................................................................
[cleanup] remove login.showCaptchaWindow() method
login.showCaptchaWindow() was never implemented and does nothing.
Remove this senseless method then after 12 years.
Change-Id: Id7af3b9eea403f1c5d55619f75a0a8264ebe8667
---
M pywikibot/login.py
1 file changed, 0 insertions(+), 4 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/login.py b/pywikibot/login.py
index 935ef19..0e64b5f 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -336,10 +336,6 @@
pywikibot.log('Should be logged in now')
return True
- def showCaptchaWindow(self, url):
- """Open a window to show the captcha for the given URL."""
- pass
-
class BotPassword(object):
--
To view, visit https://gerrit.wikimedia.org/r/513551
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id7af3b9eea403f1c5d55619f75a0a8264ebe8667
Gerrit-Change-Number: 513551
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)