Browse Source

Update unidecode module 1.0.22 (578cdb9) → 1.0.22 (a5045ab).

pull/1200/head
JackDandy 6 years ago
parent
commit
75c63d58ae
  1. 1
      CHANGES.md
  2. 3
      lib/unidecode/__main__.py
  3. 28
      lib/unidecode/util.py
  4. 162
      lib/unidecode/x1f1.py

1
CHANGES.md

@ -14,6 +14,7 @@
* Update scandir 1.9.0 (9ab3d1f) to 1.10.0 (982e6ba) * Update scandir 1.9.0 (9ab3d1f) to 1.10.0 (982e6ba)
* Update Six compatibility library 1.12.0 (d927b9e) to 1.12.0 (8da94b8) * Update Six compatibility library 1.12.0 (d927b9e) to 1.12.0 (8da94b8)
* Update Tornado Web Server 5.1.1 (cc2cf07) to 5.1.1 (a99f1471) * Update Tornado Web Server 5.1.1 (cc2cf07) to 5.1.1 (a99f1471)
* Update unidecode module 1.0.22 (578cdb9) to 1.0.22 (a5045ab)
[develop changelog] [develop changelog]

3
lib/unidecode/__main__.py

@ -0,0 +1,3 @@
from unidecode.util import main
main()

28
lib/unidecode/util.py

@ -1,10 +1,9 @@
# vim:ts=4 sw=4 expandtab softtabstop=4 # vim:ts=4 sw=4 expandtab softtabstop=4
from __future__ import print_function from __future__ import print_function
import optparse import argparse
import locale import locale
import os import os
import sys import sys
import warnings
from unidecode import unidecode from unidecode import unidecode
@ -17,33 +16,34 @@ def fatal(msg):
def main(): def main():
default_encoding = locale.getpreferredencoding() default_encoding = locale.getpreferredencoding()
parser = optparse.OptionParser('%prog [options] [FILE]', parser = argparse.ArgumentParser(
description="Transliterate Unicode text into ASCII. FILE is path to file to transliterate. " description="Transliterate Unicode text into ASCII. FILE is path to file to transliterate. "
"Standard input is used if FILE is omitted and -c is not specified.") "Standard input is used if FILE is omitted and -c is not specified.")
parser.add_option('-e', '--encoding', metavar='ENCODING', default=default_encoding, parser.add_argument('-e', '--encoding', metavar='ENCODING', default=default_encoding,
help='Specify an encoding (default is %s)' % (default_encoding,)) help='Specify an encoding (default is %s)' % (default_encoding,))
parser.add_option('-c', metavar='TEXT', dest='text', parser.add_argument('-c', metavar='TEXT', dest='text',
help='Transliterate TEXT instead of FILE') help='Transliterate TEXT instead of FILE')
parser.add_argument('path', nargs='?', metavar='FILE')
options, args = parser.parse_args() args = parser.parse_args()
encoding = options.encoding encoding = args.encoding
if args: if args.path:
if options.text: if args.text:
fatal("Can't use both FILE and -c option") fatal("Can't use both FILE and -c option")
else: else:
with open(args[0], 'rb') as f: with open(args.path, 'rb') as f:
stream = f.read() stream = f.read()
elif options.text: elif args.text:
if PY3: if PY3:
stream = os.fsencode(options.text) stream = os.fsencode(args.text)
else: else:
stream = options.text stream = args.text
# add a newline to the string if it comes from the # add a newline to the string if it comes from the
# command line so that the result is printed nicely # command line so that the result is printed nicely
# on the console. # on the console.
stream += '\n'.encode('ascii') stream += b'\n'
else: else:
if PY3: if PY3:
stream = sys.stdin.buffer.read() stream = sys.stdin.buffer.read()

162
lib/unidecode/x1f1.py

