jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/602768 )
Change subject: [BUGFIX] Use get in page_can_be_edited
......................................................................
[BUGFIX] Use get in page_can_be_edited
MW<1.23 doesn't have the restrictions parameter, so use the default
by accessing with get instead of __getitem__.
Bug: T254623
Change-Id: I96da63d7c9ca3120e252e40f9be857e5ce7392df
---
M pywikibot/site/__init__.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py
index 7e3b5b7..b53c999 100644
--- a/pywikibot/site/__init__.py
+++ b/pywikibot/site/__init__.py
@@ -3174,7 +3174,7 @@
@raises ValueError: invalid action parameter
"""
- if action not in self.siteinfo['restrictions']['types']:
+ if action not in self.siteinfo.get('restrictions')['types']:
raise ValueError('{}.page_can_be_edited(): Invalid value "{}" for '
'"action" parameter'
.format(self.__class__.__name__, action))
--
To view, visit https://gerrit.wikimedia.org/r/602768
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: I96da63d7c9ca3120e252e40f9be857e5ce7392df
Gerrit-Change-Number: 602768
Gerrit-PatchSet: 1
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(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/584896 )
Change subject: [bugfix] compare whether tag is equal to string constant
......................................................................
[bugfix] compare whether tag is equal to string constant
- compare whether tag is equal to string constant in create_diff
instead tag is _in_ string. Otherwise that check could fail if
tag is a substring
- use elif to compare different tags
- simplify check_line
Change-Id: Ifb3b67703d0f3aee235be617d1e2324f5ae0c231
---
M pywikibot/diff.py
1 file changed, 4 insertions(+), 6 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, but someone else must approve
Dvorapa: Looks good to me, but someone else must approve
Huji: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index 1bc9a20..a309aed 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -90,9 +90,7 @@
# make sure each line ends with '\n' to prevent
# behaviour like http://bugs.python.org/issue2142
def check_line(line):
- if not line.endswith('\n'):
- line += '\n'
- return line
+ return line if line.endswith('\n') else line + '\n'
for tag, i1, i2, j1, j2 in self.group:
# equal/delete/insert add additional space after the sign as it's
@@ -100,13 +98,13 @@
if tag == 'equal':
for line in self.a[i1:i2]:
yield ' ' + check_line(line)
- if tag in ('delete'):
+ elif tag == 'delete':
for line in self.a[i1:i2]:
yield '- ' + check_line(line)
- if tag in ('insert'):
+ elif tag == 'insert':
for line in self.b[j1:j2]:
yield '+ ' + check_line(line)
- if tag in ('replace'):
+ elif tag == 'replace':
for line in difflib.ndiff(self.a[i1:i2], self.b[j1:j2]):
yield check_line(line)
--
To view, visit https://gerrit.wikimedia.org/r/584896
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: Ifb3b67703d0f3aee235be617d1e2324f5ae0c231
Gerrit-Change-Number: 584896
Gerrit-PatchSet: 7
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Mpaa <mpaa.wiki(a)gmail.com>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/599345 )
Change subject: Do not exclude userscripts directory from pycodestyles
......................................................................
Do not exclude userscripts directory from pycodestyles
This directory is empty by default. Whether the user choses to put
codes in it that are PEP8 compliant or not is up to the user. So,
the choice of whether to exclude this directory from pycodestyles
should also be up to the user.
This reverts Ic97089c806a5eacc332f30750431adf67be3cb56
Additionally, do not exclude user-config.py from the flake8 checks
for the same reason.
Bug: T253873
Change-Id: Ied5f8d5eca71d510269336757bab9f6f7e3dd081
---
M tox.ini
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tox.ini b/tox.ini
index d34bd55..58bada6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -102,7 +102,7 @@
ignore = D105,D211,D401,D413,D412,FI12,FI13,FI15,FI16,FI17,FI5,H101,H236,H301,H404,H405,H903,P101,P102,P103,W503
enable-extensions = H203,H204,H205
-exclude = .tox,.git,./*.egg,build,user-config.py,scripts/archive/*,./scripts/i18n/*,scripts/userscripts/*
+exclude = .tox,.git,./*.egg,build,scripts/archive/*,./scripts/i18n/*
min-version = 2.7
accept-encodings = utf-8
require-code = true
@@ -245,7 +245,7 @@
tests/xmlreader_tests.py: N802
[pycodestyle]
-exclude = .tox,.git,./*.egg,build,user-config.py,scripts/archive/*,./scripts/i18n/*,scripts/userscripts/*
+exclude = .tox,.git,./*.egg,build,scripts/archive/*,./scripts/i18n/*
[pep257]
# see explanations above
--
To view, visit https://gerrit.wikimedia.org/r/599345
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: Ied5f8d5eca71d510269336757bab9f6f7e3dd081
Gerrit-Change-Number: 599345
Gerrit-PatchSet: 4
Gerrit-Owner: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Dvorapa <dvorapa(a)seznam.cz>