diff --git a/CHANGES.md b/CHANGES.md index 14efee2..fc932b8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ * 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 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] diff --git a/lib/unidecode/__main__.py b/lib/unidecode/__main__.py new file mode 100644 index 0000000..390f842 --- /dev/null +++ b/lib/unidecode/__main__.py @@ -0,0 +1,3 @@ +from unidecode.util import main + +main() diff --git a/lib/unidecode/util.py b/lib/unidecode/util.py index 477280d..2e14f1a 100644 --- a/lib/unidecode/util.py +++ b/lib/unidecode/util.py @@ -1,10 +1,9 @@ # vim:ts=4 sw=4 expandtab softtabstop=4 from __future__ import print_function -import optparse +import argparse import locale import os import sys -import warnings from unidecode import unidecode @@ -17,33 +16,34 @@ def fatal(msg): def main(): 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. " "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,)) - parser.add_option('-c', metavar='TEXT', dest='text', + parser.add_argument('-c', metavar='TEXT', dest='text', 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 options.text: + if args.path: + if args.text: fatal("Can't use both FILE and -c option") else: - with open(args[0], 'rb') as f: + with open(args.path, 'rb') as f: stream = f.read() - elif options.text: + elif args.text: if PY3: - stream = os.fsencode(options.text) + stream = os.fsencode(args.text) else: - stream = options.text + stream = args.text # add a newline to the string if it comes from the # command line so that the result is printed nicely # on the console. - stream += '\n'.encode('ascii') + stream += b'\n' else: if PY3: stream = sys.stdin.buffer.read() diff --git a/lib/unidecode/x1f1.py b/lib/unidecode/x1f1.py index ba0481f..4bc82b5 100644 --- a/lib/unidecode/x1f1.py +++ b/lib/unidecode/x1f1.py @@ -41,102 +41,102 @@ data = ( '(X)', # 0x27 '(Y)', # 0x28 '(Z)', # 0x29 -'', # 0x2a -'', # 0x2b -'', # 0x2c +'', # 0x2a +'(C)', # 0x2b +'(R)', # 0x2c '', # 0x2d '', # 0x2e '', # 0x2f -'', # 0x30 -'', # 0x31 -'', # 0x32 -'', # 0x33 -'', # 0x34 -'', # 0x35 -'', # 0x36 -'', # 0x37 -'', # 0x38 -'', # 0x39 -'', # 0x3a -'', # 0x3b -'', # 0x3c -'', # 0x3d -'', # 0x3e -'', # 0x3f -'', # 0x40 -'', # 0x41 -'', # 0x42 -'', # 0x43 -'', # 0x44 -'', # 0x45 -'', # 0x46 -'', # 0x47 -'', # 0x48 -'', # 0x49 +'[A]', # 0x30 +'[B]', # 0x31 +'[C]', # 0x32 +'[D]', # 0x33 +'[E]', # 0x34 +'[F]', # 0x35 +'[G]', # 0x36 +'[H]', # 0x37 +'[I]', # 0x38 +'[J]', # 0x39 +'[K]', # 0x3a +'[L]', # 0x3b +'[M]', # 0x3c +'[N]', # 0x3d +'[O]', # 0x3e +'[P]', # 0x3f +'[Q]', # 0x40 +'[R]', # 0x41 +'[S]', # 0x42 +'[T]', # 0x43 +'[U]', # 0x44 +'[V]', # 0x45 +'[W]', # 0x46 +'[X]', # 0x47 +'[Y]', # 0x48 +'[Z]', # 0x49 '', # 0x4a '', # 0x4b '', # 0x4c '', # 0x4d '', # 0x4e '', # 0x4f -'', # 0x50 -'', # 0x51 -'', # 0x52 -'', # 0x53 -'', # 0x54 -'', # 0x55 -'', # 0x56 -'', # 0x57 -'', # 0x58 -'', # 0x59 -'', # 0x5a -'', # 0x5b -'', # 0x5c -'', # 0x5d -'', # 0x5e -'', # 0x5f -'', # 0x60 -'', # 0x61 -'', # 0x62 -'', # 0x63 -'', # 0x64 -'', # 0x65 -'', # 0x66 -'', # 0x67 -'', # 0x68 -'', # 0x69 +'(A)', # 0x50 +'(B)', # 0x51 +'(C)', # 0x52 +'(D)', # 0x53 +'(E)', # 0x54 +'(F)', # 0x55 +'(G)', # 0x56 +'(H)', # 0x57 +'(I)', # 0x58 +'(J)', # 0x59 +'(K)', # 0x5a +'(L)', # 0x5b +'(M)', # 0x5c +'(N)', # 0x5d +'(O)', # 0x5e +'(P)', # 0x5f +'(Q)', # 0x60 +'(R)', # 0x61 +'(S)', # 0x62 +'(T)', # 0x63 +'(U)', # 0x64 +'(V)', # 0x65 +'(W)', # 0x66 +'(X)', # 0x67 +'(Y)', # 0x68 +'(Z)', # 0x69 '', # 0x6a '', # 0x6b '', # 0x6c '', # 0x6d '', # 0x6e '', # 0x6f -'', # 0x70 -'', # 0x71 -'', # 0x72 -'', # 0x73 -'', # 0x74 -'', # 0x75 -'', # 0x76 -'', # 0x77 -'', # 0x78 -'', # 0x79 -'', # 0x7a -'', # 0x7b -'', # 0x7c -'', # 0x7d -'', # 0x7e -'', # 0x7f -'', # 0x80 -'', # 0x81 -'', # 0x82 -'', # 0x83 -'', # 0x84 -'', # 0x85 -'', # 0x86 -'', # 0x87 -'', # 0x88 -'', # 0x89 +'[A]', # 0x70 +'[B]', # 0x71 +'[C]', # 0x72 +'[D]', # 0x73 +'[E]', # 0x74 +'[F]', # 0x75 +'[G]', # 0x76 +'[H]', # 0x77 +'[I]', # 0x78 +'[J]', # 0x79 +'[K]', # 0x7a +'[L]', # 0x7b +'[M]', # 0x7c +'[N]', # 0x7d +'[O]', # 0x7e +'[P]', # 0x7f +'[Q]', # 0x80 +'[R]', # 0x81 +'[S]', # 0x82 +'[T]', # 0x83 +'[U]', # 0x84 +'[V]', # 0x85 +'[W]', # 0x86 +'[X]', # 0x87 +'[Y]', # 0x88 +'[Z]', # 0x89 '', # 0x8a '', # 0x8b '', # 0x8c