jenkins-bot merged this change.

View Change

Approvals: D3r1ck01: Looks good to me, but someone else must approve Dalba: Looks good to me, approved jenkins-bot: Verified
[bugfix] combine two dictionaries

Use itertools.chain to combine mapLat and mapLcl dicts.
First combine these dicts to ignore duplicates in mapLcl.

Note: itertools.chain is necessary for Python 2 compatibility.

Bug: T234146
Change-Id: I2e3ac75d036e2c86a3472f21b50a5db1e14e28d3
---
M scripts/casechecker.py
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/scripts/casechecker.py b/scripts/casechecker.py
index 3ee06ff..c666f10 100755
--- a/scripts/casechecker.py
+++ b/scripts/casechecker.py
@@ -9,7 +9,7 @@
from __future__ import absolute_import, division, unicode_literals

import codecs
-import itertools
+from itertools import chain, combinations
import os
import re
from string import ascii_letters
@@ -547,7 +547,7 @@
else:

# Replace all unambiguous bad words
- for k, v in mapLat.items() + mapLcl.items():
+ for k, v in dict(chain(mapLat.items(), mapLcl.items())).items():
if k not in ambigBadWords:
title = title.replace(k, v)
if len(ambigBadWords) == 0:
@@ -561,8 +561,7 @@
# latin character.
for itemCntToPick in range(len(ambigBadWords) + 1):
title2 = title
- for uc in itertools.combinations(list(ambigBadWords),
- itemCntToPick):
+ for uc in combinations(list(ambigBadWords), itemCntToPick):
wordsToLat = ambigBadWords.copy()
for bw in uc:
title2 = title2.replace(bw, mapLcl[bw])

To view, visit change 540845. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2e3ac75d036e2c86a3472f21b50a5db1e14e28d3
Gerrit-Change-Number: 540845
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki@tools.wmflabs.org>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot (75)