jenkins-bot has submitted this change and it was merged.
Change subject: [BUGFIX] Format sting needs a conversion type specifier
......................................................................
[BUGFIX] Format sting needs a conversion type specifier
Change-Id: I3b92685102d02d95637377b3da64a8d115e2a216
---
M scripts/featured.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/featured.py b/scripts/featured.py
index f2b692e..fdf7db5 100644
--- a/scripts/featured.py
+++ b/scripts/featured.py
@@ -291,7 +291,7 @@
def run_good(self):
task = 'good'
if not self.hastemplate(task):
- pywikibot.output(u'\nNOTE: % arcticles are not implemented at %.'
+ pywikibot.output(u'\nNOTE: %s arcticles are not implemented at %s.'
% (task, self.site))
return
@@ -328,7 +328,7 @@
def run_featured(self):
task = 'featured'
if not self.hastemplate(task):
- pywikibot.output(u'\nNOTE: % arcticles are not implemented at %.'
+ pywikibot.output(u'\nNOTE: %s arcticles are not implemented at %s.'
% (task, self.site))
return
--
To view, visit https://gerrit.wikimedia.org/r/93651
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3b92685102d02d95637377b3da64a8d115e2a216
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Xqt has submitted this change and it was merged.
Change subject: [SYNC] Sychronized config.py with core
......................................................................
[SYNC] Sychronized config.py with core
Change-Id: Ibea6f4695bd118c778ec6a6b1193da528af7268f
---
M config.py
1 file changed, 77 insertions(+), 58 deletions(-)
Approvals:
Xqt: Looks good to me, approved
diff --git a/config.py b/config.py
index cc44c66..c10cefb 100644
--- a/config.py
+++ b/config.py
@@ -3,14 +3,15 @@
# (C) Rob W.W. Hooft, 2003
# parts by holger(a)trillke.net 2002/03/18
# Purodha Blissenbach (Modifier), 2010
-# (C) Pywikipedia bot team, 2003-2012
+# (C) Pywikipedia bot team, 2003-2013
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'
-import os, re
+import os
import sys as __sys
+import re
# IMPORTANT:
# Do not change any of the variables in this file. Instead, make
# a file user-config.py, and overwrite values in there.
@@ -124,7 +125,7 @@
# i18n setting for user interface language
# default is config.mylang or 'en'
-userinterface_lang = 'en' # None
+userinterface_lang = 'en' # None
# Should we transliterate characters that do not exist in the console
# character set?
@@ -161,13 +162,14 @@
if __sys.platform == 'win32':
try:
import _winreg
- _key1 = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, 'Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithProgids')
+ _key1 = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
+ 'Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithProgids')
_progID = _winreg.EnumValue(_key1, 1)[0]
- _key2 = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, '%s\shell\open\command' % _progID)
+ _key2 = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,
+ '%s\shell\open\command' % _progID)
_cmd = _winreg.QueryValueEx(_key2, None)[0]
editor = _cmd.replace('%1', '')
# Notepad is even worse than our Tkinter editor.
- # Nobody has deserved to use it.
if editor.lower().endswith('notepad.exe'):
editor = None
except:
@@ -305,13 +307,13 @@
# what you are doing and have a good reason for it!
maxlag = 5
-# Number of retries before giving up when putting a page
-maxretries = 5
-
# Maximum of pages which can be retrieved by special pages. Increase this if
# you heavily use redirect.py with action "double", and especially if you're
# running solve_disambiguation.py with the -primary argument.
special_page_limit = 500
+
+# Maximum number of retries before giving up when putting a page
+maxretries = 5
############## TABLE CONVERSION BOT SETTINGS ##############
@@ -341,17 +343,18 @@
############## SEARCH ENGINE SETTINGS ##############
-# Some scripts allow querying Google via the Google Web API. To use this feature,
-# you must install the pyGoogle module from http://pygoogle.sf.net/ and have a
-# Google Web API license key. Note that Google doesn't give out license keys
-# anymore.
+# Some scripts allow querying Google via the Google Web API. To use this
+# feature, you must install the pyGoogle module from http://pygoogle.sf.net/
+# and have a Google Web API license key. Note that Google doesn't give out
+# license keys anymore.
# --------------------
-# Google web API is obsoleted for long time, now we can use Google AJAX Search API,
-# You can signup an API key from http://code.google.com/apis/ajaxsearch/signup.html.
+# Google web API is obsoleted for long time, now we can use Google AJAX Search
+# API. You can signup an API key from
+# http://code.google.com/apis/ajaxsearch/signup.html.
google_key = ''
-# using Google AJAX Search API, it requires the referer website, this variable saves the referer web address
-# when you sign up with the key.
+# using Google AJAX Search API, it requires the referer website, this variable
+# saves the referer web address when you sign up with the key.
google_api_refer = ''
# Some scripts allow using the Yahoo! Search Web Services. To use this feature,
@@ -368,18 +371,20 @@
'api_key': u'', # Provide your key!
'api_secret': u'', # Api secret of your key (optional)
'review': False, # Do we use automatically make our uploads reviewed?
- 'reviewer': u'', # If so, under what reviewer name?
- }
+ 'reviewer': u'', # If so, under what reviewer name?
+}
# Using the Panoramio api
panoramio = {
'review': False, # Do we use automatically make our uploads reviewed?
- 'reviewer': u'', # If so, under what reviewer name?
- }
+ 'reviewer': u'', # If so, under what reviewer name?
+}
# for all connections: proxy handle
-# to use it, proxy['host'] have to support HTTP and include port number (e.g. localhost:8080)
-# if the proxy server needs authentication, set ('ID', 'PASSWORD') to proxy['auth'].
+# to use it, proxy['host'] have to support HTTP and include port number
+# (e.g. localhost:8080)
+# if the proxy server needs authentication,
+# set ('ID', 'PASSWORD') to proxy['auth'].
proxy = {
'host': None,
'auth': None,
@@ -438,18 +443,6 @@
# number of results.
copyright_economize_query = True
-############## REPLICATION BOT ################
-# You can add replicate_replace to your user_config.py, which has the following format:
-#
-# replicate_replace = {
-# 'wikipedia:li': {'Hoofdpagina': 'Veurblaad'}
-# }
-#
-# to replace all occurences of 'Hoofdpagina' with 'Veurblaad' when writing to liwiki. Note that this does
-# not take the origin wiki into account.
-replicate_replace = {}
-
-
############## HTTP SETTINGS ##############
# Default socket timeout. Set to None to disable timeouts.
socket_timeout = 120 # set a pretty long timeout just in case...
@@ -486,6 +479,18 @@
# cosmetic_changes_disable['wikipedia'] = ('de', 'en', 'fr')
cosmetic_changes_disable = {}
+############## REPLICATION BOT ################
+# You can add replicate_replace to your user_config.py, which has the following
+# format:
+#
+# replicate_replace = {
+# 'wikipedia:li': {'Hoofdpagina': 'Veurblaad'}
+# }
+#
+# to replace all occurences of 'Hoofdpagina' with 'Veurblaad' when writing to
+# liwiki. Note that this does not take the origin wiki into account.
+replicate_replace = {}
+
############## FURTHER SETTINGS ##############
# Use the experimental disk cache to prevent huge memory usage
@@ -495,18 +500,20 @@
# up to 30 minutes)
retry_on_fail = True
+### Simulate settings ###
# Defines what actions the bots are NOT allowed to do (e.g. 'edit') on wikipedia
# servers. Allows simulation runs of bots to be carried out without changing any
# page on the server side. This setting may be overridden in user_config.py.
actions_to_block = ['edit', 'watch', 'move', 'delete', 'undelete', 'protect',
'emailuser',
- 'submit', # for non-API
- 'wbcreateclaim', 'wbsetclaimvalue', # for Wikidata
- 'wbsetclaim', 'wbeditentity', #
- 'wbsetlabel', 'wbsetdescription', #
- 'wbsetaliases', 'wbsetsitelink', #
- 'wbsetreference', 'wblinktitles', #
- 'wbremoveclaims', 'wbremovereferences'] #
+ 'submit', # for non-API
+ 'wbcreateclaim', 'wbsetclaimvalue', # for Wikidata
+ 'wbsetclaim', 'wbeditentity', #
+ 'wbsetlabel', 'wbsetdescription', #
+ 'wbsetaliases', 'wbsetsitelink', #
+ 'wbsetreference', 'wblinktitles', #
+ 'wbremoveclaims', 'wbremovereferences'] #
+# Use -simulate option to block all actions given above.
# How many pages should be put to a queue in asynchroneous mode.
# If maxsize is <= 0, the queue size is infinite.
@@ -522,6 +529,7 @@
# End of configuration section
# ============================
+
def makepath(path):
"""Return a normalized absolute version of the path argument.
@@ -540,8 +548,10 @@
from os.path import normpath, dirname, exists, abspath
dpath = normpath(dirname(path))
- if not exists(dpath): makedirs(dpath)
+ if not exists(dpath):
+ makedirs(dpath)
return normpath(abspath(path))
+
def datafilepath(*filename):
"""Return an absolute path to a data file in a standard location.
@@ -551,14 +561,15 @@
directories in the path that do not already exist are created.
"""
- import os
+ import os.path
return makepath(os.path.join(base_dir, *filename))
+
def shortpath(path):
"""Return a file path relative to config.base_dir."""
- import os
+ import os.path
if path.startswith(base_dir):
- return path[len(base_dir) + len(os.path.sep) : ]
+ return path[len(base_dir) + len(os.path.sep):]
return path
# is config verbose?
@@ -605,9 +616,11 @@
if __sys.platform == 'win32' or _filemode & 002 == 0:
exec open(_filename, 'r').read()
else:
- print "WARNING: Skipped '%s': writeable by others."%_filename
+ print "WARNING: Skipped '%(fn)s': writeable by others." \
+ % {'fn': _filename}
else:
- print "WARNING: Skipped '%s': owned by someone else."%_filename
+ print "WARNING: Skipped '%(fn)s': owned by someone else." \
+ % {'fn': _filename}
# Test for obsoleted and/or unknown variables.
for _key, _val in globals().items():
@@ -616,19 +629,23 @@
elif _key in _gl:
nt = type(_val)
ot = _tp[_key]
- if nt == ot or _val is None or ot == type(None):
+ ov = _glv[_key]
+
+ if nt == ot or _val is None or ov is None: # nopep8
pass
elif nt is int and (ot is float or ot is bool):
pass
elif ot is int and (nt is float or nt is bool):
pass
else:
- print "WARNING: Type of '%s' changed"%_key
- print " Was: ",ot
- print " Now: ",nt
+ print "WARNING: Type of '%(_key)s' changed" % locals()
+ print " %(was)s: %(old)s" % {'was': "Was", 'old': ot}
+ print " %(now)s: %(new)s" % {'now': "Now", 'new': nt}
del nt, ot
else:
- print "WARNING: Configuration variable %r is defined but unknown. Misspelled?" %_key
+ print("WARNING: "
+ "Configuration variable %(_key)r is defined but unknown.\n"
+ "Misspelled?" % locals())
# Fix up default console_encoding
if console_encoding is None:
@@ -641,8 +658,10 @@
if transliteration_target == 'not set':
if __sys.platform == 'win32':
transliteration_target = console_encoding
- print "WARNING: Running on Windows and transliteration_target is not set."
- print "Please see http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Windows"
+ print("WARNING: Running on Windows and transliteration_target is not "
+ "set.")
+ print("Please see "
+ "http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Windows")
else:
transliteration_target = None
elif transliteration_target in ('None', 'none'):
@@ -673,12 +692,13 @@
elif _arg.startswith("-dir:"):
pass
else:
- print "Unknown arg %s ignored"%_arg
+ print "Unknown arg %(_arg)s ignored" % locals()
_k = globals().keys()
_k.sort()
for _name in _k:
if _name[0] != '_':
- if not type(globals()[_name]) in [types.FunctionType, types.ModuleType]:
+ if not type(globals()[_name]) in [types.FunctionType,
+ types.ModuleType]:
try:
if _all or _glv[_name] != globals()[_name]:
print _name, "=", repr(globals()[_name])
@@ -692,4 +712,3 @@
del __var, __sys
del os, re
-
--
To view, visit https://gerrit.wikimedia.org/r/94847
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibea6f4695bd118c778ec6a6b1193da528af7268f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: [BUG 55275] Prevent category_redirect.py from doing cosmetic changes
......................................................................
[BUG 55275] Prevent category_redirect.py from doing cosmetic changes
category_redirect touches category to clean them. Thus it is a good
idea to keep them off from doing cosmetic changes by placing it to
the cosmetic_changes_deny_script list.
cosmetic_changes_deny_script is a list of scripts for which cosmetic changes are disabled.
See also https://gerrit.wikimedia.org/r/#/c/94495/
Some parts where synchronized with compat.
Change-Id: I52aca8bbd468a347c677a33aea0efb6673df3f80
---
M pywikibot/config2.py
1 file changed, 39 insertions(+), 26 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index e82bc50..c758295 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# (C) Rob W.W. Hooft, 2003
-# (C) Pywikibot team, 2003-2012
+# (C) Pywikibot team, 2003-2013
#
# Distributed under the terms of the MIT license.
#
@@ -31,14 +31,11 @@
family = 'wikipedia'
# The language code of the site we're working on.
mylang = 'language'
-# The default interface for communicating with the site
-# currently the only defined interface is 'APISite', so don't change this!
-site_interface = 'APISite'
-# number of days to cache namespaces, api configuration, etc.
-API_config_expiry = 30
+
# The dictionary usernames should contain a username for each site where you
# have a bot account. Please set your usernames by adding such lines to your
# user-config.py:
+#
# usernames['wikipedia']['de'] = 'myGermanUsername'
# usernames['wiktionary']['en'] = 'myEnglishUsername'
#
@@ -49,11 +46,18 @@
# If you have a sysop account on some wikis, this will be used to delete pages
# or to edit locked pages if you add such lines to your
# user-config.py:
+#
# sysopnames['wikipedia']['de'] = 'myGermanUsername'
# sysopnames['wiktionary']['en'] = 'myEnglishUsername'
usernames = {}
sysopnames = {}
disambiguation_comment = {}
+
+# The default interface for communicating with the site
+# currently the only defined interface is 'APISite', so don't change this!
+site_interface = 'APISite'
+# number of days to cache namespaces, api configuration, etc.
+API_config_expiry = 30
# Solve captchas in the webbrowser. Setting this to False will result in the
# exception CaptchaError being thrown if a captcha is encountered.
@@ -143,7 +147,8 @@
raise RuntimeError("Directory '%(base_dir)s' does not exist."
% locals())
if not os.path.exists(os.path.join(base_dir, "user-config.py")):
- exc_text = "No user-config.py found in directory '%(base_dir)s'.\n" % locals()
+ exc_text = ("No user-config.py found in directory '%(base_dir)s'.\n"
+ % locals())
exc_text += " Please check that user-config.py is stored in the correct location.\n"
exc_text += " Directory where user-config.py is searched is determined as follows:\n\n"
exc_text += " " + _get_base_dir.__doc__
@@ -241,9 +246,11 @@
if __sys.platform == 'win32':
try:
import _winreg
- _key1 = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, 'Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithProgids')
+ _key1 = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
+ 'Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithProgids')
_progID = _winreg.EnumValue(_key1, 1)[0]
- _key2 = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, '%s\shell\open\command' % _progID)
+ _key2 = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,
+ '%s\shell\open\command' % _progID)
_cmd = _winreg.QueryValueEx(_key2, None)[0]
editor = _cmd.replace('%1', '')
# Notepad is even worse than our Tkinter editor.
@@ -429,10 +436,10 @@
############## SEARCH ENGINE SETTINGS ##############
-# Some scripts allow querying Google via the Google Web API. To use this feature,
-# you must install the pyGoogle module from http://pygoogle.sf.net/ and have a
-# Google Web API license key. Note that Google doesn't give out license keys
-# anymore.
+# Some scripts allow querying Google via the Google Web API. To use this
+# feature, you must install the pyGoogle module from http://pygoogle.sf.net/
+# and have a Google Web API license key. Note that Google doesn't give out
+# license keys anymore.
google_key = ''
# Some scripts allow using the Yahoo! Search Web Services. To use this feature,
@@ -545,17 +552,19 @@
# cosmetic_changes_deny_script += ['your_script_name_1', 'your_script_name_2']
# Appending the script name also works:
# cosmetic_changes_deny_script.append('your_script_name')
-cosmetic_changes_deny_script = ['cosmetic_changes', 'touch']
+cosmetic_changes_deny_script = ['category_redirect', 'cosmetic_changes',
+ 'touch']
############## REPLICATION BOT ################
-# You can add replicate_replace to your user_config.py, which has the following format:
+# You can add replicate_replace to your user_config.py, which has the following
+# format:
#
# replicate_replace = {
# 'wikipedia:li': {'Hoofdpagina': 'Veurblaad'}
# }
#
-# to replace all occurences of 'Hoofdpagina' with 'Veurblaad' when writing to liwiki. Note that this does
-# not take the origin wiki into account.
+# to replace all occurences of 'Hoofdpagina' with 'Veurblaad' when writing to
+# liwiki. Note that this does not take the origin wiki into account.
replicate_replace = {}
############## FURTHER SETTINGS ##############
@@ -594,7 +603,8 @@
# LS is a shortcut alias.
line_separator = LS = u'\n'
-# Settings to enable mwparserfromhell <http://mwparserfromhell.readthedocs.org/en/latest/>
+# Settings to enable mwparserfromhell
+# <http://mwparserfromhell.readthedocs.org/en/latest/>
# Currently used in textlib.extract_templates_and_params
# This should be more accurate than our current regex, but is currently opt-in.
use_mwparserfromhell = False
@@ -664,10 +674,10 @@
if __sys.platform == 'win32' or _filemode & 002 == 0 or True:
execfile(_filename)
else:
- print "WARNING: Skipped '%(fn)s': writeable by others."\
+ print "WARNING: Skipped '%(fn)s': writeable by others." \
% {'fn': _filename}
else:
- print "WARNING: Skipped '%(fn)s': owned by someone else."\
+ print "WARNING: Skipped '%(fn)s': owned by someone else." \
% {'fn': _filename}
# Test for obsoleted and/or unknown variables.
@@ -691,9 +701,9 @@
print " %(now)s: %(new)s" % {'now': "Now", 'new': nt}
del nt, ot
else:
- print \
- "Configuration variable %(_key)r is defined but unknown."\
- " Misspelled?" % locals()
+ print("WARNING: "
+ "Configuration variable %(_key)r is defined but unknown.\n"
+ "Misspelled?" % locals())
# Fix up default console_encoding
if console_encoding is None:
@@ -706,8 +716,10 @@
if transliteration_target == 'not set':
if __sys.platform == 'win32':
transliteration_target = console_encoding
- print "WARNING: Running on Windows and transliteration_target is not set."
- print "Please see http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Windows"
+ print("WARNING: Running on Windows and transliteration_target is not "
+ "set.")
+ print("Please see "
+ "http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Windows")
else:
transliteration_target = None
elif transliteration_target in ('None', 'none'):
@@ -732,7 +744,8 @@
_k.sort()
for _name in _k:
if _name[0] != '_':
- if not type(globals()[_name]) in [types.FunctionType, types.ModuleType]:
+ if not type(globals()[_name]) in [types.FunctionType,
+ types.ModuleType]:
if _all or _glv[_name] != globals()[_name]:
print _name, "=", repr(globals()[_name])
--
To view, visit https://gerrit.wikimedia.org/r/94845
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I52aca8bbd468a347c677a33aea0efb6673df3f80
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: [BUG 55275] Prevent category_redirect.py from doing cosmetic changes
......................................................................
[BUG 55275] Prevent category_redirect.py from doing cosmetic changes
category_redirect touches category to clean them. Thus it is a good
idea to keep them off from doing cosmetic changes by placing it to
the exception tuple inside wikipedia.py.
See also https://gerrit.wikimedia.org/r/#/c/94495/
Change-Id: Ib7a52e7876e8bbbbbcad30250db57ffd644aaeec
---
M wikipedia.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/wikipedia.py b/wikipedia.py
index c9bc07e..a9d3a58 100644
--- a/wikipedia.py
+++ b/wikipedia.py
@@ -2189,7 +2189,8 @@
# If no comment is given for the change, use the default
comment = comment or action
if config.cosmetic_changes and not self.isTalkPage() and \
- not calledModuleName() in ('cosmetic_changes', 'touch'):
+ not calledModuleName() in ('category_redirect', 'cosmetic_changes',
+ 'touch'):
if config.cosmetic_changes_mylang_only:
cc = (self.site.family.name == config.family and
self.site.lang == config.mylang) or \
--
To view, visit https://gerrit.wikimedia.org/r/94846
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib7a52e7876e8bbbbbcad30250db57ffd644aaeec
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: jenkins-bot