1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 14:48:49 +00:00

Fix: changed unicode characters to unicode string for python2 compatibility.

This commit is contained in:
ik1ne 2019-10-16 21:33:38 +09:00
parent 485b29d4f7
commit 25a74b0805

View File

@ -32,17 +32,17 @@ source_to_target = {
}
'''Lists used for decomposing korean letters.'''
HEAD_LIST = ['', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '']
BODY_LIST = ['', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '']
TAIL_LIST = [' ', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '']
DOUBLE_LIST = ['', '', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '']
DOUBLE_MOD_LIST = ['ㅗㅏ', 'ㅗㅐ', 'ㅗㅣ', 'ㅜㅓ', 'ㅜㅔ', 'ㅜㅣ', 'ㅡㅣ', 'ㄱㅅ',
'ㄴㅈ', 'ㄴㅎ', 'ㄹㄱ', 'ㄹㅁ', 'ㄹㅂ', 'ㄹㅅ', 'ㄹㅌ', 'ㄹㅎ', 'ㅂㅅ']
HEAD_LIST = [u'', u'', u'', u'', u'', u'', u'', u'', u'', u'', u'',
u'', u'', u'', u'', u'', u'', u'', u'']
BODY_LIST = [u'', u'', u'', u'', u'', u'', u'', u'', u'', u'', u'',
u'', u'', u'', u'', u'', u'', u'', u'', u'', u'']
TAIL_LIST = [u' ', u'', u'', u'', u'', u'', u'', u'', u'', u'', u'',
u'', u'', u'', u'', u'', u'', u'', u'', u'', u'', u'', u'',
u'', u'', u'', u'', u'']
DOUBLE_LIST = [u'', u'', u'', u'', u'', u'', u'', u'', u'', u'', u'',
u'', u'', u'', u'', u'', u'']
DOUBLE_MOD_LIST = [u'ㅗㅏ', u'ㅗㅐ', u'ㅗㅣ', u'ㅜㅓ', u'ㅜㅔ', u'ㅜㅣ', u'ㅡㅣ', u'ㄱㅅ',
u'ㄴㅈ', u'ㄴㅎ', u'ㄹㄱ', u'ㄹㅁ', u'ㄹㅂ', u'ㄹㅅ', u'ㄹㅌ', u'ㄹㅎ', u'ㅂㅅ']
@memoize
@ -84,10 +84,10 @@ def _decompose_korean(command):
else:
return ch
hg_str = ''
hg_str = u''
for ch in command.script:
if '' <= ch <= '':
ord_ch = ord(ch) - ord('')
if u'' <= ch <= u'':
ord_ch = ord(ch) - ord(u'')
hd = ord_ch // 588
bd = (ord_ch - 588 * hd) // 28
tl = ord_ch - 588 * hd - 28 * bd
@ -102,7 +102,7 @@ def _decompose_korean(command):
def match(command):
if 'not found' not in command.output:
return False
if any(['' <= ch <= '' or '' <= ch <= '' or '' <= ch <= ''
if any([u'' <= ch <= u'' or u'' <= ch <= u'' or u'' <= ch <= u''
for ch in command.script]):
return True
@ -112,7 +112,7 @@ def match(command):
def get_new_command(command):
if any(['' <= ch <= '' or '' <= ch <= '' or '' <= ch <= ''
if any([u'' <= ch <= u'' or u'' <= ch <= u'' or u'' <= ch <= u''
for ch in command.script]):
command.script = _decompose_korean(command)
matched_layout = _get_matched_layout(command)