jenkins-bot has submitted this change and it was merged.
Change subject: Trim some long lines
......................................................................
Trim some long lines
Change-Id: I56dd8632539a96bbc8728939eef69f2d0999eaf6
---
M pywikibot/__init__.py
1 file changed, 14 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 6bcf4ac..bbdab74 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -214,8 +214,14 @@
PRECISION = {'1000000000': 0, '100000000': 1, '10000000': 2, '1000000': 3, '100000': 4, '10000': 5, 'millenia': 6, 'century': 7, 'decade': 8, 'year': 9, 'month': 10, 'day': 11, 'hour': 12, 'minute': 13, 'second': 14}
FORMATSTR = '{0:+012d}-{1:02d}-{2:02d}T{3:02d}:{4:02d}:{5:02d}Z'
- def __init__(self, year=None, month=None, day=None, hour=None, minute=None, second=None, precision=None, before=0, after=0, timezone=0, calendarmodel='http://www.wikidata.org/entity/Q1985727'):
- """ Creates a new WbTime object. The precision can be set by the Wikibase int value (0-14) or by a human readable string, e.g., 'hour'. If no precision is given, it is set according to the given time units."""
+ def __init__(self, year=None, month=None, day=None, hour=None, minute=None, second=None, precision=None, before=0,
+ after=0, timezone=0, calendarmodel='http://www.wikidata.org/entity/Q1985727'):
+ """
+ Creates a new WbTime object. The precision can be set
+ by the Wikibase int value (0-14) or by a human readable
+ string, e.g., 'hour'. If no precision is given, it is set
+ according to the given time units.
+ """
if year is None:
raise ValueError('no year given')
self.precision = WbTime.PRECISION['second']
@@ -255,12 +261,14 @@
raise ValueError('Invalid precision: "%s"' % precision)
@staticmethod
- def fromTimestr(datetimestr, precision=14, before=0, after=0, timezone=0, calendarmodel='http://www.wikidata.org/entity/Q1985727'):
+ def fromTimestr(datetimestr, precision=14, before=0, after=0, timezone=0,
+ calendarmodel='http://www.wikidata.org/entity/Q1985727'):
match = re.match('([-+]?\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)Z', datetimestr)
if not match:
raise ValueError(u"Invalid format: '%s'" % datetimestr)
t = match.groups()
- return WbTime(long(t[0]), int(t[1]), int(t[2]), int(t[3]), int(t[4]), int(t[5]), precision, before, after, timezone, calendarmodel)
+ return WbTime(long(t[0]), int(t[1]), int(t[2]), int(t[3]), int(t[4]), int(t[5]),
+ precision, before, after, timezone, calendarmodel)
def toWikibase(self):
"""
@@ -279,7 +287,8 @@
@staticmethod
def fromWikibase(ts):
- return WbTime.fromTimestr(ts[u'time'], ts[u'precision'], ts[u'before'], ts[u'after'], ts[u'timezone'], ts[u'calendarmodel'])
+ return WbTime.fromTimestr(ts[u'time'], ts[u'precision'], ts[u'before'], ts[u'after'], ts[u'timezone'],
+ ts[u'calendarmodel'])
def __str__(self):
return str(self.toWikibase())
--
To view, visit https://gerrit.wikimedia.org/r/99572
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I56dd8632539a96bbc8728939eef69f2d0999eaf6
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(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.
Change subject: [BUGFIX] return from listchoice() without response (+pep8)
......................................................................
[BUGFIX] return from listchoice() without response (+pep8)
"response" is not a valid variable. Because we always
leave the infinite loop explicit on previous parts,
we do not need any return on the end of the function.
Change-Id: I8d50ccd40ccceb030e6b874bc84289273f567683
---
M generate_user_files.py
1 file changed, 22 insertions(+), 12 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/generate_user_files.py b/generate_user_files.py
index f1363fd..dfa2a0a 100644
--- a/generate_user_files.py
+++ b/generate_user_files.py
@@ -100,7 +100,6 @@
except:
if not isinstance(choice, basestring):
print("Invalid response")
- return response
def change_base_dir():
@@ -162,23 +161,27 @@
)
known_families = sorted(known_families)
fam = listchoice(known_families,
- "Select family of sites we are working on, " \
+ "Select family of sites we are working on, "
"just enter the number not name",
default='wikipedia')
if fam not in single_wiki_families:
- codesds = codecs.open("pywikibot/families/%s_family.py" % fam, "r", "utf-8").read()
- rre = re.compile("self\.languages\_by\_size *\= *(.+?)\]", re.DOTALL)
+ codesds = codecs.open("pywikibot/families/%s_family.py" % fam,
+ "r", "utf-8").read()
+ rre = re.compile("self\.languages\_by\_size *\= *(.+?)\]",
+ re.DOTALL)
known_langs = []
if not rre.findall(codesds):
rre = re.compile("self\.langs *\= *(.+?)\}", re.DOTALL)
if rre.findall(codesds):
import ast
- known_langs = ast.literal_eval(rre.findall(codesds)[0] + u"}").keys()
+ known_langs = ast.literal_eval(
+ rre.findall(codesds)[0] + u"}").keys()
else:
known_langs = eval(rre.findall(codesds)[0] + u"]")
print "This is the list of known language(s):"
print " ".join(sorted(known_langs))
- mylang = raw_input("The language code of the site we're working on (default: 'en'): ") or 'en'
+ mylang = raw_input("The language code of the site we're working on "
+ "(default: 'en'): ") or 'en'
else:
mylang = fam
@@ -195,7 +198,9 @@
mainusername = mainusername or "UnnamedBot"
while True:
- choice = raw_input("Which variant of user_config.py:\n[S]mall or [E]xtended (with further information)? ").upper()
+ choice = raw_input(
+ "Which variant of user_config.py:\n"
+ "[S]mall or [E]xtended (with further information)? ").upper()
if choice in "SE":
break
@@ -250,12 +255,14 @@
mylang = '%s'
usernames['%s']['%s'] = u'%s'
""" % (fam, mylang, fam, mylang, mainusername))
- while(raw_input("Do you want to add any other projects? (y/N)").upper() == "Y"):
+ while(raw_input(
+ "Do you want to add any other projects? (y/N)").upper() == "Y"):
fam, mylang, username = get_site_and_lang()
username = username or mainusername
# Escape ''s
username = username.replace("'", "\\'")
- f.write("usernames['%(fam)s']['%(mylang)s'] = u'%(username)s'\n" % locals())
+ f.write("usernames['%(fam)s']['%(mylang)s'] = u'%(username)s'\n"
+ % locals())
f.close()
print("'%s' written." % _fnc)
@@ -297,7 +304,8 @@
while True:
if os.path.exists(os.path.join(base_dir, "user-config.py")):
break
- do_copy = raw_input("Do you want to copy user files from an existing pywikipedia installation? ").upper().strip()
+ do_copy = raw_input("Do you want to copy user files from an existing "
+ "pywikipedia installation? ").upper().strip()
if do_copy and "YES".startswith(do_copy):
oldpath = raw_input("Path to existing wikipedia.py? ")
if not os.path.exists(oldpath):
@@ -325,13 +333,15 @@
elif do_copy and "NO".startswith(do_copy):
break
if not os.path.isfile(os.path.join(base_dir, "user-config.py")):
- a = raw_input("Create user-config.py file? Required for running bots ([y]es, [N]o) ")
+ a = raw_input("Create user-config.py file? Required for running bots "
+ "([y]es, [N]o) ")
if a[:1] in ["Y", "y"]:
create_user_config()
else:
print("NOTE: user-config.py already exists in the directory")
if not os.path.isfile(os.path.join(base_dir, "user-fixes.py")):
- a = raw_input("Create user-fixes.py file? Optional and for advanced users ([y]es, [N]o) ")
+ a = raw_input("Create user-fixes.py file? Optional and for advanced "
+ "users ([y]es, [N]o) ")
if a[:1] in ["Y", "y"]:
create_user_fixes()
else:
--
To view, visit https://gerrit.wikimedia.org/r/99085
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8d50ccd40ccceb030e6b874bc84289273f567683
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: Add Japanese date format to archivebot.py
......................................................................
Add Japanese date format to archivebot.py
This patch implements the standard Japanese date/time
format used in MediaWiki.
Change-Id: I075e77974b87b519edeec9086db731e3edbc07e8
---
M archivebot.py
1 file changed, 6 insertions(+), 0 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/archivebot.py b/archivebot.py
index 2b1a5f7..b3c33b4 100644
--- a/archivebot.py
+++ b/archivebot.py
@@ -266,6 +266,10 @@
if not TM:
TM = re.search(r'(\d\d?) (\S+) (\d\d\d\d) (\d\d):(\d\d) \(.*?\)',
line)
+# Japanese: 2012年8月4日 (日) 13:01 (UTC)
+ if not TM:
+ TM = re.search(re.compile(u'(\d\d\d\d)年(\d\d?)月(\d\d?)日 \(.*?\) (\d\d):(\d\d) \(.*?\)'),
+ line)
if TM:
# Strip away all diacritics in the Mn ('Mark, non-spacing') category
# NFD decomposition splits combined characters (e.g. 'ä",
@@ -301,6 +305,8 @@
if not TIME:
TIME = txt2timestamp(_TM, "%d %B %Y %H:%M (%Z)")
if not TIME:
+ TIME = txt2timestamp(_TM, "%Yå¹´%B%dæ—¥ (%a) %H:%M (%Z)")
+ if not TIME:
TIME = txt2timestamp(re.sub(' *\([^ ]+\) *', '', _TM),
"%H:%M, %d. %b. %Y")
if TIME:
--
To view, visit https://gerrit.wikimedia.org/r/99129
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I075e77974b87b519edeec9086db731e3edbc07e8
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Whym <whym(a)whym.org>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-Reviewer: saper <saper(a)saper.info>