jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/440547 )
Change subject: Remove an unused attribute from HarvestRobot
......................................................................
Remove an unused attribute from HarvestRobot
The attribute is only used to make a list of templates.
Change-Id: Id247b3359b51f493a59738e1d5f01523c11786e8
---
M scripts/harvest_template.py
M tox.ini
2 files changed, 6 insertions(+), 6 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py
index 2db474e..5bb82bc 100755
--- a/scripts/harvest_template.py
+++ b/scripts/harvest_template.py
@@ -123,14 +123,14 @@
"""A bot to add Wikidata claims."""
- def __init__(self, generator, templateTitle, fields, **kwargs):
+ def __init__(self, generator, template_title, fields, **kwargs):
"""
Initializer.
@param generator: A generator that yields Page objects
@type generator: iterator
- @param templateTitle: The template to work on
- @type templateTitle: str
+ @param template_title: The template to work on
+ @type template_title: str
@param fields: A dictionary of fields that are of use to us
@type fields: dict
@keyword islink: Whether non-linked values should be treated as links
@@ -149,7 +149,6 @@
})
super(HarvestRobot, self).__init__(**kwargs)
self.generator = generator
- self.templateTitle = templateTitle.replace(u'_', u' ')
# TODO: Make it a list which also includes the redirects to the template
self.fields = {}
for key, value in fields.items():
@@ -158,7 +157,8 @@
else: # backwards compatibility
self.fields[key] = (value, PropertyOptionHandler())
self.cacheSources()
- self.templateTitles = self.getTemplateSynonyms(self.templateTitle)
+ template_title = template_title.replace('_', ' ')
+ self.templateTitles = self.getTemplateSynonyms(template_title)
self.linkR = textlib.compileLinkR()
self.create_missing_item = self.getOption('create')
diff --git a/tox.ini b/tox.ini
index bef79b1..df5d598 100644
--- a/tox.ini
+++ b/tox.ini
@@ -209,7 +209,7 @@
scripts/data_ingestion.py : N803, N806
scripts/fixing_redirects.py : N803, N806
scripts/flickrripper.py : T001, N803, N806
- scripts/harvest_template.py : T001, N803
+ scripts/harvest_template.py : T001
scripts/imagecopy.py : N801, N803, N806
scripts/imagecopy_self.py : N801, N803, N806
scripts/imagerecat.py : N803, N806
--
To view, visit https://gerrit.wikimedia.org/r/440547
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: Id247b3359b51f493a59738e1d5f01523c11786e8
Gerrit-Change-Number: 440547
Gerrit-PatchSet: 3
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(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/440291 )
Change subject: Fix claimit to work on Wikidata as well
......................................................................
Fix claimit to work on Wikidata as well
The generator might yield pages from Wikidata, then the page is None and
this generates AttributeError.
Change-Id: I7b3f8535aaae433f8016a62e2288aaf8d8a74961
---
M scripts/claimit.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/claimit.py b/scripts/claimit.py
index 300076d..3c523f8 100755
--- a/scripts/claimit.py
+++ b/scripts/claimit.py
@@ -94,8 +94,9 @@
"""Treat each page."""
for claim in self.claims:
# The generator might yield pages from multiple sites
+ site = page.site if page is not None else None
self.user_add_claim_unless_exists(
- item, claim, self.exists_arg, page.site)
+ item, claim, self.exists_arg, site)
def main(*args):
--
To view, visit https://gerrit.wikimedia.org/r/440291
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: I7b3f8535aaae433f8016a62e2288aaf8d8a74961
Gerrit-Change-Number: 440291
Gerrit-PatchSet: 1
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
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/440160 )
Change subject: docs/conf.py: Set the `default_role` to 'code'
......................................................................
docs/conf.py: Set the `default_role` to 'code'
The "default default role" is :title-reference:[1] which is currently
redered to <cite> tags. Having a look at "git grep '`' -- '*.py'" results,
it seems to more appropriate to have all the current usage of '`'
interpreted as code rather than title.
[1]: http://docutils.sourceforge.net/docs/ref/rst/roles.html
Change-Id: Ic1341dd4463379a760a7a735f519bcd0a3b67858
---
M docs/conf.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index 44e6b7b..e6e4909 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -88,7 +88,7 @@
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
-# default_role = None
+default_role = 'code'
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
--
To view, visit https://gerrit.wikimedia.org/r/440160
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: Ic1341dd4463379a760a7a735f519bcd0a3b67858
Gerrit-Change-Number: 440160
Gerrit-PatchSet: 2
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
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/436820 )
Change subject: shell.py: call `sys.__interactivehook__()` if available
......................................................................
shell.py: call `sys.__interactivehook__()` if available
This pactch makes shell.py acts more similar to the built-in
interactive shell, where Python native code calls the hook. The
hook may be user-defined, or be the default implementation
defined by the site module of CPython 3.4+ Standard Library. The
site module is automatically imported if -S is not specified to
the Python interpreter.
The default implementation of the hook does all the magic of
loading readline, saving history, and tab-completion.
Unless the user defined their own sys.__interactivehook__, which
may include other features and/or exclude readline, and which we
honor in this patch, by default, this patch only works in CPython
3.4 or newer, after the fix of Python issue #5845 [1], and only on
Python installs where GNU readline is compiled into the CPython
interpreter binary. Other Python implementations, such as
IronPython, may also include their implementations of the hook,
and we try our best to simulate their built-in shell, but it is
not our main concern.
* In Windows, Python uses the ReadConsoleW() Windows API, which
has some cmd-like history functionality built-in. It is able to
use the history of a previous invokation of Python as long as
the terminal window stays open.
* In older versions of Python, sys.__interactivehook__ is not
defined by site.
* In newer versions of Python, but without readline compiled,
interactivehook will attempt to import readline but silently fail.
In these cases, you get the plain old interactive prompt, as if
this patch never existed.
In any case, this patch shall attempt to make the behavior of
shell.py closer to what would be provided if one invokes the
built-in Python interactive shell directly.
[1] https://bugs.python.org/issue5845
Bug: T196168
Change-Id: I410c9717370cff70fa441f06500625956e8596fc
---
M scripts/shell.py
1 file changed, 9 insertions(+), 3 deletions(-)
Approvals:
jenkins-bot: Verified
Dvorapa: Looks good to me, but someone else must approve
Dalba: Looks good to me, approved
diff --git a/scripts/shell.py b/scripts/shell.py
index b119a6c..5333556 100755
--- a/scripts/shell.py
+++ b/scripts/shell.py
@@ -20,6 +20,9 @@
#
from __future__ import absolute_import, print_function, unicode_literals
+import code
+import sys
+
def main(*args):
"""Script entry point."""
@@ -38,12 +41,16 @@
print('{} arguments: {}\n' # noqa: T001
.format(warn_type, ', '.join(args)))
- import code
+ # Various stuffs in Python 3.4+, such as history file.
+ # This is defined in the site module of the Python Standard Library,
+ # and usually called by the built-in CPython interactive shell.
+ if hasattr(sys, '__interactivehook__'):
+ sys.__interactivehook__()
+
code.interact("""Welcome to the Pywikibot interactive shell!""", local=env)
if __name__ == "__main__":
- import sys
if sys.platform == 'win32':
import os
os.system('title Python {} Shell'.format(*sys.version.split(' ', 1)))
@@ -51,5 +58,4 @@
args = []
if sys.argv and sys.argv[0].endswith(('shell', 'shell.py')):
args = sys.argv[1:]
- del sys
main(*args)
--
To view, visit https://gerrit.wikimedia.org/r/436820
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: I410c9717370cff70fa441f06500625956e8596fc
Gerrit-Change-Number: 436820
Gerrit-PatchSet: 6
Gerrit-Owner: Zhuyifei1999 <zhuyifei1999(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: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot