jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/432773 )
Change subject: [IMPR] Simplify creating dictionaries ......................................................................
[IMPR] Simplify creating dictionaries
Change-Id: If3f88247b2b62ca70a5d5ac02025d0c0c74c71a4 --- M scripts/casechecker.py 1 file changed, 6 insertions(+), 8 deletions(-)
Approvals: Zhuyifei1999: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/casechecker.py b/scripts/casechecker.py index 92aa7a6..bf2b817 100755 --- a/scripts/casechecker.py +++ b/scripts/casechecker.py @@ -171,20 +171,18 @@ self.titleList = [self.Page(t) for t in f] self.failedTitles += '.failed'
+ ziplist = zip(self.localSuspects, self.latinSuspects) self.lclToLatDict = { - ord(self.localSuspects[i]): self.latinSuspects[i] - for i in xrange(len(self.localSuspects))} + ord(local): latin for local, latin in ziplist} self.latToLclDict = { - ord(self.latinSuspects[i]): self.localSuspects[i] - for i in xrange(len(self.localSuspects))} + ord(latin): local for local, latin in ziplist}
if self.localKeyboard is not None: + ziplist = zip(self.localKeyboard, self.latinKeyboard) self.lclToLatKeybDict = { - ord(self.localKeyboard[i]): self.latinKeyboard[i] - for i in xrange(len(self.localKeyboard))} + ord(local): latin for local, latin in ziplist} self.latToLclKeybDict = { - ord(self.latinKeyboard[i]): self.localKeyboard[i] - for i in xrange(len(self.localKeyboard))} + ord(latin): local for local, latin in ziplist} else: self.lclToLatKeybDict = {} self.latToLclKeybDict = {}
pywikibot-commits@lists.wikimedia.org