@ -41,102 +41,102 @@ data = (
'(X)', # 0x27 '(X)', # 0x27
'(Y)', # 0x28 '(Y)', # 0x28
'(Z)', # 0x29 '(Z)', # 0x29
'', # 0x2a '<S>', # 0x2a
'', # 0x2b '(C)', # 0x2b
'', # 0x2c '(R)', # 0x2c
'', # 0x2d '', # 0x2d
'', # 0x2e '', # 0x2e
'', # 0x2f '', # 0x2f
'', # 0x30 '[A]', # 0x30
'', # 0x31 '[B]', # 0x31
'', # 0x32 '[C]', # 0x32
'', # 0x33 '[D]', # 0x33
'', # 0x34 '[E]', # 0x34
'', # 0x35 '[F]', # 0x35
'', # 0x36 '[G]', # 0x36
'', # 0x37 '[H]', # 0x37
'', # 0x38 '[I]', # 0x38
'', # 0x39 '[J]', # 0x39
'', # 0x3a '[K]', # 0x3a
'', # 0x3b '[L]', # 0x3b
'', # 0x3c '[M]', # 0x3c
'', # 0x3d '[N]', # 0x3d
'', # 0x3e '[O]', # 0x3e
'', # 0x3f '[P]', # 0x3f
'', # 0x40 '[Q]', # 0x40
'', # 0x41 '[R]', # 0x41
'', # 0x42 '[S]', # 0x42
'', # 0x43 '[T]', # 0x43
'', # 0x44 '[U]', # 0x44
'', # 0x45 '[V]', # 0x45
'', # 0x46 '[W]', # 0x46
'', # 0x47 '[X]', # 0x47
'', # 0x48 '[Y]', # 0x48
'', # 0x49 '[Z]', # 0x49
'', # 0x4a '', # 0x4a
'', # 0x4b '', # 0x4b
'', # 0x4c '', # 0x4c
'', # 0x4d '', # 0x4d
'', # 0x4e '', # 0x4e
'', # 0x4f '', # 0x4f
'', # 0x50 '(A)', # 0x50
'', # 0x51 '(B)', # 0x51
'', # 0x52 '(C)', # 0x52
'', # 0x53 '(D)', # 0x53
'', # 0x54 '(E)', # 0x54
'', # 0x55 '(F)', # 0x55
'', # 0x56 '(G)', # 0x56
'', # 0x57 '(H)', # 0x57
'', # 0x58 '(I)', # 0x58
'', # 0x59 '(J)', # 0x59
'', # 0x5a '(K)', # 0x5a
'', # 0x5b '(L)', # 0x5b
'', # 0x5c '(M)', # 0x5c
'', # 0x5d '(N)', # 0x5d
'', # 0x5e '(O)', # 0x5e
'', # 0x5f '(P)', # 0x5f
'', # 0x60 '(Q)', # 0x60
'', # 0x61 '(R)', # 0x61
'', # 0x62 '(S)', # 0x62
'', # 0x63 '(T)', # 0x63
'', # 0x64 '(U)', # 0x64
'', # 0x65 '(V)', # 0x65
'', # 0x66 '(W)', # 0x66
'', # 0x67 '(X)', # 0x67
'', # 0x68 '(Y)', # 0x68
'', # 0x69 '(Z)', # 0x69
'', # 0x6a '', # 0x6a
'', # 0x6b '', # 0x6b
'', # 0x6c '', # 0x6c
'', # 0x6d '', # 0x6d
'', # 0x6e '', # 0x6e
'', # 0x6f '', # 0x6f
'', # 0x70 '[A]', # 0x70
'', # 0x71 '[B]', # 0x71
'', # 0x72 '[C]', # 0x72
'', # 0x73 '[D]', # 0x73
'', # 0x74 '[E]', # 0x74
'', # 0x75 '[F]', # 0x75
'', # 0x76 '[G]', # 0x76
'', # 0x77 '[H]', # 0x77
'', # 0x78 '[I]', # 0x78
'', # 0x79 '[J]', # 0x79
'', # 0x7a '[K]', # 0x7a
'', # 0x7b '[L]', # 0x7b
'', # 0x7c '[M]', # 0x7c
'', # 0x7d '[N]', # 0x7d
'', # 0x7e '[O]', # 0x7e
'', # 0x7f '[P]', # 0x7f
'', # 0x80 '[Q]', # 0x80
'', # 0x81 '[R]', # 0x81
'', # 0x82 '[S]', # 0x82
'', # 0x83 '[T]', # 0x83
'', # 0x84 '[U]', # 0x84
'', # 0x85 '[V]', # 0x85
'', # 0x86 '[W]', # 0x86
'', # 0x87 '[X]', # 0x87
'', # 0x88 '[Y]', # 0x88
'', # 0x89 '[Z]', # 0x89
'', # 0x8a '', # 0x8a
'', # 0x8b '', # 0x8b
'', # 0x8c '', # 0x8c

Loading…
Cancel
Save