jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/467975 )
Change subject: [IMPR] Remove noisy title_match function
......................................................................
[IMPR] Remove noisy title_match function
detached from I4ef9009c9
Change-Id: I6d1e2315cace973099cbc4909b7504d4d162d18d
---
M scripts/patrol.py
1 file changed, 2 insertions(+), 13 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/patrol.py b/scripts/patrol.py
index 902133d..4e84499 100755
--- a/scripts/patrol.py
+++ b/scripts/patrol.py
@@ -192,7 +192,7 @@
if item.match(title):
return True
- elif title_match(item, title):
+ elif title.startswith(item):
return True
verbose_output('not found')
return False
@@ -361,17 +361,6 @@
.format(title(as_link=True)))
-def title_match(prefix, title):
- """Match title substring with given prefix."""
- if pywikibot.config.verbose_output:
- pywikibot.output('Matching {0} to prefix {1}'.format(title, prefix))
- if title.startswith(prefix):
- if pywikibot.config.verbose_output:
- pywikibot.output('substr match')
- return True
- return
-
-
class LinkedPagesRule(object):
"""Matches of page site title and linked pages title."""
@@ -414,7 +403,7 @@
for p in self.linkedpages:
if pywikibot.config.verbose_output:
pywikibot.output("Checking against '{0}'".format(p))
- if title_match(p, page_title):
+ if page_title.startswith(p):
if pywikibot.config.verbose_output:
pywikibot.output('Matched.')
return p
--
To view, visit https://gerrit.wikimedia.org/r/467975
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: I6d1e2315cace973099cbc4909b7504d4d162d18d
Gerrit-Change-Number: 467975
Gerrit-PatchSet: 3
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: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/469433 )
Change subject: Removed unused vars/parameters from daemonize.py and data/api.py
......................................................................
Removed unused vars/parameters from daemonize.py and data/api.py
According to vulture the code was not being used. I removed it and ran tests. As far as I can see
I did not break anything. But it is my first commit so it might be good if someone else ran tests
on it.
I also removed a superfluous error from data/api.py and removed the per-file-ignores that ignored
the error.
Bug: T203395
Change-Id: Id75da257c2f3e3be43b98e749f027258a1a576e1
---
M pywikibot/daemonize.py
M pywikibot/data/api.py
M tox.ini
3 files changed, 8 insertions(+), 9 deletions(-)
Approvals:
Xqt: Looks good to me, but someone else must approve
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/daemonize.py b/pywikibot/daemonize.py
index 03a1532..7fe1c04 100644
--- a/pywikibot/daemonize.py
+++ b/pywikibot/daemonize.py
@@ -11,10 +11,13 @@
import os
import sys
+from pywikibot.tools import deprecated_args
+
is_daemon = False
-def daemonize(close_fd=True, chdir=True, write_pid=False, redirect_std=None):
+@deprecated_args(write_pid=None)
+def daemonize(close_fd=True, chdir=True, redirect_std=None):
"""
Daemonize the current process.
@@ -25,8 +28,6 @@
@type close_fd: bool
@param chdir: Change the current working directory to /
@type chdir: bool
- @param write_pid: Write the pid to sys.argv[0] + '.pid'
- @type write_pid: bool
@param redirect_std: Filename to redirect stdout and stdin to
@type redirect_std: str
"""
@@ -54,7 +55,6 @@
os.dup2(1, 2)
if chdir:
os.chdir('/')
- return
else:
# Write out the pid
path = os.path.basename(sys.argv[0]) + '.pid'
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index afb997a..64223ce 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -39,7 +39,7 @@
)
from pywikibot.tools import (
MediaWikiVersion, deprecated, itergroup, ip, PY2, PYTHON_VERSION,
- getargspec, UnicodeType
+ getargspec, UnicodeType, remove_last_args
)
from pywikibot.tools.formatter import color_format
@@ -3242,11 +3242,10 @@
"""Supply getCookie() method to use API interface."""
- def getCookie(self, remember=True, captchaId=None, captchaAnswer=None):
+ @remove_last_args(arg_names=['remember, captchaId, captchaAnswer'])
+ def getCookie(self):
"""Login to the site.
- Parameters are all ignored.
-
Note, this doesn't actually return or do anything with cookies.
The threadedhttp module takes care of all the cookie stuff,
this just has a legacy name for now and should be renamed in the
diff --git a/tox.ini b/tox.ini
index 2db36d6..fa259eb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -154,7 +154,7 @@
pywikibot/compat/catlib.py : N803
pywikibot/compat/query.py: N802
pywikibot/cosmetic_changes.py : N803, N806, N802
- pywikibot/data/api.py : N803, N806, N802
+ pywikibot/data/api.py : N806, N802
pywikibot/data/sparql.py: N802
pywikibot/date.py : N803, N806, N802
pywikibot/echo.py: N802
--
To view, visit https://gerrit.wikimedia.org/r/469433
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: Id75da257c2f3e3be43b98e749f027258a1a576e1
Gerrit-Change-Number: 469433
Gerrit-PatchSet: 10
Gerrit-Owner: Nathan fraignt <nathanklumpenaar10(a)outlook.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Nathan fraignt <nathanklumpenaar10(a)outlook.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Welcome, new contributor! <ssethi(a)wikimedia.org>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/469405 )
Change subject: [cleanup] Fix W504 error in scripts/welcome.py
......................................................................
[cleanup] Fix W504 error in scripts/welcome.py
Fixed breaking of line after a binary operator. So the line
break should happen before it with the line wrapped in parentheses.
In case the operator falls on the same line with the next line, do
1 more 4 spaces indentation. This patch does that!
Bug: T207836
Depends-On: I203077c45b6fba00502e3e8c536da5a049493acd
Change-Id: Iac640afd147ce3d100bd23560f5a5c8087b467c1
---
M scripts/welcome.py
1 file changed, 4 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
Dvorapa: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 0871dfd..496d0e8 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -794,11 +794,11 @@
if self.site.family.name != 'wikinews':
welcome_text = (welcome_text
% choice(self.defineSign()))
- if self.site.family.name != 'wiktionary' or \
- self.site.code != 'it':
+ if (self.site.family.name != 'wiktionary'
+ or self.site.code != 'it'):
welcome_text += timeselected
- elif (self.site.family.name != 'wikinews' and
- self.site.code != 'it'):
+ elif (self.site.family.name != 'wikinews'
+ and self.site.code != 'it'):
welcome_text = (welcome_text
% globalvar.defaultSign)
final_text = i18n.translate(
--
To view, visit https://gerrit.wikimedia.org/r/469405
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: Iac640afd147ce3d100bd23560f5a5c8087b467c1
Gerrit-Change-Number: 469405
Gerrit-PatchSet: 5
Gerrit-Owner: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
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/469381 )
Change subject: tox.ini: Ignore W504 errors
......................................................................
tox.ini: Ignore W504 errors
Some W504 errors have been detected by flake8 after its new release.
W504 (line break after binary operator) is mostly an stylistic issue
which we have not been very rigorous about; ignore it.
Change-Id: I203077c45b6fba00502e3e8c536da5a049493acd
---
M tox.ini
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tox.ini b/tox.ini
index e5d1d8c..2db36d6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -119,6 +119,7 @@
# H405: docstring summary line
# H301: Do not import more than one module per line; Pywikibot uses H306 (Alphabetically order your imports by the full module path)
# W503: line break before binary operator; against current PEP 8 recommendation
+# W504 line break after binary operator
# P101: format string does contain unindexed parameters
# P102: docstring does contain unindexed parameters
# P103: other string does contain unindexed parameters
@@ -135,7 +136,7 @@
# D413: Missing blank line after last section
# D412: No blank lines allowed between a section header and its content
-ignore = D105,D211,FI12,FI13,FI15,FI16,FI17,FI5,H101,H236,H301,H404,H405,H903,D401,D413,D412,P101,P102,P103,W503
+ignore = D105,D211,FI12,FI13,FI15,FI16,FI17,FI5,H101,H236,H301,H404,H405,H903,D401,D413,D412,P101,P102,P103,W503,W504
exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*,scripts/userscripts/*
min-version = 2.7
accept-encodings = utf-8
--
To view, visit https://gerrit.wikimedia.org/r/469381
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: I203077c45b6fba00502e3e8c536da5a049493acd
Gerrit-Change-Number: 469381
Gerrit-PatchSet: 2
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Pywikibot-test <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Dvorapa <dvorapa(a)seznam.cz>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/467908 )
Change subject: [test] Enable script_tests for patrol.py
......................................................................
[test] Enable script_tests for patrol.py
- remove patrol from expected_failures list which are expected for -help
option if external modules aren't present
detached from I4ef9009c91
Change-Id: If323aec472dc54d1df6d8c0f0161692e4a386eb0
---
M scripts/patrol.py
M tests/script_tests.py
2 files changed, 9 insertions(+), 3 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/patrol.py b/scripts/patrol.py
index e72e7ad..2384ed8 100755
--- a/scripts/patrol.py
+++ b/scripts/patrol.py
@@ -54,7 +54,10 @@
from collections import defaultdict
-import mwparserfromhell
+try:
+ import mwparserfromhell
+except ImportError as e:
+ mwparserfromhell = e
import pywikibot
@@ -126,9 +129,11 @@
def load_whitelist(self):
"""Load most recent watchlist_page for further processing."""
+ if isinstance(mwparserfromhell, Exception):
+ raise mwparserfromhell
# Check for a more recent version after versionchecktime in sec.
- if (self.whitelist_load_ts and (time.time() - self.whitelist_load_ts <
- self.getOption('versionchecktime'))):
+ if (self.whitelist_load_ts and (time.time() - self.whitelist_load_ts
+ < self.getOption('versionchecktime'))):
verbose_output('Whitelist not stale yet')
return
diff --git a/tests/script_tests.py b/tests/script_tests.py
index af9e37b..055b1e5 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -378,6 +378,7 @@
# -help tests may pass even when packages are required
_expected_failures.discard('imageharvest')
_expected_failures.discard('isbn')
+ _expected_failures.discard('patrol')
_expected_failures.discard('weblinkchecker')
_allowed_failures = []
--
To view, visit https://gerrit.wikimedia.org/r/467908
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: If323aec472dc54d1df6d8c0f0161692e4a386eb0
Gerrit-Change-Number: 467908
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/467339 )
Change subject: [doc] Update HISTORY.rst
......................................................................
[doc] Update HISTORY.rst
Change-Id: Ib0ce00173d175529c2819e34284447ee2a4f3484
---
M HISTORY.rst
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index b1d1d36..061ba04 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,7 +4,9 @@
Current release
---------------
+* Make sure the cookie file is created with the right permissions (T206387)
* pydot >= 1.2 is required for interwiki_graph
+* Move methods for simple claim adding/removing to WikibasePage (T113131)
* Enable start timestamp for EventStreams (T205121)
* Re-enable notifications (T205184)
* Use FutureWarning for warnings intended for end users (T191192)
--
To view, visit https://gerrit.wikimedia.org/r/467339
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: Ib0ce00173d175529c2819e34284447ee2a4f3484
Gerrit-Change-Number: 467339
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: jenkins-bot (75)