jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/614572 )
Change subject: [cleanup] remove absolute_import and unicode_literals
......................................................................
[cleanup] remove absolute_import and unicode_literals
- __future__.absolute_import and __future__.unicode_literals are not
needed even if the wrapper script is called with Python 2.7
- reorder imports
Change-Id: Id9279d4863a5faaa30a0cd7f09bcd966043dc28b
---
M pwb.py
1 file changed, 5 insertions(+), 5 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/pwb.py b/pwb.py
index 3880526..19162c7 100755
--- a/pwb.py
+++ b/pwb.py
@@ -18,15 +18,15 @@
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, print_function, unicode_literals
+from __future__ import print_function
+
+import os
+import sys
+import types
from difflib import get_close_matches
from importlib import import_module
-import os
-import sys
from time import sleep
-import types
-
from warnings import warn
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/614572
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: Id9279d4863a5faaa30a0cd7f09bcd966043dc28b
Gerrit-Change-Number: 614572
Gerrit-PatchSet: 4
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/+/616213 )
Change subject: [4.0] remove UnicodeType and Python 2 related code
......................................................................
[4.0] remove UnicodeType and Python 2 related code
Also use tempfile.mkstemp instead of tempfile.mktemp which is
deprecated since Python 2.3
Change-Id: Ib32e2069f0ca914d2e104282186825488ac95a93
---
M scripts/piper.py
1 file changed, 9 insertions(+), 16 deletions(-)
Approvals:
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/piper.py b/scripts/piper.py
index 726e9f7..f89bc98 100755
--- a/scripts/piper.py
+++ b/scripts/piper.py
@@ -31,12 +31,10 @@
¶ms;
"""
#
-# (C) Pywikibot team, 2008-2019
+# (C) Pywikibot team, 2008-2020
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
import os
import pipes
import tempfile
@@ -46,7 +44,6 @@
from pywikibot import pagegenerators
from pywikibot.bot import (MultipleSitesBot, ExistingPageBot,
NoRedirectPageBot, AutomaticTWSummaryBot)
-from pywikibot.tools import UnicodeType
# This is required for the text that is shown when you run this script
# with the parameter -help.
@@ -71,38 +68,34 @@
self.availableOptions.update({
'filters': [],
})
- super(PiperBot, self).__init__(generator=generator, **kwargs)
+ super().__init__(generator=generator, **kwargs)
@property
- def summary_parameters(self):
+ def summary_parameters(self) -> dict:
"""Return the filter parameter."""
return {'filters': ', '.join(self.getOption('filters'))}
- def pipe(self, program, text):
+ def pipe(self, program: str, text: str) -> str:
"""Pipe a given text through a given program.
@return: processed text after piping
- @rtype: str
"""
- if not isinstance(text, str): # py2-py3 compatibility
- text = text.encode('utf-8')
pipe = pipes.Template()
- pipe.append(str(program), '--') # py2-py3 compatibility
+ pipe.append(program, '--')
# Create a temporary filename to save the piped stuff to
- temp_filename = '%s.%s' % (tempfile.mktemp(), 'txt')
+ file, temp_filename = tempfile.mkstemp(suffix='.txt')
+ file.close()
with pipe.open(temp_filename, 'w') as file:
file.write(text)
# Now retrieve the munged text
with open(temp_filename, 'r') as file:
- unicode_text = file.read()
- if not isinstance(unicode_text, UnicodeType): # py2-py3 compatibility
- unicode_text = unicode_text.decode('utf-8')
+ text = file.read()
# clean up
os.unlink(temp_filename)
- return unicode_text
+ return text
def treat_page(self):
"""Load the given page, do some changes, and save it."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/616213
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: Ib32e2069f0ca914d2e104282186825488ac95a93
Gerrit-Change-Number: 616213
Gerrit-PatchSet: 1
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/+/616322 )
Change subject: [doc] Update ROADMAP.rst
......................................................................
[doc] Update ROADMAP.rst
Change-Id: Ibb9c285bbf41cebc0bb80fbe4b236d32554c1ee8
---
M ROADMAP.rst
1 file changed, 7 insertions(+), 2 deletions(-)
Approvals:
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index f7b8bd6..ce90dd0 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,9 @@
Current release
~~~~~~~~~~~~~~~
+* EventStreams "since" parameter settings has been fixed
+* Unsupported debug and uploadByUrl parameters of UploadRobot were removed
+* Unported compat decode parameter of Page.title() has been removed
* Wikihow family file was added (T249814)
* Improve performance of CosmeticChangesToolkit.translateMagicWords
* Prohibit positional arguments with Page.title()
@@ -20,9 +23,11 @@
Future releases
~~~~~~~~~~~~~~~
+* 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
+* 4.0.0: site/family methods code2encodings and code2encoding will be removed in favour of encoding/endcodings methods
* 4.0.0: Methods deprecated for 6 years or longer will be removed
-* 3.0.20200703: Unsupported debug parameter of UploadRobot will be removed
-* 3.0.20200703: Unported compat decode parameter of Page.title() will be removed
* 3.0.20200703: tools.count, tools.Counter, tools.OrderedDict and ContextManagerWrapper will be removed
* 3.0.20200508: Page.getVersionHistory and Page.fullVersionHistory() methods will be removed (T136513, T151110)
* 3.0.20200306: Support of MediaWiki releases below 1.19 will be dropped (T245350)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/616322
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: Ibb9c285bbf41cebc0bb80fbe4b236d32554c1ee8
Gerrit-Change-Number: 616322
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/+/616017 )
Change subject: [bugfix] Fix for EventStreams since settings
......................................................................
[bugfix] Fix for EventStreams since settings
Change-Id: I698ccec91eee2e46c0a3dd5b69ca91f75d38f01b
---
M pywikibot/comms/eventstreams.py
1 file changed, 6 insertions(+), 9 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/eventstreams.py b/pywikibot/comms/eventstreams.py
index 86d1e42..b44a71a 100644
--- a/pywikibot/comms/eventstreams.py
+++ b/pywikibot/comms/eventstreams.py
@@ -13,8 +13,6 @@
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
from distutils.version import LooseVersion
from functools import partial
import json
@@ -30,7 +28,7 @@
EventSource = e
from pywikibot import config, debug, Timestamp, Site, warning
-from pywikibot.tools import deprecated_args, StringTypes
+from pywikibot.tools import deprecated_args
if LooseVersion(requests_version) < LooseVersion('2.20.1'):
raise ImportError(
@@ -41,7 +39,7 @@
_logger = 'pywikibot.eventstreams'
-class EventStreams(object):
+class EventStreams:
"""Basic EventStreams iterator class for Server-Sent Events (SSE) protocol.
@@ -109,16 +107,15 @@
self._site = kwargs.pop('site', Site())
self._streams = kwargs.pop('streams', None)
- if self._streams and not isinstance(self._streams, StringTypes):
+ if self._streams and not isinstance(self._streams, str):
self._streams = ','.join(self._streams)
self._since = kwargs.pop('since', None)
if self._since:
# assume this is a mw timestamp, convert it to a Timestamp object
- if isinstance(self._streams, StringTypes) \
- and '-' not in self._since:
+ if isinstance(self._since, str) and '-' not in self._since:
self._since = Timestamp.fromtimestampformat(self._since)
- if isinstance(self._streams, Timestamp):
+ if isinstance(self._since, Timestamp):
self._since = self._since.isoformat
self._url = kwargs.get('url') or self.url
@@ -258,7 +255,7 @@
if isinstance(value, (bool, type(None))):
self.filter[ftype].append(partial(_is, key=key, value=value))
# append function for a single value
- elif isinstance(value, (StringTypes, int)):
+ elif isinstance(value, (str, int)):
self.filter[ftype].append(partial(_eq, key=key, value=value))
# append function for an iterable as value
else:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/616017
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: I698ccec91eee2e46c0a3dd5b69ca91f75d38f01b
Gerrit-Change-Number: 616017
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