jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/620324 )
Change subject: [doc] Update ROADMAP.rst
......................................................................
[doc] Update ROADMAP.rst
Change-Id: I9df2bbbf3a7fdec3281470a6ad8a5a1a26de7948
---
M ROADMAP.rst
1 file changed, 6 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index c1719fe..70acf3c 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,13 +1,19 @@
Current release changes
~~~~~~~~~~~~~~~~~~~~~~~
+* APISite.loadpageinfo does not discard changes to page content when information was not loaded (T260472)
+* tools.UnicodeType and tools.signature are deprecated
* BaseBot.stop() method is deprecated in favour of BaseBot.generator.close()
* Escape bot password correctly (T259488)
+* Bugfixes and improvements
+* Localisation updates
Future release notes
~~~~~~~~~~~~~~~~~~~~
+* 4.1.0: Deprecated editor.command will be removed
+* 4.1.0: tools.open_compressed, tools.UnicodeType and tools.signature will be removed
* 4.1.0: comms.PywikibotCookieJar and comms.mode_check_decorator will be removed
* 4.0.0: Deprecated tools.UnicodeMixin and tools.IteratorNextMixin will be removed
* 4.0.0: Site.Family() function will be removed in favour of Family.load() method
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/620324
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: I9df2bbbf3a7fdec3281470a6ad8a5a1a26de7948
Gerrit-Change-Number: 620324
Gerrit-PatchSet: 2
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/+/620458 )
Change subject: Revert "Only run cosmetic changes on wikitext pages"
......................................................................
Revert "Only run cosmetic changes on wikitext pages"
This reverts commit 94a3f39a038a87e7516e55a253423609694d5342.
Reason for revert: T260472
Change-Id: Ib6b2672f978ec208b7c051e3409d70e96011872b
---
M pywikibot/page/__init__.py
1 file changed, 9 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index ff9812f..8d7dea7 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -1309,7 +1309,7 @@
cc=None, quiet=False, **kwargs):
"""Helper function for save()."""
link = self.title(as_link=True)
- if cc or (cc is None and config.cosmetic_changes):
+ if cc or cc is None and config.cosmetic_changes:
summary = self._cosmetic_changes_hook(summary)
done = self.site.editpage(self, summary=summary, minor=minor,
@@ -1330,18 +1330,20 @@
else the old edit summary.
@rtype: str
"""
- if self.isTalkPage() or self.content_model != 'wikitext' or \
+ if self.isTalkPage() or \
pywikibot.calledModuleName() in config.cosmetic_changes_deny_script:
return summary
family = self.site.family.name
if config.cosmetic_changes_mylang_only:
- cc = ((family == config.family and self.site.lang == config.mylang)
- or self.site.lang in config.cosmetic_changes_enable.get(
- family, []))
+ cc = ((family == config.family
+ and self.site.lang == config.mylang)
+ or family in config.cosmetic_changes_enable
+ and self.site.lang in config.cosmetic_changes_enable[family])
else:
cc = True
- cc = cc and self.site.lang not in config.cosmetic_changes_disable.get(
- family, [])
+ cc = (cc and not
+ (family in config.cosmetic_changes_disable
+ and self.site.lang in config.cosmetic_changes_disable[family]))
if not cc:
return summary
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/620458
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: Ib6b2672f978ec208b7c051e3409d70e96011872b
Gerrit-Change-Number: 620458
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
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/+/620292 )
Change subject: [IMPR] Improvements for editor.py
......................................................................
[IMPR] Improvements for editor.py
- Remove Python 2 code
- use FutureWarning for deprecated command function
- use subprocess.run instead of subprocess.call
see https://docs.python.org/3/library/subprocess.html
Change-Id: I9095219ef8559a0efb31614716f4a71f801e0beb
---
M pywikibot/editor.py
1 file changed, 18 insertions(+), 21 deletions(-)
Approvals:
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/editor.py b/pywikibot/editor.py
index d60ebba..b505a56 100644
--- a/pywikibot/editor.py
+++ b/pywikibot/editor.py
@@ -6,14 +6,14 @@
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
import codecs
import os
import subprocess
import tempfile
from sys import platform
+from textwrap import fill
+from typing import Optional
import pywikibot
@@ -26,7 +26,7 @@
gui = e
-class TextEditor(object):
+class TextEditor:
"""Text editor."""
@@ -72,59 +72,56 @@
for part in command)
@deprecated('_command (should not be used from the outside)',
- since='20150111')
+ since='20150111', future_warning=True)
def command(self, tempFilename, text, jumpIndex=None):
"""Return editor selected in user-config.py."""
return TextEditor._concat(self._command(tempFilename, text, jumpIndex))
- def edit(self, text, jumpIndex=None, highlight=None):
+ def edit(self, text: str, jumpIndex=None, highlight=None) -> Optional[str]:
"""
Call the editor and thus allows the user to change the text.
Halts the thread's operation until the editor is closed.
@param text: the text to be edited
- @type text: str
@param jumpIndex: position at which to put the caret
@type jumpIndex: int
@param highlight: each occurrence of this substring will be highlighted
@type highlight: str
@return: the modified text, or None if the user didn't save the text
file in his text editor
- @rtype: str or None
"""
if config.editor:
handle, tempFilename = tempfile.mkstemp()
- tempFilename = '%s.%s' % (tempFilename,
- config.editor_filename_extension)
+ tempFilename = '{}.{}'.format(tempFilename,
+ config.editor_filename_extension)
try:
with codecs.open(tempFilename, 'w',
encoding=config.editor_encoding) as tempFile:
tempFile.write(text)
creationDate = os.stat(tempFilename).st_mtime
cmd = self._command(tempFilename, text, jumpIndex)
- subprocess.call(cmd, shell=platform == 'win32')
+ subprocess.run(cmd, shell=platform == 'win32')
lastChangeDate = os.stat(tempFilename).st_mtime
if lastChangeDate == creationDate:
# Nothing changed
return None
- else:
- with codecs.open(
- tempFilename, 'r', encoding=config.editor_encoding
- ) as temp_file:
- newcontent = temp_file.read()
- return newcontent
+
+ with codecs.open(tempFilename, 'r',
+ encoding=config.editor_encoding) as temp_file:
+ newcontent = temp_file.read()
+ return newcontent
finally:
os.close(handle)
os.unlink(tempFilename)
if isinstance(gui, ImportError):
- raise ImportError(
- 'Could not load GUI modules: %s\nNo editor available.\n'
+ raise ImportError(fill(
+ 'Could not load GUI modules: {}. No editor available. '
'Set your favourite editor in user-config.py "editor", '
'or install python packages tkinter and idlelib, which '
'are typically part of Python but may be packaged separately '
- 'on your platform.\n' % gui)
+ 'on your platform.'.format(gui)) + '\n')
- return pywikibot.ui.editText(
- text, jumpIndex=jumpIndex, highlight=highlight)
+ return pywikibot.ui.editText(text, jumpIndex=jumpIndex,
+ highlight=highlight)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/620292
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: I9095219ef8559a0efb31614716f4a71f801e0beb
Gerrit-Change-Number: 620292
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/620007 )
Change subject: [4.0] Deprecate tools.UnicodeType and remove it from scripts
......................................................................
[4.0] Deprecate tools.UnicodeType and remove it from scripts
Change-Id: I49e675538160655da026d28706f9ef2f3a002884
---
M pywikibot/tools/__init__.py
M scripts/interwiki.py
M scripts/weblinkchecker.py
3 files changed, 13 insertions(+), 13 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index ade4522..ef7ae0f 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -36,7 +36,6 @@
PYTHON_VERSION = sys.version_info[:3]
PY2 = (PYTHON_VERSION[0] == 2)
StringTypes = (str, bytes)
-UnicodeType = str
try:
import bz2
@@ -1858,3 +1857,5 @@
since='20200712', future_warning=True)
wrapper._add_deprecated_attr('ArgSpec', inspect.ArgSpec,
since='20200712', future_warning=True)
+wrapper._add_deprecated_attr('UnicodeType', str,
+ since='20200813', future_warning=True)
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 2c116a0..4ed77c1 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -353,7 +353,7 @@
from pywikibot.bot import ListOption, StandardOption
from pywikibot.cosmetic_changes import moved_links
-from pywikibot.tools import first_upper, UnicodeType
+from pywikibot.tools import first_upper
from pywikibot.tools.formatter import color_format
docuReplacements = {
@@ -1155,7 +1155,7 @@
# todo list.
if not page.exists():
- self.conf.remove.append(UnicodeType(page))
+ self.conf.remove.append(str(page))
self.conf.note('{} does not exist. Skipping.'.format(page))
if page == self.originPage:
# The page we are working on is the page that does not
@@ -1214,7 +1214,7 @@
# must be behind the page.isRedirectPage() part
# otherwise a redirect error would be raised
elif page_empty_check(page):
- self.conf.remove.append(UnicodeType(page))
+ self.conf.remove.append(str(page))
self.conf.note('{} is empty. Skipping.'.format(page))
if page == self.originPage:
for site, count in self.todo.siteCounts():
@@ -1359,7 +1359,7 @@
if page2 is None:
pywikibot.output(' ' * indent + 'Given as a hint.')
else:
- pywikibot.output(' ' * indent + UnicodeType(page2))
+ pywikibot.output(' ' * indent + str(page2))
def assemble(self):
"""Assemble language links."""
@@ -1694,7 +1694,7 @@
# put it to new means don't delete it
if (
not self.conf.cleanup
- or UnicodeType(rmPage) not in self.conf.remove
+ or str(rmPage) not in self.conf.remove
):
new[rmsite] = rmPage
pywikibot.warning(
@@ -2173,7 +2173,7 @@
# Use an extended format for the string linking to all added pages.
def fmt(d, site):
- return UnicodeType(d[site])
+ return str(d[site])
else:
# Use short format, just the language code
@@ -2358,7 +2358,7 @@
elif len(namespaces) == 1:
ns = namespaces[0]
if ns != 'all':
- if isinstance(ns, UnicodeType) or isinstance(ns, str):
+ if isinstance(ns, str):
index = site.namespaces.lookup_name(ns)
if index is None:
raise ValueError('Unknown namespace: ' + ns)
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index f81a34e..9b5e9de 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -137,7 +137,7 @@
from pywikibot.pagegenerators import (
XMLDumpPageGenerator as _XMLDumpPageGenerator,
)
-from pywikibot.tools import deprecated, PY2, UnicodeType
+from pywikibot.tools import deprecated, PY2
from pywikibot.tools.formatter import color_format
import requests
@@ -399,9 +399,8 @@
self.query.encode('ascii')
except UnicodeEncodeError:
encoding = self.getEncodingUsedByServer()
- self.path = UnicodeType(urllib.quote(self.path.encode(encoding)))
- self.query = UnicodeType(urllib.quote(self.query.encode(encoding),
- '=&'))
+ self.path = urllib.quote(self.path.encode(encoding))
+ self.query = urllib.quote(self.query.encode(encoding), '=&')
def resolveRedirect(self, useHEAD=False):
"""
@@ -488,7 +487,7 @@
# wrong or a pair (errno, string) representing an error
# returned by a system call, similar to the value
# accompanying os.error
- if isinstance(error, UnicodeType):
+ if isinstance(error, str):
msg = error
else:
try:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/620007
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: I49e675538160655da026d28706f9ef2f3a002884
Gerrit-Change-Number: 620007
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/619904 )
Change subject: [doc] Update ROADMAP.rst
......................................................................
[doc] Update ROADMAP.rst
Change-Id: Iecee55f372ecf68cdddefd56d5e8705703a3e284
---
M ROADMAP.rst
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Matěj Suchánek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 3b28593..c1719fe 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -8,7 +8,8 @@
Future release notes
~~~~~~~~~~~~~~~~~~~~
-* 4.0.0: Deprecate tools.UnicodeMixin and tools.IteratorNextMixin will be removed
+* 4.1.0: comms.PywikibotCookieJar and comms.mode_check_decorator will be removed
+* 4.0.0: Deprecated tools.UnicodeMixin and tools.IteratorNextMixin will be removed
* 4.0.0: Site.Family() function will be removed in favour of Family.load() method
* 4.0.0: Site.getExpandedString method will be removed in favour of expand_text
* 4.0.0: Unused parameters of page methods like forceReload, insite, throttle, step will be removed
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/619904
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: Iecee55f372ecf68cdddefd56d5e8705703a3e284
Gerrit-Change-Number: 619904
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged