jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/427663 )
Change subject: [compat] Update conversion description
......................................................................
[compat] Update conversion description
Old compat modules catlib, userlib and query could be easily replaced
by its core equivalent. There is no need to use our compat module.
See also the deprecation warning for these replacements.
Bug: T183085
Change-Id: I9acb38602a2bdca2e21c8bcd30166227577714fe
---
M README-conversion.txt
1 file changed, 4 insertions(+), 3 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README-conversion.txt b/README-conversion.txt
index d89dec1..1d17d22 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -29,9 +29,10 @@
change "import wikipedia" to "import pywikibot"
change "import pagegenerators" to "from pywikibot import pagegenerators"
change "import config" to "from pywikibot import config"
- change "import catlib" to "from pywikibot.compat import catlib"
- change "import query" to "from pywikibot.compat import query"
- change "import userlib" to "from pywikibot.compat import userlib"
+ change "catlib.Category" to "pywikibot.Category"
+ change "catlib.change_category(page, ...)" to "page.change_category(...)"
+ change "query.GetData(request)" to "pywikibot.data.api.request(**request).submit()"
+ change "userlib.User" to "pywikibot.User"
change "wikipedia." to "pywikibot."
wikipedia.setAction() no longer works; you must revise the script to pass an
--
To view, visit https://gerrit.wikimedia.org/r/427663
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I9acb38602a2bdca2e21c8bcd30166227577714fe
Gerrit-Change-Number: 427663
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/197901 )
Change subject: API help module support for 1.25+
......................................................................
API help module support for 1.25+
Add 'wrap' argument to force json output of help module.
This does not address the difference json results from
pre-1.25.
Bug: T93188
Change-Id: I14672494ec9e98fadec67785ce45a134f6af7321
---
M pywikibot/data/api.py
1 file changed, 5 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 741a75b..ebe9241 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -961,6 +961,11 @@
'rawcontinue' not in self._params and
MediaWikiVersion(self.site.version()) >= MediaWikiVersion('1.25wmf5')):
self._params['rawcontinue'] = ['']
+ elif (self.action == 'help'
+ and MediaWikiVersion(self.site.version())
+ > MediaWikiVersion('1.24')):
+ self._params['wrap'] = ['']
+
if "maxlag" not in self._params and config.maxlag:
self._params["maxlag"] = [str(config.maxlag)]
if "format" not in self._params:
--
To view, visit https://gerrit.wikimedia.org/r/197901
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I14672494ec9e98fadec67785ce45a134f6af7321
Gerrit-Change-Number: 197901
Gerrit-PatchSet: 3
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/426751 )
Change subject: [FEAT] Show a warning if user does not exists on a given site
......................................................................
[FEAT] Show a warning if user does not exists on a given site
This is a more general solution of T191950
Bug: T191950
Change-Id: Ib2c74c580f22c393b4fee99d53260f2f71d07c06
---
M pywikibot/pagegenerators.py
1 file changed, 8 insertions(+), 3 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 9ecdf2e..684c0f9 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -1521,10 +1521,15 @@
"""
if site is None:
site = pywikibot.Site()
+
+ user = pywikibot.User(site, username)
+ if not (user.isAnonymous() or user.isRegistered()):
+ pywikibot.warning('User "{}" does not exist on site "{}".'
+ .format(user.username, site))
+
return _filter_unique(
- pywikibot.Page(pywikibot.Link(contrib["title"], source=site))
- for contrib in site.usercontribs(user=username, namespaces=namespaces,
- total=total)
+ contrib[0]
+ for contrib in user.contributions(namespaces=namespaces, total=total)
)
--
To view, visit https://gerrit.wikimedia.org/r/426751
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib2c74c580f22c393b4fee99d53260f2f71d07c06
Gerrit-Change-Number: 426751
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/426815 )
Change subject: [FEAT] Show the python version when starting pwb shell
......................................................................
[FEAT] Show the python version when starting pwb shell
- Show the python version as command line title on windows when starting
the shell script. This is usefull for example if you have different
python versions installed and start one of them with the python
launcher. This shows the started version.
Change-Id: Iabeca656ab2739e117c3704047ec5c827f26803c
---
M scripts/shell.py
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/shell.py b/scripts/shell.py
index 07b16af..f99183b 100755
--- a/scripts/shell.py
+++ b/scripts/shell.py
@@ -30,6 +30,10 @@
if __name__ == "__main__":
import sys
+ if sys.platform == 'win32':
+ import os
+ os.system('title Python {} Shell'.format(*sys.version.split(' ', 1)))
+ del os
args = []
if set(sys.argv) - {'shell', 'shell.py'}:
args = sys.argv
--
To view, visit https://gerrit.wikimedia.org/r/426815
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iabeca656ab2739e117c3704047ec5c827f26803c
Gerrit-Change-Number: 426815
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/426638 )
Change subject: [IMPR][doc] Make usage of title in pagefromfile.py more clear
......................................................................
[IMPR][doc] Make usage of title in pagefromfile.py more clear
+ make clear the whole intro to the file
+ remove safe option as it sets the default values only
Bug: T155356
Change-Id: Ie2265a40a25d0157fb5818d11b69820905805b37
---
M scripts/pagefromfile.py
1 file changed, 47 insertions(+), 48 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index 36fb613..a13d9de 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -1,62 +1,64 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
-Bot to upload pages from a file.
+Bot to upload pages from a text file.
-This bot takes its input from a file that contains a number of
-pages to be put on the wiki. The pages should all have the same
-begin and end text (which may not overlap).
+This bot takes its input from the UTF-8 text file that contains
+a number of pages to be put on the wiki. The pages should all have
+the same beginning and ending text (which may not overlap).
+The beginning and ending text is not uploaded with the page content
+by default.
-By default the text should have the intended title of the page
-as the first text in bold (that is, between ''' and '''),
-you can modify this behavior with command line options.
-
-The default is not to include the begin and
-end text in the page, if you want to include that text, use
-the -include option.
+As a pagename is by default taken the first text block
+from the page content marked in bold (wrapped between ''' and ''').
+If you expect the page title not to be present in the text
+or marked by different markers, use -titlestart, -titleend,
+and -notitle parameters.
Specific arguments:
--begin:xxx Specify the text that marks the beginning of a page
--end:xxx Specify the text that marks the end of a page
--file:xxx Give the filename we are getting our material from
- (default: dict.txt)
--include The beginning and end markers should be included
- in the page.
--titlestart:xxx Use xxx in place of ''' for identifying the
- beginning of page title
--titleend:xxx Use xxx in place of ''' for identifying the
- end of page title
--notitle do not include the title, including titlestart, and
- titleend, in the page
--nocontent If page has this statment it doesn't append
- (example: -nocontent:"{{infobox")
--noredirect if you don't want to upload on redirect page
- it is True by default and bot adds pages to redirected pages
--summary:xxx Use xxx as the edit summary for the upload - if
- a page exists, standard messages are appended
- after xxx for appending, prepending, or replacement
--autosummary Use MediaWikis autosummary when creating a new page,
- overrides -summary in this case
--minor set minor edit flag on page edits
--showdiff show difference between page and page to upload; it forces
- -always=False; default to False.
+-file:xxx The filename we are getting our material from,
+ the default value is "dict.txt"
+-begin:xxx The text that marks the beginning of a page,
+ the default value is "{{-start-}}"
+-end:xxx The text that marks the end of the page,
+ the default value is "{{-stop-}}"
+-include Include the beginning and end markers to the page
+-titlestart:xxx The text used in place of ''' for identifying
+ the beginning of a page title
+-titleend:xxx The text used in place of ''' for identifying
+ the end of the page title
+-notitle Do not include the page title, including titlestart
+ and titleend, to the page. Can be used to specify unique
+ page title above the page content
+-nocontent:xxx If the existing page contains specified statement,
+ the page is skipped from editing
+-noredirect Do not upload on redirect pages
+-summary:xxx The text used as an edit summary for the upload.
+ If the page exists, standard messages for prepending,
+ appending, or replacement are appended after it
+-autosummary Use MediaWiki's autosummary when creating a new page,
+ overrides -summary
+-minor Set the minor edit flag on page edits
+-showdiff Show difference between current page and page to upload,
+ also forces the bot to ask for confirmation
+ on every edit
-If the page to be uploaded already exists:
+If the page to be uploaded already exists, it is skipped by default.
+But you can override this behavior if you want to:
--safe do nothing (default)
--appendtop add the text to the top of it
--appendbottom add the text to the bottom of it
--force overwrite the existing page
+-appendtop Add the text to the top of the existing page
+-appendbottom Add the text to the bottom of the existing page
+-force Overwrite the existing page
-It's possible to define a separator after the 'append' modes which is added
-between the exisiting and new text. For example -appendtop:foo would add 'foo'
-between the parts. The \n (two separate characters) is replaced by the newline
-character.
+It is possible to define a separator after the 'append' modes which
+is added between the existing and the new text. For example
+a parameter -appendtop:foo would add 'foo' between them. A new line
+can be added between them by specifying '\n' as a value.
"""
#
# (C) Andre Engels, 2004
-# (C) Pywikibot team, 2005-2017
+# (C) Pywikibot team, 2005-2018
#
# Distributed under the terms of the MIT license.
#
@@ -307,9 +309,6 @@
options['append'] = ('top', value)
elif option in ('force', 'minor', 'autosummary', 'showdiff'):
options[option] = True
- elif option == 'safe':
- options['force'] = False
- options['append'] = None
elif option == 'noredirect':
options['redirect'] = False
elif option in ('nocontent', 'summary'):
--
To view, visit https://gerrit.wikimedia.org/r/426638
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie2265a40a25d0157fb5818d11b69820905805b37
Gerrit-Change-Number: 426638
Gerrit-PatchSet: 6
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Wesalius <jonas.dyba(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/225105 )
Change subject: Enable pip caching
......................................................................
Enable pip caching
Bug: T106070
Change-Id: I5a14d3e124cdb2833760dd2eaded396c8ba80550
---
M .travis.yml
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
Objections:
John Vandenberg: There's a problem with this change, please improve
diff --git a/.travis.yml b/.travis.yml
index 4108055..70efc91 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,6 +21,8 @@
- graphviz
- liblua5.1-0-dev
+cache: pip
+
before_install:
# When PYSETUP_TEST_EXTRAS is not enabled, do not allow the
# default 'install' step to install all dependencies listed in
--
To view, visit https://gerrit.wikimedia.org/r/225105
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5a14d3e124cdb2833760dd2eaded396c8ba80550
Gerrit-Change-Number: 225105
Gerrit-PatchSet: 2
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/425832 )
Change subject: [IMPR] Simplify expression for old_position in Link.parse()
......................................................................
[IMPR] Simplify expression for old_position in Link.parse()
str.find(':') is not 0 if it not starts with that token. In that case
old_position should become 0 and 1 if it starts with ':'. This can be
simplified with int(str.startswith(':')) because int(True) is 1.
Change-Id: I97c474391c427287b2aaa68ee8ee392238e770d1
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 46a43e1..3fcdf15 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -5543,7 +5543,7 @@
self._is_interwiki = False
ns_prefix = False
- old_position = 0 if self._text.find(':') != 0 else 1
+ old_position = int(self._text.startswith(':'))
colon_position = self._text.find(':', old_position)
first_other_site = None
while colon_position >= 0:
--
To view, visit https://gerrit.wikimedia.org/r/425832
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I97c474391c427287b2aaa68ee8ee392238e770d1
Gerrit-Change-Number: 425832
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/425840 )
Change subject: Revert "[FIX] W503 errors"
......................................................................
Revert "[FIX] W503 errors"
Rule W503 (line break before binary operator)
is against current PEP 8 recommendation
This reverts commit 54e9727c0d5a99119be1f230d4498d8d0bc4efd6.
Change-Id: I7bbcffc7c5d3488e2db8e746eb231e61d46e4385
---
M generate_family_file.py
M pywikibot/data/api.py
M pywikibot/page.py
M pywikibot/site.py
M pywikibot/userinterfaces/win32_unicode.py
M scripts/archivebot.py
M scripts/category_redirect.py
M scripts/commonscat.py
M scripts/solve_disambiguation.py
M scripts/transferbot.py
M tests/__init__.py
M tests/aspects.py
M tests/script_tests.py
13 files changed, 57 insertions(+), 57 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/generate_family_file.py b/generate_family_file.py
index cee2ad5..eef45c1 100755
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -105,8 +105,8 @@
print(wiki['prefix'], wiki['url'])
do_langs = raw_input("Which languages do you want: ")
self.langs = [wiki for wiki in self.langs
- if wiki['prefix'] in do_langs or
- wiki['url'] == w.iwpath]
+ if wiki['prefix'] in do_langs
+ or wiki['url'] == w.iwpath]
else:
self.langs = [wiki for wiki in self.langs
if wiki[u'url'] == w.iwpath]
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 29030fe..c099574 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -630,8 +630,8 @@
params['modules'] = module_batch
else:
params['modules'] = [mod for mod in module_batch
- if not mod.startswith('query+') and
- mod not in self.root_modules]
+ if not mod.startswith('query+')
+ and mod not in self.root_modules]
params['querymodules'] = [mod[6:] for mod in module_batch
if mod.startswith('query+')]
@@ -1460,8 +1460,8 @@
self["assert"] = 'user' # make sure user is logged in
if (self.site.protocol() == 'http' and (config.use_SSL_always or (
- self.action == 'login' and config.use_SSL_onlogin)) and
- self.site.family.name in config.available_ssl_project):
+ self.action == 'login' and config.use_SSL_onlogin))
+ and self.site.family.name in config.available_ssl_project):
self.site = EnableSSLSiteWrapper(self.site)
@classmethod
@@ -1767,9 +1767,9 @@
def __str__(self):
"""Return a string representation."""
- return unquote(self.site.scriptpath() +
- '/api.php?' +
- self._http_param_string())
+ return unquote(self.site.scriptpath()
+ + '/api.php?'
+ + self._http_param_string())
def __repr__(self):
"""Return internal representation."""
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 46a43e1..a424abe 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -338,8 +338,8 @@
target_family = config.family
if forceInterwiki or \
(allowInterwiki and
- (self.site.family.name != target_family or
- self.site.code != target_code)):
+ (self.site.family.name != target_family
+ or self.site.code != target_code)):
if self.site.family.name != target_family \
and self.site.family.name != self.site.code:
title = u'%s:%s:%s' % (self.site.family.name,
@@ -1941,8 +1941,8 @@
"""
if hasattr(self, "_deletedRevs"):
if timestamp in self._deletedRevs and (
- (not retrieveText) or
- 'content' in self._deletedRevs[timestamp]):
+ (not retrieveText)
+ or 'content' in self._deletedRevs[timestamp]):
return self._deletedRevs[timestamp]
for item in self.site.deletedrevs(self, start=timestamp,
get_text=retrieveText, total=1):
@@ -5622,11 +5622,11 @@
# * with 'relative' URLs. Forbid them explicitly.
if u'.' in t and (
- t in ('.', '..') or
- t.startswith(('./', '../')) or
- u'/./' in t or
- u'/../' in t or
- t.endswith(('/.', '/..'))
+ t in ('.', '..')
+ or t.startswith(('./', '../'))
+ or '/./' in t
+ or '/../' in t
+ or t.endswith(('/.', '/..'))
):
raise pywikibot.InvalidTitle(
u"(contains . / combinations): '%s'"
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 20c6d62..c19ec20 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -632,8 +632,8 @@
# int(None) raises TypeError; however, bool needs special handling.
result = [NotImplemented if isinstance(ns, bool) else
NamespacesDict._lookup_name(ns, namespaces)
- if isinstance(ns, basestring) and
- not ns.lstrip('-').isdigit() else
+ if isinstance(ns, basestring)
+ and not ns.lstrip('-').isdigit() else
namespaces[int(ns)] if int(ns) in namespaces
else None
for ns in identifiers]
@@ -2234,8 +2234,8 @@
@rtype: C{set} of L{Namespace}
"""
# TODO: Integrate into _userinfo
- if (force or not hasattr(self, '_useroptions') or
- self.user() != self._useroptions['_name']):
+ if (force or not hasattr(self, '_useroptions')
+ or self.user() != self._useroptions['_name']):
uirequest = self._simple_request(
action="query",
meta="userinfo",
@@ -6392,8 +6392,8 @@
final_request['filekey'] = _file_key
else:
file_contents = f.read()
- filetype = (mimetypes.guess_type(source_filename)[0] or
- 'application/octet-stream')
+ filetype = (mimetypes.guess_type(source_filename)[0]
+ or 'application/octet-stream')
final_request.mime_params = {
'file': (file_contents, filetype.split('/'),
{'filename': mime_filename})
diff --git a/pywikibot/userinterfaces/win32_unicode.py b/pywikibot/userinterfaces/win32_unicode.py
index 19ed9bb..41667b6 100755
--- a/pywikibot/userinterfaces/win32_unicode.py
+++ b/pywikibot/userinterfaces/win32_unicode.py
@@ -280,8 +280,8 @@
"""Return whether the handle is not to a console."""
if handle == INVALID_HANDLE_VALUE or handle is None:
return True
- return ((GetFileType(handle) & ~FILE_TYPE_REMOTE) != FILE_TYPE_CHAR or
- GetConsoleMode(handle, byref(DWORD())) == 0)
+ return ((GetFileType(handle) & ~FILE_TYPE_REMOTE) != FILE_TYPE_CHAR
+ or GetConsoleMode(handle, byref(DWORD())) == 0)
old_stdin_fileno = old_fileno('in')
old_stdout_fileno = old_fileno('out')
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 33000c9..21a8eaa 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -579,8 +579,8 @@
def saveables(self):
"""Return a list of saveable attributes."""
- return [a for a in self.attributes if self.attributes[a][1] and
- a != 'maxage']
+ return [a for a in self.attributes if self.attributes[a][1]
+ and a != 'maxage']
def attr2text(self):
"""Return a template with archiver saveable attributes."""
diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index 285651c..4040eaf 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -443,12 +443,12 @@
newredirs.sort()
comment = i18n.twtranslate(self.site, self.maint_comment)
self.log_page.text = (u"\n== %i-%02i-%02iT%02i:%02i:%02iZ ==\n"
- % time.gmtime()[:6] +
- u'\n'.join(self.log_text) +
- u'\n* New redirects since last report:\n' +
- u'\n'.join(newredirs) +
- u'\n' + u'\n'.join(self.problems) +
- u'\n' + self.get_log_text())
+ % time.gmtime()[:6]
+ + '\n'.join(self.log_text)
+ + '\n* New redirects since last report:\n'
+ + '\n'.join(newredirs)
+ + '\n' + '\n'.join(self.problems)
+ + '\n' + self.get_log_text())
self.log_page.save(comment)
if self.edit_requests:
edit_request_page.text = (self.edit_request_text
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index c7083b9..e1c37df 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -392,8 +392,8 @@
ipage = pywikibot.page.Page(ipageLink)
pywikibot.log("Looking for template on %s" % (ipage.title()))
try:
- if (not ipage.exists() or ipage.isRedirectPage() or
- ipage.isDisambig()):
+ if (not ipage.exists() or ipage.isRedirectPage()
+ or ipage.isDisambig()):
continue
commonscatLink = self.getCommonscatLink(ipage)
if not commonscatLink:
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index dc82dfb..2d662e8 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -944,8 +944,8 @@
new_page_title = answer[1]
repPl = pywikibot.Page(pywikibot.Link(new_page_title,
disambPage.site))
- if (new_page_title[0].isupper() or
- link_text[0].isupper()):
+ if (new_page_title[0].isupper()
+ or link_text[0].isupper()):
new_page_title = repPl.title()
else:
new_page_title = repPl.title()
@@ -956,8 +956,8 @@
newlink = "[[%s%s]]%s" % (new_page_title,
section,
trailing_chars)
- elif replaceit or (new_page_title == link_text and
- not section):
+ elif replaceit or (new_page_title == link_text
+ and not section):
newlink = "[[%s]]" % new_page_title
# check if we can create a link with trailing characters
# instead of a pipelink
@@ -1006,8 +1006,8 @@
"""
if disambPage.isRedirectPage() and not self.primary:
- if (disambPage.site.lang in self.primary_redir_template and
- self.primary_redir_template[disambPage.site.lang]
+ if (disambPage.site.lang in self.primary_redir_template
+ and self.primary_redir_template[disambPage.site.lang]
in disambPage.templates()):
baseTerm = disambPage.title()
for template in disambPage.templatesWithParams():
diff --git a/scripts/transferbot.py b/scripts/transferbot.py
index 092bad1..f6d2ee3 100755
--- a/scripts/transferbot.py
+++ b/scripts/transferbot.py
@@ -135,8 +135,8 @@
for page in gen:
targetpage = pywikibot.Page(tosite, prefix + page.title())
- edithistpage = pywikibot.Page(tosite, prefix + page.title() +
- '/edithistory')
+ edithistpage = pywikibot.Page(tosite, prefix + page.title()
+ + '/edithistory')
summary = 'Moved page from {old} ([[{new}/edithistory|history]])'\
.format(old=page.title(asLink=True, insite=tosite),
new=targetpage.title() if not
diff --git a/tests/__init__.py b/tests/__init__.py
index 75404a3..5050b9f 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -169,13 +169,13 @@
"""List tests which are to be executed."""
dir_list = os.listdir(join_tests_path())
all_test_list = [name[0:-9] for name in dir_list # strip '_tests.py'
- if name.endswith('_tests.py') and
- not name.startswith('_')] # skip __init__.py and _*
+ if name.endswith('_tests.py')
+ and not name.startswith('_')] # skip __init__.py and _*
unknown_test_modules = [name
for name in all_test_list
- if name not in library_test_modules and
- name not in script_test_modules]
+ if name not in library_test_modules
+ and name not in script_test_modules]
return unknown_test_modules
diff --git a/tests/aspects.py b/tests/aspects.py
index f51a627..268e460 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -845,9 +845,9 @@
if 'family' in dct or 'code' in dct:
dct['site'] = True
- if (('sites' not in dct or not len(dct['sites'])) and
- 'family' in dct and
- 'code' in dct and dct['code'] != '*'):
+ if (('sites' not in dct or not len(dct['sites']))
+ and 'family' in dct
+ and 'code' in dct and dct['code'] != '*'):
# Add entry to self.sites
dct['sites'] = {
str(dct['family'] + ':' + dct['code']): {
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 7a70d5e..6e290d1 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -192,8 +192,8 @@
tests = (['test__login'] +
['test_' + name
for name in sorted(script_list)
- if name != 'login' and
- name not in unrunnable_script_list
+ if name != 'login'
+ and name not in unrunnable_script_list
])
test_list = ['tests.script_tests.TestScriptHelp.' + name
@@ -202,10 +202,10 @@
tests = (['test__login'] +
['test_' + name
for name in sorted(script_list)
- if name != 'login' and
- name not in failed_dep_script_list and
- name not in unrunnable_script_list and
- (enable_autorun_tests or name not in auto_run_script_list)
+ if name != 'login'
+ and name not in failed_dep_script_list
+ and name not in unrunnable_script_list
+ and (enable_autorun_tests or name not in auto_run_script_list)
])
test_list += ['tests.script_tests.TestScriptSimulate.' + name
--
To view, visit https://gerrit.wikimedia.org/r/425840
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7bbcffc7c5d3488e2db8e746eb231e61d46e4385
Gerrit-Change-Number: 425840
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/425548 )
Change subject: [FEAT] Show a warning if user does not exists on a given site
......................................................................
[FEAT] Show a warning if user does not exists on a given site
Also use any to set the default behavior
Bug: T191950
Change-Id: Ia6cac9f966c9dadde621dff6534bad25138ad9d7
---
M scripts/patrol.py
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
Zoranzoki21: Looks good to me, but someone else must approve
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/patrol.py b/scripts/patrol.py
index 659b76a..08f03c9 100755
--- a/scripts/patrol.py
+++ b/scripts/patrol.py
@@ -499,9 +499,15 @@
site.login()
if usercontribs:
- pywikibot.output(u'Processing user: %s' % usercontribs)
+ user = pywikibot.User(site, usercontribs)
+ if user.isAnonymous() or user.isRegistered():
+ pywikibot.output('Processing user: {}'.format(usercontribs))
+ else:
+ pywikibot.warning('User {} does not exist on site {}.'
+ .format(usercontribs, site))
- if not newpages and not recentchanges and not usercontribs:
+ # default behaviour
+ if not any((newpages, recentchanges, usercontribs)):
if site.family.name == 'wikipedia':
newpages = True
else:
--
To view, visit https://gerrit.wikimedia.org/r/425548
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6cac9f966c9dadde621dff6534bad25138ad9d7
Gerrit-Change-Number: 425548
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>