jenkins-bot submitted this change.

View Change

Approvals: JJMC89: Looks good to me, approved jenkins-bot: Verified
[4.0] remove Python 2 related code

Change-Id: Ib763dfcebd487c0a885a1d394f8b8239662c4503
---
M pywikibot/userinterfaces/transliteration.py
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/pywikibot/userinterfaces/transliteration.py b/pywikibot/userinterfaces/transliteration.py
index 739e2c4..7a8b445 100644
--- a/pywikibot/userinterfaces/transliteration.py
+++ b/pywikibot/userinterfaces/transliteration.py
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
"""Module to transliterate text."""
#
-# (C) Pywikibot team, 2006-2019
+# (C) Pywikibot team, 2006-2020
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
_trans = {
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ầ': 'A', 'Ấ': 'A', 'Ẫ': 'A', 'Ẩ': 'A',
'Ậ': 'A', 'Ã': 'A', 'Ā': 'A', 'Ă': 'A', 'Ằ': 'A', 'Ắ': 'A', 'Ẵ': 'A',
@@ -1089,17 +1087,16 @@
}


-class transliterator(object):
+class transliterator:

"""Class to transliterating text."""

- def __init__(self, encoding):
+ def __init__(self, encoding: str):
"""
Initialize the transliteration mapping.

@param encoding: the encoding available. Any transliterated character
which can't be mapped, will be removed from the mapping.
- @type encoding: str
"""
trans = _trans.copy()
for char, value in trans.items():
@@ -1113,12 +1110,11 @@
trans[char] = value
self.trans = trans

- def transliterate(self, char, default='?', prev='-', next='-'):
+ def transliterate(self, char: str, default='?', prev='-', next='-') -> str:
"""
Transliterate the character.

@param char: The character to transliterate.
- @type char: str
@param default: The character used when there is no transliteration.
@type default: str
@param prev: The previous character
@@ -1126,7 +1122,6 @@
@param next: The next character
@type next: str
@return: The transliterated character which may be an empty string
- @rtype: str
"""
if char in self.trans:
return self.trans[char]

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ib763dfcebd487c0a885a1d394f8b8239662c4503
Gerrit-Change-Number: 614585
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged