]> git.proxmox.com Git - mirror_edk2.git/commitdiff
AppPkg/Applications/Python/Python-2.7.10: Initial Checkin part 4/5.
authorDaryl McDaniel <edk2-lists@mc2research.org>
Sat, 7 Nov 2015 19:33:58 +0000 (19:33 +0000)
committerdarylm503 <darylm503@Edk2>
Sat, 7 Nov 2015 19:33:58 +0000 (19:33 +0000)
The Lib directory from the cPython 2.7.10 distribution.
These files are unchanged and set the baseline for subsequent commits.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Daryl McDaniel <edk2-lists@mc2research.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18740 6f19259b-4bc3-4df7-8a09-765794883524

239 files changed:
AppPkg/Applications/Python/Python-2.7.10/Lib/BaseHTTPServer.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/HTMLParser.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/SimpleHTTPServer.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/SocketServer.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/StringIO.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/UserDict.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/_abcoll.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/_weakrefset.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/abc.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/argparse.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/ast.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/atexit.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/binhex.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/bisect.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/calendar.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/cmd.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/codecs.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/collections.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/compileall.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/copy.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/copy_reg.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/csv.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/dis.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/dummy_thread.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/__init__.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/aliases.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ascii.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/base64_codec.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5hkscs.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/bz2_codec.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/charmap.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp037.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1006.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1026.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1140.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1250.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1251.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1252.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1253.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1254.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1255.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1256.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1257.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1258.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp424.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp437.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp500.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp720.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp737.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp775.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp850.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp852.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp855.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp856.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp857.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp858.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp860.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp861.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp862.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp863.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp864.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp865.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp866.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp869.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp874.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp875.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp932.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp949.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp950.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jis_2004.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jisx0213.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jp.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_kr.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb18030.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb2312.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gbk.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hex_codec.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hp_roman8.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hz.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/idna.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_1.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2004.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_3.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_ext.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_kr.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_1.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_10.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_11.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_13.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_14.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_15.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_16.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_2.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_3.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_4.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_5.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_6.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_7.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_8.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_9.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/johab.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_r.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_u.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/latin_1.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_arabic.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_centeuro.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_croatian.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_cyrillic.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_farsi.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_greek.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_iceland.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_latin2.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_roman.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_romanian.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_turkish.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mbcs.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/palmos.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ptcp154.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/punycode.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/quopri_codec.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/rot_13.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis_2004.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jisx0213.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/string_escape.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/tis_620.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_escape.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_internal.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_be.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_le.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_be.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_le.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_7.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8_sig.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/uu_codec.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/zlib_codec.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/fileinput.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/fnmatch.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/formatter.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/functools.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/genericpath.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/getopt.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/gettext.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/hashlib.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/heapq.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/importlib/__init__.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/inspect.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/io.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/__init__.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/decoder.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/encoder.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/scanner.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/__init__.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_check_circular.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_decode.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_default.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_dump.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_encode_basestring_ascii.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_fail.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_float.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_indent.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass1.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass2.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass3.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_recursion.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_scanstring.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_separators.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_speedups.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_unicode.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/json/tool.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/keyword.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/linecache.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/md5.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/modulefinder.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/numbers.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/opcode.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/optparse.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/pkgutil.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/platform.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/__init__.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/topics.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/random.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/re.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/repr.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/runpy.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/sha.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/shutil.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/site-packages/README [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/socket.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/sre.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/sre_compile.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/sre_constants.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/sre_parse.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/stat.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/string.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/struct.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/sysconfig.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/textwrap.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/token.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/tokenize.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/traceback.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/types.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/urlparse.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/warnings.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/weakref.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/__init__.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/NodeFilter.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/__init__.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/domreg.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/expatbuilder.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minicompat.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minidom.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/pulldom.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/xmlbuilder.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementInclude.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementPath.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementTree.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/__init__.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/cElementTree.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/__init__.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/expat.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/__init__.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/_exceptions.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/expatreader.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/handler.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/saxutils.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/xmlreader.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/xmllib.py [new file with mode: 0644]
AppPkg/Applications/Python/Python-2.7.10/Lib/zipfile.py [new file with mode: 0644]

diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/BaseHTTPServer.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/BaseHTTPServer.py
new file mode 100644 (file)
index 0000000..d83ff51
--- /dev/null
@@ -0,0 +1,603 @@
+"""HTTP server base class.\r
+\r
+Note: the class in this module doesn't implement any HTTP request; see\r
+SimpleHTTPServer for simple implementations of GET, HEAD and POST\r
+(including CGI scripts).  It does, however, optionally implement HTTP/1.1\r
+persistent connections, as of version 0.3.\r
+\r
+Contents:\r
+\r
+- BaseHTTPRequestHandler: HTTP request handler base class\r
+- test: test function\r
+\r
+XXX To do:\r
+\r
+- log requests even later (to capture byte count)\r
+- log user-agent header and other interesting goodies\r
+- send error log to separate file\r
+"""\r
+\r
+\r
+# See also:\r
+#\r
+# HTTP Working Group                                        T. Berners-Lee\r
+# INTERNET-DRAFT                                            R. T. Fielding\r
+# <draft-ietf-http-v10-spec-00.txt>                     H. Frystyk Nielsen\r
+# Expires September 8, 1995                                  March 8, 1995\r
+#\r
+# URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt\r
+#\r
+# and\r
+#\r
+# Network Working Group                                      R. Fielding\r
+# Request for Comments: 2616                                       et al\r
+# Obsoletes: 2068                                              June 1999\r
+# Category: Standards Track\r
+#\r
+# URL: http://www.faqs.org/rfcs/rfc2616.html\r
+\r
+# Log files\r
+# ---------\r
+#\r
+# Here's a quote from the NCSA httpd docs about log file format.\r
+#\r
+# | The logfile format is as follows. Each line consists of:\r
+# |\r
+# | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb\r
+# |\r
+# |        host: Either the DNS name or the IP number of the remote client\r
+# |        rfc931: Any information returned by identd for this person,\r
+# |                - otherwise.\r
+# |        authuser: If user sent a userid for authentication, the user name,\r
+# |                  - otherwise.\r
+# |        DD: Day\r
+# |        Mon: Month (calendar name)\r
+# |        YYYY: Year\r
+# |        hh: hour (24-hour format, the machine's timezone)\r
+# |        mm: minutes\r
+# |        ss: seconds\r
+# |        request: The first line of the HTTP request as sent by the client.\r
+# |        ddd: the status code returned by the server, - if not available.\r
+# |        bbbb: the total number of bytes sent,\r
+# |              *not including the HTTP/1.0 header*, - if not available\r
+# |\r
+# | You can determine the name of the file accessed through request.\r
+#\r
+# (Actually, the latter is only true if you know the server configuration\r
+# at the time the request was made!)\r
+\r
+__version__ = "0.3"\r
+\r
+__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]\r
+\r
+import sys\r
+import time\r
+import socket # For gethostbyaddr()\r
+from warnings import filterwarnings, catch_warnings\r
+with catch_warnings():\r
+    if sys.py3kwarning:\r
+        filterwarnings("ignore", ".*mimetools has been removed",\r
+                        DeprecationWarning)\r
+    import mimetools\r
+import SocketServer\r
+\r
+# Default error message template\r
+DEFAULT_ERROR_MESSAGE = """\\r
+<head>\r
+<title>Error response</title>\r
+</head>\r
+<body>\r
+<h1>Error response</h1>\r
+<p>Error code %(code)d.\r
+<p>Message: %(message)s.\r
+<p>Error code explanation: %(code)s = %(explain)s.\r
+</body>\r
+"""\r
+\r
+DEFAULT_ERROR_CONTENT_TYPE = "text/html"\r
+\r
+def _quote_html(html):\r
+    return html.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")\r
+\r
+class HTTPServer(SocketServer.TCPServer):\r
+\r
+    allow_reuse_address = 1    # Seems to make sense in testing environment\r
+\r
+    def server_bind(self):\r
+        """Override server_bind to store the server name."""\r
+        SocketServer.TCPServer.server_bind(self)\r
+        host, port = self.socket.getsockname()[:2]\r
+        self.server_name = socket.getfqdn(host)\r
+        self.server_port = port\r
+\r
+\r
+class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):\r
+\r
+    """HTTP request handler base class.\r
+\r
+    The following explanation of HTTP serves to guide you through the\r
+    code as well as to expose any misunderstandings I may have about\r
+    HTTP (so you don't need to read the code to figure out I'm wrong\r
+    :-).\r
+\r
+    HTTP (HyperText Transfer Protocol) is an extensible protocol on\r
+    top of a reliable stream transport (e.g. TCP/IP).  The protocol\r
+    recognizes three parts to a request:\r
+\r
+    1. One line identifying the request type and path\r
+    2. An optional set of RFC-822-style headers\r
+    3. An optional data part\r
+\r
+    The headers and data are separated by a blank line.\r
+\r
+    The first line of the request has the form\r
+\r
+    <command> <path> <version>\r
+\r
+    where <command> is a (case-sensitive) keyword such as GET or POST,\r
+    <path> is a string containing path information for the request,\r
+    and <version> should be the string "HTTP/1.0" or "HTTP/1.1".\r
+    <path> is encoded using the URL encoding scheme (using %xx to signify\r
+    the ASCII character with hex code xx).\r
+\r
+    The specification specifies that lines are separated by CRLF but\r
+    for compatibility with the widest range of clients recommends\r
+    servers also handle LF.  Similarly, whitespace in the request line\r
+    is treated sensibly (allowing multiple spaces between components\r
+    and allowing trailing whitespace).\r
+\r
+    Similarly, for output, lines ought to be separated by CRLF pairs\r
+    but most clients grok LF characters just fine.\r
+\r
+    If the first line of the request has the form\r
+\r
+    <command> <path>\r
+\r
+    (i.e. <version> is left out) then this is assumed to be an HTTP\r
+    0.9 request; this form has no optional headers and data part and\r
+    the reply consists of just the data.\r
+\r
+    The reply form of the HTTP 1.x protocol again has three parts:\r
+\r
+    1. One line giving the response code\r
+    2. An optional set of RFC-822-style headers\r
+    3. The data\r
+\r
+    Again, the headers and data are separated by a blank line.\r
+\r
+    The response code line has the form\r
+\r
+    <version> <responsecode> <responsestring>\r
+\r
+    where <version> is the protocol version ("HTTP/1.0" or "HTTP/1.1"),\r
+    <responsecode> is a 3-digit response code indicating success or\r
+    failure of the request, and <responsestring> is an optional\r
+    human-readable string explaining what the response code means.\r
+\r
+    This server parses the request and the headers, and then calls a\r
+    function specific to the request type (<command>).  Specifically,\r
+    a request SPAM will be handled by a method do_SPAM().  If no\r
+    such method exists the server sends an error response to the\r
+    client.  If it exists, it is called with no arguments:\r
+\r
+    do_SPAM()\r
+\r
+    Note that the request name is case sensitive (i.e. SPAM and spam\r
+    are different requests).\r
+\r
+    The various request details are stored in instance variables:\r
+\r
+    - client_address is the client IP address in the form (host,\r
+    port);\r
+\r
+    - command, path and version are the broken-down request line;\r
+\r
+    - headers is an instance of mimetools.Message (or a derived\r
+    class) containing the header information;\r
+\r
+    - rfile is a file object open for reading positioned at the\r
+    start of the optional input data part;\r
+\r
+    - wfile is a file object open for writing.\r
+\r
+    IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING!\r
+\r
+    The first thing to be written must be the response line.  Then\r
+    follow 0 or more header lines, then a blank line, and then the\r
+    actual data (if any).  The meaning of the header lines depends on\r
+    the command executed by the server; in most cases, when data is\r
+    returned, there should be at least one header line of the form\r
+\r
+    Content-type: <type>/<subtype>\r
+\r
+    where <type> and <subtype> should be registered MIME types,\r
+    e.g. "text/html" or "text/plain".\r
+\r
+    """\r
+\r
+    # The Python system version, truncated to its first component.\r
+    sys_version = "Python/" + sys.version.split()[0]\r
+\r
+    # The server software version.  You may want to override this.\r
+    # The format is multiple whitespace-separated strings,\r
+    # where each string is of the form name[/version].\r
+    server_version = "BaseHTTP/" + __version__\r
+\r
+    # The default request version.  This only affects responses up until\r
+    # the point where the request line is parsed, so it mainly decides what\r
+    # the client gets back when sending a malformed request line.\r
+    # Most web servers default to HTTP 0.9, i.e. don't send a status line.\r
+    default_request_version = "HTTP/0.9"\r
+\r
+    def parse_request(self):\r
+        """Parse a request (internal).\r
+\r
+        The request should be stored in self.raw_requestline; the results\r
+        are in self.command, self.path, self.request_version and\r
+        self.headers.\r
+\r
+        Return True for success, False for failure; on failure, an\r
+        error is sent back.\r
+\r
+        """\r
+        self.command = None  # set in case of error on the first line\r
+        self.request_version = version = self.default_request_version\r
+        self.close_connection = 1\r
+        requestline = self.raw_requestline\r
+        requestline = requestline.rstrip('\r\n')\r
+        self.requestline = requestline\r
+        words = requestline.split()\r
+        if len(words) == 3:\r
+            command, path, version = words\r
+            if version[:5] != 'HTTP/':\r
+                self.send_error(400, "Bad request version (%r)" % version)\r
+                return False\r
+            try:\r
+                base_version_number = version.split('/', 1)[1]\r
+                version_number = base_version_number.split(".")\r
+                # RFC 2145 section 3.1 says there can be only one "." and\r
+                #   - major and minor numbers MUST be treated as\r
+                #      separate integers;\r
+                #   - HTTP/2.4 is a lower version than HTTP/2.13, which in\r
+                #      turn is lower than HTTP/12.3;\r
+                #   - Leading zeros MUST be ignored by recipients.\r
+                if len(version_number) != 2:\r
+                    raise ValueError\r
+                version_number = int(version_number[0]), int(version_number[1])\r
+            except (ValueError, IndexError):\r
+                self.send_error(400, "Bad request version (%r)" % version)\r
+                return False\r
+            if version_number >= (1, 1) and self.protocol_version >= "HTTP/1.1":\r
+                self.close_connection = 0\r
+            if version_number >= (2, 0):\r
+                self.send_error(505,\r
+                          "Invalid HTTP Version (%s)" % base_version_number)\r
+                return False\r
+        elif len(words) == 2:\r
+            command, path = words\r
+            self.close_connection = 1\r
+            if command != 'GET':\r
+                self.send_error(400,\r
+                                "Bad HTTP/0.9 request type (%r)" % command)\r
+                return False\r
+        elif not words:\r
+            return False\r
+        else:\r
+            self.send_error(400, "Bad request syntax (%r)" % requestline)\r
+            return False\r
+        self.command, self.path, self.request_version = command, path, version\r
+\r
+        # Examine the headers and look for a Connection directive\r
+        self.headers = self.MessageClass(self.rfile, 0)\r
+\r
+        conntype = self.headers.get('Connection', "")\r
+        if conntype.lower() == 'close':\r
+            self.close_connection = 1\r
+        elif (conntype.lower() == 'keep-alive' and\r
+              self.protocol_version >= "HTTP/1.1"):\r
+            self.close_connection = 0\r
+        return True\r
+\r
+    def handle_one_request(self):\r
+        """Handle a single HTTP request.\r
+\r
+        You normally don't need to override this method; see the class\r
+        __doc__ string for information on how to handle specific HTTP\r
+        commands such as GET and POST.\r
+\r
+        """\r
+        try:\r
+            self.raw_requestline = self.rfile.readline(65537)\r
+            if len(self.raw_requestline) > 65536:\r
+                self.requestline = ''\r
+                self.request_version = ''\r
+                self.command = ''\r
+                self.send_error(414)\r
+                return\r
+            if not self.raw_requestline:\r
+                self.close_connection = 1\r
+                return\r
+            if not self.parse_request():\r
+                # An error code has been sent, just exit\r
+                return\r
+            mname = 'do_' + self.command\r
+            if not hasattr(self, mname):\r
+                self.send_error(501, "Unsupported method (%r)" % self.command)\r
+                return\r
+            method = getattr(self, mname)\r
+            method()\r
+            self.wfile.flush() #actually send the response if not already done.\r
+        except socket.timeout, e:\r
+            #a read or a write timed out.  Discard this connection\r
+            self.log_error("Request timed out: %r", e)\r
+            self.close_connection = 1\r
+            return\r
+\r
+    def handle(self):\r
+        """Handle multiple requests if necessary."""\r
+        self.close_connection = 1\r
+\r
+        self.handle_one_request()\r
+        while not self.close_connection:\r
+            self.handle_one_request()\r
+\r
+    def send_error(self, code, message=None):\r
+        """Send and log an error reply.\r
+\r
+        Arguments are the error code, and a detailed message.\r
+        The detailed message defaults to the short entry matching the\r
+        response code.\r
+\r
+        This sends an error response (so it must be called before any\r
+        output has been generated), logs the error, and finally sends\r
+        a piece of HTML explaining the error to the user.\r
+\r
+        """\r
+\r
+        try:\r
+            short, long = self.responses[code]\r
+        except KeyError:\r
+            short, long = '???', '???'\r
+        if message is None:\r
+            message = short\r
+        explain = long\r
+        self.log_error("code %d, message %s", code, message)\r
+        # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)\r
+        content = (self.error_message_format %\r
+                   {'code': code, 'message': _quote_html(message), 'explain': explain})\r
+        self.send_response(code, message)\r
+        self.send_header("Content-Type", self.error_content_type)\r
+        self.send_header('Connection', 'close')\r
+        self.end_headers()\r
+        if self.command != 'HEAD' and code >= 200 and code not in (204, 304):\r
+            self.wfile.write(content)\r
+\r
+    error_message_format = DEFAULT_ERROR_MESSAGE\r
+    error_content_type = DEFAULT_ERROR_CONTENT_TYPE\r
+\r
+    def send_response(self, code, message=None):\r
+        """Send the response header and log the response code.\r
+\r
+        Also send two standard headers with the server software\r
+        version and the current date.\r
+\r
+        """\r
+        self.log_request(code)\r
+        if message is None:\r
+            if code in self.responses:\r
+                message = self.responses[code][0]\r
+            else:\r
+                message = ''\r
+        if self.request_version != 'HTTP/0.9':\r
+            self.wfile.write("%s %d %s\r\n" %\r
+                             (self.protocol_version, code, message))\r
+            # print (self.protocol_version, code, message)\r
+        self.send_header('Server', self.version_string())\r
+        self.send_header('Date', self.date_time_string())\r
+\r
+    def send_header(self, keyword, value):\r
+        """Send a MIME header."""\r
+        if self.request_version != 'HTTP/0.9':\r
+            self.wfile.write("%s: %s\r\n" % (keyword, value))\r
+\r
+        if keyword.lower() == 'connection':\r
+            if value.lower() == 'close':\r
+                self.close_connection = 1\r
+            elif value.lower() == 'keep-alive':\r
+                self.close_connection = 0\r
+\r
+    def end_headers(self):\r
+        """Send the blank line ending the MIME headers."""\r
+        if self.request_version != 'HTTP/0.9':\r
+            self.wfile.write("\r\n")\r
+\r
+    def log_request(self, code='-', size='-'):\r
+        """Log an accepted request.\r
+\r
+        This is called by send_response().\r
+\r
+        """\r
+\r
+        self.log_message('"%s" %s %s',\r
+                         self.requestline, str(code), str(size))\r
+\r
+    def log_error(self, format, *args):\r
+        """Log an error.\r
+\r
+        This is called when a request cannot be fulfilled.  By\r
+        default it passes the message on to log_message().\r
+\r
+        Arguments are the same as for log_message().\r
+\r
+        XXX This should go to the separate error log.\r
+\r
+        """\r
+\r
+        self.log_message(format, *args)\r
+\r
+    def log_message(self, format, *args):\r
+        """Log an arbitrary message.\r
+\r
+        This is used by all other logging functions.  Override\r
+        it if you have specific logging wishes.\r
+\r
+        The first argument, FORMAT, is a format string for the\r
+        message to be logged.  If the format string contains\r
+        any % escapes requiring parameters, they should be\r
+        specified as subsequent arguments (it's just like\r
+        printf!).\r
+\r
+        The client ip address and current date/time are prefixed to every\r
+        message.\r
+\r
+        """\r
+\r
+        sys.stderr.write("%s - - [%s] %s\n" %\r
+                         (self.client_address[0],\r
+                          self.log_date_time_string(),\r
+                          format%args))\r
+\r
+    def version_string(self):\r
+        """Return the server software version string."""\r
+        return self.server_version + ' ' + self.sys_version\r
+\r
+    def date_time_string(self, timestamp=None):\r
+        """Return the current date and time formatted for a message header."""\r
+        if timestamp is None:\r
+            timestamp = time.time()\r
+        year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp)\r
+        s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (\r
+                self.weekdayname[wd],\r
+                day, self.monthname[month], year,\r
+                hh, mm, ss)\r
+        return s\r
+\r
+    def log_date_time_string(self):\r
+        """Return the current time formatted for logging."""\r
+        now = time.time()\r
+        year, month, day, hh, mm, ss, x, y, z = time.localtime(now)\r
+        s = "%02d/%3s/%04d %02d:%02d:%02d" % (\r
+                day, self.monthname[month], year, hh, mm, ss)\r
+        return s\r
+\r
+    weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']\r
+\r
+    monthname = [None,\r
+                 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',\r
+                 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\r
+\r
+    def address_string(self):\r
+        """Return the client address formatted for logging.\r
+\r
+        This version looks up the full hostname using gethostbyaddr(),\r
+        and tries to find a name that contains at least one dot.\r
+\r
+        """\r
+\r
+        host, port = self.client_address[:2]\r
+        return socket.getfqdn(host)\r
+\r
+    # Essentially static class variables\r
+\r
+    # The version of the HTTP protocol we support.\r
+    # Set this to HTTP/1.1 to enable automatic keepalive\r
+    protocol_version = "HTTP/1.0"\r
+\r
+    # The Message-like class used to parse headers\r
+    MessageClass = mimetools.Message\r
+\r
+    # Table mapping response codes to messages; entries have the\r
+    # form {code: (shortmessage, longmessage)}.\r
+    # See RFC 2616.\r
+    responses = {\r
+        100: ('Continue', 'Request received, please continue'),\r
+        101: ('Switching Protocols',\r
+              'Switching to new protocol; obey Upgrade header'),\r
+\r
+        200: ('OK', 'Request fulfilled, document follows'),\r
+        201: ('Created', 'Document created, URL follows'),\r
+        202: ('Accepted',\r
+              'Request accepted, processing continues off-line'),\r
+        203: ('Non-Authoritative Information', 'Request fulfilled from cache'),\r
+        204: ('No Content', 'Request fulfilled, nothing follows'),\r
+        205: ('Reset Content', 'Clear input form for further input.'),\r
+        206: ('Partial Content', 'Partial content follows.'),\r
+\r
+        300: ('Multiple Choices',\r
+              'Object has several resources -- see URI list'),\r
+        301: ('Moved Permanently', 'Object moved permanently -- see URI list'),\r
+        302: ('Found', 'Object moved temporarily -- see URI list'),\r
+        303: ('See Other', 'Object moved -- see Method and URL list'),\r
+        304: ('Not Modified',\r
+              'Document has not changed since given time'),\r
+        305: ('Use Proxy',\r
+              'You must use proxy specified in Location to access this '\r
+              'resource.'),\r
+        307: ('Temporary Redirect',\r
+              'Object moved temporarily -- see URI list'),\r
+\r
+        400: ('Bad Request',\r
+              'Bad request syntax or unsupported method'),\r
+        401: ('Unauthorized',\r
+              'No permission -- see authorization schemes'),\r
+        402: ('Payment Required',\r
+              'No payment -- see charging schemes'),\r
+        403: ('Forbidden',\r
+              'Request forbidden -- authorization will not help'),\r
+        404: ('Not Found', 'Nothing matches the given URI'),\r
+        405: ('Method Not Allowed',\r
+              'Specified method is invalid for this resource.'),\r
+        406: ('Not Acceptable', 'URI not available in preferred format.'),\r
+        407: ('Proxy Authentication Required', 'You must authenticate with '\r
+              'this proxy before proceeding.'),\r
+        408: ('Request Timeout', 'Request timed out; try again later.'),\r
+        409: ('Conflict', 'Request conflict.'),\r
+        410: ('Gone',\r
+              'URI no longer exists and has been permanently removed.'),\r
+        411: ('Length Required', 'Client must specify Content-Length.'),\r
+        412: ('Precondition Failed', 'Precondition in headers is false.'),\r
+        413: ('Request Entity Too Large', 'Entity is too large.'),\r
+        414: ('Request-URI Too Long', 'URI is too long.'),\r
+        415: ('Unsupported Media Type', 'Entity body in unsupported format.'),\r
+        416: ('Requested Range Not Satisfiable',\r
+              'Cannot satisfy request range.'),\r
+        417: ('Expectation Failed',\r
+              'Expect condition could not be satisfied.'),\r
+\r
+        500: ('Internal Server Error', 'Server got itself in trouble'),\r
+        501: ('Not Implemented',\r
+              'Server does not support this operation'),\r
+        502: ('Bad Gateway', 'Invalid responses from another server/proxy.'),\r
+        503: ('Service Unavailable',\r
+              'The server cannot process the request due to a high load'),\r
+        504: ('Gateway Timeout',\r
+              'The gateway server did not receive a timely response'),\r
+        505: ('HTTP Version Not Supported', 'Cannot fulfill request.'),\r
+        }\r
+\r
+\r
+def test(HandlerClass = BaseHTTPRequestHandler,\r
+         ServerClass = HTTPServer, protocol="HTTP/1.0"):\r
+    """Test the HTTP request handler class.\r
+\r
+    This runs an HTTP server on port 8000 (or the first command line\r
+    argument).\r
+\r
+    """\r
+\r
+    if sys.argv[1:]:\r
+        port = int(sys.argv[1])\r
+    else:\r
+        port = 8000\r
+    server_address = ('', port)\r
+\r
+    HandlerClass.protocol_version = protocol\r
+    httpd = ServerClass(server_address, HandlerClass)\r
+\r
+    sa = httpd.socket.getsockname()\r
+    print "Serving HTTP on", sa[0], "port", sa[1], "..."\r
+    httpd.serve_forever()\r
+\r
+\r
+if __name__ == '__main__':\r
+    test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/HTMLParser.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/HTMLParser.py
new file mode 100644 (file)
index 0000000..07313d2
--- /dev/null
@@ -0,0 +1,475 @@
+"""A parser for HTML and XHTML."""\r
+\r
+# This file is based on sgmllib.py, but the API is slightly different.\r
+\r
+# XXX There should be a way to distinguish between PCDATA (parsed\r
+# character data -- the normal case), RCDATA (replaceable character\r
+# data -- only char and entity references and end tags are special)\r
+# and CDATA (character data -- only end tags are special).\r
+\r
+\r
+import markupbase\r
+import re\r
+\r
+# Regular expressions used for parsing\r
+\r
+interesting_normal = re.compile('[&<]')\r
+incomplete = re.compile('&[a-zA-Z#]')\r
+\r
+entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]')\r
+charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]')\r
+\r
+starttagopen = re.compile('<[a-zA-Z]')\r
+piclose = re.compile('>')\r
+commentclose = re.compile(r'--\s*>')\r
+\r
+# see http://www.w3.org/TR/html5/tokenization.html#tag-open-state\r
+# and http://www.w3.org/TR/html5/tokenization.html#tag-name-state\r
+# note: if you change tagfind/attrfind remember to update locatestarttagend too\r
+tagfind = re.compile('([a-zA-Z][^\t\n\r\f />\x00]*)(?:\s|/(?!>))*')\r
+# this regex is currently unused, but left for backward compatibility\r
+tagfind_tolerant = re.compile('[a-zA-Z][^\t\n\r\f />\x00]*')\r
+\r
+attrfind = re.compile(\r
+    r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*'\r
+    r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*')\r
+\r
+locatestarttagend = re.compile(r"""\r
+  <[a-zA-Z][^\t\n\r\f />\x00]*       # tag name\r
+  (?:[\s/]*                          # optional whitespace before attribute name\r
+    (?:(?<=['"\s/])[^\s/>][^\s/=>]*  # attribute name\r
+      (?:\s*=+\s*                    # value indicator\r
+        (?:'[^']*'                   # LITA-enclosed value\r
+          |"[^"]*"                   # LIT-enclosed value\r
+          |(?!['"])[^>\s]*           # bare value\r
+         )\r
+       )?(?:\s|/(?!>))*\r
+     )*\r
+   )?\r
+  \s*                                # trailing whitespace\r
+""", re.VERBOSE)\r
+endendtag = re.compile('>')\r
+# the HTML 5 spec, section 8.1.2.2, doesn't allow spaces between\r
+# </ and the tag name, so maybe this should be fixed\r
+endtagfind = re.compile('</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>')\r
+\r
+\r
+class HTMLParseError(Exception):\r
+    """Exception raised for all parse errors."""\r
+\r
+    def __init__(self, msg, position=(None, None)):\r
+        assert msg\r
+        self.msg = msg\r
+        self.lineno = position[0]\r
+        self.offset = position[1]\r
+\r
+    def __str__(self):\r
+        result = self.msg\r
+        if self.lineno is not None:\r
+            result = result + ", at line %d" % self.lineno\r
+        if self.offset is not None:\r
+            result = result + ", column %d" % (self.offset + 1)\r
+        return result\r
+\r
+\r
+class HTMLParser(markupbase.ParserBase):\r
+    """Find tags and other markup and call handler functions.\r
+\r
+    Usage:\r
+        p = HTMLParser()\r
+        p.feed(data)\r
+        ...\r
+        p.close()\r
+\r
+    Start tags are handled by calling self.handle_starttag() or\r
+    self.handle_startendtag(); end tags by self.handle_endtag().  The\r
+    data between tags is passed from the parser to the derived class\r
+    by calling self.handle_data() with the data as argument (the data\r
+    may be split up in arbitrary chunks).  Entity references are\r
+    passed by calling self.handle_entityref() with the entity\r
+    reference as the argument.  Numeric character references are\r
+    passed to self.handle_charref() with the string containing the\r
+    reference as the argument.\r
+    """\r
+\r
+    CDATA_CONTENT_ELEMENTS = ("script", "style")\r
+\r
+\r
+    def __init__(self):\r
+        """Initialize and reset this instance."""\r
+        self.reset()\r
+\r
+    def reset(self):\r
+        """Reset this instance.  Loses all unprocessed data."""\r
+        self.rawdata = ''\r
+        self.lasttag = '???'\r
+        self.interesting = interesting_normal\r
+        self.cdata_elem = None\r
+        markupbase.ParserBase.reset(self)\r
+\r
+    def feed(self, data):\r
+        r"""Feed data to the parser.\r
+\r
+        Call this as often as you want, with as little or as much text\r
+        as you want (may include '\n').\r
+        """\r
+        self.rawdata = self.rawdata + data\r
+        self.goahead(0)\r
+\r
+    def close(self):\r
+        """Handle any buffered data."""\r
+        self.goahead(1)\r
+\r
+    def error(self, message):\r
+        raise HTMLParseError(message, self.getpos())\r
+\r
+    __starttag_text = None\r
+\r
+    def get_starttag_text(self):\r
+        """Return full source of start tag: '<...>'."""\r
+        return self.__starttag_text\r
+\r
+    def set_cdata_mode(self, elem):\r
+        self.cdata_elem = elem.lower()\r
+        self.interesting = re.compile(r'</\s*%s\s*>' % self.cdata_elem, re.I)\r
+\r
+    def clear_cdata_mode(self):\r
+        self.interesting = interesting_normal\r
+        self.cdata_elem = None\r
+\r
+    # Internal -- handle data as far as reasonable.  May leave state\r
+    # and data to be processed by a subsequent call.  If 'end' is\r
+    # true, force handling all data as if followed by EOF marker.\r
+    def goahead(self, end):\r
+        rawdata = self.rawdata\r
+        i = 0\r
+        n = len(rawdata)\r
+        while i < n:\r
+            match = self.interesting.search(rawdata, i) # < or &\r
+            if match:\r
+                j = match.start()\r
+            else:\r
+                if self.cdata_elem:\r
+                    break\r
+                j = n\r
+            if i < j: self.handle_data(rawdata[i:j])\r
+            i = self.updatepos(i, j)\r
+            if i == n: break\r
+            startswith = rawdata.startswith\r
+            if startswith('<', i):\r
+                if starttagopen.match(rawdata, i): # < + letter\r
+                    k = self.parse_starttag(i)\r
+                elif startswith("</", i):\r
+                    k = self.parse_endtag(i)\r
+                elif startswith("<!--", i):\r
+                    k = self.parse_comment(i)\r
+                elif startswith("<?", i):\r
+                    k = self.parse_pi(i)\r
+                elif startswith("<!", i):\r
+                    k = self.parse_html_declaration(i)\r
+                elif (i + 1) < n:\r
+                    self.handle_data("<")\r
+                    k = i + 1\r
+                else:\r
+                    break\r
+                if k < 0:\r
+                    if not end:\r
+                        break\r
+                    k = rawdata.find('>', i + 1)\r
+                    if k < 0:\r
+                        k = rawdata.find('<', i + 1)\r
+                        if k < 0:\r
+                            k = i + 1\r
+                    else:\r
+                        k += 1\r
+                    self.handle_data(rawdata[i:k])\r
+                i = self.updatepos(i, k)\r
+            elif startswith("&#", i):\r
+                match = charref.match(rawdata, i)\r
+                if match:\r
+                    name = match.group()[2:-1]\r
+                    self.handle_charref(name)\r
+                    k = match.end()\r
+                    if not startswith(';', k-1):\r
+                        k = k - 1\r
+                    i = self.updatepos(i, k)\r
+                    continue\r
+                else:\r
+                    if ";" in rawdata[i:]:  # bail by consuming '&#'\r
+                        self.handle_data(rawdata[i:i+2])\r
+                        i = self.updatepos(i, i+2)\r
+                    break\r
+            elif startswith('&', i):\r
+                match = entityref.match(rawdata, i)\r
+                if match:\r
+                    name = match.group(1)\r
+                    self.handle_entityref(name)\r
+                    k = match.end()\r
+                    if not startswith(';', k-1):\r
+                        k = k - 1\r
+                    i = self.updatepos(i, k)\r
+                    continue\r
+                match = incomplete.match(rawdata, i)\r
+                if match:\r
+                    # match.group() will contain at least 2 chars\r
+                    if end and match.group() == rawdata[i:]:\r
+                        self.error("EOF in middle of entity or char ref")\r
+                    # incomplete\r
+                    break\r
+                elif (i + 1) < n:\r
+                    # not the end of the buffer, and can't be confused\r
+                    # with some other construct\r
+                    self.handle_data("&")\r
+                    i = self.updatepos(i, i + 1)\r
+                else:\r
+                    break\r
+            else:\r
+                assert 0, "interesting.search() lied"\r
+        # end while\r
+        if end and i < n and not self.cdata_elem:\r
+            self.handle_data(rawdata[i:n])\r
+            i = self.updatepos(i, n)\r
+        self.rawdata = rawdata[i:]\r
+\r
+    # Internal -- parse html declarations, return length or -1 if not terminated\r
+    # See w3.org/TR/html5/tokenization.html#markup-declaration-open-state\r
+    # See also parse_declaration in _markupbase\r
+    def parse_html_declaration(self, i):\r
+        rawdata = self.rawdata\r
+        if rawdata[i:i+2] != '<!':\r
+            self.error('unexpected call to parse_html_declaration()')\r
+        if rawdata[i:i+4] == '<!--':\r
+            # this case is actually already handled in goahead()\r
+            return self.parse_comment(i)\r
+        elif rawdata[i:i+3] == '<![':\r
+            return self.parse_marked_section(i)\r
+        elif rawdata[i:i+9].lower() == '<!doctype':\r
+            # find the closing >\r
+            gtpos = rawdata.find('>', i+9)\r
+            if gtpos == -1:\r
+                return -1\r
+            self.handle_decl(rawdata[i+2:gtpos])\r
+            return gtpos+1\r
+        else:\r
+            return self.parse_bogus_comment(i)\r
+\r
+    # Internal -- parse bogus comment, return length or -1 if not terminated\r
+    # see http://www.w3.org/TR/html5/tokenization.html#bogus-comment-state\r
+    def parse_bogus_comment(self, i, report=1):\r
+        rawdata = self.rawdata\r
+        if rawdata[i:i+2] not in ('<!', '</'):\r
+            self.error('unexpected call to parse_comment()')\r
+        pos = rawdata.find('>', i+2)\r
+        if pos == -1:\r
+            return -1\r
+        if report:\r
+            self.handle_comment(rawdata[i+2:pos])\r
+        return pos + 1\r
+\r
+    # Internal -- parse processing instr, return end or -1 if not terminated\r
+    def parse_pi(self, i):\r
+        rawdata = self.rawdata\r
+        assert rawdata[i:i+2] == '<?', 'unexpected call to parse_pi()'\r
+        match = piclose.search(rawdata, i+2) # >\r
+        if not match:\r
+            return -1\r
+        j = match.start()\r
+        self.handle_pi(rawdata[i+2: j])\r
+        j = match.end()\r
+        return j\r
+\r
+    # Internal -- handle starttag, return end or -1 if not terminated\r
+    def parse_starttag(self, i):\r
+        self.__starttag_text = None\r
+        endpos = self.check_for_whole_start_tag(i)\r
+        if endpos < 0:\r
+            return endpos\r
+        rawdata = self.rawdata\r
+        self.__starttag_text = rawdata[i:endpos]\r
+\r
+        # Now parse the data between i+1 and j into a tag and attrs\r
+        attrs = []\r
+        match = tagfind.match(rawdata, i+1)\r
+        assert match, 'unexpected call to parse_starttag()'\r
+        k = match.end()\r
+        self.lasttag = tag = match.group(1).lower()\r
+\r
+        while k < endpos:\r
+            m = attrfind.match(rawdata, k)\r
+            if not m:\r
+                break\r
+            attrname, rest, attrvalue = m.group(1, 2, 3)\r
+            if not rest:\r
+                attrvalue = None\r
+            elif attrvalue[:1] == '\'' == attrvalue[-1:] or \\r
+                 attrvalue[:1] == '"' == attrvalue[-1:]:\r
+                attrvalue = attrvalue[1:-1]\r
+            if attrvalue:\r
+                attrvalue = self.unescape(attrvalue)\r
+            attrs.append((attrname.lower(), attrvalue))\r
+            k = m.end()\r
+\r
+        end = rawdata[k:endpos].strip()\r
+        if end not in (">", "/>"):\r
+            lineno, offset = self.getpos()\r
+            if "\n" in self.__starttag_text:\r
+                lineno = lineno + self.__starttag_text.count("\n")\r
+                offset = len(self.__starttag_text) \\r
+                         - self.__starttag_text.rfind("\n")\r
+            else:\r
+                offset = offset + len(self.__starttag_text)\r
+            self.handle_data(rawdata[i:endpos])\r
+            return endpos\r
+        if end.endswith('/>'):\r
+            # XHTML-style empty tag: <span attr="value" />\r
+            self.handle_startendtag(tag, attrs)\r
+        else:\r
+            self.handle_starttag(tag, attrs)\r
+            if tag in self.CDATA_CONTENT_ELEMENTS:\r
+                self.set_cdata_mode(tag)\r
+        return endpos\r
+\r
+    # Internal -- check to see if we have a complete starttag; return end\r
+    # or -1 if incomplete.\r
+    def check_for_whole_start_tag(self, i):\r
+        rawdata = self.rawdata\r
+        m = locatestarttagend.match(rawdata, i)\r
+        if m:\r
+            j = m.end()\r
+            next = rawdata[j:j+1]\r
+            if next == ">":\r
+                return j + 1\r
+            if next == "/":\r
+                if rawdata.startswith("/>", j):\r
+                    return j + 2\r
+                if rawdata.startswith("/", j):\r
+                    # buffer boundary\r
+                    return -1\r
+                # else bogus input\r
+                self.updatepos(i, j + 1)\r
+                self.error("malformed empty start tag")\r
+            if next == "":\r
+                # end of input\r
+                return -1\r
+            if next in ("abcdefghijklmnopqrstuvwxyz=/"\r
+                        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"):\r
+                # end of input in or before attribute value, or we have the\r
+                # '/' from a '/>' ending\r
+                return -1\r
+            if j > i:\r
+                return j\r
+            else:\r
+                return i + 1\r
+        raise AssertionError("we should not get here!")\r
+\r
+    # Internal -- parse endtag, return end or -1 if incomplete\r
+    def parse_endtag(self, i):\r
+        rawdata = self.rawdata\r
+        assert rawdata[i:i+2] == "</", "unexpected call to parse_endtag"\r
+        match = endendtag.search(rawdata, i+1) # >\r
+        if not match:\r
+            return -1\r
+        gtpos = match.end()\r
+        match = endtagfind.match(rawdata, i) # </ + tag + >\r
+        if not match:\r
+            if self.cdata_elem is not None:\r
+                self.handle_data(rawdata[i:gtpos])\r
+                return gtpos\r
+            # find the name: w3.org/TR/html5/tokenization.html#tag-name-state\r
+            namematch = tagfind.match(rawdata, i+2)\r
+            if not namematch:\r
+                # w3.org/TR/html5/tokenization.html#end-tag-open-state\r
+                if rawdata[i:i+3] == '</>':\r
+                    return i+3\r
+                else:\r
+                    return self.parse_bogus_comment(i)\r
+            tagname = namematch.group(1).lower()\r
+            # consume and ignore other stuff between the name and the >\r
+            # Note: this is not 100% correct, since we might have things like\r
+            # </tag attr=">">, but looking for > after tha name should cover\r
+            # most of the cases and is much simpler\r
+            gtpos = rawdata.find('>', namematch.end())\r
+            self.handle_endtag(tagname)\r
+            return gtpos+1\r
+\r
+        elem = match.group(1).lower() # script or style\r
+        if self.cdata_elem is not None:\r
+            if elem != self.cdata_elem:\r
+                self.handle_data(rawdata[i:gtpos])\r
+                return gtpos\r
+\r
+        self.handle_endtag(elem)\r
+        self.clear_cdata_mode()\r
+        return gtpos\r
+\r
+    # Overridable -- finish processing of start+end tag: <tag.../>\r
+    def handle_startendtag(self, tag, attrs):\r
+        self.handle_starttag(tag, attrs)\r
+        self.handle_endtag(tag)\r
+\r
+    # Overridable -- handle start tag\r
+    def handle_starttag(self, tag, attrs):\r
+        pass\r
+\r
+    # Overridable -- handle end tag\r
+    def handle_endtag(self, tag):\r
+        pass\r
+\r
+    # Overridable -- handle character reference\r
+    def handle_charref(self, name):\r
+        pass\r
+\r
+    # Overridable -- handle entity reference\r
+    def handle_entityref(self, name):\r
+        pass\r
+\r
+    # Overridable -- handle data\r
+    def handle_data(self, data):\r
+        pass\r
+\r
+    # Overridable -- handle comment\r
+    def handle_comment(self, data):\r
+        pass\r
+\r
+    # Overridable -- handle declaration\r
+    def handle_decl(self, decl):\r
+        pass\r
+\r
+    # Overridable -- handle processing instruction\r
+    def handle_pi(self, data):\r
+        pass\r
+\r
+    def unknown_decl(self, data):\r
+        pass\r
+\r
+    # Internal -- helper to remove special character quoting\r
+    entitydefs = None\r
+    def unescape(self, s):\r
+        if '&' not in s:\r
+            return s\r
+        def replaceEntities(s):\r
+            s = s.groups()[0]\r
+            try:\r
+                if s[0] == "#":\r
+                    s = s[1:]\r
+                    if s[0] in ['x','X']:\r
+                        c = int(s[1:], 16)\r
+                    else:\r
+                        c = int(s)\r
+                    return unichr(c)\r
+            except ValueError:\r
+                return '&#'+s+';'\r
+            else:\r
+                # Cannot use name2codepoint directly, because HTMLParser supports apos,\r
+                # which is not part of HTML 4\r
+                import htmlentitydefs\r
+                if HTMLParser.entitydefs is None:\r
+                    entitydefs = HTMLParser.entitydefs = {'apos':u"'"}\r
+                    for k, v in htmlentitydefs.name2codepoint.iteritems():\r
+                        entitydefs[k] = unichr(v)\r
+                try:\r
+                    return self.entitydefs[s]\r
+                except KeyError:\r
+                    return '&'+s+';'\r
+\r
+        return re.sub(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));", replaceEntities, s)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/SimpleHTTPServer.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/SimpleHTTPServer.py
new file mode 100644 (file)
index 0000000..841a1cc
--- /dev/null
@@ -0,0 +1,235 @@
+"""Simple HTTP Server.\r
+\r
+This module builds on BaseHTTPServer by implementing the standard GET\r
+and HEAD requests in a fairly straightforward manner.\r
+\r
+"""\r
+\r
+\r
+__version__ = "0.6"\r
+\r
+__all__ = ["SimpleHTTPRequestHandler"]\r
+\r
+import os\r
+import posixpath\r
+import BaseHTTPServer\r
+import urllib\r
+import urlparse\r
+import cgi\r
+import sys\r
+import shutil\r
+import mimetypes\r
+try:\r
+    from cStringIO import StringIO\r
+except ImportError:\r
+    from StringIO import StringIO\r
+\r
+\r
+class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):\r
+\r
+    """Simple HTTP request handler with GET and HEAD commands.\r
+\r
+    This serves files from the current directory and any of its\r
+    subdirectories.  The MIME type for files is determined by\r
+    calling the .guess_type() method.\r
+\r
+    The GET and HEAD requests are identical except that the HEAD\r
+    request omits the actual contents of the file.\r
+\r
+    """\r
+\r
+    server_version = "SimpleHTTP/" + __version__\r
+\r
+    def do_GET(self):\r
+        """Serve a GET request."""\r
+        f = self.send_head()\r
+        if f:\r
+            try:\r
+                self.copyfile(f, self.wfile)\r
+            finally:\r
+                f.close()\r
+\r
+    def do_HEAD(self):\r
+        """Serve a HEAD request."""\r
+        f = self.send_head()\r
+        if f:\r
+            f.close()\r
+\r
+    def send_head(self):\r
+        """Common code for GET and HEAD commands.\r
+\r
+        This sends the response code and MIME headers.\r
+\r
+        Return value is either a file object (which has to be copied\r
+        to the outputfile by the caller unless the command was HEAD,\r
+        and must be closed by the caller under all circumstances), or\r
+        None, in which case the caller has nothing further to do.\r
+\r
+        """\r
+        path = self.translate_path(self.path)\r
+        f = None\r
+        if os.path.isdir(path):\r
+            parts = urlparse.urlsplit(self.path)\r
+            if not parts.path.endswith('/'):\r
+                # redirect browser - doing basically what apache does\r
+                self.send_response(301)\r
+                new_parts = (parts[0], parts[1], parts[2] + '/',\r
+                             parts[3], parts[4])\r
+                new_url = urlparse.urlunsplit(new_parts)\r
+                self.send_header("Location", new_url)\r
+                self.end_headers()\r
+                return None\r
+            for index in "index.html", "index.htm":\r
+                index = os.path.join(path, index)\r
+                if os.path.exists(index):\r
+                    path = index\r
+                    break\r
+            else:\r
+                return self.list_directory(path)\r
+        ctype = self.guess_type(path)\r
+        try:\r
+            # Always read in binary mode. Opening files in text mode may cause\r
+            # newline translations, making the actual size of the content\r
+            # transmitted *less* than the content-length!\r
+            f = open(path, 'rb')\r
+        except IOError:\r
+            self.send_error(404, "File not found")\r
+            return None\r
+        try:\r
+            self.send_response(200)\r
+            self.send_header("Content-type", ctype)\r
+            fs = os.fstat(f.fileno())\r
+            self.send_header("Content-Length", str(fs[6]))\r
+            self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))\r
+            self.end_headers()\r
+            return f\r
+        except:\r
+            f.close()\r
+            raise\r
+\r
+    def list_directory(self, path):\r
+        """Helper to produce a directory listing (absent index.html).\r
+\r
+        Return value is either a file object, or None (indicating an\r
+        error).  In either case, the headers are sent, making the\r
+        interface the same as for send_head().\r
+\r
+        """\r
+        try:\r
+            list = os.listdir(path)\r
+        except os.error:\r
+            self.send_error(404, "No permission to list directory")\r
+            return None\r
+        list.sort(key=lambda a: a.lower())\r
+        f = StringIO()\r
+        displaypath = cgi.escape(urllib.unquote(self.path))\r
+        f.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">')\r
+        f.write("<html>\n<title>Directory listing for %s</title>\n" % displaypath)\r
+        f.write("<body>\n<h2>Directory listing for %s</h2>\n" % displaypath)\r
+        f.write("<hr>\n<ul>\n")\r
+        for name in list:\r
+            fullname = os.path.join(path, name)\r
+            displayname = linkname = name\r
+            # Append / for directories or @ for symbolic links\r
+            if os.path.isdir(fullname):\r
+                displayname = name + "/"\r
+                linkname = name + "/"\r
+            if os.path.islink(fullname):\r
+                displayname = name + "@"\r
+                # Note: a link to a directory displays with @ and links with /\r
+            f.write('<li><a href="%s">%s</a>\n'\r
+                    % (urllib.quote(linkname), cgi.escape(displayname)))\r
+        f.write("</ul>\n<hr>\n</body>\n</html>\n")\r
+        length = f.tell()\r
+        f.seek(0)\r
+        self.send_response(200)\r
+        encoding = sys.getfilesystemencoding()\r
+        self.send_header("Content-type", "text/html; charset=%s" % encoding)\r
+        self.send_header("Content-Length", str(length))\r
+        self.end_headers()\r
+        return f\r
+\r
+    def translate_path(self, path):\r
+        """Translate a /-separated PATH to the local filename syntax.\r
+\r
+        Components that mean special things to the local file system\r
+        (e.g. drive or directory names) are ignored.  (XXX They should\r
+        probably be diagnosed.)\r
+\r
+        """\r
+        # abandon query parameters\r
+        path = path.split('?',1)[0]\r
+        path = path.split('#',1)[0]\r
+        # Don't forget explicit trailing slash when normalizing. Issue17324\r
+        trailing_slash = path.rstrip().endswith('/')\r
+        path = posixpath.normpath(urllib.unquote(path))\r
+        words = path.split('/')\r
+        words = filter(None, words)\r
+        path = os.getcwd()\r
+        for word in words:\r
+            drive, word = os.path.splitdrive(word)\r
+            head, word = os.path.split(word)\r
+            if word in (os.curdir, os.pardir): continue\r
+            path = os.path.join(path, word)\r
+        if trailing_slash:\r
+            path += '/'\r
+        return path\r
+\r
+    def copyfile(self, source, outputfile):\r
+        """Copy all data between two file objects.\r
+\r
+        The SOURCE argument is a file object open for reading\r
+        (or anything with a read() method) and the DESTINATION\r
+        argument is a file object open for writing (or\r
+        anything with a write() method).\r
+\r
+        The only reason for overriding this would be to change\r
+        the block size or perhaps to replace newlines by CRLF\r
+        -- note however that this the default server uses this\r
+        to copy binary data as well.\r
+\r
+        """\r
+        shutil.copyfileobj(source, outputfile)\r
+\r
+    def guess_type(self, path):\r
+        """Guess the type of a file.\r
+\r
+        Argument is a PATH (a filename).\r
+\r
+        Return value is a string of the form type/subtype,\r
+        usable for a MIME Content-type header.\r
+\r
+        The default implementation looks the file's extension\r
+        up in the table self.extensions_map, using application/octet-stream\r
+        as a default; however it would be permissible (if\r
+        slow) to look inside the data to make a better guess.\r
+\r
+        """\r
+\r
+        base, ext = posixpath.splitext(path)\r
+        if ext in self.extensions_map:\r
+            return self.extensions_map[ext]\r
+        ext = ext.lower()\r
+        if ext in self.extensions_map:\r
+            return self.extensions_map[ext]\r
+        else:\r
+            return self.extensions_map['']\r
+\r
+    if not mimetypes.inited:\r
+        mimetypes.init() # try to read system mime.types\r
+    extensions_map = mimetypes.types_map.copy()\r
+    extensions_map.update({\r
+        '': 'application/octet-stream', # Default\r
+        '.py': 'text/plain',\r
+        '.c': 'text/plain',\r
+        '.h': 'text/plain',\r
+        })\r
+\r
+\r
+def test(HandlerClass = SimpleHTTPRequestHandler,\r
+         ServerClass = BaseHTTPServer.HTTPServer):\r
+    BaseHTTPServer.test(HandlerClass, ServerClass)\r
+\r
+\r
+if __name__ == '__main__':\r
+    test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/SocketServer.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/SocketServer.py
new file mode 100644 (file)
index 0000000..64a53d4
--- /dev/null
@@ -0,0 +1,737 @@
+"""Generic socket server classes.\r
+\r
+This module tries to capture the various aspects of defining a server:\r
+\r
+For socket-based servers:\r
+\r
+- address family:\r
+        - AF_INET{,6}: IP (Internet Protocol) sockets (default)\r
+        - AF_UNIX: Unix domain sockets\r
+        - others, e.g. AF_DECNET are conceivable (see <socket.h>\r
+- socket type:\r
+        - SOCK_STREAM (reliable stream, e.g. TCP)\r
+        - SOCK_DGRAM (datagrams, e.g. UDP)\r
+\r
+For request-based servers (including socket-based):\r
+\r
+- client address verification before further looking at the request\r
+        (This is actually a hook for any processing that needs to look\r
+         at the request before anything else, e.g. logging)\r
+- how to handle multiple requests:\r
+        - synchronous (one request is handled at a time)\r
+        - forking (each request is handled by a new process)\r
+        - threading (each request is handled by a new thread)\r
+\r
+The classes in this module favor the server type that is simplest to\r
+write: a synchronous TCP/IP server.  This is bad class design, but\r
+save some typing.  (There's also the issue that a deep class hierarchy\r
+slows down method lookups.)\r
+\r
+There are five classes in an inheritance diagram, four of which represent\r
+synchronous servers of four types:\r
+\r
+        +------------+\r
+        | BaseServer |\r
+        +------------+\r
+              |\r
+              v\r
+        +-----------+        +------------------+\r
+        | TCPServer |------->| UnixStreamServer |\r
+        +-----------+        +------------------+\r
+              |\r
+              v\r
+        +-----------+        +--------------------+\r
+        | UDPServer |------->| UnixDatagramServer |\r
+        +-----------+        +--------------------+\r
+\r
+Note that UnixDatagramServer derives from UDPServer, not from\r
+UnixStreamServer -- the only difference between an IP and a Unix\r
+stream server is the address family, which is simply repeated in both\r
+unix server classes.\r
+\r
+Forking and threading versions of each type of server can be created\r
+using the ForkingMixIn and ThreadingMixIn mix-in classes.  For\r
+instance, a threading UDP server class is created as follows:\r
+\r
+        class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass\r
+\r
+The Mix-in class must come first, since it overrides a method defined\r
+in UDPServer! Setting the various member variables also changes\r
+the behavior of the underlying server mechanism.\r
+\r
+To implement a service, you must derive a class from\r
+BaseRequestHandler and redefine its handle() method.  You can then run\r
+various versions of the service by combining one of the server classes\r
+with your request handler class.\r
+\r
+The request handler class must be different for datagram or stream\r
+services.  This can be hidden by using the request handler\r
+subclasses StreamRequestHandler or DatagramRequestHandler.\r
+\r
+Of course, you still have to use your head!\r
+\r
+For instance, it makes no sense to use a forking server if the service\r
+contains state in memory that can be modified by requests (since the\r
+modifications in the child process would never reach the initial state\r
+kept in the parent process and passed to each child).  In this case,\r
+you can use a threading server, but you will probably have to use\r
+locks to avoid two requests that come in nearly simultaneous to apply\r
+conflicting changes to the server state.\r
+\r
+On the other hand, if you are building e.g. an HTTP server, where all\r
+data is stored externally (e.g. in the file system), a synchronous\r
+class will essentially render the service "deaf" while one request is\r
+being handled -- which may be for a very long time if a client is slow\r
+to read all the data it has requested.  Here a threading or forking\r
+server is appropriate.\r
+\r
+In some cases, it may be appropriate to process part of a request\r
+synchronously, but to finish processing in a forked child depending on\r
+the request data.  This can be implemented by using a synchronous\r
+server and doing an explicit fork in the request handler class\r
+handle() method.\r
+\r
+Another approach to handling multiple simultaneous requests in an\r
+environment that supports neither threads nor fork (or where these are\r
+too expensive or inappropriate for the service) is to maintain an\r
+explicit table of partially finished requests and to use select() to\r
+decide which request to work on next (or whether to handle a new\r
+incoming request).  This is particularly important for stream services\r
+where each client can potentially be connected for a long time (if\r
+threads or subprocesses cannot be used).\r
+\r
+Future work:\r
+- Standard classes for Sun RPC (which uses either UDP or TCP)\r
+- Standard mix-in classes to implement various authentication\r
+  and encryption schemes\r
+- Standard framework for select-based multiplexing\r
+\r
+XXX Open problems:\r
+- What to do with out-of-band data?\r
+\r
+BaseServer:\r
+- split generic "request" functionality out into BaseServer class.\r
+  Copyright (C) 2000  Luke Kenneth Casson Leighton <lkcl@samba.org>\r
+\r
+  example: read entries from a SQL database (requires overriding\r
+  get_request() to return a table entry from the database).\r
+  entry is processed by a RequestHandlerClass.\r
+\r
+"""\r
+\r
+# Author of the BaseServer patch: Luke Kenneth Casson Leighton\r
+\r
+# XXX Warning!\r
+# There is a test suite for this module, but it cannot be run by the\r
+# standard regression test.\r
+# To run it manually, run Lib/test/test_socketserver.py.\r
+\r
+__version__ = "0.4"\r
+\r
+\r
+import socket\r
+import select\r
+import sys\r
+import os\r
+import errno\r
+try:\r
+    import threading\r
+except ImportError:\r
+    import dummy_threading as threading\r
+\r
+__all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer",\r
+           "ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler",\r
+           "StreamRequestHandler","DatagramRequestHandler",\r
+           "ThreadingMixIn", "ForkingMixIn"]\r
+if hasattr(socket, "AF_UNIX"):\r
+    __all__.extend(["UnixStreamServer","UnixDatagramServer",\r
+                    "ThreadingUnixStreamServer",\r
+                    "ThreadingUnixDatagramServer"])\r
+\r
+def _eintr_retry(func, *args):\r
+    """restart a system call interrupted by EINTR"""\r
+    while True:\r
+        try:\r
+            return func(*args)\r
+        except (OSError, select.error) as e:\r
+            if e.args[0] != errno.EINTR:\r
+                raise\r
+\r
+class BaseServer:\r
+\r
+    """Base class for server classes.\r
+\r
+    Methods for the caller:\r
+\r
+    - __init__(server_address, RequestHandlerClass)\r
+    - serve_forever(poll_interval=0.5)\r
+    - shutdown()\r
+    - handle_request()  # if you do not use serve_forever()\r
+    - fileno() -> int   # for select()\r
+\r
+    Methods that may be overridden:\r
+\r
+    - server_bind()\r
+    - server_activate()\r
+    - get_request() -> request, client_address\r
+    - handle_timeout()\r
+    - verify_request(request, client_address)\r
+    - server_close()\r
+    - process_request(request, client_address)\r
+    - shutdown_request(request)\r
+    - close_request(request)\r
+    - handle_error()\r
+\r
+    Methods for derived classes:\r
+\r
+    - finish_request(request, client_address)\r
+\r
+    Class variables that may be overridden by derived classes or\r
+    instances:\r
+\r
+    - timeout\r
+    - address_family\r
+    - socket_type\r
+    - allow_reuse_address\r
+\r
+    Instance variables:\r
+\r
+    - RequestHandlerClass\r
+    - socket\r
+\r
+    """\r
+\r
+    timeout = None\r
+\r
+    def __init__(self, server_address, RequestHandlerClass):\r
+        """Constructor.  May be extended, do not override."""\r
+        self.server_address = server_address\r
+        self.RequestHandlerClass = RequestHandlerClass\r
+        self.__is_shut_down = threading.Event()\r
+        self.__shutdown_request = False\r
+\r
+    def server_activate(self):\r
+        """Called by constructor to activate the server.\r
+\r
+        May be overridden.\r
+\r
+        """\r
+        pass\r
+\r
+    def serve_forever(self, poll_interval=0.5):\r
+        """Handle one request at a time until shutdown.\r
+\r
+        Polls for shutdown every poll_interval seconds. Ignores\r
+        self.timeout. If you need to do periodic tasks, do them in\r
+        another thread.\r
+        """\r
+        self.__is_shut_down.clear()\r
+        try:\r
+            while not self.__shutdown_request:\r
+                # XXX: Consider using another file descriptor or\r
+                # connecting to the socket to wake this up instead of\r
+                # polling. Polling reduces our responsiveness to a\r
+                # shutdown request and wastes cpu at all other times.\r
+                r, w, e = _eintr_retry(select.select, [self], [], [],\r
+                                       poll_interval)\r
+                if self in r:\r
+                    self._handle_request_noblock()\r
+        finally:\r
+            self.__shutdown_request = False\r
+            self.__is_shut_down.set()\r
+\r
+    def shutdown(self):\r
+        """Stops the serve_forever loop.\r
+\r
+        Blocks until the loop has finished. This must be called while\r
+        serve_forever() is running in another thread, or it will\r
+        deadlock.\r
+        """\r
+        self.__shutdown_request = True\r
+        self.__is_shut_down.wait()\r
+\r
+    # The distinction between handling, getting, processing and\r
+    # finishing a request is fairly arbitrary.  Remember:\r
+    #\r
+    # - handle_request() is the top-level call.  It calls\r
+    #   select, get_request(), verify_request() and process_request()\r
+    # - get_request() is different for stream or datagram sockets\r
+    # - process_request() is the place that may fork a new process\r
+    #   or create a new thread to finish the request\r
+    # - finish_request() instantiates the request handler class;\r
+    #   this constructor will handle the request all by itself\r
+\r
+    def handle_request(self):\r
+        """Handle one request, possibly blocking.\r
+\r
+        Respects self.timeout.\r
+        """\r
+        # Support people who used socket.settimeout() to escape\r
+        # handle_request before self.timeout was available.\r
+        timeout = self.socket.gettimeout()\r
+        if timeout is None:\r
+            timeout = self.timeout\r
+        elif self.timeout is not None:\r
+            timeout = min(timeout, self.timeout)\r
+        fd_sets = _eintr_retry(select.select, [self], [], [], timeout)\r
+        if not fd_sets[0]:\r
+            self.handle_timeout()\r
+            return\r
+        self._handle_request_noblock()\r
+\r
+    def _handle_request_noblock(self):\r
+        """Handle one request, without blocking.\r
+\r
+        I assume that select.select has returned that the socket is\r
+        readable before this function was called, so there should be\r
+        no risk of blocking in get_request().\r
+        """\r
+        try:\r
+            request, client_address = self.get_request()\r
+        except socket.error:\r
+            return\r
+        if self.verify_request(request, client_address):\r
+            try:\r
+                self.process_request(request, client_address)\r
+            except:\r
+                self.handle_error(request, client_address)\r
+                self.shutdown_request(request)\r
+\r
+    def handle_timeout(self):\r
+        """Called if no new request arrives within self.timeout.\r
+\r
+        Overridden by ForkingMixIn.\r
+        """\r
+        pass\r
+\r
+    def verify_request(self, request, client_address):\r
+        """Verify the request.  May be overridden.\r
+\r
+        Return True if we should proceed with this request.\r
+\r
+        """\r
+        return True\r
+\r
+    def process_request(self, request, client_address):\r
+        """Call finish_request.\r
+\r
+        Overridden by ForkingMixIn and ThreadingMixIn.\r
+\r
+        """\r
+        self.finish_request(request, client_address)\r
+        self.shutdown_request(request)\r
+\r
+    def server_close(self):\r
+        """Called to clean-up the server.\r
+\r
+        May be overridden.\r
+\r
+        """\r
+        pass\r
+\r
+    def finish_request(self, request, client_address):\r
+        """Finish one request by instantiating RequestHandlerClass."""\r
+        self.RequestHandlerClass(request, client_address, self)\r
+\r
+    def shutdown_request(self, request):\r
+        """Called to shutdown and close an individual request."""\r
+        self.close_request(request)\r
+\r
+    def close_request(self, request):\r
+        """Called to clean up an individual request."""\r
+        pass\r
+\r
+    def handle_error(self, request, client_address):\r
+        """Handle an error gracefully.  May be overridden.\r
+\r
+        The default is to print a traceback and continue.\r
+\r
+        """\r
+        print '-'*40\r
+        print 'Exception happened during processing of request from',\r
+        print client_address\r
+        import traceback\r
+        traceback.print_exc() # XXX But this goes to stderr!\r
+        print '-'*40\r
+\r
+\r
+class TCPServer(BaseServer):\r
+\r
+    """Base class for various socket-based server classes.\r
+\r
+    Defaults to synchronous IP stream (i.e., TCP).\r
+\r
+    Methods for the caller:\r
+\r
+    - __init__(server_address, RequestHandlerClass, bind_and_activate=True)\r
+    - serve_forever(poll_interval=0.5)\r
+    - shutdown()\r
+    - handle_request()  # if you don't use serve_forever()\r
+    - fileno() -> int   # for select()\r
+\r
+    Methods that may be overridden:\r
+\r
+    - server_bind()\r
+    - server_activate()\r
+    - get_request() -> request, client_address\r
+    - handle_timeout()\r
+    - verify_request(request, client_address)\r
+    - process_request(request, client_address)\r
+    - shutdown_request(request)\r
+    - close_request(request)\r
+    - handle_error()\r
+\r
+    Methods for derived classes:\r
+\r
+    - finish_request(request, client_address)\r
+\r
+    Class variables that may be overridden by derived classes or\r
+    instances:\r
+\r
+    - timeout\r
+    - address_family\r
+    - socket_type\r
+    - request_queue_size (only for stream sockets)\r
+    - allow_reuse_address\r
+\r
+    Instance variables:\r
+\r
+    - server_address\r
+    - RequestHandlerClass\r
+    - socket\r
+\r
+    """\r
+\r
+    address_family = socket.AF_INET\r
+\r
+    socket_type = socket.SOCK_STREAM\r
+\r
+    request_queue_size = 5\r
+\r
+    allow_reuse_address = False\r
+\r
+    def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True):\r
+        """Constructor.  May be extended, do not override."""\r
+        BaseServer.__init__(self, server_address, RequestHandlerClass)\r
+        self.socket = socket.socket(self.address_family,\r
+                                    self.socket_type)\r
+        if bind_and_activate:\r
+            try:\r
+                self.server_bind()\r
+                self.server_activate()\r
+            except:\r
+                self.server_close()\r
+                raise\r
+\r
+    def server_bind(self):\r
+        """Called by constructor to bind the socket.\r
+\r
+        May be overridden.\r
+\r
+        """\r
+        if self.allow_reuse_address:\r
+            self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\r
+        self.socket.bind(self.server_address)\r
+        self.server_address = self.socket.getsockname()\r
+\r
+    def server_activate(self):\r
+        """Called by constructor to activate the server.\r
+\r
+        May be overridden.\r
+\r
+        """\r
+        self.socket.listen(self.request_queue_size)\r
+\r
+    def server_close(self):\r
+        """Called to clean-up the server.\r
+\r
+        May be overridden.\r
+\r
+        """\r
+        self.socket.close()\r
+\r
+    def fileno(self):\r
+        """Return socket file number.\r
+\r
+        Interface required by select().\r
+\r
+        """\r
+        return self.socket.fileno()\r
+\r
+    def get_request(self):\r
+        """Get the request and client address from the socket.\r
+\r
+        May be overridden.\r
+\r
+        """\r
+        return self.socket.accept()\r
+\r
+    def shutdown_request(self, request):\r
+        """Called to shutdown and close an individual request."""\r
+        try:\r
+            #explicitly shutdown.  socket.close() merely releases\r
+            #the socket and waits for GC to perform the actual close.\r
+            request.shutdown(socket.SHUT_WR)\r
+        except socket.error:\r
+            pass #some platforms may raise ENOTCONN here\r
+        self.close_request(request)\r
+\r
+    def close_request(self, request):\r
+        """Called to clean up an individual request."""\r
+        request.close()\r
+\r
+\r
+class UDPServer(TCPServer):\r
+\r
+    """UDP server class."""\r
+\r
+    allow_reuse_address = False\r
+\r
+    socket_type = socket.SOCK_DGRAM\r
+\r
+    max_packet_size = 8192\r
+\r
+    def get_request(self):\r
+        data, client_addr = self.socket.recvfrom(self.max_packet_size)\r
+        return (data, self.socket), client_addr\r
+\r
+    def server_activate(self):\r
+        # No need to call listen() for UDP.\r
+        pass\r
+\r
+    def shutdown_request(self, request):\r
+        # No need to shutdown anything.\r
+        self.close_request(request)\r
+\r
+    def close_request(self, request):\r
+        # No need to close anything.\r
+        pass\r
+\r
+class ForkingMixIn:\r
+\r
+    """Mix-in class to handle each request in a new process."""\r
+\r
+    timeout = 300\r
+    active_children = None\r
+    max_children = 40\r
+\r
+    def collect_children(self):\r
+        """Internal routine to wait for children that have exited."""\r
+        if self.active_children is None:\r
+            return\r
+\r
+        # If we're above the max number of children, wait and reap them until\r
+        # we go back below threshold. Note that we use waitpid(-1) below to be\r
+        # able to collect children in size(<defunct children>) syscalls instead\r
+        # of size(<children>): the downside is that this might reap children\r
+        # which we didn't spawn, which is why we only resort to this when we're\r
+        # above max_children.\r
+        while len(self.active_children) >= self.max_children:\r
+            try:\r
+                pid, _ = os.waitpid(-1, 0)\r
+                self.active_children.discard(pid)\r
+            except OSError as e:\r
+                if e.errno == errno.ECHILD:\r
+                    # we don't have any children, we're done\r
+                    self.active_children.clear()\r
+                elif e.errno != errno.EINTR:\r
+                    break\r
+\r
+        # Now reap all defunct children.\r
+        for pid in self.active_children.copy():\r
+            try:\r
+                pid, _ = os.waitpid(pid, os.WNOHANG)\r
+                # if the child hasn't exited yet, pid will be 0 and ignored by\r
+                # discard() below\r
+                self.active_children.discard(pid)\r
+            except OSError as e:\r
+                if e.errno == errno.ECHILD:\r
+                    # someone else reaped it\r
+                    self.active_children.discard(pid)\r
+\r
+    def handle_timeout(self):\r
+        """Wait for zombies after self.timeout seconds of inactivity.\r
+\r
+        May be extended, do not override.\r
+        """\r
+        self.collect_children()\r
+\r
+    def process_request(self, request, client_address):\r
+        """Fork a new subprocess to process the request."""\r
+        self.collect_children()\r
+        pid = os.fork()\r
+        if pid:\r
+            # Parent process\r
+            if self.active_children is None:\r
+                self.active_children = set()\r
+            self.active_children.add(pid)\r
+            self.close_request(request) #close handle in parent process\r
+            return\r
+        else:\r
+            # Child process.\r
+            # This must never return, hence os._exit()!\r
+            try:\r
+                self.finish_request(request, client_address)\r
+                self.shutdown_request(request)\r
+                os._exit(0)\r
+            except:\r
+                try:\r
+                    self.handle_error(request, client_address)\r
+                    self.shutdown_request(request)\r
+                finally:\r
+                    os._exit(1)\r
+\r
+\r
+class ThreadingMixIn:\r
+    """Mix-in class to handle each request in a new thread."""\r
+\r
+    # Decides how threads will act upon termination of the\r
+    # main process\r
+    daemon_threads = False\r
+\r
+    def process_request_thread(self, request, client_address):\r
+        """Same as in BaseServer but as a thread.\r
+\r
+        In addition, exception handling is done here.\r
+\r
+        """\r
+        try:\r
+            self.finish_request(request, client_address)\r
+            self.shutdown_request(request)\r
+        except:\r
+            self.handle_error(request, client_address)\r
+            self.shutdown_request(request)\r
+\r
+    def process_request(self, request, client_address):\r
+        """Start a new thread to process the request."""\r
+        t = threading.Thread(target = self.process_request_thread,\r
+                             args = (request, client_address))\r
+        t.daemon = self.daemon_threads\r
+        t.start()\r
+\r
+\r
+class ForkingUDPServer(ForkingMixIn, UDPServer): pass\r
+class ForkingTCPServer(ForkingMixIn, TCPServer): pass\r
+\r
+class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass\r
+class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass\r
+\r
+if hasattr(socket, 'AF_UNIX'):\r
+\r
+    class UnixStreamServer(TCPServer):\r
+        address_family = socket.AF_UNIX\r
+\r
+    class UnixDatagramServer(UDPServer):\r
+        address_family = socket.AF_UNIX\r
+\r
+    class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): pass\r
+\r
+    class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): pass\r
+\r
+class BaseRequestHandler:\r
+\r
+    """Base class for request handler classes.\r
+\r
+    This class is instantiated for each request to be handled.  The\r
+    constructor sets the instance variables request, client_address\r
+    and server, and then calls the handle() method.  To implement a\r
+    specific service, all you need to do is to derive a class which\r
+    defines a handle() method.\r
+\r
+    The handle() method can find the request as self.request, the\r
+    client address as self.client_address, and the server (in case it\r
+    needs access to per-server information) as self.server.  Since a\r
+    separate instance is created for each request, the handle() method\r
+    can define arbitrary other instance variariables.\r
+\r
+    """\r
+\r
+    def __init__(self, request, client_address, server):\r
+        self.request = request\r
+        self.client_address = client_address\r
+        self.server = server\r
+        self.setup()\r
+        try:\r
+            self.handle()\r
+        finally:\r
+            self.finish()\r
+\r
+    def setup(self):\r
+        pass\r
+\r
+    def handle(self):\r
+        pass\r
+\r
+    def finish(self):\r
+        pass\r
+\r
+\r
+# The following two classes make it possible to use the same service\r
+# class for stream or datagram servers.\r
+# Each class sets up these instance variables:\r
+# - rfile: a file object from which receives the request is read\r
+# - wfile: a file object to which the reply is written\r
+# When the handle() method returns, wfile is flushed properly\r
+\r
+\r
+class StreamRequestHandler(BaseRequestHandler):\r
+\r
+    """Define self.rfile and self.wfile for stream sockets."""\r
+\r
+    # Default buffer sizes for rfile, wfile.\r
+    # We default rfile to buffered because otherwise it could be\r
+    # really slow for large data (a getc() call per byte); we make\r
+    # wfile unbuffered because (a) often after a write() we want to\r
+    # read and we need to flush the line; (b) big writes to unbuffered\r
+    # files are typically optimized by stdio even when big reads\r
+    # aren't.\r
+    rbufsize = -1\r
+    wbufsize = 0\r
+\r
+    # A timeout to apply to the request socket, if not None.\r
+    timeout = None\r
+\r
+    # Disable nagle algorithm for this socket, if True.\r
+    # Use only when wbufsize != 0, to avoid small packets.\r
+    disable_nagle_algorithm = False\r
+\r
+    def setup(self):\r
+        self.connection = self.request\r
+        if self.timeout is not None:\r
+            self.connection.settimeout(self.timeout)\r
+        if self.disable_nagle_algorithm:\r
+            self.connection.setsockopt(socket.IPPROTO_TCP,\r
+                                       socket.TCP_NODELAY, True)\r
+        self.rfile = self.connection.makefile('rb', self.rbufsize)\r
+        self.wfile = self.connection.makefile('wb', self.wbufsize)\r
+\r
+    def finish(self):\r
+        if not self.wfile.closed:\r
+            try:\r
+                self.wfile.flush()\r
+            except socket.error:\r
+                # An final socket error may have occurred here, such as\r
+                # the local error ECONNABORTED.\r
+                pass\r
+        self.wfile.close()\r
+        self.rfile.close()\r
+\r
+\r
+class DatagramRequestHandler(BaseRequestHandler):\r
+\r
+    # XXX Regrettably, I cannot get this working on Linux;\r
+    # s.recvfrom() doesn't return a meaningful client address.\r
+\r
+    """Define self.rfile and self.wfile for datagram sockets."""\r
+\r
+    def setup(self):\r
+        try:\r
+            from cStringIO import StringIO\r
+        except ImportError:\r
+            from StringIO import StringIO\r
+        self.packet, self.socket = self.request\r
+        self.rfile = StringIO(self.packet)\r
+        self.wfile = StringIO()\r
+\r
+    def finish(self):\r
+        self.socket.sendto(self.wfile.getvalue(), self.client_address)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/StringIO.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/StringIO.py
new file mode 100644 (file)
index 0000000..92f4b79
--- /dev/null
@@ -0,0 +1,324 @@
+r"""File-like objects that read from or write to a string buffer.\r
+\r
+This implements (nearly) all stdio methods.\r
+\r
+f = StringIO()      # ready for writing\r
+f = StringIO(buf)   # ready for reading\r
+f.close()           # explicitly release resources held\r
+flag = f.isatty()   # always false\r
+pos = f.tell()      # get current position\r
+f.seek(pos)         # set current position\r
+f.seek(pos, mode)   # mode 0: absolute; 1: relative; 2: relative to EOF\r
+buf = f.read()      # read until EOF\r
+buf = f.read(n)     # read up to n bytes\r
+buf = f.readline()  # read until end of line ('\n') or EOF\r
+list = f.readlines()# list of f.readline() results until EOF\r
+f.truncate([size])  # truncate file at to at most size (default: current pos)\r
+f.write(buf)        # write at current position\r
+f.writelines(list)  # for line in list: f.write(line)\r
+f.getvalue()        # return whole file's contents as a string\r
+\r
+Notes:\r
+- Using a real file is often faster (but less convenient).\r
+- There's also a much faster implementation in C, called cStringIO, but\r
+  it's not subclassable.\r
+- fileno() is left unimplemented so that code which uses it triggers\r
+  an exception early.\r
+- Seeking far beyond EOF and then writing will insert real null\r
+  bytes that occupy space in the buffer.\r
+- There's a simple test set (see end of this file).\r
+"""\r
+try:\r
+    from errno import EINVAL\r
+except ImportError:\r
+    EINVAL = 22\r
+\r
+__all__ = ["StringIO"]\r
+\r
+def _complain_ifclosed(closed):\r
+    if closed:\r
+        raise ValueError, "I/O operation on closed file"\r
+\r
+class StringIO:\r
+    """class StringIO([buffer])\r
+\r
+    When a StringIO object is created, it can be initialized to an existing\r
+    string by passing the string to the constructor. If no string is given,\r
+    the StringIO will start empty.\r
+\r
+    The StringIO object can accept either Unicode or 8-bit strings, but\r
+    mixing the two may take some care. If both are used, 8-bit strings that\r
+    cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause\r
+    a UnicodeError to be raised when getvalue() is called.\r
+    """\r
+    def __init__(self, buf = ''):\r
+        # Force self.buf to be a string or unicode\r
+        if not isinstance(buf, basestring):\r
+            buf = str(buf)\r
+        self.buf = buf\r
+        self.len = len(buf)\r
+        self.buflist = []\r
+        self.pos = 0\r
+        self.closed = False\r
+        self.softspace = 0\r
+\r
+    def __iter__(self):\r
+        return self\r
+\r
+    def next(self):\r
+        """A file object is its own iterator, for example iter(f) returns f\r
+        (unless f is closed). When a file is used as an iterator, typically\r
+        in a for loop (for example, for line in f: print line), the next()\r
+        method is called repeatedly. This method returns the next input line,\r
+        or raises StopIteration when EOF is hit.\r
+        """\r
+        _complain_ifclosed(self.closed)\r
+        r = self.readline()\r
+        if not r:\r
+            raise StopIteration\r
+        return r\r
+\r
+    def close(self):\r
+        """Free the memory buffer.\r
+        """\r
+        if not self.closed:\r
+            self.closed = True\r
+            del self.buf, self.pos\r
+\r
+    def isatty(self):\r
+        """Returns False because StringIO objects are not connected to a\r
+        tty-like device.\r
+        """\r
+        _complain_ifclosed(self.closed)\r
+        return False\r
+\r
+    def seek(self, pos, mode = 0):\r
+        """Set the file's current position.\r
+\r
+        The mode argument is optional and defaults to 0 (absolute file\r
+        positioning); other values are 1 (seek relative to the current\r
+        position) and 2 (seek relative to the file's end).\r
+\r
+        There is no return value.\r
+        """\r
+        _complain_ifclosed(self.closed)\r
+        if self.buflist:\r
+            self.buf += ''.join(self.buflist)\r
+            self.buflist = []\r
+        if mode == 1:\r
+            pos += self.pos\r
+        elif mode == 2:\r
+            pos += self.len\r
+        self.pos = max(0, pos)\r
+\r
+    def tell(self):\r
+        """Return the file's current position."""\r
+        _complain_ifclosed(self.closed)\r
+        return self.pos\r
+\r
+    def read(self, n = -1):\r
+        """Read at most size bytes from the file\r
+        (less if the read hits EOF before obtaining size bytes).\r
+\r
+        If the size argument is negative or omitted, read all data until EOF\r
+        is reached. The bytes are returned as a string object. An empty\r
+        string is returned when EOF is encountered immediately.\r
+        """\r
+        _complain_ifclosed(self.closed)\r
+        if self.buflist:\r
+            self.buf += ''.join(self.buflist)\r
+            self.buflist = []\r
+        if n is None or n < 0:\r
+            newpos = self.len\r
+        else:\r
+            newpos = min(self.pos+n, self.len)\r
+        r = self.buf[self.pos:newpos]\r
+        self.pos = newpos\r
+        return r\r
+\r
+    def readline(self, length=None):\r
+        r"""Read one entire line from the file.\r
+\r
+        A trailing newline character is kept in the string (but may be absent\r
+        when a file ends with an incomplete line). If the size argument is\r
+        present and non-negative, it is a maximum byte count (including the\r
+        trailing newline) and an incomplete line may be returned.\r
+\r
+        An empty string is returned only when EOF is encountered immediately.\r
+\r
+        Note: Unlike stdio's fgets(), the returned string contains null\r
+        characters ('\0') if they occurred in the input.\r
+        """\r
+        _complain_ifclosed(self.closed)\r
+        if self.buflist:\r
+            self.buf += ''.join(self.buflist)\r
+            self.buflist = []\r
+        i = self.buf.find('\n', self.pos)\r
+        if i < 0:\r
+            newpos = self.len\r
+        else:\r
+            newpos = i+1\r
+        if length is not None and length >= 0:\r
+            if self.pos + length < newpos:\r
+                newpos = self.pos + length\r
+        r = self.buf[self.pos:newpos]\r
+        self.pos = newpos\r
+        return r\r
+\r
+    def readlines(self, sizehint = 0):\r
+        """Read until EOF using readline() and return a list containing the\r
+        lines thus read.\r
+\r
+        If the optional sizehint argument is present, instead of reading up\r
+        to EOF, whole lines totalling approximately sizehint bytes (or more\r
+        to accommodate a final whole line).\r
+        """\r
+        total = 0\r
+        lines = []\r
+        line = self.readline()\r
+        while line:\r
+            lines.append(line)\r
+            total += len(line)\r
+            if 0 < sizehint <= total:\r
+                break\r
+            line = self.readline()\r
+        return lines\r
+\r
+    def truncate(self, size=None):\r
+        """Truncate the file's size.\r
+\r
+        If the optional size argument is present, the file is truncated to\r
+        (at most) that size. The size defaults to the current position.\r
+        The current file position is not changed unless the position\r
+        is beyond the new file size.\r
+\r
+        If the specified size exceeds the file's current size, the\r
+        file remains unchanged.\r
+        """\r
+        _complain_ifclosed(self.closed)\r
+        if size is None:\r
+            size = self.pos\r
+        elif size < 0:\r
+            raise IOError(EINVAL, "Negative size not allowed")\r
+        elif size < self.pos:\r
+            self.pos = size\r
+        self.buf = self.getvalue()[:size]\r
+        self.len = size\r
+\r
+    def write(self, s):\r
+        """Write a string to the file.\r
+\r
+        There is no return value.\r
+        """\r
+        _complain_ifclosed(self.closed)\r
+        if not s: return\r
+        # Force s to be a string or unicode\r
+        if not isinstance(s, basestring):\r
+            s = str(s)\r
+        spos = self.pos\r
+        slen = self.len\r
+        if spos == slen:\r
+            self.buflist.append(s)\r
+            self.len = self.pos = spos + len(s)\r
+            return\r
+        if spos > slen:\r
+            self.buflist.append('\0'*(spos - slen))\r
+            slen = spos\r
+        newpos = spos + len(s)\r
+        if spos < slen:\r
+            if self.buflist:\r
+                self.buf += ''.join(self.buflist)\r
+            self.buflist = [self.buf[:spos], s, self.buf[newpos:]]\r
+            self.buf = ''\r
+            if newpos > slen:\r
+                slen = newpos\r
+        else:\r
+            self.buflist.append(s)\r
+            slen = newpos\r
+        self.len = slen\r
+        self.pos = newpos\r
+\r
+    def writelines(self, iterable):\r
+        """Write a sequence of strings to the file. The sequence can be any\r
+        iterable object producing strings, typically a list of strings. There\r
+        is no return value.\r
+\r
+        (The name is intended to match readlines(); writelines() does not add\r
+        line separators.)\r
+        """\r
+        write = self.write\r
+        for line in iterable:\r
+            write(line)\r
+\r
+    def flush(self):\r
+        """Flush the internal buffer\r
+        """\r
+        _complain_ifclosed(self.closed)\r
+\r
+    def getvalue(self):\r
+        """\r
+        Retrieve the entire contents of the "file" at any time before\r
+        the StringIO object's close() method is called.\r
+\r
+        The StringIO object can accept either Unicode or 8-bit strings,\r
+        but mixing the two may take some care. If both are used, 8-bit\r
+        strings that cannot be interpreted as 7-bit ASCII (that use the\r
+        8th bit) will cause a UnicodeError to be raised when getvalue()\r
+        is called.\r
+        """\r
+        _complain_ifclosed(self.closed)\r
+        if self.buflist:\r
+            self.buf += ''.join(self.buflist)\r
+            self.buflist = []\r
+        return self.buf\r
+\r
+\r
+# A little test suite\r
+\r
+def test():\r
+    import sys\r
+    if sys.argv[1:]:\r
+        file = sys.argv[1]\r
+    else:\r
+        file = '/etc/passwd'\r
+    lines = open(file, 'r').readlines()\r
+    text = open(file, 'r').read()\r
+    f = StringIO()\r
+    for line in lines[:-2]:\r
+        f.write(line)\r
+    f.writelines(lines[-2:])\r
+    if f.getvalue() != text:\r
+        raise RuntimeError, 'write failed'\r
+    length = f.tell()\r
+    print 'File length =', length\r
+    f.seek(len(lines[0]))\r
+    f.write(lines[1])\r
+    f.seek(0)\r
+    print 'First line =', repr(f.readline())\r
+    print 'Position =', f.tell()\r
+    line = f.readline()\r
+    print 'Second line =', repr(line)\r
+    f.seek(-len(line), 1)\r
+    line2 = f.read(len(line))\r
+    if line != line2:\r
+        raise RuntimeError, 'bad result after seek back'\r
+    f.seek(len(line2), 1)\r
+    list = f.readlines()\r
+    line = list[-1]\r
+    f.seek(f.tell() - len(line))\r
+    line2 = f.read()\r
+    if line != line2:\r
+        raise RuntimeError, 'bad result after seek back from EOF'\r
+    print 'Read', len(list), 'more lines'\r
+    print 'File length =', f.tell()\r
+    if f.tell() != length:\r
+        raise RuntimeError, 'bad length'\r
+    f.truncate(length/2)\r
+    f.seek(0, 2)\r
+    print 'Truncated length =', f.tell()\r
+    if f.tell() != length/2:\r
+        raise RuntimeError, 'truncate did not adjust length'\r
+    f.close()\r
+\r
+if __name__ == '__main__':\r
+    test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/UserDict.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/UserDict.py
new file mode 100644 (file)
index 0000000..67822a3
--- /dev/null
@@ -0,0 +1,180 @@
+"""A more or less complete user-defined wrapper around dictionary objects."""\r
+\r
+class UserDict:\r
+    def __init__(self, dict=None, **kwargs):\r
+        self.data = {}\r
+        if dict is not None:\r
+            self.update(dict)\r
+        if len(kwargs):\r
+            self.update(kwargs)\r
+    def __repr__(self): return repr(self.data)\r
+    def __cmp__(self, dict):\r
+        if isinstance(dict, UserDict):\r
+            return cmp(self.data, dict.data)\r
+        else:\r
+            return cmp(self.data, dict)\r
+    __hash__ = None # Avoid Py3k warning\r
+    def __len__(self): return len(self.data)\r
+    def __getitem__(self, key):\r
+        if key in self.data:\r
+            return self.data[key]\r
+        if hasattr(self.__class__, "__missing__"):\r
+            return self.__class__.__missing__(self, key)\r
+        raise KeyError(key)\r
+    def __setitem__(self, key, item): self.data[key] = item\r
+    def __delitem__(self, key): del self.data[key]\r
+    def clear(self): self.data.clear()\r
+    def copy(self):\r
+        if self.__class__ is UserDict:\r
+            return UserDict(self.data.copy())\r
+        import copy\r
+        data = self.data\r
+        try:\r
+            self.data = {}\r
+            c = copy.copy(self)\r
+        finally:\r
+            self.data = data\r
+        c.update(self)\r
+        return c\r
+    def keys(self): return self.data.keys()\r
+    def items(self): return self.data.items()\r
+    def iteritems(self): return self.data.iteritems()\r
+    def iterkeys(self): return self.data.iterkeys()\r
+    def itervalues(self): return self.data.itervalues()\r
+    def values(self): return self.data.values()\r
+    def has_key(self, key): return key in self.data\r
+    def update(self, dict=None, **kwargs):\r
+        if dict is None:\r
+            pass\r
+        elif isinstance(dict, UserDict):\r
+            self.data.update(dict.data)\r
+        elif isinstance(dict, type({})) or not hasattr(dict, 'items'):\r
+            self.data.update(dict)\r
+        else:\r
+            for k, v in dict.items():\r
+                self[k] = v\r
+        if len(kwargs):\r
+            self.data.update(kwargs)\r
+    def get(self, key, failobj=None):\r
+        if key not in self:\r
+            return failobj\r
+        return self[key]\r
+    def setdefault(self, key, failobj=None):\r
+        if key not in self:\r
+            self[key] = failobj\r
+        return self[key]\r
+    def pop(self, key, *args):\r
+        return self.data.pop(key, *args)\r
+    def popitem(self):\r
+        return self.data.popitem()\r
+    def __contains__(self, key):\r
+        return key in self.data\r
+    @classmethod\r
+    def fromkeys(cls, iterable, value=None):\r
+        d = cls()\r
+        for key in iterable:\r
+            d[key] = value\r
+        return d\r
+\r
+class IterableUserDict(UserDict):\r
+    def __iter__(self):\r
+        return iter(self.data)\r
+\r
+import _abcoll\r
+_abcoll.MutableMapping.register(IterableUserDict)\r
+\r
+\r
+class DictMixin:\r
+    # Mixin defining all dictionary methods for classes that already have\r
+    # a minimum dictionary interface including getitem, setitem, delitem,\r
+    # and keys. Without knowledge of the subclass constructor, the mixin\r
+    # does not define __init__() or copy().  In addition to the four base\r
+    # methods, progressively more efficiency comes with defining\r
+    # __contains__(), __iter__(), and iteritems().\r
+\r
+    # second level definitions support higher levels\r
+    def __iter__(self):\r
+        for k in self.keys():\r
+            yield k\r
+    def has_key(self, key):\r
+        try:\r
+            self[key]\r
+        except KeyError:\r
+            return False\r
+        return True\r
+    def __contains__(self, key):\r
+        return self.has_key(key)\r
+\r
+    # third level takes advantage of second level definitions\r
+    def iteritems(self):\r
+        for k in self:\r
+            yield (k, self[k])\r
+    def iterkeys(self):\r
+        return self.__iter__()\r
+\r
+    # fourth level uses definitions from lower levels\r
+    def itervalues(self):\r
+        for _, v in self.iteritems():\r
+            yield v\r
+    def values(self):\r
+        return [v for _, v in self.iteritems()]\r
+    def items(self):\r
+        return list(self.iteritems())\r
+    def clear(self):\r
+        for key in self.keys():\r
+            del self[key]\r
+    def setdefault(self, key, default=None):\r
+        try:\r
+            return self[key]\r
+        except KeyError:\r
+            self[key] = default\r
+        return default\r
+    def pop(self, key, *args):\r
+        if len(args) > 1:\r
+            raise TypeError, "pop expected at most 2 arguments, got "\\r
+                              + repr(1 + len(args))\r
+        try:\r
+            value = self[key]\r
+        except KeyError:\r
+            if args:\r
+                return args[0]\r
+            raise\r
+        del self[key]\r
+        return value\r
+    def popitem(self):\r
+        try:\r
+            k, v = self.iteritems().next()\r
+        except StopIteration:\r
+            raise KeyError, 'container is empty'\r
+        del self[k]\r
+        return (k, v)\r
+    def update(self, other=None, **kwargs):\r
+        # Make progressively weaker assumptions about "other"\r
+        if other is None:\r
+            pass\r
+        elif hasattr(other, 'iteritems'):  # iteritems saves memory and lookups\r
+            for k, v in other.iteritems():\r
+                self[k] = v\r
+        elif hasattr(other, 'keys'):\r
+            for k in other.keys():\r
+                self[k] = other[k]\r
+        else:\r
+            for k, v in other:\r
+                self[k] = v\r
+        if kwargs:\r
+            self.update(kwargs)\r
+    def get(self, key, default=None):\r
+        try:\r
+            return self[key]\r
+        except KeyError:\r
+            return default\r
+    def __repr__(self):\r
+        return repr(dict(self.iteritems()))\r
+    def __cmp__(self, other):\r
+        if other is None:\r
+            return 1\r
+        if isinstance(other, DictMixin):\r
+            other = dict(other.iteritems())\r
+        return cmp(dict(self.iteritems()), other)\r
+    def __len__(self):\r
+        return len(self.keys())\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/_abcoll.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/_abcoll.py
new file mode 100644 (file)
index 0000000..62f4051
--- /dev/null
@@ -0,0 +1,692 @@
+# Copyright 2007 Google, Inc. All Rights Reserved.\r
+# Licensed to PSF under a Contributor Agreement.\r
+\r
+"""Abstract Base Classes (ABCs) for collections, according to PEP 3119.\r
+\r
+DON'T USE THIS MODULE DIRECTLY!  The classes here should be imported\r
+via collections; they are defined here only to alleviate certain\r
+bootstrapping issues.  Unit tests are in test_collections.\r
+"""\r
+\r
+from abc import ABCMeta, abstractmethod\r
+import sys\r
+\r
+__all__ = ["Hashable", "Iterable", "Iterator",\r
+           "Sized", "Container", "Callable",\r
+           "Set", "MutableSet",\r
+           "Mapping", "MutableMapping",\r
+           "MappingView", "KeysView", "ItemsView", "ValuesView",\r
+           "Sequence", "MutableSequence",\r
+           ]\r
+\r
+### ONE-TRICK PONIES ###\r
+\r
+def _hasattr(C, attr):\r
+    try:\r
+        return any(attr in B.__dict__ for B in C.__mro__)\r
+    except AttributeError:\r
+        # Old-style class\r
+        return hasattr(C, attr)\r
+\r
+\r
+class Hashable:\r
+    __metaclass__ = ABCMeta\r
+\r
+    @abstractmethod\r
+    def __hash__(self):\r
+        return 0\r
+\r
+    @classmethod\r
+    def __subclasshook__(cls, C):\r
+        if cls is Hashable:\r
+            try:\r
+                for B in C.__mro__:\r
+                    if "__hash__" in B.__dict__:\r
+                        if B.__dict__["__hash__"]:\r
+                            return True\r
+                        break\r
+            except AttributeError:\r
+                # Old-style class\r
+                if getattr(C, "__hash__", None):\r
+                    return True\r
+        return NotImplemented\r
+\r
+\r
+class Iterable:\r
+    __metaclass__ = ABCMeta\r
+\r
+    @abstractmethod\r
+    def __iter__(self):\r
+        while False:\r
+            yield None\r
+\r
+    @classmethod\r
+    def __subclasshook__(cls, C):\r
+        if cls is Iterable:\r
+            if _hasattr(C, "__iter__"):\r
+                return True\r
+        return NotImplemented\r
+\r
+Iterable.register(str)\r
+\r
+\r
+class Iterator(Iterable):\r
+\r
+    @abstractmethod\r
+    def next(self):\r
+        'Return the next item from the iterator. When exhausted, raise StopIteration'\r
+        raise StopIteration\r
+\r
+    def __iter__(self):\r
+        return self\r
+\r
+    @classmethod\r
+    def __subclasshook__(cls, C):\r
+        if cls is Iterator:\r
+            if _hasattr(C, "next") and _hasattr(C, "__iter__"):\r
+                return True\r
+        return NotImplemented\r
+\r
+\r
+class Sized:\r
+    __metaclass__ = ABCMeta\r
+\r
+    @abstractmethod\r
+    def __len__(self):\r
+        return 0\r
+\r
+    @classmethod\r
+    def __subclasshook__(cls, C):\r
+        if cls is Sized:\r
+            if _hasattr(C, "__len__"):\r
+                return True\r
+        return NotImplemented\r
+\r
+\r
+class Container:\r
+    __metaclass__ = ABCMeta\r
+\r
+    @abstractmethod\r
+    def __contains__(self, x):\r
+        return False\r
+\r
+    @classmethod\r
+    def __subclasshook__(cls, C):\r
+        if cls is Container:\r
+            if _hasattr(C, "__contains__"):\r
+                return True\r
+        return NotImplemented\r
+\r
+\r
+class Callable:\r
+    __metaclass__ = ABCMeta\r
+\r
+    @abstractmethod\r
+    def __call__(self, *args, **kwds):\r
+        return False\r
+\r
+    @classmethod\r
+    def __subclasshook__(cls, C):\r
+        if cls is Callable:\r
+            if _hasattr(C, "__call__"):\r
+                return True\r
+        return NotImplemented\r
+\r
+\r
+### SETS ###\r
+\r
+\r
+class Set(Sized, Iterable, Container):\r
+    """A set is a finite, iterable container.\r
+\r
+    This class provides concrete generic implementations of all\r
+    methods except for __contains__, __iter__ and __len__.\r
+\r
+    To override the comparisons (presumably for speed, as the\r
+    semantics are fixed), redefine __le__ and __ge__,\r
+    then the other operations will automatically follow suit.\r
+    """\r
+\r
+    def __le__(self, other):\r
+        if not isinstance(other, Set):\r
+            return NotImplemented\r
+        if len(self) > len(other):\r
+            return False\r
+        for elem in self:\r
+            if elem not in other:\r
+                return False\r
+        return True\r
+\r
+    def __lt__(self, other):\r
+        if not isinstance(other, Set):\r
+            return NotImplemented\r
+        return len(self) < len(other) and self.__le__(other)\r
+\r
+    def __gt__(self, other):\r
+        if not isinstance(other, Set):\r
+            return NotImplemented\r
+        return len(self) > len(other) and self.__ge__(other)\r
+\r
+    def __ge__(self, other):\r
+        if not isinstance(other, Set):\r
+            return NotImplemented\r
+        if len(self) < len(other):\r
+            return False\r
+        for elem in other:\r
+            if elem not in self:\r
+                return False\r
+        return True\r
+\r
+    def __eq__(self, other):\r
+        if not isinstance(other, Set):\r
+            return NotImplemented\r
+        return len(self) == len(other) and self.__le__(other)\r
+\r
+    def __ne__(self, other):\r
+        return not (self == other)\r
+\r
+    @classmethod\r
+    def _from_iterable(cls, it):\r
+        '''Construct an instance of the class from any iterable input.\r
+\r
+        Must override this method if the class constructor signature\r
+        does not accept an iterable for an input.\r
+        '''\r
+        return cls(it)\r
+\r
+    def __and__(self, other):\r
+        if not isinstance(other, Iterable):\r
+            return NotImplemented\r
+        return self._from_iterable(value for value in other if value in self)\r
+\r
+    __rand__ = __and__\r
+\r
+    def isdisjoint(self, other):\r
+        'Return True if two sets have a null intersection.'\r
+        for value in other:\r
+            if value in self:\r
+                return False\r
+        return True\r
+\r
+    def __or__(self, other):\r
+        if not isinstance(other, Iterable):\r
+            return NotImplemented\r
+        chain = (e for s in (self, other) for e in s)\r
+        return self._from_iterable(chain)\r
+\r
+    __ror__ = __or__\r
+\r
+    def __sub__(self, other):\r
+        if not isinstance(other, Set):\r
+            if not isinstance(other, Iterable):\r
+                return NotImplemented\r
+            other = self._from_iterable(other)\r
+        return self._from_iterable(value for value in self\r
+                                   if value not in other)\r
+\r
+    def __rsub__(self, other):\r
+        if not isinstance(other, Set):\r
+            if not isinstance(other, Iterable):\r
+                return NotImplemented\r
+            other = self._from_iterable(other)\r
+        return self._from_iterable(value for value in other\r
+                                   if value not in self)\r
+\r
+    def __xor__(self, other):\r
+        if not isinstance(other, Set):\r
+            if not isinstance(other, Iterable):\r
+                return NotImplemented\r
+            other = self._from_iterable(other)\r
+        return (self - other) | (other - self)\r
+\r
+    __rxor__ = __xor__\r
+\r
+    # Sets are not hashable by default, but subclasses can change this\r
+    __hash__ = None\r
+\r
+    def _hash(self):\r
+        """Compute the hash value of a set.\r
+\r
+        Note that we don't define __hash__: not all sets are hashable.\r
+        But if you define a hashable set type, its __hash__ should\r
+        call this function.\r
+\r
+        This must be compatible __eq__.\r
+\r
+        All sets ought to compare equal if they contain the same\r
+        elements, regardless of how they are implemented, and\r
+        regardless of the order of the elements; so there's not much\r
+        freedom for __eq__ or __hash__.  We match the algorithm used\r
+        by the built-in frozenset type.\r
+        """\r
+        MAX = sys.maxint\r
+        MASK = 2 * MAX + 1\r
+        n = len(self)\r
+        h = 1927868237 * (n + 1)\r
+        h &= MASK\r
+        for x in self:\r
+            hx = hash(x)\r
+            h ^= (hx ^ (hx << 16) ^ 89869747)  * 3644798167\r
+            h &= MASK\r
+        h = h * 69069 + 907133923\r
+        h &= MASK\r
+        if h > MAX:\r
+            h -= MASK + 1\r
+        if h == -1:\r
+            h = 590923713\r
+        return h\r
+\r
+Set.register(frozenset)\r
+\r
+\r
+class MutableSet(Set):\r
+    """A mutable set is a finite, iterable container.\r
+\r
+    This class provides concrete generic implementations of all\r
+    methods except for __contains__, __iter__, __len__,\r
+    add(), and discard().\r
+\r
+    To override the comparisons (presumably for speed, as the\r
+    semantics are fixed), all you have to do is redefine __le__ and\r
+    then the other operations will automatically follow suit.\r
+    """\r
+\r
+    @abstractmethod\r
+    def add(self, value):\r
+        """Add an element."""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def discard(self, value):\r
+        """Remove an element.  Do not raise an exception if absent."""\r
+        raise NotImplementedError\r
+\r
+    def remove(self, value):\r
+        """Remove an element. If not a member, raise a KeyError."""\r
+        if value not in self:\r
+            raise KeyError(value)\r
+        self.discard(value)\r
+\r
+    def pop(self):\r
+        """Return the popped value.  Raise KeyError if empty."""\r
+        it = iter(self)\r
+        try:\r
+            value = next(it)\r
+        except StopIteration:\r
+            raise KeyError\r
+        self.discard(value)\r
+        return value\r
+\r
+    def clear(self):\r
+        """This is slow (creates N new iterators!) but effective."""\r
+        try:\r
+            while True:\r
+                self.pop()\r
+        except KeyError:\r
+            pass\r
+\r
+    def __ior__(self, it):\r
+        for value in it:\r
+            self.add(value)\r
+        return self\r
+\r
+    def __iand__(self, it):\r
+        for value in (self - it):\r
+            self.discard(value)\r
+        return self\r
+\r
+    def __ixor__(self, it):\r
+        if it is self:\r
+            self.clear()\r
+        else:\r
+            if not isinstance(it, Set):\r
+                it = self._from_iterable(it)\r
+            for value in it:\r
+                if value in self:\r
+                    self.discard(value)\r
+                else:\r
+                    self.add(value)\r
+        return self\r
+\r
+    def __isub__(self, it):\r
+        if it is self:\r
+            self.clear()\r
+        else:\r
+            for value in it:\r
+                self.discard(value)\r
+        return self\r
+\r
+MutableSet.register(set)\r
+\r
+\r
+### MAPPINGS ###\r
+\r
+\r
+class Mapping(Sized, Iterable, Container):\r
+\r
+    """A Mapping is a generic container for associating key/value\r
+    pairs.\r
+\r
+    This class provides concrete generic implementations of all\r
+    methods except for __getitem__, __iter__, and __len__.\r
+\r
+    """\r
+\r
+    @abstractmethod\r
+    def __getitem__(self, key):\r
+        raise KeyError\r
+\r
+    def get(self, key, default=None):\r
+        'D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.'\r
+        try:\r
+            return self[key]\r
+        except KeyError:\r
+            return default\r
+\r
+    def __contains__(self, key):\r
+        try:\r
+            self[key]\r
+        except KeyError:\r
+            return False\r
+        else:\r
+            return True\r
+\r
+    def iterkeys(self):\r
+        'D.iterkeys() -> an iterator over the keys of D'\r
+        return iter(self)\r
+\r
+    def itervalues(self):\r
+        'D.itervalues() -> an iterator over the values of D'\r
+        for key in self:\r
+            yield self[key]\r
+\r
+    def iteritems(self):\r
+        'D.iteritems() -> an iterator over the (key, value) items of D'\r
+        for key in self:\r
+            yield (key, self[key])\r
+\r
+    def keys(self):\r
+        "D.keys() -> list of D's keys"\r
+        return list(self)\r
+\r
+    def items(self):\r
+        "D.items() -> list of D's (key, value) pairs, as 2-tuples"\r
+        return [(key, self[key]) for key in self]\r
+\r
+    def values(self):\r
+        "D.values() -> list of D's values"\r
+        return [self[key] for key in self]\r
+\r
+    # Mappings are not hashable by default, but subclasses can change this\r
+    __hash__ = None\r
+\r
+    def __eq__(self, other):\r
+        if not isinstance(other, Mapping):\r
+            return NotImplemented\r
+        return dict(self.items()) == dict(other.items())\r
+\r
+    def __ne__(self, other):\r
+        return not (self == other)\r
+\r
+class MappingView(Sized):\r
+\r
+    def __init__(self, mapping):\r
+        self._mapping = mapping\r
+\r
+    def __len__(self):\r
+        return len(self._mapping)\r
+\r
+    def __repr__(self):\r
+        return '{0.__class__.__name__}({0._mapping!r})'.format(self)\r
+\r
+\r
+class KeysView(MappingView, Set):\r
+\r
+    @classmethod\r
+    def _from_iterable(self, it):\r
+        return set(it)\r
+\r
+    def __contains__(self, key):\r
+        return key in self._mapping\r
+\r
+    def __iter__(self):\r
+        for key in self._mapping:\r
+            yield key\r
+\r
+\r
+class ItemsView(MappingView, Set):\r
+\r
+    @classmethod\r
+    def _from_iterable(self, it):\r
+        return set(it)\r
+\r
+    def __contains__(self, item):\r
+        key, value = item\r
+        try:\r
+            v = self._mapping[key]\r
+        except KeyError:\r
+            return False\r
+        else:\r
+            return v == value\r
+\r
+    def __iter__(self):\r
+        for key in self._mapping:\r
+            yield (key, self._mapping[key])\r
+\r
+\r
+class ValuesView(MappingView):\r
+\r
+    def __contains__(self, value):\r
+        for key in self._mapping:\r
+            if value == self._mapping[key]:\r
+                return True\r
+        return False\r
+\r
+    def __iter__(self):\r
+        for key in self._mapping:\r
+            yield self._mapping[key]\r
+\r
+\r
+class MutableMapping(Mapping):\r
+\r
+    """A MutableMapping is a generic container for associating\r
+    key/value pairs.\r
+\r
+    This class provides concrete generic implementations of all\r
+    methods except for __getitem__, __setitem__, __delitem__,\r
+    __iter__, and __len__.\r
+\r
+    """\r
+\r
+    @abstractmethod\r
+    def __setitem__(self, key, value):\r
+        raise KeyError\r
+\r
+    @abstractmethod\r
+    def __delitem__(self, key):\r
+        raise KeyError\r
+\r
+    __marker = object()\r
+\r
+    def pop(self, key, default=__marker):\r
+        '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\r
+          If key is not found, d is returned if given, otherwise KeyError is raised.\r
+        '''\r
+        try:\r
+            value = self[key]\r
+        except KeyError:\r
+            if default is self.__marker:\r
+                raise\r
+            return default\r
+        else:\r
+            del self[key]\r
+            return value\r
+\r
+    def popitem(self):\r
+        '''D.popitem() -> (k, v), remove and return some (key, value) pair\r
+           as a 2-tuple; but raise KeyError if D is empty.\r
+        '''\r
+        try:\r
+            key = next(iter(self))\r
+        except StopIteration:\r
+            raise KeyError\r
+        value = self[key]\r
+        del self[key]\r
+        return key, value\r
+\r
+    def clear(self):\r
+        'D.clear() -> None.  Remove all items from D.'\r
+        try:\r
+            while True:\r
+                self.popitem()\r
+        except KeyError:\r
+            pass\r
+\r
+    def update(*args, **kwds):\r
+        ''' D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.\r
+            If E present and has a .keys() method, does:     for k in E: D[k] = E[k]\r
+            If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v\r
+            In either case, this is followed by: for k, v in F.items(): D[k] = v\r
+        '''\r
+        if not args:\r
+            raise TypeError("descriptor 'update' of 'MutableMapping' object "\r
+                            "needs an argument")\r
+        self = args[0]\r
+        args = args[1:]\r
+        if len(args) > 1:\r
+            raise TypeError('update expected at most 1 arguments, got %d' %\r
+                            len(args))\r
+        if args:\r
+            other = args[0]\r
+            if isinstance(other, Mapping):\r
+                for key in other:\r
+                    self[key] = other[key]\r
+            elif hasattr(other, "keys"):\r
+                for key in other.keys():\r
+                    self[key] = other[key]\r
+            else:\r
+                for key, value in other:\r
+                    self[key] = value\r
+        for key, value in kwds.items():\r
+            self[key] = value\r
+\r
+    def setdefault(self, key, default=None):\r
+        'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D'\r
+        try:\r
+            return self[key]\r
+        except KeyError:\r
+            self[key] = default\r
+        return default\r
+\r
+MutableMapping.register(dict)\r
+\r
+\r
+### SEQUENCES ###\r
+\r
+\r
+class Sequence(Sized, Iterable, Container):\r
+    """All the operations on a read-only sequence.\r
+\r
+    Concrete subclasses must override __new__ or __init__,\r
+    __getitem__, and __len__.\r
+    """\r
+\r
+    @abstractmethod\r
+    def __getitem__(self, index):\r
+        raise IndexError\r
+\r
+    def __iter__(self):\r
+        i = 0\r
+        try:\r
+            while True:\r
+                v = self[i]\r
+                yield v\r
+                i += 1\r
+        except IndexError:\r
+            return\r
+\r
+    def __contains__(self, value):\r
+        for v in self:\r
+            if v == value:\r
+                return True\r
+        return False\r
+\r
+    def __reversed__(self):\r
+        for i in reversed(range(len(self))):\r
+            yield self[i]\r
+\r
+    def index(self, value):\r
+        '''S.index(value) -> integer -- return first index of value.\r
+           Raises ValueError if the value is not present.\r
+        '''\r
+        for i, v in enumerate(self):\r
+            if v == value:\r
+                return i\r
+        raise ValueError\r
+\r
+    def count(self, value):\r
+        'S.count(value) -> integer -- return number of occurrences of value'\r
+        return sum(1 for v in self if v == value)\r
+\r
+Sequence.register(tuple)\r
+Sequence.register(basestring)\r
+Sequence.register(buffer)\r
+Sequence.register(xrange)\r
+\r
+\r
+class MutableSequence(Sequence):\r
+\r
+    """All the operations on a read-only sequence.\r
+\r
+    Concrete subclasses must provide __new__ or __init__,\r
+    __getitem__, __setitem__, __delitem__, __len__, and insert().\r
+\r
+    """\r
+\r
+    @abstractmethod\r
+    def __setitem__(self, index, value):\r
+        raise IndexError\r
+\r
+    @abstractmethod\r
+    def __delitem__(self, index):\r
+        raise IndexError\r
+\r
+    @abstractmethod\r
+    def insert(self, index, value):\r
+        'S.insert(index, object) -- insert object before index'\r
+        raise IndexError\r
+\r
+    def append(self, value):\r
+        'S.append(object) -- append object to the end of the sequence'\r
+        self.insert(len(self), value)\r
+\r
+    def reverse(self):\r
+        'S.reverse() -- reverse *IN PLACE*'\r
+        n = len(self)\r
+        for i in range(n//2):\r
+            self[i], self[n-i-1] = self[n-i-1], self[i]\r
+\r
+    def extend(self, values):\r
+        'S.extend(iterable) -- extend sequence by appending elements from the iterable'\r
+        for v in values:\r
+            self.append(v)\r
+\r
+    def pop(self, index=-1):\r
+        '''S.pop([index]) -> item -- remove and return item at index (default last).\r
+           Raise IndexError if list is empty or index is out of range.\r
+        '''\r
+        v = self[index]\r
+        del self[index]\r
+        return v\r
+\r
+    def remove(self, value):\r
+        '''S.remove(value) -- remove first occurrence of value.\r
+           Raise ValueError if the value is not present.\r
+        '''\r
+        del self[self.index(value)]\r
+\r
+    def __iadd__(self, values):\r
+        self.extend(values)\r
+        return self\r
+\r
+MutableSequence.register(list)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/_weakrefset.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/_weakrefset.py
new file mode 100644 (file)
index 0000000..9cd1857
--- /dev/null
@@ -0,0 +1,204 @@
+# Access WeakSet through the weakref module.\r
+# This code is separated-out because it is needed\r
+# by abc.py to load everything else at startup.\r
+\r
+from _weakref import ref\r
+\r
+__all__ = ['WeakSet']\r
+\r
+\r
+class _IterationGuard(object):\r
+    # This context manager registers itself in the current iterators of the\r
+    # weak container, such as to delay all removals until the context manager\r
+    # exits.\r
+    # This technique should be relatively thread-safe (since sets are).\r
+\r
+    def __init__(self, weakcontainer):\r
+        # Don't create cycles\r
+        self.weakcontainer = ref(weakcontainer)\r
+\r
+    def __enter__(self):\r
+        w = self.weakcontainer()\r
+        if w is not None:\r
+            w._iterating.add(self)\r
+        return self\r
+\r
+    def __exit__(self, e, t, b):\r
+        w = self.weakcontainer()\r
+        if w is not None:\r
+            s = w._iterating\r
+            s.remove(self)\r
+            if not s:\r
+                w._commit_removals()\r
+\r
+\r
+class WeakSet(object):\r
+    def __init__(self, data=None):\r
+        self.data = set()\r
+        def _remove(item, selfref=ref(self)):\r
+            self = selfref()\r
+            if self is not None:\r
+                if self._iterating:\r
+                    self._pending_removals.append(item)\r
+                else:\r
+                    self.data.discard(item)\r
+        self._remove = _remove\r
+        # A list of keys to be removed\r
+        self._pending_removals = []\r
+        self._iterating = set()\r
+        if data is not None:\r
+            self.update(data)\r
+\r
+    def _commit_removals(self):\r
+        l = self._pending_removals\r
+        discard = self.data.discard\r
+        while l:\r
+            discard(l.pop())\r
+\r
+    def __iter__(self):\r
+        with _IterationGuard(self):\r
+            for itemref in self.data:\r
+                item = itemref()\r
+                if item is not None:\r
+                    # Caveat: the iterator will keep a strong reference to\r
+                    # `item` until it is resumed or closed.\r
+                    yield item\r
+\r
+    def __len__(self):\r
+        return len(self.data) - len(self._pending_removals)\r
+\r
+    def __contains__(self, item):\r
+        try:\r
+            wr = ref(item)\r
+        except TypeError:\r
+            return False\r
+        return wr in self.data\r
+\r
+    def __reduce__(self):\r
+        return (self.__class__, (list(self),),\r
+                getattr(self, '__dict__', None))\r
+\r
+    __hash__ = None\r
+\r
+    def add(self, item):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        self.data.add(ref(item, self._remove))\r
+\r
+    def clear(self):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        self.data.clear()\r
+\r
+    def copy(self):\r
+        return self.__class__(self)\r
+\r
+    def pop(self):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        while True:\r
+            try:\r
+                itemref = self.data.pop()\r
+            except KeyError:\r
+                raise KeyError('pop from empty WeakSet')\r
+            item = itemref()\r
+            if item is not None:\r
+                return item\r
+\r
+    def remove(self, item):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        self.data.remove(ref(item))\r
+\r
+    def discard(self, item):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        self.data.discard(ref(item))\r
+\r
+    def update(self, other):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        for element in other:\r
+            self.add(element)\r
+\r
+    def __ior__(self, other):\r
+        self.update(other)\r
+        return self\r
+\r
+    def difference(self, other):\r
+        newset = self.copy()\r
+        newset.difference_update(other)\r
+        return newset\r
+    __sub__ = difference\r
+\r
+    def difference_update(self, other):\r
+        self.__isub__(other)\r
+    def __isub__(self, other):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        if self is other:\r
+            self.data.clear()\r
+        else:\r
+            self.data.difference_update(ref(item) for item in other)\r
+        return self\r
+\r
+    def intersection(self, other):\r
+        return self.__class__(item for item in other if item in self)\r
+    __and__ = intersection\r
+\r
+    def intersection_update(self, other):\r
+        self.__iand__(other)\r
+    def __iand__(self, other):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        self.data.intersection_update(ref(item) for item in other)\r
+        return self\r
+\r
+    def issubset(self, other):\r
+        return self.data.issubset(ref(item) for item in other)\r
+    __le__ = issubset\r
+\r
+    def __lt__(self, other):\r
+        return self.data < set(ref(item) for item in other)\r
+\r
+    def issuperset(self, other):\r
+        return self.data.issuperset(ref(item) for item in other)\r
+    __ge__ = issuperset\r
+\r
+    def __gt__(self, other):\r
+        return self.data > set(ref(item) for item in other)\r
+\r
+    def __eq__(self, other):\r
+        if not isinstance(other, self.__class__):\r
+            return NotImplemented\r
+        return self.data == set(ref(item) for item in other)\r
+\r
+    def __ne__(self, other):\r
+        opposite = self.__eq__(other)\r
+        if opposite is NotImplemented:\r
+            return NotImplemented\r
+        return not opposite\r
+\r
+    def symmetric_difference(self, other):\r
+        newset = self.copy()\r
+        newset.symmetric_difference_update(other)\r
+        return newset\r
+    __xor__ = symmetric_difference\r
+\r
+    def symmetric_difference_update(self, other):\r
+        self.__ixor__(other)\r
+    def __ixor__(self, other):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        if self is other:\r
+            self.data.clear()\r
+        else:\r
+            self.data.symmetric_difference_update(ref(item, self._remove) for item in other)\r
+        return self\r
+\r
+    def union(self, other):\r
+        return self.__class__(e for s in (self, other) for e in s)\r
+    __or__ = union\r
+\r
+    def isdisjoint(self, other):\r
+        return len(self.intersection(other)) == 0\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/abc.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/abc.py
new file mode 100644 (file)
index 0000000..0e1bfec
--- /dev/null
@@ -0,0 +1,185 @@
+# Copyright 2007 Google, Inc. All Rights Reserved.\r
+# Licensed to PSF under a Contributor Agreement.\r
+\r
+"""Abstract Base Classes (ABCs) according to PEP 3119."""\r
+\r
+import types\r
+\r
+from _weakrefset import WeakSet\r
+\r
+# Instance of old-style class\r
+class _C: pass\r
+_InstanceType = type(_C())\r
+\r
+\r
+def abstractmethod(funcobj):\r
+    """A decorator indicating abstract methods.\r
+\r
+    Requires that the metaclass is ABCMeta or derived from it.  A\r
+    class that has a metaclass derived from ABCMeta cannot be\r
+    instantiated unless all of its abstract methods are overridden.\r
+    The abstract methods can be called using any of the normal\r
+    'super' call mechanisms.\r
+\r
+    Usage:\r
+\r
+        class C:\r
+            __metaclass__ = ABCMeta\r
+            @abstractmethod\r
+            def my_abstract_method(self, ...):\r
+                ...\r
+    """\r
+    funcobj.__isabstractmethod__ = True\r
+    return funcobj\r
+\r
+\r
+class abstractproperty(property):\r
+    """A decorator indicating abstract properties.\r
+\r
+    Requires that the metaclass is ABCMeta or derived from it.  A\r
+    class that has a metaclass derived from ABCMeta cannot be\r
+    instantiated unless all of its abstract properties are overridden.\r
+    The abstract properties can be called using any of the normal\r
+    'super' call mechanisms.\r
+\r
+    Usage:\r
+\r
+        class C:\r
+            __metaclass__ = ABCMeta\r
+            @abstractproperty\r
+            def my_abstract_property(self):\r
+                ...\r
+\r
+    This defines a read-only property; you can also define a read-write\r
+    abstract property using the 'long' form of property declaration:\r
+\r
+        class C:\r
+            __metaclass__ = ABCMeta\r
+            def getx(self): ...\r
+            def setx(self, value): ...\r
+            x = abstractproperty(getx, setx)\r
+    """\r
+    __isabstractmethod__ = True\r
+\r
+\r
+class ABCMeta(type):\r
+\r
+    """Metaclass for defining Abstract Base Classes (ABCs).\r
+\r
+    Use this metaclass to create an ABC.  An ABC can be subclassed\r
+    directly, and then acts as a mix-in class.  You can also register\r
+    unrelated concrete classes (even built-in classes) and unrelated\r
+    ABCs as 'virtual subclasses' -- these and their descendants will\r
+    be considered subclasses of the registering ABC by the built-in\r
+    issubclass() function, but the registering ABC won't show up in\r
+    their MRO (Method Resolution Order) nor will method\r
+    implementations defined by the registering ABC be callable (not\r
+    even via super()).\r
+\r
+    """\r
+\r
+    # A global counter that is incremented each time a class is\r
+    # registered as a virtual subclass of anything.  It forces the\r
+    # negative cache to be cleared before its next use.\r
+    _abc_invalidation_counter = 0\r
+\r
+    def __new__(mcls, name, bases, namespace):\r
+        cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)\r
+        # Compute set of abstract method names\r
+        abstracts = set(name\r
+                     for name, value in namespace.items()\r
+                     if getattr(value, "__isabstractmethod__", False))\r
+        for base in bases:\r
+            for name in getattr(base, "__abstractmethods__", set()):\r
+                value = getattr(cls, name, None)\r
+                if getattr(value, "__isabstractmethod__", False):\r
+                    abstracts.add(name)\r
+        cls.__abstractmethods__ = frozenset(abstracts)\r
+        # Set up inheritance registry\r
+        cls._abc_registry = WeakSet()\r
+        cls._abc_cache = WeakSet()\r
+        cls._abc_negative_cache = WeakSet()\r
+        cls._abc_negative_cache_version = ABCMeta._abc_invalidation_counter\r
+        return cls\r
+\r
+    def register(cls, subclass):\r
+        """Register a virtual subclass of an ABC."""\r
+        if not isinstance(subclass, (type, types.ClassType)):\r
+            raise TypeError("Can only register classes")\r
+        if issubclass(subclass, cls):\r
+            return  # Already a subclass\r
+        # Subtle: test for cycles *after* testing for "already a subclass";\r
+        # this means we allow X.register(X) and interpret it as a no-op.\r
+        if issubclass(cls, subclass):\r
+            # This would create a cycle, which is bad for the algorithm below\r
+            raise RuntimeError("Refusing to create an inheritance cycle")\r
+        cls._abc_registry.add(subclass)\r
+        ABCMeta._abc_invalidation_counter += 1  # Invalidate negative cache\r
+\r
+    def _dump_registry(cls, file=None):\r
+        """Debug helper to print the ABC registry."""\r
+        print >> file, "Class: %s.%s" % (cls.__module__, cls.__name__)\r
+        print >> file, "Inv.counter: %s" % ABCMeta._abc_invalidation_counter\r
+        for name in sorted(cls.__dict__.keys()):\r
+            if name.startswith("_abc_"):\r
+                value = getattr(cls, name)\r
+                print >> file, "%s: %r" % (name, value)\r
+\r
+    def __instancecheck__(cls, instance):\r
+        """Override for isinstance(instance, cls)."""\r
+        # Inline the cache checking when it's simple.\r
+        subclass = getattr(instance, '__class__', None)\r
+        if subclass is not None and subclass in cls._abc_cache:\r
+            return True\r
+        subtype = type(instance)\r
+        # Old-style instances\r
+        if subtype is _InstanceType:\r
+            subtype = subclass\r
+        if subtype is subclass or subclass is None:\r
+            if (cls._abc_negative_cache_version ==\r
+                ABCMeta._abc_invalidation_counter and\r
+                subtype in cls._abc_negative_cache):\r
+                return False\r
+            # Fall back to the subclass check.\r
+            return cls.__subclasscheck__(subtype)\r
+        return (cls.__subclasscheck__(subclass) or\r
+                cls.__subclasscheck__(subtype))\r
+\r
+    def __subclasscheck__(cls, subclass):\r
+        """Override for issubclass(subclass, cls)."""\r
+        # Check cache\r
+        if subclass in cls._abc_cache:\r
+            return True\r
+        # Check negative cache; may have to invalidate\r
+        if cls._abc_negative_cache_version < ABCMeta._abc_invalidation_counter:\r
+            # Invalidate the negative cache\r
+            cls._abc_negative_cache = WeakSet()\r
+            cls._abc_negative_cache_version = ABCMeta._abc_invalidation_counter\r
+        elif subclass in cls._abc_negative_cache:\r
+            return False\r
+        # Check the subclass hook\r
+        ok = cls.__subclasshook__(subclass)\r
+        if ok is not NotImplemented:\r
+            assert isinstance(ok, bool)\r
+            if ok:\r
+                cls._abc_cache.add(subclass)\r
+            else:\r
+                cls._abc_negative_cache.add(subclass)\r
+            return ok\r
+        # Check if it's a direct subclass\r
+        if cls in getattr(subclass, '__mro__', ()):\r
+            cls._abc_cache.add(subclass)\r
+            return True\r
+        # Check if it's a subclass of a registered class (recursive)\r
+        for rcls in cls._abc_registry:\r
+            if issubclass(subclass, rcls):\r
+                cls._abc_cache.add(subclass)\r
+                return True\r
+        # Check if it's a subclass of a subclass (recursive)\r
+        for scls in cls.__subclasses__():\r
+            if issubclass(subclass, scls):\r
+                cls._abc_cache.add(subclass)\r
+                return True\r
+        # No dice; update negative cache\r
+        cls._abc_negative_cache.add(subclass)\r
+        return False\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/argparse.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/argparse.py
new file mode 100644 (file)
index 0000000..4d56aa7
--- /dev/null
@@ -0,0 +1,2374 @@
+# Author: Steven J. Bethard <steven.bethard@gmail.com>.\r
+\r
+"""Command-line parsing library\r
+\r
+This module is an optparse-inspired command-line parsing library that:\r
+\r
+    - handles both optional and positional arguments\r
+    - produces highly informative usage messages\r
+    - supports parsers that dispatch to sub-parsers\r
+\r
+The following is a simple usage example that sums integers from the\r
+command-line and writes the result to a file::\r
+\r
+    parser = argparse.ArgumentParser(\r
+        description='sum the integers at the command line')\r
+    parser.add_argument(\r
+        'integers', metavar='int', nargs='+', type=int,\r
+        help='an integer to be summed')\r
+    parser.add_argument(\r
+        '--log', default=sys.stdout, type=argparse.FileType('w'),\r
+        help='the file where the sum should be written')\r
+    args = parser.parse_args()\r
+    args.log.write('%s' % sum(args.integers))\r
+    args.log.close()\r
+\r
+The module contains the following public classes:\r
+\r
+    - ArgumentParser -- The main entry point for command-line parsing. As the\r
+        example above shows, the add_argument() method is used to populate\r
+        the parser with actions for optional and positional arguments. Then\r
+        the parse_args() method is invoked to convert the args at the\r
+        command-line into an object with attributes.\r
+\r
+    - ArgumentError -- The exception raised by ArgumentParser objects when\r
+        there are errors with the parser's actions. Errors raised while\r
+        parsing the command-line are caught by ArgumentParser and emitted\r
+        as command-line messages.\r
+\r
+    - FileType -- A factory for defining types of files to be created. As the\r
+        example above shows, instances of FileType are typically passed as\r
+        the type= argument of add_argument() calls.\r
+\r
+    - Action -- The base class for parser actions. Typically actions are\r
+        selected by passing strings like 'store_true' or 'append_const' to\r
+        the action= argument of add_argument(). However, for greater\r
+        customization of ArgumentParser actions, subclasses of Action may\r
+        be defined and passed as the action= argument.\r
+\r
+    - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,\r
+        ArgumentDefaultsHelpFormatter -- Formatter classes which\r
+        may be passed as the formatter_class= argument to the\r
+        ArgumentParser constructor. HelpFormatter is the default,\r
+        RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser\r
+        not to change the formatting for help text, and\r
+        ArgumentDefaultsHelpFormatter adds information about argument defaults\r
+        to the help.\r
+\r
+All other classes in this module are considered implementation details.\r
+(Also note that HelpFormatter and RawDescriptionHelpFormatter are only\r
+considered public as object names -- the API of the formatter objects is\r
+still considered an implementation detail.)\r
+"""\r
+\r
+__version__ = '1.1'\r
+__all__ = [\r
+    'ArgumentParser',\r
+    'ArgumentError',\r
+    'ArgumentTypeError',\r
+    'FileType',\r
+    'HelpFormatter',\r
+    'ArgumentDefaultsHelpFormatter',\r
+    'RawDescriptionHelpFormatter',\r
+    'RawTextHelpFormatter',\r
+    'Namespace',\r
+    'Action',\r
+    'ONE_OR_MORE',\r
+    'OPTIONAL',\r
+    'PARSER',\r
+    'REMAINDER',\r
+    'SUPPRESS',\r
+    'ZERO_OR_MORE',\r
+]\r
+\r
+\r
+import collections as _collections\r
+import copy as _copy\r
+import os as _os\r
+import re as _re\r
+import sys as _sys\r
+import textwrap as _textwrap\r
+\r
+from gettext import gettext as _\r
+\r
+\r
+def _callable(obj):\r
+    return hasattr(obj, '__call__') or hasattr(obj, '__bases__')\r
+\r
+\r
+SUPPRESS = '==SUPPRESS=='\r
+\r
+OPTIONAL = '?'\r
+ZERO_OR_MORE = '*'\r
+ONE_OR_MORE = '+'\r
+PARSER = 'A...'\r
+REMAINDER = '...'\r
+_UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args'\r
+\r
+# =============================\r
+# Utility functions and classes\r
+# =============================\r
+\r
+class _AttributeHolder(object):\r
+    """Abstract base class that provides __repr__.\r
+\r
+    The __repr__ method returns a string in the format::\r
+        ClassName(attr=name, attr=name, ...)\r
+    The attributes are determined either by a class-level attribute,\r
+    '_kwarg_names', or by inspecting the instance __dict__.\r
+    """\r
+\r
+    def __repr__(self):\r
+        type_name = type(self).__name__\r
+        arg_strings = []\r
+        for arg in self._get_args():\r
+            arg_strings.append(repr(arg))\r
+        for name, value in self._get_kwargs():\r
+            arg_strings.append('%s=%r' % (name, value))\r
+        return '%s(%s)' % (type_name, ', '.join(arg_strings))\r
+\r
+    def _get_kwargs(self):\r
+        return sorted(self.__dict__.items())\r
+\r
+    def _get_args(self):\r
+        return []\r
+\r
+\r
+def _ensure_value(namespace, name, value):\r
+    if getattr(namespace, name, None) is None:\r
+        setattr(namespace, name, value)\r
+    return getattr(namespace, name)\r
+\r
+\r
+# ===============\r
+# Formatting Help\r
+# ===============\r
+\r
+class HelpFormatter(object):\r
+    """Formatter for generating usage messages and argument help strings.\r
+\r
+    Only the name of this class is considered a public API. All the methods\r
+    provided by the class are considered an implementation detail.\r
+    """\r
+\r
+    def __init__(self,\r
+                 prog,\r
+                 indent_increment=2,\r
+                 max_help_position=24,\r
+                 width=None):\r
+\r
+        # default setting for width\r
+        if width is None:\r
+            try:\r
+                width = int(_os.environ['COLUMNS'])\r
+            except (KeyError, ValueError):\r
+                width = 80\r
+            width -= 2\r
+\r
+        self._prog = prog\r
+        self._indent_increment = indent_increment\r
+        self._max_help_position = max_help_position\r
+        self._max_help_position = min(max_help_position,\r
+                                      max(width - 20, indent_increment * 2))\r
+        self._width = width\r
+\r
+        self._current_indent = 0\r
+        self._level = 0\r
+        self._action_max_length = 0\r
+\r
+        self._root_section = self._Section(self, None)\r
+        self._current_section = self._root_section\r
+\r
+        self._whitespace_matcher = _re.compile(r'\s+')\r
+        self._long_break_matcher = _re.compile(r'\n\n\n+')\r
+\r
+    # ===============================\r
+    # Section and indentation methods\r
+    # ===============================\r
+    def _indent(self):\r
+        self._current_indent += self._indent_increment\r
+        self._level += 1\r
+\r
+    def _dedent(self):\r
+        self._current_indent -= self._indent_increment\r
+        assert self._current_indent >= 0, 'Indent decreased below 0.'\r
+        self._level -= 1\r
+\r
+    class _Section(object):\r
+\r
+        def __init__(self, formatter, parent, heading=None):\r
+            self.formatter = formatter\r
+            self.parent = parent\r
+            self.heading = heading\r
+            self.items = []\r
+\r
+        def format_help(self):\r
+            # format the indented section\r
+            if self.parent is not None:\r
+                self.formatter._indent()\r
+            join = self.formatter._join_parts\r
+            for func, args in self.items:\r
+                func(*args)\r
+            item_help = join([func(*args) for func, args in self.items])\r
+            if self.parent is not None:\r
+                self.formatter._dedent()\r
+\r
+            # return nothing if the section was empty\r
+            if not item_help:\r
+                return ''\r
+\r
+            # add the heading if the section was non-empty\r
+            if self.heading is not SUPPRESS and self.heading is not None:\r
+                current_indent = self.formatter._current_indent\r
+                heading = '%*s%s:\n' % (current_indent, '', self.heading)\r
+            else:\r
+                heading = ''\r
+\r
+            # join the section-initial newline, the heading and the help\r
+            return join(['\n', heading, item_help, '\n'])\r
+\r
+    def _add_item(self, func, args):\r
+        self._current_section.items.append((func, args))\r
+\r
+    # ========================\r
+    # Message building methods\r
+    # ========================\r
+    def start_section(self, heading):\r
+        self._indent()\r
+        section = self._Section(self, self._current_section, heading)\r
+        self._add_item(section.format_help, [])\r
+        self._current_section = section\r
+\r
+    def end_section(self):\r
+        self._current_section = self._current_section.parent\r
+        self._dedent()\r
+\r
+    def add_text(self, text):\r
+        if text is not SUPPRESS and text is not None:\r
+            self._add_item(self._format_text, [text])\r
+\r
+    def add_usage(self, usage, actions, groups, prefix=None):\r
+        if usage is not SUPPRESS:\r
+            args = usage, actions, groups, prefix\r
+            self._add_item(self._format_usage, args)\r
+\r
+    def add_argument(self, action):\r
+        if action.help is not SUPPRESS:\r
+\r
+            # find all invocations\r
+            get_invocation = self._format_action_invocation\r
+            invocations = [get_invocation(action)]\r
+            for subaction in self._iter_indented_subactions(action):\r
+                invocations.append(get_invocation(subaction))\r
+\r
+            # update the maximum item length\r
+            invocation_length = max([len(s) for s in invocations])\r
+            action_length = invocation_length + self._current_indent\r
+            self._action_max_length = max(self._action_max_length,\r
+                                          action_length)\r
+\r
+            # add the item to the list\r
+            self._add_item(self._format_action, [action])\r
+\r
+    def add_arguments(self, actions):\r
+        for action in actions:\r
+            self.add_argument(action)\r
+\r
+    # =======================\r
+    # Help-formatting methods\r
+    # =======================\r
+    def format_help(self):\r
+        help = self._root_section.format_help()\r
+        if help:\r
+            help = self._long_break_matcher.sub('\n\n', help)\r
+            help = help.strip('\n') + '\n'\r
+        return help\r
+\r
+    def _join_parts(self, part_strings):\r
+        return ''.join([part\r
+                        for part in part_strings\r
+                        if part and part is not SUPPRESS])\r
+\r
+    def _format_usage(self, usage, actions, groups, prefix):\r
+        if prefix is None:\r
+            prefix = _('usage: ')\r
+\r
+        # if usage is specified, use that\r
+        if usage is not None:\r
+            usage = usage % dict(prog=self._prog)\r
+\r
+        # if no optionals or positionals are available, usage is just prog\r
+        elif usage is None and not actions:\r
+            usage = '%(prog)s' % dict(prog=self._prog)\r
+\r
+        # if optionals and positionals are available, calculate usage\r
+        elif usage is None:\r
+            prog = '%(prog)s' % dict(prog=self._prog)\r
+\r
+            # split optionals from positionals\r
+            optionals = []\r
+            positionals = []\r
+            for action in actions:\r
+                if action.option_strings:\r
+                    optionals.append(action)\r
+                else:\r
+                    positionals.append(action)\r
+\r
+            # build full usage string\r
+            format = self._format_actions_usage\r
+            action_usage = format(optionals + positionals, groups)\r
+            usage = ' '.join([s for s in [prog, action_usage] if s])\r
+\r
+            # wrap the usage parts if it's too long\r
+            text_width = self._width - self._current_indent\r
+            if len(prefix) + len(usage) > text_width:\r
+\r
+                # break usage into wrappable parts\r
+                part_regexp = r'\(.*?\)+|\[.*?\]+|\S+'\r
+                opt_usage = format(optionals, groups)\r
+                pos_usage = format(positionals, groups)\r
+                opt_parts = _re.findall(part_regexp, opt_usage)\r
+                pos_parts = _re.findall(part_regexp, pos_usage)\r
+                assert ' '.join(opt_parts) == opt_usage\r
+                assert ' '.join(pos_parts) == pos_usage\r
+\r
+                # helper for wrapping lines\r
+                def get_lines(parts, indent, prefix=None):\r
+                    lines = []\r
+                    line = []\r
+                    if prefix is not None:\r
+                        line_len = len(prefix) - 1\r
+                    else:\r
+                        line_len = len(indent) - 1\r
+                    for part in parts:\r
+                        if line_len + 1 + len(part) > text_width and line:\r
+                            lines.append(indent + ' '.join(line))\r
+                            line = []\r
+                            line_len = len(indent) - 1\r
+                        line.append(part)\r
+                        line_len += len(part) + 1\r
+                    if line:\r
+                        lines.append(indent + ' '.join(line))\r
+                    if prefix is not None:\r
+                        lines[0] = lines[0][len(indent):]\r
+                    return lines\r
+\r
+                # if prog is short, follow it with optionals or positionals\r
+                if len(prefix) + len(prog) <= 0.75 * text_width:\r
+                    indent = ' ' * (len(prefix) + len(prog) + 1)\r
+                    if opt_parts:\r
+                        lines = get_lines([prog] + opt_parts, indent, prefix)\r
+                        lines.extend(get_lines(pos_parts, indent))\r
+                    elif pos_parts:\r
+                        lines = get_lines([prog] + pos_parts, indent, prefix)\r
+                    else:\r
+                        lines = [prog]\r
+\r
+                # if prog is long, put it on its own line\r
+                else:\r
+                    indent = ' ' * len(prefix)\r
+                    parts = opt_parts + pos_parts\r
+                    lines = get_lines(parts, indent)\r
+                    if len(lines) > 1:\r
+                        lines = []\r
+                        lines.extend(get_lines(opt_parts, indent))\r
+                        lines.extend(get_lines(pos_parts, indent))\r
+                    lines = [prog] + lines\r
+\r
+                # join lines into usage\r
+                usage = '\n'.join(lines)\r
+\r
+        # prefix with 'usage:'\r
+        return '%s%s\n\n' % (prefix, usage)\r
+\r
+    def _format_actions_usage(self, actions, groups):\r
+        # find group indices and identify actions in groups\r
+        group_actions = set()\r
+        inserts = {}\r
+        for group in groups:\r
+            try:\r
+                start = actions.index(group._group_actions[0])\r
+            except ValueError:\r
+                continue\r
+            else:\r
+                end = start + len(group._group_actions)\r
+                if actions[start:end] == group._group_actions:\r
+                    for action in group._group_actions:\r
+                        group_actions.add(action)\r
+                    if not group.required:\r
+                        if start in inserts:\r
+                            inserts[start] += ' ['\r
+                        else:\r
+                            inserts[start] = '['\r
+                        inserts[end] = ']'\r
+                    else:\r
+                        if start in inserts:\r
+                            inserts[start] += ' ('\r
+                        else:\r
+                            inserts[start] = '('\r
+                        inserts[end] = ')'\r
+                    for i in range(start + 1, end):\r
+                        inserts[i] = '|'\r
+\r
+        # collect all actions format strings\r
+        parts = []\r
+        for i, action in enumerate(actions):\r
+\r
+            # suppressed arguments are marked with None\r
+            # remove | separators for suppressed arguments\r
+            if action.help is SUPPRESS:\r
+                parts.append(None)\r
+                if inserts.get(i) == '|':\r
+                    inserts.pop(i)\r
+                elif inserts.get(i + 1) == '|':\r
+                    inserts.pop(i + 1)\r
+\r
+            # produce all arg strings\r
+            elif not action.option_strings:\r
+                part = self._format_args(action, action.dest)\r
+\r
+                # if it's in a group, strip the outer []\r
+                if action in group_actions:\r
+                    if part[0] == '[' and part[-1] == ']':\r
+                        part = part[1:-1]\r
+\r
+                # add the action string to the list\r
+                parts.append(part)\r
+\r
+            # produce the first way to invoke the option in brackets\r
+            else:\r
+                option_string = action.option_strings[0]\r
+\r
+                # if the Optional doesn't take a value, format is:\r
+                #    -s or --long\r
+                if action.nargs == 0:\r
+                    part = '%s' % option_string\r
+\r
+                # if the Optional takes a value, format is:\r
+                #    -s ARGS or --long ARGS\r
+                else:\r
+                    default = action.dest.upper()\r
+                    args_string = self._format_args(action, default)\r
+                    part = '%s %s' % (option_string, args_string)\r
+\r
+                # make it look optional if it's not required or in a group\r
+                if not action.required and action not in group_actions:\r
+                    part = '[%s]' % part\r
+\r
+                # add the action string to the list\r
+                parts.append(part)\r
+\r
+        # insert things at the necessary indices\r
+        for i in sorted(inserts, reverse=True):\r
+            parts[i:i] = [inserts[i]]\r
+\r
+        # join all the action items with spaces\r
+        text = ' '.join([item for item in parts if item is not None])\r
+\r
+        # clean up separators for mutually exclusive groups\r
+        open = r'[\[(]'\r
+        close = r'[\])]'\r
+        text = _re.sub(r'(%s) ' % open, r'\1', text)\r
+        text = _re.sub(r' (%s)' % close, r'\1', text)\r
+        text = _re.sub(r'%s *%s' % (open, close), r'', text)\r
+        text = _re.sub(r'\(([^|]*)\)', r'\1', text)\r
+        text = text.strip()\r
+\r
+        # return the text\r
+        return text\r
+\r
+    def _format_text(self, text):\r
+        if '%(prog)' in text:\r
+            text = text % dict(prog=self._prog)\r
+        text_width = max(self._width - self._current_indent, 11)\r
+        indent = ' ' * self._current_indent\r
+        return self._fill_text(text, text_width, indent) + '\n\n'\r
+\r
+    def _format_action(self, action):\r
+        # determine the required width and the entry label\r
+        help_position = min(self._action_max_length + 2,\r
+                            self._max_help_position)\r
+        help_width = max(self._width - help_position, 11)\r
+        action_width = help_position - self._current_indent - 2\r
+        action_header = self._format_action_invocation(action)\r
+\r
+        # ho nelp; start on same line and add a final newline\r
+        if not action.help:\r
+            tup = self._current_indent, '', action_header\r
+            action_header = '%*s%s\n' % tup\r
+\r
+        # short action name; start on the same line and pad two spaces\r
+        elif len(action_header) <= action_width:\r
+            tup = self._current_indent, '', action_width, action_header\r
+            action_header = '%*s%-*s  ' % tup\r
+            indent_first = 0\r
+\r
+        # long action name; start on the next line\r
+        else:\r
+            tup = self._current_indent, '', action_header\r
+            action_header = '%*s%s\n' % tup\r
+            indent_first = help_position\r
+\r
+        # collect the pieces of the action help\r
+        parts = [action_header]\r
+\r
+        # if there was help for the action, add lines of help text\r
+        if action.help:\r
+            help_text = self._expand_help(action)\r
+            help_lines = self._split_lines(help_text, help_width)\r
+            parts.append('%*s%s\n' % (indent_first, '', help_lines[0]))\r
+            for line in help_lines[1:]:\r
+                parts.append('%*s%s\n' % (help_position, '', line))\r
+\r
+        # or add a newline if the description doesn't end with one\r
+        elif not action_header.endswith('\n'):\r
+            parts.append('\n')\r
+\r
+        # if there are any sub-actions, add their help as well\r
+        for subaction in self._iter_indented_subactions(action):\r
+            parts.append(self._format_action(subaction))\r
+\r
+        # return a single string\r
+        return self._join_parts(parts)\r
+\r
+    def _format_action_invocation(self, action):\r
+        if not action.option_strings:\r
+            metavar, = self._metavar_formatter(action, action.dest)(1)\r
+            return metavar\r
+\r
+        else:\r
+            parts = []\r
+\r
+            # if the Optional doesn't take a value, format is:\r
+            #    -s, --long\r
+            if action.nargs == 0:\r
+                parts.extend(action.option_strings)\r
+\r
+            # if the Optional takes a value, format is:\r
+            #    -s ARGS, --long ARGS\r
+            else:\r
+                default = action.dest.upper()\r
+                args_string = self._format_args(action, default)\r
+                for option_string in action.option_strings:\r
+                    parts.append('%s %s' % (option_string, args_string))\r
+\r
+            return ', '.join(parts)\r
+\r
+    def _metavar_formatter(self, action, default_metavar):\r
+        if action.metavar is not None:\r
+            result = action.metavar\r
+        elif action.choices is not None:\r
+            choice_strs = [str(choice) for choice in action.choices]\r
+            result = '{%s}' % ','.join(choice_strs)\r
+        else:\r
+            result = default_metavar\r
+\r
+        def format(tuple_size):\r
+            if isinstance(result, tuple):\r
+                return result\r
+            else:\r
+                return (result, ) * tuple_size\r
+        return format\r
+\r
+    def _format_args(self, action, default_metavar):\r
+        get_metavar = self._metavar_formatter(action, default_metavar)\r
+        if action.nargs is None:\r
+            result = '%s' % get_metavar(1)\r
+        elif action.nargs == OPTIONAL:\r
+            result = '[%s]' % get_metavar(1)\r
+        elif action.nargs == ZERO_OR_MORE:\r
+            result = '[%s [%s ...]]' % get_metavar(2)\r
+        elif action.nargs == ONE_OR_MORE:\r
+            result = '%s [%s ...]' % get_metavar(2)\r
+        elif action.nargs == REMAINDER:\r
+            result = '...'\r
+        elif action.nargs == PARSER:\r
+            result = '%s ...' % get_metavar(1)\r
+        else:\r
+            formats = ['%s' for _ in range(action.nargs)]\r
+            result = ' '.join(formats) % get_metavar(action.nargs)\r
+        return result\r
+\r
+    def _expand_help(self, action):\r
+        params = dict(vars(action), prog=self._prog)\r
+        for name in list(params):\r
+            if params[name] is SUPPRESS:\r
+                del params[name]\r
+        for name in list(params):\r
+            if hasattr(params[name], '__name__'):\r
+                params[name] = params[name].__name__\r
+        if params.get('choices') is not None:\r
+            choices_str = ', '.join([str(c) for c in params['choices']])\r
+            params['choices'] = choices_str\r
+        return self._get_help_string(action) % params\r
+\r
+    def _iter_indented_subactions(self, action):\r
+        try:\r
+            get_subactions = action._get_subactions\r
+        except AttributeError:\r
+            pass\r
+        else:\r
+            self._indent()\r
+            for subaction in get_subactions():\r
+                yield subaction\r
+            self._dedent()\r
+\r
+    def _split_lines(self, text, width):\r
+        text = self._whitespace_matcher.sub(' ', text).strip()\r
+        return _textwrap.wrap(text, width)\r
+\r
+    def _fill_text(self, text, width, indent):\r
+        text = self._whitespace_matcher.sub(' ', text).strip()\r
+        return _textwrap.fill(text, width, initial_indent=indent,\r
+                                           subsequent_indent=indent)\r
+\r
+    def _get_help_string(self, action):\r
+        return action.help\r
+\r
+\r
+class RawDescriptionHelpFormatter(HelpFormatter):\r
+    """Help message formatter which retains any formatting in descriptions.\r
+\r
+    Only the name of this class is considered a public API. All the methods\r
+    provided by the class are considered an implementation detail.\r
+    """\r
+\r
+    def _fill_text(self, text, width, indent):\r
+        return ''.join([indent + line for line in text.splitlines(True)])\r
+\r
+\r
+class RawTextHelpFormatter(RawDescriptionHelpFormatter):\r
+    """Help message formatter which retains formatting of all help text.\r
+\r
+    Only the name of this class is considered a public API. All the methods\r
+    provided by the class are considered an implementation detail.\r
+    """\r
+\r
+    def _split_lines(self, text, width):\r
+        return text.splitlines()\r
+\r
+\r
+class ArgumentDefaultsHelpFormatter(HelpFormatter):\r
+    """Help message formatter which adds default values to argument help.\r
+\r
+    Only the name of this class is considered a public API. All the methods\r
+    provided by the class are considered an implementation detail.\r
+    """\r
+\r
+    def _get_help_string(self, action):\r
+        help = action.help\r
+        if '%(default)' not in action.help:\r
+            if action.default is not SUPPRESS:\r
+                defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]\r
+                if action.option_strings or action.nargs in defaulting_nargs:\r
+                    help += ' (default: %(default)s)'\r
+        return help\r
+\r
+\r
+# =====================\r
+# Options and Arguments\r
+# =====================\r
+\r
+def _get_action_name(argument):\r
+    if argument is None:\r
+        return None\r
+    elif argument.option_strings:\r
+        return  '/'.join(argument.option_strings)\r
+    elif argument.metavar not in (None, SUPPRESS):\r
+        return argument.metavar\r
+    elif argument.dest not in (None, SUPPRESS):\r
+        return argument.dest\r
+    else:\r
+        return None\r
+\r
+\r
+class ArgumentError(Exception):\r
+    """An error from creating or using an argument (optional or positional).\r
+\r
+    The string value of this exception is the message, augmented with\r
+    information about the argument that caused it.\r
+    """\r
+\r
+    def __init__(self, argument, message):\r
+        self.argument_name = _get_action_name(argument)\r
+        self.message = message\r
+\r
+    def __str__(self):\r
+        if self.argument_name is None:\r
+            format = '%(message)s'\r
+        else:\r
+            format = 'argument %(argument_name)s: %(message)s'\r
+        return format % dict(message=self.message,\r
+                             argument_name=self.argument_name)\r
+\r
+\r
+class ArgumentTypeError(Exception):\r
+    """An error from trying to convert a command line string to a type."""\r
+    pass\r
+\r
+\r
+# ==============\r
+# Action classes\r
+# ==============\r
+\r
+class Action(_AttributeHolder):\r
+    """Information about how to convert command line strings to Python objects.\r
+\r
+    Action objects are used by an ArgumentParser to represent the information\r
+    needed to parse a single argument from one or more strings from the\r
+    command line. The keyword arguments to the Action constructor are also\r
+    all attributes of Action instances.\r
+\r
+    Keyword Arguments:\r
+\r
+        - option_strings -- A list of command-line option strings which\r
+            should be associated with this action.\r
+\r
+        - dest -- The name of the attribute to hold the created object(s)\r
+\r
+        - nargs -- The number of command-line arguments that should be\r
+            consumed. By default, one argument will be consumed and a single\r
+            value will be produced.  Other values include:\r
+                - N (an integer) consumes N arguments (and produces a list)\r
+                - '?' consumes zero or one arguments\r
+                - '*' consumes zero or more arguments (and produces a list)\r
+                - '+' consumes one or more arguments (and produces a list)\r
+            Note that the difference between the default and nargs=1 is that\r
+            with the default, a single value will be produced, while with\r
+            nargs=1, a list containing a single value will be produced.\r
+\r
+        - const -- The value to be produced if the option is specified and the\r
+            option uses an action that takes no values.\r
+\r
+        - default -- The value to be produced if the option is not specified.\r
+\r
+        - type -- A callable that accepts a single string argument, and\r
+            returns the converted value.  The standard Python types str, int,\r
+            float, and complex are useful examples of such callables.  If None,\r
+            str is used.\r
+\r
+        - choices -- A container of values that should be allowed. If not None,\r
+            after a command-line argument has been converted to the appropriate\r
+            type, an exception will be raised if it is not a member of this\r
+            collection.\r
+\r
+        - required -- True if the action must always be specified at the\r
+            command line. This is only meaningful for optional command-line\r
+            arguments.\r
+\r
+        - help -- The help string describing the argument.\r
+\r
+        - metavar -- The name to be used for the option's argument with the\r
+            help string. If None, the 'dest' value will be used as the name.\r
+    """\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 dest,\r
+                 nargs=None,\r
+                 const=None,\r
+                 default=None,\r
+                 type=None,\r
+                 choices=None,\r
+                 required=False,\r
+                 help=None,\r
+                 metavar=None):\r
+        self.option_strings = option_strings\r
+        self.dest = dest\r
+        self.nargs = nargs\r
+        self.const = const\r
+        self.default = default\r
+        self.type = type\r
+        self.choices = choices\r
+        self.required = required\r
+        self.help = help\r
+        self.metavar = metavar\r
+\r
+    def _get_kwargs(self):\r
+        names = [\r
+            'option_strings',\r
+            'dest',\r
+            'nargs',\r
+            'const',\r
+            'default',\r
+            'type',\r
+            'choices',\r
+            'help',\r
+            'metavar',\r
+        ]\r
+        return [(name, getattr(self, name)) for name in names]\r
+\r
+    def __call__(self, parser, namespace, values, option_string=None):\r
+        raise NotImplementedError(_('.__call__() not defined'))\r
+\r
+\r
+class _StoreAction(Action):\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 dest,\r
+                 nargs=None,\r
+                 const=None,\r
+                 default=None,\r
+                 type=None,\r
+                 choices=None,\r
+                 required=False,\r
+                 help=None,\r
+                 metavar=None):\r
+        if nargs == 0:\r
+            raise ValueError('nargs for store actions must be > 0; if you '\r
+                             'have nothing to store, actions such as store '\r
+                             'true or store const may be more appropriate')\r
+        if const is not None and nargs != OPTIONAL:\r
+            raise ValueError('nargs must be %r to supply const' % OPTIONAL)\r
+        super(_StoreAction, self).__init__(\r
+            option_strings=option_strings,\r
+            dest=dest,\r
+            nargs=nargs,\r
+            const=const,\r
+            default=default,\r
+            type=type,\r
+            choices=choices,\r
+            required=required,\r
+            help=help,\r
+            metavar=metavar)\r
+\r
+    def __call__(self, parser, namespace, values, option_string=None):\r
+        setattr(namespace, self.dest, values)\r
+\r
+\r
+class _StoreConstAction(Action):\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 dest,\r
+                 const,\r
+                 default=None,\r
+                 required=False,\r
+                 help=None,\r
+                 metavar=None):\r
+        super(_StoreConstAction, self).__init__(\r
+            option_strings=option_strings,\r
+            dest=dest,\r
+            nargs=0,\r
+            const=const,\r
+            default=default,\r
+            required=required,\r
+            help=help)\r
+\r
+    def __call__(self, parser, namespace, values, option_string=None):\r
+        setattr(namespace, self.dest, self.const)\r
+\r
+\r
+class _StoreTrueAction(_StoreConstAction):\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 dest,\r
+                 default=False,\r
+                 required=False,\r
+                 help=None):\r
+        super(_StoreTrueAction, self).__init__(\r
+            option_strings=option_strings,\r
+            dest=dest,\r
+            const=True,\r
+            default=default,\r
+            required=required,\r
+            help=help)\r
+\r
+\r
+class _StoreFalseAction(_StoreConstAction):\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 dest,\r
+                 default=True,\r
+                 required=False,\r
+                 help=None):\r
+        super(_StoreFalseAction, self).__init__(\r
+            option_strings=option_strings,\r
+            dest=dest,\r
+            const=False,\r
+            default=default,\r
+            required=required,\r
+            help=help)\r
+\r
+\r
+class _AppendAction(Action):\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 dest,\r
+                 nargs=None,\r
+                 const=None,\r
+                 default=None,\r
+                 type=None,\r
+                 choices=None,\r
+                 required=False,\r
+                 help=None,\r
+                 metavar=None):\r
+        if nargs == 0:\r
+            raise ValueError('nargs for append actions must be > 0; if arg '\r
+                             'strings are not supplying the value to append, '\r
+                             'the append const action may be more appropriate')\r
+        if const is not None and nargs != OPTIONAL:\r
+            raise ValueError('nargs must be %r to supply const' % OPTIONAL)\r
+        super(_AppendAction, self).__init__(\r
+            option_strings=option_strings,\r
+            dest=dest,\r
+            nargs=nargs,\r
+            const=const,\r
+            default=default,\r
+            type=type,\r
+            choices=choices,\r
+            required=required,\r
+            help=help,\r
+            metavar=metavar)\r
+\r
+    def __call__(self, parser, namespace, values, option_string=None):\r
+        items = _copy.copy(_ensure_value(namespace, self.dest, []))\r
+        items.append(values)\r
+        setattr(namespace, self.dest, items)\r
+\r
+\r
+class _AppendConstAction(Action):\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 dest,\r
+                 const,\r
+                 default=None,\r
+                 required=False,\r
+                 help=None,\r
+                 metavar=None):\r
+        super(_AppendConstAction, self).__init__(\r
+            option_strings=option_strings,\r
+            dest=dest,\r
+            nargs=0,\r
+            const=const,\r
+            default=default,\r
+            required=required,\r
+            help=help,\r
+            metavar=metavar)\r
+\r
+    def __call__(self, parser, namespace, values, option_string=None):\r
+        items = _copy.copy(_ensure_value(namespace, self.dest, []))\r
+        items.append(self.const)\r
+        setattr(namespace, self.dest, items)\r
+\r
+\r
+class _CountAction(Action):\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 dest,\r
+                 default=None,\r
+                 required=False,\r
+                 help=None):\r
+        super(_CountAction, self).__init__(\r
+            option_strings=option_strings,\r
+            dest=dest,\r
+            nargs=0,\r
+            default=default,\r
+            required=required,\r
+            help=help)\r
+\r
+    def __call__(self, parser, namespace, values, option_string=None):\r
+        new_count = _ensure_value(namespace, self.dest, 0) + 1\r
+        setattr(namespace, self.dest, new_count)\r
+\r
+\r
+class _HelpAction(Action):\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 dest=SUPPRESS,\r
+                 default=SUPPRESS,\r
+                 help=None):\r
+        super(_HelpAction, self).__init__(\r
+            option_strings=option_strings,\r
+            dest=dest,\r
+            default=default,\r
+            nargs=0,\r
+            help=help)\r
+\r
+    def __call__(self, parser, namespace, values, option_string=None):\r
+        parser.print_help()\r
+        parser.exit()\r
+\r
+\r
+class _VersionAction(Action):\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 version=None,\r
+                 dest=SUPPRESS,\r
+                 default=SUPPRESS,\r
+                 help="show program's version number and exit"):\r
+        super(_VersionAction, self).__init__(\r
+            option_strings=option_strings,\r
+            dest=dest,\r
+            default=default,\r
+            nargs=0,\r
+            help=help)\r
+        self.version = version\r
+\r
+    def __call__(self, parser, namespace, values, option_string=None):\r
+        version = self.version\r
+        if version is None:\r
+            version = parser.version\r
+        formatter = parser._get_formatter()\r
+        formatter.add_text(version)\r
+        parser.exit(message=formatter.format_help())\r
+\r
+\r
+class _SubParsersAction(Action):\r
+\r
+    class _ChoicesPseudoAction(Action):\r
+\r
+        def __init__(self, name, help):\r
+            sup = super(_SubParsersAction._ChoicesPseudoAction, self)\r
+            sup.__init__(option_strings=[], dest=name, help=help)\r
+\r
+    def __init__(self,\r
+                 option_strings,\r
+                 prog,\r
+                 parser_class,\r
+                 dest=SUPPRESS,\r
+                 help=None,\r
+                 metavar=None):\r
+\r
+        self._prog_prefix = prog\r
+        self._parser_class = parser_class\r
+        self._name_parser_map = _collections.OrderedDict()\r
+        self._choices_actions = []\r
+\r
+        super(_SubParsersAction, self).__init__(\r
+            option_strings=option_strings,\r
+            dest=dest,\r
+            nargs=PARSER,\r
+            choices=self._name_parser_map,\r
+            help=help,\r
+            metavar=metavar)\r
+\r
+    def add_parser(self, name, **kwargs):\r
+        # set prog from the existing prefix\r
+        if kwargs.get('prog') is None:\r
+            kwargs['prog'] = '%s %s' % (self._prog_prefix, name)\r
+\r
+        # create a pseudo-action to hold the choice help\r
+        if 'help' in kwargs:\r
+            help = kwargs.pop('help')\r
+            choice_action = self._ChoicesPseudoAction(name, help)\r
+            self._choices_actions.append(choice_action)\r
+\r
+        # create the parser and add it to the map\r
+        parser = self._parser_class(**kwargs)\r
+        self._name_parser_map[name] = parser\r
+        return parser\r
+\r
+    def _get_subactions(self):\r
+        return self._choices_actions\r
+\r
+    def __call__(self, parser, namespace, values, option_string=None):\r
+        parser_name = values[0]\r
+        arg_strings = values[1:]\r
+\r
+        # set the parser name if requested\r
+        if self.dest is not SUPPRESS:\r
+            setattr(namespace, self.dest, parser_name)\r
+\r
+        # select the parser\r
+        try:\r
+            parser = self._name_parser_map[parser_name]\r
+        except KeyError:\r
+            tup = parser_name, ', '.join(self._name_parser_map)\r
+            msg = _('unknown parser %r (choices: %s)') % tup\r
+            raise ArgumentError(self, msg)\r
+\r
+        # parse all the remaining options into the namespace\r
+        # store any unrecognized options on the object, so that the top\r
+        # level parser can decide what to do with them\r
+\r
+        # In case this subparser defines new defaults, we parse them\r
+        # in a new namespace object and then update the original\r
+        # namespace for the relevant parts.\r
+        subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)\r
+        for key, value in vars(subnamespace).items():\r
+            setattr(namespace, key, value)\r
+\r
+        if arg_strings:\r
+            vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])\r
+            getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).extend(arg_strings)\r
+\r
+\r
+# ==============\r
+# Type classes\r
+# ==============\r
+\r
+class FileType(object):\r
+    """Factory for creating file object types\r
+\r
+    Instances of FileType are typically passed as type= arguments to the\r
+    ArgumentParser add_argument() method.\r
+\r
+    Keyword Arguments:\r
+        - mode -- A string indicating how the file is to be opened. Accepts the\r
+            same values as the builtin open() function.\r
+        - bufsize -- The file's desired buffer size. Accepts the same values as\r
+            the builtin open() function.\r
+    """\r
+\r
+    def __init__(self, mode='r', bufsize=-1):\r
+        self._mode = mode\r
+        self._bufsize = bufsize\r
+\r
+    def __call__(self, string):\r
+        # the special argument "-" means sys.std{in,out}\r
+        if string == '-':\r
+            if 'r' in self._mode:\r
+                return _sys.stdin\r
+            elif 'w' in self._mode:\r
+                return _sys.stdout\r
+            else:\r
+                msg = _('argument "-" with mode %r') % self._mode\r
+                raise ValueError(msg)\r
+\r
+        # all other arguments are used as file names\r
+        try:\r
+            return open(string, self._mode, self._bufsize)\r
+        except IOError as e:\r
+            message = _("can't open '%s': %s")\r
+            raise ArgumentTypeError(message % (string, e))\r
+\r
+    def __repr__(self):\r
+        args = self._mode, self._bufsize\r
+        args_str = ', '.join(repr(arg) for arg in args if arg != -1)\r
+        return '%s(%s)' % (type(self).__name__, args_str)\r
+\r
+# ===========================\r
+# Optional and Positional Parsing\r
+# ===========================\r
+\r
+class Namespace(_AttributeHolder):\r
+    """Simple object for storing attributes.\r
+\r
+    Implements equality by attribute names and values, and provides a simple\r
+    string representation.\r
+    """\r
+\r
+    def __init__(self, **kwargs):\r
+        for name in kwargs:\r
+            setattr(self, name, kwargs[name])\r
+\r
+    __hash__ = None\r
+\r
+    def __eq__(self, other):\r
+        if not isinstance(other, Namespace):\r
+            return NotImplemented\r
+        return vars(self) == vars(other)\r
+\r
+    def __ne__(self, other):\r
+        if not isinstance(other, Namespace):\r
+            return NotImplemented\r
+        return not (self == other)\r
+\r
+    def __contains__(self, key):\r
+        return key in self.__dict__\r
+\r
+\r
+class _ActionsContainer(object):\r
+\r
+    def __init__(self,\r
+                 description,\r
+                 prefix_chars,\r
+                 argument_default,\r
+                 conflict_handler):\r
+        super(_ActionsContainer, self).__init__()\r
+\r
+        self.description = description\r
+        self.argument_default = argument_default\r
+        self.prefix_chars = prefix_chars\r
+        self.conflict_handler = conflict_handler\r
+\r
+        # set up registries\r
+        self._registries = {}\r
+\r
+        # register actions\r
+        self.register('action', None, _StoreAction)\r
+        self.register('action', 'store', _StoreAction)\r
+        self.register('action', 'store_const', _StoreConstAction)\r
+        self.register('action', 'store_true', _StoreTrueAction)\r
+        self.register('action', 'store_false', _StoreFalseAction)\r
+        self.register('action', 'append', _AppendAction)\r
+        self.register('action', 'append_const', _AppendConstAction)\r
+        self.register('action', 'count', _CountAction)\r
+        self.register('action', 'help', _HelpAction)\r
+        self.register('action', 'version', _VersionAction)\r
+        self.register('action', 'parsers', _SubParsersAction)\r
+\r
+        # raise an exception if the conflict handler is invalid\r
+        self._get_handler()\r
+\r
+        # action storage\r
+        self._actions = []\r
+        self._option_string_actions = {}\r
+\r
+        # groups\r
+        self._action_groups = []\r
+        self._mutually_exclusive_groups = []\r
+\r
+        # defaults storage\r
+        self._defaults = {}\r
+\r
+        # determines whether an "option" looks like a negative number\r
+        self._negative_number_matcher = _re.compile(r'^-\d+$|^-\d*\.\d+$')\r
+\r
+        # whether or not there are any optionals that look like negative\r
+        # numbers -- uses a list so it can be shared and edited\r
+        self._has_negative_number_optionals = []\r
+\r
+    # ====================\r
+    # Registration methods\r
+    # ====================\r
+    def register(self, registry_name, value, object):\r
+        registry = self._registries.setdefault(registry_name, {})\r
+        registry[value] = object\r
+\r
+    def _registry_get(self, registry_name, value, default=None):\r
+        return self._registries[registry_name].get(value, default)\r
+\r
+    # ==================================\r
+    # Namespace default accessor methods\r
+    # ==================================\r
+    def set_defaults(self, **kwargs):\r
+        self._defaults.update(kwargs)\r
+\r
+        # if these defaults match any existing arguments, replace\r
+        # the previous default on the object with the new one\r
+        for action in self._actions:\r
+            if action.dest in kwargs:\r
+                action.default = kwargs[action.dest]\r
+\r
+    def get_default(self, dest):\r
+        for action in self._actions:\r
+            if action.dest == dest and action.default is not None:\r
+                return action.default\r
+        return self._defaults.get(dest, None)\r
+\r
+\r
+    # =======================\r
+    # Adding argument actions\r
+    # =======================\r
+    def add_argument(self, *args, **kwargs):\r
+        """\r
+        add_argument(dest, ..., name=value, ...)\r
+        add_argument(option_string, option_string, ..., name=value, ...)\r
+        """\r
+\r
+        # if no positional args are supplied or only one is supplied and\r
+        # it doesn't look like an option string, parse a positional\r
+        # argument\r
+        chars = self.prefix_chars\r
+        if not args or len(args) == 1 and args[0][0] not in chars:\r
+            if args and 'dest' in kwargs:\r
+                raise ValueError('dest supplied twice for positional argument')\r
+            kwargs = self._get_positional_kwargs(*args, **kwargs)\r
+\r
+        # otherwise, we're adding an optional argument\r
+        else:\r
+            kwargs = self._get_optional_kwargs(*args, **kwargs)\r
+\r
+        # if no default was supplied, use the parser-level default\r
+        if 'default' not in kwargs:\r
+            dest = kwargs['dest']\r
+            if dest in self._defaults:\r
+                kwargs['default'] = self._defaults[dest]\r
+            elif self.argument_default is not None:\r
+                kwargs['default'] = self.argument_default\r
+\r
+        # create the action object, and add it to the parser\r
+        action_class = self._pop_action_class(kwargs)\r
+        if not _callable(action_class):\r
+            raise ValueError('unknown action "%s"' % (action_class,))\r
+        action = action_class(**kwargs)\r
+\r
+        # raise an error if the action type is not callable\r
+        type_func = self._registry_get('type', action.type, action.type)\r
+        if not _callable(type_func):\r
+            raise ValueError('%r is not callable' % (type_func,))\r
+\r
+        # raise an error if the metavar does not match the type\r
+        if hasattr(self, "_get_formatter"):\r
+            try:\r
+                self._get_formatter()._format_args(action, None)\r
+            except TypeError:\r
+                raise ValueError("length of metavar tuple does not match nargs")\r
+\r
+        return self._add_action(action)\r
+\r
+    def add_argument_group(self, *args, **kwargs):\r
+        group = _ArgumentGroup(self, *args, **kwargs)\r
+        self._action_groups.append(group)\r
+        return group\r
+\r
+    def add_mutually_exclusive_group(self, **kwargs):\r
+        group = _MutuallyExclusiveGroup(self, **kwargs)\r
+        self._mutually_exclusive_groups.append(group)\r
+        return group\r
+\r
+    def _add_action(self, action):\r
+        # resolve any conflicts\r
+        self._check_conflict(action)\r
+\r
+        # add to actions list\r
+        self._actions.append(action)\r
+        action.container = self\r
+\r
+        # index the action by any option strings it has\r
+        for option_string in action.option_strings:\r
+            self._option_string_actions[option_string] = action\r
+\r
+        # set the flag if any option strings look like negative numbers\r
+        for option_string in action.option_strings:\r
+            if self._negative_number_matcher.match(option_string):\r
+                if not self._has_negative_number_optionals:\r
+                    self._has_negative_number_optionals.append(True)\r
+\r
+        # return the created action\r
+        return action\r
+\r
+    def _remove_action(self, action):\r
+        self._actions.remove(action)\r
+\r
+    def _add_container_actions(self, container):\r
+        # collect groups by titles\r
+        title_group_map = {}\r
+        for group in self._action_groups:\r
+            if group.title in title_group_map:\r
+                msg = _('cannot merge actions - two groups are named %r')\r
+                raise ValueError(msg % (group.title))\r
+            title_group_map[group.title] = group\r
+\r
+        # map each action to its group\r
+        group_map = {}\r
+        for group in container._action_groups:\r
+\r
+            # if a group with the title exists, use that, otherwise\r
+            # create a new group matching the container's group\r
+            if group.title not in title_group_map:\r
+                title_group_map[group.title] = self.add_argument_group(\r
+                    title=group.title,\r
+                    description=group.description,\r
+                    conflict_handler=group.conflict_handler)\r
+\r
+            # map the actions to their new group\r
+            for action in group._group_actions:\r
+                group_map[action] = title_group_map[group.title]\r
+\r
+        # add container's mutually exclusive groups\r
+        # NOTE: if add_mutually_exclusive_group ever gains title= and\r
+        # description= then this code will need to be expanded as above\r
+        for group in container._mutually_exclusive_groups:\r
+            mutex_group = self.add_mutually_exclusive_group(\r
+                required=group.required)\r
+\r
+            # map the actions to their new mutex group\r
+            for action in group._group_actions:\r
+                group_map[action] = mutex_group\r
+\r
+        # add all actions to this container or their group\r
+        for action in container._actions:\r
+            group_map.get(action, self)._add_action(action)\r
+\r
+    def _get_positional_kwargs(self, dest, **kwargs):\r
+        # make sure required is not specified\r
+        if 'required' in kwargs:\r
+            msg = _("'required' is an invalid argument for positionals")\r
+            raise TypeError(msg)\r
+\r
+        # mark positional arguments as required if at least one is\r
+        # always required\r
+        if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]:\r
+            kwargs['required'] = True\r
+        if kwargs.get('nargs') == ZERO_OR_MORE and 'default' not in kwargs:\r
+            kwargs['required'] = True\r
+\r
+        # return the keyword arguments with no option strings\r
+        return dict(kwargs, dest=dest, option_strings=[])\r
+\r
+    def _get_optional_kwargs(self, *args, **kwargs):\r
+        # determine short and long option strings\r
+        option_strings = []\r
+        long_option_strings = []\r
+        for option_string in args:\r
+            # error on strings that don't start with an appropriate prefix\r
+            if not option_string[0] in self.prefix_chars:\r
+                msg = _('invalid option string %r: '\r
+                        'must start with a character %r')\r
+                tup = option_string, self.prefix_chars\r
+                raise ValueError(msg % tup)\r
+\r
+            # strings starting with two prefix characters are long options\r
+            option_strings.append(option_string)\r
+            if option_string[0] in self.prefix_chars:\r
+                if len(option_string) > 1:\r
+                    if option_string[1] in self.prefix_chars:\r
+                        long_option_strings.append(option_string)\r
+\r
+        # infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x'\r
+        dest = kwargs.pop('dest', None)\r
+        if dest is None:\r
+            if long_option_strings:\r
+                dest_option_string = long_option_strings[0]\r
+            else:\r
+                dest_option_string = option_strings[0]\r
+            dest = dest_option_string.lstrip(self.prefix_chars)\r
+            if not dest:\r
+                msg = _('dest= is required for options like %r')\r
+                raise ValueError(msg % option_string)\r
+            dest = dest.replace('-', '_')\r
+\r
+        # return the updated keyword arguments\r
+        return dict(kwargs, dest=dest, option_strings=option_strings)\r
+\r
+    def _pop_action_class(self, kwargs, default=None):\r
+        action = kwargs.pop('action', default)\r
+        return self._registry_get('action', action, action)\r
+\r
+    def _get_handler(self):\r
+        # determine function from conflict handler string\r
+        handler_func_name = '_handle_conflict_%s' % self.conflict_handler\r
+        try:\r
+            return getattr(self, handler_func_name)\r
+        except AttributeError:\r
+            msg = _('invalid conflict_resolution value: %r')\r
+            raise ValueError(msg % self.conflict_handler)\r
+\r
+    def _check_conflict(self, action):\r
+\r
+        # find all options that conflict with this option\r
+        confl_optionals = []\r
+        for option_string in action.option_strings:\r
+            if option_string in self._option_string_actions:\r
+                confl_optional = self._option_string_actions[option_string]\r
+                confl_optionals.append((option_string, confl_optional))\r
+\r
+        # resolve any conflicts\r
+        if confl_optionals:\r
+            conflict_handler = self._get_handler()\r
+            conflict_handler(action, confl_optionals)\r
+\r
+    def _handle_conflict_error(self, action, conflicting_actions):\r
+        message = _('conflicting option string(s): %s')\r
+        conflict_string = ', '.join([option_string\r
+                                     for option_string, action\r
+                                     in conflicting_actions])\r
+        raise ArgumentError(action, message % conflict_string)\r
+\r
+    def _handle_conflict_resolve(self, action, conflicting_actions):\r
+\r
+        # remove all conflicting options\r
+        for option_string, action in conflicting_actions:\r
+\r
+            # remove the conflicting option\r
+            action.option_strings.remove(option_string)\r
+            self._option_string_actions.pop(option_string, None)\r
+\r
+            # if the option now has no option string, remove it from the\r
+            # container holding it\r
+            if not action.option_strings:\r
+                action.container._remove_action(action)\r
+\r
+\r
+class _ArgumentGroup(_ActionsContainer):\r
+\r
+    def __init__(self, container, title=None, description=None, **kwargs):\r
+        # add any missing keyword arguments by checking the container\r
+        update = kwargs.setdefault\r
+        update('conflict_handler', container.conflict_handler)\r
+        update('prefix_chars', container.prefix_chars)\r
+        update('argument_default', container.argument_default)\r
+        super_init = super(_ArgumentGroup, self).__init__\r
+        super_init(description=description, **kwargs)\r
+\r
+        # group attributes\r
+        self.title = title\r
+        self._group_actions = []\r
+\r
+        # share most attributes with the container\r
+        self._registries = container._registries\r
+        self._actions = container._actions\r
+        self._option_string_actions = container._option_string_actions\r
+        self._defaults = container._defaults\r
+        self._has_negative_number_optionals = \\r
+            container._has_negative_number_optionals\r
+        self._mutually_exclusive_groups = container._mutually_exclusive_groups\r
+\r
+    def _add_action(self, action):\r
+        action = super(_ArgumentGroup, self)._add_action(action)\r
+        self._group_actions.append(action)\r
+        return action\r
+\r
+    def _remove_action(self, action):\r
+        super(_ArgumentGroup, self)._remove_action(action)\r
+        self._group_actions.remove(action)\r
+\r
+\r
+class _MutuallyExclusiveGroup(_ArgumentGroup):\r
+\r
+    def __init__(self, container, required=False):\r
+        super(_MutuallyExclusiveGroup, self).__init__(container)\r
+        self.required = required\r
+        self._container = container\r
+\r
+    def _add_action(self, action):\r
+        if action.required:\r
+            msg = _('mutually exclusive arguments must be optional')\r
+            raise ValueError(msg)\r
+        action = self._container._add_action(action)\r
+        self._group_actions.append(action)\r
+        return action\r
+\r
+    def _remove_action(self, action):\r
+        self._container._remove_action(action)\r
+        self._group_actions.remove(action)\r
+\r
+\r
+class ArgumentParser(_AttributeHolder, _ActionsContainer):\r
+    """Object for parsing command line strings into Python objects.\r
+\r
+    Keyword Arguments:\r
+        - prog -- The name of the program (default: sys.argv[0])\r
+        - usage -- A usage message (default: auto-generated from arguments)\r
+        - description -- A description of what the program does\r
+        - epilog -- Text following the argument descriptions\r
+        - parents -- Parsers whose arguments should be copied into this one\r
+        - formatter_class -- HelpFormatter class for printing help messages\r
+        - prefix_chars -- Characters that prefix optional arguments\r
+        - fromfile_prefix_chars -- Characters that prefix files containing\r
+            additional arguments\r
+        - argument_default -- The default value for all arguments\r
+        - conflict_handler -- String indicating how to handle conflicts\r
+        - add_help -- Add a -h/-help option\r
+    """\r
+\r
+    def __init__(self,\r
+                 prog=None,\r
+                 usage=None,\r
+                 description=None,\r
+                 epilog=None,\r
+                 version=None,\r
+                 parents=[],\r
+                 formatter_class=HelpFormatter,\r
+                 prefix_chars='-',\r
+                 fromfile_prefix_chars=None,\r
+                 argument_default=None,\r
+                 conflict_handler='error',\r
+                 add_help=True):\r
+\r
+        if version is not None:\r
+            import warnings\r
+            warnings.warn(\r
+                """The "version" argument to ArgumentParser is deprecated. """\r
+                """Please use """\r
+                """"add_argument(..., action='version', version="N", ...)" """\r
+                """instead""", DeprecationWarning)\r
+\r
+        superinit = super(ArgumentParser, self).__init__\r
+        superinit(description=description,\r
+                  prefix_chars=prefix_chars,\r
+                  argument_default=argument_default,\r
+                  conflict_handler=conflict_handler)\r
+\r
+        # default setting for prog\r
+        if prog is None:\r
+            prog = _os.path.basename(_sys.argv[0])\r
+\r
+        self.prog = prog\r
+        self.usage = usage\r
+        self.epilog = epilog\r
+        self.version = version\r
+        self.formatter_class = formatter_class\r
+        self.fromfile_prefix_chars = fromfile_prefix_chars\r
+        self.add_help = add_help\r
+\r
+        add_group = self.add_argument_group\r
+        self._positionals = add_group(_('positional arguments'))\r
+        self._optionals = add_group(_('optional arguments'))\r
+        self._subparsers = None\r
+\r
+        # register types\r
+        def identity(string):\r
+            return string\r
+        self.register('type', None, identity)\r
+\r
+        # add help and version arguments if necessary\r
+        # (using explicit default to override global argument_default)\r
+        default_prefix = '-' if '-' in prefix_chars else prefix_chars[0]\r
+        if self.add_help:\r
+            self.add_argument(\r
+                default_prefix+'h', default_prefix*2+'help',\r
+                action='help', default=SUPPRESS,\r
+                help=_('show this help message and exit'))\r
+        if self.version:\r
+            self.add_argument(\r
+                default_prefix+'v', default_prefix*2+'version',\r
+                action='version', default=SUPPRESS,\r
+                version=self.version,\r
+                help=_("show program's version number and exit"))\r
+\r
+        # add parent arguments and defaults\r
+        for parent in parents:\r
+            self._add_container_actions(parent)\r
+            try:\r
+                defaults = parent._defaults\r
+            except AttributeError:\r
+                pass\r
+            else:\r
+                self._defaults.update(defaults)\r
+\r
+    # =======================\r
+    # Pretty __repr__ methods\r
+    # =======================\r
+    def _get_kwargs(self):\r
+        names = [\r
+            'prog',\r
+            'usage',\r
+            'description',\r
+            'version',\r
+            'formatter_class',\r
+            'conflict_handler',\r
+            'add_help',\r
+        ]\r
+        return [(name, getattr(self, name)) for name in names]\r
+\r
+    # ==================================\r
+    # Optional/Positional adding methods\r
+    # ==================================\r
+    def add_subparsers(self, **kwargs):\r
+        if self._subparsers is not None:\r
+            self.error(_('cannot have multiple subparser arguments'))\r
+\r
+        # add the parser class to the arguments if it's not present\r
+        kwargs.setdefault('parser_class', type(self))\r
+\r
+        if 'title' in kwargs or 'description' in kwargs:\r
+            title = _(kwargs.pop('title', 'subcommands'))\r
+            description = _(kwargs.pop('description', None))\r
+            self._subparsers = self.add_argument_group(title, description)\r
+        else:\r
+            self._subparsers = self._positionals\r
+\r
+        # prog defaults to the usage message of this parser, skipping\r
+        # optional arguments and with no "usage:" prefix\r
+        if kwargs.get('prog') is None:\r
+            formatter = self._get_formatter()\r
+            positionals = self._get_positional_actions()\r
+            groups = self._mutually_exclusive_groups\r
+            formatter.add_usage(self.usage, positionals, groups, '')\r
+            kwargs['prog'] = formatter.format_help().strip()\r
+\r
+        # create the parsers action and add it to the positionals list\r
+        parsers_class = self._pop_action_class(kwargs, 'parsers')\r
+        action = parsers_class(option_strings=[], **kwargs)\r
+        self._subparsers._add_action(action)\r
+\r
+        # return the created parsers action\r
+        return action\r
+\r
+    def _add_action(self, action):\r
+        if action.option_strings:\r
+            self._optionals._add_action(action)\r
+        else:\r
+            self._positionals._add_action(action)\r
+        return action\r
+\r
+    def _get_optional_actions(self):\r
+        return [action\r
+                for action in self._actions\r
+                if action.option_strings]\r
+\r
+    def _get_positional_actions(self):\r
+        return [action\r
+                for action in self._actions\r
+                if not action.option_strings]\r
+\r
+    # =====================================\r
+    # Command line argument parsing methods\r
+    # =====================================\r
+    def parse_args(self, args=None, namespace=None):\r
+        args, argv = self.parse_known_args(args, namespace)\r
+        if argv:\r
+            msg = _('unrecognized arguments: %s')\r
+            self.error(msg % ' '.join(argv))\r
+        return args\r
+\r
+    def parse_known_args(self, args=None, namespace=None):\r
+        if args is None:\r
+            # args default to the system args\r
+            args = _sys.argv[1:]\r
+        else:\r
+            # make sure that args are mutable\r
+            args = list(args)\r
+\r
+        # default Namespace built from parser defaults\r
+        if namespace is None:\r
+            namespace = Namespace()\r
+\r
+        # add any action defaults that aren't present\r
+        for action in self._actions:\r
+            if action.dest is not SUPPRESS:\r
+                if not hasattr(namespace, action.dest):\r
+                    if action.default is not SUPPRESS:\r
+                        setattr(namespace, action.dest, action.default)\r
+\r
+        # add any parser defaults that aren't present\r
+        for dest in self._defaults:\r
+            if not hasattr(namespace, dest):\r
+                setattr(namespace, dest, self._defaults[dest])\r
+\r
+        # parse the arguments and exit if there are any errors\r
+        try:\r
+            namespace, args = self._parse_known_args(args, namespace)\r
+            if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR):\r
+                args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR))\r
+                delattr(namespace, _UNRECOGNIZED_ARGS_ATTR)\r
+            return namespace, args\r
+        except ArgumentError:\r
+            err = _sys.exc_info()[1]\r
+            self.error(str(err))\r
+\r
+    def _parse_known_args(self, arg_strings, namespace):\r
+        # replace arg strings that are file references\r
+        if self.fromfile_prefix_chars is not None:\r
+            arg_strings = self._read_args_from_files(arg_strings)\r
+\r
+        # map all mutually exclusive arguments to the other arguments\r
+        # they can't occur with\r
+        action_conflicts = {}\r
+        for mutex_group in self._mutually_exclusive_groups:\r
+            group_actions = mutex_group._group_actions\r
+            for i, mutex_action in enumerate(mutex_group._group_actions):\r
+                conflicts = action_conflicts.setdefault(mutex_action, [])\r
+                conflicts.extend(group_actions[:i])\r
+                conflicts.extend(group_actions[i + 1:])\r
+\r
+        # find all option indices, and determine the arg_string_pattern\r
+        # which has an 'O' if there is an option at an index,\r
+        # an 'A' if there is an argument, or a '-' if there is a '--'\r
+        option_string_indices = {}\r
+        arg_string_pattern_parts = []\r
+        arg_strings_iter = iter(arg_strings)\r
+        for i, arg_string in enumerate(arg_strings_iter):\r
+\r
+            # all args after -- are non-options\r
+            if arg_string == '--':\r
+                arg_string_pattern_parts.append('-')\r
+                for arg_string in arg_strings_iter:\r
+                    arg_string_pattern_parts.append('A')\r
+\r
+            # otherwise, add the arg to the arg strings\r
+            # and note the index if it was an option\r
+            else:\r
+                option_tuple = self._parse_optional(arg_string)\r
+                if option_tuple is None:\r
+                    pattern = 'A'\r
+                else:\r
+                    option_string_indices[i] = option_tuple\r
+                    pattern = 'O'\r
+                arg_string_pattern_parts.append(pattern)\r
+\r
+        # join the pieces together to form the pattern\r
+        arg_strings_pattern = ''.join(arg_string_pattern_parts)\r
+\r
+        # converts arg strings to the appropriate and then takes the action\r
+        seen_actions = set()\r
+        seen_non_default_actions = set()\r
+\r
+        def take_action(action, argument_strings, option_string=None):\r
+            seen_actions.add(action)\r
+            argument_values = self._get_values(action, argument_strings)\r
+\r
+            # error if this argument is not allowed with other previously\r
+            # seen arguments, assuming that actions that use the default\r
+            # value don't really count as "present"\r
+            if argument_values is not action.default:\r
+                seen_non_default_actions.add(action)\r
+                for conflict_action in action_conflicts.get(action, []):\r
+                    if conflict_action in seen_non_default_actions:\r
+                        msg = _('not allowed with argument %s')\r
+                        action_name = _get_action_name(conflict_action)\r
+                        raise ArgumentError(action, msg % action_name)\r
+\r
+            # take the action if we didn't receive a SUPPRESS value\r
+            # (e.g. from a default)\r
+            if argument_values is not SUPPRESS:\r
+                action(self, namespace, argument_values, option_string)\r
+\r
+        # function to convert arg_strings into an optional action\r
+        def consume_optional(start_index):\r
+\r
+            # get the optional identified at this index\r
+            option_tuple = option_string_indices[start_index]\r
+            action, option_string, explicit_arg = option_tuple\r
+\r
+            # identify additional optionals in the same arg string\r
+            # (e.g. -xyz is the same as -x -y -z if no args are required)\r
+            match_argument = self._match_argument\r
+            action_tuples = []\r
+            while True:\r
+\r
+                # if we found no optional action, skip it\r
+                if action is None:\r
+                    extras.append(arg_strings[start_index])\r
+                    return start_index + 1\r
+\r
+                # if there is an explicit argument, try to match the\r
+                # optional's string arguments to only this\r
+                if explicit_arg is not None:\r
+                    arg_count = match_argument(action, 'A')\r
+\r
+                    # if the action is a single-dash option and takes no\r
+                    # arguments, try to parse more single-dash options out\r
+                    # of the tail of the option string\r
+                    chars = self.prefix_chars\r
+                    if arg_count == 0 and option_string[1] not in chars:\r
+                        action_tuples.append((action, [], option_string))\r
+                        char = option_string[0]\r
+                        option_string = char + explicit_arg[0]\r
+                        new_explicit_arg = explicit_arg[1:] or None\r
+                        optionals_map = self._option_string_actions\r
+                        if option_string in optionals_map:\r
+                            action = optionals_map[option_string]\r
+                            explicit_arg = new_explicit_arg\r
+                        else:\r
+                            msg = _('ignored explicit argument %r')\r
+                            raise ArgumentError(action, msg % explicit_arg)\r
+\r
+                    # if the action expect exactly one argument, we've\r
+                    # successfully matched the option; exit the loop\r
+                    elif arg_count == 1:\r
+                        stop = start_index + 1\r
+                        args = [explicit_arg]\r
+                        action_tuples.append((action, args, option_string))\r
+                        break\r
+\r
+                    # error if a double-dash option did not use the\r
+                    # explicit argument\r
+                    else:\r
+                        msg = _('ignored explicit argument %r')\r
+                        raise ArgumentError(action, msg % explicit_arg)\r
+\r
+                # if there is no explicit argument, try to match the\r
+                # optional's string arguments with the following strings\r
+                # if successful, exit the loop\r
+                else:\r
+                    start = start_index + 1\r
+                    selected_patterns = arg_strings_pattern[start:]\r
+                    arg_count = match_argument(action, selected_patterns)\r
+                    stop = start + arg_count\r
+                    args = arg_strings[start:stop]\r
+                    action_tuples.append((action, args, option_string))\r
+                    break\r
+\r
+            # add the Optional to the list and return the index at which\r
+            # the Optional's string args stopped\r
+            assert action_tuples\r
+            for action, args, option_string in action_tuples:\r
+                take_action(action, args, option_string)\r
+            return stop\r
+\r
+        # the list of Positionals left to be parsed; this is modified\r
+        # by consume_positionals()\r
+        positionals = self._get_positional_actions()\r
+\r
+        # function to convert arg_strings into positional actions\r
+        def consume_positionals(start_index):\r
+            # match as many Positionals as possible\r
+            match_partial = self._match_arguments_partial\r
+            selected_pattern = arg_strings_pattern[start_index:]\r
+            arg_counts = match_partial(positionals, selected_pattern)\r
+\r
+            # slice off the appropriate arg strings for each Positional\r
+            # and add the Positional and its args to the list\r
+            for action, arg_count in zip(positionals, arg_counts):\r
+                args = arg_strings[start_index: start_index + arg_count]\r
+                start_index += arg_count\r
+                take_action(action, args)\r
+\r
+            # slice off the Positionals that we just parsed and return the\r
+            # index at which the Positionals' string args stopped\r
+            positionals[:] = positionals[len(arg_counts):]\r
+            return start_index\r
+\r
+        # consume Positionals and Optionals alternately, until we have\r
+        # passed the last option string\r
+        extras = []\r
+        start_index = 0\r
+        if option_string_indices:\r
+            max_option_string_index = max(option_string_indices)\r
+        else:\r
+            max_option_string_index = -1\r
+        while start_index <= max_option_string_index:\r
+\r
+            # consume any Positionals preceding the next option\r
+            next_option_string_index = min([\r
+                index\r
+                for index in option_string_indices\r
+                if index >= start_index])\r
+            if start_index != next_option_string_index:\r
+                positionals_end_index = consume_positionals(start_index)\r
+\r
+                # only try to parse the next optional if we didn't consume\r
+                # the option string during the positionals parsing\r
+                if positionals_end_index > start_index:\r
+                    start_index = positionals_end_index\r
+                    continue\r
+                else:\r
+                    start_index = positionals_end_index\r
+\r
+            # if we consumed all the positionals we could and we're not\r
+            # at the index of an option string, there were extra arguments\r
+            if start_index not in option_string_indices:\r
+                strings = arg_strings[start_index:next_option_string_index]\r
+                extras.extend(strings)\r
+                start_index = next_option_string_index\r
+\r
+            # consume the next optional and any arguments for it\r
+            start_index = consume_optional(start_index)\r
+\r
+        # consume any positionals following the last Optional\r
+        stop_index = consume_positionals(start_index)\r
+\r
+        # if we didn't consume all the argument strings, there were extras\r
+        extras.extend(arg_strings[stop_index:])\r
+\r
+        # if we didn't use all the Positional objects, there were too few\r
+        # arg strings supplied.\r
+        if positionals:\r
+            self.error(_('too few arguments'))\r
+\r
+        # make sure all required actions were present, and convert defaults.\r
+        for action in self._actions:\r
+            if action not in seen_actions:\r
+                if action.required:\r
+                    name = _get_action_name(action)\r
+                    self.error(_('argument %s is required') % name)\r
+                else:\r
+                    # Convert action default now instead of doing it before\r
+                    # parsing arguments to avoid calling convert functions\r
+                    # twice (which may fail) if the argument was given, but\r
+                    # only if it was defined already in the namespace\r
+                    if (action.default is not None and\r
+                            isinstance(action.default, basestring) and\r
+                            hasattr(namespace, action.dest) and\r
+                            action.default is getattr(namespace, action.dest)):\r
+                        setattr(namespace, action.dest,\r
+                                self._get_value(action, action.default))\r
+\r
+        # make sure all required groups had one option present\r
+        for group in self._mutually_exclusive_groups:\r
+            if group.required:\r
+                for action in group._group_actions:\r
+                    if action in seen_non_default_actions:\r
+                        break\r
+\r
+                # if no actions were used, report the error\r
+                else:\r
+                    names = [_get_action_name(action)\r
+                             for action in group._group_actions\r
+                             if action.help is not SUPPRESS]\r
+                    msg = _('one of the arguments %s is required')\r
+                    self.error(msg % ' '.join(names))\r
+\r
+        # return the updated namespace and the extra arguments\r
+        return namespace, extras\r
+\r
+    def _read_args_from_files(self, arg_strings):\r
+        # expand arguments referencing files\r
+        new_arg_strings = []\r
+        for arg_string in arg_strings:\r
+\r
+            # for regular arguments, just add them back into the list\r
+            if not arg_string or arg_string[0] not in self.fromfile_prefix_chars:\r
+                new_arg_strings.append(arg_string)\r
+\r
+            # replace arguments referencing files with the file content\r
+            else:\r
+                try:\r
+                    args_file = open(arg_string[1:])\r
+                    try:\r
+                        arg_strings = []\r
+                        for arg_line in args_file.read().splitlines():\r
+                            for arg in self.convert_arg_line_to_args(arg_line):\r
+                                arg_strings.append(arg)\r
+                        arg_strings = self._read_args_from_files(arg_strings)\r
+                        new_arg_strings.extend(arg_strings)\r
+                    finally:\r
+                        args_file.close()\r
+                except IOError:\r
+                    err = _sys.exc_info()[1]\r
+                    self.error(str(err))\r
+\r
+        # return the modified argument list\r
+        return new_arg_strings\r
+\r
+    def convert_arg_line_to_args(self, arg_line):\r
+        return [arg_line]\r
+\r
+    def _match_argument(self, action, arg_strings_pattern):\r
+        # match the pattern for this action to the arg strings\r
+        nargs_pattern = self._get_nargs_pattern(action)\r
+        match = _re.match(nargs_pattern, arg_strings_pattern)\r
+\r
+        # raise an exception if we weren't able to find a match\r
+        if match is None:\r
+            nargs_errors = {\r
+                None: _('expected one argument'),\r
+                OPTIONAL: _('expected at most one argument'),\r
+                ONE_OR_MORE: _('expected at least one argument'),\r
+            }\r
+            default = _('expected %s argument(s)') % action.nargs\r
+            msg = nargs_errors.get(action.nargs, default)\r
+            raise ArgumentError(action, msg)\r
+\r
+        # return the number of arguments matched\r
+        return len(match.group(1))\r
+\r
+    def _match_arguments_partial(self, actions, arg_strings_pattern):\r
+        # progressively shorten the actions list by slicing off the\r
+        # final actions until we find a match\r
+        result = []\r
+        for i in range(len(actions), 0, -1):\r
+            actions_slice = actions[:i]\r
+            pattern = ''.join([self._get_nargs_pattern(action)\r
+                               for action in actions_slice])\r
+            match = _re.match(pattern, arg_strings_pattern)\r
+            if match is not None:\r
+                result.extend([len(string) for string in match.groups()])\r
+                break\r
+\r
+        # return the list of arg string counts\r
+        return result\r
+\r
+    def _parse_optional(self, arg_string):\r
+        # if it's an empty string, it was meant to be a positional\r
+        if not arg_string:\r
+            return None\r
+\r
+        # if it doesn't start with a prefix, it was meant to be positional\r
+        if not arg_string[0] in self.prefix_chars:\r
+            return None\r
+\r
+        # if the option string is present in the parser, return the action\r
+        if arg_string in self._option_string_actions:\r
+            action = self._option_string_actions[arg_string]\r
+            return action, arg_string, None\r
+\r
+        # if it's just a single character, it was meant to be positional\r
+        if len(arg_string) == 1:\r
+            return None\r
+\r
+        # if the option string before the "=" is present, return the action\r
+        if '=' in arg_string:\r
+            option_string, explicit_arg = arg_string.split('=', 1)\r
+            if option_string in self._option_string_actions:\r
+                action = self._option_string_actions[option_string]\r
+                return action, option_string, explicit_arg\r
+\r
+        # search through all possible prefixes of the option string\r
+        # and all actions in the parser for possible interpretations\r
+        option_tuples = self._get_option_tuples(arg_string)\r
+\r
+        # if multiple actions match, the option string was ambiguous\r
+        if len(option_tuples) > 1:\r
+            options = ', '.join([option_string\r
+                for action, option_string, explicit_arg in option_tuples])\r
+            tup = arg_string, options\r
+            self.error(_('ambiguous option: %s could match %s') % tup)\r
+\r
+        # if exactly one action matched, this segmentation is good,\r
+        # so return the parsed action\r
+        elif len(option_tuples) == 1:\r
+            option_tuple, = option_tuples\r
+            return option_tuple\r
+\r
+        # if it was not found as an option, but it looks like a negative\r
+        # number, it was meant to be positional\r
+        # unless there are negative-number-like options\r
+        if self._negative_number_matcher.match(arg_string):\r
+            if not self._has_negative_number_optionals:\r
+                return None\r
+\r
+        # if it contains a space, it was meant to be a positional\r
+        if ' ' in arg_string:\r
+            return None\r
+\r
+        # it was meant to be an optional but there is no such option\r
+        # in this parser (though it might be a valid option in a subparser)\r
+        return None, arg_string, None\r
+\r
+    def _get_option_tuples(self, option_string):\r
+        result = []\r
+\r
+        # option strings starting with two prefix characters are only\r
+        # split at the '='\r
+        chars = self.prefix_chars\r
+        if option_string[0] in chars and option_string[1] in chars:\r
+            if '=' in option_string:\r
+                option_prefix, explicit_arg = option_string.split('=', 1)\r
+            else:\r
+                option_prefix = option_string\r
+                explicit_arg = None\r
+            for option_string in self._option_string_actions:\r
+                if option_string.startswith(option_prefix):\r
+                    action = self._option_string_actions[option_string]\r
+                    tup = action, option_string, explicit_arg\r
+                    result.append(tup)\r
+\r
+        # single character options can be concatenated with their arguments\r
+        # but multiple character options always have to have their argument\r
+        # separate\r
+        elif option_string[0] in chars and option_string[1] not in chars:\r
+            option_prefix = option_string\r
+            explicit_arg = None\r
+            short_option_prefix = option_string[:2]\r
+            short_explicit_arg = option_string[2:]\r
+\r
+            for option_string in self._option_string_actions:\r
+                if option_string == short_option_prefix:\r
+                    action = self._option_string_actions[option_string]\r
+                    tup = action, option_string, short_explicit_arg\r
+                    result.append(tup)\r
+                elif option_string.startswith(option_prefix):\r
+                    action = self._option_string_actions[option_string]\r
+                    tup = action, option_string, explicit_arg\r
+                    result.append(tup)\r
+\r
+        # shouldn't ever get here\r
+        else:\r
+            self.error(_('unexpected option string: %s') % option_string)\r
+\r
+        # return the collected option tuples\r
+        return result\r
+\r
+    def _get_nargs_pattern(self, action):\r
+        # in all examples below, we have to allow for '--' args\r
+        # which are represented as '-' in the pattern\r
+        nargs = action.nargs\r
+\r
+        # the default (None) is assumed to be a single argument\r
+        if nargs is None:\r
+            nargs_pattern = '(-*A-*)'\r
+\r
+        # allow zero or one arguments\r
+        elif nargs == OPTIONAL:\r
+            nargs_pattern = '(-*A?-*)'\r
+\r
+        # allow zero or more arguments\r
+        elif nargs == ZERO_OR_MORE:\r
+            nargs_pattern = '(-*[A-]*)'\r
+\r
+        # allow one or more arguments\r
+        elif nargs == ONE_OR_MORE:\r
+            nargs_pattern = '(-*A[A-]*)'\r
+\r
+        # allow any number of options or arguments\r
+        elif nargs == REMAINDER:\r
+            nargs_pattern = '([-AO]*)'\r
+\r
+        # allow one argument followed by any number of options or arguments\r
+        elif nargs == PARSER:\r
+            nargs_pattern = '(-*A[-AO]*)'\r
+\r
+        # all others should be integers\r
+        else:\r
+            nargs_pattern = '(-*%s-*)' % '-*'.join('A' * nargs)\r
+\r
+        # if this is an optional action, -- is not allowed\r
+        if action.option_strings:\r
+            nargs_pattern = nargs_pattern.replace('-*', '')\r
+            nargs_pattern = nargs_pattern.replace('-', '')\r
+\r
+        # return the pattern\r
+        return nargs_pattern\r
+\r
+    # ========================\r
+    # Value conversion methods\r
+    # ========================\r
+    def _get_values(self, action, arg_strings):\r
+        # for everything but PARSER, REMAINDER args, strip out first '--'\r
+        if action.nargs not in [PARSER, REMAINDER]:\r
+            try:\r
+                arg_strings.remove('--')\r
+            except ValueError:\r
+                pass\r
+\r
+        # optional argument produces a default when not present\r
+        if not arg_strings and action.nargs == OPTIONAL:\r
+            if action.option_strings:\r
+                value = action.const\r
+            else:\r
+                value = action.default\r
+            if isinstance(value, basestring):\r
+                value = self._get_value(action, value)\r
+                self._check_value(action, value)\r
+\r
+        # when nargs='*' on a positional, if there were no command-line\r
+        # args, use the default if it is anything other than None\r
+        elif (not arg_strings and action.nargs == ZERO_OR_MORE and\r
+              not action.option_strings):\r
+            if action.default is not None:\r
+                value = action.default\r
+            else:\r
+                value = arg_strings\r
+            self._check_value(action, value)\r
+\r
+        # single argument or optional argument produces a single value\r
+        elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]:\r
+            arg_string, = arg_strings\r
+            value = self._get_value(action, arg_string)\r
+            self._check_value(action, value)\r
+\r
+        # REMAINDER arguments convert all values, checking none\r
+        elif action.nargs == REMAINDER:\r
+            value = [self._get_value(action, v) for v in arg_strings]\r
+\r
+        # PARSER arguments convert all values, but check only the first\r
+        elif action.nargs == PARSER:\r
+            value = [self._get_value(action, v) for v in arg_strings]\r
+            self._check_value(action, value[0])\r
+\r
+        # all other types of nargs produce a list\r
+        else:\r
+            value = [self._get_value(action, v) for v in arg_strings]\r
+            for v in value:\r
+                self._check_value(action, v)\r
+\r
+        # return the converted value\r
+        return value\r
+\r
+    def _get_value(self, action, arg_string):\r
+        type_func = self._registry_get('type', action.type, action.type)\r
+        if not _callable(type_func):\r
+            msg = _('%r is not callable')\r
+            raise ArgumentError(action, msg % type_func)\r
+\r
+        # convert the value to the appropriate type\r
+        try:\r
+            result = type_func(arg_string)\r
+\r
+        # ArgumentTypeErrors indicate errors\r
+        except ArgumentTypeError:\r
+            name = getattr(action.type, '__name__', repr(action.type))\r
+            msg = str(_sys.exc_info()[1])\r
+            raise ArgumentError(action, msg)\r
+\r
+        # TypeErrors or ValueErrors also indicate errors\r
+        except (TypeError, ValueError):\r
+            name = getattr(action.type, '__name__', repr(action.type))\r
+            msg = _('invalid %s value: %r')\r
+            raise ArgumentError(action, msg % (name, arg_string))\r
+\r
+        # return the converted value\r
+        return result\r
+\r
+    def _check_value(self, action, value):\r
+        # converted value must be one of the choices (if specified)\r
+        if action.choices is not None and value not in action.choices:\r
+            tup = value, ', '.join(map(repr, action.choices))\r
+            msg = _('invalid choice: %r (choose from %s)') % tup\r
+            raise ArgumentError(action, msg)\r
+\r
+    # =======================\r
+    # Help-formatting methods\r
+    # =======================\r
+    def format_usage(self):\r
+        formatter = self._get_formatter()\r
+        formatter.add_usage(self.usage, self._actions,\r
+                            self._mutually_exclusive_groups)\r
+        return formatter.format_help()\r
+\r
+    def format_help(self):\r
+        formatter = self._get_formatter()\r
+\r
+        # usage\r
+        formatter.add_usage(self.usage, self._actions,\r
+                            self._mutually_exclusive_groups)\r
+\r
+        # description\r
+        formatter.add_text(self.description)\r
+\r
+        # positionals, optionals and user-defined groups\r
+        for action_group in self._action_groups:\r
+            formatter.start_section(action_group.title)\r
+            formatter.add_text(action_group.description)\r
+            formatter.add_arguments(action_group._group_actions)\r
+            formatter.end_section()\r
+\r
+        # epilog\r
+        formatter.add_text(self.epilog)\r
+\r
+        # determine help from format above\r
+        return formatter.format_help()\r
+\r
+    def format_version(self):\r
+        import warnings\r
+        warnings.warn(\r
+            'The format_version method is deprecated -- the "version" '\r
+            'argument to ArgumentParser is no longer supported.',\r
+            DeprecationWarning)\r
+        formatter = self._get_formatter()\r
+        formatter.add_text(self.version)\r
+        return formatter.format_help()\r
+\r
+    def _get_formatter(self):\r
+        return self.formatter_class(prog=self.prog)\r
+\r
+    # =====================\r
+    # Help-printing methods\r
+    # =====================\r
+    def print_usage(self, file=None):\r
+        if file is None:\r
+            file = _sys.stdout\r
+        self._print_message(self.format_usage(), file)\r
+\r
+    def print_help(self, file=None):\r
+        if file is None:\r
+            file = _sys.stdout\r
+        self._print_message(self.format_help(), file)\r
+\r
+    def print_version(self, file=None):\r
+        import warnings\r
+        warnings.warn(\r
+            'The print_version method is deprecated -- the "version" '\r
+            'argument to ArgumentParser is no longer supported.',\r
+            DeprecationWarning)\r
+        self._print_message(self.format_version(), file)\r
+\r
+    def _print_message(self, message, file=None):\r
+        if message:\r
+            if file is None:\r
+                file = _sys.stderr\r
+            file.write(message)\r
+\r
+    # ===============\r
+    # Exiting methods\r
+    # ===============\r
+    def exit(self, status=0, message=None):\r
+        if message:\r
+            self._print_message(message, _sys.stderr)\r
+        _sys.exit(status)\r
+\r
+    def error(self, message):\r
+        """error(message: string)\r
+\r
+        Prints a usage message incorporating the message to stderr and\r
+        exits.\r
+\r
+        If you override this in a subclass, it should not return -- it\r
+        should either exit or raise an exception.\r
+        """\r
+        self.print_usage(_sys.stderr)\r
+        self.exit(2, _('%s: error: %s\n') % (self.prog, message))\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/ast.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/ast.py
new file mode 100644 (file)
index 0000000..4070c39
--- /dev/null
@@ -0,0 +1,311 @@
+# -*- coding: utf-8 -*-\r
+"""\r
+    ast\r
+    ~~~\r
+\r
+    The `ast` module helps Python applications to process trees of the Python\r
+    abstract syntax grammar.  The abstract syntax itself might change with\r
+    each Python release; this module helps to find out programmatically what\r
+    the current grammar looks like and allows modifications of it.\r
+\r
+    An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as\r
+    a flag to the `compile()` builtin function or by using the `parse()`\r
+    function from this module.  The result will be a tree of objects whose\r
+    classes all inherit from `ast.AST`.\r
+\r
+    A modified abstract syntax tree can be compiled into a Python code object\r
+    using the built-in `compile()` function.\r
+\r
+    Additionally various helper functions are provided that make working with\r
+    the trees simpler.  The main intention of the helper functions and this\r
+    module in general is to provide an easy to use interface for libraries\r
+    that work tightly with the python syntax (template engines for example).\r
+\r
+\r
+    :copyright: Copyright 2008 by Armin Ronacher.\r
+    :license: Python License.\r
+"""\r
+from _ast import *\r
+from _ast import __version__\r
+\r
+\r
+def parse(source, filename='<unknown>', mode='exec'):\r
+    """\r
+    Parse the source into an AST node.\r
+    Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).\r
+    """\r
+    return compile(source, filename, mode, PyCF_ONLY_AST)\r
+\r
+\r
+def literal_eval(node_or_string):\r
+    """\r
+    Safely evaluate an expression node or a string containing a Python\r
+    expression.  The string or node provided may only consist of the following\r
+    Python literal structures: strings, numbers, tuples, lists, dicts, booleans,\r
+    and None.\r
+    """\r
+    _safe_names = {'None': None, 'True': True, 'False': False}\r
+    if isinstance(node_or_string, basestring):\r
+        node_or_string = parse(node_or_string, mode='eval')\r
+    if isinstance(node_or_string, Expression):\r
+        node_or_string = node_or_string.body\r
+    def _convert(node):\r
+        if isinstance(node, Str):\r
+            return node.s\r
+        elif isinstance(node, Num):\r
+            return node.n\r
+        elif isinstance(node, Tuple):\r
+            return tuple(map(_convert, node.elts))\r
+        elif isinstance(node, List):\r
+            return list(map(_convert, node.elts))\r
+        elif isinstance(node, Dict):\r
+            return dict((_convert(k), _convert(v)) for k, v\r
+                        in zip(node.keys, node.values))\r
+        elif isinstance(node, Name):\r
+            if node.id in _safe_names:\r
+                return _safe_names[node.id]\r
+        elif isinstance(node, BinOp) and \\r
+             isinstance(node.op, (Add, Sub)) and \\r
+             isinstance(node.right, Num) and \\r
+             isinstance(node.right.n, complex) and \\r
+             isinstance(node.left, Num) and \\r
+             isinstance(node.left.n, (int, long, float)):\r
+            left = node.left.n\r
+            right = node.right.n\r
+            if isinstance(node.op, Add):\r
+                return left + right\r
+            else:\r
+                return left - right\r
+        raise ValueError('malformed string')\r
+    return _convert(node_or_string)\r
+\r
+\r
+def dump(node, annotate_fields=True, include_attributes=False):\r
+    """\r
+    Return a formatted dump of the tree in *node*.  This is mainly useful for\r
+    debugging purposes.  The returned string will show the names and the values\r
+    for fields.  This makes the code impossible to evaluate, so if evaluation is\r
+    wanted *annotate_fields* must be set to False.  Attributes such as line\r
+    numbers and column offsets are not dumped by default.  If this is wanted,\r
+    *include_attributes* can be set to True.\r
+    """\r
+    def _format(node):\r
+        if isinstance(node, AST):\r
+            fields = [(a, _format(b)) for a, b in iter_fields(node)]\r
+            rv = '%s(%s' % (node.__class__.__name__, ', '.join(\r
+                ('%s=%s' % field for field in fields)\r
+                if annotate_fields else\r
+                (b for a, b in fields)\r
+            ))\r
+            if include_attributes and node._attributes:\r
+                rv += fields and ', ' or ' '\r
+                rv += ', '.join('%s=%s' % (a, _format(getattr(node, a)))\r
+                                for a in node._attributes)\r
+            return rv + ')'\r
+        elif isinstance(node, list):\r
+            return '[%s]' % ', '.join(_format(x) for x in node)\r
+        return repr(node)\r
+    if not isinstance(node, AST):\r
+        raise TypeError('expected AST, got %r' % node.__class__.__name__)\r
+    return _format(node)\r
+\r
+\r
+def copy_location(new_node, old_node):\r
+    """\r
+    Copy source location (`lineno` and `col_offset` attributes) from\r
+    *old_node* to *new_node* if possible, and return *new_node*.\r
+    """\r
+    for attr in 'lineno', 'col_offset':\r
+        if attr in old_node._attributes and attr in new_node._attributes \\r
+           and hasattr(old_node, attr):\r
+            setattr(new_node, attr, getattr(old_node, attr))\r
+    return new_node\r
+\r
+\r
+def fix_missing_locations(node):\r
+    """\r
+    When you compile a node tree with compile(), the compiler expects lineno and\r
+    col_offset attributes for every node that supports them.  This is rather\r
+    tedious to fill in for generated nodes, so this helper adds these attributes\r
+    recursively where not already set, by setting them to the values of the\r
+    parent node.  It works recursively starting at *node*.\r
+    """\r
+    def _fix(node, lineno, col_offset):\r
+        if 'lineno' in node._attributes:\r
+            if not hasattr(node, 'lineno'):\r
+                node.lineno = lineno\r
+            else:\r
+                lineno = node.lineno\r
+        if 'col_offset' in node._attributes:\r
+            if not hasattr(node, 'col_offset'):\r
+                node.col_offset = col_offset\r
+            else:\r
+                col_offset = node.col_offset\r
+        for child in iter_child_nodes(node):\r
+            _fix(child, lineno, col_offset)\r
+    _fix(node, 1, 0)\r
+    return node\r
+\r
+\r
+def increment_lineno(node, n=1):\r
+    """\r
+    Increment the line number of each node in the tree starting at *node* by *n*.\r
+    This is useful to "move code" to a different location in a file.\r
+    """\r
+    for child in walk(node):\r
+        if 'lineno' in child._attributes:\r
+            child.lineno = getattr(child, 'lineno', 0) + n\r
+    return node\r
+\r
+\r
+def iter_fields(node):\r
+    """\r
+    Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``\r
+    that is present on *node*.\r
+    """\r
+    for field in node._fields:\r
+        try:\r
+            yield field, getattr(node, field)\r
+        except AttributeError:\r
+            pass\r
+\r
+\r
+def iter_child_nodes(node):\r
+    """\r
+    Yield all direct child nodes of *node*, that is, all fields that are nodes\r
+    and all items of fields that are lists of nodes.\r
+    """\r
+    for name, field in iter_fields(node):\r
+        if isinstance(field, AST):\r
+            yield field\r
+        elif isinstance(field, list):\r
+            for item in field:\r
+                if isinstance(item, AST):\r
+                    yield item\r
+\r
+\r
+def get_docstring(node, clean=True):\r
+    """\r
+    Return the docstring for the given node or None if no docstring can\r
+    be found.  If the node provided does not have docstrings a TypeError\r
+    will be raised.\r
+    """\r
+    if not isinstance(node, (FunctionDef, ClassDef, Module)):\r
+        raise TypeError("%r can't have docstrings" % node.__class__.__name__)\r
+    if node.body and isinstance(node.body[0], Expr) and \\r
+       isinstance(node.body[0].value, Str):\r
+        if clean:\r
+            import inspect\r
+            return inspect.cleandoc(node.body[0].value.s)\r
+        return node.body[0].value.s\r
+\r
+\r
+def walk(node):\r
+    """\r
+    Recursively yield all descendant nodes in the tree starting at *node*\r
+    (including *node* itself), in no specified order.  This is useful if you\r
+    only want to modify nodes in place and don't care about the context.\r
+    """\r
+    from collections import deque\r
+    todo = deque([node])\r
+    while todo:\r
+        node = todo.popleft()\r
+        todo.extend(iter_child_nodes(node))\r
+        yield node\r
+\r
+\r
+class NodeVisitor(object):\r
+    """\r
+    A node visitor base class that walks the abstract syntax tree and calls a\r
+    visitor function for every node found.  This function may return a value\r
+    which is forwarded by the `visit` method.\r
+\r
+    This class is meant to be subclassed, with the subclass adding visitor\r
+    methods.\r
+\r
+    Per default the visitor functions for the nodes are ``'visit_'`` +\r
+    class name of the node.  So a `TryFinally` node visit function would\r
+    be `visit_TryFinally`.  This behavior can be changed by overriding\r
+    the `visit` method.  If no visitor function exists for a node\r
+    (return value `None`) the `generic_visit` visitor is used instead.\r
+\r
+    Don't use the `NodeVisitor` if you want to apply changes to nodes during\r
+    traversing.  For this a special visitor exists (`NodeTransformer`) that\r
+    allows modifications.\r
+    """\r
+\r
+    def visit(self, node):\r
+        """Visit a node."""\r
+        method = 'visit_' + node.__class__.__name__\r
+        visitor = getattr(self, method, self.generic_visit)\r
+        return visitor(node)\r
+\r
+    def generic_visit(self, node):\r
+        """Called if no explicit visitor function exists for a node."""\r
+        for field, value in iter_fields(node):\r
+            if isinstance(value, list):\r
+                for item in value:\r
+                    if isinstance(item, AST):\r
+                        self.visit(item)\r
+            elif isinstance(value, AST):\r
+                self.visit(value)\r
+\r
+\r
+class NodeTransformer(NodeVisitor):\r
+    """\r
+    A :class:`NodeVisitor` subclass that walks the abstract syntax tree and\r
+    allows modification of nodes.\r
+\r
+    The `NodeTransformer` will walk the AST and use the return value of the\r
+    visitor methods to replace or remove the old node.  If the return value of\r
+    the visitor method is ``None``, the node will be removed from its location,\r
+    otherwise it is replaced with the return value.  The return value may be the\r
+    original node in which case no replacement takes place.\r
+\r
+    Here is an example transformer that rewrites all occurrences of name lookups\r
+    (``foo``) to ``data['foo']``::\r
+\r
+       class RewriteName(NodeTransformer):\r
+\r
+           def visit_Name(self, node):\r
+               return copy_location(Subscript(\r
+                   value=Name(id='data', ctx=Load()),\r
+                   slice=Index(value=Str(s=node.id)),\r
+                   ctx=node.ctx\r
+               ), node)\r
+\r
+    Keep in mind that if the node you're operating on has child nodes you must\r
+    either transform the child nodes yourself or call the :meth:`generic_visit`\r
+    method for the node first.\r
+\r
+    For nodes that were part of a collection of statements (that applies to all\r
+    statement nodes), the visitor may also return a list of nodes rather than\r
+    just a single node.\r
+\r
+    Usually you use the transformer like this::\r
+\r
+       node = YourTransformer().visit(node)\r
+    """\r
+\r
+    def generic_visit(self, node):\r
+        for field, old_value in iter_fields(node):\r
+            old_value = getattr(node, field, None)\r
+            if isinstance(old_value, list):\r
+                new_values = []\r
+                for value in old_value:\r
+                    if isinstance(value, AST):\r
+                        value = self.visit(value)\r
+                        if value is None:\r
+                            continue\r
+                        elif not isinstance(value, AST):\r
+                            new_values.extend(value)\r
+                            continue\r
+                    new_values.append(value)\r
+                old_value[:] = new_values\r
+            elif isinstance(old_value, AST):\r
+                new_node = self.visit(old_value)\r
+                if new_node is None:\r
+                    delattr(node, field)\r
+                else:\r
+                    setattr(node, field, new_node)\r
+        return node\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/atexit.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/atexit.py
new file mode 100644 (file)
index 0000000..6c2769c
--- /dev/null
@@ -0,0 +1,65 @@
+"""\r
+atexit.py - allow programmer to define multiple exit functions to be executed\r
+upon normal program termination.\r
+\r
+One public function, register, is defined.\r
+"""\r
+\r
+__all__ = ["register"]\r
+\r
+import sys\r
+\r
+_exithandlers = []\r
+def _run_exitfuncs():\r
+    """run any registered exit functions\r
+\r
+    _exithandlers is traversed in reverse order so functions are executed\r
+    last in, first out.\r
+    """\r
+\r
+    exc_info = None\r
+    while _exithandlers:\r
+        func, targs, kargs = _exithandlers.pop()\r
+        try:\r
+            func(*targs, **kargs)\r
+        except SystemExit:\r
+            exc_info = sys.exc_info()\r
+        except:\r
+            import traceback\r
+            print >> sys.stderr, "Error in atexit._run_exitfuncs:"\r
+            traceback.print_exc()\r
+            exc_info = sys.exc_info()\r
+\r
+    if exc_info is not None:\r
+        raise exc_info[0], exc_info[1], exc_info[2]\r
+\r
+\r
+def register(func, *targs, **kargs):\r
+    """register a function to be executed upon normal program termination\r
+\r
+    func - function to be called at exit\r
+    targs - optional arguments to pass to func\r
+    kargs - optional keyword arguments to pass to func\r
+\r
+    func is returned to facilitate usage as a decorator.\r
+    """\r
+    _exithandlers.append((func, targs, kargs))\r
+    return func\r
+\r
+if hasattr(sys, "exitfunc"):\r
+    # Assume it's another registered exit function - append it to our list\r
+    register(sys.exitfunc)\r
+sys.exitfunc = _run_exitfuncs\r
+\r
+if __name__ == "__main__":\r
+    def x1():\r
+        print "running x1"\r
+    def x2(n):\r
+        print "running x2(%r)" % (n,)\r
+    def x3(n, kwd=None):\r
+        print "running x3(%r, kwd=%r)" % (n, kwd)\r
+\r
+    register(x1)\r
+    register(x2, 12)\r
+    register(x3, 5, "bar")\r
+    register(x3, "no kwd args")\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/binhex.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/binhex.py
new file mode 100644 (file)
index 0000000..4828c1c
--- /dev/null
@@ -0,0 +1,518 @@
+"""Macintosh binhex compression/decompression.\r
+\r
+easy interface:\r
+binhex(inputfilename, outputfilename)\r
+hexbin(inputfilename, outputfilename)\r
+"""\r
+\r
+#\r
+# Jack Jansen, CWI, August 1995.\r
+#\r
+# The module is supposed to be as compatible as possible. Especially the\r
+# easy interface should work "as expected" on any platform.\r
+# XXXX Note: currently, textfiles appear in mac-form on all platforms.\r
+# We seem to lack a simple character-translate in python.\r
+# (we should probably use ISO-Latin-1 on all but the mac platform).\r
+# XXXX The simple routines are too simple: they expect to hold the complete\r
+# files in-core. Should be fixed.\r
+# XXXX It would be nice to handle AppleDouble format on unix\r
+# (for servers serving macs).\r
+# XXXX I don't understand what happens when you get 0x90 times the same byte on\r
+# input. The resulting code (xx 90 90) would appear to be interpreted as an\r
+# escaped *value* of 0x90. All coders I've seen appear to ignore this nicety...\r
+#\r
+import sys\r
+import os\r
+import struct\r
+import binascii\r
+\r
+__all__ = ["binhex","hexbin","Error"]\r
+\r
+class Error(Exception):\r
+    pass\r
+\r
+# States (what have we written)\r
+_DID_HEADER = 0\r
+_DID_DATA = 1\r
+\r
+# Various constants\r
+REASONABLY_LARGE=32768  # Minimal amount we pass the rle-coder\r
+LINELEN=64\r
+RUNCHAR=chr(0x90)   # run-length introducer\r
+\r
+#\r
+# This code is no longer byte-order dependent\r
+\r
+#\r
+# Workarounds for non-mac machines.\r
+try:\r
+    from Carbon.File import FSSpec, FInfo\r
+    from MacOS import openrf\r
+\r
+    def getfileinfo(name):\r
+        finfo = FSSpec(name).FSpGetFInfo()\r
+        dir, file = os.path.split(name)\r
+        # XXX Get resource/data sizes\r
+        fp = open(name, 'rb')\r
+        fp.seek(0, 2)\r
+        dlen = fp.tell()\r
+        fp = openrf(name, '*rb')\r
+        fp.seek(0, 2)\r
+        rlen = fp.tell()\r
+        return file, finfo, dlen, rlen\r
+\r
+    def openrsrc(name, *mode):\r
+        if not mode:\r
+            mode = '*rb'\r
+        else:\r
+            mode = '*' + mode[0]\r
+        return openrf(name, mode)\r
+\r
+except ImportError:\r
+    #\r
+    # Glue code for non-macintosh usage\r
+    #\r
+\r
+    class FInfo:\r
+        def __init__(self):\r
+            self.Type = '????'\r
+            self.Creator = '????'\r
+            self.Flags = 0\r
+\r
+    def getfileinfo(name):\r
+        finfo = FInfo()\r
+        # Quick check for textfile\r
+        fp = open(name)\r
+        data = open(name).read(256)\r
+        for c in data:\r
+            if not c.isspace() and (c<' ' or ord(c) > 0x7f):\r
+                break\r
+        else:\r
+            finfo.Type = 'TEXT'\r
+        fp.seek(0, 2)\r
+        dsize = fp.tell()\r
+        fp.close()\r
+        dir, file = os.path.split(name)\r
+        file = file.replace(':', '-', 1)\r
+        return file, finfo, dsize, 0\r
+\r
+    class openrsrc:\r
+        def __init__(self, *args):\r
+            pass\r
+\r
+        def read(self, *args):\r
+            return ''\r
+\r
+        def write(self, *args):\r
+            pass\r
+\r
+        def close(self):\r
+            pass\r
+\r
+class _Hqxcoderengine:\r
+    """Write data to the coder in 3-byte chunks"""\r
+\r
+    def __init__(self, ofp):\r
+        self.ofp = ofp\r
+        self.data = ''\r
+        self.hqxdata = ''\r
+        self.linelen = LINELEN-1\r
+\r
+    def write(self, data):\r
+        self.data = self.data + data\r
+        datalen = len(self.data)\r
+        todo = (datalen//3)*3\r
+        data = self.data[:todo]\r
+        self.data = self.data[todo:]\r
+        if not data:\r
+            return\r
+        self.hqxdata = self.hqxdata + binascii.b2a_hqx(data)\r
+        self._flush(0)\r
+\r
+    def _flush(self, force):\r
+        first = 0\r
+        while first <= len(self.hqxdata)-self.linelen:\r
+            last = first + self.linelen\r
+            self.ofp.write(self.hqxdata[first:last]+'\n')\r
+            self.linelen = LINELEN\r
+            first = last\r
+        self.hqxdata = self.hqxdata[first:]\r
+        if force:\r
+            self.ofp.write(self.hqxdata + ':\n')\r
+\r
+    def close(self):\r
+        if self.data:\r
+            self.hqxdata = \\r
+                 self.hqxdata + binascii.b2a_hqx(self.data)\r
+        self._flush(1)\r
+        self.ofp.close()\r
+        del self.ofp\r
+\r
+class _Rlecoderengine:\r
+    """Write data to the RLE-coder in suitably large chunks"""\r
+\r
+    def __init__(self, ofp):\r
+        self.ofp = ofp\r
+        self.data = ''\r
+\r
+    def write(self, data):\r
+        self.data = self.data + data\r
+        if len(self.data) < REASONABLY_LARGE:\r
+            return\r
+        rledata = binascii.rlecode_hqx(self.data)\r
+        self.ofp.write(rledata)\r
+        self.data = ''\r
+\r
+    def close(self):\r
+        if self.data:\r
+            rledata = binascii.rlecode_hqx(self.data)\r
+            self.ofp.write(rledata)\r
+        self.ofp.close()\r
+        del self.ofp\r
+\r
+class BinHex:\r
+    def __init__(self, name_finfo_dlen_rlen, ofp):\r
+        name, finfo, dlen, rlen = name_finfo_dlen_rlen\r
+        if type(ofp) == type(''):\r
+            ofname = ofp\r
+            ofp = open(ofname, 'w')\r
+        ofp.write('(This file must be converted with BinHex 4.0)\n\n:')\r
+        hqxer = _Hqxcoderengine(ofp)\r
+        self.ofp = _Rlecoderengine(hqxer)\r
+        self.crc = 0\r
+        if finfo is None:\r
+            finfo = FInfo()\r
+        self.dlen = dlen\r
+        self.rlen = rlen\r
+        self._writeinfo(name, finfo)\r
+        self.state = _DID_HEADER\r
+\r
+    def _writeinfo(self, name, finfo):\r
+        nl = len(name)\r
+        if nl > 63:\r
+            raise Error, 'Filename too long'\r
+        d = chr(nl) + name + '\0'\r
+        d2 = finfo.Type + finfo.Creator\r
+\r
+        # Force all structs to be packed with big-endian\r
+        d3 = struct.pack('>h', finfo.Flags)\r
+        d4 = struct.pack('>ii', self.dlen, self.rlen)\r
+        info = d + d2 + d3 + d4\r
+        self._write(info)\r
+        self._writecrc()\r
+\r
+    def _write(self, data):\r
+        self.crc = binascii.crc_hqx(data, self.crc)\r
+        self.ofp.write(data)\r
+\r
+    def _writecrc(self):\r
+        # XXXX Should this be here??\r
+        # self.crc = binascii.crc_hqx('\0\0', self.crc)\r
+        if self.crc < 0:\r
+            fmt = '>h'\r
+        else:\r
+            fmt = '>H'\r
+        self.ofp.write(struct.pack(fmt, self.crc))\r
+        self.crc = 0\r
+\r
+    def write(self, data):\r
+        if self.state != _DID_HEADER:\r
+            raise Error, 'Writing data at the wrong time'\r
+        self.dlen = self.dlen - len(data)\r
+        self._write(data)\r
+\r
+    def close_data(self):\r
+        if self.dlen != 0:\r
+            raise Error, 'Incorrect data size, diff=%r' % (self.rlen,)\r
+        self._writecrc()\r
+        self.state = _DID_DATA\r
+\r
+    def write_rsrc(self, data):\r
+        if self.state < _DID_DATA:\r
+            self.close_data()\r
+        if self.state != _DID_DATA:\r
+            raise Error, 'Writing resource data at the wrong time'\r
+        self.rlen = self.rlen - len(data)\r
+        self._write(data)\r
+\r
+    def close(self):\r
+        if self.state is None:\r
+            return\r
+        try:\r
+            if self.state < _DID_DATA:\r
+                self.close_data()\r
+            if self.state != _DID_DATA:\r
+                raise Error, 'Close at the wrong time'\r
+            if self.rlen != 0:\r
+                raise Error, \\r
+                    "Incorrect resource-datasize, diff=%r" % (self.rlen,)\r
+            self._writecrc()\r
+        finally:\r
+            self.state = None\r
+            ofp = self.ofp\r
+            del self.ofp\r
+            ofp.close()\r
+\r
+def binhex(inp, out):\r
+    """(infilename, outfilename) - Create binhex-encoded copy of a file"""\r
+    finfo = getfileinfo(inp)\r
+    ofp = BinHex(finfo, out)\r
+\r
+    ifp = open(inp, 'rb')\r
+    # XXXX Do textfile translation on non-mac systems\r
+    while 1:\r
+        d = ifp.read(128000)\r
+        if not d: break\r
+        ofp.write(d)\r
+    ofp.close_data()\r
+    ifp.close()\r
+\r
+    ifp = openrsrc(inp, 'rb')\r
+    while 1:\r
+        d = ifp.read(128000)\r
+        if not d: break\r
+        ofp.write_rsrc(d)\r
+    ofp.close()\r
+    ifp.close()\r
+\r
+class _Hqxdecoderengine:\r
+    """Read data via the decoder in 4-byte chunks"""\r
+\r
+    def __init__(self, ifp):\r
+        self.ifp = ifp\r
+        self.eof = 0\r
+\r
+    def read(self, totalwtd):\r
+        """Read at least wtd bytes (or until EOF)"""\r
+        decdata = ''\r
+        wtd = totalwtd\r
+        #\r
+        # The loop here is convoluted, since we don't really now how\r
+        # much to decode: there may be newlines in the incoming data.\r
+        while wtd > 0:\r
+            if self.eof: return decdata\r
+            wtd = ((wtd+2)//3)*4\r
+            data = self.ifp.read(wtd)\r
+            #\r
+            # Next problem: there may not be a complete number of\r
+            # bytes in what we pass to a2b. Solve by yet another\r
+            # loop.\r
+            #\r
+            while 1:\r
+                try:\r
+                    decdatacur, self.eof = \\r
+                            binascii.a2b_hqx(data)\r
+                    break\r
+                except binascii.Incomplete:\r
+                    pass\r
+                newdata = self.ifp.read(1)\r
+                if not newdata:\r
+                    raise Error, \\r
+                          'Premature EOF on binhex file'\r
+                data = data + newdata\r
+            decdata = decdata + decdatacur\r
+            wtd = totalwtd - len(decdata)\r
+            if not decdata and not self.eof:\r
+                raise Error, 'Premature EOF on binhex file'\r
+        return decdata\r
+\r
+    def close(self):\r
+        self.ifp.close()\r
+\r
+class _Rledecoderengine:\r
+    """Read data via the RLE-coder"""\r
+\r
+    def __init__(self, ifp):\r
+        self.ifp = ifp\r
+        self.pre_buffer = ''\r
+        self.post_buffer = ''\r
+        self.eof = 0\r
+\r
+    def read(self, wtd):\r
+        if wtd > len(self.post_buffer):\r
+            self._fill(wtd-len(self.post_buffer))\r
+        rv = self.post_buffer[:wtd]\r
+        self.post_buffer = self.post_buffer[wtd:]\r
+        return rv\r
+\r
+    def _fill(self, wtd):\r
+        self.pre_buffer = self.pre_buffer + self.ifp.read(wtd+4)\r
+        if self.ifp.eof:\r
+            self.post_buffer = self.post_buffer + \\r
+                binascii.rledecode_hqx(self.pre_buffer)\r
+            self.pre_buffer = ''\r
+            return\r
+\r
+        #\r
+        # Obfuscated code ahead. We have to take care that we don't\r
+        # end up with an orphaned RUNCHAR later on. So, we keep a couple\r
+        # of bytes in the buffer, depending on what the end of\r
+        # the buffer looks like:\r
+        # '\220\0\220' - Keep 3 bytes: repeated \220 (escaped as \220\0)\r
+        # '?\220' - Keep 2 bytes: repeated something-else\r
+        # '\220\0' - Escaped \220: Keep 2 bytes.\r
+        # '?\220?' - Complete repeat sequence: decode all\r
+        # otherwise: keep 1 byte.\r
+        #\r
+        mark = len(self.pre_buffer)\r
+        if self.pre_buffer[-3:] == RUNCHAR + '\0' + RUNCHAR:\r
+            mark = mark - 3\r
+        elif self.pre_buffer[-1] == RUNCHAR:\r
+            mark = mark - 2\r
+        elif self.pre_buffer[-2:] == RUNCHAR + '\0':\r
+            mark = mark - 2\r
+        elif self.pre_buffer[-2] == RUNCHAR:\r
+            pass # Decode all\r
+        else:\r
+            mark = mark - 1\r
+\r
+        self.post_buffer = self.post_buffer + \\r
+            binascii.rledecode_hqx(self.pre_buffer[:mark])\r
+        self.pre_buffer = self.pre_buffer[mark:]\r
+\r
+    def close(self):\r
+        self.ifp.close()\r
+\r
+class HexBin:\r
+    def __init__(self, ifp):\r
+        if type(ifp) == type(''):\r
+            ifp = open(ifp)\r
+        #\r
+        # Find initial colon.\r
+        #\r
+        while 1:\r
+            ch = ifp.read(1)\r
+            if not ch:\r
+                raise Error, "No binhex data found"\r
+            # Cater for \r\n terminated lines (which show up as \n\r, hence\r
+            # all lines start with \r)\r
+            if ch == '\r':\r
+                continue\r
+            if ch == ':':\r
+                break\r
+            if ch != '\n':\r
+                dummy = ifp.readline()\r
+\r
+        hqxifp = _Hqxdecoderengine(ifp)\r
+        self.ifp = _Rledecoderengine(hqxifp)\r
+        self.crc = 0\r
+        self._readheader()\r
+\r
+    def _read(self, len):\r
+        data = self.ifp.read(len)\r
+        self.crc = binascii.crc_hqx(data, self.crc)\r
+        return data\r
+\r
+    def _checkcrc(self):\r
+        filecrc = struct.unpack('>h', self.ifp.read(2))[0] & 0xffff\r
+        #self.crc = binascii.crc_hqx('\0\0', self.crc)\r
+        # XXXX Is this needed??\r
+        self.crc = self.crc & 0xffff\r
+        if filecrc != self.crc:\r
+            raise Error, 'CRC error, computed %x, read %x' \\r
+                  %(self.crc, filecrc)\r
+        self.crc = 0\r
+\r
+    def _readheader(self):\r
+        len = self._read(1)\r
+        fname = self._read(ord(len))\r
+        rest = self._read(1+4+4+2+4+4)\r
+        self._checkcrc()\r
+\r
+        type = rest[1:5]\r
+        creator = rest[5:9]\r
+        flags = struct.unpack('>h', rest[9:11])[0]\r
+        self.dlen = struct.unpack('>l', rest[11:15])[0]\r
+        self.rlen = struct.unpack('>l', rest[15:19])[0]\r
+\r
+        self.FName = fname\r
+        self.FInfo = FInfo()\r
+        self.FInfo.Creator = creator\r
+        self.FInfo.Type = type\r
+        self.FInfo.Flags = flags\r
+\r
+        self.state = _DID_HEADER\r
+\r
+    def read(self, *n):\r
+        if self.state != _DID_HEADER:\r
+            raise Error, 'Read data at wrong time'\r
+        if n:\r
+            n = n[0]\r
+            n = min(n, self.dlen)\r
+        else:\r
+            n = self.dlen\r
+        rv = ''\r
+        while len(rv) < n:\r
+            rv = rv + self._read(n-len(rv))\r
+        self.dlen = self.dlen - n\r
+        return rv\r
+\r
+    def close_data(self):\r
+        if self.state != _DID_HEADER:\r
+            raise Error, 'close_data at wrong time'\r
+        if self.dlen:\r
+            dummy = self._read(self.dlen)\r
+        self._checkcrc()\r
+        self.state = _DID_DATA\r
+\r
+    def read_rsrc(self, *n):\r
+        if self.state == _DID_HEADER:\r
+            self.close_data()\r
+        if self.state != _DID_DATA:\r
+            raise Error, 'Read resource data at wrong time'\r
+        if n:\r
+            n = n[0]\r
+            n = min(n, self.rlen)\r
+        else:\r
+            n = self.rlen\r
+        self.rlen = self.rlen - n\r
+        return self._read(n)\r
+\r
+    def close(self):\r
+        if self.state is None:\r
+            return\r
+        try:\r
+            if self.rlen:\r
+                dummy = self.read_rsrc(self.rlen)\r
+            self._checkcrc()\r
+        finally:\r
+            self.state = None\r
+            self.ifp.close()\r
+\r
+def hexbin(inp, out):\r
+    """(infilename, outfilename) - Decode binhexed file"""\r
+    ifp = HexBin(inp)\r
+    finfo = ifp.FInfo\r
+    if not out:\r
+        out = ifp.FName\r
+\r
+    ofp = open(out, 'wb')\r
+    # XXXX Do translation on non-mac systems\r
+    while 1:\r
+        d = ifp.read(128000)\r
+        if not d: break\r
+        ofp.write(d)\r
+    ofp.close()\r
+    ifp.close_data()\r
+\r
+    d = ifp.read_rsrc(128000)\r
+    if d:\r
+        ofp = openrsrc(out, 'wb')\r
+        ofp.write(d)\r
+        while 1:\r
+            d = ifp.read_rsrc(128000)\r
+            if not d: break\r
+            ofp.write(d)\r
+        ofp.close()\r
+\r
+    ifp.close()\r
+\r
+def _test():\r
+    fname = sys.argv[1]\r
+    binhex(fname, fname+'.hqx')\r
+    hexbin(fname+'.hqx', fname+'.viahqx')\r
+    #hexbin(fname, fname+'.unpacked')\r
+    sys.exit(1)\r
+\r
+if __name__ == '__main__':\r
+    _test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/bisect.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/bisect.py
new file mode 100644 (file)
index 0000000..d1016d9
--- /dev/null
@@ -0,0 +1,92 @@
+"""Bisection algorithms."""\r
+\r
+def insort_right(a, x, lo=0, hi=None):\r
+    """Insert item x in list a, and keep it sorted assuming a is sorted.\r
+\r
+    If x is already in a, insert it to the right of the rightmost x.\r
+\r
+    Optional args lo (default 0) and hi (default len(a)) bound the\r
+    slice of a to be searched.\r
+    """\r
+\r
+    if lo < 0:\r
+        raise ValueError('lo must be non-negative')\r
+    if hi is None:\r
+        hi = len(a)\r
+    while lo < hi:\r
+        mid = (lo+hi)//2\r
+        if x < a[mid]: hi = mid\r
+        else: lo = mid+1\r
+    a.insert(lo, x)\r
+\r
+insort = insort_right   # backward compatibility\r
+\r
+def bisect_right(a, x, lo=0, hi=None):\r
+    """Return the index where to insert item x in list a, assuming a is sorted.\r
+\r
+    The return value i is such that all e in a[:i] have e <= x, and all e in\r
+    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will\r
+    insert just after the rightmost x already there.\r
+\r
+    Optional args lo (default 0) and hi (default len(a)) bound the\r
+    slice of a to be searched.\r
+    """\r
+\r
+    if lo < 0:\r
+        raise ValueError('lo must be non-negative')\r
+    if hi is None:\r
+        hi = len(a)\r
+    while lo < hi:\r
+        mid = (lo+hi)//2\r
+        if x < a[mid]: hi = mid\r
+        else: lo = mid+1\r
+    return lo\r
+\r
+bisect = bisect_right   # backward compatibility\r
+\r
+def insort_left(a, x, lo=0, hi=None):\r
+    """Insert item x in list a, and keep it sorted assuming a is sorted.\r
+\r
+    If x is already in a, insert it to the left of the leftmost x.\r
+\r
+    Optional args lo (default 0) and hi (default len(a)) bound the\r
+    slice of a to be searched.\r
+    """\r
+\r
+    if lo < 0:\r
+        raise ValueError('lo must be non-negative')\r
+    if hi is None:\r
+        hi = len(a)\r
+    while lo < hi:\r
+        mid = (lo+hi)//2\r
+        if a[mid] < x: lo = mid+1\r
+        else: hi = mid\r
+    a.insert(lo, x)\r
+\r
+\r
+def bisect_left(a, x, lo=0, hi=None):\r
+    """Return the index where to insert item x in list a, assuming a is sorted.\r
+\r
+    The return value i is such that all e in a[:i] have e < x, and all e in\r
+    a[i:] have e >= x.  So if x already appears in the list, a.insert(x) will\r
+    insert just before the leftmost x already there.\r
+\r
+    Optional args lo (default 0) and hi (default len(a)) bound the\r
+    slice of a to be searched.\r
+    """\r
+\r
+    if lo < 0:\r
+        raise ValueError('lo must be non-negative')\r
+    if hi is None:\r
+        hi = len(a)\r
+    while lo < hi:\r
+        mid = (lo+hi)//2\r
+        if a[mid] < x: lo = mid+1\r
+        else: hi = mid\r
+    return lo\r
+\r
+# Overwrite above definitions with a fast C implementation\r
+try:\r
+    from _bisect import *\r
+except ImportError:\r
+    pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/calendar.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/calendar.py
new file mode 100644 (file)
index 0000000..f07cb71
--- /dev/null
@@ -0,0 +1,713 @@
+"""Calendar printing functions\r
+\r
+Note when comparing these calendars to the ones printed by cal(1): By\r
+default, these calendars have Monday as the first day of the week, and\r
+Sunday as the last (the European convention). Use setfirstweekday() to\r
+set the first day of the week (0=Monday, 6=Sunday)."""\r
+\r
+import sys\r
+import datetime\r
+import locale as _locale\r
+\r
+__all__ = ["IllegalMonthError", "IllegalWeekdayError", "setfirstweekday",\r
+           "firstweekday", "isleap", "leapdays", "weekday", "monthrange",\r
+           "monthcalendar", "prmonth", "month", "prcal", "calendar",\r
+           "timegm", "month_name", "month_abbr", "day_name", "day_abbr"]\r
+\r
+# Exception raised for bad input (with string parameter for details)\r
+error = ValueError\r
+\r
+# Exceptions raised for bad input\r
+class IllegalMonthError(ValueError):\r
+    def __init__(self, month):\r
+        self.month = month\r
+    def __str__(self):\r
+        return "bad month number %r; must be 1-12" % self.month\r
+\r
+\r
+class IllegalWeekdayError(ValueError):\r
+    def __init__(self, weekday):\r
+        self.weekday = weekday\r
+    def __str__(self):\r
+        return "bad weekday number %r; must be 0 (Monday) to 6 (Sunday)" % self.weekday\r
+\r
+\r
+# Constants for months referenced later\r
+January = 1\r
+February = 2\r
+\r
+# Number of days per month (except for February in leap years)\r
+mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\r
+\r
+# This module used to have hard-coded lists of day and month names, as\r
+# English strings.  The classes following emulate a read-only version of\r
+# that, but supply localized names.  Note that the values are computed\r
+# fresh on each call, in case the user changes locale between calls.\r
+\r
+class _localized_month:\r
+\r
+    _months = [datetime.date(2001, i+1, 1).strftime for i in range(12)]\r
+    _months.insert(0, lambda x: "")\r
+\r
+    def __init__(self, format):\r
+        self.format = format\r
+\r
+    def __getitem__(self, i):\r
+        funcs = self._months[i]\r
+        if isinstance(i, slice):\r
+            return [f(self.format) for f in funcs]\r
+        else:\r
+            return funcs(self.format)\r
+\r
+    def __len__(self):\r
+        return 13\r
+\r
+\r
+class _localized_day:\r
+\r
+    # January 1, 2001, was a Monday.\r
+    _days = [datetime.date(2001, 1, i+1).strftime for i in range(7)]\r
+\r
+    def __init__(self, format):\r
+        self.format = format\r
+\r
+    def __getitem__(self, i):\r
+        funcs = self._days[i]\r
+        if isinstance(i, slice):\r
+            return [f(self.format) for f in funcs]\r
+        else:\r
+            return funcs(self.format)\r
+\r
+    def __len__(self):\r
+        return 7\r
+\r
+\r
+# Full and abbreviated names of weekdays\r
+day_name = _localized_day('%A')\r
+day_abbr = _localized_day('%a')\r
+\r
+# Full and abbreviated names of months (1-based arrays!!!)\r
+month_name = _localized_month('%B')\r
+month_abbr = _localized_month('%b')\r
+\r
+# Constants for weekdays\r
+(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY) = range(7)\r
+\r
+\r
+def isleap(year):\r
+    """Return True for leap years, False for non-leap years."""\r
+    return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)\r
+\r
+\r
+def leapdays(y1, y2):\r
+    """Return number of leap years in range [y1, y2).\r
+       Assume y1 <= y2."""\r
+    y1 -= 1\r
+    y2 -= 1\r
+    return (y2//4 - y1//4) - (y2//100 - y1//100) + (y2//400 - y1//400)\r
+\r
+\r
+def weekday(year, month, day):\r
+    """Return weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12),\r
+       day (1-31)."""\r
+    return datetime.date(year, month, day).weekday()\r
+\r
+\r
+def monthrange(year, month):\r
+    """Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for\r
+       year, month."""\r
+    if not 1 <= month <= 12:\r
+        raise IllegalMonthError(month)\r
+    day1 = weekday(year, month, 1)\r
+    ndays = mdays[month] + (month == February and isleap(year))\r
+    return day1, ndays\r
+\r
+\r
+class Calendar(object):\r
+    """\r
+    Base calendar class. This class doesn't do any formatting. It simply\r
+    provides data to subclasses.\r
+    """\r
+\r
+    def __init__(self, firstweekday=0):\r
+        self.firstweekday = firstweekday # 0 = Monday, 6 = Sunday\r
+\r
+    def getfirstweekday(self):\r
+        return self._firstweekday % 7\r
+\r
+    def setfirstweekday(self, firstweekday):\r
+        self._firstweekday = firstweekday\r
+\r
+    firstweekday = property(getfirstweekday, setfirstweekday)\r
+\r
+    def iterweekdays(self):\r
+        """\r
+        Return a iterator for one week of weekday numbers starting with the\r
+        configured first one.\r
+        """\r
+        for i in range(self.firstweekday, self.firstweekday + 7):\r
+            yield i%7\r
+\r
+    def itermonthdates(self, year, month):\r
+        """\r
+        Return an iterator for one month. The iterator will yield datetime.date\r
+        values and will always iterate through complete weeks, so it will yield\r
+        dates outside the specified month.\r
+        """\r
+        date = datetime.date(year, month, 1)\r
+        # Go back to the beginning of the week\r
+        days = (date.weekday() - self.firstweekday) % 7\r
+        date -= datetime.timedelta(days=days)\r
+        oneday = datetime.timedelta(days=1)\r
+        while True:\r
+            yield date\r
+            try:\r
+                date += oneday\r
+            except OverflowError:\r
+                # Adding one day could fail after datetime.MAXYEAR\r
+                break\r
+            if date.month != month and date.weekday() == self.firstweekday:\r
+                break\r
+\r
+    def itermonthdays2(self, year, month):\r
+        """\r
+        Like itermonthdates(), but will yield (day number, weekday number)\r
+        tuples. For days outside the specified month the day number is 0.\r
+        """\r
+        for date in self.itermonthdates(year, month):\r
+            if date.month != month:\r
+                yield (0, date.weekday())\r
+            else:\r
+                yield (date.day, date.weekday())\r
+\r
+    def itermonthdays(self, year, month):\r
+        """\r
+        Like itermonthdates(), but will yield day numbers. For days outside\r
+        the specified month the day number is 0.\r
+        """\r
+        for date in self.itermonthdates(year, month):\r
+            if date.month != month:\r
+                yield 0\r
+            else:\r
+                yield date.day\r
+\r
+    def monthdatescalendar(self, year, month):\r
+        """\r
+        Return a matrix (list of lists) representing a month's calendar.\r
+        Each row represents a week; week entries are datetime.date values.\r
+        """\r
+        dates = list(self.itermonthdates(year, month))\r
+        return [ dates[i:i+7] for i in range(0, len(dates), 7) ]\r
+\r
+    def monthdays2calendar(self, year, month):\r
+        """\r
+        Return a matrix representing a month's calendar.\r
+        Each row represents a week; week entries are\r
+        (day number, weekday number) tuples. Day numbers outside this month\r
+        are zero.\r
+        """\r
+        days = list(self.itermonthdays2(year, month))\r
+        return [ days[i:i+7] for i in range(0, len(days), 7) ]\r
+\r
+    def monthdayscalendar(self, year, month):\r
+        """\r
+        Return a matrix representing a month's calendar.\r
+        Each row represents a week; days outside this month are zero.\r
+        """\r
+        days = list(self.itermonthdays(year, month))\r
+        return [ days[i:i+7] for i in range(0, len(days), 7) ]\r
+\r
+    def yeardatescalendar(self, year, width=3):\r
+        """\r
+        Return the data for the specified year ready for formatting. The return\r
+        value is a list of month rows. Each month row contains up to width months.\r
+        Each month contains between 4 and 6 weeks and each week contains 1-7\r
+        days. Days are datetime.date objects.\r
+        """\r
+        months = [\r
+            self.monthdatescalendar(year, i)\r
+            for i in range(January, January+12)\r
+        ]\r
+        return [months[i:i+width] for i in range(0, len(months), width) ]\r
+\r
+    def yeardays2calendar(self, year, width=3):\r
+        """\r
+        Return the data for the specified year ready for formatting (similar to\r
+        yeardatescalendar()). Entries in the week lists are\r
+        (day number, weekday number) tuples. Day numbers outside this month are\r
+        zero.\r
+        """\r
+        months = [\r
+            self.monthdays2calendar(year, i)\r
+            for i in range(January, January+12)\r
+        ]\r
+        return [months[i:i+width] for i in range(0, len(months), width) ]\r
+\r
+    def yeardayscalendar(self, year, width=3):\r
+        """\r
+        Return the data for the specified year ready for formatting (similar to\r
+        yeardatescalendar()). Entries in the week lists are day numbers.\r
+        Day numbers outside this month are zero.\r
+        """\r
+        months = [\r
+            self.monthdayscalendar(year, i)\r
+            for i in range(January, January+12)\r
+        ]\r
+        return [months[i:i+width] for i in range(0, len(months), width) ]\r
+\r
+\r
+class TextCalendar(Calendar):\r
+    """\r
+    Subclass of Calendar that outputs a calendar as a simple plain text\r
+    similar to the UNIX program cal.\r
+    """\r
+\r
+    def prweek(self, theweek, width):\r
+        """\r
+        Print a single week (no newline).\r
+        """\r
+        print self.formatweek(theweek, width),\r
+\r
+    def formatday(self, day, weekday, width):\r
+        """\r
+        Returns a formatted day.\r
+        """\r
+        if day == 0:\r
+            s = ''\r
+        else:\r
+            s = '%2i' % day             # right-align single-digit days\r
+        return s.center(width)\r
+\r
+    def formatweek(self, theweek, width):\r
+        """\r
+        Returns a single week in a string (no newline).\r
+        """\r
+        return ' '.join(self.formatday(d, wd, width) for (d, wd) in theweek)\r
+\r
+    def formatweekday(self, day, width):\r
+        """\r
+        Returns a formatted week day name.\r
+        """\r
+        if width >= 9:\r
+            names = day_name\r
+        else:\r
+            names = day_abbr\r
+        return names[day][:width].center(width)\r
+\r
+    def formatweekheader(self, width):\r
+        """\r
+        Return a header for a week.\r
+        """\r
+        return ' '.join(self.formatweekday(i, width) for i in self.iterweekdays())\r
+\r
+    def formatmonthname(self, theyear, themonth, width, withyear=True):\r
+        """\r
+        Return a formatted month name.\r
+        """\r
+        s = month_name[themonth]\r
+        if withyear:\r
+            s = "%s %r" % (s, theyear)\r
+        return s.center(width)\r
+\r
+    def prmonth(self, theyear, themonth, w=0, l=0):\r
+        """\r
+        Print a month's calendar.\r
+        """\r
+        print self.formatmonth(theyear, themonth, w, l),\r
+\r
+    def formatmonth(self, theyear, themonth, w=0, l=0):\r
+        """\r
+        Return a month's calendar string (multi-line).\r
+        """\r
+        w = max(2, w)\r
+        l = max(1, l)\r
+        s = self.formatmonthname(theyear, themonth, 7 * (w + 1) - 1)\r
+        s = s.rstrip()\r
+        s += '\n' * l\r
+        s += self.formatweekheader(w).rstrip()\r
+        s += '\n' * l\r
+        for week in self.monthdays2calendar(theyear, themonth):\r
+            s += self.formatweek(week, w).rstrip()\r
+            s += '\n' * l\r
+        return s\r
+\r
+    def formatyear(self, theyear, w=2, l=1, c=6, m=3):\r
+        """\r
+        Returns a year's calendar as a multi-line string.\r
+        """\r
+        w = max(2, w)\r
+        l = max(1, l)\r
+        c = max(2, c)\r
+        colwidth = (w + 1) * 7 - 1\r
+        v = []\r
+        a = v.append\r
+        a(repr(theyear).center(colwidth*m+c*(m-1)).rstrip())\r
+        a('\n'*l)\r
+        header = self.formatweekheader(w)\r
+        for (i, row) in enumerate(self.yeardays2calendar(theyear, m)):\r
+            # months in this row\r
+            months = range(m*i+1, min(m*(i+1)+1, 13))\r
+            a('\n'*l)\r
+            names = (self.formatmonthname(theyear, k, colwidth, False)\r
+                     for k in months)\r
+            a(formatstring(names, colwidth, c).rstrip())\r
+            a('\n'*l)\r
+            headers = (header for k in months)\r
+            a(formatstring(headers, colwidth, c).rstrip())\r
+            a('\n'*l)\r
+            # max number of weeks for this row\r
+            height = max(len(cal) for cal in row)\r
+            for j in range(height):\r
+                weeks = []\r
+                for cal in row:\r
+                    if j >= len(cal):\r
+                        weeks.append('')\r
+                    else:\r
+                        weeks.append(self.formatweek(cal[j], w))\r
+                a(formatstring(weeks, colwidth, c).rstrip())\r
+                a('\n' * l)\r
+        return ''.join(v)\r
+\r
+    def pryear(self, theyear, w=0, l=0, c=6, m=3):\r
+        """Print a year's calendar."""\r
+        print self.formatyear(theyear, w, l, c, m)\r
+\r
+\r
+class HTMLCalendar(Calendar):\r
+    """\r
+    This calendar returns complete HTML pages.\r
+    """\r
+\r
+    # CSS classes for the day <td>s\r
+    cssclasses = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]\r
+\r
+    def formatday(self, day, weekday):\r
+        """\r
+        Return a day as a table cell.\r
+        """\r
+        if day == 0:\r
+            return '<td class="noday">&nbsp;</td>' # day outside month\r
+        else:\r
+            return '<td class="%s">%d</td>' % (self.cssclasses[weekday], day)\r
+\r
+    def formatweek(self, theweek):\r
+        """\r
+        Return a complete week as a table row.\r
+        """\r
+        s = ''.join(self.formatday(d, wd) for (d, wd) in theweek)\r
+        return '<tr>%s</tr>' % s\r
+\r
+    def formatweekday(self, day):\r
+        """\r
+        Return a weekday name as a table header.\r
+        """\r
+        return '<th class="%s">%s</th>' % (self.cssclasses[day], day_abbr[day])\r
+\r
+    def formatweekheader(self):\r
+        """\r
+        Return a header for a week as a table row.\r
+        """\r
+        s = ''.join(self.formatweekday(i) for i in self.iterweekdays())\r
+        return '<tr>%s</tr>' % s\r
+\r
+    def formatmonthname(self, theyear, themonth, withyear=True):\r
+        """\r
+        Return a month name as a table row.\r
+        """\r
+        if withyear:\r
+            s = '%s %s' % (month_name[themonth], theyear)\r
+        else:\r
+            s = '%s' % month_name[themonth]\r
+        return '<tr><th colspan="7" class="month">%s</th></tr>' % s\r
+\r
+    def formatmonth(self, theyear, themonth, withyear=True):\r
+        """\r
+        Return a formatted month as a table.\r
+        """\r
+        v = []\r
+        a = v.append\r
+        a('<table border="0" cellpadding="0" cellspacing="0" class="month">')\r
+        a('\n')\r
+        a(self.formatmonthname(theyear, themonth, withyear=withyear))\r
+        a('\n')\r
+        a(self.formatweekheader())\r
+        a('\n')\r
+        for week in self.monthdays2calendar(theyear, themonth):\r
+            a(self.formatweek(week))\r
+            a('\n')\r
+        a('</table>')\r
+        a('\n')\r
+        return ''.join(v)\r
+\r
+    def formatyear(self, theyear, width=3):\r
+        """\r
+        Return a formatted year as a table of tables.\r
+        """\r
+        v = []\r
+        a = v.append\r
+        width = max(width, 1)\r
+        a('<table border="0" cellpadding="0" cellspacing="0" class="year">')\r
+        a('\n')\r
+        a('<tr><th colspan="%d" class="year">%s</th></tr>' % (width, theyear))\r
+        for i in range(January, January+12, width):\r
+            # months in this row\r
+            months = range(i, min(i+width, 13))\r
+            a('<tr>')\r
+            for m in months:\r
+                a('<td>')\r
+                a(self.formatmonth(theyear, m, withyear=False))\r
+                a('</td>')\r
+            a('</tr>')\r
+        a('</table>')\r
+        return ''.join(v)\r
+\r
+    def formatyearpage(self, theyear, width=3, css='calendar.css', encoding=None):\r
+        """\r
+        Return a formatted year as a complete HTML page.\r
+        """\r
+        if encoding is None:\r
+            encoding = sys.getdefaultencoding()\r
+        v = []\r
+        a = v.append\r
+        a('<?xml version="1.0" encoding="%s"?>\n' % encoding)\r
+        a('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')\r
+        a('<html>\n')\r
+        a('<head>\n')\r
+        a('<meta http-equiv="Content-Type" content="text/html; charset=%s" />\n' % encoding)\r
+        if css is not None:\r
+            a('<link rel="stylesheet" type="text/css" href="%s" />\n' % css)\r
+        a('<title>Calendar for %d</title>\n' % theyear)\r
+        a('</head>\n')\r
+        a('<body>\n')\r
+        a(self.formatyear(theyear, width))\r
+        a('</body>\n')\r
+        a('</html>\n')\r
+        return ''.join(v).encode(encoding, "xmlcharrefreplace")\r
+\r
+\r
+class TimeEncoding:\r
+    def __init__(self, locale):\r
+        self.locale = locale\r
+\r
+    def __enter__(self):\r
+        self.oldlocale = _locale.getlocale(_locale.LC_TIME)\r
+        _locale.setlocale(_locale.LC_TIME, self.locale)\r
+        return _locale.getlocale(_locale.LC_TIME)[1]\r
+\r
+    def __exit__(self, *args):\r
+        _locale.setlocale(_locale.LC_TIME, self.oldlocale)\r
+\r
+\r
+class LocaleTextCalendar(TextCalendar):\r
+    """\r
+    This class can be passed a locale name in the constructor and will return\r
+    month and weekday names in the specified locale. If this locale includes\r
+    an encoding all strings containing month and weekday names will be returned\r
+    as unicode.\r
+    """\r
+\r
+    def __init__(self, firstweekday=0, locale=None):\r
+        TextCalendar.__init__(self, firstweekday)\r
+        if locale is None:\r
+            locale = _locale.getdefaultlocale()\r
+        self.locale = locale\r
+\r
+    def formatweekday(self, day, width):\r
+        with TimeEncoding(self.locale) as encoding:\r
+            if width >= 9:\r
+                names = day_name\r
+            else:\r
+                names = day_abbr\r
+            name = names[day]\r
+            if encoding is not None:\r
+                name = name.decode(encoding)\r
+            return name[:width].center(width)\r
+\r
+    def formatmonthname(self, theyear, themonth, width, withyear=True):\r
+        with TimeEncoding(self.locale) as encoding:\r
+            s = month_name[themonth]\r
+            if encoding is not None:\r
+                s = s.decode(encoding)\r
+            if withyear:\r
+                s = "%s %r" % (s, theyear)\r
+            return s.center(width)\r
+\r
+\r
+class LocaleHTMLCalendar(HTMLCalendar):\r
+    """\r
+    This class can be passed a locale name in the constructor and will return\r
+    month and weekday names in the specified locale. If this locale includes\r
+    an encoding all strings containing month and weekday names will be returned\r
+    as unicode.\r
+    """\r
+    def __init__(self, firstweekday=0, locale=None):\r
+        HTMLCalendar.__init__(self, firstweekday)\r
+        if locale is None:\r
+            locale = _locale.getdefaultlocale()\r
+        self.locale = locale\r
+\r
+    def formatweekday(self, day):\r
+        with TimeEncoding(self.locale) as encoding:\r
+            s = day_abbr[day]\r
+            if encoding is not None:\r
+                s = s.decode(encoding)\r
+            return '<th class="%s">%s</th>' % (self.cssclasses[day], s)\r
+\r
+    def formatmonthname(self, theyear, themonth, withyear=True):\r
+        with TimeEncoding(self.locale) as encoding:\r
+            s = month_name[themonth]\r
+            if encoding is not None:\r
+                s = s.decode(encoding)\r
+            if withyear:\r
+                s = '%s %s' % (s, theyear)\r
+            return '<tr><th colspan="7" class="month">%s</th></tr>' % s\r
+\r
+\r
+# Support for old module level interface\r
+c = TextCalendar()\r
+\r
+firstweekday = c.getfirstweekday\r
+\r
+def setfirstweekday(firstweekday):\r
+    try:\r
+        firstweekday.__index__\r
+    except AttributeError:\r
+        raise IllegalWeekdayError(firstweekday)\r
+    if not MONDAY <= firstweekday <= SUNDAY:\r
+        raise IllegalWeekdayError(firstweekday)\r
+    c.firstweekday = firstweekday\r
+\r
+monthcalendar = c.monthdayscalendar\r
+prweek = c.prweek\r
+week = c.formatweek\r
+weekheader = c.formatweekheader\r
+prmonth = c.prmonth\r
+month = c.formatmonth\r
+calendar = c.formatyear\r
+prcal = c.pryear\r
+\r
+\r
+# Spacing of month columns for multi-column year calendar\r
+_colwidth = 7*3 - 1         # Amount printed by prweek()\r
+_spacing = 6                # Number of spaces between columns\r
+\r
+\r
+def format(cols, colwidth=_colwidth, spacing=_spacing):\r
+    """Prints multi-column formatting for year calendars"""\r
+    print formatstring(cols, colwidth, spacing)\r
+\r
+\r
+def formatstring(cols, colwidth=_colwidth, spacing=_spacing):\r
+    """Returns a string formatted from n strings, centered within n columns."""\r
+    spacing *= ' '\r
+    return spacing.join(c.center(colwidth) for c in cols)\r
+\r
+\r
+EPOCH = 1970\r
+_EPOCH_ORD = datetime.date(EPOCH, 1, 1).toordinal()\r
+\r
+\r
+def timegm(tuple):\r
+    """Unrelated but handy function to calculate Unix timestamp from GMT."""\r
+    year, month, day, hour, minute, second = tuple[:6]\r
+    days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1\r
+    hours = days*24 + hour\r
+    minutes = hours*60 + minute\r
+    seconds = minutes*60 + second\r
+    return seconds\r
+\r
+\r
+def main(args):\r
+    import optparse\r
+    parser = optparse.OptionParser(usage="usage: %prog [options] [year [month]]")\r
+    parser.add_option(\r
+        "-w", "--width",\r
+        dest="width", type="int", default=2,\r
+        help="width of date column (default 2, text only)"\r
+    )\r
+    parser.add_option(\r
+        "-l", "--lines",\r
+        dest="lines", type="int", default=1,\r
+        help="number of lines for each week (default 1, text only)"\r
+    )\r
+    parser.add_option(\r
+        "-s", "--spacing",\r
+        dest="spacing", type="int", default=6,\r
+        help="spacing between months (default 6, text only)"\r
+    )\r
+    parser.add_option(\r
+        "-m", "--months",\r
+        dest="months", type="int", default=3,\r
+        help="months per row (default 3, text only)"\r
+    )\r
+    parser.add_option(\r
+        "-c", "--css",\r
+        dest="css", default="calendar.css",\r
+        help="CSS to use for page (html only)"\r
+    )\r
+    parser.add_option(\r
+        "-L", "--locale",\r
+        dest="locale", default=None,\r
+        help="locale to be used from month and weekday names"\r
+    )\r
+    parser.add_option(\r
+        "-e", "--encoding",\r
+        dest="encoding", default=None,\r
+        help="Encoding to use for output"\r
+    )\r
+    parser.add_option(\r
+        "-t", "--type",\r
+        dest="type", default="text",\r
+        choices=("text", "html"),\r
+        help="output type (text or html)"\r
+    )\r
+\r
+    (options, args) = parser.parse_args(args)\r
+\r
+    if options.locale and not options.encoding:\r
+        parser.error("if --locale is specified --encoding is required")\r
+        sys.exit(1)\r
+\r
+    locale = options.locale, options.encoding\r
+\r
+    if options.type == "html":\r
+        if options.locale:\r
+            cal = LocaleHTMLCalendar(locale=locale)\r
+        else:\r
+            cal = HTMLCalendar()\r
+        encoding = options.encoding\r
+        if encoding is None:\r
+            encoding = sys.getdefaultencoding()\r
+        optdict = dict(encoding=encoding, css=options.css)\r
+        if len(args) == 1:\r
+            print cal.formatyearpage(datetime.date.today().year, **optdict)\r
+        elif len(args) == 2:\r
+            print cal.formatyearpage(int(args[1]), **optdict)\r
+        else:\r
+            parser.error("incorrect number of arguments")\r
+            sys.exit(1)\r
+    else:\r
+        if options.locale:\r
+            cal = LocaleTextCalendar(locale=locale)\r
+        else:\r
+            cal = TextCalendar()\r
+        optdict = dict(w=options.width, l=options.lines)\r
+        if len(args) != 3:\r
+            optdict["c"] = options.spacing\r
+            optdict["m"] = options.months\r
+        if len(args) == 1:\r
+            result = cal.formatyear(datetime.date.today().year, **optdict)\r
+        elif len(args) == 2:\r
+            result = cal.formatyear(int(args[1]), **optdict)\r
+        elif len(args) == 3:\r
+            result = cal.formatmonth(int(args[1]), int(args[2]), **optdict)\r
+        else:\r
+            parser.error("incorrect number of arguments")\r
+            sys.exit(1)\r
+        if options.encoding:\r
+            result = result.encode(options.encoding)\r
+        print result\r
+\r
+\r
+if __name__ == "__main__":\r
+    main(sys.argv)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/cmd.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/cmd.py
new file mode 100644 (file)
index 0000000..33a624c
--- /dev/null
@@ -0,0 +1,404 @@
+"""A generic class to build line-oriented command interpreters.\r
+\r
+Interpreters constructed with this class obey the following conventions:\r
+\r
+1. End of file on input is processed as the command 'EOF'.\r
+2. A command is parsed out of each line by collecting the prefix composed\r
+   of characters in the identchars member.\r
+3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method\r
+   is passed a single argument consisting of the remainder of the line.\r
+4. Typing an empty line repeats the last command.  (Actually, it calls the\r
+   method `emptyline', which may be overridden in a subclass.)\r
+5. There is a predefined `help' method.  Given an argument `topic', it\r
+   calls the command `help_topic'.  With no arguments, it lists all topics\r
+   with defined help_ functions, broken into up to three topics; documented\r
+   commands, miscellaneous help topics, and undocumented commands.\r
+6. The command '?' is a synonym for `help'.  The command '!' is a synonym\r
+   for `shell', if a do_shell method exists.\r
+7. If completion is enabled, completing commands will be done automatically,\r
+   and completing of commands args is done by calling complete_foo() with\r
+   arguments text, line, begidx, endidx.  text is string we are matching\r
+   against, all returned matches must begin with it.  line is the current\r
+   input line (lstripped), begidx and endidx are the beginning and end\r
+   indexes of the text being matched, which could be used to provide\r
+   different completion depending upon which position the argument is in.\r
+\r
+The `default' method may be overridden to intercept commands for which there\r
+is no do_ method.\r
+\r
+The `completedefault' method may be overridden to intercept completions for\r
+commands that have no complete_ method.\r
+\r
+The data member `self.ruler' sets the character used to draw separator lines\r
+in the help messages.  If empty, no ruler line is drawn.  It defaults to "=".\r
+\r
+If the value of `self.intro' is nonempty when the cmdloop method is called,\r
+it is printed out on interpreter startup.  This value may be overridden\r
+via an optional argument to the cmdloop() method.\r
+\r
+The data members `self.doc_header', `self.misc_header', and\r
+`self.undoc_header' set the headers used for the help function's\r
+listings of documented functions, miscellaneous topics, and undocumented\r
+functions respectively.\r
+\r
+These interpreters use raw_input; thus, if the readline module is loaded,\r
+they automatically support Emacs-like command history and editing features.\r
+"""\r
+\r
+import string\r
+\r
+__all__ = ["Cmd"]\r
+\r
+PROMPT = '(Cmd) '\r
+IDENTCHARS = string.ascii_letters + string.digits + '_'\r
+\r
+class Cmd:\r
+    """A simple framework for writing line-oriented command interpreters.\r
+\r
+    These are often useful for test harnesses, administrative tools, and\r
+    prototypes that will later be wrapped in a more sophisticated interface.\r
+\r
+    A Cmd instance or subclass instance is a line-oriented interpreter\r
+    framework.  There is no good reason to instantiate Cmd itself; rather,\r
+    it's useful as a superclass of an interpreter class you define yourself\r
+    in order to inherit Cmd's methods and encapsulate action methods.\r
+\r
+    """\r
+    prompt = PROMPT\r
+    identchars = IDENTCHARS\r
+    ruler = '='\r
+    lastcmd = ''\r
+    intro = None\r
+    doc_leader = ""\r
+    doc_header = "Documented commands (type help <topic>):"\r
+    misc_header = "Miscellaneous help topics:"\r
+    undoc_header = "Undocumented commands:"\r
+    nohelp = "*** No help on %s"\r
+    use_rawinput = 1\r
+\r
+    def __init__(self, completekey='tab', stdin=None, stdout=None):\r
+        """Instantiate a line-oriented interpreter framework.\r
+\r
+        The optional argument 'completekey' is the readline name of a\r
+        completion key; it defaults to the Tab key. If completekey is\r
+        not None and the readline module is available, command completion\r
+        is done automatically. The optional arguments stdin and stdout\r
+        specify alternate input and output file objects; if not specified,\r
+        sys.stdin and sys.stdout are used.\r
+\r
+        """\r
+        import sys\r
+        if stdin is not None:\r
+            self.stdin = stdin\r
+        else:\r
+            self.stdin = sys.stdin\r
+        if stdout is not None:\r
+            self.stdout = stdout\r
+        else:\r
+            self.stdout = sys.stdout\r
+        self.cmdqueue = []\r
+        self.completekey = completekey\r
+\r
+    def cmdloop(self, intro=None):\r
+        """Repeatedly issue a prompt, accept input, parse an initial prefix\r
+        off the received input, and dispatch to action methods, passing them\r
+        the remainder of the line as argument.\r
+\r
+        """\r
+\r
+        self.preloop()\r
+        if self.use_rawinput and self.completekey:\r
+            try:\r
+                import readline\r
+                self.old_completer = readline.get_completer()\r
+                readline.set_completer(self.complete)\r
+                readline.parse_and_bind(self.completekey+": complete")\r
+            except ImportError:\r
+                pass\r
+        try:\r
+            if intro is not None:\r
+                self.intro = intro\r
+            if self.intro:\r
+                self.stdout.write(str(self.intro)+"\n")\r
+            stop = None\r
+            while not stop:\r
+                if self.cmdqueue:\r
+                    line = self.cmdqueue.pop(0)\r
+                else:\r
+                    if self.use_rawinput:\r
+                        try:\r
+                            line = raw_input(self.prompt)\r
+                        except EOFError:\r
+                            line = 'EOF'\r
+                    else:\r
+                        self.stdout.write(self.prompt)\r
+                        self.stdout.flush()\r
+                        line = self.stdin.readline()\r
+                        if not len(line):\r
+                            line = 'EOF'\r
+                        else:\r
+                            line = line.rstrip('\r\n')\r
+                line = self.precmd(line)\r
+                stop = self.onecmd(line)\r
+                stop = self.postcmd(stop, line)\r
+            self.postloop()\r
+        finally:\r
+            if self.use_rawinput and self.completekey:\r
+                try:\r
+                    import readline\r
+                    readline.set_completer(self.old_completer)\r
+                except ImportError:\r
+                    pass\r
+\r
+\r
+    def precmd(self, line):\r
+        """Hook method executed just before the command line is\r
+        interpreted, but after the input prompt is generated and issued.\r
+\r
+        """\r
+        return line\r
+\r
+    def postcmd(self, stop, line):\r
+        """Hook method executed just after a command dispatch is finished."""\r
+        return stop\r
+\r
+    def preloop(self):\r
+        """Hook method executed once when the cmdloop() method is called."""\r
+        pass\r
+\r
+    def postloop(self):\r
+        """Hook method executed once when the cmdloop() method is about to\r
+        return.\r
+\r
+        """\r
+        pass\r
+\r
+    def parseline(self, line):\r
+        """Parse the line into a command name and a string containing\r
+        the arguments.  Returns a tuple containing (command, args, line).\r
+        'command' and 'args' may be None if the line couldn't be parsed.\r
+        """\r
+        line = line.strip()\r
+        if not line:\r
+            return None, None, line\r
+        elif line[0] == '?':\r
+            line = 'help ' + line[1:]\r
+        elif line[0] == '!':\r
+            if hasattr(self, 'do_shell'):\r
+                line = 'shell ' + line[1:]\r
+            else:\r
+                return None, None, line\r
+        i, n = 0, len(line)\r
+        while i < n and line[i] in self.identchars: i = i+1\r
+        cmd, arg = line[:i], line[i:].strip()\r
+        return cmd, arg, line\r
+\r
+    def onecmd(self, line):\r
+        """Interpret the argument as though it had been typed in response\r
+        to the prompt.\r
+\r
+        This may be overridden, but should not normally need to be;\r
+        see the precmd() and postcmd() methods for useful execution hooks.\r
+        The return value is a flag indicating whether interpretation of\r
+        commands by the interpreter should stop.\r
+\r
+        """\r
+        cmd, arg, line = self.parseline(line)\r
+        if not line:\r
+            return self.emptyline()\r
+        if cmd is None:\r
+            return self.default(line)\r
+        self.lastcmd = line\r
+        if line == 'EOF' :\r
+            self.lastcmd = ''\r
+        if cmd == '':\r
+            return self.default(line)\r
+        else:\r
+            try:\r
+                func = getattr(self, 'do_' + cmd)\r
+            except AttributeError:\r
+                return self.default(line)\r
+            return func(arg)\r
+\r
+    def emptyline(self):\r
+        """Called when an empty line is entered in response to the prompt.\r
+\r
+        If this method is not overridden, it repeats the last nonempty\r
+        command entered.\r
+\r
+        """\r
+        if self.lastcmd:\r
+            return self.onecmd(self.lastcmd)\r
+\r
+    def default(self, line):\r
+        """Called on an input line when the command prefix is not recognized.\r
+\r
+        If this method is not overridden, it prints an error message and\r
+        returns.\r
+\r
+        """\r
+        self.stdout.write('*** Unknown syntax: %s\n'%line)\r
+\r
+    def completedefault(self, *ignored):\r
+        """Method called to complete an input line when no command-specific\r
+        complete_*() method is available.\r
+\r
+        By default, it returns an empty list.\r
+\r
+        """\r
+        return []\r
+\r
+    def completenames(self, text, *ignored):\r
+        dotext = 'do_'+text\r
+        return [a[3:] for a in self.get_names() if a.startswith(dotext)]\r
+\r
+    def complete(self, text, state):\r
+        """Return the next possible completion for 'text'.\r
+\r
+        If a command has not been entered, then complete against command list.\r
+        Otherwise try to call complete_<command> to get list of completions.\r
+        """\r
+        if state == 0:\r
+            import readline\r
+            origline = readline.get_line_buffer()\r
+            line = origline.lstrip()\r
+            stripped = len(origline) - len(line)\r
+            begidx = readline.get_begidx() - stripped\r
+            endidx = readline.get_endidx() - stripped\r
+            if begidx>0:\r
+                cmd, args, foo = self.parseline(line)\r
+                if cmd == '':\r
+                    compfunc = self.completedefault\r
+                else:\r
+                    try:\r
+                        compfunc = getattr(self, 'complete_' + cmd)\r
+                    except AttributeError:\r
+                        compfunc = self.completedefault\r
+            else:\r
+                compfunc = self.completenames\r
+            self.completion_matches = compfunc(text, line, begidx, endidx)\r
+        try:\r
+            return self.completion_matches[state]\r
+        except IndexError:\r
+            return None\r
+\r
+    def get_names(self):\r
+        # This method used to pull in base class attributes\r
+        # at a time dir() didn't do it yet.\r
+        return dir(self.__class__)\r
+\r
+    def complete_help(self, *args):\r
+        commands = set(self.completenames(*args))\r
+        topics = set(a[5:] for a in self.get_names()\r
+                     if a.startswith('help_' + args[0]))\r
+        return list(commands | topics)\r
+\r
+    def do_help(self, arg):\r
+        'List available commands with "help" or detailed help with "help cmd".'\r
+        if arg:\r
+            # XXX check arg syntax\r
+            try:\r
+                func = getattr(self, 'help_' + arg)\r
+            except AttributeError:\r
+                try:\r
+                    doc=getattr(self, 'do_' + arg).__doc__\r
+                    if doc:\r
+                        self.stdout.write("%s\n"%str(doc))\r
+                        return\r
+                except AttributeError:\r
+                    pass\r
+                self.stdout.write("%s\n"%str(self.nohelp % (arg,)))\r
+                return\r
+            func()\r
+        else:\r
+            names = self.get_names()\r
+            cmds_doc = []\r
+            cmds_undoc = []\r
+            help = {}\r
+            for name in names:\r
+                if name[:5] == 'help_':\r
+                    help[name[5:]]=1\r
+            names.sort()\r
+            # There can be duplicates if routines overridden\r
+            prevname = ''\r
+            for name in names:\r
+                if name[:3] == 'do_':\r
+                    if name == prevname:\r
+                        continue\r
+                    prevname = name\r
+                    cmd=name[3:]\r
+                    if cmd in help:\r
+                        cmds_doc.append(cmd)\r
+                        del help[cmd]\r
+                    elif getattr(self, name).__doc__:\r
+                        cmds_doc.append(cmd)\r
+                    else:\r
+                        cmds_undoc.append(cmd)\r
+            self.stdout.write("%s\n"%str(self.doc_leader))\r
+            self.print_topics(self.doc_header,   cmds_doc,   15,80)\r
+            self.print_topics(self.misc_header,  help.keys(),15,80)\r
+            self.print_topics(self.undoc_header, cmds_undoc, 15,80)\r
+\r
+    def print_topics(self, header, cmds, cmdlen, maxcol):\r
+        if cmds:\r
+            self.stdout.write("%s\n"%str(header))\r
+            if self.ruler:\r
+                self.stdout.write("%s\n"%str(self.ruler * len(header)))\r
+            self.columnize(cmds, maxcol-1)\r
+            self.stdout.write("\n")\r
+\r
+    def columnize(self, list, displaywidth=80):\r
+        """Display a list of strings as a compact set of columns.\r
+\r
+        Each column is only as wide as necessary.\r
+        Columns are separated by two spaces (one was not legible enough).\r
+        """\r
+        if not list:\r
+            self.stdout.write("<empty>\n")\r
+            return\r
+        nonstrings = [i for i in range(len(list))\r
+                        if not isinstance(list[i], str)]\r
+        if nonstrings:\r
+            raise TypeError, ("list[i] not a string for i in %s" %\r
+                              ", ".join(map(str, nonstrings)))\r
+        size = len(list)\r
+        if size == 1:\r
+            self.stdout.write('%s\n'%str(list[0]))\r
+            return\r
+        # Try every row count from 1 upwards\r
+        for nrows in range(1, len(list)):\r
+            ncols = (size+nrows-1) // nrows\r
+            colwidths = []\r
+            totwidth = -2\r
+            for col in range(ncols):\r
+                colwidth = 0\r
+                for row in range(nrows):\r
+                    i = row + nrows*col\r
+                    if i >= size:\r
+                        break\r
+                    x = list[i]\r
+                    colwidth = max(colwidth, len(x))\r
+                colwidths.append(colwidth)\r
+                totwidth += colwidth + 2\r
+                if totwidth > displaywidth:\r
+                    break\r
+            if totwidth <= displaywidth:\r
+                break\r
+        else:\r
+            nrows = len(list)\r
+            ncols = 1\r
+            colwidths = [0]\r
+        for row in range(nrows):\r
+            texts = []\r
+            for col in range(ncols):\r
+                i = row + nrows*col\r
+                if i >= size:\r
+                    x = ""\r
+                else:\r
+                    x = list[i]\r
+                texts.append(x)\r
+            while texts and not texts[-1]:\r
+                del texts[-1]\r
+            for col in range(len(texts)):\r
+                texts[col] = texts[col].ljust(colwidths[col])\r
+            self.stdout.write("%s\n"%str("  ".join(texts)))\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/codecs.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/codecs.py
new file mode 100644 (file)
index 0000000..452bf2f
--- /dev/null
@@ -0,0 +1,1101 @@
+""" codecs -- Python Codec Registry, API and helpers.\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""#"\r
+\r
+import __builtin__, sys\r
+\r
+### Registry and builtin stateless codec functions\r
+\r
+try:\r
+    from _codecs import *\r
+except ImportError, why:\r
+    raise SystemError('Failed to load the builtin codecs: %s' % why)\r
+\r
+__all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE",\r
+           "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE",\r
+           "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE",\r
+           "BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE",\r
+           "CodecInfo", "Codec", "IncrementalEncoder", "IncrementalDecoder",\r
+           "StreamReader", "StreamWriter",\r
+           "StreamReaderWriter", "StreamRecoder",\r
+           "getencoder", "getdecoder", "getincrementalencoder",\r
+           "getincrementaldecoder", "getreader", "getwriter",\r
+           "encode", "decode", "iterencode", "iterdecode",\r
+           "strict_errors", "ignore_errors", "replace_errors",\r
+           "xmlcharrefreplace_errors", "backslashreplace_errors",\r
+           "register_error", "lookup_error"]\r
+\r
+### Constants\r
+\r
+#\r
+# Byte Order Mark (BOM = ZERO WIDTH NO-BREAK SPACE = U+FEFF)\r
+# and its possible byte string values\r
+# for UTF8/UTF16/UTF32 output and little/big endian machines\r
+#\r
+\r
+# UTF-8\r
+BOM_UTF8 = '\xef\xbb\xbf'\r
+\r
+# UTF-16, little endian\r
+BOM_LE = BOM_UTF16_LE = '\xff\xfe'\r
+\r
+# UTF-16, big endian\r
+BOM_BE = BOM_UTF16_BE = '\xfe\xff'\r
+\r
+# UTF-32, little endian\r
+BOM_UTF32_LE = '\xff\xfe\x00\x00'\r
+\r
+# UTF-32, big endian\r
+BOM_UTF32_BE = '\x00\x00\xfe\xff'\r
+\r
+if sys.byteorder == 'little':\r
+\r
+    # UTF-16, native endianness\r
+    BOM = BOM_UTF16 = BOM_UTF16_LE\r
+\r
+    # UTF-32, native endianness\r
+    BOM_UTF32 = BOM_UTF32_LE\r
+\r
+else:\r
+\r
+    # UTF-16, native endianness\r
+    BOM = BOM_UTF16 = BOM_UTF16_BE\r
+\r
+    # UTF-32, native endianness\r
+    BOM_UTF32 = BOM_UTF32_BE\r
+\r
+# Old broken names (don't use in new code)\r
+BOM32_LE = BOM_UTF16_LE\r
+BOM32_BE = BOM_UTF16_BE\r
+BOM64_LE = BOM_UTF32_LE\r
+BOM64_BE = BOM_UTF32_BE\r
+\r
+\r
+### Codec base classes (defining the API)\r
+\r
+class CodecInfo(tuple):\r
+\r
+    def __new__(cls, encode, decode, streamreader=None, streamwriter=None,\r
+        incrementalencoder=None, incrementaldecoder=None, name=None):\r
+        self = tuple.__new__(cls, (encode, decode, streamreader, streamwriter))\r
+        self.name = name\r
+        self.encode = encode\r
+        self.decode = decode\r
+        self.incrementalencoder = incrementalencoder\r
+        self.incrementaldecoder = incrementaldecoder\r
+        self.streamwriter = streamwriter\r
+        self.streamreader = streamreader\r
+        return self\r
+\r
+    def __repr__(self):\r
+        return "<%s.%s object for encoding %s at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))\r
+\r
+class Codec:\r
+\r
+    """ Defines the interface for stateless encoders/decoders.\r
+\r
+        The .encode()/.decode() methods may use different error\r
+        handling schemes by providing the errors argument. These\r
+        string values are predefined:\r
+\r
+         'strict' - raise a ValueError error (or a subclass)\r
+         'ignore' - ignore the character and continue with the next\r
+         'replace' - replace with a suitable replacement character;\r
+                    Python will use the official U+FFFD REPLACEMENT\r
+                    CHARACTER for the builtin Unicode codecs on\r
+                    decoding and '?' on encoding.\r
+         'xmlcharrefreplace' - Replace with the appropriate XML\r
+                               character reference (only for encoding).\r
+         'backslashreplace'  - Replace with backslashed escape sequences\r
+                               (only for encoding).\r
+\r
+        The set of allowed values can be extended via register_error.\r
+\r
+    """\r
+    def encode(self, input, errors='strict'):\r
+\r
+        """ Encodes the object input and returns a tuple (output\r
+            object, length consumed).\r
+\r
+            errors defines the error handling to apply. It defaults to\r
+            'strict' handling.\r
+\r
+            The method may not store state in the Codec instance. Use\r
+            StreamCodec for codecs which have to keep state in order to\r
+            make encoding/decoding efficient.\r
+\r
+            The encoder must be able to handle zero length input and\r
+            return an empty object of the output object type in this\r
+            situation.\r
+\r
+        """\r
+        raise NotImplementedError\r
+\r
+    def decode(self, input, errors='strict'):\r
+\r
+        """ Decodes the object input and returns a tuple (output\r
+            object, length consumed).\r
+\r
+            input must be an object which provides the bf_getreadbuf\r
+            buffer slot. Python strings, buffer objects and memory\r
+            mapped files are examples of objects providing this slot.\r
+\r
+            errors defines the error handling to apply. It defaults to\r
+            'strict' handling.\r
+\r
+            The method may not store state in the Codec instance. Use\r
+            StreamCodec for codecs which have to keep state in order to\r
+            make encoding/decoding efficient.\r
+\r
+            The decoder must be able to handle zero length input and\r
+            return an empty object of the output object type in this\r
+            situation.\r
+\r
+        """\r
+        raise NotImplementedError\r
+\r
+class IncrementalEncoder(object):\r
+    """\r
+    An IncrementalEncoder encodes an input in multiple steps. The input can be\r
+    passed piece by piece to the encode() method. The IncrementalEncoder remembers\r
+    the state of the Encoding process between calls to encode().\r
+    """\r
+    def __init__(self, errors='strict'):\r
+        """\r
+        Creates an IncrementalEncoder instance.\r
+\r
+        The IncrementalEncoder may use different error handling schemes by\r
+        providing the errors keyword argument. See the module docstring\r
+        for a list of possible values.\r
+        """\r
+        self.errors = errors\r
+        self.buffer = ""\r
+\r
+    def encode(self, input, final=False):\r
+        """\r
+        Encodes input and returns the resulting object.\r
+        """\r
+        raise NotImplementedError\r
+\r
+    def reset(self):\r
+        """\r
+        Resets the encoder to the initial state.\r
+        """\r
+\r
+    def getstate(self):\r
+        """\r
+        Return the current state of the encoder.\r
+        """\r
+        return 0\r
+\r
+    def setstate(self, state):\r
+        """\r
+        Set the current state of the encoder. state must have been\r
+        returned by getstate().\r
+        """\r
+\r
+class BufferedIncrementalEncoder(IncrementalEncoder):\r
+    """\r
+    This subclass of IncrementalEncoder can be used as the baseclass for an\r
+    incremental encoder if the encoder must keep some of the output in a\r
+    buffer between calls to encode().\r
+    """\r
+    def __init__(self, errors='strict'):\r
+        IncrementalEncoder.__init__(self, errors)\r
+        self.buffer = "" # unencoded input that is kept between calls to encode()\r
+\r
+    def _buffer_encode(self, input, errors, final):\r
+        # Overwrite this method in subclasses: It must encode input\r
+        # and return an (output, length consumed) tuple\r
+        raise NotImplementedError\r
+\r
+    def encode(self, input, final=False):\r
+        # encode input (taking the buffer into account)\r
+        data = self.buffer + input\r
+        (result, consumed) = self._buffer_encode(data, self.errors, final)\r
+        # keep unencoded input until the next call\r
+        self.buffer = data[consumed:]\r
+        return result\r
+\r
+    def reset(self):\r
+        IncrementalEncoder.reset(self)\r
+        self.buffer = ""\r
+\r
+    def getstate(self):\r
+        return self.buffer or 0\r
+\r
+    def setstate(self, state):\r
+        self.buffer = state or ""\r
+\r
+class IncrementalDecoder(object):\r
+    """\r
+    An IncrementalDecoder decodes an input in multiple steps. The input can be\r
+    passed piece by piece to the decode() method. The IncrementalDecoder\r
+    remembers the state of the decoding process between calls to decode().\r
+    """\r
+    def __init__(self, errors='strict'):\r
+        """\r
+        Creates a IncrementalDecoder instance.\r
+\r
+        The IncrementalDecoder may use different error handling schemes by\r
+        providing the errors keyword argument. See the module docstring\r
+        for a list of possible values.\r
+        """\r
+        self.errors = errors\r
+\r
+    def decode(self, input, final=False):\r
+        """\r
+        Decodes input and returns the resulting object.\r
+        """\r
+        raise NotImplementedError\r
+\r
+    def reset(self):\r
+        """\r
+        Resets the decoder to the initial state.\r
+        """\r
+\r
+    def getstate(self):\r
+        """\r
+        Return the current state of the decoder.\r
+\r
+        This must be a (buffered_input, additional_state_info) tuple.\r
+        buffered_input must be a bytes object containing bytes that\r
+        were passed to decode() that have not yet been converted.\r
+        additional_state_info must be a non-negative integer\r
+        representing the state of the decoder WITHOUT yet having\r
+        processed the contents of buffered_input.  In the initial state\r
+        and after reset(), getstate() must return (b"", 0).\r
+        """\r
+        return (b"", 0)\r
+\r
+    def setstate(self, state):\r
+        """\r
+        Set the current state of the decoder.\r
+\r
+        state must have been returned by getstate().  The effect of\r
+        setstate((b"", 0)) must be equivalent to reset().\r
+        """\r
+\r
+class BufferedIncrementalDecoder(IncrementalDecoder):\r
+    """\r
+    This subclass of IncrementalDecoder can be used as the baseclass for an\r
+    incremental decoder if the decoder must be able to handle incomplete byte\r
+    sequences.\r
+    """\r
+    def __init__(self, errors='strict'):\r
+        IncrementalDecoder.__init__(self, errors)\r
+        self.buffer = "" # undecoded input that is kept between calls to decode()\r
+\r
+    def _buffer_decode(self, input, errors, final):\r
+        # Overwrite this method in subclasses: It must decode input\r
+        # and return an (output, length consumed) tuple\r
+        raise NotImplementedError\r
+\r
+    def decode(self, input, final=False):\r
+        # decode input (taking the buffer into account)\r
+        data = self.buffer + input\r
+        (result, consumed) = self._buffer_decode(data, self.errors, final)\r
+        # keep undecoded input until the next call\r
+        self.buffer = data[consumed:]\r
+        return result\r
+\r
+    def reset(self):\r
+        IncrementalDecoder.reset(self)\r
+        self.buffer = ""\r
+\r
+    def getstate(self):\r
+        # additional state info is always 0\r
+        return (self.buffer, 0)\r
+\r
+    def setstate(self, state):\r
+        # ignore additional state info\r
+        self.buffer = state[0]\r
+\r
+#\r
+# The StreamWriter and StreamReader class provide generic working\r
+# interfaces which can be used to implement new encoding submodules\r
+# very easily. See encodings/utf_8.py for an example on how this is\r
+# done.\r
+#\r
+\r
+class StreamWriter(Codec):\r
+\r
+    def __init__(self, stream, errors='strict'):\r
+\r
+        """ Creates a StreamWriter instance.\r
+\r
+            stream must be a file-like object open for writing\r
+            (binary) data.\r
+\r
+            The StreamWriter may use different error handling\r
+            schemes by providing the errors keyword argument. These\r
+            parameters are predefined:\r
+\r
+             'strict' - raise a ValueError (or a subclass)\r
+             'ignore' - ignore the character and continue with the next\r
+             'replace'- replace with a suitable replacement character\r
+             'xmlcharrefreplace' - Replace with the appropriate XML\r
+                                   character reference.\r
+             'backslashreplace'  - Replace with backslashed escape\r
+                                   sequences (only for encoding).\r
+\r
+            The set of allowed parameter values can be extended via\r
+            register_error.\r
+        """\r
+        self.stream = stream\r
+        self.errors = errors\r
+\r
+    def write(self, object):\r
+\r
+        """ Writes the object's contents encoded to self.stream.\r
+        """\r
+        data, consumed = self.encode(object, self.errors)\r
+        self.stream.write(data)\r
+\r
+    def writelines(self, list):\r
+\r
+        """ Writes the concatenated list of strings to the stream\r
+            using .write().\r
+        """\r
+        self.write(''.join(list))\r
+\r
+    def reset(self):\r
+\r
+        """ Flushes and resets the codec buffers used for keeping state.\r
+\r
+            Calling this method should ensure that the data on the\r
+            output is put into a clean state, that allows appending\r
+            of new fresh data without having to rescan the whole\r
+            stream to recover state.\r
+\r
+        """\r
+        pass\r
+\r
+    def seek(self, offset, whence=0):\r
+        self.stream.seek(offset, whence)\r
+        if whence == 0 and offset == 0:\r
+            self.reset()\r
+\r
+    def __getattr__(self, name,\r
+                    getattr=getattr):\r
+\r
+        """ Inherit all other methods from the underlying stream.\r
+        """\r
+        return getattr(self.stream, name)\r
+\r
+    def __enter__(self):\r
+        return self\r
+\r
+    def __exit__(self, type, value, tb):\r
+        self.stream.close()\r
+\r
+###\r
+\r
+class StreamReader(Codec):\r
+\r
+    def __init__(self, stream, errors='strict'):\r
+\r
+        """ Creates a StreamReader instance.\r
+\r
+            stream must be a file-like object open for reading\r
+            (binary) data.\r
+\r
+            The StreamReader may use different error handling\r
+            schemes by providing the errors keyword argument. These\r
+            parameters are predefined:\r
+\r
+             'strict' - raise a ValueError (or a subclass)\r
+             'ignore' - ignore the character and continue with the next\r
+             'replace'- replace with a suitable replacement character;\r
+\r
+            The set of allowed parameter values can be extended via\r
+            register_error.\r
+        """\r
+        self.stream = stream\r
+        self.errors = errors\r
+        self.bytebuffer = ""\r
+        # For str->str decoding this will stay a str\r
+        # For str->unicode decoding the first read will promote it to unicode\r
+        self.charbuffer = ""\r
+        self.linebuffer = None\r
+\r
+    def decode(self, input, errors='strict'):\r
+        raise NotImplementedError\r
+\r
+    def read(self, size=-1, chars=-1, firstline=False):\r
+\r
+        """ Decodes data from the stream self.stream and returns the\r
+            resulting object.\r
+\r
+            chars indicates the number of characters to read from the\r
+            stream. read() will never return more than chars\r
+            characters, but it might return less, if there are not enough\r
+            characters available.\r
+\r
+            size indicates the approximate maximum number of bytes to\r
+            read from the stream for decoding purposes. The decoder\r
+            can modify this setting as appropriate. The default value\r
+            -1 indicates to read and decode as much as possible.  size\r
+            is intended to prevent having to decode huge files in one\r
+            step.\r
+\r
+            If firstline is true, and a UnicodeDecodeError happens\r
+            after the first line terminator in the input only the first line\r
+            will be returned, the rest of the input will be kept until the\r
+            next call to read().\r
+\r
+            The method should use a greedy read strategy meaning that\r
+            it should read as much data as is allowed within the\r
+            definition of the encoding and the given size, e.g.  if\r
+            optional encoding endings or state markers are available\r
+            on the stream, these should be read too.\r
+        """\r
+        # If we have lines cached, first merge them back into characters\r
+        if self.linebuffer:\r
+            self.charbuffer = "".join(self.linebuffer)\r
+            self.linebuffer = None\r
+\r
+        # read until we get the required number of characters (if available)\r
+        while True:\r
+            # can the request be satisfied from the character buffer?\r
+            if chars >= 0:\r
+                if len(self.charbuffer) >= chars:\r
+                    break\r
+            elif size >= 0:\r
+                if len(self.charbuffer) >= size:\r
+                    break\r
+            # we need more data\r
+            if size < 0:\r
+                newdata = self.stream.read()\r
+            else:\r
+                newdata = self.stream.read(size)\r
+            # decode bytes (those remaining from the last call included)\r
+            data = self.bytebuffer + newdata\r
+            try:\r
+                newchars, decodedbytes = self.decode(data, self.errors)\r
+            except UnicodeDecodeError, exc:\r
+                if firstline:\r
+                    newchars, decodedbytes = self.decode(data[:exc.start], self.errors)\r
+                    lines = newchars.splitlines(True)\r
+                    if len(lines)<=1:\r
+                        raise\r
+                else:\r
+                    raise\r
+            # keep undecoded bytes until the next call\r
+            self.bytebuffer = data[decodedbytes:]\r
+            # put new characters in the character buffer\r
+            self.charbuffer += newchars\r
+            # there was no data available\r
+            if not newdata:\r
+                break\r
+        if chars < 0:\r
+            # Return everything we've got\r
+            result = self.charbuffer\r
+            self.charbuffer = ""\r
+        else:\r
+            # Return the first chars characters\r
+            result = self.charbuffer[:chars]\r
+            self.charbuffer = self.charbuffer[chars:]\r
+        return result\r
+\r
+    def readline(self, size=None, keepends=True):\r
+\r
+        """ Read one line from the input stream and return the\r
+            decoded data.\r
+\r
+            size, if given, is passed as size argument to the\r
+            read() method.\r
+\r
+        """\r
+        # If we have lines cached from an earlier read, return\r
+        # them unconditionally\r
+        if self.linebuffer:\r
+            line = self.linebuffer[0]\r
+            del self.linebuffer[0]\r
+            if len(self.linebuffer) == 1:\r
+                # revert to charbuffer mode; we might need more data\r
+                # next time\r
+                self.charbuffer = self.linebuffer[0]\r
+                self.linebuffer = None\r
+            if not keepends:\r
+                line = line.splitlines(False)[0]\r
+            return line\r
+\r
+        readsize = size or 72\r
+        line = ""\r
+        # If size is given, we call read() only once\r
+        while True:\r
+            data = self.read(readsize, firstline=True)\r
+            if data:\r
+                # If we're at a "\r" read one extra character (which might\r
+                # be a "\n") to get a proper line ending. If the stream is\r
+                # temporarily exhausted we return the wrong line ending.\r
+                if data.endswith("\r"):\r
+                    data += self.read(size=1, chars=1)\r
+\r
+            line += data\r
+            lines = line.splitlines(True)\r
+            if lines:\r
+                if len(lines) > 1:\r
+                    # More than one line result; the first line is a full line\r
+                    # to return\r
+                    line = lines[0]\r
+                    del lines[0]\r
+                    if len(lines) > 1:\r
+                        # cache the remaining lines\r
+                        lines[-1] += self.charbuffer\r
+                        self.linebuffer = lines\r
+                        self.charbuffer = None\r
+                    else:\r
+                        # only one remaining line, put it back into charbuffer\r
+                        self.charbuffer = lines[0] + self.charbuffer\r
+                    if not keepends:\r
+                        line = line.splitlines(False)[0]\r
+                    break\r
+                line0withend = lines[0]\r
+                line0withoutend = lines[0].splitlines(False)[0]\r
+                if line0withend != line0withoutend: # We really have a line end\r
+                    # Put the rest back together and keep it until the next call\r
+                    self.charbuffer = "".join(lines[1:]) + self.charbuffer\r
+                    if keepends:\r
+                        line = line0withend\r
+                    else:\r
+                        line = line0withoutend\r
+                    break\r
+            # we didn't get anything or this was our only try\r
+            if not data or size is not None:\r
+                if line and not keepends:\r
+                    line = line.splitlines(False)[0]\r
+                break\r
+            if readsize<8000:\r
+                readsize *= 2\r
+        return line\r
+\r
+    def readlines(self, sizehint=None, keepends=True):\r
+\r
+        """ Read all lines available on the input stream\r
+            and return them as list of lines.\r
+\r
+            Line breaks are implemented using the codec's decoder\r
+            method and are included in the list entries.\r
+\r
+            sizehint, if given, is ignored since there is no efficient\r
+            way to finding the true end-of-line.\r
+\r
+        """\r
+        data = self.read()\r
+        return data.splitlines(keepends)\r
+\r
+    def reset(self):\r
+\r
+        """ Resets the codec buffers used for keeping state.\r
+\r
+            Note that no stream repositioning should take place.\r
+            This method is primarily intended to be able to recover\r
+            from decoding errors.\r
+\r
+        """\r
+        self.bytebuffer = ""\r
+        self.charbuffer = u""\r
+        self.linebuffer = None\r
+\r
+    def seek(self, offset, whence=0):\r
+        """ Set the input stream's current position.\r
+\r
+            Resets the codec buffers used for keeping state.\r
+        """\r
+        self.stream.seek(offset, whence)\r
+        self.reset()\r
+\r
+    def next(self):\r
+\r
+        """ Return the next decoded line from the input stream."""\r
+        line = self.readline()\r
+        if line:\r
+            return line\r
+        raise StopIteration\r
+\r
+    def __iter__(self):\r
+        return self\r
+\r
+    def __getattr__(self, name,\r
+                    getattr=getattr):\r
+\r
+        """ Inherit all other methods from the underlying stream.\r
+        """\r
+        return getattr(self.stream, name)\r
+\r
+    def __enter__(self):\r
+        return self\r
+\r
+    def __exit__(self, type, value, tb):\r
+        self.stream.close()\r
+\r
+###\r
+\r
+class StreamReaderWriter:\r
+\r
+    """ StreamReaderWriter instances allow wrapping streams which\r
+        work in both read and write modes.\r
+\r
+        The design is such that one can use the factory functions\r
+        returned by the codec.lookup() function to construct the\r
+        instance.\r
+\r
+    """\r
+    # Optional attributes set by the file wrappers below\r
+    encoding = 'unknown'\r
+\r
+    def __init__(self, stream, Reader, Writer, errors='strict'):\r
+\r
+        """ Creates a StreamReaderWriter instance.\r
+\r
+            stream must be a Stream-like object.\r
+\r
+            Reader, Writer must be factory functions or classes\r
+            providing the StreamReader, StreamWriter interface resp.\r
+\r
+            Error handling is done in the same way as defined for the\r
+            StreamWriter/Readers.\r
+\r
+        """\r
+        self.stream = stream\r
+        self.reader = Reader(stream, errors)\r
+        self.writer = Writer(stream, errors)\r
+        self.errors = errors\r
+\r
+    def read(self, size=-1):\r
+\r
+        return self.reader.read(size)\r
+\r
+    def readline(self, size=None):\r
+\r
+        return self.reader.readline(size)\r
+\r
+    def readlines(self, sizehint=None):\r
+\r
+        return self.reader.readlines(sizehint)\r
+\r
+    def next(self):\r
+\r
+        """ Return the next decoded line from the input stream."""\r
+        return self.reader.next()\r
+\r
+    def __iter__(self):\r
+        return self\r
+\r
+    def write(self, data):\r
+\r
+        return self.writer.write(data)\r
+\r
+    def writelines(self, list):\r
+\r
+        return self.writer.writelines(list)\r
+\r
+    def reset(self):\r
+\r
+        self.reader.reset()\r
+        self.writer.reset()\r
+\r
+    def seek(self, offset, whence=0):\r
+        self.stream.seek(offset, whence)\r
+        self.reader.reset()\r
+        if whence == 0 and offset == 0:\r
+            self.writer.reset()\r
+\r
+    def __getattr__(self, name,\r
+                    getattr=getattr):\r
+\r
+        """ Inherit all other methods from the underlying stream.\r
+        """\r
+        return getattr(self.stream, name)\r
+\r
+    # these are needed to make "with codecs.open(...)" work properly\r
+\r
+    def __enter__(self):\r
+        return self\r
+\r
+    def __exit__(self, type, value, tb):\r
+        self.stream.close()\r
+\r
+###\r
+\r
+class StreamRecoder:\r
+\r
+    """ StreamRecoder instances provide a frontend - backend\r
+        view of encoding data.\r
+\r
+        They use the complete set of APIs returned by the\r
+        codecs.lookup() function to implement their task.\r
+\r
+        Data written to the stream is first decoded into an\r
+        intermediate format (which is dependent on the given codec\r
+        combination) and then written to the stream using an instance\r
+        of the provided Writer class.\r
+\r
+        In the other direction, data is read from the stream using a\r
+        Reader instance and then return encoded data to the caller.\r
+\r
+    """\r
+    # Optional attributes set by the file wrappers below\r
+    data_encoding = 'unknown'\r
+    file_encoding = 'unknown'\r
+\r
+    def __init__(self, stream, encode, decode, Reader, Writer,\r
+                 errors='strict'):\r
+\r
+        """ Creates a StreamRecoder instance which implements a two-way\r
+            conversion: encode and decode work on the frontend (the\r
+            input to .read() and output of .write()) while\r
+            Reader and Writer work on the backend (reading and\r
+            writing to the stream).\r
+\r
+            You can use these objects to do transparent direct\r
+            recodings from e.g. latin-1 to utf-8 and back.\r
+\r
+            stream must be a file-like object.\r
+\r
+            encode, decode must adhere to the Codec interface, Reader,\r
+            Writer must be factory functions or classes providing the\r
+            StreamReader, StreamWriter interface resp.\r
+\r
+            encode and decode are needed for the frontend translation,\r
+            Reader and Writer for the backend translation. Unicode is\r
+            used as intermediate encoding.\r
+\r
+            Error handling is done in the same way as defined for the\r
+            StreamWriter/Readers.\r
+\r
+        """\r
+        self.stream = stream\r
+        self.encode = encode\r
+        self.decode = decode\r
+        self.reader = Reader(stream, errors)\r
+        self.writer = Writer(stream, errors)\r
+        self.errors = errors\r
+\r
+    def read(self, size=-1):\r
+\r
+        data = self.reader.read(size)\r
+        data, bytesencoded = self.encode(data, self.errors)\r
+        return data\r
+\r
+    def readline(self, size=None):\r
+\r
+        if size is None:\r
+            data = self.reader.readline()\r
+        else:\r
+            data = self.reader.readline(size)\r
+        data, bytesencoded = self.encode(data, self.errors)\r
+        return data\r
+\r
+    def readlines(self, sizehint=None):\r
+\r
+        data = self.reader.read()\r
+        data, bytesencoded = self.encode(data, self.errors)\r
+        return data.splitlines(1)\r
+\r
+    def next(self):\r
+\r
+        """ Return the next decoded line from the input stream."""\r
+        data = self.reader.next()\r
+        data, bytesencoded = self.encode(data, self.errors)\r
+        return data\r
+\r
+    def __iter__(self):\r
+        return self\r
+\r
+    def write(self, data):\r
+\r
+        data, bytesdecoded = self.decode(data, self.errors)\r
+        return self.writer.write(data)\r
+\r
+    def writelines(self, list):\r
+\r
+        data = ''.join(list)\r
+        data, bytesdecoded = self.decode(data, self.errors)\r
+        return self.writer.write(data)\r
+\r
+    def reset(self):\r
+\r
+        self.reader.reset()\r
+        self.writer.reset()\r
+\r
+    def __getattr__(self, name,\r
+                    getattr=getattr):\r
+\r
+        """ Inherit all other methods from the underlying stream.\r
+        """\r
+        return getattr(self.stream, name)\r
+\r
+    def __enter__(self):\r
+        return self\r
+\r
+    def __exit__(self, type, value, tb):\r
+        self.stream.close()\r
+\r
+### Shortcuts\r
+\r
+def open(filename, mode='rb', encoding=None, errors='strict', buffering=1):\r
+\r
+    """ Open an encoded file using the given mode and return\r
+        a wrapped version providing transparent encoding/decoding.\r
+\r
+        Note: The wrapped version will only accept the object format\r
+        defined by the codecs, i.e. Unicode objects for most builtin\r
+        codecs. Output is also codec dependent and will usually be\r
+        Unicode as well.\r
+\r
+        Files are always opened in binary mode, even if no binary mode\r
+        was specified. This is done to avoid data loss due to encodings\r
+        using 8-bit values. The default file mode is 'rb' meaning to\r
+        open the file in binary read mode.\r
+\r
+        encoding specifies the encoding which is to be used for the\r
+        file.\r
+\r
+        errors may be given to define the error handling. It defaults\r
+        to 'strict' which causes ValueErrors to be raised in case an\r
+        encoding error occurs.\r
+\r
+        buffering has the same meaning as for the builtin open() API.\r
+        It defaults to line buffered.\r
+\r
+        The returned wrapped file object provides an extra attribute\r
+        .encoding which allows querying the used encoding. This\r
+        attribute is only available if an encoding was specified as\r
+        parameter.\r
+\r
+    """\r
+    if encoding is not None:\r
+        if 'U' in mode:\r
+            # No automatic conversion of '\n' is done on reading and writing\r
+            mode = mode.strip().replace('U', '')\r
+            if mode[:1] not in set('rwa'):\r
+                mode = 'r' + mode\r
+        if 'b' not in mode:\r
+            # Force opening of the file in binary mode\r
+            mode = mode + 'b'\r
+    file = __builtin__.open(filename, mode, buffering)\r
+    if encoding is None:\r
+        return file\r
+    info = lookup(encoding)\r
+    srw = StreamReaderWriter(file, info.streamreader, info.streamwriter, errors)\r
+    # Add attributes to simplify introspection\r
+    srw.encoding = encoding\r
+    return srw\r
+\r
+def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'):\r
+\r
+    """ Return a wrapped version of file which provides transparent\r
+        encoding translation.\r
+\r
+        Strings written to the wrapped file are interpreted according\r
+        to the given data_encoding and then written to the original\r
+        file as string using file_encoding. The intermediate encoding\r
+        will usually be Unicode but depends on the specified codecs.\r
+\r
+        Strings are read from the file using file_encoding and then\r
+        passed back to the caller as string using data_encoding.\r
+\r
+        If file_encoding is not given, it defaults to data_encoding.\r
+\r
+        errors may be given to define the error handling. It defaults\r
+        to 'strict' which causes ValueErrors to be raised in case an\r
+        encoding error occurs.\r
+\r
+        The returned wrapped file object provides two extra attributes\r
+        .data_encoding and .file_encoding which reflect the given\r
+        parameters of the same name. The attributes can be used for\r
+        introspection by Python programs.\r
+\r
+    """\r
+    if file_encoding is None:\r
+        file_encoding = data_encoding\r
+    data_info = lookup(data_encoding)\r
+    file_info = lookup(file_encoding)\r
+    sr = StreamRecoder(file, data_info.encode, data_info.decode,\r
+                       file_info.streamreader, file_info.streamwriter, errors)\r
+    # Add attributes to simplify introspection\r
+    sr.data_encoding = data_encoding\r
+    sr.file_encoding = file_encoding\r
+    return sr\r
+\r
+### Helpers for codec lookup\r
+\r
+def getencoder(encoding):\r
+\r
+    """ Lookup up the codec for the given encoding and return\r
+        its encoder function.\r
+\r
+        Raises a LookupError in case the encoding cannot be found.\r
+\r
+    """\r
+    return lookup(encoding).encode\r
+\r
+def getdecoder(encoding):\r
+\r
+    """ Lookup up the codec for the given encoding and return\r
+        its decoder function.\r
+\r
+        Raises a LookupError in case the encoding cannot be found.\r
+\r
+    """\r
+    return lookup(encoding).decode\r
+\r
+def getincrementalencoder(encoding):\r
+\r
+    """ Lookup up the codec for the given encoding and return\r
+        its IncrementalEncoder class or factory function.\r
+\r
+        Raises a LookupError in case the encoding cannot be found\r
+        or the codecs doesn't provide an incremental encoder.\r
+\r
+    """\r
+    encoder = lookup(encoding).incrementalencoder\r
+    if encoder is None:\r
+        raise LookupError(encoding)\r
+    return encoder\r
+\r
+def getincrementaldecoder(encoding):\r
+\r
+    """ Lookup up the codec for the given encoding and return\r
+        its IncrementalDecoder class or factory function.\r
+\r
+        Raises a LookupError in case the encoding cannot be found\r
+        or the codecs doesn't provide an incremental decoder.\r
+\r
+    """\r
+    decoder = lookup(encoding).incrementaldecoder\r
+    if decoder is None:\r
+        raise LookupError(encoding)\r
+    return decoder\r
+\r
+def getreader(encoding):\r
+\r
+    """ Lookup up the codec for the given encoding and return\r
+        its StreamReader class or factory function.\r
+\r
+        Raises a LookupError in case the encoding cannot be found.\r
+\r
+    """\r
+    return lookup(encoding).streamreader\r
+\r
+def getwriter(encoding):\r
+\r
+    """ Lookup up the codec for the given encoding and return\r
+        its StreamWriter class or factory function.\r
+\r
+        Raises a LookupError in case the encoding cannot be found.\r
+\r
+    """\r
+    return lookup(encoding).streamwriter\r
+\r
+def iterencode(iterator, encoding, errors='strict', **kwargs):\r
+    """\r
+    Encoding iterator.\r
+\r
+    Encodes the input strings from the iterator using a IncrementalEncoder.\r
+\r
+    errors and kwargs are passed through to the IncrementalEncoder\r
+    constructor.\r
+    """\r
+    encoder = getincrementalencoder(encoding)(errors, **kwargs)\r
+    for input in iterator:\r
+        output = encoder.encode(input)\r
+        if output:\r
+            yield output\r
+    output = encoder.encode("", True)\r
+    if output:\r
+        yield output\r
+\r
+def iterdecode(iterator, encoding, errors='strict', **kwargs):\r
+    """\r
+    Decoding iterator.\r
+\r
+    Decodes the input strings from the iterator using a IncrementalDecoder.\r
+\r
+    errors and kwargs are passed through to the IncrementalDecoder\r
+    constructor.\r
+    """\r
+    decoder = getincrementaldecoder(encoding)(errors, **kwargs)\r
+    for input in iterator:\r
+        output = decoder.decode(input)\r
+        if output:\r
+            yield output\r
+    output = decoder.decode("", True)\r
+    if output:\r
+        yield output\r
+\r
+### Helpers for charmap-based codecs\r
+\r
+def make_identity_dict(rng):\r
+\r
+    """ make_identity_dict(rng) -> dict\r
+\r
+        Return a dictionary where elements of the rng sequence are\r
+        mapped to themselves.\r
+\r
+    """\r
+    res = {}\r
+    for i in rng:\r
+        res[i]=i\r
+    return res\r
+\r
+def make_encoding_map(decoding_map):\r
+\r
+    """ Creates an encoding map from a decoding map.\r
+\r
+        If a target mapping in the decoding map occurs multiple\r
+        times, then that target is mapped to None (undefined mapping),\r
+        causing an exception when encountered by the charmap codec\r
+        during translation.\r
+\r
+        One example where this happens is cp875.py which decodes\r
+        multiple character to \\u001a.\r
+\r
+    """\r
+    m = {}\r
+    for k,v in decoding_map.items():\r
+        if not v in m:\r
+            m[v] = k\r
+        else:\r
+            m[v] = None\r
+    return m\r
+\r
+### error handlers\r
+\r
+try:\r
+    strict_errors = lookup_error("strict")\r
+    ignore_errors = lookup_error("ignore")\r
+    replace_errors = lookup_error("replace")\r
+    xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace")\r
+    backslashreplace_errors = lookup_error("backslashreplace")\r
+except LookupError:\r
+    # In --disable-unicode builds, these error handler are missing\r
+    strict_errors = None\r
+    ignore_errors = None\r
+    replace_errors = None\r
+    xmlcharrefreplace_errors = None\r
+    backslashreplace_errors = None\r
+\r
+# Tell modulefinder that using codecs probably needs the encodings\r
+# package\r
+_false = 0\r
+if _false:\r
+    import encodings\r
+\r
+### Tests\r
+\r
+if __name__ == '__main__':\r
+\r
+    # Make stdout translate Latin-1 output into UTF-8 output\r
+    sys.stdout = EncodedFile(sys.stdout, 'latin-1', 'utf-8')\r
+\r
+    # Have stdin translate Latin-1 input into UTF-8 input\r
+    sys.stdin = EncodedFile(sys.stdin, 'utf-8', 'latin-1')\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/collections.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/collections.py
new file mode 100644 (file)
index 0000000..82bf490
--- /dev/null
@@ -0,0 +1,730 @@
+__all__ = ['Counter', 'deque', 'defaultdict', 'namedtuple', 'OrderedDict']\r
+# For bootstrapping reasons, the collection ABCs are defined in _abcoll.py.\r
+# They should however be considered an integral part of collections.py.\r
+from _abcoll import *\r
+import _abcoll\r
+__all__ += _abcoll.__all__\r
+\r
+from _collections import deque, defaultdict\r
+from operator import itemgetter as _itemgetter, eq as _eq\r
+from keyword import iskeyword as _iskeyword\r
+import sys as _sys\r
+import heapq as _heapq\r
+from itertools import repeat as _repeat, chain as _chain, starmap as _starmap\r
+from itertools import imap as _imap\r
+\r
+try:\r
+    from thread import get_ident as _get_ident\r
+except ImportError:\r
+    from dummy_thread import get_ident as _get_ident\r
+\r
+\r
+################################################################################\r
+### OrderedDict\r
+################################################################################\r
+\r
+class OrderedDict(dict):\r
+    'Dictionary that remembers insertion order'\r
+    # An inherited dict maps keys to values.\r
+    # The inherited dict provides __getitem__, __len__, __contains__, and get.\r
+    # The remaining methods are order-aware.\r
+    # Big-O running times for all methods are the same as regular dictionaries.\r
+\r
+    # The internal self.__map dict maps keys to links in a doubly linked list.\r
+    # The circular doubly linked list starts and ends with a sentinel element.\r
+    # The sentinel element never gets deleted (this simplifies the algorithm).\r
+    # Each link is stored as a list of length three:  [PREV, NEXT, KEY].\r
+\r
+    def __init__(*args, **kwds):\r
+        '''Initialize an ordered dictionary.  The signature is the same as\r
+        regular dictionaries, but keyword arguments are not recommended because\r
+        their insertion order is arbitrary.\r
+\r
+        '''\r
+        if not args:\r
+            raise TypeError("descriptor '__init__' of 'OrderedDict' object "\r
+                            "needs an argument")\r
+        self = args[0]\r
+        args = args[1:]\r
+        if len(args) > 1:\r
+            raise TypeError('expected at most 1 arguments, got %d' % len(args))\r
+        try:\r
+            self.__root\r
+        except AttributeError:\r
+            self.__root = root = []                     # sentinel node\r
+            root[:] = [root, root, None]\r
+            self.__map = {}\r
+        self.__update(*args, **kwds)\r
+\r
+    def __setitem__(self, key, value, dict_setitem=dict.__setitem__):\r
+        'od.__setitem__(i, y) <==> od[i]=y'\r
+        # Setting a new item creates a new link at the end of the linked list,\r
+        # and the inherited dictionary is updated with the new key/value pair.\r
+        if key not in self:\r
+            root = self.__root\r
+            last = root[0]\r
+            last[1] = root[0] = self.__map[key] = [last, root, key]\r
+        return dict_setitem(self, key, value)\r
+\r
+    def __delitem__(self, key, dict_delitem=dict.__delitem__):\r
+        'od.__delitem__(y) <==> del od[y]'\r
+        # Deleting an existing item uses self.__map to find the link which gets\r
+        # removed by updating the links in the predecessor and successor nodes.\r
+        dict_delitem(self, key)\r
+        link_prev, link_next, _ = self.__map.pop(key)\r
+        link_prev[1] = link_next                        # update link_prev[NEXT]\r
+        link_next[0] = link_prev                        # update link_next[PREV]\r
+\r
+    def __iter__(self):\r
+        'od.__iter__() <==> iter(od)'\r
+        # Traverse the linked list in order.\r
+        root = self.__root\r
+        curr = root[1]                                  # start at the first node\r
+        while curr is not root:\r
+            yield curr[2]                               # yield the curr[KEY]\r
+            curr = curr[1]                              # move to next node\r
+\r
+    def __reversed__(self):\r
+        'od.__reversed__() <==> reversed(od)'\r
+        # Traverse the linked list in reverse order.\r
+        root = self.__root\r
+        curr = root[0]                                  # start at the last node\r
+        while curr is not root:\r
+            yield curr[2]                               # yield the curr[KEY]\r
+            curr = curr[0]                              # move to previous node\r
+\r
+    def clear(self):\r
+        'od.clear() -> None.  Remove all items from od.'\r
+        root = self.__root\r
+        root[:] = [root, root, None]\r
+        self.__map.clear()\r
+        dict.clear(self)\r
+\r
+    # -- the following methods do not depend on the internal structure --\r
+\r
+    def keys(self):\r
+        'od.keys() -> list of keys in od'\r
+        return list(self)\r
+\r
+    def values(self):\r
+        'od.values() -> list of values in od'\r
+        return [self[key] for key in self]\r
+\r
+    def items(self):\r
+        'od.items() -> list of (key, value) pairs in od'\r
+        return [(key, self[key]) for key in self]\r
+\r
+    def iterkeys(self):\r
+        'od.iterkeys() -> an iterator over the keys in od'\r
+        return iter(self)\r
+\r
+    def itervalues(self):\r
+        'od.itervalues -> an iterator over the values in od'\r
+        for k in self:\r
+            yield self[k]\r
+\r
+    def iteritems(self):\r
+        'od.iteritems -> an iterator over the (key, value) pairs in od'\r
+        for k in self:\r
+            yield (k, self[k])\r
+\r
+    update = MutableMapping.update\r
+\r
+    __update = update # let subclasses override update without breaking __init__\r
+\r
+    __marker = object()\r
+\r
+    def pop(self, key, default=__marker):\r
+        '''od.pop(k[,d]) -> v, remove specified key and return the corresponding\r
+        value.  If key is not found, d is returned if given, otherwise KeyError\r
+        is raised.\r
+\r
+        '''\r
+        if key in self:\r
+            result = self[key]\r
+            del self[key]\r
+            return result\r
+        if default is self.__marker:\r
+            raise KeyError(key)\r
+        return default\r
+\r
+    def setdefault(self, key, default=None):\r
+        'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'\r
+        if key in self:\r
+            return self[key]\r
+        self[key] = default\r
+        return default\r
+\r
+    def popitem(self, last=True):\r
+        '''od.popitem() -> (k, v), return and remove a (key, value) pair.\r
+        Pairs are returned in LIFO order if last is true or FIFO order if false.\r
+\r
+        '''\r
+        if not self:\r
+            raise KeyError('dictionary is empty')\r
+        key = next(reversed(self) if last else iter(self))\r
+        value = self.pop(key)\r
+        return key, value\r
+\r
+    def __repr__(self, _repr_running={}):\r
+        'od.__repr__() <==> repr(od)'\r
+        call_key = id(self), _get_ident()\r
+        if call_key in _repr_running:\r
+            return '...'\r
+        _repr_running[call_key] = 1\r
+        try:\r
+            if not self:\r
+                return '%s()' % (self.__class__.__name__,)\r
+            return '%s(%r)' % (self.__class__.__name__, self.items())\r
+        finally:\r
+            del _repr_running[call_key]\r
+\r
+    def __reduce__(self):\r
+        'Return state information for pickling'\r
+        items = [[k, self[k]] for k in self]\r
+        inst_dict = vars(self).copy()\r
+        for k in vars(OrderedDict()):\r
+            inst_dict.pop(k, None)\r
+        if inst_dict:\r
+            return (self.__class__, (items,), inst_dict)\r
+        return self.__class__, (items,)\r
+\r
+    def copy(self):\r
+        'od.copy() -> a shallow copy of od'\r
+        return self.__class__(self)\r
+\r
+    @classmethod\r
+    def fromkeys(cls, iterable, value=None):\r
+        '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.\r
+        If not specified, the value defaults to None.\r
+\r
+        '''\r
+        self = cls()\r
+        for key in iterable:\r
+            self[key] = value\r
+        return self\r
+\r
+    def __eq__(self, other):\r
+        '''od.__eq__(y) <==> od==y.  Comparison to another OD is order-sensitive\r
+        while comparison to a regular mapping is order-insensitive.\r
+\r
+        '''\r
+        if isinstance(other, OrderedDict):\r
+            return dict.__eq__(self, other) and all(_imap(_eq, self, other))\r
+        return dict.__eq__(self, other)\r
+\r
+    def __ne__(self, other):\r
+        'od.__ne__(y) <==> od!=y'\r
+        return not self == other\r
+\r
+    # -- the following methods support python 3.x style dictionary views --\r
+\r
+    def viewkeys(self):\r
+        "od.viewkeys() -> a set-like object providing a view on od's keys"\r
+        return KeysView(self)\r
+\r
+    def viewvalues(self):\r
+        "od.viewvalues() -> an object providing a view on od's values"\r
+        return ValuesView(self)\r
+\r
+    def viewitems(self):\r
+        "od.viewitems() -> a set-like object providing a view on od's items"\r
+        return ItemsView(self)\r
+\r
+\r
+################################################################################\r
+### namedtuple\r
+################################################################################\r
+\r
+_class_template = '''\\r
+class {typename}(tuple):\r
+    '{typename}({arg_list})'\r
+\r
+    __slots__ = ()\r
+\r
+    _fields = {field_names!r}\r
+\r
+    def __new__(_cls, {arg_list}):\r
+        'Create new instance of {typename}({arg_list})'\r
+        return _tuple.__new__(_cls, ({arg_list}))\r
+\r
+    @classmethod\r
+    def _make(cls, iterable, new=tuple.__new__, len=len):\r
+        'Make a new {typename} object from a sequence or iterable'\r
+        result = new(cls, iterable)\r
+        if len(result) != {num_fields:d}:\r
+            raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result))\r
+        return result\r
+\r
+    def __repr__(self):\r
+        'Return a nicely formatted representation string'\r
+        return '{typename}({repr_fmt})' % self\r
+\r
+    def _asdict(self):\r
+        'Return a new OrderedDict which maps field names to their values'\r
+        return OrderedDict(zip(self._fields, self))\r
+\r
+    def _replace(_self, **kwds):\r
+        'Return a new {typename} object replacing specified fields with new values'\r
+        result = _self._make(map(kwds.pop, {field_names!r}, _self))\r
+        if kwds:\r
+            raise ValueError('Got unexpected field names: %r' % kwds.keys())\r
+        return result\r
+\r
+    def __getnewargs__(self):\r
+        'Return self as a plain tuple.  Used by copy and pickle.'\r
+        return tuple(self)\r
+\r
+    __dict__ = _property(_asdict)\r
+\r
+    def __getstate__(self):\r
+        'Exclude the OrderedDict from pickling'\r
+        pass\r
+\r
+{field_defs}\r
+'''\r
+\r
+_repr_template = '{name}=%r'\r
+\r
+_field_template = '''\\r
+    {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}')\r
+'''\r
+\r
+def namedtuple(typename, field_names, verbose=False, rename=False):\r
+    """Returns a new subclass of tuple with named fields.\r
+\r
+    >>> Point = namedtuple('Point', ['x', 'y'])\r
+    >>> Point.__doc__                   # docstring for the new class\r
+    'Point(x, y)'\r
+    >>> p = Point(11, y=22)             # instantiate with positional args or keywords\r
+    >>> p[0] + p[1]                     # indexable like a plain tuple\r
+    33\r
+    >>> x, y = p                        # unpack like a regular tuple\r
+    >>> x, y\r
+    (11, 22)\r
+    >>> p.x + p.y                       # fields also accessable by name\r
+    33\r
+    >>> d = p._asdict()                 # convert to a dictionary\r
+    >>> d['x']\r
+    11\r
+    >>> Point(**d)                      # convert from a dictionary\r
+    Point(x=11, y=22)\r
+    >>> p._replace(x=100)               # _replace() is like str.replace() but targets named fields\r
+    Point(x=100, y=22)\r
+\r
+    """\r
+\r
+    # Validate the field names.  At the user's option, either generate an error\r
+    # message or automatically replace the field name with a valid name.\r
+    if isinstance(field_names, basestring):\r
+        field_names = field_names.replace(',', ' ').split()\r
+    field_names = map(str, field_names)\r
+    typename = str(typename)\r
+    if rename:\r
+        seen = set()\r
+        for index, name in enumerate(field_names):\r
+            if (not all(c.isalnum() or c=='_' for c in name)\r
+                or _iskeyword(name)\r
+                or not name\r
+                or name[0].isdigit()\r
+                or name.startswith('_')\r
+                or name in seen):\r
+                field_names[index] = '_%d' % index\r
+            seen.add(name)\r
+    for name in [typename] + field_names:\r
+        if type(name) != str:\r
+            raise TypeError('Type names and field names must be strings')\r
+        if not all(c.isalnum() or c=='_' for c in name):\r
+            raise ValueError('Type names and field names can only contain '\r
+                             'alphanumeric characters and underscores: %r' % name)\r
+        if _iskeyword(name):\r
+            raise ValueError('Type names and field names cannot be a '\r
+                             'keyword: %r' % name)\r
+        if name[0].isdigit():\r
+            raise ValueError('Type names and field names cannot start with '\r
+                             'a number: %r' % name)\r
+    seen = set()\r
+    for name in field_names:\r
+        if name.startswith('_') and not rename:\r
+            raise ValueError('Field names cannot start with an underscore: '\r
+                             '%r' % name)\r
+        if name in seen:\r
+            raise ValueError('Encountered duplicate field name: %r' % name)\r
+        seen.add(name)\r
+\r
+    # Fill-in the class template\r
+    class_definition = _class_template.format(\r
+        typename = typename,\r
+        field_names = tuple(field_names),\r
+        num_fields = len(field_names),\r
+        arg_list = repr(tuple(field_names)).replace("'", "")[1:-1],\r
+        repr_fmt = ', '.join(_repr_template.format(name=name)\r
+                             for name in field_names),\r
+        field_defs = '\n'.join(_field_template.format(index=index, name=name)\r
+                               for index, name in enumerate(field_names))\r
+    )\r
+    if verbose:\r
+        print class_definition\r
+\r
+    # Execute the template string in a temporary namespace and support\r
+    # tracing utilities by setting a value for frame.f_globals['__name__']\r
+    namespace = dict(_itemgetter=_itemgetter, __name__='namedtuple_%s' % typename,\r
+                     OrderedDict=OrderedDict, _property=property, _tuple=tuple)\r
+    try:\r
+        exec class_definition in namespace\r
+    except SyntaxError as e:\r
+        raise SyntaxError(e.message + ':\n' + class_definition)\r
+    result = namespace[typename]\r
+\r
+    # For pickling to work, the __module__ variable needs to be set to the frame\r
+    # where the named tuple is created.  Bypass this step in environments where\r
+    # sys._getframe is not defined (Jython for example) or sys._getframe is not\r
+    # defined for arguments greater than 0 (IronPython).\r
+    try:\r
+        result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__')\r
+    except (AttributeError, ValueError):\r
+        pass\r
+\r
+    return result\r
+\r
+\r
+########################################################################\r
+###  Counter\r
+########################################################################\r
+\r
+class Counter(dict):\r
+    '''Dict subclass for counting hashable items.  Sometimes called a bag\r
+    or multiset.  Elements are stored as dictionary keys and their counts\r
+    are stored as dictionary values.\r
+\r
+    >>> c = Counter('abcdeabcdabcaba')  # count elements from a string\r
+\r
+    >>> c.most_common(3)                # three most common elements\r
+    [('a', 5), ('b', 4), ('c', 3)]\r
+    >>> sorted(c)                       # list all unique elements\r
+    ['a', 'b', 'c', 'd', 'e']\r
+    >>> ''.join(sorted(c.elements()))   # list elements with repetitions\r
+    'aaaaabbbbcccdde'\r
+    >>> sum(c.values())                 # total of all counts\r
+    15\r
+\r
+    >>> c['a']                          # count of letter 'a'\r
+    5\r
+    >>> for elem in 'shazam':           # update counts from an iterable\r
+    ...     c[elem] += 1                # by adding 1 to each element's count\r
+    >>> c['a']                          # now there are seven 'a'\r
+    7\r
+    >>> del c['b']                      # remove all 'b'\r
+    >>> c['b']                          # now there are zero 'b'\r
+    0\r
+\r
+    >>> d = Counter('simsalabim')       # make another counter\r
+    >>> c.update(d)                     # add in the second counter\r
+    >>> c['a']                          # now there are nine 'a'\r
+    9\r
+\r
+    >>> c.clear()                       # empty the counter\r
+    >>> c\r
+    Counter()\r
+\r
+    Note:  If a count is set to zero or reduced to zero, it will remain\r
+    in the counter until the entry is deleted or the counter is cleared:\r
+\r
+    >>> c = Counter('aaabbc')\r
+    >>> c['b'] -= 2                     # reduce the count of 'b' by two\r
+    >>> c.most_common()                 # 'b' is still in, but its count is zero\r
+    [('a', 3), ('c', 1), ('b', 0)]\r
+\r
+    '''\r
+    # References:\r
+    #   http://en.wikipedia.org/wiki/Multiset\r
+    #   http://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html\r
+    #   http://www.demo2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm\r
+    #   http://code.activestate.com/recipes/259174/\r
+    #   Knuth, TAOCP Vol. II section 4.6.3\r
+\r
+    def __init__(*args, **kwds):\r
+        '''Create a new, empty Counter object.  And if given, count elements\r
+        from an input iterable.  Or, initialize the count from another mapping\r
+        of elements to their counts.\r
+\r
+        >>> c = Counter()                           # a new, empty counter\r
+        >>> c = Counter('gallahad')                 # a new counter from an iterable\r
+        >>> c = Counter({'a': 4, 'b': 2})           # a new counter from a mapping\r
+        >>> c = Counter(a=4, b=2)                   # a new counter from keyword args\r
+\r
+        '''\r
+        if not args:\r
+            raise TypeError("descriptor '__init__' of 'Counter' object "\r
+                            "needs an argument")\r
+        self = args[0]\r
+        args = args[1:]\r
+        if len(args) > 1:\r
+            raise TypeError('expected at most 1 arguments, got %d' % len(args))\r
+        super(Counter, self).__init__()\r
+        self.update(*args, **kwds)\r
+\r
+    def __missing__(self, key):\r
+        'The count of elements not in the Counter is zero.'\r
+        # Needed so that self[missing_item] does not raise KeyError\r
+        return 0\r
+\r
+    def most_common(self, n=None):\r
+        '''List the n most common elements and their counts from the most\r
+        common to the least.  If n is None, then list all element counts.\r
+\r
+        >>> Counter('abcdeabcdabcaba').most_common(3)\r
+        [('a', 5), ('b', 4), ('c', 3)]\r
+\r
+        '''\r
+        # Emulate Bag.sortedByCount from Smalltalk\r
+        if n is None:\r
+            return sorted(self.iteritems(), key=_itemgetter(1), reverse=True)\r
+        return _heapq.nlargest(n, self.iteritems(), key=_itemgetter(1))\r
+\r
+    def elements(self):\r
+        '''Iterator over elements repeating each as many times as its count.\r
+\r
+        >>> c = Counter('ABCABC')\r
+        >>> sorted(c.elements())\r
+        ['A', 'A', 'B', 'B', 'C', 'C']\r
+\r
+        # Knuth's example for prime factors of 1836:  2**2 * 3**3 * 17**1\r
+        >>> prime_factors = Counter({2: 2, 3: 3, 17: 1})\r
+        >>> product = 1\r
+        >>> for factor in prime_factors.elements():     # loop over factors\r
+        ...     product *= factor                       # and multiply them\r
+        >>> product\r
+        1836\r
+\r
+        Note, if an element's count has been set to zero or is a negative\r
+        number, elements() will ignore it.\r
+\r
+        '''\r
+        # Emulate Bag.do from Smalltalk and Multiset.begin from C++.\r
+        return _chain.from_iterable(_starmap(_repeat, self.iteritems()))\r
+\r
+    # Override dict methods where necessary\r
+\r
+    @classmethod\r
+    def fromkeys(cls, iterable, v=None):\r
+        # There is no equivalent method for counters because setting v=1\r
+        # means that no element can have a count greater than one.\r
+        raise NotImplementedError(\r
+            'Counter.fromkeys() is undefined.  Use Counter(iterable) instead.')\r
+\r
+    def update(*args, **kwds):\r
+        '''Like dict.update() but add counts instead of replacing them.\r
+\r
+        Source can be an iterable, a dictionary, or another Counter instance.\r
+\r
+        >>> c = Counter('which')\r
+        >>> c.update('witch')           # add elements from another iterable\r
+        >>> d = Counter('watch')\r
+        >>> c.update(d)                 # add elements from another counter\r
+        >>> c['h']                      # four 'h' in which, witch, and watch\r
+        4\r
+\r
+        '''\r
+        # The regular dict.update() operation makes no sense here because the\r
+        # replace behavior results in the some of original untouched counts\r
+        # being mixed-in with all of the other counts for a mismash that\r
+        # doesn't have a straight-forward interpretation in most counting\r
+        # contexts.  Instead, we implement straight-addition.  Both the inputs\r
+        # and outputs are allowed to contain zero and negative counts.\r
+\r
+        if not args:\r
+            raise TypeError("descriptor 'update' of 'Counter' object "\r
+                            "needs an argument")\r
+        self = args[0]\r
+        args = args[1:]\r
+        if len(args) > 1:\r
+            raise TypeError('expected at most 1 arguments, got %d' % len(args))\r
+        iterable = args[0] if args else None\r
+        if iterable is not None:\r
+            if isinstance(iterable, Mapping):\r
+                if self:\r
+                    self_get = self.get\r
+                    for elem, count in iterable.iteritems():\r
+                        self[elem] = self_get(elem, 0) + count\r
+                else:\r
+                    super(Counter, self).update(iterable) # fast path when counter is empty\r
+            else:\r
+                self_get = self.get\r
+                for elem in iterable:\r
+                    self[elem] = self_get(elem, 0) + 1\r
+        if kwds:\r
+            self.update(kwds)\r
+\r
+    def subtract(*args, **kwds):\r
+        '''Like dict.update() but subtracts counts instead of replacing them.\r
+        Counts can be reduced below zero.  Both the inputs and outputs are\r
+        allowed to contain zero and negative counts.\r
+\r
+        Source can be an iterable, a dictionary, or another Counter instance.\r
+\r
+        >>> c = Counter('which')\r
+        >>> c.subtract('witch')             # subtract elements from another iterable\r
+        >>> c.subtract(Counter('watch'))    # subtract elements from another counter\r
+        >>> c['h']                          # 2 in which, minus 1 in witch, minus 1 in watch\r
+        0\r
+        >>> c['w']                          # 1 in which, minus 1 in witch, minus 1 in watch\r
+        -1\r
+\r
+        '''\r
+        if not args:\r
+            raise TypeError("descriptor 'subtract' of 'Counter' object "\r
+                            "needs an argument")\r
+        self = args[0]\r
+        args = args[1:]\r
+        if len(args) > 1:\r
+            raise TypeError('expected at most 1 arguments, got %d' % len(args))\r
+        iterable = args[0] if args else None\r
+        if iterable is not None:\r
+            self_get = self.get\r
+            if isinstance(iterable, Mapping):\r
+                for elem, count in iterable.items():\r
+                    self[elem] = self_get(elem, 0) - count\r
+            else:\r
+                for elem in iterable:\r
+                    self[elem] = self_get(elem, 0) - 1\r
+        if kwds:\r
+            self.subtract(kwds)\r
+\r
+    def copy(self):\r
+        'Return a shallow copy.'\r
+        return self.__class__(self)\r
+\r
+    def __reduce__(self):\r
+        return self.__class__, (dict(self),)\r
+\r
+    def __delitem__(self, elem):\r
+        'Like dict.__delitem__() but does not raise KeyError for missing values.'\r
+        if elem in self:\r
+            super(Counter, self).__delitem__(elem)\r
+\r
+    def __repr__(self):\r
+        if not self:\r
+            return '%s()' % self.__class__.__name__\r
+        items = ', '.join(map('%r: %r'.__mod__, self.most_common()))\r
+        return '%s({%s})' % (self.__class__.__name__, items)\r
+\r
+    # Multiset-style mathematical operations discussed in:\r
+    #       Knuth TAOCP Volume II section 4.6.3 exercise 19\r
+    #       and at http://en.wikipedia.org/wiki/Multiset\r
+    #\r
+    # Outputs guaranteed to only include positive counts.\r
+    #\r
+    # To strip negative and zero counts, add-in an empty counter:\r
+    #       c += Counter()\r
+\r
+    def __add__(self, other):\r
+        '''Add counts from two counters.\r
+\r
+        >>> Counter('abbb') + Counter('bcc')\r
+        Counter({'b': 4, 'c': 2, 'a': 1})\r
+\r
+        '''\r
+        if not isinstance(other, Counter):\r
+            return NotImplemented\r
+        result = Counter()\r
+        for elem, count in self.items():\r
+            newcount = count + other[elem]\r
+            if newcount > 0:\r
+                result[elem] = newcount\r
+        for elem, count in other.items():\r
+            if elem not in self and count > 0:\r
+                result[elem] = count\r
+        return result\r
+\r
+    def __sub__(self, other):\r
+        ''' Subtract count, but keep only results with positive counts.\r
+\r
+        >>> Counter('abbbc') - Counter('bccd')\r
+        Counter({'b': 2, 'a': 1})\r
+\r
+        '''\r
+        if not isinstance(other, Counter):\r
+            return NotImplemented\r
+        result = Counter()\r
+        for elem, count in self.items():\r
+            newcount = count - other[elem]\r
+            if newcount > 0:\r
+                result[elem] = newcount\r
+        for elem, count in other.items():\r
+            if elem not in self and count < 0:\r
+                result[elem] = 0 - count\r
+        return result\r
+\r
+    def __or__(self, other):\r
+        '''Union is the maximum of value in either of the input counters.\r
+\r
+        >>> Counter('abbb') | Counter('bcc')\r
+        Counter({'b': 3, 'c': 2, 'a': 1})\r
+\r
+        '''\r
+        if not isinstance(other, Counter):\r
+            return NotImplemented\r
+        result = Counter()\r
+        for elem, count in self.items():\r
+            other_count = other[elem]\r
+            newcount = other_count if count < other_count else count\r
+            if newcount > 0:\r
+                result[elem] = newcount\r
+        for elem, count in other.items():\r
+            if elem not in self and count > 0:\r
+                result[elem] = count\r
+        return result\r
+\r
+    def __and__(self, other):\r
+        ''' Intersection is the minimum of corresponding counts.\r
+\r
+        >>> Counter('abbb') & Counter('bcc')\r
+        Counter({'b': 1})\r
+\r
+        '''\r
+        if not isinstance(other, Counter):\r
+            return NotImplemented\r
+        result = Counter()\r
+        for elem, count in self.items():\r
+            other_count = other[elem]\r
+            newcount = count if count < other_count else other_count\r
+            if newcount > 0:\r
+                result[elem] = newcount\r
+        return result\r
+\r
+\r
+if __name__ == '__main__':\r
+    # verify that instances can be pickled\r
+    from cPickle import loads, dumps\r
+    Point = namedtuple('Point', 'x, y', True)\r
+    p = Point(x=10, y=20)\r
+    assert p == loads(dumps(p))\r
+\r
+    # test and demonstrate ability to override methods\r
+    class Point(namedtuple('Point', 'x y')):\r
+        __slots__ = ()\r
+        @property\r
+        def hypot(self):\r
+            return (self.x ** 2 + self.y ** 2) ** 0.5\r
+        def __str__(self):\r
+            return 'Point: x=%6.3f  y=%6.3f  hypot=%6.3f' % (self.x, self.y, self.hypot)\r
+\r
+    for p in Point(3, 4), Point(14, 5/7.):\r
+        print p\r
+\r
+    class Point(namedtuple('Point', 'x y')):\r
+        'Point class with optimized _make() and _replace() without error-checking'\r
+        __slots__ = ()\r
+        _make = classmethod(tuple.__new__)\r
+        def _replace(self, _map=map, **kwds):\r
+            return self._make(_map(kwds.get, ('x', 'y'), self))\r
+\r
+    print Point(11, 22)._replace(x=100)\r
+\r
+    Point3D = namedtuple('Point3D', Point._fields + ('z',))\r
+    print Point3D.__doc__\r
+\r
+    import doctest\r
+    TestResults = namedtuple('TestResults', 'failed attempted')\r
+    print TestResults(*doctest.testmod())\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/compileall.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/compileall.py
new file mode 100644 (file)
index 0000000..839649d
--- /dev/null
@@ -0,0 +1,227 @@
+"""Module/script to byte-compile all .py files to .pyc (or .pyo) files.\r
+\r
+When called as a script with arguments, this compiles the directories\r
+given as arguments recursively; the -l option prevents it from\r
+recursing into directories.\r
+\r
+Without arguments, if compiles all modules on sys.path, without\r
+recursing into subdirectories.  (Even though it should do so for\r
+packages -- for now, you'll have to deal with packages separately.)\r
+\r
+See module py_compile for details of the actual byte-compilation.\r
+"""\r
+import os\r
+import sys\r
+import py_compile\r
+import struct\r
+import imp\r
+\r
+__all__ = ["compile_dir","compile_file","compile_path"]\r
+\r
+def compile_dir(dir, maxlevels=10, ddir=None,\r
+                force=0, rx=None, quiet=0):\r
+    """Byte-compile all modules in the given directory tree.\r
+\r
+    Arguments (only dir is required):\r
+\r
+    dir:       the directory to byte-compile\r
+    maxlevels: maximum recursion level (default 10)\r
+    ddir:      the directory that will be prepended to the path to the\r
+               file as it is compiled into each byte-code file.\r
+    force:     if 1, force compilation, even if timestamps are up-to-date\r
+    quiet:     if 1, be quiet during compilation\r
+    """\r
+    if not quiet:\r
+        print 'Listing', dir, '...'\r
+    try:\r
+        names = os.listdir(dir)\r
+    except os.error:\r
+        print "Can't list", dir\r
+        names = []\r
+    names.sort()\r
+    success = 1\r
+    for name in names:\r
+        fullname = os.path.join(dir, name)\r
+        if ddir is not None:\r
+            dfile = os.path.join(ddir, name)\r
+        else:\r
+            dfile = None\r
+        if not os.path.isdir(fullname):\r
+            if not compile_file(fullname, ddir, force, rx, quiet):\r
+                success = 0\r
+        elif maxlevels > 0 and \\r
+             name != os.curdir and name != os.pardir and \\r
+             os.path.isdir(fullname) and \\r
+             not os.path.islink(fullname):\r
+            if not compile_dir(fullname, maxlevels - 1, dfile, force, rx,\r
+                               quiet):\r
+                success = 0\r
+    return success\r
+\r
+def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0):\r
+    """Byte-compile one file.\r
+\r
+    Arguments (only fullname is required):\r
+\r
+    fullname:  the file to byte-compile\r
+    ddir:      if given, the directory name compiled in to the\r
+               byte-code file.\r
+    force:     if 1, force compilation, even if timestamps are up-to-date\r
+    quiet:     if 1, be quiet during compilation\r
+    """\r
+    success = 1\r
+    name = os.path.basename(fullname)\r
+    if ddir is not None:\r
+        dfile = os.path.join(ddir, name)\r
+    else:\r
+        dfile = None\r
+    if rx is not None:\r
+        mo = rx.search(fullname)\r
+        if mo:\r
+            return success\r
+    if os.path.isfile(fullname):\r
+        head, tail = name[:-3], name[-3:]\r
+        if tail == '.py':\r
+            if not force:\r
+                try:\r
+                    mtime = int(os.stat(fullname).st_mtime)\r
+                    expect = struct.pack('<4sl', imp.get_magic(), mtime)\r
+                    cfile = fullname + (__debug__ and 'c' or 'o')\r
+                    with open(cfile, 'rb') as chandle:\r
+                        actual = chandle.read(8)\r
+                    if expect == actual:\r
+                        return success\r
+                except IOError:\r
+                    pass\r
+            if not quiet:\r
+                print 'Compiling', fullname, '...'\r
+            try:\r
+                ok = py_compile.compile(fullname, None, dfile, True)\r
+            except py_compile.PyCompileError,err:\r
+                if quiet:\r
+                    print 'Compiling', fullname, '...'\r
+                print err.msg\r
+                success = 0\r
+            except IOError, e:\r
+                print "Sorry", e\r
+                success = 0\r
+            else:\r
+                if ok == 0:\r
+                    success = 0\r
+    return success\r
+\r
+def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0):\r
+    """Byte-compile all module on sys.path.\r
+\r
+    Arguments (all optional):\r
+\r
+    skip_curdir: if true, skip current directory (default true)\r
+    maxlevels:   max recursion level (default 0)\r
+    force: as for compile_dir() (default 0)\r
+    quiet: as for compile_dir() (default 0)\r
+    """\r
+    success = 1\r
+    for dir in sys.path:\r
+        if (not dir or dir == os.curdir) and skip_curdir:\r
+            print 'Skipping current directory'\r
+        else:\r
+            success = success and compile_dir(dir, maxlevels, None,\r
+                                              force, quiet=quiet)\r
+    return success\r
+\r
+def expand_args(args, flist):\r
+    """read names in flist and append to args"""\r
+    expanded = args[:]\r
+    if flist:\r
+        try:\r
+            if flist == '-':\r
+                fd = sys.stdin\r
+            else:\r
+                fd = open(flist)\r
+            while 1:\r
+                line = fd.readline()\r
+                if not line:\r
+                    break\r
+                expanded.append(line[:-1])\r
+        except IOError:\r
+            print "Error reading file list %s" % flist\r
+            raise\r
+    return expanded\r
+\r
+def main():\r
+    """Script main program."""\r
+    import getopt\r
+    try:\r
+        opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:i:')\r
+    except getopt.error, msg:\r
+        print msg\r
+        print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \\r
+              "[-x regexp] [-i list] [directory|file ...]"\r
+        print\r
+        print "arguments: zero or more file and directory names to compile; " \\r
+              "if no arguments given, "\r
+        print "           defaults to the equivalent of -l sys.path"\r
+        print\r
+        print "options:"\r
+        print "-l: don't recurse into subdirectories"\r
+        print "-f: force rebuild even if timestamps are up-to-date"\r
+        print "-q: output only error messages"\r
+        print "-d destdir: directory to prepend to file paths for use in " \\r
+              "compile-time tracebacks and in"\r
+        print "            runtime tracebacks in cases where the source " \\r
+              "file is unavailable"\r
+        print "-x regexp: skip files matching the regular expression regexp; " \\r
+              "the regexp is searched for"\r
+        print "           in the full path of each file considered for " \\r
+              "compilation"\r
+        print "-i file: add all the files and directories listed in file to " \\r
+              "the list considered for"\r
+        print '         compilation; if "-", names are read from stdin'\r
+\r
+        sys.exit(2)\r
+    maxlevels = 10\r
+    ddir = None\r
+    force = 0\r
+    quiet = 0\r
+    rx = None\r
+    flist = None\r
+    for o, a in opts:\r
+        if o == '-l': maxlevels = 0\r
+        if o == '-d': ddir = a\r
+        if o == '-f': force = 1\r
+        if o == '-q': quiet = 1\r
+        if o == '-x':\r
+            import re\r
+            rx = re.compile(a)\r
+        if o == '-i': flist = a\r
+    if ddir:\r
+        if len(args) != 1 and not os.path.isdir(args[0]):\r
+            print "-d destdir require exactly one directory argument"\r
+            sys.exit(2)\r
+    success = 1\r
+    try:\r
+        if args or flist:\r
+            try:\r
+                if flist:\r
+                    args = expand_args(args, flist)\r
+            except IOError:\r
+                success = 0\r
+            if success:\r
+                for arg in args:\r
+                    if os.path.isdir(arg):\r
+                        if not compile_dir(arg, maxlevels, ddir,\r
+                                           force, rx, quiet):\r
+                            success = 0\r
+                    else:\r
+                        if not compile_file(arg, ddir, force, rx, quiet):\r
+                            success = 0\r
+        else:\r
+            success = compile_path()\r
+    except KeyboardInterrupt:\r
+        print "\n[interrupted]"\r
+        success = 0\r
+    return success\r
+\r
+if __name__ == '__main__':\r
+    exit_status = int(not main())\r
+    sys.exit(exit_status)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/copy.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/copy.py
new file mode 100644 (file)
index 0000000..c9792f7
--- /dev/null
@@ -0,0 +1,433 @@
+"""Generic (shallow and deep) copying operations.\r
+\r
+Interface summary:\r
+\r
+        import copy\r
+\r
+        x = copy.copy(y)        # make a shallow copy of y\r
+        x = copy.deepcopy(y)    # make a deep copy of y\r
+\r
+For module specific errors, copy.Error is raised.\r
+\r
+The difference between shallow and deep copying is only relevant for\r
+compound objects (objects that contain other objects, like lists or\r
+class instances).\r
+\r
+- A shallow copy constructs a new compound object and then (to the\r
+  extent possible) inserts *the same objects* into it that the\r
+  original contains.\r
+\r
+- A deep copy constructs a new compound object and then, recursively,\r
+  inserts *copies* into it of the objects found in the original.\r
+\r
+Two problems often exist with deep copy operations that don't exist\r
+with shallow copy operations:\r
+\r
+ a) recursive objects (compound objects that, directly or indirectly,\r
+    contain a reference to themselves) may cause a recursive loop\r
+\r
+ b) because deep copy copies *everything* it may copy too much, e.g.\r
+    administrative data structures that should be shared even between\r
+    copies\r
+\r
+Python's deep copy operation avoids these problems by:\r
+\r
+ a) keeping a table of objects already copied during the current\r
+    copying pass\r
+\r
+ b) letting user-defined classes override the copying operation or the\r
+    set of components copied\r
+\r
+This version does not copy types like module, class, function, method,\r
+nor stack trace, stack frame, nor file, socket, window, nor array, nor\r
+any similar types.\r
+\r
+Classes can use the same interfaces to control copying that they use\r
+to control pickling: they can define methods called __getinitargs__(),\r
+__getstate__() and __setstate__().  See the documentation for module\r
+"pickle" for information on these methods.\r
+"""\r
+\r
+import types\r
+import weakref\r
+from copy_reg import dispatch_table\r
+\r
+class Error(Exception):\r
+    pass\r
+error = Error   # backward compatibility\r
+\r
+try:\r
+    from org.python.core import PyStringMap\r
+except ImportError:\r
+    PyStringMap = None\r
+\r
+__all__ = ["Error", "copy", "deepcopy"]\r
+\r
+def copy(x):\r
+    """Shallow copy operation on arbitrary Python objects.\r
+\r
+    See the module's __doc__ string for more info.\r
+    """\r
+\r
+    cls = type(x)\r
+\r
+    copier = _copy_dispatch.get(cls)\r
+    if copier:\r
+        return copier(x)\r
+\r
+    copier = getattr(cls, "__copy__", None)\r
+    if copier:\r
+        return copier(x)\r
+\r
+    reductor = dispatch_table.get(cls)\r
+    if reductor:\r
+        rv = reductor(x)\r
+    else:\r
+        reductor = getattr(x, "__reduce_ex__", None)\r
+        if reductor:\r
+            rv = reductor(2)\r
+        else:\r
+            reductor = getattr(x, "__reduce__", None)\r
+            if reductor:\r
+                rv = reductor()\r
+            else:\r
+                raise Error("un(shallow)copyable object of type %s" % cls)\r
+\r
+    return _reconstruct(x, rv, 0)\r
+\r
+\r
+_copy_dispatch = d = {}\r
+\r
+def _copy_immutable(x):\r
+    return x\r
+for t in (type(None), int, long, float, bool, str, tuple,\r
+          frozenset, type, xrange, types.ClassType,\r
+          types.BuiltinFunctionType, type(Ellipsis),\r
+          types.FunctionType, weakref.ref):\r
+    d[t] = _copy_immutable\r
+for name in ("ComplexType", "UnicodeType", "CodeType"):\r
+    t = getattr(types, name, None)\r
+    if t is not None:\r
+        d[t] = _copy_immutable\r
+\r
+def _copy_with_constructor(x):\r
+    return type(x)(x)\r
+for t in (list, dict, set):\r
+    d[t] = _copy_with_constructor\r
+\r
+def _copy_with_copy_method(x):\r
+    return x.copy()\r
+if PyStringMap is not None:\r
+    d[PyStringMap] = _copy_with_copy_method\r
+\r
+def _copy_inst(x):\r
+    if hasattr(x, '__copy__'):\r
+        return x.__copy__()\r
+    if hasattr(x, '__getinitargs__'):\r
+        args = x.__getinitargs__()\r
+        y = x.__class__(*args)\r
+    else:\r
+        y = _EmptyClass()\r
+        y.__class__ = x.__class__\r
+    if hasattr(x, '__getstate__'):\r
+        state = x.__getstate__()\r
+    else:\r
+        state = x.__dict__\r
+    if hasattr(y, '__setstate__'):\r
+        y.__setstate__(state)\r
+    else:\r
+        y.__dict__.update(state)\r
+    return y\r
+d[types.InstanceType] = _copy_inst\r
+\r
+del d\r
+\r
+def deepcopy(x, memo=None, _nil=[]):\r
+    """Deep copy operation on arbitrary Python objects.\r
+\r
+    See the module's __doc__ string for more info.\r
+    """\r
+\r
+    if memo is None:\r
+        memo = {}\r
+\r
+    d = id(x)\r
+    y = memo.get(d, _nil)\r
+    if y is not _nil:\r
+        return y\r
+\r
+    cls = type(x)\r
+\r
+    copier = _deepcopy_dispatch.get(cls)\r
+    if copier:\r
+        y = copier(x, memo)\r
+    else:\r
+        try:\r
+            issc = issubclass(cls, type)\r
+        except TypeError: # cls is not a class (old Boost; see SF #502085)\r
+            issc = 0\r
+        if issc:\r
+            y = _deepcopy_atomic(x, memo)\r
+        else:\r
+            copier = getattr(x, "__deepcopy__", None)\r
+            if copier:\r
+                y = copier(memo)\r
+            else:\r
+                reductor = dispatch_table.get(cls)\r
+                if reductor:\r
+                    rv = reductor(x)\r
+                else:\r
+                    reductor = getattr(x, "__reduce_ex__", None)\r
+                    if reductor:\r
+                        rv = reductor(2)\r
+                    else:\r
+                        reductor = getattr(x, "__reduce__", None)\r
+                        if reductor:\r
+                            rv = reductor()\r
+                        else:\r
+                            raise Error(\r
+                                "un(deep)copyable object of type %s" % cls)\r
+                y = _reconstruct(x, rv, 1, memo)\r
+\r
+    memo[d] = y\r
+    _keep_alive(x, memo) # Make sure x lives at least as long as d\r
+    return y\r
+\r
+_deepcopy_dispatch = d = {}\r
+\r
+def _deepcopy_atomic(x, memo):\r
+    return x\r
+d[type(None)] = _deepcopy_atomic\r
+d[type(Ellipsis)] = _deepcopy_atomic\r
+d[int] = _deepcopy_atomic\r
+d[long] = _deepcopy_atomic\r
+d[float] = _deepcopy_atomic\r
+d[bool] = _deepcopy_atomic\r
+try:\r
+    d[complex] = _deepcopy_atomic\r
+except NameError:\r
+    pass\r
+d[str] = _deepcopy_atomic\r
+try:\r
+    d[unicode] = _deepcopy_atomic\r
+except NameError:\r
+    pass\r
+try:\r
+    d[types.CodeType] = _deepcopy_atomic\r
+except AttributeError:\r
+    pass\r
+d[type] = _deepcopy_atomic\r
+d[xrange] = _deepcopy_atomic\r
+d[types.ClassType] = _deepcopy_atomic\r
+d[types.BuiltinFunctionType] = _deepcopy_atomic\r
+d[types.FunctionType] = _deepcopy_atomic\r
+d[weakref.ref] = _deepcopy_atomic\r
+\r
+def _deepcopy_list(x, memo):\r
+    y = []\r
+    memo[id(x)] = y\r
+    for a in x:\r
+        y.append(deepcopy(a, memo))\r
+    return y\r
+d[list] = _deepcopy_list\r
+\r
+def _deepcopy_tuple(x, memo):\r
+    y = []\r
+    for a in x:\r
+        y.append(deepcopy(a, memo))\r
+    d = id(x)\r
+    try:\r
+        return memo[d]\r
+    except KeyError:\r
+        pass\r
+    for i in range(len(x)):\r
+        if x[i] is not y[i]:\r
+            y = tuple(y)\r
+            break\r
+    else:\r
+        y = x\r
+    memo[d] = y\r
+    return y\r
+d[tuple] = _deepcopy_tuple\r
+\r
+def _deepcopy_dict(x, memo):\r
+    y = {}\r
+    memo[id(x)] = y\r
+    for key, value in x.iteritems():\r
+        y[deepcopy(key, memo)] = deepcopy(value, memo)\r
+    return y\r
+d[dict] = _deepcopy_dict\r
+if PyStringMap is not None:\r
+    d[PyStringMap] = _deepcopy_dict\r
+\r
+def _deepcopy_method(x, memo): # Copy instance methods\r
+    return type(x)(x.im_func, deepcopy(x.im_self, memo), x.im_class)\r
+_deepcopy_dispatch[types.MethodType] = _deepcopy_method\r
+\r
+def _keep_alive(x, memo):\r
+    """Keeps a reference to the object x in the memo.\r
+\r
+    Because we remember objects by their id, we have\r
+    to assure that possibly temporary objects are kept\r
+    alive by referencing them.\r
+    We store a reference at the id of the memo, which should\r
+    normally not be used unless someone tries to deepcopy\r
+    the memo itself...\r
+    """\r
+    try:\r
+        memo[id(memo)].append(x)\r
+    except KeyError:\r
+        # aha, this is the first one :-)\r
+        memo[id(memo)]=[x]\r
+\r
+def _deepcopy_inst(x, memo):\r
+    if hasattr(x, '__deepcopy__'):\r
+        return x.__deepcopy__(memo)\r
+    if hasattr(x, '__getinitargs__'):\r
+        args = x.__getinitargs__()\r
+        args = deepcopy(args, memo)\r
+        y = x.__class__(*args)\r
+    else:\r
+        y = _EmptyClass()\r
+        y.__class__ = x.__class__\r
+    memo[id(x)] = y\r
+    if hasattr(x, '__getstate__'):\r
+        state = x.__getstate__()\r
+    else:\r
+        state = x.__dict__\r
+    state = deepcopy(state, memo)\r
+    if hasattr(y, '__setstate__'):\r
+        y.__setstate__(state)\r
+    else:\r
+        y.__dict__.update(state)\r
+    return y\r
+d[types.InstanceType] = _deepcopy_inst\r
+\r
+def _reconstruct(x, info, deep, memo=None):\r
+    if isinstance(info, str):\r
+        return x\r
+    assert isinstance(info, tuple)\r
+    if memo is None:\r
+        memo = {}\r
+    n = len(info)\r
+    assert n in (2, 3, 4, 5)\r
+    callable, args = info[:2]\r
+    if n > 2:\r
+        state = info[2]\r
+    else:\r
+        state = {}\r
+    if n > 3:\r
+        listiter = info[3]\r
+    else:\r
+        listiter = None\r
+    if n > 4:\r
+        dictiter = info[4]\r
+    else:\r
+        dictiter = None\r
+    if deep:\r
+        args = deepcopy(args, memo)\r
+    y = callable(*args)\r
+    memo[id(x)] = y\r
+\r
+    if state:\r
+        if deep:\r
+            state = deepcopy(state, memo)\r
+        if hasattr(y, '__setstate__'):\r
+            y.__setstate__(state)\r
+        else:\r
+            if isinstance(state, tuple) and len(state) == 2:\r
+                state, slotstate = state\r
+            else:\r
+                slotstate = None\r
+            if state is not None:\r
+                y.__dict__.update(state)\r
+            if slotstate is not None:\r
+                for key, value in slotstate.iteritems():\r
+                    setattr(y, key, value)\r
+\r
+    if listiter is not None:\r
+        for item in listiter:\r
+            if deep:\r
+                item = deepcopy(item, memo)\r
+            y.append(item)\r
+    if dictiter is not None:\r
+        for key, value in dictiter:\r
+            if deep:\r
+                key = deepcopy(key, memo)\r
+                value = deepcopy(value, memo)\r
+            y[key] = value\r
+    return y\r
+\r
+del d\r
+\r
+del types\r
+\r
+# Helper for instance creation without calling __init__\r
+class _EmptyClass:\r
+    pass\r
+\r
+def _test():\r
+    l = [None, 1, 2L, 3.14, 'xyzzy', (1, 2L), [3.14, 'abc'],\r
+         {'abc': 'ABC'}, (), [], {}]\r
+    l1 = copy(l)\r
+    print l1==l\r
+    l1 = map(copy, l)\r
+    print l1==l\r
+    l1 = deepcopy(l)\r
+    print l1==l\r
+    class C:\r
+        def __init__(self, arg=None):\r
+            self.a = 1\r
+            self.arg = arg\r
+            if __name__ == '__main__':\r
+                import sys\r
+                file = sys.argv[0]\r
+            else:\r
+                file = __file__\r
+            self.fp = open(file)\r
+            self.fp.close()\r
+        def __getstate__(self):\r
+            return {'a': self.a, 'arg': self.arg}\r
+        def __setstate__(self, state):\r
+            for key, value in state.iteritems():\r
+                setattr(self, key, value)\r
+        def __deepcopy__(self, memo=None):\r
+            new = self.__class__(deepcopy(self.arg, memo))\r
+            new.a = self.a\r
+            return new\r
+    c = C('argument sketch')\r
+    l.append(c)\r
+    l2 = copy(l)\r
+    print l == l2\r
+    print l\r
+    print l2\r
+    l2 = deepcopy(l)\r
+    print l == l2\r
+    print l\r
+    print l2\r
+    l.append({l[1]: l, 'xyz': l[2]})\r
+    l3 = copy(l)\r
+    import repr\r
+    print map(repr.repr, l)\r
+    print map(repr.repr, l1)\r
+    print map(repr.repr, l2)\r
+    print map(repr.repr, l3)\r
+    l3 = deepcopy(l)\r
+    import repr\r
+    print map(repr.repr, l)\r
+    print map(repr.repr, l1)\r
+    print map(repr.repr, l2)\r
+    print map(repr.repr, l3)\r
+    class odict(dict):\r
+        def __init__(self, d = {}):\r
+            self.a = 99\r
+            dict.__init__(self, d)\r
+        def __setitem__(self, k, i):\r
+            dict.__setitem__(self, k, i)\r
+            self.a\r
+    o = odict({"A" : "B"})\r
+    x = deepcopy(o)\r
+    print(o, x)\r
+\r
+if __name__ == '__main__':\r
+    _test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/copy_reg.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/copy_reg.py
new file mode 100644 (file)
index 0000000..72db74d
--- /dev/null
@@ -0,0 +1,201 @@
+"""Helper to provide extensibility for pickle/cPickle.\r
+\r
+This is only useful to add pickle support for extension types defined in\r
+C, not for instances of user-defined classes.\r
+"""\r
+\r
+from types import ClassType as _ClassType\r
+\r
+__all__ = ["pickle", "constructor",\r
+           "add_extension", "remove_extension", "clear_extension_cache"]\r
+\r
+dispatch_table = {}\r
+\r
+def pickle(ob_type, pickle_function, constructor_ob=None):\r
+    if type(ob_type) is _ClassType:\r
+        raise TypeError("copy_reg is not intended for use with classes")\r
+\r
+    if not hasattr(pickle_function, '__call__'):\r
+        raise TypeError("reduction functions must be callable")\r
+    dispatch_table[ob_type] = pickle_function\r
+\r
+    # The constructor_ob function is a vestige of safe for unpickling.\r
+    # There is no reason for the caller to pass it anymore.\r
+    if constructor_ob is not None:\r
+        constructor(constructor_ob)\r
+\r
+def constructor(object):\r
+    if not hasattr(object, '__call__'):\r
+        raise TypeError("constructors must be callable")\r
+\r
+# Example: provide pickling support for complex numbers.\r
+\r
+try:\r
+    complex\r
+except NameError:\r
+    pass\r
+else:\r
+\r
+    def pickle_complex(c):\r
+        return complex, (c.real, c.imag)\r
+\r
+    pickle(complex, pickle_complex, complex)\r
+\r
+# Support for pickling new-style objects\r
+\r
+def _reconstructor(cls, base, state):\r
+    if base is object:\r
+        obj = object.__new__(cls)\r
+    else:\r
+        obj = base.__new__(cls, state)\r
+        if base.__init__ != object.__init__:\r
+            base.__init__(obj, state)\r
+    return obj\r
+\r
+_HEAPTYPE = 1<<9\r
+\r
+# Python code for object.__reduce_ex__ for protocols 0 and 1\r
+\r
+def _reduce_ex(self, proto):\r
+    assert proto < 2\r
+    for base in self.__class__.__mro__:\r
+        if hasattr(base, '__flags__') and not base.__flags__ & _HEAPTYPE:\r
+            break\r
+    else:\r
+        base = object # not really reachable\r
+    if base is object:\r
+        state = None\r
+    else:\r
+        if base is self.__class__:\r
+            raise TypeError, "can't pickle %s objects" % base.__name__\r
+        state = base(self)\r
+    args = (self.__class__, base, state)\r
+    try:\r
+        getstate = self.__getstate__\r
+    except AttributeError:\r
+        if getattr(self, "__slots__", None):\r
+            raise TypeError("a class that defines __slots__ without "\r
+                            "defining __getstate__ cannot be pickled")\r
+        try:\r
+            dict = self.__dict__\r
+        except AttributeError:\r
+            dict = None\r
+    else:\r
+        dict = getstate()\r
+    if dict:\r
+        return _reconstructor, args, dict\r
+    else:\r
+        return _reconstructor, args\r
+\r
+# Helper for __reduce_ex__ protocol 2\r
+\r
+def __newobj__(cls, *args):\r
+    return cls.__new__(cls, *args)\r
+\r
+def _slotnames(cls):\r
+    """Return a list of slot names for a given class.\r
+\r
+    This needs to find slots defined by the class and its bases, so we\r
+    can't simply return the __slots__ attribute.  We must walk down\r
+    the Method Resolution Order and concatenate the __slots__ of each\r
+    class found there.  (This assumes classes don't modify their\r
+    __slots__ attribute to misrepresent their slots after the class is\r
+    defined.)\r
+    """\r
+\r
+    # Get the value from a cache in the class if possible\r
+    names = cls.__dict__.get("__slotnames__")\r
+    if names is not None:\r
+        return names\r
+\r
+    # Not cached -- calculate the value\r
+    names = []\r
+    if not hasattr(cls, "__slots__"):\r
+        # This class has no slots\r
+        pass\r
+    else:\r
+        # Slots found -- gather slot names from all base classes\r
+        for c in cls.__mro__:\r
+            if "__slots__" in c.__dict__:\r
+                slots = c.__dict__['__slots__']\r
+                # if class has a single slot, it can be given as a string\r
+                if isinstance(slots, basestring):\r
+                    slots = (slots,)\r
+                for name in slots:\r
+                    # special descriptors\r
+                    if name in ("__dict__", "__weakref__"):\r
+                        continue\r
+                    # mangled names\r
+                    elif name.startswith('__') and not name.endswith('__'):\r
+                        names.append('_%s%s' % (c.__name__, name))\r
+                    else:\r
+                        names.append(name)\r
+\r
+    # Cache the outcome in the class if at all possible\r
+    try:\r
+        cls.__slotnames__ = names\r
+    except:\r
+        pass # But don't die if we can't\r
+\r
+    return names\r
+\r
+# A registry of extension codes.  This is an ad-hoc compression\r
+# mechanism.  Whenever a global reference to <module>, <name> is about\r
+# to be pickled, the (<module>, <name>) tuple is looked up here to see\r
+# if it is a registered extension code for it.  Extension codes are\r
+# universal, so that the meaning of a pickle does not depend on\r
+# context.  (There are also some codes reserved for local use that\r
+# don't have this restriction.)  Codes are positive ints; 0 is\r
+# reserved.\r
+\r
+_extension_registry = {}                # key -> code\r
+_inverted_registry = {}                 # code -> key\r
+_extension_cache = {}                   # code -> object\r
+# Don't ever rebind those names:  cPickle grabs a reference to them when\r
+# it's initialized, and won't see a rebinding.\r
+\r
+def add_extension(module, name, code):\r
+    """Register an extension code."""\r
+    code = int(code)\r
+    if not 1 <= code <= 0x7fffffff:\r
+        raise ValueError, "code out of range"\r
+    key = (module, name)\r
+    if (_extension_registry.get(key) == code and\r
+        _inverted_registry.get(code) == key):\r
+        return # Redundant registrations are benign\r
+    if key in _extension_registry:\r
+        raise ValueError("key %s is already registered with code %s" %\r
+                         (key, _extension_registry[key]))\r
+    if code in _inverted_registry:\r
+        raise ValueError("code %s is already in use for key %s" %\r
+                         (code, _inverted_registry[code]))\r
+    _extension_registry[key] = code\r
+    _inverted_registry[code] = key\r
+\r
+def remove_extension(module, name, code):\r
+    """Unregister an extension code.  For testing only."""\r
+    key = (module, name)\r
+    if (_extension_registry.get(key) != code or\r
+        _inverted_registry.get(code) != key):\r
+        raise ValueError("key %s is not registered with code %s" %\r
+                         (key, code))\r
+    del _extension_registry[key]\r
+    del _inverted_registry[code]\r
+    if code in _extension_cache:\r
+        del _extension_cache[code]\r
+\r
+def clear_extension_cache():\r
+    _extension_cache.clear()\r
+\r
+# Standard extension code assignments\r
+\r
+# Reserved ranges\r
+\r
+# First  Last Count  Purpose\r
+#     1   127   127  Reserved for Python standard library\r
+#   128   191    64  Reserved for Zope\r
+#   192   239    48  Reserved for 3rd parties\r
+#   240   255    16  Reserved for private use (will never be assigned)\r
+#   256   Inf   Inf  Reserved for future assignment\r
+\r
+# Extension codes are assigned by the Python Software Foundation.\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/csv.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/csv.py
new file mode 100644 (file)
index 0000000..081df79
--- /dev/null
@@ -0,0 +1,456 @@
+\r
+"""\r
+csv.py - read/write/investigate CSV files\r
+"""\r
+\r
+import re\r
+from functools import reduce\r
+from _csv import Error, __version__, writer, reader, register_dialect, \\r
+                 unregister_dialect, get_dialect, list_dialects, \\r
+                 field_size_limit, \\r
+                 QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE, \\r
+                 __doc__\r
+from _csv import Dialect as _Dialect\r
+\r
+try:\r
+    from cStringIO import StringIO\r
+except ImportError:\r
+    from StringIO import StringIO\r
+\r
+__all__ = [ "QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE",\r
+            "Error", "Dialect", "__doc__", "excel", "excel_tab",\r
+            "field_size_limit", "reader", "writer",\r
+            "register_dialect", "get_dialect", "list_dialects", "Sniffer",\r
+            "unregister_dialect", "__version__", "DictReader", "DictWriter" ]\r
+\r
+class Dialect:\r
+    """Describe an Excel dialect.\r
+\r
+    This must be subclassed (see csv.excel).  Valid attributes are:\r
+    delimiter, quotechar, escapechar, doublequote, skipinitialspace,\r
+    lineterminator, quoting.\r
+\r
+    """\r
+    _name = ""\r
+    _valid = False\r
+    # placeholders\r
+    delimiter = None\r
+    quotechar = None\r
+    escapechar = None\r
+    doublequote = None\r
+    skipinitialspace = None\r
+    lineterminator = None\r
+    quoting = None\r
+\r
+    def __init__(self):\r
+        if self.__class__ != Dialect:\r
+            self._valid = True\r
+        self._validate()\r
+\r
+    def _validate(self):\r
+        try:\r
+            _Dialect(self)\r
+        except TypeError, e:\r
+            # We do this for compatibility with py2.3\r
+            raise Error(str(e))\r
+\r
+class excel(Dialect):\r
+    """Describe the usual properties of Excel-generated CSV files."""\r
+    delimiter = ','\r
+    quotechar = '"'\r
+    doublequote = True\r
+    skipinitialspace = False\r
+    lineterminator = '\r\n'\r
+    quoting = QUOTE_MINIMAL\r
+register_dialect("excel", excel)\r
+\r
+class excel_tab(excel):\r
+    """Describe the usual properties of Excel-generated TAB-delimited files."""\r
+    delimiter = '\t'\r
+register_dialect("excel-tab", excel_tab)\r
+\r
+\r
+class DictReader:\r
+    def __init__(self, f, fieldnames=None, restkey=None, restval=None,\r
+                 dialect="excel", *args, **kwds):\r
+        self._fieldnames = fieldnames   # list of keys for the dict\r
+        self.restkey = restkey          # key to catch long rows\r
+        self.restval = restval          # default value for short rows\r
+        self.reader = reader(f, dialect, *args, **kwds)\r
+        self.dialect = dialect\r
+        self.line_num = 0\r
+\r
+    def __iter__(self):\r
+        return self\r
+\r
+    @property\r
+    def fieldnames(self):\r
+        if self._fieldnames is None:\r
+            try:\r
+                self._fieldnames = self.reader.next()\r
+            except StopIteration:\r
+                pass\r
+        self.line_num = self.reader.line_num\r
+        return self._fieldnames\r
+\r
+    # Issue 20004: Because DictReader is a classic class, this setter is\r
+    # ignored.  At this point in 2.7's lifecycle, it is too late to change the\r
+    # base class for fear of breaking working code.  If you want to change\r
+    # fieldnames without overwriting the getter, set _fieldnames directly.\r
+    @fieldnames.setter\r
+    def fieldnames(self, value):\r
+        self._fieldnames = value\r
+\r
+    def next(self):\r
+        if self.line_num == 0:\r
+            # Used only for its side effect.\r
+            self.fieldnames\r
+        row = self.reader.next()\r
+        self.line_num = self.reader.line_num\r
+\r
+        # unlike the basic reader, we prefer not to return blanks,\r
+        # because we will typically wind up with a dict full of None\r
+        # values\r
+        while row == []:\r
+            row = self.reader.next()\r
+        d = dict(zip(self.fieldnames, row))\r
+        lf = len(self.fieldnames)\r
+        lr = len(row)\r
+        if lf < lr:\r
+            d[self.restkey] = row[lf:]\r
+        elif lf > lr:\r
+            for key in self.fieldnames[lr:]:\r
+                d[key] = self.restval\r
+        return d\r
+\r
+\r
+class DictWriter:\r
+    def __init__(self, f, fieldnames, restval="", extrasaction="raise",\r
+                 dialect="excel", *args, **kwds):\r
+        self.fieldnames = fieldnames    # list of keys for the dict\r
+        self.restval = restval          # for writing short dicts\r
+        if extrasaction.lower() not in ("raise", "ignore"):\r
+            raise ValueError, \\r
+                  ("extrasaction (%s) must be 'raise' or 'ignore'" %\r
+                   extrasaction)\r
+        self.extrasaction = extrasaction\r
+        self.writer = writer(f, dialect, *args, **kwds)\r
+\r
+    def writeheader(self):\r
+        header = dict(zip(self.fieldnames, self.fieldnames))\r
+        self.writerow(header)\r
+\r
+    def _dict_to_list(self, rowdict):\r
+        if self.extrasaction == "raise":\r
+            wrong_fields = [k for k in rowdict if k not in self.fieldnames]\r
+            if wrong_fields:\r
+                raise ValueError("dict contains fields not in fieldnames: "\r
+                                 + ", ".join([repr(x) for x in wrong_fields]))\r
+        return [rowdict.get(key, self.restval) for key in self.fieldnames]\r
+\r
+    def writerow(self, rowdict):\r
+        return self.writer.writerow(self._dict_to_list(rowdict))\r
+\r
+    def writerows(self, rowdicts):\r
+        rows = []\r
+        for rowdict in rowdicts:\r
+            rows.append(self._dict_to_list(rowdict))\r
+        return self.writer.writerows(rows)\r
+\r
+# Guard Sniffer's type checking against builds that exclude complex()\r
+try:\r
+    complex\r
+except NameError:\r
+    complex = float\r
+\r
+class Sniffer:\r
+    '''\r
+    "Sniffs" the format of a CSV file (i.e. delimiter, quotechar)\r
+    Returns a Dialect object.\r
+    '''\r
+    def __init__(self):\r
+        # in case there is more than one possible delimiter\r
+        self.preferred = [',', '\t', ';', ' ', ':']\r
+\r
+\r
+    def sniff(self, sample, delimiters=None):\r
+        """\r
+        Returns a dialect (or None) corresponding to the sample\r
+        """\r
+\r
+        quotechar, doublequote, delimiter, skipinitialspace = \\r
+                   self._guess_quote_and_delimiter(sample, delimiters)\r
+        if not delimiter:\r
+            delimiter, skipinitialspace = self._guess_delimiter(sample,\r
+                                                                delimiters)\r
+\r
+        if not delimiter:\r
+            raise Error, "Could not determine delimiter"\r
+\r
+        class dialect(Dialect):\r
+            _name = "sniffed"\r
+            lineterminator = '\r\n'\r
+            quoting = QUOTE_MINIMAL\r
+            # escapechar = ''\r
+\r
+        dialect.doublequote = doublequote\r
+        dialect.delimiter = delimiter\r
+        # _csv.reader won't accept a quotechar of ''\r
+        dialect.quotechar = quotechar or '"'\r
+        dialect.skipinitialspace = skipinitialspace\r
+\r
+        return dialect\r
+\r
+\r
+    def _guess_quote_and_delimiter(self, data, delimiters):\r
+        """\r
+        Looks for text enclosed between two identical quotes\r
+        (the probable quotechar) which are preceded and followed\r
+        by the same character (the probable delimiter).\r
+        For example:\r
+                         ,'some text',\r
+        The quote with the most wins, same with the delimiter.\r
+        If there is no quotechar the delimiter can't be determined\r
+        this way.\r
+        """\r
+\r
+        matches = []\r
+        for restr in ('(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)', # ,".*?",\r
+                      '(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)',   #  ".*?",\r
+                      '(?P<delim>>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)',  # ,".*?"\r
+                      '(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)'):                            #  ".*?" (no delim, no space)\r
+            regexp = re.compile(restr, re.DOTALL | re.MULTILINE)\r
+            matches = regexp.findall(data)\r
+            if matches:\r
+                break\r
+\r
+        if not matches:\r
+            # (quotechar, doublequote, delimiter, skipinitialspace)\r
+            return ('', False, None, 0)\r
+        quotes = {}\r
+        delims = {}\r
+        spaces = 0\r
+        for m in matches:\r
+            n = regexp.groupindex['quote'] - 1\r
+            key = m[n]\r
+            if key:\r
+                quotes[key] = quotes.get(key, 0) + 1\r
+            try:\r
+                n = regexp.groupindex['delim'] - 1\r
+                key = m[n]\r
+            except KeyError:\r
+                continue\r
+            if key and (delimiters is None or key in delimiters):\r
+                delims[key] = delims.get(key, 0) + 1\r
+            try:\r
+                n = regexp.groupindex['space'] - 1\r
+            except KeyError:\r
+                continue\r
+            if m[n]:\r
+                spaces += 1\r
+\r
+        quotechar = reduce(lambda a, b, quotes = quotes:\r
+                           (quotes[a] > quotes[b]) and a or b, quotes.keys())\r
+\r
+        if delims:\r
+            delim = reduce(lambda a, b, delims = delims:\r
+                           (delims[a] > delims[b]) and a or b, delims.keys())\r
+            skipinitialspace = delims[delim] == spaces\r
+            if delim == '\n': # most likely a file with a single column\r
+                delim = ''\r
+        else:\r
+            # there is *no* delimiter, it's a single column of quoted data\r
+            delim = ''\r
+            skipinitialspace = 0\r
+\r
+        # if we see an extra quote between delimiters, we've got a\r
+        # double quoted format\r
+        dq_regexp = re.compile(\r
+                               r"((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$)" % \\r
+                               {'delim':re.escape(delim), 'quote':quotechar}, re.MULTILINE)\r
+\r
+\r
+\r
+        if dq_regexp.search(data):\r
+            doublequote = True\r
+        else:\r
+            doublequote = False\r
+\r
+        return (quotechar, doublequote, delim, skipinitialspace)\r
+\r
+\r
+    def _guess_delimiter(self, data, delimiters):\r
+        """\r
+        The delimiter /should/ occur the same number of times on\r
+        each row. However, due to malformed data, it may not. We don't want\r
+        an all or nothing approach, so we allow for small variations in this\r
+        number.\r
+          1) build a table of the frequency of each character on every line.\r
+          2) build a table of frequencies of this frequency (meta-frequency?),\r
+             e.g.  'x occurred 5 times in 10 rows, 6 times in 1000 rows,\r
+             7 times in 2 rows'\r
+          3) use the mode of the meta-frequency to determine the /expected/\r
+             frequency for that character\r
+          4) find out how often the character actually meets that goal\r
+          5) the character that best meets its goal is the delimiter\r
+        For performance reasons, the data is evaluated in chunks, so it can\r
+        try and evaluate the smallest portion of the data possible, evaluating\r
+        additional chunks as necessary.\r
+        """\r
+\r
+        data = filter(None, data.split('\n'))\r
+\r
+        ascii = [chr(c) for c in range(127)] # 7-bit ASCII\r
+\r
+        # build frequency tables\r
+        chunkLength = min(10, len(data))\r
+        iteration = 0\r
+        charFrequency = {}\r
+        modes = {}\r
+        delims = {}\r
+        start, end = 0, min(chunkLength, len(data))\r
+        while start < len(data):\r
+            iteration += 1\r
+            for line in data[start:end]:\r
+                for char in ascii:\r
+                    metaFrequency = charFrequency.get(char, {})\r
+                    # must count even if frequency is 0\r
+                    freq = line.count(char)\r
+                    # value is the mode\r
+                    metaFrequency[freq] = metaFrequency.get(freq, 0) + 1\r
+                    charFrequency[char] = metaFrequency\r
+\r
+            for char in charFrequency.keys():\r
+                items = charFrequency[char].items()\r
+                if len(items) == 1 and items[0][0] == 0:\r
+                    continue\r
+                # get the mode of the frequencies\r
+                if len(items) > 1:\r
+                    modes[char] = reduce(lambda a, b: a[1] > b[1] and a or b,\r
+                                         items)\r
+                    # adjust the mode - subtract the sum of all\r
+                    # other frequencies\r
+                    items.remove(modes[char])\r
+                    modes[char] = (modes[char][0], modes[char][1]\r
+                                   - reduce(lambda a, b: (0, a[1] + b[1]),\r
+                                            items)[1])\r
+                else:\r
+                    modes[char] = items[0]\r
+\r
+            # build a list of possible delimiters\r
+            modeList = modes.items()\r
+            total = float(chunkLength * iteration)\r
+            # (rows of consistent data) / (number of rows) = 100%\r
+            consistency = 1.0\r
+            # minimum consistency threshold\r
+            threshold = 0.9\r
+            while len(delims) == 0 and consistency >= threshold:\r
+                for k, v in modeList:\r
+                    if v[0] > 0 and v[1] > 0:\r
+                        if ((v[1]/total) >= consistency and\r
+                            (delimiters is None or k in delimiters)):\r
+                            delims[k] = v\r
+                consistency -= 0.01\r
+\r
+            if len(delims) == 1:\r
+                delim = delims.keys()[0]\r
+                skipinitialspace = (data[0].count(delim) ==\r
+                                    data[0].count("%c " % delim))\r
+                return (delim, skipinitialspace)\r
+\r
+            # analyze another chunkLength lines\r
+            start = end\r
+            end += chunkLength\r
+\r
+        if not delims:\r
+            return ('', 0)\r
+\r
+        # if there's more than one, fall back to a 'preferred' list\r
+        if len(delims) > 1:\r
+            for d in self.preferred:\r
+                if d in delims.keys():\r
+                    skipinitialspace = (data[0].count(d) ==\r
+                                        data[0].count("%c " % d))\r
+                    return (d, skipinitialspace)\r
+\r
+        # nothing else indicates a preference, pick the character that\r
+        # dominates(?)\r
+        items = [(v,k) for (k,v) in delims.items()]\r
+        items.sort()\r
+        delim = items[-1][1]\r
+\r
+        skipinitialspace = (data[0].count(delim) ==\r
+                            data[0].count("%c " % delim))\r
+        return (delim, skipinitialspace)\r
+\r
+\r
+    def has_header(self, sample):\r
+        # Creates a dictionary of types of data in each column. If any\r
+        # column is of a single type (say, integers), *except* for the first\r
+        # row, then the first row is presumed to be labels. If the type\r
+        # can't be determined, it is assumed to be a string in which case\r
+        # the length of the string is the determining factor: if all of the\r
+        # rows except for the first are the same length, it's a header.\r
+        # Finally, a 'vote' is taken at the end for each column, adding or\r
+        # subtracting from the likelihood of the first row being a header.\r
+\r
+        rdr = reader(StringIO(sample), self.sniff(sample))\r
+\r
+        header = rdr.next() # assume first row is header\r
+\r
+        columns = len(header)\r
+        columnTypes = {}\r
+        for i in range(columns): columnTypes[i] = None\r
+\r
+        checked = 0\r
+        for row in rdr:\r
+            # arbitrary number of rows to check, to keep it sane\r
+            if checked > 20:\r
+                break\r
+            checked += 1\r
+\r
+            if len(row) != columns:\r
+                continue # skip rows that have irregular number of columns\r
+\r
+            for col in columnTypes.keys():\r
+\r
+                for thisType in [int, long, float, complex]:\r
+                    try:\r
+                        thisType(row[col])\r
+                        break\r
+                    except (ValueError, OverflowError):\r
+                        pass\r
+                else:\r
+                    # fallback to length of string\r
+                    thisType = len(row[col])\r
+\r
+                # treat longs as ints\r
+                if thisType == long:\r
+                    thisType = int\r
+\r
+                if thisType != columnTypes[col]:\r
+                    if columnTypes[col] is None: # add new column type\r
+                        columnTypes[col] = thisType\r
+                    else:\r
+                        # type is inconsistent, remove column from\r
+                        # consideration\r
+                        del columnTypes[col]\r
+\r
+        # finally, compare results against first row and "vote"\r
+        # on whether it's a header\r
+        hasHeader = 0\r
+        for col, colType in columnTypes.items():\r
+            if type(colType) == type(0): # it's a length\r
+                if len(header[col]) != colType:\r
+                    hasHeader += 1\r
+                else:\r
+                    hasHeader -= 1\r
+            else: # attempt typecast\r
+                try:\r
+                    colType(header[col])\r
+                except (ValueError, TypeError):\r
+                    hasHeader += 1\r
+                else:\r
+                    hasHeader -= 1\r
+\r
+        return hasHeader > 0\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/dis.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/dis.py
new file mode 100644 (file)
index 0000000..cdb9c59
--- /dev/null
@@ -0,0 +1,224 @@
+"""Disassembler of Python byte code into mnemonics."""\r
+\r
+import sys\r
+import types\r
+\r
+from opcode import *\r
+from opcode import __all__ as _opcodes_all\r
+\r
+__all__ = ["dis", "disassemble", "distb", "disco",\r
+           "findlinestarts", "findlabels"] + _opcodes_all\r
+del _opcodes_all\r
+\r
+_have_code = (types.MethodType, types.FunctionType, types.CodeType,\r
+              types.ClassType, type)\r
+\r
+def dis(x=None):\r
+    """Disassemble classes, methods, functions, or code.\r
+\r
+    With no argument, disassemble the last traceback.\r
+\r
+    """\r
+    if x is None:\r
+        distb()\r
+        return\r
+    if isinstance(x, types.InstanceType):\r
+        x = x.__class__\r
+    if hasattr(x, 'im_func'):\r
+        x = x.im_func\r
+    if hasattr(x, 'func_code'):\r
+        x = x.func_code\r
+    if hasattr(x, '__dict__'):\r
+        items = x.__dict__.items()\r
+        items.sort()\r
+        for name, x1 in items:\r
+            if isinstance(x1, _have_code):\r
+                print "Disassembly of %s:" % name\r
+                try:\r
+                    dis(x1)\r
+                except TypeError, msg:\r
+                    print "Sorry:", msg\r
+                print\r
+    elif hasattr(x, 'co_code'):\r
+        disassemble(x)\r
+    elif isinstance(x, str):\r
+        disassemble_string(x)\r
+    else:\r
+        raise TypeError, \\r
+              "don't know how to disassemble %s objects" % \\r
+              type(x).__name__\r
+\r
+def distb(tb=None):\r
+    """Disassemble a traceback (default: last traceback)."""\r
+    if tb is None:\r
+        try:\r
+            tb = sys.last_traceback\r
+        except AttributeError:\r
+            raise RuntimeError, "no last traceback to disassemble"\r
+        while tb.tb_next: tb = tb.tb_next\r
+    disassemble(tb.tb_frame.f_code, tb.tb_lasti)\r
+\r
+def disassemble(co, lasti=-1):\r
+    """Disassemble a code object."""\r
+    code = co.co_code\r
+    labels = findlabels(code)\r
+    linestarts = dict(findlinestarts(co))\r
+    n = len(code)\r
+    i = 0\r
+    extended_arg = 0\r
+    free = None\r
+    while i < n:\r
+        c = code[i]\r
+        op = ord(c)\r
+        if i in linestarts:\r
+            if i > 0:\r
+                print\r
+            print "%3d" % linestarts[i],\r
+        else:\r
+            print '   ',\r
+\r
+        if i == lasti: print '-->',\r
+        else: print '   ',\r
+        if i in labels: print '>>',\r
+        else: print '  ',\r
+        print repr(i).rjust(4),\r
+        print opname[op].ljust(20),\r
+        i = i+1\r
+        if op >= HAVE_ARGUMENT:\r
+            oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg\r
+            extended_arg = 0\r
+            i = i+2\r
+            if op == EXTENDED_ARG:\r
+                extended_arg = oparg*65536L\r
+            print repr(oparg).rjust(5),\r
+            if op in hasconst:\r
+                print '(' + repr(co.co_consts[oparg]) + ')',\r
+            elif op in hasname:\r
+                print '(' + co.co_names[oparg] + ')',\r
+            elif op in hasjrel:\r
+                print '(to ' + repr(i + oparg) + ')',\r
+            elif op in haslocal:\r
+                print '(' + co.co_varnames[oparg] + ')',\r
+            elif op in hascompare:\r
+                print '(' + cmp_op[oparg] + ')',\r
+            elif op in hasfree:\r
+                if free is None:\r
+                    free = co.co_cellvars + co.co_freevars\r
+                print '(' + free[oparg] + ')',\r
+        print\r
+\r
+def disassemble_string(code, lasti=-1, varnames=None, names=None,\r
+                       constants=None):\r
+    labels = findlabels(code)\r
+    n = len(code)\r
+    i = 0\r
+    while i < n:\r
+        c = code[i]\r
+        op = ord(c)\r
+        if i == lasti: print '-->',\r
+        else: print '   ',\r
+        if i in labels: print '>>',\r
+        else: print '  ',\r
+        print repr(i).rjust(4),\r
+        print opname[op].ljust(15),\r
+        i = i+1\r
+        if op >= HAVE_ARGUMENT:\r
+            oparg = ord(code[i]) + ord(code[i+1])*256\r
+            i = i+2\r
+            print repr(oparg).rjust(5),\r
+            if op in hasconst:\r
+                if constants:\r
+                    print '(' + repr(constants[oparg]) + ')',\r
+                else:\r
+                    print '(%d)'%oparg,\r
+            elif op in hasname:\r
+                if names is not None:\r
+                    print '(' + names[oparg] + ')',\r
+                else:\r
+                    print '(%d)'%oparg,\r
+            elif op in hasjrel:\r
+                print '(to ' + repr(i + oparg) + ')',\r
+            elif op in haslocal:\r
+                if varnames:\r
+                    print '(' + varnames[oparg] + ')',\r
+                else:\r
+                    print '(%d)' % oparg,\r
+            elif op in hascompare:\r
+                print '(' + cmp_op[oparg] + ')',\r
+        print\r
+\r
+disco = disassemble                     # XXX For backwards compatibility\r
+\r
+def findlabels(code):\r
+    """Detect all offsets in a byte code which are jump targets.\r
+\r
+    Return the list of offsets.\r
+\r
+    """\r
+    labels = []\r
+    n = len(code)\r
+    i = 0\r
+    while i < n:\r
+        c = code[i]\r
+        op = ord(c)\r
+        i = i+1\r
+        if op >= HAVE_ARGUMENT:\r
+            oparg = ord(code[i]) + ord(code[i+1])*256\r
+            i = i+2\r
+            label = -1\r
+            if op in hasjrel:\r
+                label = i+oparg\r
+            elif op in hasjabs:\r
+                label = oparg\r
+            if label >= 0:\r
+                if label not in labels:\r
+                    labels.append(label)\r
+    return labels\r
+\r
+def findlinestarts(code):\r
+    """Find the offsets in a byte code which are start of lines in the source.\r
+\r
+    Generate pairs (offset, lineno) as described in Python/compile.c.\r
+\r
+    """\r
+    byte_increments = [ord(c) for c in code.co_lnotab[0::2]]\r
+    line_increments = [ord(c) for c in code.co_lnotab[1::2]]\r
+\r
+    lastlineno = None\r
+    lineno = code.co_firstlineno\r
+    addr = 0\r
+    for byte_incr, line_incr in zip(byte_increments, line_increments):\r
+        if byte_incr:\r
+            if lineno != lastlineno:\r
+                yield (addr, lineno)\r
+                lastlineno = lineno\r
+            addr += byte_incr\r
+        lineno += line_incr\r
+    if lineno != lastlineno:\r
+        yield (addr, lineno)\r
+\r
+def _test():\r
+    """Simple test program to disassemble a file."""\r
+    if sys.argv[1:]:\r
+        if sys.argv[2:]:\r
+            sys.stderr.write("usage: python dis.py [-|file]\n")\r
+            sys.exit(2)\r
+        fn = sys.argv[1]\r
+        if not fn or fn == "-":\r
+            fn = None\r
+    else:\r
+        fn = None\r
+    if fn is None:\r
+        f = sys.stdin\r
+    else:\r
+        f = open(fn)\r
+    source = f.read()\r
+    if fn is not None:\r
+        f.close()\r
+    else:\r
+        fn = "<stdin>"\r
+    code = compile(source, fn, "exec")\r
+    dis(code)\r
+\r
+if __name__ == "__main__":\r
+    _test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/dummy_thread.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/dummy_thread.py
new file mode 100644 (file)
index 0000000..4b2da7d
--- /dev/null
@@ -0,0 +1,145 @@
+"""Drop-in replacement for the thread module.\r
+\r
+Meant to be used as a brain-dead substitute so that threaded code does\r
+not need to be rewritten for when the thread module is not present.\r
+\r
+Suggested usage is::\r
+\r
+    try:\r
+        import thread\r
+    except ImportError:\r
+        import dummy_thread as thread\r
+\r
+"""\r
+# Exports only things specified by thread documentation;\r
+# skipping obsolete synonyms allocate(), start_new(), exit_thread().\r
+__all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock',\r
+           'interrupt_main', 'LockType']\r
+\r
+import traceback as _traceback\r
+\r
+class error(Exception):\r
+    """Dummy implementation of thread.error."""\r
+\r
+    def __init__(self, *args):\r
+        self.args = args\r
+\r
+def start_new_thread(function, args, kwargs={}):\r
+    """Dummy implementation of thread.start_new_thread().\r
+\r
+    Compatibility is maintained by making sure that ``args`` is a\r
+    tuple and ``kwargs`` is a dictionary.  If an exception is raised\r
+    and it is SystemExit (which can be done by thread.exit()) it is\r
+    caught and nothing is done; all other exceptions are printed out\r
+    by using traceback.print_exc().\r
+\r
+    If the executed function calls interrupt_main the KeyboardInterrupt will be\r
+    raised when the function returns.\r
+\r
+    """\r
+    if type(args) != type(tuple()):\r
+        raise TypeError("2nd arg must be a tuple")\r
+    if type(kwargs) != type(dict()):\r
+        raise TypeError("3rd arg must be a dict")\r
+    global _main\r
+    _main = False\r
+    try:\r
+        function(*args, **kwargs)\r
+    except SystemExit:\r
+        pass\r
+    except:\r
+        _traceback.print_exc()\r
+    _main = True\r
+    global _interrupt\r
+    if _interrupt:\r
+        _interrupt = False\r
+        raise KeyboardInterrupt\r
+\r
+def exit():\r
+    """Dummy implementation of thread.exit()."""\r
+    raise SystemExit\r
+\r
+def get_ident():\r
+    """Dummy implementation of thread.get_ident().\r
+\r
+    Since this module should only be used when threadmodule is not\r
+    available, it is safe to assume that the current process is the\r
+    only thread.  Thus a constant can be safely returned.\r
+    """\r
+    return -1\r
+\r
+def allocate_lock():\r
+    """Dummy implementation of thread.allocate_lock()."""\r
+    return LockType()\r
+\r
+def stack_size(size=None):\r
+    """Dummy implementation of thread.stack_size()."""\r
+    if size is not None:\r
+        raise error("setting thread stack size not supported")\r
+    return 0\r
+\r
+class LockType(object):\r
+    """Class implementing dummy implementation of thread.LockType.\r
+\r
+    Compatibility is maintained by maintaining self.locked_status\r
+    which is a boolean that stores the state of the lock.  Pickling of\r
+    the lock, though, should not be done since if the thread module is\r
+    then used with an unpickled ``lock()`` from here problems could\r
+    occur from this class not having atomic methods.\r
+\r
+    """\r
+\r
+    def __init__(self):\r
+        self.locked_status = False\r
+\r
+    def acquire(self, waitflag=None):\r
+        """Dummy implementation of acquire().\r
+\r
+        For blocking calls, self.locked_status is automatically set to\r
+        True and returned appropriately based on value of\r
+        ``waitflag``.  If it is non-blocking, then the value is\r
+        actually checked and not set if it is already acquired.  This\r
+        is all done so that threading.Condition's assert statements\r
+        aren't triggered and throw a little fit.\r
+\r
+        """\r
+        if waitflag is None or waitflag:\r
+            self.locked_status = True\r
+            return True\r
+        else:\r
+            if not self.locked_status:\r
+                self.locked_status = True\r
+                return True\r
+            else:\r
+                return False\r
+\r
+    __enter__ = acquire\r
+\r
+    def __exit__(self, typ, val, tb):\r
+        self.release()\r
+\r
+    def release(self):\r
+        """Release the dummy lock."""\r
+        # XXX Perhaps shouldn't actually bother to test?  Could lead\r
+        #     to problems for complex, threaded code.\r
+        if not self.locked_status:\r
+            raise error\r
+        self.locked_status = False\r
+        return True\r
+\r
+    def locked(self):\r
+        return self.locked_status\r
+\r
+# Used to signal that interrupt_main was called in a "thread"\r
+_interrupt = False\r
+# True when not executing in a "thread"\r
+_main = True\r
+\r
+def interrupt_main():\r
+    """Set _interrupt flag to True to have start_new_thread raise\r
+    KeyboardInterrupt upon exiting."""\r
+    if _main:\r
+        raise KeyboardInterrupt\r
+    else:\r
+        global _interrupt\r
+        _interrupt = True\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/__init__.py
new file mode 100644 (file)
index 0000000..40e862f
--- /dev/null
@@ -0,0 +1,157 @@
+""" Standard "encodings" Package\r
+\r
+    Standard Python encoding modules are stored in this package\r
+    directory.\r
+\r
+    Codec modules must have names corresponding to normalized encoding\r
+    names as defined in the normalize_encoding() function below, e.g.\r
+    'utf-8' must be implemented by the module 'utf_8.py'.\r
+\r
+    Each codec module must export the following interface:\r
+\r
+    * getregentry() -> codecs.CodecInfo object\r
+    The getregentry() API must a CodecInfo object with encoder, decoder,\r
+    incrementalencoder, incrementaldecoder, streamwriter and streamreader\r
+    atttributes which adhere to the Python Codec Interface Standard.\r
+\r
+    In addition, a module may optionally also define the following\r
+    APIs which are then used by the package's codec search function:\r
+\r
+    * getaliases() -> sequence of encoding name strings to use as aliases\r
+\r
+    Alias names returned by getaliases() must be normalized encoding\r
+    names as defined by normalize_encoding().\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""#"\r
+\r
+import codecs\r
+from encodings import aliases\r
+import __builtin__\r
+\r
+_cache = {}\r
+_unknown = '--unknown--'\r
+_import_tail = ['*']\r
+_norm_encoding_map = ('                                              . '\r
+                      '0123456789       ABCDEFGHIJKLMNOPQRSTUVWXYZ     '\r
+                      ' abcdefghijklmnopqrstuvwxyz                     '\r
+                      '                                                '\r
+                      '                                                '\r
+                      '                ')\r
+_aliases = aliases.aliases\r
+\r
+class CodecRegistryError(LookupError, SystemError):\r
+    pass\r
+\r
+def normalize_encoding(encoding):\r
+\r
+    """ Normalize an encoding name.\r
+\r
+        Normalization works as follows: all non-alphanumeric\r
+        characters except the dot used for Python package names are\r
+        collapsed and replaced with a single underscore, e.g. '  -;#'\r
+        becomes '_'. Leading and trailing underscores are removed.\r
+\r
+        Note that encoding names should be ASCII only; if they do use\r
+        non-ASCII characters, these must be Latin-1 compatible.\r
+\r
+    """\r
+    # Make sure we have an 8-bit string, because .translate() works\r
+    # differently for Unicode strings.\r
+    if hasattr(__builtin__, "unicode") and isinstance(encoding, unicode):\r
+        # Note that .encode('latin-1') does *not* use the codec\r
+        # registry, so this call doesn't recurse. (See unicodeobject.c\r
+        # PyUnicode_AsEncodedString() for details)\r
+        encoding = encoding.encode('latin-1')\r
+    return '_'.join(encoding.translate(_norm_encoding_map).split())\r
+\r
+def search_function(encoding):\r
+\r
+    # Cache lookup\r
+    entry = _cache.get(encoding, _unknown)\r
+    if entry is not _unknown:\r
+        return entry\r
+\r
+    # Import the module:\r
+    #\r
+    # First try to find an alias for the normalized encoding\r
+    # name and lookup the module using the aliased name, then try to\r
+    # lookup the module using the standard import scheme, i.e. first\r
+    # try in the encodings package, then at top-level.\r
+    #\r
+    norm_encoding = normalize_encoding(encoding)\r
+    aliased_encoding = _aliases.get(norm_encoding) or \\r
+                       _aliases.get(norm_encoding.replace('.', '_'))\r
+    if aliased_encoding is not None:\r
+        modnames = [aliased_encoding,\r
+                    norm_encoding]\r
+    else:\r
+        modnames = [norm_encoding]\r
+    for modname in modnames:\r
+        if not modname or '.' in modname:\r
+            continue\r
+        try:\r
+            # Import is absolute to prevent the possibly malicious import of a\r
+            # module with side-effects that is not in the 'encodings' package.\r
+            mod = __import__('encodings.' + modname, fromlist=_import_tail,\r
+                             level=0)\r
+        except ImportError:\r
+            pass\r
+        else:\r
+            break\r
+    else:\r
+        mod = None\r
+\r
+    try:\r
+        getregentry = mod.getregentry\r
+    except AttributeError:\r
+        # Not a codec module\r
+        mod = None\r
+\r
+    if mod is None:\r
+        # Cache misses\r
+        _cache[encoding] = None\r
+        return None\r
+\r
+    # Now ask the module for the registry entry\r
+    entry = getregentry()\r
+    if not isinstance(entry, codecs.CodecInfo):\r
+        if not 4 <= len(entry) <= 7:\r
+            raise CodecRegistryError,\\r
+                 'module "%s" (%s) failed to register' % \\r
+                  (mod.__name__, mod.__file__)\r
+        if not hasattr(entry[0], '__call__') or \\r
+           not hasattr(entry[1], '__call__') or \\r
+           (entry[2] is not None and not hasattr(entry[2], '__call__')) or \\r
+           (entry[3] is not None and not hasattr(entry[3], '__call__')) or \\r
+           (len(entry) > 4 and entry[4] is not None and not hasattr(entry[4], '__call__')) or \\r
+           (len(entry) > 5 and entry[5] is not None and not hasattr(entry[5], '__call__')):\r
+            raise CodecRegistryError,\\r
+                'incompatible codecs in module "%s" (%s)' % \\r
+                (mod.__name__, mod.__file__)\r
+        if len(entry)<7 or entry[6] is None:\r
+            entry += (None,)*(6-len(entry)) + (mod.__name__.split(".", 1)[1],)\r
+        entry = codecs.CodecInfo(*entry)\r
+\r
+    # Cache the codec registry entry\r
+    _cache[encoding] = entry\r
+\r
+    # Register its aliases (without overwriting previously registered\r
+    # aliases)\r
+    try:\r
+        codecaliases = mod.getaliases()\r
+    except AttributeError:\r
+        pass\r
+    else:\r
+        for alias in codecaliases:\r
+            if alias not in _aliases:\r
+                _aliases[alias] = modname\r
+\r
+    # Return the registry entry\r
+    return entry\r
+\r
+# Register the search_function in the Python codec registry\r
+codecs.register(search_function)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/aliases.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/aliases.py
new file mode 100644 (file)
index 0000000..ff8011b
--- /dev/null
@@ -0,0 +1,527 @@
+""" Encoding Aliases Support\r
+\r
+    This module is used by the encodings package search function to\r
+    map encodings names to module names.\r
+\r
+    Note that the search function normalizes the encoding names before\r
+    doing the lookup, so the mapping will have to map normalized\r
+    encoding names to module names.\r
+\r
+    Contents:\r
+\r
+        The following aliases dictionary contains mappings of all IANA\r
+        character set names for which the Python core library provides\r
+        codecs. In addition to these, a few Python specific codec\r
+        aliases have also been added.\r
+\r
+"""\r
+aliases = {\r
+\r
+    # Please keep this list sorted alphabetically by value !\r
+\r
+    # ascii codec\r
+    '646'                : 'ascii',\r
+    'ansi_x3.4_1968'     : 'ascii',\r
+    'ansi_x3_4_1968'     : 'ascii', # some email headers use this non-standard name\r
+    'ansi_x3.4_1986'     : 'ascii',\r
+    'cp367'              : 'ascii',\r
+    'csascii'            : 'ascii',\r
+    'ibm367'             : 'ascii',\r
+    'iso646_us'          : 'ascii',\r
+    'iso_646.irv_1991'   : 'ascii',\r
+    'iso_ir_6'           : 'ascii',\r
+    'us'                 : 'ascii',\r
+    'us_ascii'           : 'ascii',\r
+\r
+    # base64_codec codec\r
+    'base64'             : 'base64_codec',\r
+    'base_64'            : 'base64_codec',\r
+\r
+    # big5 codec\r
+    'big5_tw'            : 'big5',\r
+    'csbig5'             : 'big5',\r
+\r
+    # big5hkscs codec\r
+    'big5_hkscs'         : 'big5hkscs',\r
+    'hkscs'              : 'big5hkscs',\r
+\r
+    # bz2_codec codec\r
+    'bz2'                : 'bz2_codec',\r
+\r
+    # cp037 codec\r
+    '037'                : 'cp037',\r
+    'csibm037'           : 'cp037',\r
+    'ebcdic_cp_ca'       : 'cp037',\r
+    'ebcdic_cp_nl'       : 'cp037',\r
+    'ebcdic_cp_us'       : 'cp037',\r
+    'ebcdic_cp_wt'       : 'cp037',\r
+    'ibm037'             : 'cp037',\r
+    'ibm039'             : 'cp037',\r
+\r
+    # cp1026 codec\r
+    '1026'               : 'cp1026',\r
+    'csibm1026'          : 'cp1026',\r
+    'ibm1026'            : 'cp1026',\r
+\r
+    # cp1140 codec\r
+    '1140'               : 'cp1140',\r
+    'ibm1140'            : 'cp1140',\r
+\r
+    # cp1250 codec\r
+    '1250'               : 'cp1250',\r
+    'windows_1250'       : 'cp1250',\r
+\r
+    # cp1251 codec\r
+    '1251'               : 'cp1251',\r
+    'windows_1251'       : 'cp1251',\r
+\r
+    # cp1252 codec\r
+    '1252'               : 'cp1252',\r
+    'windows_1252'       : 'cp1252',\r
+\r
+    # cp1253 codec\r
+    '1253'               : 'cp1253',\r
+    'windows_1253'       : 'cp1253',\r
+\r
+    # cp1254 codec\r
+    '1254'               : 'cp1254',\r
+    'windows_1254'       : 'cp1254',\r
+\r
+    # cp1255 codec\r
+    '1255'               : 'cp1255',\r
+    'windows_1255'       : 'cp1255',\r
+\r
+    # cp1256 codec\r
+    '1256'               : 'cp1256',\r
+    'windows_1256'       : 'cp1256',\r
+\r
+    # cp1257 codec\r
+    '1257'               : 'cp1257',\r
+    'windows_1257'       : 'cp1257',\r
+\r
+    # cp1258 codec\r
+    '1258'               : 'cp1258',\r
+    'windows_1258'       : 'cp1258',\r
+\r
+    # cp424 codec\r
+    '424'                : 'cp424',\r
+    'csibm424'           : 'cp424',\r
+    'ebcdic_cp_he'       : 'cp424',\r
+    'ibm424'             : 'cp424',\r
+\r
+    # cp437 codec\r
+    '437'                : 'cp437',\r
+    'cspc8codepage437'   : 'cp437',\r
+    'ibm437'             : 'cp437',\r
+\r
+    # cp500 codec\r
+    '500'                : 'cp500',\r
+    'csibm500'           : 'cp500',\r
+    'ebcdic_cp_be'       : 'cp500',\r
+    'ebcdic_cp_ch'       : 'cp500',\r
+    'ibm500'             : 'cp500',\r
+\r
+    # cp775 codec\r
+    '775'                : 'cp775',\r
+    'cspc775baltic'      : 'cp775',\r
+    'ibm775'             : 'cp775',\r
+\r
+    # cp850 codec\r
+    '850'                : 'cp850',\r
+    'cspc850multilingual' : 'cp850',\r
+    'ibm850'             : 'cp850',\r
+\r
+    # cp852 codec\r
+    '852'                : 'cp852',\r
+    'cspcp852'           : 'cp852',\r
+    'ibm852'             : 'cp852',\r
+\r
+    # cp855 codec\r
+    '855'                : 'cp855',\r
+    'csibm855'           : 'cp855',\r
+    'ibm855'             : 'cp855',\r
+\r
+    # cp857 codec\r
+    '857'                : 'cp857',\r
+    'csibm857'           : 'cp857',\r
+    'ibm857'             : 'cp857',\r
+\r
+    # cp858 codec\r
+    '858'                : 'cp858',\r
+    'csibm858'           : 'cp858',\r
+    'ibm858'             : 'cp858',\r
+\r
+    # cp860 codec\r
+    '860'                : 'cp860',\r
+    'csibm860'           : 'cp860',\r
+    'ibm860'             : 'cp860',\r
+\r
+    # cp861 codec\r
+    '861'                : 'cp861',\r
+    'cp_is'              : 'cp861',\r
+    'csibm861'           : 'cp861',\r
+    'ibm861'             : 'cp861',\r
+\r
+    # cp862 codec\r
+    '862'                : 'cp862',\r
+    'cspc862latinhebrew' : 'cp862',\r
+    'ibm862'             : 'cp862',\r
+\r
+    # cp863 codec\r
+    '863'                : 'cp863',\r
+    'csibm863'           : 'cp863',\r
+    'ibm863'             : 'cp863',\r
+\r
+    # cp864 codec\r
+    '864'                : 'cp864',\r
+    'csibm864'           : 'cp864',\r
+    'ibm864'             : 'cp864',\r
+\r
+    # cp865 codec\r
+    '865'                : 'cp865',\r
+    'csibm865'           : 'cp865',\r
+    'ibm865'             : 'cp865',\r
+\r
+    # cp866 codec\r
+    '866'                : 'cp866',\r
+    'csibm866'           : 'cp866',\r
+    'ibm866'             : 'cp866',\r
+\r
+    # cp869 codec\r
+    '869'                : 'cp869',\r
+    'cp_gr'              : 'cp869',\r
+    'csibm869'           : 'cp869',\r
+    'ibm869'             : 'cp869',\r
+\r
+    # cp932 codec\r
+    '932'                : 'cp932',\r
+    'ms932'              : 'cp932',\r
+    'mskanji'            : 'cp932',\r
+    'ms_kanji'           : 'cp932',\r
+\r
+    # cp949 codec\r
+    '949'                : 'cp949',\r
+    'ms949'              : 'cp949',\r
+    'uhc'                : 'cp949',\r
+\r
+    # cp950 codec\r
+    '950'                : 'cp950',\r
+    'ms950'              : 'cp950',\r
+\r
+    # euc_jis_2004 codec\r
+    'jisx0213'           : 'euc_jis_2004',\r
+    'eucjis2004'         : 'euc_jis_2004',\r
+    'euc_jis2004'        : 'euc_jis_2004',\r
+\r
+    # euc_jisx0213 codec\r
+    'eucjisx0213'        : 'euc_jisx0213',\r
+\r
+    # euc_jp codec\r
+    'eucjp'              : 'euc_jp',\r
+    'ujis'               : 'euc_jp',\r
+    'u_jis'              : 'euc_jp',\r
+\r
+    # euc_kr codec\r
+    'euckr'              : 'euc_kr',\r
+    'korean'             : 'euc_kr',\r
+    'ksc5601'            : 'euc_kr',\r
+    'ks_c_5601'          : 'euc_kr',\r
+    'ks_c_5601_1987'     : 'euc_kr',\r
+    'ksx1001'            : 'euc_kr',\r
+    'ks_x_1001'          : 'euc_kr',\r
+\r
+    # gb18030 codec\r
+    'gb18030_2000'       : 'gb18030',\r
+\r
+    # gb2312 codec\r
+    'chinese'            : 'gb2312',\r
+    'csiso58gb231280'    : 'gb2312',\r
+    'euc_cn'             : 'gb2312',\r
+    'euccn'              : 'gb2312',\r
+    'eucgb2312_cn'       : 'gb2312',\r
+    'gb2312_1980'        : 'gb2312',\r
+    'gb2312_80'          : 'gb2312',\r
+    'iso_ir_58'          : 'gb2312',\r
+\r
+    # gbk codec\r
+    '936'                : 'gbk',\r
+    'cp936'              : 'gbk',\r
+    'ms936'              : 'gbk',\r
+\r
+    # hex_codec codec\r
+    'hex'                : 'hex_codec',\r
+\r
+    # hp_roman8 codec\r
+    'roman8'             : 'hp_roman8',\r
+    'r8'                 : 'hp_roman8',\r
+    'csHPRoman8'         : 'hp_roman8',\r
+\r
+    # hz codec\r
+    'hzgb'               : 'hz',\r
+    'hz_gb'              : 'hz',\r
+    'hz_gb_2312'         : 'hz',\r
+\r
+    # iso2022_jp codec\r
+    'csiso2022jp'        : 'iso2022_jp',\r
+    'iso2022jp'          : 'iso2022_jp',\r
+    'iso_2022_jp'        : 'iso2022_jp',\r
+\r
+    # iso2022_jp_1 codec\r
+    'iso2022jp_1'        : 'iso2022_jp_1',\r
+    'iso_2022_jp_1'      : 'iso2022_jp_1',\r
+\r
+    # iso2022_jp_2 codec\r
+    'iso2022jp_2'        : 'iso2022_jp_2',\r
+    'iso_2022_jp_2'      : 'iso2022_jp_2',\r
+\r
+    # iso2022_jp_2004 codec\r
+    'iso_2022_jp_2004'   : 'iso2022_jp_2004',\r
+    'iso2022jp_2004'     : 'iso2022_jp_2004',\r
+\r
+    # iso2022_jp_3 codec\r
+    'iso2022jp_3'        : 'iso2022_jp_3',\r
+    'iso_2022_jp_3'      : 'iso2022_jp_3',\r
+\r
+    # iso2022_jp_ext codec\r
+    'iso2022jp_ext'      : 'iso2022_jp_ext',\r
+    'iso_2022_jp_ext'    : 'iso2022_jp_ext',\r
+\r
+    # iso2022_kr codec\r
+    'csiso2022kr'        : 'iso2022_kr',\r
+    'iso2022kr'          : 'iso2022_kr',\r
+    'iso_2022_kr'        : 'iso2022_kr',\r
+\r
+    # iso8859_10 codec\r
+    'csisolatin6'        : 'iso8859_10',\r
+    'iso_8859_10'        : 'iso8859_10',\r
+    'iso_8859_10_1992'   : 'iso8859_10',\r
+    'iso_ir_157'         : 'iso8859_10',\r
+    'l6'                 : 'iso8859_10',\r
+    'latin6'             : 'iso8859_10',\r
+\r
+    # iso8859_11 codec\r
+    'thai'               : 'iso8859_11',\r
+    'iso_8859_11'        : 'iso8859_11',\r
+    'iso_8859_11_2001'   : 'iso8859_11',\r
+\r
+    # iso8859_13 codec\r
+    'iso_8859_13'        : 'iso8859_13',\r
+    'l7'                 : 'iso8859_13',\r
+    'latin7'             : 'iso8859_13',\r
+\r
+    # iso8859_14 codec\r
+    'iso_8859_14'        : 'iso8859_14',\r
+    'iso_8859_14_1998'   : 'iso8859_14',\r
+    'iso_celtic'         : 'iso8859_14',\r
+    'iso_ir_199'         : 'iso8859_14',\r
+    'l8'                 : 'iso8859_14',\r
+    'latin8'             : 'iso8859_14',\r
+\r
+    # iso8859_15 codec\r
+    'iso_8859_15'        : 'iso8859_15',\r
+    'l9'                 : 'iso8859_15',\r
+    'latin9'             : 'iso8859_15',\r
+\r
+    # iso8859_16 codec\r
+    'iso_8859_16'        : 'iso8859_16',\r
+    'iso_8859_16_2001'   : 'iso8859_16',\r
+    'iso_ir_226'         : 'iso8859_16',\r
+    'l10'                : 'iso8859_16',\r
+    'latin10'            : 'iso8859_16',\r
+\r
+    # iso8859_2 codec\r
+    'csisolatin2'        : 'iso8859_2',\r
+    'iso_8859_2'         : 'iso8859_2',\r
+    'iso_8859_2_1987'    : 'iso8859_2',\r
+    'iso_ir_101'         : 'iso8859_2',\r
+    'l2'                 : 'iso8859_2',\r
+    'latin2'             : 'iso8859_2',\r
+\r
+    # iso8859_3 codec\r
+    'csisolatin3'        : 'iso8859_3',\r
+    'iso_8859_3'         : 'iso8859_3',\r
+    'iso_8859_3_1988'    : 'iso8859_3',\r
+    'iso_ir_109'         : 'iso8859_3',\r
+    'l3'                 : 'iso8859_3',\r
+    'latin3'             : 'iso8859_3',\r
+\r
+    # iso8859_4 codec\r
+    'csisolatin4'        : 'iso8859_4',\r
+    'iso_8859_4'         : 'iso8859_4',\r
+    'iso_8859_4_1988'    : 'iso8859_4',\r
+    'iso_ir_110'         : 'iso8859_4',\r
+    'l4'                 : 'iso8859_4',\r
+    'latin4'             : 'iso8859_4',\r
+\r
+    # iso8859_5 codec\r
+    'csisolatincyrillic' : 'iso8859_5',\r
+    'cyrillic'           : 'iso8859_5',\r
+    'iso_8859_5'         : 'iso8859_5',\r
+    'iso_8859_5_1988'    : 'iso8859_5',\r
+    'iso_ir_144'         : 'iso8859_5',\r
+\r
+    # iso8859_6 codec\r
+    'arabic'             : 'iso8859_6',\r
+    'asmo_708'           : 'iso8859_6',\r
+    'csisolatinarabic'   : 'iso8859_6',\r
+    'ecma_114'           : 'iso8859_6',\r
+    'iso_8859_6'         : 'iso8859_6',\r
+    'iso_8859_6_1987'    : 'iso8859_6',\r
+    'iso_ir_127'         : 'iso8859_6',\r
+\r
+    # iso8859_7 codec\r
+    'csisolatingreek'    : 'iso8859_7',\r
+    'ecma_118'           : 'iso8859_7',\r
+    'elot_928'           : 'iso8859_7',\r
+    'greek'              : 'iso8859_7',\r
+    'greek8'             : 'iso8859_7',\r
+    'iso_8859_7'         : 'iso8859_7',\r
+    'iso_8859_7_1987'    : 'iso8859_7',\r
+    'iso_ir_126'         : 'iso8859_7',\r
+\r
+    # iso8859_8 codec\r
+    'csisolatinhebrew'   : 'iso8859_8',\r
+    'hebrew'             : 'iso8859_8',\r
+    'iso_8859_8'         : 'iso8859_8',\r
+    'iso_8859_8_1988'    : 'iso8859_8',\r
+    'iso_ir_138'         : 'iso8859_8',\r
+\r
+    # iso8859_9 codec\r
+    'csisolatin5'        : 'iso8859_9',\r
+    'iso_8859_9'         : 'iso8859_9',\r
+    'iso_8859_9_1989'    : 'iso8859_9',\r
+    'iso_ir_148'         : 'iso8859_9',\r
+    'l5'                 : 'iso8859_9',\r
+    'latin5'             : 'iso8859_9',\r
+\r
+    # johab codec\r
+    'cp1361'             : 'johab',\r
+    'ms1361'             : 'johab',\r
+\r
+    # koi8_r codec\r
+    'cskoi8r'            : 'koi8_r',\r
+\r
+    # latin_1 codec\r
+    #\r
+    # Note that the latin_1 codec is implemented internally in C and a\r
+    # lot faster than the charmap codec iso8859_1 which uses the same\r
+    # encoding. This is why we discourage the use of the iso8859_1\r
+    # codec and alias it to latin_1 instead.\r
+    #\r
+    '8859'               : 'latin_1',\r
+    'cp819'              : 'latin_1',\r
+    'csisolatin1'        : 'latin_1',\r
+    'ibm819'             : 'latin_1',\r
+    'iso8859'            : 'latin_1',\r
+    'iso8859_1'          : 'latin_1',\r
+    'iso_8859_1'         : 'latin_1',\r
+    'iso_8859_1_1987'    : 'latin_1',\r
+    'iso_ir_100'         : 'latin_1',\r
+    'l1'                 : 'latin_1',\r
+    'latin'              : 'latin_1',\r
+    'latin1'             : 'latin_1',\r
+\r
+    # mac_cyrillic codec\r
+    'maccyrillic'        : 'mac_cyrillic',\r
+\r
+    # mac_greek codec\r
+    'macgreek'           : 'mac_greek',\r
+\r
+    # mac_iceland codec\r
+    'maciceland'         : 'mac_iceland',\r
+\r
+    # mac_latin2 codec\r
+    'maccentraleurope'   : 'mac_latin2',\r
+    'maclatin2'          : 'mac_latin2',\r
+\r
+    # mac_roman codec\r
+    'macroman'           : 'mac_roman',\r
+\r
+    # mac_turkish codec\r
+    'macturkish'         : 'mac_turkish',\r
+\r
+    # mbcs codec\r
+    'dbcs'               : 'mbcs',\r
+\r
+    # ptcp154 codec\r
+    'csptcp154'          : 'ptcp154',\r
+    'pt154'              : 'ptcp154',\r
+    'cp154'              : 'ptcp154',\r
+    'cyrillic_asian'     : 'ptcp154',\r
+\r
+    # quopri_codec codec\r
+    'quopri'             : 'quopri_codec',\r
+    'quoted_printable'   : 'quopri_codec',\r
+    'quotedprintable'    : 'quopri_codec',\r
+\r
+    # rot_13 codec\r
+    'rot13'              : 'rot_13',\r
+\r
+    # shift_jis codec\r
+    'csshiftjis'         : 'shift_jis',\r
+    'shiftjis'           : 'shift_jis',\r
+    'sjis'               : 'shift_jis',\r
+    's_jis'              : 'shift_jis',\r
+\r
+    # shift_jis_2004 codec\r
+    'shiftjis2004'       : 'shift_jis_2004',\r
+    'sjis_2004'          : 'shift_jis_2004',\r
+    's_jis_2004'         : 'shift_jis_2004',\r
+\r
+    # shift_jisx0213 codec\r
+    'shiftjisx0213'      : 'shift_jisx0213',\r
+    'sjisx0213'          : 'shift_jisx0213',\r
+    's_jisx0213'         : 'shift_jisx0213',\r
+\r
+    # tactis codec\r
+    'tis260'             : 'tactis',\r
+\r
+    # tis_620 codec\r
+    'tis620'             : 'tis_620',\r
+    'tis_620_0'          : 'tis_620',\r
+    'tis_620_2529_0'     : 'tis_620',\r
+    'tis_620_2529_1'     : 'tis_620',\r
+    'iso_ir_166'         : 'tis_620',\r
+\r
+    # utf_16 codec\r
+    'u16'                : 'utf_16',\r
+    'utf16'              : 'utf_16',\r
+\r
+    # utf_16_be codec\r
+    'unicodebigunmarked' : 'utf_16_be',\r
+    'utf_16be'           : 'utf_16_be',\r
+\r
+    # utf_16_le codec\r
+    'unicodelittleunmarked' : 'utf_16_le',\r
+    'utf_16le'           : 'utf_16_le',\r
+\r
+    # utf_32 codec\r
+    'u32'                : 'utf_32',\r
+    'utf32'              : 'utf_32',\r
+\r
+    # utf_32_be codec\r
+    'utf_32be'           : 'utf_32_be',\r
+\r
+    # utf_32_le codec\r
+    'utf_32le'           : 'utf_32_le',\r
+\r
+    # utf_7 codec\r
+    'u7'                 : 'utf_7',\r
+    'utf7'               : 'utf_7',\r
+    'unicode_1_1_utf_7'  : 'utf_7',\r
+\r
+    # utf_8 codec\r
+    'u8'                 : 'utf_8',\r
+    'utf'                : 'utf_8',\r
+    'utf8'               : 'utf_8',\r
+    'utf8_ucs2'          : 'utf_8',\r
+    'utf8_ucs4'          : 'utf_8',\r
+\r
+    # uu_codec codec\r
+    'uu'                 : 'uu_codec',\r
+\r
+    # zlib_codec codec\r
+    'zip'                : 'zlib_codec',\r
+    'zlib'               : 'zlib_codec',\r
+\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ascii.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ascii.py
new file mode 100644 (file)
index 0000000..df0d66d
--- /dev/null
@@ -0,0 +1,50 @@
+""" Python 'ascii' Codec\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    # Note: Binding these as C functions will result in the class not\r
+    # converting them to methods. This is intended.\r
+    encode = codecs.ascii_encode\r
+    decode = codecs.ascii_decode\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.ascii_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.ascii_decode(input, self.errors)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+class StreamConverter(StreamWriter,StreamReader):\r
+\r
+    encode = codecs.ascii_decode\r
+    decode = codecs.ascii_encode\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='ascii',\r
+        encode=Codec.encode,\r
+        decode=Codec.decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/base64_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/base64_codec.py
new file mode 100644 (file)
index 0000000..2092637
--- /dev/null
@@ -0,0 +1,79 @@
+""" Python 'base64_codec' Codec - base64 content transfer encoding\r
+\r
+    Unlike most of the other codecs which target Unicode, this codec\r
+    will return Python string objects for both encode and decode.\r
+\r
+    Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+"""\r
+import codecs, base64\r
+\r
+### Codec APIs\r
+\r
+def base64_encode(input,errors='strict'):\r
+\r
+    """ Encodes the object input and returns a tuple (output\r
+        object, length consumed).\r
+\r
+        errors defines the error handling to apply. It defaults to\r
+        'strict' handling which is the only currently supported\r
+        error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    output = base64.encodestring(input)\r
+    return (output, len(input))\r
+\r
+def base64_decode(input,errors='strict'):\r
+\r
+    """ Decodes the object input and returns a tuple (output\r
+        object, length consumed).\r
+\r
+        input must be an object which provides the bf_getreadbuf\r
+        buffer slot. Python strings, buffer objects and memory\r
+        mapped files are examples of objects providing this slot.\r
+\r
+        errors defines the error handling to apply. It defaults to\r
+        'strict' handling which is the only currently supported\r
+        error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    output = base64.decodestring(input)\r
+    return (output, len(input))\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self, input,errors='strict'):\r
+        return base64_encode(input,errors)\r
+    def decode(self, input,errors='strict'):\r
+        return base64_decode(input,errors)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        assert self.errors == 'strict'\r
+        return base64.encodestring(input)\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        assert self.errors == 'strict'\r
+        return base64.decodestring(input)\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='base64',\r
+        encode=base64_encode,\r
+        decode=base64_decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5.py
new file mode 100644 (file)
index 0000000..1be2c29
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# big5.py: Python Unicode Codec for BIG5\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_tw, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_tw.getcodec('big5')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='big5',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5hkscs.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5hkscs.py
new file mode 100644 (file)
index 0000000..ddfcaa6
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# big5hkscs.py: Python Unicode Codec for BIG5HKSCS\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_hk, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_hk.getcodec('big5hkscs')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='big5hkscs',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/bz2_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/bz2_codec.py
new file mode 100644 (file)
index 0000000..04020db
--- /dev/null
@@ -0,0 +1,102 @@
+""" Python 'bz2_codec' Codec - bz2 compression encoding\r
+\r
+    Unlike most of the other codecs which target Unicode, this codec\r
+    will return Python string objects for both encode and decode.\r
+\r
+    Adapted by Raymond Hettinger from zlib_codec.py which was written\r
+    by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+"""\r
+import codecs\r
+import bz2 # this codec needs the optional bz2 module !\r
+\r
+### Codec APIs\r
+\r
+def bz2_encode(input,errors='strict'):\r
+\r
+    """ Encodes the object input and returns a tuple (output\r
+        object, length consumed).\r
+\r
+        errors defines the error handling to apply. It defaults to\r
+        'strict' handling which is the only currently supported\r
+        error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    output = bz2.compress(input)\r
+    return (output, len(input))\r
+\r
+def bz2_decode(input,errors='strict'):\r
+\r
+    """ Decodes the object input and returns a tuple (output\r
+        object, length consumed).\r
+\r
+        input must be an object which provides the bf_getreadbuf\r
+        buffer slot. Python strings, buffer objects and memory\r
+        mapped files are examples of objects providing this slot.\r
+\r
+        errors defines the error handling to apply. It defaults to\r
+        'strict' handling which is the only currently supported\r
+        error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    output = bz2.decompress(input)\r
+    return (output, len(input))\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self, input, errors='strict'):\r
+        return bz2_encode(input, errors)\r
+    def decode(self, input, errors='strict'):\r
+        return bz2_decode(input, errors)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def __init__(self, errors='strict'):\r
+        assert errors == 'strict'\r
+        self.errors = errors\r
+        self.compressobj = bz2.BZ2Compressor()\r
+\r
+    def encode(self, input, final=False):\r
+        if final:\r
+            c = self.compressobj.compress(input)\r
+            return c + self.compressobj.flush()\r
+        else:\r
+            return self.compressobj.compress(input)\r
+\r
+    def reset(self):\r
+        self.compressobj = bz2.BZ2Compressor()\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def __init__(self, errors='strict'):\r
+        assert errors == 'strict'\r
+        self.errors = errors\r
+        self.decompressobj = bz2.BZ2Decompressor()\r
+\r
+    def decode(self, input, final=False):\r
+        try:\r
+            return self.decompressobj.decompress(input)\r
+        except EOFError:\r
+            return ''\r
+\r
+    def reset(self):\r
+        self.decompressobj = bz2.BZ2Decompressor()\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name="bz2",\r
+        encode=bz2_encode,\r
+        decode=bz2_decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/charmap.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/charmap.py
new file mode 100644 (file)
index 0000000..9697493
--- /dev/null
@@ -0,0 +1,69 @@
+""" Generic Python Character Mapping Codec.\r
+\r
+    Use this codec directly rather than through the automatic\r
+    conversion mechanisms supplied by unicode() and .encode().\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    # Note: Binding these as C functions will result in the class not\r
+    # converting them to methods. This is intended.\r
+    encode = codecs.charmap_encode\r
+    decode = codecs.charmap_decode\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def __init__(self, errors='strict', mapping=None):\r
+        codecs.IncrementalEncoder.__init__(self, errors)\r
+        self.mapping = mapping\r
+\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input, self.errors, self.mapping)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def __init__(self, errors='strict', mapping=None):\r
+        codecs.IncrementalDecoder.__init__(self, errors)\r
+        self.mapping = mapping\r
+\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input, self.errors, self.mapping)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+\r
+    def __init__(self,stream,errors='strict',mapping=None):\r
+        codecs.StreamWriter.__init__(self,stream,errors)\r
+        self.mapping = mapping\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return Codec.encode(input,errors,self.mapping)\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+\r
+    def __init__(self,stream,errors='strict',mapping=None):\r
+        codecs.StreamReader.__init__(self,stream,errors)\r
+        self.mapping = mapping\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return Codec.decode(input,errors,self.mapping)\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='charmap',\r
+        encode=Codec.encode,\r
+        decode=Codec.decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp037.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp037.py
new file mode 100644 (file)
index 0000000..c617a60
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp037 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP037.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp037',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x9c'     #  0x04 -> CONTROL\r
+    u'\t'       #  0x05 -> HORIZONTAL TABULATION\r
+    u'\x86'     #  0x06 -> CONTROL\r
+    u'\x7f'     #  0x07 -> DELETE\r
+    u'\x97'     #  0x08 -> CONTROL\r
+    u'\x8d'     #  0x09 -> CONTROL\r
+    u'\x8e'     #  0x0A -> CONTROL\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x9d'     #  0x14 -> CONTROL\r
+    u'\x85'     #  0x15 -> CONTROL\r
+    u'\x08'     #  0x16 -> BACKSPACE\r
+    u'\x87'     #  0x17 -> CONTROL\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x92'     #  0x1A -> CONTROL\r
+    u'\x8f'     #  0x1B -> CONTROL\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u'\x80'     #  0x20 -> CONTROL\r
+    u'\x81'     #  0x21 -> CONTROL\r
+    u'\x82'     #  0x22 -> CONTROL\r
+    u'\x83'     #  0x23 -> CONTROL\r
+    u'\x84'     #  0x24 -> CONTROL\r
+    u'\n'       #  0x25 -> LINE FEED\r
+    u'\x17'     #  0x26 -> END OF TRANSMISSION BLOCK\r
+    u'\x1b'     #  0x27 -> ESCAPE\r
+    u'\x88'     #  0x28 -> CONTROL\r
+    u'\x89'     #  0x29 -> CONTROL\r
+    u'\x8a'     #  0x2A -> CONTROL\r
+    u'\x8b'     #  0x2B -> CONTROL\r
+    u'\x8c'     #  0x2C -> CONTROL\r
+    u'\x05'     #  0x2D -> ENQUIRY\r
+    u'\x06'     #  0x2E -> ACKNOWLEDGE\r
+    u'\x07'     #  0x2F -> BELL\r
+    u'\x90'     #  0x30 -> CONTROL\r
+    u'\x91'     #  0x31 -> CONTROL\r
+    u'\x16'     #  0x32 -> SYNCHRONOUS IDLE\r
+    u'\x93'     #  0x33 -> CONTROL\r
+    u'\x94'     #  0x34 -> CONTROL\r
+    u'\x95'     #  0x35 -> CONTROL\r
+    u'\x96'     #  0x36 -> CONTROL\r
+    u'\x04'     #  0x37 -> END OF TRANSMISSION\r
+    u'\x98'     #  0x38 -> CONTROL\r
+    u'\x99'     #  0x39 -> CONTROL\r
+    u'\x9a'     #  0x3A -> CONTROL\r
+    u'\x9b'     #  0x3B -> CONTROL\r
+    u'\x14'     #  0x3C -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x3D -> NEGATIVE ACKNOWLEDGE\r
+    u'\x9e'     #  0x3E -> CONTROL\r
+    u'\x1a'     #  0x3F -> SUBSTITUTE\r
+    u' '        #  0x40 -> SPACE\r
+    u'\xa0'     #  0x41 -> NO-BREAK SPACE\r
+    u'\xe2'     #  0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x43 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe0'     #  0x44 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0x45 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe3'     #  0x46 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe5'     #  0x47 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x48 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xf1'     #  0x49 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xa2'     #  0x4A -> CENT SIGN\r
+    u'.'        #  0x4B -> FULL STOP\r
+    u'<'        #  0x4C -> LESS-THAN SIGN\r
+    u'('        #  0x4D -> LEFT PARENTHESIS\r
+    u'+'        #  0x4E -> PLUS SIGN\r
+    u'|'        #  0x4F -> VERTICAL LINE\r
+    u'&'        #  0x50 -> AMPERSAND\r
+    u'\xe9'     #  0x51 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x53 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x54 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xed'     #  0x55 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x57 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xec'     #  0x58 -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xdf'     #  0x59 -> LATIN SMALL LETTER SHARP S (GERMAN)\r
+    u'!'        #  0x5A -> EXCLAMATION MARK\r
+    u'$'        #  0x5B -> DOLLAR SIGN\r
+    u'*'        #  0x5C -> ASTERISK\r
+    u')'        #  0x5D -> RIGHT PARENTHESIS\r
+    u';'        #  0x5E -> SEMICOLON\r
+    u'\xac'     #  0x5F -> NOT SIGN\r
+    u'-'        #  0x60 -> HYPHEN-MINUS\r
+    u'/'        #  0x61 -> SOLIDUS\r
+    u'\xc2'     #  0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc4'     #  0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc0'     #  0x64 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0x65 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc3'     #  0x66 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc5'     #  0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc7'     #  0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xd1'     #  0x69 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xa6'     #  0x6A -> BROKEN BAR\r
+    u','        #  0x6B -> COMMA\r
+    u'%'        #  0x6C -> PERCENT SIGN\r
+    u'_'        #  0x6D -> LOW LINE\r
+    u'>'        #  0x6E -> GREATER-THAN SIGN\r
+    u'?'        #  0x6F -> QUESTION MARK\r
+    u'\xf8'     #  0x70 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xc9'     #  0x71 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0x74 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xcd'     #  0x75 -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xcc'     #  0x78 -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'`'        #  0x79 -> GRAVE ACCENT\r
+    u':'        #  0x7A -> COLON\r
+    u'#'        #  0x7B -> NUMBER SIGN\r
+    u'@'        #  0x7C -> COMMERCIAL AT\r
+    u"'"        #  0x7D -> APOSTROPHE\r
+    u'='        #  0x7E -> EQUALS SIGN\r
+    u'"'        #  0x7F -> QUOTATION MARK\r
+    u'\xd8'     #  0x80 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'a'        #  0x81 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x82 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x83 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x84 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x85 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x86 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x87 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x88 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x89 -> LATIN SMALL LETTER I\r
+    u'\xab'     #  0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xf0'     #  0x8C -> LATIN SMALL LETTER ETH (ICELANDIC)\r
+    u'\xfd'     #  0x8D -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xfe'     #  0x8E -> LATIN SMALL LETTER THORN (ICELANDIC)\r
+    u'\xb1'     #  0x8F -> PLUS-MINUS SIGN\r
+    u'\xb0'     #  0x90 -> DEGREE SIGN\r
+    u'j'        #  0x91 -> LATIN SMALL LETTER J\r
+    u'k'        #  0x92 -> LATIN SMALL LETTER K\r
+    u'l'        #  0x93 -> LATIN SMALL LETTER L\r
+    u'm'        #  0x94 -> LATIN SMALL LETTER M\r
+    u'n'        #  0x95 -> LATIN SMALL LETTER N\r
+    u'o'        #  0x96 -> LATIN SMALL LETTER O\r
+    u'p'        #  0x97 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x98 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x99 -> LATIN SMALL LETTER R\r
+    u'\xaa'     #  0x9A -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0x9B -> MASCULINE ORDINAL INDICATOR\r
+    u'\xe6'     #  0x9C -> LATIN SMALL LIGATURE AE\r
+    u'\xb8'     #  0x9D -> CEDILLA\r
+    u'\xc6'     #  0x9E -> LATIN CAPITAL LIGATURE AE\r
+    u'\xa4'     #  0x9F -> CURRENCY SIGN\r
+    u'\xb5'     #  0xA0 -> MICRO SIGN\r
+    u'~'        #  0xA1 -> TILDE\r
+    u's'        #  0xA2 -> LATIN SMALL LETTER S\r
+    u't'        #  0xA3 -> LATIN SMALL LETTER T\r
+    u'u'        #  0xA4 -> LATIN SMALL LETTER U\r
+    u'v'        #  0xA5 -> LATIN SMALL LETTER V\r
+    u'w'        #  0xA6 -> LATIN SMALL LETTER W\r
+    u'x'        #  0xA7 -> LATIN SMALL LETTER X\r
+    u'y'        #  0xA8 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0xA9 -> LATIN SMALL LETTER Z\r
+    u'\xa1'     #  0xAA -> INVERTED EXCLAMATION MARK\r
+    u'\xbf'     #  0xAB -> INVERTED QUESTION MARK\r
+    u'\xd0'     #  0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC)\r
+    u'\xdd'     #  0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xde'     #  0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC)\r
+    u'\xae'     #  0xAF -> REGISTERED SIGN\r
+    u'^'        #  0xB0 -> CIRCUMFLEX ACCENT\r
+    u'\xa3'     #  0xB1 -> POUND SIGN\r
+    u'\xa5'     #  0xB2 -> YEN SIGN\r
+    u'\xb7'     #  0xB3 -> MIDDLE DOT\r
+    u'\xa9'     #  0xB4 -> COPYRIGHT SIGN\r
+    u'\xa7'     #  0xB5 -> SECTION SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xbc'     #  0xB7 -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xB8 -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xB9 -> VULGAR FRACTION THREE QUARTERS\r
+    u'['        #  0xBA -> LEFT SQUARE BRACKET\r
+    u']'        #  0xBB -> RIGHT SQUARE BRACKET\r
+    u'\xaf'     #  0xBC -> MACRON\r
+    u'\xa8'     #  0xBD -> DIAERESIS\r
+    u'\xb4'     #  0xBE -> ACUTE ACCENT\r
+    u'\xd7'     #  0xBF -> MULTIPLICATION SIGN\r
+    u'{'        #  0xC0 -> LEFT CURLY BRACKET\r
+    u'A'        #  0xC1 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0xC2 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0xC3 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0xC4 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0xC5 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0xC6 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0xC7 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0xC8 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0xC9 -> LATIN CAPITAL LETTER I\r
+    u'\xad'     #  0xCA -> SOFT HYPHEN\r
+    u'\xf4'     #  0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0xCC -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf2'     #  0xCD -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xCE -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf5'     #  0xCF -> LATIN SMALL LETTER O WITH TILDE\r
+    u'}'        #  0xD0 -> RIGHT CURLY BRACKET\r
+    u'J'        #  0xD1 -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0xD2 -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0xD3 -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0xD4 -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0xD5 -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0xD6 -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0xD7 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0xD8 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0xD9 -> LATIN CAPITAL LETTER R\r
+    u'\xb9'     #  0xDA -> SUPERSCRIPT ONE\r
+    u'\xfb'     #  0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xDC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xf9'     #  0xDD -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xDE -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xff'     #  0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\\'       #  0xE0 -> REVERSE SOLIDUS\r
+    u'\xf7'     #  0xE1 -> DIVISION SIGN\r
+    u'S'        #  0xE2 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0xE3 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0xE4 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0xE5 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0xE6 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0xE7 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0xE8 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0xE9 -> LATIN CAPITAL LETTER Z\r
+    u'\xb2'     #  0xEA -> SUPERSCRIPT TWO\r
+    u'\xd4'     #  0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd6'     #  0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd2'     #  0xED -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xEE -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd5'     #  0xEF -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'0'        #  0xF0 -> DIGIT ZERO\r
+    u'1'        #  0xF1 -> DIGIT ONE\r
+    u'2'        #  0xF2 -> DIGIT TWO\r
+    u'3'        #  0xF3 -> DIGIT THREE\r
+    u'4'        #  0xF4 -> DIGIT FOUR\r
+    u'5'        #  0xF5 -> DIGIT FIVE\r
+    u'6'        #  0xF6 -> DIGIT SIX\r
+    u'7'        #  0xF7 -> DIGIT SEVEN\r
+    u'8'        #  0xF8 -> DIGIT EIGHT\r
+    u'9'        #  0xF9 -> DIGIT NINE\r
+    u'\xb3'     #  0xFA -> SUPERSCRIPT THREE\r
+    u'\xdb'     #  0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xd9'     #  0xFD -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xFE -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\x9f'     #  0xFF -> CONTROL\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1006.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1006.py
new file mode 100644 (file)
index 0000000..c649b76
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1006 generated from 'MAPPINGS/VENDORS/MISC/CP1006.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1006',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u06f0'   #  0xA1 -> EXTENDED ARABIC-INDIC DIGIT ZERO\r
+    u'\u06f1'   #  0xA2 -> EXTENDED ARABIC-INDIC DIGIT ONE\r
+    u'\u06f2'   #  0xA3 -> EXTENDED ARABIC-INDIC DIGIT TWO\r
+    u'\u06f3'   #  0xA4 -> EXTENDED ARABIC-INDIC DIGIT THREE\r
+    u'\u06f4'   #  0xA5 -> EXTENDED ARABIC-INDIC DIGIT FOUR\r
+    u'\u06f5'   #  0xA6 -> EXTENDED ARABIC-INDIC DIGIT FIVE\r
+    u'\u06f6'   #  0xA7 -> EXTENDED ARABIC-INDIC DIGIT SIX\r
+    u'\u06f7'   #  0xA8 -> EXTENDED ARABIC-INDIC DIGIT SEVEN\r
+    u'\u06f8'   #  0xA9 -> EXTENDED ARABIC-INDIC DIGIT EIGHT\r
+    u'\u06f9'   #  0xAA -> EXTENDED ARABIC-INDIC DIGIT NINE\r
+    u'\u060c'   #  0xAB -> ARABIC COMMA\r
+    u'\u061b'   #  0xAC -> ARABIC SEMICOLON\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\u061f'   #  0xAE -> ARABIC QUESTION MARK\r
+    u'\ufe81'   #  0xAF -> ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM\r
+    u'\ufe8d'   #  0xB0 -> ARABIC LETTER ALEF ISOLATED FORM\r
+    u'\ufe8e'   #  0xB1 -> ARABIC LETTER ALEF FINAL FORM\r
+    u'\ufe8e'   #  0xB2 -> ARABIC LETTER ALEF FINAL FORM\r
+    u'\ufe8f'   #  0xB3 -> ARABIC LETTER BEH ISOLATED FORM\r
+    u'\ufe91'   #  0xB4 -> ARABIC LETTER BEH INITIAL FORM\r
+    u'\ufb56'   #  0xB5 -> ARABIC LETTER PEH ISOLATED FORM\r
+    u'\ufb58'   #  0xB6 -> ARABIC LETTER PEH INITIAL FORM\r
+    u'\ufe93'   #  0xB7 -> ARABIC LETTER TEH MARBUTA ISOLATED FORM\r
+    u'\ufe95'   #  0xB8 -> ARABIC LETTER TEH ISOLATED FORM\r
+    u'\ufe97'   #  0xB9 -> ARABIC LETTER TEH INITIAL FORM\r
+    u'\ufb66'   #  0xBA -> ARABIC LETTER TTEH ISOLATED FORM\r
+    u'\ufb68'   #  0xBB -> ARABIC LETTER TTEH INITIAL FORM\r
+    u'\ufe99'   #  0xBC -> ARABIC LETTER THEH ISOLATED FORM\r
+    u'\ufe9b'   #  0xBD -> ARABIC LETTER THEH INITIAL FORM\r
+    u'\ufe9d'   #  0xBE -> ARABIC LETTER JEEM ISOLATED FORM\r
+    u'\ufe9f'   #  0xBF -> ARABIC LETTER JEEM INITIAL FORM\r
+    u'\ufb7a'   #  0xC0 -> ARABIC LETTER TCHEH ISOLATED FORM\r
+    u'\ufb7c'   #  0xC1 -> ARABIC LETTER TCHEH INITIAL FORM\r
+    u'\ufea1'   #  0xC2 -> ARABIC LETTER HAH ISOLATED FORM\r
+    u'\ufea3'   #  0xC3 -> ARABIC LETTER HAH INITIAL FORM\r
+    u'\ufea5'   #  0xC4 -> ARABIC LETTER KHAH ISOLATED FORM\r
+    u'\ufea7'   #  0xC5 -> ARABIC LETTER KHAH INITIAL FORM\r
+    u'\ufea9'   #  0xC6 -> ARABIC LETTER DAL ISOLATED FORM\r
+    u'\ufb84'   #  0xC7 -> ARABIC LETTER DAHAL ISOLATED FORMN\r
+    u'\ufeab'   #  0xC8 -> ARABIC LETTER THAL ISOLATED FORM\r
+    u'\ufead'   #  0xC9 -> ARABIC LETTER REH ISOLATED FORM\r
+    u'\ufb8c'   #  0xCA -> ARABIC LETTER RREH ISOLATED FORM\r
+    u'\ufeaf'   #  0xCB -> ARABIC LETTER ZAIN ISOLATED FORM\r
+    u'\ufb8a'   #  0xCC -> ARABIC LETTER JEH ISOLATED FORM\r
+    u'\ufeb1'   #  0xCD -> ARABIC LETTER SEEN ISOLATED FORM\r
+    u'\ufeb3'   #  0xCE -> ARABIC LETTER SEEN INITIAL FORM\r
+    u'\ufeb5'   #  0xCF -> ARABIC LETTER SHEEN ISOLATED FORM\r
+    u'\ufeb7'   #  0xD0 -> ARABIC LETTER SHEEN INITIAL FORM\r
+    u'\ufeb9'   #  0xD1 -> ARABIC LETTER SAD ISOLATED FORM\r
+    u'\ufebb'   #  0xD2 -> ARABIC LETTER SAD INITIAL FORM\r
+    u'\ufebd'   #  0xD3 -> ARABIC LETTER DAD ISOLATED FORM\r
+    u'\ufebf'   #  0xD4 -> ARABIC LETTER DAD INITIAL FORM\r
+    u'\ufec1'   #  0xD5 -> ARABIC LETTER TAH ISOLATED FORM\r
+    u'\ufec5'   #  0xD6 -> ARABIC LETTER ZAH ISOLATED FORM\r
+    u'\ufec9'   #  0xD7 -> ARABIC LETTER AIN ISOLATED FORM\r
+    u'\ufeca'   #  0xD8 -> ARABIC LETTER AIN FINAL FORM\r
+    u'\ufecb'   #  0xD9 -> ARABIC LETTER AIN INITIAL FORM\r
+    u'\ufecc'   #  0xDA -> ARABIC LETTER AIN MEDIAL FORM\r
+    u'\ufecd'   #  0xDB -> ARABIC LETTER GHAIN ISOLATED FORM\r
+    u'\ufece'   #  0xDC -> ARABIC LETTER GHAIN FINAL FORM\r
+    u'\ufecf'   #  0xDD -> ARABIC LETTER GHAIN INITIAL FORM\r
+    u'\ufed0'   #  0xDE -> ARABIC LETTER GHAIN MEDIAL FORM\r
+    u'\ufed1'   #  0xDF -> ARABIC LETTER FEH ISOLATED FORM\r
+    u'\ufed3'   #  0xE0 -> ARABIC LETTER FEH INITIAL FORM\r
+    u'\ufed5'   #  0xE1 -> ARABIC LETTER QAF ISOLATED FORM\r
+    u'\ufed7'   #  0xE2 -> ARABIC LETTER QAF INITIAL FORM\r
+    u'\ufed9'   #  0xE3 -> ARABIC LETTER KAF ISOLATED FORM\r
+    u'\ufedb'   #  0xE4 -> ARABIC LETTER KAF INITIAL FORM\r
+    u'\ufb92'   #  0xE5 -> ARABIC LETTER GAF ISOLATED FORM\r
+    u'\ufb94'   #  0xE6 -> ARABIC LETTER GAF INITIAL FORM\r
+    u'\ufedd'   #  0xE7 -> ARABIC LETTER LAM ISOLATED FORM\r
+    u'\ufedf'   #  0xE8 -> ARABIC LETTER LAM INITIAL FORM\r
+    u'\ufee0'   #  0xE9 -> ARABIC LETTER LAM MEDIAL FORM\r
+    u'\ufee1'   #  0xEA -> ARABIC LETTER MEEM ISOLATED FORM\r
+    u'\ufee3'   #  0xEB -> ARABIC LETTER MEEM INITIAL FORM\r
+    u'\ufb9e'   #  0xEC -> ARABIC LETTER NOON GHUNNA ISOLATED FORM\r
+    u'\ufee5'   #  0xED -> ARABIC LETTER NOON ISOLATED FORM\r
+    u'\ufee7'   #  0xEE -> ARABIC LETTER NOON INITIAL FORM\r
+    u'\ufe85'   #  0xEF -> ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM\r
+    u'\ufeed'   #  0xF0 -> ARABIC LETTER WAW ISOLATED FORM\r
+    u'\ufba6'   #  0xF1 -> ARABIC LETTER HEH GOAL ISOLATED FORM\r
+    u'\ufba8'   #  0xF2 -> ARABIC LETTER HEH GOAL INITIAL FORM\r
+    u'\ufba9'   #  0xF3 -> ARABIC LETTER HEH GOAL MEDIAL FORM\r
+    u'\ufbaa'   #  0xF4 -> ARABIC LETTER HEH DOACHASHMEE ISOLATED FORM\r
+    u'\ufe80'   #  0xF5 -> ARABIC LETTER HAMZA ISOLATED FORM\r
+    u'\ufe89'   #  0xF6 -> ARABIC LETTER YEH WITH HAMZA ABOVE ISOLATED FORM\r
+    u'\ufe8a'   #  0xF7 -> ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM\r
+    u'\ufe8b'   #  0xF8 -> ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM\r
+    u'\ufef1'   #  0xF9 -> ARABIC LETTER YEH ISOLATED FORM\r
+    u'\ufef2'   #  0xFA -> ARABIC LETTER YEH FINAL FORM\r
+    u'\ufef3'   #  0xFB -> ARABIC LETTER YEH INITIAL FORM\r
+    u'\ufbb0'   #  0xFC -> ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM\r
+    u'\ufbae'   #  0xFD -> ARABIC LETTER YEH BARREE ISOLATED FORM\r
+    u'\ufe7c'   #  0xFE -> ARABIC SHADDA ISOLATED FORM\r
+    u'\ufe7d'   #  0xFF -> ARABIC SHADDA MEDIAL FORM\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1026.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1026.py
new file mode 100644 (file)
index 0000000..bc2a890
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1026 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP1026.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1026',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x9c'     #  0x04 -> CONTROL\r
+    u'\t'       #  0x05 -> HORIZONTAL TABULATION\r
+    u'\x86'     #  0x06 -> CONTROL\r
+    u'\x7f'     #  0x07 -> DELETE\r
+    u'\x97'     #  0x08 -> CONTROL\r
+    u'\x8d'     #  0x09 -> CONTROL\r
+    u'\x8e'     #  0x0A -> CONTROL\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x9d'     #  0x14 -> CONTROL\r
+    u'\x85'     #  0x15 -> CONTROL\r
+    u'\x08'     #  0x16 -> BACKSPACE\r
+    u'\x87'     #  0x17 -> CONTROL\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x92'     #  0x1A -> CONTROL\r
+    u'\x8f'     #  0x1B -> CONTROL\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u'\x80'     #  0x20 -> CONTROL\r
+    u'\x81'     #  0x21 -> CONTROL\r
+    u'\x82'     #  0x22 -> CONTROL\r
+    u'\x83'     #  0x23 -> CONTROL\r
+    u'\x84'     #  0x24 -> CONTROL\r
+    u'\n'       #  0x25 -> LINE FEED\r
+    u'\x17'     #  0x26 -> END OF TRANSMISSION BLOCK\r
+    u'\x1b'     #  0x27 -> ESCAPE\r
+    u'\x88'     #  0x28 -> CONTROL\r
+    u'\x89'     #  0x29 -> CONTROL\r
+    u'\x8a'     #  0x2A -> CONTROL\r
+    u'\x8b'     #  0x2B -> CONTROL\r
+    u'\x8c'     #  0x2C -> CONTROL\r
+    u'\x05'     #  0x2D -> ENQUIRY\r
+    u'\x06'     #  0x2E -> ACKNOWLEDGE\r
+    u'\x07'     #  0x2F -> BELL\r
+    u'\x90'     #  0x30 -> CONTROL\r
+    u'\x91'     #  0x31 -> CONTROL\r
+    u'\x16'     #  0x32 -> SYNCHRONOUS IDLE\r
+    u'\x93'     #  0x33 -> CONTROL\r
+    u'\x94'     #  0x34 -> CONTROL\r
+    u'\x95'     #  0x35 -> CONTROL\r
+    u'\x96'     #  0x36 -> CONTROL\r
+    u'\x04'     #  0x37 -> END OF TRANSMISSION\r
+    u'\x98'     #  0x38 -> CONTROL\r
+    u'\x99'     #  0x39 -> CONTROL\r
+    u'\x9a'     #  0x3A -> CONTROL\r
+    u'\x9b'     #  0x3B -> CONTROL\r
+    u'\x14'     #  0x3C -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x3D -> NEGATIVE ACKNOWLEDGE\r
+    u'\x9e'     #  0x3E -> CONTROL\r
+    u'\x1a'     #  0x3F -> SUBSTITUTE\r
+    u' '        #  0x40 -> SPACE\r
+    u'\xa0'     #  0x41 -> NO-BREAK SPACE\r
+    u'\xe2'     #  0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x43 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe0'     #  0x44 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0x45 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe3'     #  0x46 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe5'     #  0x47 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'{'        #  0x48 -> LEFT CURLY BRACKET\r
+    u'\xf1'     #  0x49 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xc7'     #  0x4A -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'.'        #  0x4B -> FULL STOP\r
+    u'<'        #  0x4C -> LESS-THAN SIGN\r
+    u'('        #  0x4D -> LEFT PARENTHESIS\r
+    u'+'        #  0x4E -> PLUS SIGN\r
+    u'!'        #  0x4F -> EXCLAMATION MARK\r
+    u'&'        #  0x50 -> AMPERSAND\r
+    u'\xe9'     #  0x51 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x53 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x54 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xed'     #  0x55 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x57 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xec'     #  0x58 -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xdf'     #  0x59 -> LATIN SMALL LETTER SHARP S (GERMAN)\r
+    u'\u011e'   #  0x5A -> LATIN CAPITAL LETTER G WITH BREVE\r
+    u'\u0130'   #  0x5B -> LATIN CAPITAL LETTER I WITH DOT ABOVE\r
+    u'*'        #  0x5C -> ASTERISK\r
+    u')'        #  0x5D -> RIGHT PARENTHESIS\r
+    u';'        #  0x5E -> SEMICOLON\r
+    u'^'        #  0x5F -> CIRCUMFLEX ACCENT\r
+    u'-'        #  0x60 -> HYPHEN-MINUS\r
+    u'/'        #  0x61 -> SOLIDUS\r
+    u'\xc2'     #  0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc4'     #  0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc0'     #  0x64 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0x65 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc3'     #  0x66 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc5'     #  0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'['        #  0x68 -> LEFT SQUARE BRACKET\r
+    u'\xd1'     #  0x69 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\u015f'   #  0x6A -> LATIN SMALL LETTER S WITH CEDILLA\r
+    u','        #  0x6B -> COMMA\r
+    u'%'        #  0x6C -> PERCENT SIGN\r
+    u'_'        #  0x6D -> LOW LINE\r
+    u'>'        #  0x6E -> GREATER-THAN SIGN\r
+    u'?'        #  0x6F -> QUESTION MARK\r
+    u'\xf8'     #  0x70 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xc9'     #  0x71 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0x74 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xcd'     #  0x75 -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xcc'     #  0x78 -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\u0131'   #  0x79 -> LATIN SMALL LETTER DOTLESS I\r
+    u':'        #  0x7A -> COLON\r
+    u'\xd6'     #  0x7B -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\u015e'   #  0x7C -> LATIN CAPITAL LETTER S WITH CEDILLA\r
+    u"'"        #  0x7D -> APOSTROPHE\r
+    u'='        #  0x7E -> EQUALS SIGN\r
+    u'\xdc'     #  0x7F -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xd8'     #  0x80 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'a'        #  0x81 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x82 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x83 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x84 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x85 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x86 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x87 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x88 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x89 -> LATIN SMALL LETTER I\r
+    u'\xab'     #  0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'}'        #  0x8C -> RIGHT CURLY BRACKET\r
+    u'`'        #  0x8D -> GRAVE ACCENT\r
+    u'\xa6'     #  0x8E -> BROKEN BAR\r
+    u'\xb1'     #  0x8F -> PLUS-MINUS SIGN\r
+    u'\xb0'     #  0x90 -> DEGREE SIGN\r
+    u'j'        #  0x91 -> LATIN SMALL LETTER J\r
+    u'k'        #  0x92 -> LATIN SMALL LETTER K\r
+    u'l'        #  0x93 -> LATIN SMALL LETTER L\r
+    u'm'        #  0x94 -> LATIN SMALL LETTER M\r
+    u'n'        #  0x95 -> LATIN SMALL LETTER N\r
+    u'o'        #  0x96 -> LATIN SMALL LETTER O\r
+    u'p'        #  0x97 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x98 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x99 -> LATIN SMALL LETTER R\r
+    u'\xaa'     #  0x9A -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0x9B -> MASCULINE ORDINAL INDICATOR\r
+    u'\xe6'     #  0x9C -> LATIN SMALL LIGATURE AE\r
+    u'\xb8'     #  0x9D -> CEDILLA\r
+    u'\xc6'     #  0x9E -> LATIN CAPITAL LIGATURE AE\r
+    u'\xa4'     #  0x9F -> CURRENCY SIGN\r
+    u'\xb5'     #  0xA0 -> MICRO SIGN\r
+    u'\xf6'     #  0xA1 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u's'        #  0xA2 -> LATIN SMALL LETTER S\r
+    u't'        #  0xA3 -> LATIN SMALL LETTER T\r
+    u'u'        #  0xA4 -> LATIN SMALL LETTER U\r
+    u'v'        #  0xA5 -> LATIN SMALL LETTER V\r
+    u'w'        #  0xA6 -> LATIN SMALL LETTER W\r
+    u'x'        #  0xA7 -> LATIN SMALL LETTER X\r
+    u'y'        #  0xA8 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0xA9 -> LATIN SMALL LETTER Z\r
+    u'\xa1'     #  0xAA -> INVERTED EXCLAMATION MARK\r
+    u'\xbf'     #  0xAB -> INVERTED QUESTION MARK\r
+    u']'        #  0xAC -> RIGHT SQUARE BRACKET\r
+    u'$'        #  0xAD -> DOLLAR SIGN\r
+    u'@'        #  0xAE -> COMMERCIAL AT\r
+    u'\xae'     #  0xAF -> REGISTERED SIGN\r
+    u'\xa2'     #  0xB0 -> CENT SIGN\r
+    u'\xa3'     #  0xB1 -> POUND SIGN\r
+    u'\xa5'     #  0xB2 -> YEN SIGN\r
+    u'\xb7'     #  0xB3 -> MIDDLE DOT\r
+    u'\xa9'     #  0xB4 -> COPYRIGHT SIGN\r
+    u'\xa7'     #  0xB5 -> SECTION SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xbc'     #  0xB7 -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xB8 -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xB9 -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xac'     #  0xBA -> NOT SIGN\r
+    u'|'        #  0xBB -> VERTICAL LINE\r
+    u'\xaf'     #  0xBC -> MACRON\r
+    u'\xa8'     #  0xBD -> DIAERESIS\r
+    u'\xb4'     #  0xBE -> ACUTE ACCENT\r
+    u'\xd7'     #  0xBF -> MULTIPLICATION SIGN\r
+    u'\xe7'     #  0xC0 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'A'        #  0xC1 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0xC2 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0xC3 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0xC4 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0xC5 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0xC6 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0xC7 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0xC8 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0xC9 -> LATIN CAPITAL LETTER I\r
+    u'\xad'     #  0xCA -> SOFT HYPHEN\r
+    u'\xf4'     #  0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'~'        #  0xCC -> TILDE\r
+    u'\xf2'     #  0xCD -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xCE -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf5'     #  0xCF -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\u011f'   #  0xD0 -> LATIN SMALL LETTER G WITH BREVE\r
+    u'J'        #  0xD1 -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0xD2 -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0xD3 -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0xD4 -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0xD5 -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0xD6 -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0xD7 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0xD8 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0xD9 -> LATIN CAPITAL LETTER R\r
+    u'\xb9'     #  0xDA -> SUPERSCRIPT ONE\r
+    u'\xfb'     #  0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\\'       #  0xDC -> REVERSE SOLIDUS\r
+    u'\xf9'     #  0xDD -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xDE -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xff'     #  0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\xfc'     #  0xE0 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xf7'     #  0xE1 -> DIVISION SIGN\r
+    u'S'        #  0xE2 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0xE3 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0xE4 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0xE5 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0xE6 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0xE7 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0xE8 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0xE9 -> LATIN CAPITAL LETTER Z\r
+    u'\xb2'     #  0xEA -> SUPERSCRIPT TWO\r
+    u'\xd4'     #  0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'#'        #  0xEC -> NUMBER SIGN\r
+    u'\xd2'     #  0xED -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xEE -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd5'     #  0xEF -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'0'        #  0xF0 -> DIGIT ZERO\r
+    u'1'        #  0xF1 -> DIGIT ONE\r
+    u'2'        #  0xF2 -> DIGIT TWO\r
+    u'3'        #  0xF3 -> DIGIT THREE\r
+    u'4'        #  0xF4 -> DIGIT FOUR\r
+    u'5'        #  0xF5 -> DIGIT FIVE\r
+    u'6'        #  0xF6 -> DIGIT SIX\r
+    u'7'        #  0xF7 -> DIGIT SEVEN\r
+    u'8'        #  0xF8 -> DIGIT EIGHT\r
+    u'9'        #  0xF9 -> DIGIT NINE\r
+    u'\xb3'     #  0xFA -> SUPERSCRIPT THREE\r
+    u'\xdb'     #  0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'"'        #  0xFC -> QUOTATION MARK\r
+    u'\xd9'     #  0xFD -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xFE -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\x9f'     #  0xFF -> CONTROL\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1140.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1140.py
new file mode 100644 (file)
index 0000000..0b918c6
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1140 generated from 'python-mappings/CP1140.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1140',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x9c'     #  0x04 -> CONTROL\r
+    u'\t'       #  0x05 -> HORIZONTAL TABULATION\r
+    u'\x86'     #  0x06 -> CONTROL\r
+    u'\x7f'     #  0x07 -> DELETE\r
+    u'\x97'     #  0x08 -> CONTROL\r
+    u'\x8d'     #  0x09 -> CONTROL\r
+    u'\x8e'     #  0x0A -> CONTROL\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x9d'     #  0x14 -> CONTROL\r
+    u'\x85'     #  0x15 -> CONTROL\r
+    u'\x08'     #  0x16 -> BACKSPACE\r
+    u'\x87'     #  0x17 -> CONTROL\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x92'     #  0x1A -> CONTROL\r
+    u'\x8f'     #  0x1B -> CONTROL\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u'\x80'     #  0x20 -> CONTROL\r
+    u'\x81'     #  0x21 -> CONTROL\r
+    u'\x82'     #  0x22 -> CONTROL\r
+    u'\x83'     #  0x23 -> CONTROL\r
+    u'\x84'     #  0x24 -> CONTROL\r
+    u'\n'       #  0x25 -> LINE FEED\r
+    u'\x17'     #  0x26 -> END OF TRANSMISSION BLOCK\r
+    u'\x1b'     #  0x27 -> ESCAPE\r
+    u'\x88'     #  0x28 -> CONTROL\r
+    u'\x89'     #  0x29 -> CONTROL\r
+    u'\x8a'     #  0x2A -> CONTROL\r
+    u'\x8b'     #  0x2B -> CONTROL\r
+    u'\x8c'     #  0x2C -> CONTROL\r
+    u'\x05'     #  0x2D -> ENQUIRY\r
+    u'\x06'     #  0x2E -> ACKNOWLEDGE\r
+    u'\x07'     #  0x2F -> BELL\r
+    u'\x90'     #  0x30 -> CONTROL\r
+    u'\x91'     #  0x31 -> CONTROL\r
+    u'\x16'     #  0x32 -> SYNCHRONOUS IDLE\r
+    u'\x93'     #  0x33 -> CONTROL\r
+    u'\x94'     #  0x34 -> CONTROL\r
+    u'\x95'     #  0x35 -> CONTROL\r
+    u'\x96'     #  0x36 -> CONTROL\r
+    u'\x04'     #  0x37 -> END OF TRANSMISSION\r
+    u'\x98'     #  0x38 -> CONTROL\r
+    u'\x99'     #  0x39 -> CONTROL\r
+    u'\x9a'     #  0x3A -> CONTROL\r
+    u'\x9b'     #  0x3B -> CONTROL\r
+    u'\x14'     #  0x3C -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x3D -> NEGATIVE ACKNOWLEDGE\r
+    u'\x9e'     #  0x3E -> CONTROL\r
+    u'\x1a'     #  0x3F -> SUBSTITUTE\r
+    u' '        #  0x40 -> SPACE\r
+    u'\xa0'     #  0x41 -> NO-BREAK SPACE\r
+    u'\xe2'     #  0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x43 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe0'     #  0x44 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0x45 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe3'     #  0x46 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe5'     #  0x47 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x48 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xf1'     #  0x49 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xa2'     #  0x4A -> CENT SIGN\r
+    u'.'        #  0x4B -> FULL STOP\r
+    u'<'        #  0x4C -> LESS-THAN SIGN\r
+    u'('        #  0x4D -> LEFT PARENTHESIS\r
+    u'+'        #  0x4E -> PLUS SIGN\r
+    u'|'        #  0x4F -> VERTICAL LINE\r
+    u'&'        #  0x50 -> AMPERSAND\r
+    u'\xe9'     #  0x51 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x53 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x54 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xed'     #  0x55 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x57 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xec'     #  0x58 -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xdf'     #  0x59 -> LATIN SMALL LETTER SHARP S (GERMAN)\r
+    u'!'        #  0x5A -> EXCLAMATION MARK\r
+    u'$'        #  0x5B -> DOLLAR SIGN\r
+    u'*'        #  0x5C -> ASTERISK\r
+    u')'        #  0x5D -> RIGHT PARENTHESIS\r
+    u';'        #  0x5E -> SEMICOLON\r
+    u'\xac'     #  0x5F -> NOT SIGN\r
+    u'-'        #  0x60 -> HYPHEN-MINUS\r
+    u'/'        #  0x61 -> SOLIDUS\r
+    u'\xc2'     #  0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc4'     #  0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc0'     #  0x64 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0x65 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc3'     #  0x66 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc5'     #  0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc7'     #  0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xd1'     #  0x69 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xa6'     #  0x6A -> BROKEN BAR\r
+    u','        #  0x6B -> COMMA\r
+    u'%'        #  0x6C -> PERCENT SIGN\r
+    u'_'        #  0x6D -> LOW LINE\r
+    u'>'        #  0x6E -> GREATER-THAN SIGN\r
+    u'?'        #  0x6F -> QUESTION MARK\r
+    u'\xf8'     #  0x70 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xc9'     #  0x71 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0x74 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xcd'     #  0x75 -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xcc'     #  0x78 -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'`'        #  0x79 -> GRAVE ACCENT\r
+    u':'        #  0x7A -> COLON\r
+    u'#'        #  0x7B -> NUMBER SIGN\r
+    u'@'        #  0x7C -> COMMERCIAL AT\r
+    u"'"        #  0x7D -> APOSTROPHE\r
+    u'='        #  0x7E -> EQUALS SIGN\r
+    u'"'        #  0x7F -> QUOTATION MARK\r
+    u'\xd8'     #  0x80 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'a'        #  0x81 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x82 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x83 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x84 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x85 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x86 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x87 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x88 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x89 -> LATIN SMALL LETTER I\r
+    u'\xab'     #  0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xf0'     #  0x8C -> LATIN SMALL LETTER ETH (ICELANDIC)\r
+    u'\xfd'     #  0x8D -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xfe'     #  0x8E -> LATIN SMALL LETTER THORN (ICELANDIC)\r
+    u'\xb1'     #  0x8F -> PLUS-MINUS SIGN\r
+    u'\xb0'     #  0x90 -> DEGREE SIGN\r
+    u'j'        #  0x91 -> LATIN SMALL LETTER J\r
+    u'k'        #  0x92 -> LATIN SMALL LETTER K\r
+    u'l'        #  0x93 -> LATIN SMALL LETTER L\r
+    u'm'        #  0x94 -> LATIN SMALL LETTER M\r
+    u'n'        #  0x95 -> LATIN SMALL LETTER N\r
+    u'o'        #  0x96 -> LATIN SMALL LETTER O\r
+    u'p'        #  0x97 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x98 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x99 -> LATIN SMALL LETTER R\r
+    u'\xaa'     #  0x9A -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0x9B -> MASCULINE ORDINAL INDICATOR\r
+    u'\xe6'     #  0x9C -> LATIN SMALL LIGATURE AE\r
+    u'\xb8'     #  0x9D -> CEDILLA\r
+    u'\xc6'     #  0x9E -> LATIN CAPITAL LIGATURE AE\r
+    u'\u20ac'   #  0x9F -> EURO SIGN\r
+    u'\xb5'     #  0xA0 -> MICRO SIGN\r
+    u'~'        #  0xA1 -> TILDE\r
+    u's'        #  0xA2 -> LATIN SMALL LETTER S\r
+    u't'        #  0xA3 -> LATIN SMALL LETTER T\r
+    u'u'        #  0xA4 -> LATIN SMALL LETTER U\r
+    u'v'        #  0xA5 -> LATIN SMALL LETTER V\r
+    u'w'        #  0xA6 -> LATIN SMALL LETTER W\r
+    u'x'        #  0xA7 -> LATIN SMALL LETTER X\r
+    u'y'        #  0xA8 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0xA9 -> LATIN SMALL LETTER Z\r
+    u'\xa1'     #  0xAA -> INVERTED EXCLAMATION MARK\r
+    u'\xbf'     #  0xAB -> INVERTED QUESTION MARK\r
+    u'\xd0'     #  0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC)\r
+    u'\xdd'     #  0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xde'     #  0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC)\r
+    u'\xae'     #  0xAF -> REGISTERED SIGN\r
+    u'^'        #  0xB0 -> CIRCUMFLEX ACCENT\r
+    u'\xa3'     #  0xB1 -> POUND SIGN\r
+    u'\xa5'     #  0xB2 -> YEN SIGN\r
+    u'\xb7'     #  0xB3 -> MIDDLE DOT\r
+    u'\xa9'     #  0xB4 -> COPYRIGHT SIGN\r
+    u'\xa7'     #  0xB5 -> SECTION SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xbc'     #  0xB7 -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xB8 -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xB9 -> VULGAR FRACTION THREE QUARTERS\r
+    u'['        #  0xBA -> LEFT SQUARE BRACKET\r
+    u']'        #  0xBB -> RIGHT SQUARE BRACKET\r
+    u'\xaf'     #  0xBC -> MACRON\r
+    u'\xa8'     #  0xBD -> DIAERESIS\r
+    u'\xb4'     #  0xBE -> ACUTE ACCENT\r
+    u'\xd7'     #  0xBF -> MULTIPLICATION SIGN\r
+    u'{'        #  0xC0 -> LEFT CURLY BRACKET\r
+    u'A'        #  0xC1 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0xC2 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0xC3 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0xC4 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0xC5 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0xC6 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0xC7 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0xC8 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0xC9 -> LATIN CAPITAL LETTER I\r
+    u'\xad'     #  0xCA -> SOFT HYPHEN\r
+    u'\xf4'     #  0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0xCC -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf2'     #  0xCD -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xCE -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf5'     #  0xCF -> LATIN SMALL LETTER O WITH TILDE\r
+    u'}'        #  0xD0 -> RIGHT CURLY BRACKET\r
+    u'J'        #  0xD1 -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0xD2 -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0xD3 -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0xD4 -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0xD5 -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0xD6 -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0xD7 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0xD8 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0xD9 -> LATIN CAPITAL LETTER R\r
+    u'\xb9'     #  0xDA -> SUPERSCRIPT ONE\r
+    u'\xfb'     #  0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xDC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xf9'     #  0xDD -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xDE -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xff'     #  0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\\'       #  0xE0 -> REVERSE SOLIDUS\r
+    u'\xf7'     #  0xE1 -> DIVISION SIGN\r
+    u'S'        #  0xE2 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0xE3 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0xE4 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0xE5 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0xE6 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0xE7 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0xE8 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0xE9 -> LATIN CAPITAL LETTER Z\r
+    u'\xb2'     #  0xEA -> SUPERSCRIPT TWO\r
+    u'\xd4'     #  0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd6'     #  0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd2'     #  0xED -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xEE -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd5'     #  0xEF -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'0'        #  0xF0 -> DIGIT ZERO\r
+    u'1'        #  0xF1 -> DIGIT ONE\r
+    u'2'        #  0xF2 -> DIGIT TWO\r
+    u'3'        #  0xF3 -> DIGIT THREE\r
+    u'4'        #  0xF4 -> DIGIT FOUR\r
+    u'5'        #  0xF5 -> DIGIT FIVE\r
+    u'6'        #  0xF6 -> DIGIT SIX\r
+    u'7'        #  0xF7 -> DIGIT SEVEN\r
+    u'8'        #  0xF8 -> DIGIT EIGHT\r
+    u'9'        #  0xF9 -> DIGIT NINE\r
+    u'\xb3'     #  0xFA -> SUPERSCRIPT THREE\r
+    u'\xdb'     #  0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xd9'     #  0xFD -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xFE -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\x9f'     #  0xFF -> CONTROL\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1250.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1250.py
new file mode 100644 (file)
index 0000000..c6041e0
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1250 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1250',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u20ac'   #  0x80 -> EURO SIGN\r
+    u'\ufffe'   #  0x81 -> UNDEFINED\r
+    u'\u201a'   #  0x82 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\ufffe'   #  0x83 -> UNDEFINED\r
+    u'\u201e'   #  0x84 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2026'   #  0x85 -> HORIZONTAL ELLIPSIS\r
+    u'\u2020'   #  0x86 -> DAGGER\r
+    u'\u2021'   #  0x87 -> DOUBLE DAGGER\r
+    u'\ufffe'   #  0x88 -> UNDEFINED\r
+    u'\u2030'   #  0x89 -> PER MILLE SIGN\r
+    u'\u0160'   #  0x8A -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u2039'   #  0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\u015a'   #  0x8C -> LATIN CAPITAL LETTER S WITH ACUTE\r
+    u'\u0164'   #  0x8D -> LATIN CAPITAL LETTER T WITH CARON\r
+    u'\u017d'   #  0x8E -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\u0179'   #  0x8F -> LATIN CAPITAL LETTER Z WITH ACUTE\r
+    u'\ufffe'   #  0x90 -> UNDEFINED\r
+    u'\u2018'   #  0x91 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x92 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u201c'   #  0x93 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0x94 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2022'   #  0x95 -> BULLET\r
+    u'\u2013'   #  0x96 -> EN DASH\r
+    u'\u2014'   #  0x97 -> EM DASH\r
+    u'\ufffe'   #  0x98 -> UNDEFINED\r
+    u'\u2122'   #  0x99 -> TRADE MARK SIGN\r
+    u'\u0161'   #  0x9A -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u203a'   #  0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\u015b'   #  0x9C -> LATIN SMALL LETTER S WITH ACUTE\r
+    u'\u0165'   #  0x9D -> LATIN SMALL LETTER T WITH CARON\r
+    u'\u017e'   #  0x9E -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u017a'   #  0x9F -> LATIN SMALL LETTER Z WITH ACUTE\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u02c7'   #  0xA1 -> CARON\r
+    u'\u02d8'   #  0xA2 -> BREVE\r
+    u'\u0141'   #  0xA3 -> LATIN CAPITAL LETTER L WITH STROKE\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\u0104'   #  0xA5 -> LATIN CAPITAL LETTER A WITH OGONEK\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u015e'   #  0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\u017b'   #  0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\u02db'   #  0xB2 -> OGONEK\r
+    u'\u0142'   #  0xB3 -> LATIN SMALL LETTER L WITH STROKE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\u0105'   #  0xB9 -> LATIN SMALL LETTER A WITH OGONEK\r
+    u'\u015f'   #  0xBA -> LATIN SMALL LETTER S WITH CEDILLA\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u013d'   #  0xBC -> LATIN CAPITAL LETTER L WITH CARON\r
+    u'\u02dd'   #  0xBD -> DOUBLE ACUTE ACCENT\r
+    u'\u013e'   #  0xBE -> LATIN SMALL LETTER L WITH CARON\r
+    u'\u017c'   #  0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    u'\u0154'   #  0xC0 -> LATIN CAPITAL LETTER R WITH ACUTE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\u0102'   #  0xC3 -> LATIN CAPITAL LETTER A WITH BREVE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\u0139'   #  0xC5 -> LATIN CAPITAL LETTER L WITH ACUTE\r
+    u'\u0106'   #  0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\u010c'   #  0xC8 -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\u0118'   #  0xCA -> LATIN CAPITAL LETTER E WITH OGONEK\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\u011a'   #  0xCC -> LATIN CAPITAL LETTER E WITH CARON\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\u010e'   #  0xCF -> LATIN CAPITAL LETTER D WITH CARON\r
+    u'\u0110'   #  0xD0 -> LATIN CAPITAL LETTER D WITH STROKE\r
+    u'\u0143'   #  0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE\r
+    u'\u0147'   #  0xD2 -> LATIN CAPITAL LETTER N WITH CARON\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\u0150'   #  0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\u0158'   #  0xD8 -> LATIN CAPITAL LETTER R WITH CARON\r
+    u'\u016e'   #  0xD9 -> LATIN CAPITAL LETTER U WITH RING ABOVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\u0170'   #  0xDB -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xdd'     #  0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\u0162'   #  0xDE -> LATIN CAPITAL LETTER T WITH CEDILLA\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\u0155'   #  0xE0 -> LATIN SMALL LETTER R WITH ACUTE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\u0103'   #  0xE3 -> LATIN SMALL LETTER A WITH BREVE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\u013a'   #  0xE5 -> LATIN SMALL LETTER L WITH ACUTE\r
+    u'\u0107'   #  0xE6 -> LATIN SMALL LETTER C WITH ACUTE\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\u010d'   #  0xE8 -> LATIN SMALL LETTER C WITH CARON\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\u0119'   #  0xEA -> LATIN SMALL LETTER E WITH OGONEK\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\u011b'   #  0xEC -> LATIN SMALL LETTER E WITH CARON\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\u010f'   #  0xEF -> LATIN SMALL LETTER D WITH CARON\r
+    u'\u0111'   #  0xF0 -> LATIN SMALL LETTER D WITH STROKE\r
+    u'\u0144'   #  0xF1 -> LATIN SMALL LETTER N WITH ACUTE\r
+    u'\u0148'   #  0xF2 -> LATIN SMALL LETTER N WITH CARON\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\u0151'   #  0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\u0159'   #  0xF8 -> LATIN SMALL LETTER R WITH CARON\r
+    u'\u016f'   #  0xF9 -> LATIN SMALL LETTER U WITH RING ABOVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\u0171'   #  0xFB -> LATIN SMALL LETTER U WITH DOUBLE ACUTE\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xfd'     #  0xFD -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\u0163'   #  0xFE -> LATIN SMALL LETTER T WITH CEDILLA\r
+    u'\u02d9'   #  0xFF -> DOT ABOVE\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1251.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1251.py
new file mode 100644 (file)
index 0000000..be9fec5
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1251 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1251',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u0402'   #  0x80 -> CYRILLIC CAPITAL LETTER DJE\r
+    u'\u0403'   #  0x81 -> CYRILLIC CAPITAL LETTER GJE\r
+    u'\u201a'   #  0x82 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u0453'   #  0x83 -> CYRILLIC SMALL LETTER GJE\r
+    u'\u201e'   #  0x84 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2026'   #  0x85 -> HORIZONTAL ELLIPSIS\r
+    u'\u2020'   #  0x86 -> DAGGER\r
+    u'\u2021'   #  0x87 -> DOUBLE DAGGER\r
+    u'\u20ac'   #  0x88 -> EURO SIGN\r
+    u'\u2030'   #  0x89 -> PER MILLE SIGN\r
+    u'\u0409'   #  0x8A -> CYRILLIC CAPITAL LETTER LJE\r
+    u'\u2039'   #  0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\u040a'   #  0x8C -> CYRILLIC CAPITAL LETTER NJE\r
+    u'\u040c'   #  0x8D -> CYRILLIC CAPITAL LETTER KJE\r
+    u'\u040b'   #  0x8E -> CYRILLIC CAPITAL LETTER TSHE\r
+    u'\u040f'   #  0x8F -> CYRILLIC CAPITAL LETTER DZHE\r
+    u'\u0452'   #  0x90 -> CYRILLIC SMALL LETTER DJE\r
+    u'\u2018'   #  0x91 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x92 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u201c'   #  0x93 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0x94 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2022'   #  0x95 -> BULLET\r
+    u'\u2013'   #  0x96 -> EN DASH\r
+    u'\u2014'   #  0x97 -> EM DASH\r
+    u'\ufffe'   #  0x98 -> UNDEFINED\r
+    u'\u2122'   #  0x99 -> TRADE MARK SIGN\r
+    u'\u0459'   #  0x9A -> CYRILLIC SMALL LETTER LJE\r
+    u'\u203a'   #  0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\u045a'   #  0x9C -> CYRILLIC SMALL LETTER NJE\r
+    u'\u045c'   #  0x9D -> CYRILLIC SMALL LETTER KJE\r
+    u'\u045b'   #  0x9E -> CYRILLIC SMALL LETTER TSHE\r
+    u'\u045f'   #  0x9F -> CYRILLIC SMALL LETTER DZHE\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u040e'   #  0xA1 -> CYRILLIC CAPITAL LETTER SHORT U\r
+    u'\u045e'   #  0xA2 -> CYRILLIC SMALL LETTER SHORT U\r
+    u'\u0408'   #  0xA3 -> CYRILLIC CAPITAL LETTER JE\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\u0490'   #  0xA5 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\u0401'   #  0xA8 -> CYRILLIC CAPITAL LETTER IO\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u0404'   #  0xAA -> CYRILLIC CAPITAL LETTER UKRAINIAN IE\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\u0407'   #  0xAF -> CYRILLIC CAPITAL LETTER YI\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\u0406'   #  0xB2 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    u'\u0456'   #  0xB3 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    u'\u0491'   #  0xB4 -> CYRILLIC SMALL LETTER GHE WITH UPTURN\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\u0451'   #  0xB8 -> CYRILLIC SMALL LETTER IO\r
+    u'\u2116'   #  0xB9 -> NUMERO SIGN\r
+    u'\u0454'   #  0xBA -> CYRILLIC SMALL LETTER UKRAINIAN IE\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u0458'   #  0xBC -> CYRILLIC SMALL LETTER JE\r
+    u'\u0405'   #  0xBD -> CYRILLIC CAPITAL LETTER DZE\r
+    u'\u0455'   #  0xBE -> CYRILLIC SMALL LETTER DZE\r
+    u'\u0457'   #  0xBF -> CYRILLIC SMALL LETTER YI\r
+    u'\u0410'   #  0xC0 -> CYRILLIC CAPITAL LETTER A\r
+    u'\u0411'   #  0xC1 -> CYRILLIC CAPITAL LETTER BE\r
+    u'\u0412'   #  0xC2 -> CYRILLIC CAPITAL LETTER VE\r
+    u'\u0413'   #  0xC3 -> CYRILLIC CAPITAL LETTER GHE\r
+    u'\u0414'   #  0xC4 -> CYRILLIC CAPITAL LETTER DE\r
+    u'\u0415'   #  0xC5 -> CYRILLIC CAPITAL LETTER IE\r
+    u'\u0416'   #  0xC6 -> CYRILLIC CAPITAL LETTER ZHE\r
+    u'\u0417'   #  0xC7 -> CYRILLIC CAPITAL LETTER ZE\r
+    u'\u0418'   #  0xC8 -> CYRILLIC CAPITAL LETTER I\r
+    u'\u0419'   #  0xC9 -> CYRILLIC CAPITAL LETTER SHORT I\r
+    u'\u041a'   #  0xCA -> CYRILLIC CAPITAL LETTER KA\r
+    u'\u041b'   #  0xCB -> CYRILLIC CAPITAL LETTER EL\r
+    u'\u041c'   #  0xCC -> CYRILLIC CAPITAL LETTER EM\r
+    u'\u041d'   #  0xCD -> CYRILLIC CAPITAL LETTER EN\r
+    u'\u041e'   #  0xCE -> CYRILLIC CAPITAL LETTER O\r
+    u'\u041f'   #  0xCF -> CYRILLIC CAPITAL LETTER PE\r
+    u'\u0420'   #  0xD0 -> CYRILLIC CAPITAL LETTER ER\r
+    u'\u0421'   #  0xD1 -> CYRILLIC CAPITAL LETTER ES\r
+    u'\u0422'   #  0xD2 -> CYRILLIC CAPITAL LETTER TE\r
+    u'\u0423'   #  0xD3 -> CYRILLIC CAPITAL LETTER U\r
+    u'\u0424'   #  0xD4 -> CYRILLIC CAPITAL LETTER EF\r
+    u'\u0425'   #  0xD5 -> CYRILLIC CAPITAL LETTER HA\r
+    u'\u0426'   #  0xD6 -> CYRILLIC CAPITAL LETTER TSE\r
+    u'\u0427'   #  0xD7 -> CYRILLIC CAPITAL LETTER CHE\r
+    u'\u0428'   #  0xD8 -> CYRILLIC CAPITAL LETTER SHA\r
+    u'\u0429'   #  0xD9 -> CYRILLIC CAPITAL LETTER SHCHA\r
+    u'\u042a'   #  0xDA -> CYRILLIC CAPITAL LETTER HARD SIGN\r
+    u'\u042b'   #  0xDB -> CYRILLIC CAPITAL LETTER YERU\r
+    u'\u042c'   #  0xDC -> CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    u'\u042d'   #  0xDD -> CYRILLIC CAPITAL LETTER E\r
+    u'\u042e'   #  0xDE -> CYRILLIC CAPITAL LETTER YU\r
+    u'\u042f'   #  0xDF -> CYRILLIC CAPITAL LETTER YA\r
+    u'\u0430'   #  0xE0 -> CYRILLIC SMALL LETTER A\r
+    u'\u0431'   #  0xE1 -> CYRILLIC SMALL LETTER BE\r
+    u'\u0432'   #  0xE2 -> CYRILLIC SMALL LETTER VE\r
+    u'\u0433'   #  0xE3 -> CYRILLIC SMALL LETTER GHE\r
+    u'\u0434'   #  0xE4 -> CYRILLIC SMALL LETTER DE\r
+    u'\u0435'   #  0xE5 -> CYRILLIC SMALL LETTER IE\r
+    u'\u0436'   #  0xE6 -> CYRILLIC SMALL LETTER ZHE\r
+    u'\u0437'   #  0xE7 -> CYRILLIC SMALL LETTER ZE\r
+    u'\u0438'   #  0xE8 -> CYRILLIC SMALL LETTER I\r
+    u'\u0439'   #  0xE9 -> CYRILLIC SMALL LETTER SHORT I\r
+    u'\u043a'   #  0xEA -> CYRILLIC SMALL LETTER KA\r
+    u'\u043b'   #  0xEB -> CYRILLIC SMALL LETTER EL\r
+    u'\u043c'   #  0xEC -> CYRILLIC SMALL LETTER EM\r
+    u'\u043d'   #  0xED -> CYRILLIC SMALL LETTER EN\r
+    u'\u043e'   #  0xEE -> CYRILLIC SMALL LETTER O\r
+    u'\u043f'   #  0xEF -> CYRILLIC SMALL LETTER PE\r
+    u'\u0440'   #  0xF0 -> CYRILLIC SMALL LETTER ER\r
+    u'\u0441'   #  0xF1 -> CYRILLIC SMALL LETTER ES\r
+    u'\u0442'   #  0xF2 -> CYRILLIC SMALL LETTER TE\r
+    u'\u0443'   #  0xF3 -> CYRILLIC SMALL LETTER U\r
+    u'\u0444'   #  0xF4 -> CYRILLIC SMALL LETTER EF\r
+    u'\u0445'   #  0xF5 -> CYRILLIC SMALL LETTER HA\r
+    u'\u0446'   #  0xF6 -> CYRILLIC SMALL LETTER TSE\r
+    u'\u0447'   #  0xF7 -> CYRILLIC SMALL LETTER CHE\r
+    u'\u0448'   #  0xF8 -> CYRILLIC SMALL LETTER SHA\r
+    u'\u0449'   #  0xF9 -> CYRILLIC SMALL LETTER SHCHA\r
+    u'\u044a'   #  0xFA -> CYRILLIC SMALL LETTER HARD SIGN\r
+    u'\u044b'   #  0xFB -> CYRILLIC SMALL LETTER YERU\r
+    u'\u044c'   #  0xFC -> CYRILLIC SMALL LETTER SOFT SIGN\r
+    u'\u044d'   #  0xFD -> CYRILLIC SMALL LETTER E\r
+    u'\u044e'   #  0xFE -> CYRILLIC SMALL LETTER YU\r
+    u'\u044f'   #  0xFF -> CYRILLIC SMALL LETTER YA\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1252.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1252.py
new file mode 100644 (file)
index 0000000..005a122
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1252 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1252',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u20ac'   #  0x80 -> EURO SIGN\r
+    u'\ufffe'   #  0x81 -> UNDEFINED\r
+    u'\u201a'   #  0x82 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u0192'   #  0x83 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u201e'   #  0x84 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2026'   #  0x85 -> HORIZONTAL ELLIPSIS\r
+    u'\u2020'   #  0x86 -> DAGGER\r
+    u'\u2021'   #  0x87 -> DOUBLE DAGGER\r
+    u'\u02c6'   #  0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT\r
+    u'\u2030'   #  0x89 -> PER MILLE SIGN\r
+    u'\u0160'   #  0x8A -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u2039'   #  0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\u0152'   #  0x8C -> LATIN CAPITAL LIGATURE OE\r
+    u'\ufffe'   #  0x8D -> UNDEFINED\r
+    u'\u017d'   #  0x8E -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\ufffe'   #  0x8F -> UNDEFINED\r
+    u'\ufffe'   #  0x90 -> UNDEFINED\r
+    u'\u2018'   #  0x91 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x92 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u201c'   #  0x93 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0x94 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2022'   #  0x95 -> BULLET\r
+    u'\u2013'   #  0x96 -> EN DASH\r
+    u'\u2014'   #  0x97 -> EM DASH\r
+    u'\u02dc'   #  0x98 -> SMALL TILDE\r
+    u'\u2122'   #  0x99 -> TRADE MARK SIGN\r
+    u'\u0161'   #  0x9A -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u203a'   #  0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\u0153'   #  0x9C -> LATIN SMALL LIGATURE OE\r
+    u'\ufffe'   #  0x9D -> UNDEFINED\r
+    u'\u017e'   #  0x9E -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u0178'   #  0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\xa1'     #  0xA1 -> INVERTED EXCLAMATION MARK\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\xa5'     #  0xA5 -> YEN SIGN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\xaa'     #  0xAA -> FEMININE ORDINAL INDICATOR\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xaf'     #  0xAF -> MACRON\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\xba'     #  0xBA -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbc'     #  0xBC -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xBE -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xbf'     #  0xBF -> INVERTED QUESTION MARK\r
+    u'\xc0'     #  0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc3'     #  0xC3 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc6'     #  0xC6 -> LATIN CAPITAL LETTER AE\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc8'     #  0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xcc'     #  0xCC -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xd0'     #  0xD0 -> LATIN CAPITAL LETTER ETH\r
+    u'\xd1'     #  0xD1 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd2'     #  0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd5'     #  0xD5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\xd8'     #  0xD8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xd9'     #  0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xdd'     #  0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xde'     #  0xDE -> LATIN CAPITAL LETTER THORN\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\xe0'     #  0xE0 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe3'     #  0xE3 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe6'     #  0xE6 -> LATIN SMALL LETTER AE\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe8'     #  0xE8 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xec'     #  0xEC -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf0'     #  0xF0 -> LATIN SMALL LETTER ETH\r
+    u'\xf1'     #  0xF1 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf2'     #  0xF2 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf5'     #  0xF5 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\xf8'     #  0xF8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xf9'     #  0xF9 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xfd'     #  0xFD -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xfe'     #  0xFE -> LATIN SMALL LETTER THORN\r
+    u'\xff'     #  0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1253.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1253.py
new file mode 100644 (file)
index 0000000..ab3abdc
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1253 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1253.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1253',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u20ac'   #  0x80 -> EURO SIGN\r
+    u'\ufffe'   #  0x81 -> UNDEFINED\r
+    u'\u201a'   #  0x82 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u0192'   #  0x83 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u201e'   #  0x84 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2026'   #  0x85 -> HORIZONTAL ELLIPSIS\r
+    u'\u2020'   #  0x86 -> DAGGER\r
+    u'\u2021'   #  0x87 -> DOUBLE DAGGER\r
+    u'\ufffe'   #  0x88 -> UNDEFINED\r
+    u'\u2030'   #  0x89 -> PER MILLE SIGN\r
+    u'\ufffe'   #  0x8A -> UNDEFINED\r
+    u'\u2039'   #  0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\ufffe'   #  0x8C -> UNDEFINED\r
+    u'\ufffe'   #  0x8D -> UNDEFINED\r
+    u'\ufffe'   #  0x8E -> UNDEFINED\r
+    u'\ufffe'   #  0x8F -> UNDEFINED\r
+    u'\ufffe'   #  0x90 -> UNDEFINED\r
+    u'\u2018'   #  0x91 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x92 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u201c'   #  0x93 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0x94 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2022'   #  0x95 -> BULLET\r
+    u'\u2013'   #  0x96 -> EN DASH\r
+    u'\u2014'   #  0x97 -> EM DASH\r
+    u'\ufffe'   #  0x98 -> UNDEFINED\r
+    u'\u2122'   #  0x99 -> TRADE MARK SIGN\r
+    u'\ufffe'   #  0x9A -> UNDEFINED\r
+    u'\u203a'   #  0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\ufffe'   #  0x9C -> UNDEFINED\r
+    u'\ufffe'   #  0x9D -> UNDEFINED\r
+    u'\ufffe'   #  0x9E -> UNDEFINED\r
+    u'\ufffe'   #  0x9F -> UNDEFINED\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u0385'   #  0xA1 -> GREEK DIALYTIKA TONOS\r
+    u'\u0386'   #  0xA2 -> GREEK CAPITAL LETTER ALPHA WITH TONOS\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\xa5'     #  0xA5 -> YEN SIGN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\ufffe'   #  0xAA -> UNDEFINED\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\u2015'   #  0xAF -> HORIZONTAL BAR\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\u0384'   #  0xB4 -> GREEK TONOS\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\u0388'   #  0xB8 -> GREEK CAPITAL LETTER EPSILON WITH TONOS\r
+    u'\u0389'   #  0xB9 -> GREEK CAPITAL LETTER ETA WITH TONOS\r
+    u'\u038a'   #  0xBA -> GREEK CAPITAL LETTER IOTA WITH TONOS\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u038c'   #  0xBC -> GREEK CAPITAL LETTER OMICRON WITH TONOS\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\u038e'   #  0xBE -> GREEK CAPITAL LETTER UPSILON WITH TONOS\r
+    u'\u038f'   #  0xBF -> GREEK CAPITAL LETTER OMEGA WITH TONOS\r
+    u'\u0390'   #  0xC0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS\r
+    u'\u0391'   #  0xC1 -> GREEK CAPITAL LETTER ALPHA\r
+    u'\u0392'   #  0xC2 -> GREEK CAPITAL LETTER BETA\r
+    u'\u0393'   #  0xC3 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u0394'   #  0xC4 -> GREEK CAPITAL LETTER DELTA\r
+    u'\u0395'   #  0xC5 -> GREEK CAPITAL LETTER EPSILON\r
+    u'\u0396'   #  0xC6 -> GREEK CAPITAL LETTER ZETA\r
+    u'\u0397'   #  0xC7 -> GREEK CAPITAL LETTER ETA\r
+    u'\u0398'   #  0xC8 -> GREEK CAPITAL LETTER THETA\r
+    u'\u0399'   #  0xC9 -> GREEK CAPITAL LETTER IOTA\r
+    u'\u039a'   #  0xCA -> GREEK CAPITAL LETTER KAPPA\r
+    u'\u039b'   #  0xCB -> GREEK CAPITAL LETTER LAMDA\r
+    u'\u039c'   #  0xCC -> GREEK CAPITAL LETTER MU\r
+    u'\u039d'   #  0xCD -> GREEK CAPITAL LETTER NU\r
+    u'\u039e'   #  0xCE -> GREEK CAPITAL LETTER XI\r
+    u'\u039f'   #  0xCF -> GREEK CAPITAL LETTER OMICRON\r
+    u'\u03a0'   #  0xD0 -> GREEK CAPITAL LETTER PI\r
+    u'\u03a1'   #  0xD1 -> GREEK CAPITAL LETTER RHO\r
+    u'\ufffe'   #  0xD2 -> UNDEFINED\r
+    u'\u03a3'   #  0xD3 -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03a4'   #  0xD4 -> GREEK CAPITAL LETTER TAU\r
+    u'\u03a5'   #  0xD5 -> GREEK CAPITAL LETTER UPSILON\r
+    u'\u03a6'   #  0xD6 -> GREEK CAPITAL LETTER PHI\r
+    u'\u03a7'   #  0xD7 -> GREEK CAPITAL LETTER CHI\r
+    u'\u03a8'   #  0xD8 -> GREEK CAPITAL LETTER PSI\r
+    u'\u03a9'   #  0xD9 -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03aa'   #  0xDA -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA\r
+    u'\u03ab'   #  0xDB -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA\r
+    u'\u03ac'   #  0xDC -> GREEK SMALL LETTER ALPHA WITH TONOS\r
+    u'\u03ad'   #  0xDD -> GREEK SMALL LETTER EPSILON WITH TONOS\r
+    u'\u03ae'   #  0xDE -> GREEK SMALL LETTER ETA WITH TONOS\r
+    u'\u03af'   #  0xDF -> GREEK SMALL LETTER IOTA WITH TONOS\r
+    u'\u03b0'   #  0xE0 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS\r
+    u'\u03b1'   #  0xE1 -> GREEK SMALL LETTER ALPHA\r
+    u'\u03b2'   #  0xE2 -> GREEK SMALL LETTER BETA\r
+    u'\u03b3'   #  0xE3 -> GREEK SMALL LETTER GAMMA\r
+    u'\u03b4'   #  0xE4 -> GREEK SMALL LETTER DELTA\r
+    u'\u03b5'   #  0xE5 -> GREEK SMALL LETTER EPSILON\r
+    u'\u03b6'   #  0xE6 -> GREEK SMALL LETTER ZETA\r
+    u'\u03b7'   #  0xE7 -> GREEK SMALL LETTER ETA\r
+    u'\u03b8'   #  0xE8 -> GREEK SMALL LETTER THETA\r
+    u'\u03b9'   #  0xE9 -> GREEK SMALL LETTER IOTA\r
+    u'\u03ba'   #  0xEA -> GREEK SMALL LETTER KAPPA\r
+    u'\u03bb'   #  0xEB -> GREEK SMALL LETTER LAMDA\r
+    u'\u03bc'   #  0xEC -> GREEK SMALL LETTER MU\r
+    u'\u03bd'   #  0xED -> GREEK SMALL LETTER NU\r
+    u'\u03be'   #  0xEE -> GREEK SMALL LETTER XI\r
+    u'\u03bf'   #  0xEF -> GREEK SMALL LETTER OMICRON\r
+    u'\u03c0'   #  0xF0 -> GREEK SMALL LETTER PI\r
+    u'\u03c1'   #  0xF1 -> GREEK SMALL LETTER RHO\r
+    u'\u03c2'   #  0xF2 -> GREEK SMALL LETTER FINAL SIGMA\r
+    u'\u03c3'   #  0xF3 -> GREEK SMALL LETTER SIGMA\r
+    u'\u03c4'   #  0xF4 -> GREEK SMALL LETTER TAU\r
+    u'\u03c5'   #  0xF5 -> GREEK SMALL LETTER UPSILON\r
+    u'\u03c6'   #  0xF6 -> GREEK SMALL LETTER PHI\r
+    u'\u03c7'   #  0xF7 -> GREEK SMALL LETTER CHI\r
+    u'\u03c8'   #  0xF8 -> GREEK SMALL LETTER PSI\r
+    u'\u03c9'   #  0xF9 -> GREEK SMALL LETTER OMEGA\r
+    u'\u03ca'   #  0xFA -> GREEK SMALL LETTER IOTA WITH DIALYTIKA\r
+    u'\u03cb'   #  0xFB -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA\r
+    u'\u03cc'   #  0xFC -> GREEK SMALL LETTER OMICRON WITH TONOS\r
+    u'\u03cd'   #  0xFD -> GREEK SMALL LETTER UPSILON WITH TONOS\r
+    u'\u03ce'   #  0xFE -> GREEK SMALL LETTER OMEGA WITH TONOS\r
+    u'\ufffe'   #  0xFF -> UNDEFINED\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1254.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1254.py
new file mode 100644 (file)
index 0000000..ac691e6
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1254 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1254.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1254',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u20ac'   #  0x80 -> EURO SIGN\r
+    u'\ufffe'   #  0x81 -> UNDEFINED\r
+    u'\u201a'   #  0x82 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u0192'   #  0x83 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u201e'   #  0x84 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2026'   #  0x85 -> HORIZONTAL ELLIPSIS\r
+    u'\u2020'   #  0x86 -> DAGGER\r
+    u'\u2021'   #  0x87 -> DOUBLE DAGGER\r
+    u'\u02c6'   #  0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT\r
+    u'\u2030'   #  0x89 -> PER MILLE SIGN\r
+    u'\u0160'   #  0x8A -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u2039'   #  0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\u0152'   #  0x8C -> LATIN CAPITAL LIGATURE OE\r
+    u'\ufffe'   #  0x8D -> UNDEFINED\r
+    u'\ufffe'   #  0x8E -> UNDEFINED\r
+    u'\ufffe'   #  0x8F -> UNDEFINED\r
+    u'\ufffe'   #  0x90 -> UNDEFINED\r
+    u'\u2018'   #  0x91 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x92 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u201c'   #  0x93 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0x94 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2022'   #  0x95 -> BULLET\r
+    u'\u2013'   #  0x96 -> EN DASH\r
+    u'\u2014'   #  0x97 -> EM DASH\r
+    u'\u02dc'   #  0x98 -> SMALL TILDE\r
+    u'\u2122'   #  0x99 -> TRADE MARK SIGN\r
+    u'\u0161'   #  0x9A -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u203a'   #  0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\u0153'   #  0x9C -> LATIN SMALL LIGATURE OE\r
+    u'\ufffe'   #  0x9D -> UNDEFINED\r
+    u'\ufffe'   #  0x9E -> UNDEFINED\r
+    u'\u0178'   #  0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\xa1'     #  0xA1 -> INVERTED EXCLAMATION MARK\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\xa5'     #  0xA5 -> YEN SIGN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\xaa'     #  0xAA -> FEMININE ORDINAL INDICATOR\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xaf'     #  0xAF -> MACRON\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\xba'     #  0xBA -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbc'     #  0xBC -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xBE -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xbf'     #  0xBF -> INVERTED QUESTION MARK\r
+    u'\xc0'     #  0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc3'     #  0xC3 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc6'     #  0xC6 -> LATIN CAPITAL LETTER AE\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc8'     #  0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xcc'     #  0xCC -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\u011e'   #  0xD0 -> LATIN CAPITAL LETTER G WITH BREVE\r
+    u'\xd1'     #  0xD1 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd2'     #  0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd5'     #  0xD5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\xd8'     #  0xD8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xd9'     #  0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\u0130'   #  0xDD -> LATIN CAPITAL LETTER I WITH DOT ABOVE\r
+    u'\u015e'   #  0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\xe0'     #  0xE0 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe3'     #  0xE3 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe6'     #  0xE6 -> LATIN SMALL LETTER AE\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe8'     #  0xE8 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xec'     #  0xEC -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\u011f'   #  0xF0 -> LATIN SMALL LETTER G WITH BREVE\r
+    u'\xf1'     #  0xF1 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf2'     #  0xF2 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf5'     #  0xF5 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\xf8'     #  0xF8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xf9'     #  0xF9 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u0131'   #  0xFD -> LATIN SMALL LETTER DOTLESS I\r
+    u'\u015f'   #  0xFE -> LATIN SMALL LETTER S WITH CEDILLA\r
+    u'\xff'     #  0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1255.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1255.py
new file mode 100644 (file)
index 0000000..8002347
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1255 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1255.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1255',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u20ac'   #  0x80 -> EURO SIGN\r
+    u'\ufffe'   #  0x81 -> UNDEFINED\r
+    u'\u201a'   #  0x82 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u0192'   #  0x83 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u201e'   #  0x84 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2026'   #  0x85 -> HORIZONTAL ELLIPSIS\r
+    u'\u2020'   #  0x86 -> DAGGER\r
+    u'\u2021'   #  0x87 -> DOUBLE DAGGER\r
+    u'\u02c6'   #  0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT\r
+    u'\u2030'   #  0x89 -> PER MILLE SIGN\r
+    u'\ufffe'   #  0x8A -> UNDEFINED\r
+    u'\u2039'   #  0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\ufffe'   #  0x8C -> UNDEFINED\r
+    u'\ufffe'   #  0x8D -> UNDEFINED\r
+    u'\ufffe'   #  0x8E -> UNDEFINED\r
+    u'\ufffe'   #  0x8F -> UNDEFINED\r
+    u'\ufffe'   #  0x90 -> UNDEFINED\r
+    u'\u2018'   #  0x91 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x92 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u201c'   #  0x93 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0x94 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2022'   #  0x95 -> BULLET\r
+    u'\u2013'   #  0x96 -> EN DASH\r
+    u'\u2014'   #  0x97 -> EM DASH\r
+    u'\u02dc'   #  0x98 -> SMALL TILDE\r
+    u'\u2122'   #  0x99 -> TRADE MARK SIGN\r
+    u'\ufffe'   #  0x9A -> UNDEFINED\r
+    u'\u203a'   #  0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\ufffe'   #  0x9C -> UNDEFINED\r
+    u'\ufffe'   #  0x9D -> UNDEFINED\r
+    u'\ufffe'   #  0x9E -> UNDEFINED\r
+    u'\ufffe'   #  0x9F -> UNDEFINED\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\xa1'     #  0xA1 -> INVERTED EXCLAMATION MARK\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\u20aa'   #  0xA4 -> NEW SHEQEL SIGN\r
+    u'\xa5'     #  0xA5 -> YEN SIGN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\xd7'     #  0xAA -> MULTIPLICATION SIGN\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xaf'     #  0xAF -> MACRON\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\xf7'     #  0xBA -> DIVISION SIGN\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbc'     #  0xBC -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xBE -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xbf'     #  0xBF -> INVERTED QUESTION MARK\r
+    u'\u05b0'   #  0xC0 -> HEBREW POINT SHEVA\r
+    u'\u05b1'   #  0xC1 -> HEBREW POINT HATAF SEGOL\r
+    u'\u05b2'   #  0xC2 -> HEBREW POINT HATAF PATAH\r
+    u'\u05b3'   #  0xC3 -> HEBREW POINT HATAF QAMATS\r
+    u'\u05b4'   #  0xC4 -> HEBREW POINT HIRIQ\r
+    u'\u05b5'   #  0xC5 -> HEBREW POINT TSERE\r
+    u'\u05b6'   #  0xC6 -> HEBREW POINT SEGOL\r
+    u'\u05b7'   #  0xC7 -> HEBREW POINT PATAH\r
+    u'\u05b8'   #  0xC8 -> HEBREW POINT QAMATS\r
+    u'\u05b9'   #  0xC9 -> HEBREW POINT HOLAM\r
+    u'\ufffe'   #  0xCA -> UNDEFINED\r
+    u'\u05bb'   #  0xCB -> HEBREW POINT QUBUTS\r
+    u'\u05bc'   #  0xCC -> HEBREW POINT DAGESH OR MAPIQ\r
+    u'\u05bd'   #  0xCD -> HEBREW POINT METEG\r
+    u'\u05be'   #  0xCE -> HEBREW PUNCTUATION MAQAF\r
+    u'\u05bf'   #  0xCF -> HEBREW POINT RAFE\r
+    u'\u05c0'   #  0xD0 -> HEBREW PUNCTUATION PASEQ\r
+    u'\u05c1'   #  0xD1 -> HEBREW POINT SHIN DOT\r
+    u'\u05c2'   #  0xD2 -> HEBREW POINT SIN DOT\r
+    u'\u05c3'   #  0xD3 -> HEBREW PUNCTUATION SOF PASUQ\r
+    u'\u05f0'   #  0xD4 -> HEBREW LIGATURE YIDDISH DOUBLE VAV\r
+    u'\u05f1'   #  0xD5 -> HEBREW LIGATURE YIDDISH VAV YOD\r
+    u'\u05f2'   #  0xD6 -> HEBREW LIGATURE YIDDISH DOUBLE YOD\r
+    u'\u05f3'   #  0xD7 -> HEBREW PUNCTUATION GERESH\r
+    u'\u05f4'   #  0xD8 -> HEBREW PUNCTUATION GERSHAYIM\r
+    u'\ufffe'   #  0xD9 -> UNDEFINED\r
+    u'\ufffe'   #  0xDA -> UNDEFINED\r
+    u'\ufffe'   #  0xDB -> UNDEFINED\r
+    u'\ufffe'   #  0xDC -> UNDEFINED\r
+    u'\ufffe'   #  0xDD -> UNDEFINED\r
+    u'\ufffe'   #  0xDE -> UNDEFINED\r
+    u'\ufffe'   #  0xDF -> UNDEFINED\r
+    u'\u05d0'   #  0xE0 -> HEBREW LETTER ALEF\r
+    u'\u05d1'   #  0xE1 -> HEBREW LETTER BET\r
+    u'\u05d2'   #  0xE2 -> HEBREW LETTER GIMEL\r
+    u'\u05d3'   #  0xE3 -> HEBREW LETTER DALET\r
+    u'\u05d4'   #  0xE4 -> HEBREW LETTER HE\r
+    u'\u05d5'   #  0xE5 -> HEBREW LETTER VAV\r
+    u'\u05d6'   #  0xE6 -> HEBREW LETTER ZAYIN\r
+    u'\u05d7'   #  0xE7 -> HEBREW LETTER HET\r
+    u'\u05d8'   #  0xE8 -> HEBREW LETTER TET\r
+    u'\u05d9'   #  0xE9 -> HEBREW LETTER YOD\r
+    u'\u05da'   #  0xEA -> HEBREW LETTER FINAL KAF\r
+    u'\u05db'   #  0xEB -> HEBREW LETTER KAF\r
+    u'\u05dc'   #  0xEC -> HEBREW LETTER LAMED\r
+    u'\u05dd'   #  0xED -> HEBREW LETTER FINAL MEM\r
+    u'\u05de'   #  0xEE -> HEBREW LETTER MEM\r
+    u'\u05df'   #  0xEF -> HEBREW LETTER FINAL NUN\r
+    u'\u05e0'   #  0xF0 -> HEBREW LETTER NUN\r
+    u'\u05e1'   #  0xF1 -> HEBREW LETTER SAMEKH\r
+    u'\u05e2'   #  0xF2 -> HEBREW LETTER AYIN\r
+    u'\u05e3'   #  0xF3 -> HEBREW LETTER FINAL PE\r
+    u'\u05e4'   #  0xF4 -> HEBREW LETTER PE\r
+    u'\u05e5'   #  0xF5 -> HEBREW LETTER FINAL TSADI\r
+    u'\u05e6'   #  0xF6 -> HEBREW LETTER TSADI\r
+    u'\u05e7'   #  0xF7 -> HEBREW LETTER QOF\r
+    u'\u05e8'   #  0xF8 -> HEBREW LETTER RESH\r
+    u'\u05e9'   #  0xF9 -> HEBREW LETTER SHIN\r
+    u'\u05ea'   #  0xFA -> HEBREW LETTER TAV\r
+    u'\ufffe'   #  0xFB -> UNDEFINED\r
+    u'\ufffe'   #  0xFC -> UNDEFINED\r
+    u'\u200e'   #  0xFD -> LEFT-TO-RIGHT MARK\r
+    u'\u200f'   #  0xFE -> RIGHT-TO-LEFT MARK\r
+    u'\ufffe'   #  0xFF -> UNDEFINED\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1256.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1256.py
new file mode 100644 (file)
index 0000000..d8a67a4
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1256 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1256.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1256',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u20ac'   #  0x80 -> EURO SIGN\r
+    u'\u067e'   #  0x81 -> ARABIC LETTER PEH\r
+    u'\u201a'   #  0x82 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u0192'   #  0x83 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u201e'   #  0x84 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2026'   #  0x85 -> HORIZONTAL ELLIPSIS\r
+    u'\u2020'   #  0x86 -> DAGGER\r
+    u'\u2021'   #  0x87 -> DOUBLE DAGGER\r
+    u'\u02c6'   #  0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT\r
+    u'\u2030'   #  0x89 -> PER MILLE SIGN\r
+    u'\u0679'   #  0x8A -> ARABIC LETTER TTEH\r
+    u'\u2039'   #  0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\u0152'   #  0x8C -> LATIN CAPITAL LIGATURE OE\r
+    u'\u0686'   #  0x8D -> ARABIC LETTER TCHEH\r
+    u'\u0698'   #  0x8E -> ARABIC LETTER JEH\r
+    u'\u0688'   #  0x8F -> ARABIC LETTER DDAL\r
+    u'\u06af'   #  0x90 -> ARABIC LETTER GAF\r
+    u'\u2018'   #  0x91 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x92 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u201c'   #  0x93 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0x94 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2022'   #  0x95 -> BULLET\r
+    u'\u2013'   #  0x96 -> EN DASH\r
+    u'\u2014'   #  0x97 -> EM DASH\r
+    u'\u06a9'   #  0x98 -> ARABIC LETTER KEHEH\r
+    u'\u2122'   #  0x99 -> TRADE MARK SIGN\r
+    u'\u0691'   #  0x9A -> ARABIC LETTER RREH\r
+    u'\u203a'   #  0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\u0153'   #  0x9C -> LATIN SMALL LIGATURE OE\r
+    u'\u200c'   #  0x9D -> ZERO WIDTH NON-JOINER\r
+    u'\u200d'   #  0x9E -> ZERO WIDTH JOINER\r
+    u'\u06ba'   #  0x9F -> ARABIC LETTER NOON GHUNNA\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u060c'   #  0xA1 -> ARABIC COMMA\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\xa5'     #  0xA5 -> YEN SIGN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u06be'   #  0xAA -> ARABIC LETTER HEH DOACHASHMEE\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xaf'     #  0xAF -> MACRON\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\u061b'   #  0xBA -> ARABIC SEMICOLON\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbc'     #  0xBC -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xBE -> VULGAR FRACTION THREE QUARTERS\r
+    u'\u061f'   #  0xBF -> ARABIC QUESTION MARK\r
+    u'\u06c1'   #  0xC0 -> ARABIC LETTER HEH GOAL\r
+    u'\u0621'   #  0xC1 -> ARABIC LETTER HAMZA\r
+    u'\u0622'   #  0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE\r
+    u'\u0623'   #  0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE\r
+    u'\u0624'   #  0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE\r
+    u'\u0625'   #  0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW\r
+    u'\u0626'   #  0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE\r
+    u'\u0627'   #  0xC7 -> ARABIC LETTER ALEF\r
+    u'\u0628'   #  0xC8 -> ARABIC LETTER BEH\r
+    u'\u0629'   #  0xC9 -> ARABIC LETTER TEH MARBUTA\r
+    u'\u062a'   #  0xCA -> ARABIC LETTER TEH\r
+    u'\u062b'   #  0xCB -> ARABIC LETTER THEH\r
+    u'\u062c'   #  0xCC -> ARABIC LETTER JEEM\r
+    u'\u062d'   #  0xCD -> ARABIC LETTER HAH\r
+    u'\u062e'   #  0xCE -> ARABIC LETTER KHAH\r
+    u'\u062f'   #  0xCF -> ARABIC LETTER DAL\r
+    u'\u0630'   #  0xD0 -> ARABIC LETTER THAL\r
+    u'\u0631'   #  0xD1 -> ARABIC LETTER REH\r
+    u'\u0632'   #  0xD2 -> ARABIC LETTER ZAIN\r
+    u'\u0633'   #  0xD3 -> ARABIC LETTER SEEN\r
+    u'\u0634'   #  0xD4 -> ARABIC LETTER SHEEN\r
+    u'\u0635'   #  0xD5 -> ARABIC LETTER SAD\r
+    u'\u0636'   #  0xD6 -> ARABIC LETTER DAD\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\u0637'   #  0xD8 -> ARABIC LETTER TAH\r
+    u'\u0638'   #  0xD9 -> ARABIC LETTER ZAH\r
+    u'\u0639'   #  0xDA -> ARABIC LETTER AIN\r
+    u'\u063a'   #  0xDB -> ARABIC LETTER GHAIN\r
+    u'\u0640'   #  0xDC -> ARABIC TATWEEL\r
+    u'\u0641'   #  0xDD -> ARABIC LETTER FEH\r
+    u'\u0642'   #  0xDE -> ARABIC LETTER QAF\r
+    u'\u0643'   #  0xDF -> ARABIC LETTER KAF\r
+    u'\xe0'     #  0xE0 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\u0644'   #  0xE1 -> ARABIC LETTER LAM\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\u0645'   #  0xE3 -> ARABIC LETTER MEEM\r
+    u'\u0646'   #  0xE4 -> ARABIC LETTER NOON\r
+    u'\u0647'   #  0xE5 -> ARABIC LETTER HEH\r
+    u'\u0648'   #  0xE6 -> ARABIC LETTER WAW\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe8'     #  0xE8 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\u0649'   #  0xEC -> ARABIC LETTER ALEF MAKSURA\r
+    u'\u064a'   #  0xED -> ARABIC LETTER YEH\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\u064b'   #  0xF0 -> ARABIC FATHATAN\r
+    u'\u064c'   #  0xF1 -> ARABIC DAMMATAN\r
+    u'\u064d'   #  0xF2 -> ARABIC KASRATAN\r
+    u'\u064e'   #  0xF3 -> ARABIC FATHA\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\u064f'   #  0xF5 -> ARABIC DAMMA\r
+    u'\u0650'   #  0xF6 -> ARABIC KASRA\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\u0651'   #  0xF8 -> ARABIC SHADDA\r
+    u'\xf9'     #  0xF9 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\u0652'   #  0xFA -> ARABIC SUKUN\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u200e'   #  0xFD -> LEFT-TO-RIGHT MARK\r
+    u'\u200f'   #  0xFE -> RIGHT-TO-LEFT MARK\r
+    u'\u06d2'   #  0xFF -> ARABIC LETTER YEH BARREE\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1257.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1257.py
new file mode 100644 (file)
index 0000000..05917c7
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1257 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1257.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1257',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u20ac'   #  0x80 -> EURO SIGN\r
+    u'\ufffe'   #  0x81 -> UNDEFINED\r
+    u'\u201a'   #  0x82 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\ufffe'   #  0x83 -> UNDEFINED\r
+    u'\u201e'   #  0x84 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2026'   #  0x85 -> HORIZONTAL ELLIPSIS\r
+    u'\u2020'   #  0x86 -> DAGGER\r
+    u'\u2021'   #  0x87 -> DOUBLE DAGGER\r
+    u'\ufffe'   #  0x88 -> UNDEFINED\r
+    u'\u2030'   #  0x89 -> PER MILLE SIGN\r
+    u'\ufffe'   #  0x8A -> UNDEFINED\r
+    u'\u2039'   #  0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\ufffe'   #  0x8C -> UNDEFINED\r
+    u'\xa8'     #  0x8D -> DIAERESIS\r
+    u'\u02c7'   #  0x8E -> CARON\r
+    u'\xb8'     #  0x8F -> CEDILLA\r
+    u'\ufffe'   #  0x90 -> UNDEFINED\r
+    u'\u2018'   #  0x91 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x92 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u201c'   #  0x93 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0x94 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2022'   #  0x95 -> BULLET\r
+    u'\u2013'   #  0x96 -> EN DASH\r
+    u'\u2014'   #  0x97 -> EM DASH\r
+    u'\ufffe'   #  0x98 -> UNDEFINED\r
+    u'\u2122'   #  0x99 -> TRADE MARK SIGN\r
+    u'\ufffe'   #  0x9A -> UNDEFINED\r
+    u'\u203a'   #  0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\ufffe'   #  0x9C -> UNDEFINED\r
+    u'\xaf'     #  0x9D -> MACRON\r
+    u'\u02db'   #  0x9E -> OGONEK\r
+    u'\ufffe'   #  0x9F -> UNDEFINED\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\ufffe'   #  0xA1 -> UNDEFINED\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\ufffe'   #  0xA5 -> UNDEFINED\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xd8'     #  0xA8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u0156'   #  0xAA -> LATIN CAPITAL LETTER R WITH CEDILLA\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xc6'     #  0xAF -> LATIN CAPITAL LETTER AE\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xf8'     #  0xB8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\u0157'   #  0xBA -> LATIN SMALL LETTER R WITH CEDILLA\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbc'     #  0xBC -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xBE -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xe6'     #  0xBF -> LATIN SMALL LETTER AE\r
+    u'\u0104'   #  0xC0 -> LATIN CAPITAL LETTER A WITH OGONEK\r
+    u'\u012e'   #  0xC1 -> LATIN CAPITAL LETTER I WITH OGONEK\r
+    u'\u0100'   #  0xC2 -> LATIN CAPITAL LETTER A WITH MACRON\r
+    u'\u0106'   #  0xC3 -> LATIN CAPITAL LETTER C WITH ACUTE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\u0118'   #  0xC6 -> LATIN CAPITAL LETTER E WITH OGONEK\r
+    u'\u0112'   #  0xC7 -> LATIN CAPITAL LETTER E WITH MACRON\r
+    u'\u010c'   #  0xC8 -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\u0179'   #  0xCA -> LATIN CAPITAL LETTER Z WITH ACUTE\r
+    u'\u0116'   #  0xCB -> LATIN CAPITAL LETTER E WITH DOT ABOVE\r
+    u'\u0122'   #  0xCC -> LATIN CAPITAL LETTER G WITH CEDILLA\r
+    u'\u0136'   #  0xCD -> LATIN CAPITAL LETTER K WITH CEDILLA\r
+    u'\u012a'   #  0xCE -> LATIN CAPITAL LETTER I WITH MACRON\r
+    u'\u013b'   #  0xCF -> LATIN CAPITAL LETTER L WITH CEDILLA\r
+    u'\u0160'   #  0xD0 -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u0143'   #  0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE\r
+    u'\u0145'   #  0xD2 -> LATIN CAPITAL LETTER N WITH CEDILLA\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\u014c'   #  0xD4 -> LATIN CAPITAL LETTER O WITH MACRON\r
+    u'\xd5'     #  0xD5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\u0172'   #  0xD8 -> LATIN CAPITAL LETTER U WITH OGONEK\r
+    u'\u0141'   #  0xD9 -> LATIN CAPITAL LETTER L WITH STROKE\r
+    u'\u015a'   #  0xDA -> LATIN CAPITAL LETTER S WITH ACUTE\r
+    u'\u016a'   #  0xDB -> LATIN CAPITAL LETTER U WITH MACRON\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\u017b'   #  0xDD -> LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    u'\u017d'   #  0xDE -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\u0105'   #  0xE0 -> LATIN SMALL LETTER A WITH OGONEK\r
+    u'\u012f'   #  0xE1 -> LATIN SMALL LETTER I WITH OGONEK\r
+    u'\u0101'   #  0xE2 -> LATIN SMALL LETTER A WITH MACRON\r
+    u'\u0107'   #  0xE3 -> LATIN SMALL LETTER C WITH ACUTE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\u0119'   #  0xE6 -> LATIN SMALL LETTER E WITH OGONEK\r
+    u'\u0113'   #  0xE7 -> LATIN SMALL LETTER E WITH MACRON\r
+    u'\u010d'   #  0xE8 -> LATIN SMALL LETTER C WITH CARON\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\u017a'   #  0xEA -> LATIN SMALL LETTER Z WITH ACUTE\r
+    u'\u0117'   #  0xEB -> LATIN SMALL LETTER E WITH DOT ABOVE\r
+    u'\u0123'   #  0xEC -> LATIN SMALL LETTER G WITH CEDILLA\r
+    u'\u0137'   #  0xED -> LATIN SMALL LETTER K WITH CEDILLA\r
+    u'\u012b'   #  0xEE -> LATIN SMALL LETTER I WITH MACRON\r
+    u'\u013c'   #  0xEF -> LATIN SMALL LETTER L WITH CEDILLA\r
+    u'\u0161'   #  0xF0 -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u0144'   #  0xF1 -> LATIN SMALL LETTER N WITH ACUTE\r
+    u'\u0146'   #  0xF2 -> LATIN SMALL LETTER N WITH CEDILLA\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\u014d'   #  0xF4 -> LATIN SMALL LETTER O WITH MACRON\r
+    u'\xf5'     #  0xF5 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\u0173'   #  0xF8 -> LATIN SMALL LETTER U WITH OGONEK\r
+    u'\u0142'   #  0xF9 -> LATIN SMALL LETTER L WITH STROKE\r
+    u'\u015b'   #  0xFA -> LATIN SMALL LETTER S WITH ACUTE\r
+    u'\u016b'   #  0xFB -> LATIN SMALL LETTER U WITH MACRON\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u017c'   #  0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    u'\u017e'   #  0xFE -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u02d9'   #  0xFF -> DOT ABOVE\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1258.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1258.py
new file mode 100644 (file)
index 0000000..a6e8408
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1258 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1258.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp1258',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u20ac'   #  0x80 -> EURO SIGN\r
+    u'\ufffe'   #  0x81 -> UNDEFINED\r
+    u'\u201a'   #  0x82 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u0192'   #  0x83 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u201e'   #  0x84 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2026'   #  0x85 -> HORIZONTAL ELLIPSIS\r
+    u'\u2020'   #  0x86 -> DAGGER\r
+    u'\u2021'   #  0x87 -> DOUBLE DAGGER\r
+    u'\u02c6'   #  0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT\r
+    u'\u2030'   #  0x89 -> PER MILLE SIGN\r
+    u'\ufffe'   #  0x8A -> UNDEFINED\r
+    u'\u2039'   #  0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\u0152'   #  0x8C -> LATIN CAPITAL LIGATURE OE\r
+    u'\ufffe'   #  0x8D -> UNDEFINED\r
+    u'\ufffe'   #  0x8E -> UNDEFINED\r
+    u'\ufffe'   #  0x8F -> UNDEFINED\r
+    u'\ufffe'   #  0x90 -> UNDEFINED\r
+    u'\u2018'   #  0x91 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x92 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u201c'   #  0x93 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0x94 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2022'   #  0x95 -> BULLET\r
+    u'\u2013'   #  0x96 -> EN DASH\r
+    u'\u2014'   #  0x97 -> EM DASH\r
+    u'\u02dc'   #  0x98 -> SMALL TILDE\r
+    u'\u2122'   #  0x99 -> TRADE MARK SIGN\r
+    u'\ufffe'   #  0x9A -> UNDEFINED\r
+    u'\u203a'   #  0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\u0153'   #  0x9C -> LATIN SMALL LIGATURE OE\r
+    u'\ufffe'   #  0x9D -> UNDEFINED\r
+    u'\ufffe'   #  0x9E -> UNDEFINED\r
+    u'\u0178'   #  0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\xa1'     #  0xA1 -> INVERTED EXCLAMATION MARK\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\xa5'     #  0xA5 -> YEN SIGN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\xaa'     #  0xAA -> FEMININE ORDINAL INDICATOR\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xaf'     #  0xAF -> MACRON\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\xba'     #  0xBA -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbc'     #  0xBC -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xBE -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xbf'     #  0xBF -> INVERTED QUESTION MARK\r
+    u'\xc0'     #  0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\u0102'   #  0xC3 -> LATIN CAPITAL LETTER A WITH BREVE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc6'     #  0xC6 -> LATIN CAPITAL LETTER AE\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc8'     #  0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\u0300'   #  0xCC -> COMBINING GRAVE ACCENT\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\u0110'   #  0xD0 -> LATIN CAPITAL LETTER D WITH STROKE\r
+    u'\xd1'     #  0xD1 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\u0309'   #  0xD2 -> COMBINING HOOK ABOVE\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\u01a0'   #  0xD5 -> LATIN CAPITAL LETTER O WITH HORN\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\xd8'     #  0xD8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xd9'     #  0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\u01af'   #  0xDD -> LATIN CAPITAL LETTER U WITH HORN\r
+    u'\u0303'   #  0xDE -> COMBINING TILDE\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\xe0'     #  0xE0 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\u0103'   #  0xE3 -> LATIN SMALL LETTER A WITH BREVE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe6'     #  0xE6 -> LATIN SMALL LETTER AE\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe8'     #  0xE8 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\u0301'   #  0xEC -> COMBINING ACUTE ACCENT\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\u0111'   #  0xF0 -> LATIN SMALL LETTER D WITH STROKE\r
+    u'\xf1'     #  0xF1 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\u0323'   #  0xF2 -> COMBINING DOT BELOW\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\u01a1'   #  0xF5 -> LATIN SMALL LETTER O WITH HORN\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\xf8'     #  0xF8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xf9'     #  0xF9 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u01b0'   #  0xFD -> LATIN SMALL LETTER U WITH HORN\r
+    u'\u20ab'   #  0xFE -> DONG SIGN\r
+    u'\xff'     #  0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp424.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp424.py
new file mode 100644 (file)
index 0000000..343d7d7
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp424 generated from 'MAPPINGS/VENDORS/MISC/CP424.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp424',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x9c'     #  0x04 -> SELECT\r
+    u'\t'       #  0x05 -> HORIZONTAL TABULATION\r
+    u'\x86'     #  0x06 -> REQUIRED NEW LINE\r
+    u'\x7f'     #  0x07 -> DELETE\r
+    u'\x97'     #  0x08 -> GRAPHIC ESCAPE\r
+    u'\x8d'     #  0x09 -> SUPERSCRIPT\r
+    u'\x8e'     #  0x0A -> REPEAT\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x9d'     #  0x14 -> RESTORE/ENABLE PRESENTATION\r
+    u'\x85'     #  0x15 -> NEW LINE\r
+    u'\x08'     #  0x16 -> BACKSPACE\r
+    u'\x87'     #  0x17 -> PROGRAM OPERATOR COMMUNICATION\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x92'     #  0x1A -> UNIT BACK SPACE\r
+    u'\x8f'     #  0x1B -> CUSTOMER USE ONE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u'\x80'     #  0x20 -> DIGIT SELECT\r
+    u'\x81'     #  0x21 -> START OF SIGNIFICANCE\r
+    u'\x82'     #  0x22 -> FIELD SEPARATOR\r
+    u'\x83'     #  0x23 -> WORD UNDERSCORE\r
+    u'\x84'     #  0x24 -> BYPASS OR INHIBIT PRESENTATION\r
+    u'\n'       #  0x25 -> LINE FEED\r
+    u'\x17'     #  0x26 -> END OF TRANSMISSION BLOCK\r
+    u'\x1b'     #  0x27 -> ESCAPE\r
+    u'\x88'     #  0x28 -> SET ATTRIBUTE\r
+    u'\x89'     #  0x29 -> START FIELD EXTENDED\r
+    u'\x8a'     #  0x2A -> SET MODE OR SWITCH\r
+    u'\x8b'     #  0x2B -> CONTROL SEQUENCE PREFIX\r
+    u'\x8c'     #  0x2C -> MODIFY FIELD ATTRIBUTE\r
+    u'\x05'     #  0x2D -> ENQUIRY\r
+    u'\x06'     #  0x2E -> ACKNOWLEDGE\r
+    u'\x07'     #  0x2F -> BELL\r
+    u'\x90'     #  0x30 -> <reserved>\r
+    u'\x91'     #  0x31 -> <reserved>\r
+    u'\x16'     #  0x32 -> SYNCHRONOUS IDLE\r
+    u'\x93'     #  0x33 -> INDEX RETURN\r
+    u'\x94'     #  0x34 -> PRESENTATION POSITION\r
+    u'\x95'     #  0x35 -> TRANSPARENT\r
+    u'\x96'     #  0x36 -> NUMERIC BACKSPACE\r
+    u'\x04'     #  0x37 -> END OF TRANSMISSION\r
+    u'\x98'     #  0x38 -> SUBSCRIPT\r
+    u'\x99'     #  0x39 -> INDENT TABULATION\r
+    u'\x9a'     #  0x3A -> REVERSE FORM FEED\r
+    u'\x9b'     #  0x3B -> CUSTOMER USE THREE\r
+    u'\x14'     #  0x3C -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x3D -> NEGATIVE ACKNOWLEDGE\r
+    u'\x9e'     #  0x3E -> <reserved>\r
+    u'\x1a'     #  0x3F -> SUBSTITUTE\r
+    u' '        #  0x40 -> SPACE\r
+    u'\u05d0'   #  0x41 -> HEBREW LETTER ALEF\r
+    u'\u05d1'   #  0x42 -> HEBREW LETTER BET\r
+    u'\u05d2'   #  0x43 -> HEBREW LETTER GIMEL\r
+    u'\u05d3'   #  0x44 -> HEBREW LETTER DALET\r
+    u'\u05d4'   #  0x45 -> HEBREW LETTER HE\r
+    u'\u05d5'   #  0x46 -> HEBREW LETTER VAV\r
+    u'\u05d6'   #  0x47 -> HEBREW LETTER ZAYIN\r
+    u'\u05d7'   #  0x48 -> HEBREW LETTER HET\r
+    u'\u05d8'   #  0x49 -> HEBREW LETTER TET\r
+    u'\xa2'     #  0x4A -> CENT SIGN\r
+    u'.'        #  0x4B -> FULL STOP\r
+    u'<'        #  0x4C -> LESS-THAN SIGN\r
+    u'('        #  0x4D -> LEFT PARENTHESIS\r
+    u'+'        #  0x4E -> PLUS SIGN\r
+    u'|'        #  0x4F -> VERTICAL LINE\r
+    u'&'        #  0x50 -> AMPERSAND\r
+    u'\u05d9'   #  0x51 -> HEBREW LETTER YOD\r
+    u'\u05da'   #  0x52 -> HEBREW LETTER FINAL KAF\r
+    u'\u05db'   #  0x53 -> HEBREW LETTER KAF\r
+    u'\u05dc'   #  0x54 -> HEBREW LETTER LAMED\r
+    u'\u05dd'   #  0x55 -> HEBREW LETTER FINAL MEM\r
+    u'\u05de'   #  0x56 -> HEBREW LETTER MEM\r
+    u'\u05df'   #  0x57 -> HEBREW LETTER FINAL NUN\r
+    u'\u05e0'   #  0x58 -> HEBREW LETTER NUN\r
+    u'\u05e1'   #  0x59 -> HEBREW LETTER SAMEKH\r
+    u'!'        #  0x5A -> EXCLAMATION MARK\r
+    u'$'        #  0x5B -> DOLLAR SIGN\r
+    u'*'        #  0x5C -> ASTERISK\r
+    u')'        #  0x5D -> RIGHT PARENTHESIS\r
+    u';'        #  0x5E -> SEMICOLON\r
+    u'\xac'     #  0x5F -> NOT SIGN\r
+    u'-'        #  0x60 -> HYPHEN-MINUS\r
+    u'/'        #  0x61 -> SOLIDUS\r
+    u'\u05e2'   #  0x62 -> HEBREW LETTER AYIN\r
+    u'\u05e3'   #  0x63 -> HEBREW LETTER FINAL PE\r
+    u'\u05e4'   #  0x64 -> HEBREW LETTER PE\r
+    u'\u05e5'   #  0x65 -> HEBREW LETTER FINAL TSADI\r
+    u'\u05e6'   #  0x66 -> HEBREW LETTER TSADI\r
+    u'\u05e7'   #  0x67 -> HEBREW LETTER QOF\r
+    u'\u05e8'   #  0x68 -> HEBREW LETTER RESH\r
+    u'\u05e9'   #  0x69 -> HEBREW LETTER SHIN\r
+    u'\xa6'     #  0x6A -> BROKEN BAR\r
+    u','        #  0x6B -> COMMA\r
+    u'%'        #  0x6C -> PERCENT SIGN\r
+    u'_'        #  0x6D -> LOW LINE\r
+    u'>'        #  0x6E -> GREATER-THAN SIGN\r
+    u'?'        #  0x6F -> QUESTION MARK\r
+    u'\ufffe'   #  0x70 -> UNDEFINED\r
+    u'\u05ea'   #  0x71 -> HEBREW LETTER TAV\r
+    u'\ufffe'   #  0x72 -> UNDEFINED\r
+    u'\ufffe'   #  0x73 -> UNDEFINED\r
+    u'\xa0'     #  0x74 -> NO-BREAK SPACE\r
+    u'\ufffe'   #  0x75 -> UNDEFINED\r
+    u'\ufffe'   #  0x76 -> UNDEFINED\r
+    u'\ufffe'   #  0x77 -> UNDEFINED\r
+    u'\u2017'   #  0x78 -> DOUBLE LOW LINE\r
+    u'`'        #  0x79 -> GRAVE ACCENT\r
+    u':'        #  0x7A -> COLON\r
+    u'#'        #  0x7B -> NUMBER SIGN\r
+    u'@'        #  0x7C -> COMMERCIAL AT\r
+    u"'"        #  0x7D -> APOSTROPHE\r
+    u'='        #  0x7E -> EQUALS SIGN\r
+    u'"'        #  0x7F -> QUOTATION MARK\r
+    u'\ufffe'   #  0x80 -> UNDEFINED\r
+    u'a'        #  0x81 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x82 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x83 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x84 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x85 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x86 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x87 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x88 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x89 -> LATIN SMALL LETTER I\r
+    u'\xab'     #  0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\ufffe'   #  0x8C -> UNDEFINED\r
+    u'\ufffe'   #  0x8D -> UNDEFINED\r
+    u'\ufffe'   #  0x8E -> UNDEFINED\r
+    u'\xb1'     #  0x8F -> PLUS-MINUS SIGN\r
+    u'\xb0'     #  0x90 -> DEGREE SIGN\r
+    u'j'        #  0x91 -> LATIN SMALL LETTER J\r
+    u'k'        #  0x92 -> LATIN SMALL LETTER K\r
+    u'l'        #  0x93 -> LATIN SMALL LETTER L\r
+    u'm'        #  0x94 -> LATIN SMALL LETTER M\r
+    u'n'        #  0x95 -> LATIN SMALL LETTER N\r
+    u'o'        #  0x96 -> LATIN SMALL LETTER O\r
+    u'p'        #  0x97 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x98 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x99 -> LATIN SMALL LETTER R\r
+    u'\ufffe'   #  0x9A -> UNDEFINED\r
+    u'\ufffe'   #  0x9B -> UNDEFINED\r
+    u'\ufffe'   #  0x9C -> UNDEFINED\r
+    u'\xb8'     #  0x9D -> CEDILLA\r
+    u'\ufffe'   #  0x9E -> UNDEFINED\r
+    u'\xa4'     #  0x9F -> CURRENCY SIGN\r
+    u'\xb5'     #  0xA0 -> MICRO SIGN\r
+    u'~'        #  0xA1 -> TILDE\r
+    u's'        #  0xA2 -> LATIN SMALL LETTER S\r
+    u't'        #  0xA3 -> LATIN SMALL LETTER T\r
+    u'u'        #  0xA4 -> LATIN SMALL LETTER U\r
+    u'v'        #  0xA5 -> LATIN SMALL LETTER V\r
+    u'w'        #  0xA6 -> LATIN SMALL LETTER W\r
+    u'x'        #  0xA7 -> LATIN SMALL LETTER X\r
+    u'y'        #  0xA8 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0xA9 -> LATIN SMALL LETTER Z\r
+    u'\ufffe'   #  0xAA -> UNDEFINED\r
+    u'\ufffe'   #  0xAB -> UNDEFINED\r
+    u'\ufffe'   #  0xAC -> UNDEFINED\r
+    u'\ufffe'   #  0xAD -> UNDEFINED\r
+    u'\ufffe'   #  0xAE -> UNDEFINED\r
+    u'\xae'     #  0xAF -> REGISTERED SIGN\r
+    u'^'        #  0xB0 -> CIRCUMFLEX ACCENT\r
+    u'\xa3'     #  0xB1 -> POUND SIGN\r
+    u'\xa5'     #  0xB2 -> YEN SIGN\r
+    u'\xb7'     #  0xB3 -> MIDDLE DOT\r
+    u'\xa9'     #  0xB4 -> COPYRIGHT SIGN\r
+    u'\xa7'     #  0xB5 -> SECTION SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xbc'     #  0xB7 -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xB8 -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xB9 -> VULGAR FRACTION THREE QUARTERS\r
+    u'['        #  0xBA -> LEFT SQUARE BRACKET\r
+    u']'        #  0xBB -> RIGHT SQUARE BRACKET\r
+    u'\xaf'     #  0xBC -> MACRON\r
+    u'\xa8'     #  0xBD -> DIAERESIS\r
+    u'\xb4'     #  0xBE -> ACUTE ACCENT\r
+    u'\xd7'     #  0xBF -> MULTIPLICATION SIGN\r
+    u'{'        #  0xC0 -> LEFT CURLY BRACKET\r
+    u'A'        #  0xC1 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0xC2 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0xC3 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0xC4 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0xC5 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0xC6 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0xC7 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0xC8 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0xC9 -> LATIN CAPITAL LETTER I\r
+    u'\xad'     #  0xCA -> SOFT HYPHEN\r
+    u'\ufffe'   #  0xCB -> UNDEFINED\r
+    u'\ufffe'   #  0xCC -> UNDEFINED\r
+    u'\ufffe'   #  0xCD -> UNDEFINED\r
+    u'\ufffe'   #  0xCE -> UNDEFINED\r
+    u'\ufffe'   #  0xCF -> UNDEFINED\r
+    u'}'        #  0xD0 -> RIGHT CURLY BRACKET\r
+    u'J'        #  0xD1 -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0xD2 -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0xD3 -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0xD4 -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0xD5 -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0xD6 -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0xD7 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0xD8 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0xD9 -> LATIN CAPITAL LETTER R\r
+    u'\xb9'     #  0xDA -> SUPERSCRIPT ONE\r
+    u'\ufffe'   #  0xDB -> UNDEFINED\r
+    u'\ufffe'   #  0xDC -> UNDEFINED\r
+    u'\ufffe'   #  0xDD -> UNDEFINED\r
+    u'\ufffe'   #  0xDE -> UNDEFINED\r
+    u'\ufffe'   #  0xDF -> UNDEFINED\r
+    u'\\'       #  0xE0 -> REVERSE SOLIDUS\r
+    u'\xf7'     #  0xE1 -> DIVISION SIGN\r
+    u'S'        #  0xE2 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0xE3 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0xE4 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0xE5 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0xE6 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0xE7 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0xE8 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0xE9 -> LATIN CAPITAL LETTER Z\r
+    u'\xb2'     #  0xEA -> SUPERSCRIPT TWO\r
+    u'\ufffe'   #  0xEB -> UNDEFINED\r
+    u'\ufffe'   #  0xEC -> UNDEFINED\r
+    u'\ufffe'   #  0xED -> UNDEFINED\r
+    u'\ufffe'   #  0xEE -> UNDEFINED\r
+    u'\ufffe'   #  0xEF -> UNDEFINED\r
+    u'0'        #  0xF0 -> DIGIT ZERO\r
+    u'1'        #  0xF1 -> DIGIT ONE\r
+    u'2'        #  0xF2 -> DIGIT TWO\r
+    u'3'        #  0xF3 -> DIGIT THREE\r
+    u'4'        #  0xF4 -> DIGIT FOUR\r
+    u'5'        #  0xF5 -> DIGIT FIVE\r
+    u'6'        #  0xF6 -> DIGIT SIX\r
+    u'7'        #  0xF7 -> DIGIT SEVEN\r
+    u'8'        #  0xF8 -> DIGIT EIGHT\r
+    u'9'        #  0xF9 -> DIGIT NINE\r
+    u'\xb3'     #  0xFA -> SUPERSCRIPT THREE\r
+    u'\ufffe'   #  0xFB -> UNDEFINED\r
+    u'\ufffe'   #  0xFC -> UNDEFINED\r
+    u'\ufffe'   #  0xFD -> UNDEFINED\r
+    u'\ufffe'   #  0xFE -> UNDEFINED\r
+    u'\x9f'     #  0xFF -> EIGHT ONES\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp437.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp437.py
new file mode 100644 (file)
index 0000000..800ae50
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec cp437 generated from 'VENDORS/MICSFT/PC/CP437.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp437',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x00c7,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x0081: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0082: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x0083: 0x00e2,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x0084: 0x00e4,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x0085: 0x00e0,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x0086: 0x00e5,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x0087: 0x00e7,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x0088: 0x00ea,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x0089: 0x00eb,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x008a: 0x00e8,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x008b: 0x00ef,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x008c: 0x00ee,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x008d: 0x00ec,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x008e: 0x00c4,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x008f: 0x00c5,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x0090: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0091: 0x00e6,     #  LATIN SMALL LIGATURE AE\r
+    0x0092: 0x00c6,     #  LATIN CAPITAL LIGATURE AE\r
+    0x0093: 0x00f4,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x0094: 0x00f6,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x0095: 0x00f2,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x0096: 0x00fb,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x0097: 0x00f9,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x0098: 0x00ff,     #  LATIN SMALL LETTER Y WITH DIAERESIS\r
+    0x0099: 0x00d6,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x009a: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x009b: 0x00a2,     #  CENT SIGN\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x00a5,     #  YEN SIGN\r
+    0x009e: 0x20a7,     #  PESETA SIGN\r
+    0x009f: 0x0192,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x00a0: 0x00e1,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00a1: 0x00ed,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00a4: 0x00f1,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00a5: 0x00d1,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00a6: 0x00aa,     #  FEMININE ORDINAL INDICATOR\r
+    0x00a7: 0x00ba,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00a8: 0x00bf,     #  INVERTED QUESTION MARK\r
+    0x00a9: 0x2310,     #  REVERSED NOT SIGN\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x00bc,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00ad: 0x00a1,     #  INVERTED EXCLAMATION MARK\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x2561,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x00b6: 0x2562,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x00b7: 0x2556,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x00b8: 0x2555,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x255c,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x00be: 0x255b,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x255e,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x00c7: 0x255f,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x2567,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d0: 0x2568,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d1: 0x2564,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d2: 0x2565,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d3: 0x2559,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x00d4: 0x2558,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x00d5: 0x2552,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x00d6: 0x2553,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x00d7: 0x256b,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d8: 0x256a,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x258c,     #  LEFT HALF BLOCK\r
+    0x00de: 0x2590,     #  RIGHT HALF BLOCK\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x03b1,     #  GREEK SMALL LETTER ALPHA\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e2: 0x0393,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x00e3: 0x03c0,     #  GREEK SMALL LETTER PI\r
+    0x00e4: 0x03a3,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x00e5: 0x03c3,     #  GREEK SMALL LETTER SIGMA\r
+    0x00e6: 0x00b5,     #  MICRO SIGN\r
+    0x00e7: 0x03c4,     #  GREEK SMALL LETTER TAU\r
+    0x00e8: 0x03a6,     #  GREEK CAPITAL LETTER PHI\r
+    0x00e9: 0x0398,     #  GREEK CAPITAL LETTER THETA\r
+    0x00ea: 0x03a9,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x00eb: 0x03b4,     #  GREEK SMALL LETTER DELTA\r
+    0x00ec: 0x221e,     #  INFINITY\r
+    0x00ed: 0x03c6,     #  GREEK SMALL LETTER PHI\r
+    0x00ee: 0x03b5,     #  GREEK SMALL LETTER EPSILON\r
+    0x00ef: 0x2229,     #  INTERSECTION\r
+    0x00f0: 0x2261,     #  IDENTICAL TO\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x2265,     #  GREATER-THAN OR EQUAL TO\r
+    0x00f3: 0x2264,     #  LESS-THAN OR EQUAL TO\r
+    0x00f4: 0x2320,     #  TOP HALF INTEGRAL\r
+    0x00f5: 0x2321,     #  BOTTOM HALF INTEGRAL\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x2248,     #  ALMOST EQUAL TO\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x2219,     #  BULLET OPERATOR\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x221a,     #  SQUARE ROOT\r
+    0x00fc: 0x207f,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\xc7'     #  0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xfc'     #  0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xe9'     #  0x0082 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe2'     #  0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe0'     #  0x0085 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe5'     #  0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x0087 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xea'     #  0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x008a -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xef'     #  0x008b -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xee'     #  0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xec'     #  0x008d -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xc4'     #  0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc9'     #  0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xe6'     #  0x0091 -> LATIN SMALL LIGATURE AE\r
+    u'\xc6'     #  0x0092 -> LATIN CAPITAL LIGATURE AE\r
+    u'\xf4'     #  0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf2'     #  0x0095 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xfb'     #  0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xf9'     #  0x0097 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xff'     #  0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\xd6'     #  0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xa2'     #  0x009b -> CENT SIGN\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\xa5'     #  0x009d -> YEN SIGN\r
+    u'\u20a7'   #  0x009e -> PESETA SIGN\r
+    u'\u0192'   #  0x009f -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\xe1'     #  0x00a0 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xed'     #  0x00a1 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xfa'     #  0x00a3 -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf1'     #  0x00a4 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xd1'     #  0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xaa'     #  0x00a6 -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0x00a7 -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbf'     #  0x00a8 -> INVERTED QUESTION MARK\r
+    u'\u2310'   #  0x00a9 -> REVERSED NOT SIGN\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0x00ac -> VULGAR FRACTION ONE QUARTER\r
+    u'\xa1'     #  0x00ad -> INVERTED EXCLAMATION MARK\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u2561'   #  0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u2562'   #  0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    u'\u2556'   #  0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    u'\u2555'   #  0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255c'   #  0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    u'\u255b'   #  0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u255e'   #  0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u2567'   #  0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2564'   #  0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2565'   #  0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2559'   #  0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u2558'   #  0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2552'   #  0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u2553'   #  0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    u'\u256b'   #  0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u256a'   #  0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u258c'   #  0x00dd -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x00de -> RIGHT HALF BLOCK\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\u03b1'   #  0x00e0 -> GREEK SMALL LETTER ALPHA\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S\r
+    u'\u0393'   #  0x00e2 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u03c0'   #  0x00e3 -> GREEK SMALL LETTER PI\r
+    u'\u03a3'   #  0x00e4 -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03c3'   #  0x00e5 -> GREEK SMALL LETTER SIGMA\r
+    u'\xb5'     #  0x00e6 -> MICRO SIGN\r
+    u'\u03c4'   #  0x00e7 -> GREEK SMALL LETTER TAU\r
+    u'\u03a6'   #  0x00e8 -> GREEK CAPITAL LETTER PHI\r
+    u'\u0398'   #  0x00e9 -> GREEK CAPITAL LETTER THETA\r
+    u'\u03a9'   #  0x00ea -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03b4'   #  0x00eb -> GREEK SMALL LETTER DELTA\r
+    u'\u221e'   #  0x00ec -> INFINITY\r
+    u'\u03c6'   #  0x00ed -> GREEK SMALL LETTER PHI\r
+    u'\u03b5'   #  0x00ee -> GREEK SMALL LETTER EPSILON\r
+    u'\u2229'   #  0x00ef -> INTERSECTION\r
+    u'\u2261'   #  0x00f0 -> IDENTICAL TO\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u2265'   #  0x00f2 -> GREATER-THAN OR EQUAL TO\r
+    u'\u2264'   #  0x00f3 -> LESS-THAN OR EQUAL TO\r
+    u'\u2320'   #  0x00f4 -> TOP HALF INTEGRAL\r
+    u'\u2321'   #  0x00f5 -> BOTTOM HALF INTEGRAL\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\u2248'   #  0x00f7 -> ALMOST EQUAL TO\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\u2219'   #  0x00f9 -> BULLET OPERATOR\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\u221a'   #  0x00fb -> SQUARE ROOT\r
+    u'\u207f'   #  0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a1: 0x00ad,     #  INVERTED EXCLAMATION MARK\r
+    0x00a2: 0x009b,     #  CENT SIGN\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00a5: 0x009d,     #  YEN SIGN\r
+    0x00aa: 0x00a6,     #  FEMININE ORDINAL INDICATOR\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b5: 0x00e6,     #  MICRO SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00ba: 0x00a7,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00bc: 0x00ac,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x00bf: 0x00a8,     #  INVERTED QUESTION MARK\r
+    0x00c4: 0x008e,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x00c5: 0x008f,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x00c6: 0x0092,     #  LATIN CAPITAL LIGATURE AE\r
+    0x00c7: 0x0080,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x00c9: 0x0090,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00d1: 0x00a5,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00d6: 0x0099,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x00dc: 0x009a,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e0: 0x0085,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x00e1: 0x00a0,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00e2: 0x0083,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x00e4: 0x0084,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x00e5: 0x0086,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x00e6: 0x0091,     #  LATIN SMALL LIGATURE AE\r
+    0x00e7: 0x0087,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x00e8: 0x008a,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x00e9: 0x0082,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00ea: 0x0088,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x00eb: 0x0089,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x00ec: 0x008d,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x00ed: 0x00a1,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00ee: 0x008c,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x00ef: 0x008b,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x00f1: 0x00a4,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00f2: 0x0095,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f4: 0x0093,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x00f6: 0x0094,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00f9: 0x0097,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x00fa: 0x00a3,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00fb: 0x0096,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x00fc: 0x0081,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x00ff: 0x0098,     #  LATIN SMALL LETTER Y WITH DIAERESIS\r
+    0x0192: 0x009f,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x0393: 0x00e2,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x0398: 0x00e9,     #  GREEK CAPITAL LETTER THETA\r
+    0x03a3: 0x00e4,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x03a6: 0x00e8,     #  GREEK CAPITAL LETTER PHI\r
+    0x03a9: 0x00ea,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x03b1: 0x00e0,     #  GREEK SMALL LETTER ALPHA\r
+    0x03b4: 0x00eb,     #  GREEK SMALL LETTER DELTA\r
+    0x03b5: 0x00ee,     #  GREEK SMALL LETTER EPSILON\r
+    0x03c0: 0x00e3,     #  GREEK SMALL LETTER PI\r
+    0x03c3: 0x00e5,     #  GREEK SMALL LETTER SIGMA\r
+    0x03c4: 0x00e7,     #  GREEK SMALL LETTER TAU\r
+    0x03c6: 0x00ed,     #  GREEK SMALL LETTER PHI\r
+    0x207f: 0x00fc,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x20a7: 0x009e,     #  PESETA SIGN\r
+    0x2219: 0x00f9,     #  BULLET OPERATOR\r
+    0x221a: 0x00fb,     #  SQUARE ROOT\r
+    0x221e: 0x00ec,     #  INFINITY\r
+    0x2229: 0x00ef,     #  INTERSECTION\r
+    0x2248: 0x00f7,     #  ALMOST EQUAL TO\r
+    0x2261: 0x00f0,     #  IDENTICAL TO\r
+    0x2264: 0x00f3,     #  LESS-THAN OR EQUAL TO\r
+    0x2265: 0x00f2,     #  GREATER-THAN OR EQUAL TO\r
+    0x2310: 0x00a9,     #  REVERSED NOT SIGN\r
+    0x2320: 0x00f4,     #  TOP HALF INTEGRAL\r
+    0x2321: 0x00f5,     #  BOTTOM HALF INTEGRAL\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2552: 0x00d5,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x2553: 0x00d6,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2555: 0x00b8,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x2556: 0x00b7,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x2558: 0x00d4,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x2559: 0x00d3,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255b: 0x00be,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x255c: 0x00bd,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x255e: 0x00c6,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x255f: 0x00c7,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2561: 0x00b5,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x2562: 0x00b6,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2564: 0x00d1,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x2565: 0x00d2,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2567: 0x00cf,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x2568: 0x00d0,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256a: 0x00d8,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x256b: 0x00d7,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x258c: 0x00dd,     #  LEFT HALF BLOCK\r
+    0x2590: 0x00de,     #  RIGHT HALF BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp500.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp500.py
new file mode 100644 (file)
index 0000000..5f60957
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp500 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP500.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp500',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x9c'     #  0x04 -> CONTROL\r
+    u'\t'       #  0x05 -> HORIZONTAL TABULATION\r
+    u'\x86'     #  0x06 -> CONTROL\r
+    u'\x7f'     #  0x07 -> DELETE\r
+    u'\x97'     #  0x08 -> CONTROL\r
+    u'\x8d'     #  0x09 -> CONTROL\r
+    u'\x8e'     #  0x0A -> CONTROL\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x9d'     #  0x14 -> CONTROL\r
+    u'\x85'     #  0x15 -> CONTROL\r
+    u'\x08'     #  0x16 -> BACKSPACE\r
+    u'\x87'     #  0x17 -> CONTROL\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x92'     #  0x1A -> CONTROL\r
+    u'\x8f'     #  0x1B -> CONTROL\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u'\x80'     #  0x20 -> CONTROL\r
+    u'\x81'     #  0x21 -> CONTROL\r
+    u'\x82'     #  0x22 -> CONTROL\r
+    u'\x83'     #  0x23 -> CONTROL\r
+    u'\x84'     #  0x24 -> CONTROL\r
+    u'\n'       #  0x25 -> LINE FEED\r
+    u'\x17'     #  0x26 -> END OF TRANSMISSION BLOCK\r
+    u'\x1b'     #  0x27 -> ESCAPE\r
+    u'\x88'     #  0x28 -> CONTROL\r
+    u'\x89'     #  0x29 -> CONTROL\r
+    u'\x8a'     #  0x2A -> CONTROL\r
+    u'\x8b'     #  0x2B -> CONTROL\r
+    u'\x8c'     #  0x2C -> CONTROL\r
+    u'\x05'     #  0x2D -> ENQUIRY\r
+    u'\x06'     #  0x2E -> ACKNOWLEDGE\r
+    u'\x07'     #  0x2F -> BELL\r
+    u'\x90'     #  0x30 -> CONTROL\r
+    u'\x91'     #  0x31 -> CONTROL\r
+    u'\x16'     #  0x32 -> SYNCHRONOUS IDLE\r
+    u'\x93'     #  0x33 -> CONTROL\r
+    u'\x94'     #  0x34 -> CONTROL\r
+    u'\x95'     #  0x35 -> CONTROL\r
+    u'\x96'     #  0x36 -> CONTROL\r
+    u'\x04'     #  0x37 -> END OF TRANSMISSION\r
+    u'\x98'     #  0x38 -> CONTROL\r
+    u'\x99'     #  0x39 -> CONTROL\r
+    u'\x9a'     #  0x3A -> CONTROL\r
+    u'\x9b'     #  0x3B -> CONTROL\r
+    u'\x14'     #  0x3C -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x3D -> NEGATIVE ACKNOWLEDGE\r
+    u'\x9e'     #  0x3E -> CONTROL\r
+    u'\x1a'     #  0x3F -> SUBSTITUTE\r
+    u' '        #  0x40 -> SPACE\r
+    u'\xa0'     #  0x41 -> NO-BREAK SPACE\r
+    u'\xe2'     #  0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x43 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe0'     #  0x44 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0x45 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe3'     #  0x46 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe5'     #  0x47 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x48 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xf1'     #  0x49 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'['        #  0x4A -> LEFT SQUARE BRACKET\r
+    u'.'        #  0x4B -> FULL STOP\r
+    u'<'        #  0x4C -> LESS-THAN SIGN\r
+    u'('        #  0x4D -> LEFT PARENTHESIS\r
+    u'+'        #  0x4E -> PLUS SIGN\r
+    u'!'        #  0x4F -> EXCLAMATION MARK\r
+    u'&'        #  0x50 -> AMPERSAND\r
+    u'\xe9'     #  0x51 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x53 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x54 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xed'     #  0x55 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x57 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xec'     #  0x58 -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xdf'     #  0x59 -> LATIN SMALL LETTER SHARP S (GERMAN)\r
+    u']'        #  0x5A -> RIGHT SQUARE BRACKET\r
+    u'$'        #  0x5B -> DOLLAR SIGN\r
+    u'*'        #  0x5C -> ASTERISK\r
+    u')'        #  0x5D -> RIGHT PARENTHESIS\r
+    u';'        #  0x5E -> SEMICOLON\r
+    u'^'        #  0x5F -> CIRCUMFLEX ACCENT\r
+    u'-'        #  0x60 -> HYPHEN-MINUS\r
+    u'/'        #  0x61 -> SOLIDUS\r
+    u'\xc2'     #  0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc4'     #  0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc0'     #  0x64 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0x65 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc3'     #  0x66 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc5'     #  0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc7'     #  0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xd1'     #  0x69 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xa6'     #  0x6A -> BROKEN BAR\r
+    u','        #  0x6B -> COMMA\r
+    u'%'        #  0x6C -> PERCENT SIGN\r
+    u'_'        #  0x6D -> LOW LINE\r
+    u'>'        #  0x6E -> GREATER-THAN SIGN\r
+    u'?'        #  0x6F -> QUESTION MARK\r
+    u'\xf8'     #  0x70 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xc9'     #  0x71 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0x74 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xcd'     #  0x75 -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xcc'     #  0x78 -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'`'        #  0x79 -> GRAVE ACCENT\r
+    u':'        #  0x7A -> COLON\r
+    u'#'        #  0x7B -> NUMBER SIGN\r
+    u'@'        #  0x7C -> COMMERCIAL AT\r
+    u"'"        #  0x7D -> APOSTROPHE\r
+    u'='        #  0x7E -> EQUALS SIGN\r
+    u'"'        #  0x7F -> QUOTATION MARK\r
+    u'\xd8'     #  0x80 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'a'        #  0x81 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x82 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x83 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x84 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x85 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x86 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x87 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x88 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x89 -> LATIN SMALL LETTER I\r
+    u'\xab'     #  0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xf0'     #  0x8C -> LATIN SMALL LETTER ETH (ICELANDIC)\r
+    u'\xfd'     #  0x8D -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xfe'     #  0x8E -> LATIN SMALL LETTER THORN (ICELANDIC)\r
+    u'\xb1'     #  0x8F -> PLUS-MINUS SIGN\r
+    u'\xb0'     #  0x90 -> DEGREE SIGN\r
+    u'j'        #  0x91 -> LATIN SMALL LETTER J\r
+    u'k'        #  0x92 -> LATIN SMALL LETTER K\r
+    u'l'        #  0x93 -> LATIN SMALL LETTER L\r
+    u'm'        #  0x94 -> LATIN SMALL LETTER M\r
+    u'n'        #  0x95 -> LATIN SMALL LETTER N\r
+    u'o'        #  0x96 -> LATIN SMALL LETTER O\r
+    u'p'        #  0x97 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x98 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x99 -> LATIN SMALL LETTER R\r
+    u'\xaa'     #  0x9A -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0x9B -> MASCULINE ORDINAL INDICATOR\r
+    u'\xe6'     #  0x9C -> LATIN SMALL LIGATURE AE\r
+    u'\xb8'     #  0x9D -> CEDILLA\r
+    u'\xc6'     #  0x9E -> LATIN CAPITAL LIGATURE AE\r
+    u'\xa4'     #  0x9F -> CURRENCY SIGN\r
+    u'\xb5'     #  0xA0 -> MICRO SIGN\r
+    u'~'        #  0xA1 -> TILDE\r
+    u's'        #  0xA2 -> LATIN SMALL LETTER S\r
+    u't'        #  0xA3 -> LATIN SMALL LETTER T\r
+    u'u'        #  0xA4 -> LATIN SMALL LETTER U\r
+    u'v'        #  0xA5 -> LATIN SMALL LETTER V\r
+    u'w'        #  0xA6 -> LATIN SMALL LETTER W\r
+    u'x'        #  0xA7 -> LATIN SMALL LETTER X\r
+    u'y'        #  0xA8 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0xA9 -> LATIN SMALL LETTER Z\r
+    u'\xa1'     #  0xAA -> INVERTED EXCLAMATION MARK\r
+    u'\xbf'     #  0xAB -> INVERTED QUESTION MARK\r
+    u'\xd0'     #  0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC)\r
+    u'\xdd'     #  0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xde'     #  0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC)\r
+    u'\xae'     #  0xAF -> REGISTERED SIGN\r
+    u'\xa2'     #  0xB0 -> CENT SIGN\r
+    u'\xa3'     #  0xB1 -> POUND SIGN\r
+    u'\xa5'     #  0xB2 -> YEN SIGN\r
+    u'\xb7'     #  0xB3 -> MIDDLE DOT\r
+    u'\xa9'     #  0xB4 -> COPYRIGHT SIGN\r
+    u'\xa7'     #  0xB5 -> SECTION SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xbc'     #  0xB7 -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xB8 -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xB9 -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xac'     #  0xBA -> NOT SIGN\r
+    u'|'        #  0xBB -> VERTICAL LINE\r
+    u'\xaf'     #  0xBC -> MACRON\r
+    u'\xa8'     #  0xBD -> DIAERESIS\r
+    u'\xb4'     #  0xBE -> ACUTE ACCENT\r
+    u'\xd7'     #  0xBF -> MULTIPLICATION SIGN\r
+    u'{'        #  0xC0 -> LEFT CURLY BRACKET\r
+    u'A'        #  0xC1 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0xC2 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0xC3 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0xC4 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0xC5 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0xC6 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0xC7 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0xC8 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0xC9 -> LATIN CAPITAL LETTER I\r
+    u'\xad'     #  0xCA -> SOFT HYPHEN\r
+    u'\xf4'     #  0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0xCC -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf2'     #  0xCD -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xCE -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf5'     #  0xCF -> LATIN SMALL LETTER O WITH TILDE\r
+    u'}'        #  0xD0 -> RIGHT CURLY BRACKET\r
+    u'J'        #  0xD1 -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0xD2 -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0xD3 -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0xD4 -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0xD5 -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0xD6 -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0xD7 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0xD8 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0xD9 -> LATIN CAPITAL LETTER R\r
+    u'\xb9'     #  0xDA -> SUPERSCRIPT ONE\r
+    u'\xfb'     #  0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xDC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xf9'     #  0xDD -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xDE -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xff'     #  0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\\'       #  0xE0 -> REVERSE SOLIDUS\r
+    u'\xf7'     #  0xE1 -> DIVISION SIGN\r
+    u'S'        #  0xE2 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0xE3 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0xE4 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0xE5 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0xE6 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0xE7 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0xE8 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0xE9 -> LATIN CAPITAL LETTER Z\r
+    u'\xb2'     #  0xEA -> SUPERSCRIPT TWO\r
+    u'\xd4'     #  0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd6'     #  0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd2'     #  0xED -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xEE -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd5'     #  0xEF -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'0'        #  0xF0 -> DIGIT ZERO\r
+    u'1'        #  0xF1 -> DIGIT ONE\r
+    u'2'        #  0xF2 -> DIGIT TWO\r
+    u'3'        #  0xF3 -> DIGIT THREE\r
+    u'4'        #  0xF4 -> DIGIT FOUR\r
+    u'5'        #  0xF5 -> DIGIT FIVE\r
+    u'6'        #  0xF6 -> DIGIT SIX\r
+    u'7'        #  0xF7 -> DIGIT SEVEN\r
+    u'8'        #  0xF8 -> DIGIT EIGHT\r
+    u'9'        #  0xF9 -> DIGIT NINE\r
+    u'\xb3'     #  0xFA -> SUPERSCRIPT THREE\r
+    u'\xdb'     #  0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xd9'     #  0xFD -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xFE -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\x9f'     #  0xFF -> CONTROL\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp720.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp720.py
new file mode 100644 (file)
index 0000000..e8e0ae1
--- /dev/null
@@ -0,0 +1,309 @@
+"""Python Character Mapping Codec cp720 generated on Windows:\r
+Vista 6.0.6002 SP2 Multiprocessor Free with the command:\r
+  python Tools/unicode/genwincodec.py 720\r
+"""#"\r
+\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp720',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x01 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x02 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x03 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x04 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x05 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x06 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x07 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x08 -> CONTROL CHARACTER\r
+    u'\t'       #  0x09 -> CONTROL CHARACTER\r
+    u'\n'       #  0x0A -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x0B -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x0C -> CONTROL CHARACTER\r
+    u'\r'       #  0x0D -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x0E -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x0F -> CONTROL CHARACTER\r
+    u'\x10'     #  0x10 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x11 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x12 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x13 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x14 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x15 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x16 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x17 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x18 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x19 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x1A -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x1B -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x1C -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x1D -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x1E -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x1F -> CONTROL CHARACTER\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> CONTROL CHARACTER\r
+    u'\x80'\r
+    u'\x81'\r
+    u'\xe9'     #  0x82 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe2'     #  0x83 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\x84'\r
+    u'\xe0'     #  0x85 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\x86'\r
+    u'\xe7'     #  0x87 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xea'     #  0x88 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x89 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x8A -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xef'     #  0x8B -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xee'     #  0x8C -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\x8d'\r
+    u'\x8e'\r
+    u'\x8f'\r
+    u'\x90'\r
+    u'\u0651'   #  0x91 -> ARABIC SHADDA\r
+    u'\u0652'   #  0x92 -> ARABIC SUKUN\r
+    u'\xf4'     #  0x93 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xa4'     #  0x94 -> CURRENCY SIGN\r
+    u'\u0640'   #  0x95 -> ARABIC TATWEEL\r
+    u'\xfb'     #  0x96 -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xf9'     #  0x97 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\u0621'   #  0x98 -> ARABIC LETTER HAMZA\r
+    u'\u0622'   #  0x99 -> ARABIC LETTER ALEF WITH MADDA ABOVE\r
+    u'\u0623'   #  0x9A -> ARABIC LETTER ALEF WITH HAMZA ABOVE\r
+    u'\u0624'   #  0x9B -> ARABIC LETTER WAW WITH HAMZA ABOVE\r
+    u'\xa3'     #  0x9C -> POUND SIGN\r
+    u'\u0625'   #  0x9D -> ARABIC LETTER ALEF WITH HAMZA BELOW\r
+    u'\u0626'   #  0x9E -> ARABIC LETTER YEH WITH HAMZA ABOVE\r
+    u'\u0627'   #  0x9F -> ARABIC LETTER ALEF\r
+    u'\u0628'   #  0xA0 -> ARABIC LETTER BEH\r
+    u'\u0629'   #  0xA1 -> ARABIC LETTER TEH MARBUTA\r
+    u'\u062a'   #  0xA2 -> ARABIC LETTER TEH\r
+    u'\u062b'   #  0xA3 -> ARABIC LETTER THEH\r
+    u'\u062c'   #  0xA4 -> ARABIC LETTER JEEM\r
+    u'\u062d'   #  0xA5 -> ARABIC LETTER HAH\r
+    u'\u062e'   #  0xA6 -> ARABIC LETTER KHAH\r
+    u'\u062f'   #  0xA7 -> ARABIC LETTER DAL\r
+    u'\u0630'   #  0xA8 -> ARABIC LETTER THAL\r
+    u'\u0631'   #  0xA9 -> ARABIC LETTER REH\r
+    u'\u0632'   #  0xAA -> ARABIC LETTER ZAIN\r
+    u'\u0633'   #  0xAB -> ARABIC LETTER SEEN\r
+    u'\u0634'   #  0xAC -> ARABIC LETTER SHEEN\r
+    u'\u0635'   #  0xAD -> ARABIC LETTER SAD\r
+    u'\xab'     #  0xAE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0xAF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0xB0 -> LIGHT SHADE\r
+    u'\u2592'   #  0xB1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0xB2 -> DARK SHADE\r
+    u'\u2502'   #  0xB3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0xB4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u2561'   #  0xB5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u2562'   #  0xB6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    u'\u2556'   #  0xB7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    u'\u2555'   #  0xB8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    u'\u2563'   #  0xB9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0xBA -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0xBB -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0xBC -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255c'   #  0xBD -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    u'\u255b'   #  0xBE -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u2510'   #  0xBF -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0xC0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0xC1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0xC2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0xC3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0xC4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0xC5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u255e'   #  0xC6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0xC7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0xC8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0xC9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0xCA -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0xCB -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0xCC -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0xCD -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0xCE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u2567'   #  0xCF -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0xD0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2564'   #  0xD1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2565'   #  0xD2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2559'   #  0xD3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u2558'   #  0xD4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2552'   #  0xD5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u2553'   #  0xD6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    u'\u256b'   #  0xD7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u256a'   #  0xD8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2518'   #  0xD9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0xDA -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0xDB -> FULL BLOCK\r
+    u'\u2584'   #  0xDC -> LOWER HALF BLOCK\r
+    u'\u258c'   #  0xDD -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0xDE -> RIGHT HALF BLOCK\r
+    u'\u2580'   #  0xDF -> UPPER HALF BLOCK\r
+    u'\u0636'   #  0xE0 -> ARABIC LETTER DAD\r
+    u'\u0637'   #  0xE1 -> ARABIC LETTER TAH\r
+    u'\u0638'   #  0xE2 -> ARABIC LETTER ZAH\r
+    u'\u0639'   #  0xE3 -> ARABIC LETTER AIN\r
+    u'\u063a'   #  0xE4 -> ARABIC LETTER GHAIN\r
+    u'\u0641'   #  0xE5 -> ARABIC LETTER FEH\r
+    u'\xb5'     #  0xE6 -> MICRO SIGN\r
+    u'\u0642'   #  0xE7 -> ARABIC LETTER QAF\r
+    u'\u0643'   #  0xE8 -> ARABIC LETTER KAF\r
+    u'\u0644'   #  0xE9 -> ARABIC LETTER LAM\r
+    u'\u0645'   #  0xEA -> ARABIC LETTER MEEM\r
+    u'\u0646'   #  0xEB -> ARABIC LETTER NOON\r
+    u'\u0647'   #  0xEC -> ARABIC LETTER HEH\r
+    u'\u0648'   #  0xED -> ARABIC LETTER WAW\r
+    u'\u0649'   #  0xEE -> ARABIC LETTER ALEF MAKSURA\r
+    u'\u064a'   #  0xEF -> ARABIC LETTER YEH\r
+    u'\u2261'   #  0xF0 -> IDENTICAL TO\r
+    u'\u064b'   #  0xF1 -> ARABIC FATHATAN\r
+    u'\u064c'   #  0xF2 -> ARABIC DAMMATAN\r
+    u'\u064d'   #  0xF3 -> ARABIC KASRATAN\r
+    u'\u064e'   #  0xF4 -> ARABIC FATHA\r
+    u'\u064f'   #  0xF5 -> ARABIC DAMMA\r
+    u'\u0650'   #  0xF6 -> ARABIC KASRA\r
+    u'\u2248'   #  0xF7 -> ALMOST EQUAL TO\r
+    u'\xb0'     #  0xF8 -> DEGREE SIGN\r
+    u'\u2219'   #  0xF9 -> BULLET OPERATOR\r
+    u'\xb7'     #  0xFA -> MIDDLE DOT\r
+    u'\u221a'   #  0xFB -> SQUARE ROOT\r
+    u'\u207f'   #  0xFC -> SUPERSCRIPT LATIN SMALL LETTER N\r
+    u'\xb2'     #  0xFD -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0xFE -> BLACK SQUARE\r
+    u'\xa0'     #  0xFF -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp737.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp737.py
new file mode 100644 (file)
index 0000000..2c080e5
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec cp737 generated from 'VENDORS/MICSFT/PC/CP737.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp737',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x0391,     #  GREEK CAPITAL LETTER ALPHA\r
+    0x0081: 0x0392,     #  GREEK CAPITAL LETTER BETA\r
+    0x0082: 0x0393,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x0083: 0x0394,     #  GREEK CAPITAL LETTER DELTA\r
+    0x0084: 0x0395,     #  GREEK CAPITAL LETTER EPSILON\r
+    0x0085: 0x0396,     #  GREEK CAPITAL LETTER ZETA\r
+    0x0086: 0x0397,     #  GREEK CAPITAL LETTER ETA\r
+    0x0087: 0x0398,     #  GREEK CAPITAL LETTER THETA\r
+    0x0088: 0x0399,     #  GREEK CAPITAL LETTER IOTA\r
+    0x0089: 0x039a,     #  GREEK CAPITAL LETTER KAPPA\r
+    0x008a: 0x039b,     #  GREEK CAPITAL LETTER LAMDA\r
+    0x008b: 0x039c,     #  GREEK CAPITAL LETTER MU\r
+    0x008c: 0x039d,     #  GREEK CAPITAL LETTER NU\r
+    0x008d: 0x039e,     #  GREEK CAPITAL LETTER XI\r
+    0x008e: 0x039f,     #  GREEK CAPITAL LETTER OMICRON\r
+    0x008f: 0x03a0,     #  GREEK CAPITAL LETTER PI\r
+    0x0090: 0x03a1,     #  GREEK CAPITAL LETTER RHO\r
+    0x0091: 0x03a3,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x0092: 0x03a4,     #  GREEK CAPITAL LETTER TAU\r
+    0x0093: 0x03a5,     #  GREEK CAPITAL LETTER UPSILON\r
+    0x0094: 0x03a6,     #  GREEK CAPITAL LETTER PHI\r
+    0x0095: 0x03a7,     #  GREEK CAPITAL LETTER CHI\r
+    0x0096: 0x03a8,     #  GREEK CAPITAL LETTER PSI\r
+    0x0097: 0x03a9,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x0098: 0x03b1,     #  GREEK SMALL LETTER ALPHA\r
+    0x0099: 0x03b2,     #  GREEK SMALL LETTER BETA\r
+    0x009a: 0x03b3,     #  GREEK SMALL LETTER GAMMA\r
+    0x009b: 0x03b4,     #  GREEK SMALL LETTER DELTA\r
+    0x009c: 0x03b5,     #  GREEK SMALL LETTER EPSILON\r
+    0x009d: 0x03b6,     #  GREEK SMALL LETTER ZETA\r
+    0x009e: 0x03b7,     #  GREEK SMALL LETTER ETA\r
+    0x009f: 0x03b8,     #  GREEK SMALL LETTER THETA\r
+    0x00a0: 0x03b9,     #  GREEK SMALL LETTER IOTA\r
+    0x00a1: 0x03ba,     #  GREEK SMALL LETTER KAPPA\r
+    0x00a2: 0x03bb,     #  GREEK SMALL LETTER LAMDA\r
+    0x00a3: 0x03bc,     #  GREEK SMALL LETTER MU\r
+    0x00a4: 0x03bd,     #  GREEK SMALL LETTER NU\r
+    0x00a5: 0x03be,     #  GREEK SMALL LETTER XI\r
+    0x00a6: 0x03bf,     #  GREEK SMALL LETTER OMICRON\r
+    0x00a7: 0x03c0,     #  GREEK SMALL LETTER PI\r
+    0x00a8: 0x03c1,     #  GREEK SMALL LETTER RHO\r
+    0x00a9: 0x03c3,     #  GREEK SMALL LETTER SIGMA\r
+    0x00aa: 0x03c2,     #  GREEK SMALL LETTER FINAL SIGMA\r
+    0x00ab: 0x03c4,     #  GREEK SMALL LETTER TAU\r
+    0x00ac: 0x03c5,     #  GREEK SMALL LETTER UPSILON\r
+    0x00ad: 0x03c6,     #  GREEK SMALL LETTER PHI\r
+    0x00ae: 0x03c7,     #  GREEK SMALL LETTER CHI\r
+    0x00af: 0x03c8,     #  GREEK SMALL LETTER PSI\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x2561,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x00b6: 0x2562,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x00b7: 0x2556,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x00b8: 0x2555,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x255c,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x00be: 0x255b,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x255e,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x00c7: 0x255f,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x2567,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d0: 0x2568,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d1: 0x2564,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d2: 0x2565,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d3: 0x2559,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x00d4: 0x2558,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x00d5: 0x2552,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x00d6: 0x2553,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x00d7: 0x256b,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d8: 0x256a,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x258c,     #  LEFT HALF BLOCK\r
+    0x00de: 0x2590,     #  RIGHT HALF BLOCK\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x03c9,     #  GREEK SMALL LETTER OMEGA\r
+    0x00e1: 0x03ac,     #  GREEK SMALL LETTER ALPHA WITH TONOS\r
+    0x00e2: 0x03ad,     #  GREEK SMALL LETTER EPSILON WITH TONOS\r
+    0x00e3: 0x03ae,     #  GREEK SMALL LETTER ETA WITH TONOS\r
+    0x00e4: 0x03ca,     #  GREEK SMALL LETTER IOTA WITH DIALYTIKA\r
+    0x00e5: 0x03af,     #  GREEK SMALL LETTER IOTA WITH TONOS\r
+    0x00e6: 0x03cc,     #  GREEK SMALL LETTER OMICRON WITH TONOS\r
+    0x00e7: 0x03cd,     #  GREEK SMALL LETTER UPSILON WITH TONOS\r
+    0x00e8: 0x03cb,     #  GREEK SMALL LETTER UPSILON WITH DIALYTIKA\r
+    0x00e9: 0x03ce,     #  GREEK SMALL LETTER OMEGA WITH TONOS\r
+    0x00ea: 0x0386,     #  GREEK CAPITAL LETTER ALPHA WITH TONOS\r
+    0x00eb: 0x0388,     #  GREEK CAPITAL LETTER EPSILON WITH TONOS\r
+    0x00ec: 0x0389,     #  GREEK CAPITAL LETTER ETA WITH TONOS\r
+    0x00ed: 0x038a,     #  GREEK CAPITAL LETTER IOTA WITH TONOS\r
+    0x00ee: 0x038c,     #  GREEK CAPITAL LETTER OMICRON WITH TONOS\r
+    0x00ef: 0x038e,     #  GREEK CAPITAL LETTER UPSILON WITH TONOS\r
+    0x00f0: 0x038f,     #  GREEK CAPITAL LETTER OMEGA WITH TONOS\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x2265,     #  GREATER-THAN OR EQUAL TO\r
+    0x00f3: 0x2264,     #  LESS-THAN OR EQUAL TO\r
+    0x00f4: 0x03aa,     #  GREEK CAPITAL LETTER IOTA WITH DIALYTIKA\r
+    0x00f5: 0x03ab,     #  GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x2248,     #  ALMOST EQUAL TO\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x2219,     #  BULLET OPERATOR\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x221a,     #  SQUARE ROOT\r
+    0x00fc: 0x207f,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\u0391'   #  0x0080 -> GREEK CAPITAL LETTER ALPHA\r
+    u'\u0392'   #  0x0081 -> GREEK CAPITAL LETTER BETA\r
+    u'\u0393'   #  0x0082 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u0394'   #  0x0083 -> GREEK CAPITAL LETTER DELTA\r
+    u'\u0395'   #  0x0084 -> GREEK CAPITAL LETTER EPSILON\r
+    u'\u0396'   #  0x0085 -> GREEK CAPITAL LETTER ZETA\r
+    u'\u0397'   #  0x0086 -> GREEK CAPITAL LETTER ETA\r
+    u'\u0398'   #  0x0087 -> GREEK CAPITAL LETTER THETA\r
+    u'\u0399'   #  0x0088 -> GREEK CAPITAL LETTER IOTA\r
+    u'\u039a'   #  0x0089 -> GREEK CAPITAL LETTER KAPPA\r
+    u'\u039b'   #  0x008a -> GREEK CAPITAL LETTER LAMDA\r
+    u'\u039c'   #  0x008b -> GREEK CAPITAL LETTER MU\r
+    u'\u039d'   #  0x008c -> GREEK CAPITAL LETTER NU\r
+    u'\u039e'   #  0x008d -> GREEK CAPITAL LETTER XI\r
+    u'\u039f'   #  0x008e -> GREEK CAPITAL LETTER OMICRON\r
+    u'\u03a0'   #  0x008f -> GREEK CAPITAL LETTER PI\r
+    u'\u03a1'   #  0x0090 -> GREEK CAPITAL LETTER RHO\r
+    u'\u03a3'   #  0x0091 -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03a4'   #  0x0092 -> GREEK CAPITAL LETTER TAU\r
+    u'\u03a5'   #  0x0093 -> GREEK CAPITAL LETTER UPSILON\r
+    u'\u03a6'   #  0x0094 -> GREEK CAPITAL LETTER PHI\r
+    u'\u03a7'   #  0x0095 -> GREEK CAPITAL LETTER CHI\r
+    u'\u03a8'   #  0x0096 -> GREEK CAPITAL LETTER PSI\r
+    u'\u03a9'   #  0x0097 -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03b1'   #  0x0098 -> GREEK SMALL LETTER ALPHA\r
+    u'\u03b2'   #  0x0099 -> GREEK SMALL LETTER BETA\r
+    u'\u03b3'   #  0x009a -> GREEK SMALL LETTER GAMMA\r
+    u'\u03b4'   #  0x009b -> GREEK SMALL LETTER DELTA\r
+    u'\u03b5'   #  0x009c -> GREEK SMALL LETTER EPSILON\r
+    u'\u03b6'   #  0x009d -> GREEK SMALL LETTER ZETA\r
+    u'\u03b7'   #  0x009e -> GREEK SMALL LETTER ETA\r
+    u'\u03b8'   #  0x009f -> GREEK SMALL LETTER THETA\r
+    u'\u03b9'   #  0x00a0 -> GREEK SMALL LETTER IOTA\r
+    u'\u03ba'   #  0x00a1 -> GREEK SMALL LETTER KAPPA\r
+    u'\u03bb'   #  0x00a2 -> GREEK SMALL LETTER LAMDA\r
+    u'\u03bc'   #  0x00a3 -> GREEK SMALL LETTER MU\r
+    u'\u03bd'   #  0x00a4 -> GREEK SMALL LETTER NU\r
+    u'\u03be'   #  0x00a5 -> GREEK SMALL LETTER XI\r
+    u'\u03bf'   #  0x00a6 -> GREEK SMALL LETTER OMICRON\r
+    u'\u03c0'   #  0x00a7 -> GREEK SMALL LETTER PI\r
+    u'\u03c1'   #  0x00a8 -> GREEK SMALL LETTER RHO\r
+    u'\u03c3'   #  0x00a9 -> GREEK SMALL LETTER SIGMA\r
+    u'\u03c2'   #  0x00aa -> GREEK SMALL LETTER FINAL SIGMA\r
+    u'\u03c4'   #  0x00ab -> GREEK SMALL LETTER TAU\r
+    u'\u03c5'   #  0x00ac -> GREEK SMALL LETTER UPSILON\r
+    u'\u03c6'   #  0x00ad -> GREEK SMALL LETTER PHI\r
+    u'\u03c7'   #  0x00ae -> GREEK SMALL LETTER CHI\r
+    u'\u03c8'   #  0x00af -> GREEK SMALL LETTER PSI\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u2561'   #  0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u2562'   #  0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    u'\u2556'   #  0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    u'\u2555'   #  0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255c'   #  0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    u'\u255b'   #  0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u255e'   #  0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u2567'   #  0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2564'   #  0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2565'   #  0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2559'   #  0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u2558'   #  0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2552'   #  0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u2553'   #  0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    u'\u256b'   #  0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u256a'   #  0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u258c'   #  0x00dd -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x00de -> RIGHT HALF BLOCK\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\u03c9'   #  0x00e0 -> GREEK SMALL LETTER OMEGA\r
+    u'\u03ac'   #  0x00e1 -> GREEK SMALL LETTER ALPHA WITH TONOS\r
+    u'\u03ad'   #  0x00e2 -> GREEK SMALL LETTER EPSILON WITH TONOS\r
+    u'\u03ae'   #  0x00e3 -> GREEK SMALL LETTER ETA WITH TONOS\r
+    u'\u03ca'   #  0x00e4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA\r
+    u'\u03af'   #  0x00e5 -> GREEK SMALL LETTER IOTA WITH TONOS\r
+    u'\u03cc'   #  0x00e6 -> GREEK SMALL LETTER OMICRON WITH TONOS\r
+    u'\u03cd'   #  0x00e7 -> GREEK SMALL LETTER UPSILON WITH TONOS\r
+    u'\u03cb'   #  0x00e8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA\r
+    u'\u03ce'   #  0x00e9 -> GREEK SMALL LETTER OMEGA WITH TONOS\r
+    u'\u0386'   #  0x00ea -> GREEK CAPITAL LETTER ALPHA WITH TONOS\r
+    u'\u0388'   #  0x00eb -> GREEK CAPITAL LETTER EPSILON WITH TONOS\r
+    u'\u0389'   #  0x00ec -> GREEK CAPITAL LETTER ETA WITH TONOS\r
+    u'\u038a'   #  0x00ed -> GREEK CAPITAL LETTER IOTA WITH TONOS\r
+    u'\u038c'   #  0x00ee -> GREEK CAPITAL LETTER OMICRON WITH TONOS\r
+    u'\u038e'   #  0x00ef -> GREEK CAPITAL LETTER UPSILON WITH TONOS\r
+    u'\u038f'   #  0x00f0 -> GREEK CAPITAL LETTER OMEGA WITH TONOS\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u2265'   #  0x00f2 -> GREATER-THAN OR EQUAL TO\r
+    u'\u2264'   #  0x00f3 -> LESS-THAN OR EQUAL TO\r
+    u'\u03aa'   #  0x00f4 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA\r
+    u'\u03ab'   #  0x00f5 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\u2248'   #  0x00f7 -> ALMOST EQUAL TO\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\u2219'   #  0x00f9 -> BULLET OPERATOR\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\u221a'   #  0x00fb -> SQUARE ROOT\r
+    u'\u207f'   #  0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x0386: 0x00ea,     #  GREEK CAPITAL LETTER ALPHA WITH TONOS\r
+    0x0388: 0x00eb,     #  GREEK CAPITAL LETTER EPSILON WITH TONOS\r
+    0x0389: 0x00ec,     #  GREEK CAPITAL LETTER ETA WITH TONOS\r
+    0x038a: 0x00ed,     #  GREEK CAPITAL LETTER IOTA WITH TONOS\r
+    0x038c: 0x00ee,     #  GREEK CAPITAL LETTER OMICRON WITH TONOS\r
+    0x038e: 0x00ef,     #  GREEK CAPITAL LETTER UPSILON WITH TONOS\r
+    0x038f: 0x00f0,     #  GREEK CAPITAL LETTER OMEGA WITH TONOS\r
+    0x0391: 0x0080,     #  GREEK CAPITAL LETTER ALPHA\r
+    0x0392: 0x0081,     #  GREEK CAPITAL LETTER BETA\r
+    0x0393: 0x0082,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x0394: 0x0083,     #  GREEK CAPITAL LETTER DELTA\r
+    0x0395: 0x0084,     #  GREEK CAPITAL LETTER EPSILON\r
+    0x0396: 0x0085,     #  GREEK CAPITAL LETTER ZETA\r
+    0x0397: 0x0086,     #  GREEK CAPITAL LETTER ETA\r
+    0x0398: 0x0087,     #  GREEK CAPITAL LETTER THETA\r
+    0x0399: 0x0088,     #  GREEK CAPITAL LETTER IOTA\r
+    0x039a: 0x0089,     #  GREEK CAPITAL LETTER KAPPA\r
+    0x039b: 0x008a,     #  GREEK CAPITAL LETTER LAMDA\r
+    0x039c: 0x008b,     #  GREEK CAPITAL LETTER MU\r
+    0x039d: 0x008c,     #  GREEK CAPITAL LETTER NU\r
+    0x039e: 0x008d,     #  GREEK CAPITAL LETTER XI\r
+    0x039f: 0x008e,     #  GREEK CAPITAL LETTER OMICRON\r
+    0x03a0: 0x008f,     #  GREEK CAPITAL LETTER PI\r
+    0x03a1: 0x0090,     #  GREEK CAPITAL LETTER RHO\r
+    0x03a3: 0x0091,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x03a4: 0x0092,     #  GREEK CAPITAL LETTER TAU\r
+    0x03a5: 0x0093,     #  GREEK CAPITAL LETTER UPSILON\r
+    0x03a6: 0x0094,     #  GREEK CAPITAL LETTER PHI\r
+    0x03a7: 0x0095,     #  GREEK CAPITAL LETTER CHI\r
+    0x03a8: 0x0096,     #  GREEK CAPITAL LETTER PSI\r
+    0x03a9: 0x0097,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x03aa: 0x00f4,     #  GREEK CAPITAL LETTER IOTA WITH DIALYTIKA\r
+    0x03ab: 0x00f5,     #  GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA\r
+    0x03ac: 0x00e1,     #  GREEK SMALL LETTER ALPHA WITH TONOS\r
+    0x03ad: 0x00e2,     #  GREEK SMALL LETTER EPSILON WITH TONOS\r
+    0x03ae: 0x00e3,     #  GREEK SMALL LETTER ETA WITH TONOS\r
+    0x03af: 0x00e5,     #  GREEK SMALL LETTER IOTA WITH TONOS\r
+    0x03b1: 0x0098,     #  GREEK SMALL LETTER ALPHA\r
+    0x03b2: 0x0099,     #  GREEK SMALL LETTER BETA\r
+    0x03b3: 0x009a,     #  GREEK SMALL LETTER GAMMA\r
+    0x03b4: 0x009b,     #  GREEK SMALL LETTER DELTA\r
+    0x03b5: 0x009c,     #  GREEK SMALL LETTER EPSILON\r
+    0x03b6: 0x009d,     #  GREEK SMALL LETTER ZETA\r
+    0x03b7: 0x009e,     #  GREEK SMALL LETTER ETA\r
+    0x03b8: 0x009f,     #  GREEK SMALL LETTER THETA\r
+    0x03b9: 0x00a0,     #  GREEK SMALL LETTER IOTA\r
+    0x03ba: 0x00a1,     #  GREEK SMALL LETTER KAPPA\r
+    0x03bb: 0x00a2,     #  GREEK SMALL LETTER LAMDA\r
+    0x03bc: 0x00a3,     #  GREEK SMALL LETTER MU\r
+    0x03bd: 0x00a4,     #  GREEK SMALL LETTER NU\r
+    0x03be: 0x00a5,     #  GREEK SMALL LETTER XI\r
+    0x03bf: 0x00a6,     #  GREEK SMALL LETTER OMICRON\r
+    0x03c0: 0x00a7,     #  GREEK SMALL LETTER PI\r
+    0x03c1: 0x00a8,     #  GREEK SMALL LETTER RHO\r
+    0x03c2: 0x00aa,     #  GREEK SMALL LETTER FINAL SIGMA\r
+    0x03c3: 0x00a9,     #  GREEK SMALL LETTER SIGMA\r
+    0x03c4: 0x00ab,     #  GREEK SMALL LETTER TAU\r
+    0x03c5: 0x00ac,     #  GREEK SMALL LETTER UPSILON\r
+    0x03c6: 0x00ad,     #  GREEK SMALL LETTER PHI\r
+    0x03c7: 0x00ae,     #  GREEK SMALL LETTER CHI\r
+    0x03c8: 0x00af,     #  GREEK SMALL LETTER PSI\r
+    0x03c9: 0x00e0,     #  GREEK SMALL LETTER OMEGA\r
+    0x03ca: 0x00e4,     #  GREEK SMALL LETTER IOTA WITH DIALYTIKA\r
+    0x03cb: 0x00e8,     #  GREEK SMALL LETTER UPSILON WITH DIALYTIKA\r
+    0x03cc: 0x00e6,     #  GREEK SMALL LETTER OMICRON WITH TONOS\r
+    0x03cd: 0x00e7,     #  GREEK SMALL LETTER UPSILON WITH TONOS\r
+    0x03ce: 0x00e9,     #  GREEK SMALL LETTER OMEGA WITH TONOS\r
+    0x207f: 0x00fc,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x2219: 0x00f9,     #  BULLET OPERATOR\r
+    0x221a: 0x00fb,     #  SQUARE ROOT\r
+    0x2248: 0x00f7,     #  ALMOST EQUAL TO\r
+    0x2264: 0x00f3,     #  LESS-THAN OR EQUAL TO\r
+    0x2265: 0x00f2,     #  GREATER-THAN OR EQUAL TO\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2552: 0x00d5,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x2553: 0x00d6,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2555: 0x00b8,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x2556: 0x00b7,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x2558: 0x00d4,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x2559: 0x00d3,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255b: 0x00be,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x255c: 0x00bd,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x255e: 0x00c6,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x255f: 0x00c7,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2561: 0x00b5,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x2562: 0x00b6,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2564: 0x00d1,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x2565: 0x00d2,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2567: 0x00cf,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x2568: 0x00d0,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256a: 0x00d8,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x256b: 0x00d7,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x258c: 0x00dd,     #  LEFT HALF BLOCK\r
+    0x2590: 0x00de,     #  RIGHT HALF BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp775.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp775.py
new file mode 100644 (file)
index 0000000..eadb989
--- /dev/null
@@ -0,0 +1,697 @@
+""" Python Character Mapping Codec cp775 generated from 'VENDORS/MICSFT/PC/CP775.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp775',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x0106,     #  LATIN CAPITAL LETTER C WITH ACUTE\r
+    0x0081: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0082: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x0083: 0x0101,     #  LATIN SMALL LETTER A WITH MACRON\r
+    0x0084: 0x00e4,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x0085: 0x0123,     #  LATIN SMALL LETTER G WITH CEDILLA\r
+    0x0086: 0x00e5,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x0087: 0x0107,     #  LATIN SMALL LETTER C WITH ACUTE\r
+    0x0088: 0x0142,     #  LATIN SMALL LETTER L WITH STROKE\r
+    0x0089: 0x0113,     #  LATIN SMALL LETTER E WITH MACRON\r
+    0x008a: 0x0156,     #  LATIN CAPITAL LETTER R WITH CEDILLA\r
+    0x008b: 0x0157,     #  LATIN SMALL LETTER R WITH CEDILLA\r
+    0x008c: 0x012b,     #  LATIN SMALL LETTER I WITH MACRON\r
+    0x008d: 0x0179,     #  LATIN CAPITAL LETTER Z WITH ACUTE\r
+    0x008e: 0x00c4,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x008f: 0x00c5,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x0090: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0091: 0x00e6,     #  LATIN SMALL LIGATURE AE\r
+    0x0092: 0x00c6,     #  LATIN CAPITAL LIGATURE AE\r
+    0x0093: 0x014d,     #  LATIN SMALL LETTER O WITH MACRON\r
+    0x0094: 0x00f6,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x0095: 0x0122,     #  LATIN CAPITAL LETTER G WITH CEDILLA\r
+    0x0096: 0x00a2,     #  CENT SIGN\r
+    0x0097: 0x015a,     #  LATIN CAPITAL LETTER S WITH ACUTE\r
+    0x0098: 0x015b,     #  LATIN SMALL LETTER S WITH ACUTE\r
+    0x0099: 0x00d6,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x009a: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x009b: 0x00f8,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x00d8,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x009e: 0x00d7,     #  MULTIPLICATION SIGN\r
+    0x009f: 0x00a4,     #  CURRENCY SIGN\r
+    0x00a0: 0x0100,     #  LATIN CAPITAL LETTER A WITH MACRON\r
+    0x00a1: 0x012a,     #  LATIN CAPITAL LETTER I WITH MACRON\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x017b,     #  LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    0x00a4: 0x017c,     #  LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    0x00a5: 0x017a,     #  LATIN SMALL LETTER Z WITH ACUTE\r
+    0x00a6: 0x201d,     #  RIGHT DOUBLE QUOTATION MARK\r
+    0x00a7: 0x00a6,     #  BROKEN BAR\r
+    0x00a8: 0x00a9,     #  COPYRIGHT SIGN\r
+    0x00a9: 0x00ae,     #  REGISTERED SIGN\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x00bc,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00ad: 0x0141,     #  LATIN CAPITAL LETTER L WITH STROKE\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x0104,     #  LATIN CAPITAL LETTER A WITH OGONEK\r
+    0x00b6: 0x010c,     #  LATIN CAPITAL LETTER C WITH CARON\r
+    0x00b7: 0x0118,     #  LATIN CAPITAL LETTER E WITH OGONEK\r
+    0x00b8: 0x0116,     #  LATIN CAPITAL LETTER E WITH DOT ABOVE\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x012e,     #  LATIN CAPITAL LETTER I WITH OGONEK\r
+    0x00be: 0x0160,     #  LATIN CAPITAL LETTER S WITH CARON\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x0172,     #  LATIN CAPITAL LETTER U WITH OGONEK\r
+    0x00c7: 0x016a,     #  LATIN CAPITAL LETTER U WITH MACRON\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x017d,     #  LATIN CAPITAL LETTER Z WITH CARON\r
+    0x00d0: 0x0105,     #  LATIN SMALL LETTER A WITH OGONEK\r
+    0x00d1: 0x010d,     #  LATIN SMALL LETTER C WITH CARON\r
+    0x00d2: 0x0119,     #  LATIN SMALL LETTER E WITH OGONEK\r
+    0x00d3: 0x0117,     #  LATIN SMALL LETTER E WITH DOT ABOVE\r
+    0x00d4: 0x012f,     #  LATIN SMALL LETTER I WITH OGONEK\r
+    0x00d5: 0x0161,     #  LATIN SMALL LETTER S WITH CARON\r
+    0x00d6: 0x0173,     #  LATIN SMALL LETTER U WITH OGONEK\r
+    0x00d7: 0x016b,     #  LATIN SMALL LETTER U WITH MACRON\r
+    0x00d8: 0x017e,     #  LATIN SMALL LETTER Z WITH CARON\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x258c,     #  LEFT HALF BLOCK\r
+    0x00de: 0x2590,     #  RIGHT HALF BLOCK\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x00d3,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S (GERMAN)\r
+    0x00e2: 0x014c,     #  LATIN CAPITAL LETTER O WITH MACRON\r
+    0x00e3: 0x0143,     #  LATIN CAPITAL LETTER N WITH ACUTE\r
+    0x00e4: 0x00f5,     #  LATIN SMALL LETTER O WITH TILDE\r
+    0x00e5: 0x00d5,     #  LATIN CAPITAL LETTER O WITH TILDE\r
+    0x00e6: 0x00b5,     #  MICRO SIGN\r
+    0x00e7: 0x0144,     #  LATIN SMALL LETTER N WITH ACUTE\r
+    0x00e8: 0x0136,     #  LATIN CAPITAL LETTER K WITH CEDILLA\r
+    0x00e9: 0x0137,     #  LATIN SMALL LETTER K WITH CEDILLA\r
+    0x00ea: 0x013b,     #  LATIN CAPITAL LETTER L WITH CEDILLA\r
+    0x00eb: 0x013c,     #  LATIN SMALL LETTER L WITH CEDILLA\r
+    0x00ec: 0x0146,     #  LATIN SMALL LETTER N WITH CEDILLA\r
+    0x00ed: 0x0112,     #  LATIN CAPITAL LETTER E WITH MACRON\r
+    0x00ee: 0x0145,     #  LATIN CAPITAL LETTER N WITH CEDILLA\r
+    0x00ef: 0x2019,     #  RIGHT SINGLE QUOTATION MARK\r
+    0x00f0: 0x00ad,     #  SOFT HYPHEN\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x201c,     #  LEFT DOUBLE QUOTATION MARK\r
+    0x00f3: 0x00be,     #  VULGAR FRACTION THREE QUARTERS\r
+    0x00f4: 0x00b6,     #  PILCROW SIGN\r
+    0x00f5: 0x00a7,     #  SECTION SIGN\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x201e,     #  DOUBLE LOW-9 QUOTATION MARK\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x2219,     #  BULLET OPERATOR\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x00b9,     #  SUPERSCRIPT ONE\r
+    0x00fc: 0x00b3,     #  SUPERSCRIPT THREE\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\u0106'   #  0x0080 -> LATIN CAPITAL LETTER C WITH ACUTE\r
+    u'\xfc'     #  0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xe9'     #  0x0082 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\u0101'   #  0x0083 -> LATIN SMALL LETTER A WITH MACRON\r
+    u'\xe4'     #  0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\u0123'   #  0x0085 -> LATIN SMALL LETTER G WITH CEDILLA\r
+    u'\xe5'     #  0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\u0107'   #  0x0087 -> LATIN SMALL LETTER C WITH ACUTE\r
+    u'\u0142'   #  0x0088 -> LATIN SMALL LETTER L WITH STROKE\r
+    u'\u0113'   #  0x0089 -> LATIN SMALL LETTER E WITH MACRON\r
+    u'\u0156'   #  0x008a -> LATIN CAPITAL LETTER R WITH CEDILLA\r
+    u'\u0157'   #  0x008b -> LATIN SMALL LETTER R WITH CEDILLA\r
+    u'\u012b'   #  0x008c -> LATIN SMALL LETTER I WITH MACRON\r
+    u'\u0179'   #  0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE\r
+    u'\xc4'     #  0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc9'     #  0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xe6'     #  0x0091 -> LATIN SMALL LIGATURE AE\r
+    u'\xc6'     #  0x0092 -> LATIN CAPITAL LIGATURE AE\r
+    u'\u014d'   #  0x0093 -> LATIN SMALL LETTER O WITH MACRON\r
+    u'\xf6'     #  0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\u0122'   #  0x0095 -> LATIN CAPITAL LETTER G WITH CEDILLA\r
+    u'\xa2'     #  0x0096 -> CENT SIGN\r
+    u'\u015a'   #  0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE\r
+    u'\u015b'   #  0x0098 -> LATIN SMALL LETTER S WITH ACUTE\r
+    u'\xd6'     #  0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xf8'     #  0x009b -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\xd8'     #  0x009d -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xd7'     #  0x009e -> MULTIPLICATION SIGN\r
+    u'\xa4'     #  0x009f -> CURRENCY SIGN\r
+    u'\u0100'   #  0x00a0 -> LATIN CAPITAL LETTER A WITH MACRON\r
+    u'\u012a'   #  0x00a1 -> LATIN CAPITAL LETTER I WITH MACRON\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\u017b'   #  0x00a3 -> LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    u'\u017c'   #  0x00a4 -> LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    u'\u017a'   #  0x00a5 -> LATIN SMALL LETTER Z WITH ACUTE\r
+    u'\u201d'   #  0x00a6 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\xa6'     #  0x00a7 -> BROKEN BAR\r
+    u'\xa9'     #  0x00a8 -> COPYRIGHT SIGN\r
+    u'\xae'     #  0x00a9 -> REGISTERED SIGN\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0x00ac -> VULGAR FRACTION ONE QUARTER\r
+    u'\u0141'   #  0x00ad -> LATIN CAPITAL LETTER L WITH STROKE\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u0104'   #  0x00b5 -> LATIN CAPITAL LETTER A WITH OGONEK\r
+    u'\u010c'   #  0x00b6 -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\u0118'   #  0x00b7 -> LATIN CAPITAL LETTER E WITH OGONEK\r
+    u'\u0116'   #  0x00b8 -> LATIN CAPITAL LETTER E WITH DOT ABOVE\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u012e'   #  0x00bd -> LATIN CAPITAL LETTER I WITH OGONEK\r
+    u'\u0160'   #  0x00be -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u0172'   #  0x00c6 -> LATIN CAPITAL LETTER U WITH OGONEK\r
+    u'\u016a'   #  0x00c7 -> LATIN CAPITAL LETTER U WITH MACRON\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u017d'   #  0x00cf -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\u0105'   #  0x00d0 -> LATIN SMALL LETTER A WITH OGONEK\r
+    u'\u010d'   #  0x00d1 -> LATIN SMALL LETTER C WITH CARON\r
+    u'\u0119'   #  0x00d2 -> LATIN SMALL LETTER E WITH OGONEK\r
+    u'\u0117'   #  0x00d3 -> LATIN SMALL LETTER E WITH DOT ABOVE\r
+    u'\u012f'   #  0x00d4 -> LATIN SMALL LETTER I WITH OGONEK\r
+    u'\u0161'   #  0x00d5 -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u0173'   #  0x00d6 -> LATIN SMALL LETTER U WITH OGONEK\r
+    u'\u016b'   #  0x00d7 -> LATIN SMALL LETTER U WITH MACRON\r
+    u'\u017e'   #  0x00d8 -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u258c'   #  0x00dd -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x00de -> RIGHT HALF BLOCK\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\xd3'     #  0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN)\r
+    u'\u014c'   #  0x00e2 -> LATIN CAPITAL LETTER O WITH MACRON\r
+    u'\u0143'   #  0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE\r
+    u'\xf5'     #  0x00e4 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xd5'     #  0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xb5'     #  0x00e6 -> MICRO SIGN\r
+    u'\u0144'   #  0x00e7 -> LATIN SMALL LETTER N WITH ACUTE\r
+    u'\u0136'   #  0x00e8 -> LATIN CAPITAL LETTER K WITH CEDILLA\r
+    u'\u0137'   #  0x00e9 -> LATIN SMALL LETTER K WITH CEDILLA\r
+    u'\u013b'   #  0x00ea -> LATIN CAPITAL LETTER L WITH CEDILLA\r
+    u'\u013c'   #  0x00eb -> LATIN SMALL LETTER L WITH CEDILLA\r
+    u'\u0146'   #  0x00ec -> LATIN SMALL LETTER N WITH CEDILLA\r
+    u'\u0112'   #  0x00ed -> LATIN CAPITAL LETTER E WITH MACRON\r
+    u'\u0145'   #  0x00ee -> LATIN CAPITAL LETTER N WITH CEDILLA\r
+    u'\u2019'   #  0x00ef -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xad'     #  0x00f0 -> SOFT HYPHEN\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u201c'   #  0x00f2 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\xbe'     #  0x00f3 -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xb6'     #  0x00f4 -> PILCROW SIGN\r
+    u'\xa7'     #  0x00f5 -> SECTION SIGN\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\u201e'   #  0x00f7 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\u2219'   #  0x00f9 -> BULLET OPERATOR\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\xb9'     #  0x00fb -> SUPERSCRIPT ONE\r
+    u'\xb3'     #  0x00fc -> SUPERSCRIPT THREE\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a2: 0x0096,     #  CENT SIGN\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00a4: 0x009f,     #  CURRENCY SIGN\r
+    0x00a6: 0x00a7,     #  BROKEN BAR\r
+    0x00a7: 0x00f5,     #  SECTION SIGN\r
+    0x00a9: 0x00a8,     #  COPYRIGHT SIGN\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00ad: 0x00f0,     #  SOFT HYPHEN\r
+    0x00ae: 0x00a9,     #  REGISTERED SIGN\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b3: 0x00fc,     #  SUPERSCRIPT THREE\r
+    0x00b5: 0x00e6,     #  MICRO SIGN\r
+    0x00b6: 0x00f4,     #  PILCROW SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00b9: 0x00fb,     #  SUPERSCRIPT ONE\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00bc: 0x00ac,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x00be: 0x00f3,     #  VULGAR FRACTION THREE QUARTERS\r
+    0x00c4: 0x008e,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x00c5: 0x008f,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x00c6: 0x0092,     #  LATIN CAPITAL LIGATURE AE\r
+    0x00c9: 0x0090,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00d3: 0x00e0,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00d5: 0x00e5,     #  LATIN CAPITAL LETTER O WITH TILDE\r
+    0x00d6: 0x0099,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x00d7: 0x009e,     #  MULTIPLICATION SIGN\r
+    0x00d8: 0x009d,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x00dc: 0x009a,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S (GERMAN)\r
+    0x00e4: 0x0084,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x00e5: 0x0086,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x00e6: 0x0091,     #  LATIN SMALL LIGATURE AE\r
+    0x00e9: 0x0082,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f5: 0x00e4,     #  LATIN SMALL LETTER O WITH TILDE\r
+    0x00f6: 0x0094,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00f8: 0x009b,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x00fc: 0x0081,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0100: 0x00a0,     #  LATIN CAPITAL LETTER A WITH MACRON\r
+    0x0101: 0x0083,     #  LATIN SMALL LETTER A WITH MACRON\r
+    0x0104: 0x00b5,     #  LATIN CAPITAL LETTER A WITH OGONEK\r
+    0x0105: 0x00d0,     #  LATIN SMALL LETTER A WITH OGONEK\r
+    0x0106: 0x0080,     #  LATIN CAPITAL LETTER C WITH ACUTE\r
+    0x0107: 0x0087,     #  LATIN SMALL LETTER C WITH ACUTE\r
+    0x010c: 0x00b6,     #  LATIN CAPITAL LETTER C WITH CARON\r
+    0x010d: 0x00d1,     #  LATIN SMALL LETTER C WITH CARON\r
+    0x0112: 0x00ed,     #  LATIN CAPITAL LETTER E WITH MACRON\r
+    0x0113: 0x0089,     #  LATIN SMALL LETTER E WITH MACRON\r
+    0x0116: 0x00b8,     #  LATIN CAPITAL LETTER E WITH DOT ABOVE\r
+    0x0117: 0x00d3,     #  LATIN SMALL LETTER E WITH DOT ABOVE\r
+    0x0118: 0x00b7,     #  LATIN CAPITAL LETTER E WITH OGONEK\r
+    0x0119: 0x00d2,     #  LATIN SMALL LETTER E WITH OGONEK\r
+    0x0122: 0x0095,     #  LATIN CAPITAL LETTER G WITH CEDILLA\r
+    0x0123: 0x0085,     #  LATIN SMALL LETTER G WITH CEDILLA\r
+    0x012a: 0x00a1,     #  LATIN CAPITAL LETTER I WITH MACRON\r
+    0x012b: 0x008c,     #  LATIN SMALL LETTER I WITH MACRON\r
+    0x012e: 0x00bd,     #  LATIN CAPITAL LETTER I WITH OGONEK\r
+    0x012f: 0x00d4,     #  LATIN SMALL LETTER I WITH OGONEK\r
+    0x0136: 0x00e8,     #  LATIN CAPITAL LETTER K WITH CEDILLA\r
+    0x0137: 0x00e9,     #  LATIN SMALL LETTER K WITH CEDILLA\r
+    0x013b: 0x00ea,     #  LATIN CAPITAL LETTER L WITH CEDILLA\r
+    0x013c: 0x00eb,     #  LATIN SMALL LETTER L WITH CEDILLA\r
+    0x0141: 0x00ad,     #  LATIN CAPITAL LETTER L WITH STROKE\r
+    0x0142: 0x0088,     #  LATIN SMALL LETTER L WITH STROKE\r
+    0x0143: 0x00e3,     #  LATIN CAPITAL LETTER N WITH ACUTE\r
+    0x0144: 0x00e7,     #  LATIN SMALL LETTER N WITH ACUTE\r
+    0x0145: 0x00ee,     #  LATIN CAPITAL LETTER N WITH CEDILLA\r
+    0x0146: 0x00ec,     #  LATIN SMALL LETTER N WITH CEDILLA\r
+    0x014c: 0x00e2,     #  LATIN CAPITAL LETTER O WITH MACRON\r
+    0x014d: 0x0093,     #  LATIN SMALL LETTER O WITH MACRON\r
+    0x0156: 0x008a,     #  LATIN CAPITAL LETTER R WITH CEDILLA\r
+    0x0157: 0x008b,     #  LATIN SMALL LETTER R WITH CEDILLA\r
+    0x015a: 0x0097,     #  LATIN CAPITAL LETTER S WITH ACUTE\r
+    0x015b: 0x0098,     #  LATIN SMALL LETTER S WITH ACUTE\r
+    0x0160: 0x00be,     #  LATIN CAPITAL LETTER S WITH CARON\r
+    0x0161: 0x00d5,     #  LATIN SMALL LETTER S WITH CARON\r
+    0x016a: 0x00c7,     #  LATIN CAPITAL LETTER U WITH MACRON\r
+    0x016b: 0x00d7,     #  LATIN SMALL LETTER U WITH MACRON\r
+    0x0172: 0x00c6,     #  LATIN CAPITAL LETTER U WITH OGONEK\r
+    0x0173: 0x00d6,     #  LATIN SMALL LETTER U WITH OGONEK\r
+    0x0179: 0x008d,     #  LATIN CAPITAL LETTER Z WITH ACUTE\r
+    0x017a: 0x00a5,     #  LATIN SMALL LETTER Z WITH ACUTE\r
+    0x017b: 0x00a3,     #  LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    0x017c: 0x00a4,     #  LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    0x017d: 0x00cf,     #  LATIN CAPITAL LETTER Z WITH CARON\r
+    0x017e: 0x00d8,     #  LATIN SMALL LETTER Z WITH CARON\r
+    0x2019: 0x00ef,     #  RIGHT SINGLE QUOTATION MARK\r
+    0x201c: 0x00f2,     #  LEFT DOUBLE QUOTATION MARK\r
+    0x201d: 0x00a6,     #  RIGHT DOUBLE QUOTATION MARK\r
+    0x201e: 0x00f7,     #  DOUBLE LOW-9 QUOTATION MARK\r
+    0x2219: 0x00f9,     #  BULLET OPERATOR\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x258c: 0x00dd,     #  LEFT HALF BLOCK\r
+    0x2590: 0x00de,     #  RIGHT HALF BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp850.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp850.py
new file mode 100644 (file)
index 0000000..b110f4e
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP850.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp850',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x00c7,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x0081: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0082: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x0083: 0x00e2,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x0084: 0x00e4,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x0085: 0x00e0,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x0086: 0x00e5,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x0087: 0x00e7,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x0088: 0x00ea,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x0089: 0x00eb,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x008a: 0x00e8,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x008b: 0x00ef,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x008c: 0x00ee,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x008d: 0x00ec,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x008e: 0x00c4,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x008f: 0x00c5,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x0090: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0091: 0x00e6,     #  LATIN SMALL LIGATURE AE\r
+    0x0092: 0x00c6,     #  LATIN CAPITAL LIGATURE AE\r
+    0x0093: 0x00f4,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x0094: 0x00f6,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x0095: 0x00f2,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x0096: 0x00fb,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x0097: 0x00f9,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x0098: 0x00ff,     #  LATIN SMALL LETTER Y WITH DIAERESIS\r
+    0x0099: 0x00d6,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x009a: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x009b: 0x00f8,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x00d8,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x009e: 0x00d7,     #  MULTIPLICATION SIGN\r
+    0x009f: 0x0192,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x00a0: 0x00e1,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00a1: 0x00ed,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00a4: 0x00f1,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00a5: 0x00d1,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00a6: 0x00aa,     #  FEMININE ORDINAL INDICATOR\r
+    0x00a7: 0x00ba,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00a8: 0x00bf,     #  INVERTED QUESTION MARK\r
+    0x00a9: 0x00ae,     #  REGISTERED SIGN\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x00bc,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00ad: 0x00a1,     #  INVERTED EXCLAMATION MARK\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x00c1,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00b6: 0x00c2,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x00b7: 0x00c0,     #  LATIN CAPITAL LETTER A WITH GRAVE\r
+    0x00b8: 0x00a9,     #  COPYRIGHT SIGN\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x00a2,     #  CENT SIGN\r
+    0x00be: 0x00a5,     #  YEN SIGN\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x00e3,     #  LATIN SMALL LETTER A WITH TILDE\r
+    0x00c7: 0x00c3,     #  LATIN CAPITAL LETTER A WITH TILDE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x00a4,     #  CURRENCY SIGN\r
+    0x00d0: 0x00f0,     #  LATIN SMALL LETTER ETH\r
+    0x00d1: 0x00d0,     #  LATIN CAPITAL LETTER ETH\r
+    0x00d2: 0x00ca,     #  LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    0x00d3: 0x00cb,     #  LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    0x00d4: 0x00c8,     #  LATIN CAPITAL LETTER E WITH GRAVE\r
+    0x00d5: 0x0131,     #  LATIN SMALL LETTER DOTLESS I\r
+    0x00d6: 0x00cd,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00d7: 0x00ce,     #  LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    0x00d8: 0x00cf,     #  LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x00a6,     #  BROKEN BAR\r
+    0x00de: 0x00cc,     #  LATIN CAPITAL LETTER I WITH GRAVE\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x00d3,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e2: 0x00d4,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x00e3: 0x00d2,     #  LATIN CAPITAL LETTER O WITH GRAVE\r
+    0x00e4: 0x00f5,     #  LATIN SMALL LETTER O WITH TILDE\r
+    0x00e5: 0x00d5,     #  LATIN CAPITAL LETTER O WITH TILDE\r
+    0x00e6: 0x00b5,     #  MICRO SIGN\r
+    0x00e7: 0x00fe,     #  LATIN SMALL LETTER THORN\r
+    0x00e8: 0x00de,     #  LATIN CAPITAL LETTER THORN\r
+    0x00e9: 0x00da,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00ea: 0x00db,     #  LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    0x00eb: 0x00d9,     #  LATIN CAPITAL LETTER U WITH GRAVE\r
+    0x00ec: 0x00fd,     #  LATIN SMALL LETTER Y WITH ACUTE\r
+    0x00ed: 0x00dd,     #  LATIN CAPITAL LETTER Y WITH ACUTE\r
+    0x00ee: 0x00af,     #  MACRON\r
+    0x00ef: 0x00b4,     #  ACUTE ACCENT\r
+    0x00f0: 0x00ad,     #  SOFT HYPHEN\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x2017,     #  DOUBLE LOW LINE\r
+    0x00f3: 0x00be,     #  VULGAR FRACTION THREE QUARTERS\r
+    0x00f4: 0x00b6,     #  PILCROW SIGN\r
+    0x00f5: 0x00a7,     #  SECTION SIGN\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x00b8,     #  CEDILLA\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x00a8,     #  DIAERESIS\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x00b9,     #  SUPERSCRIPT ONE\r
+    0x00fc: 0x00b3,     #  SUPERSCRIPT THREE\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\xc7'     #  0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xfc'     #  0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xe9'     #  0x0082 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe2'     #  0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe0'     #  0x0085 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe5'     #  0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x0087 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xea'     #  0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x008a -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xef'     #  0x008b -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xee'     #  0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xec'     #  0x008d -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xc4'     #  0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc9'     #  0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xe6'     #  0x0091 -> LATIN SMALL LIGATURE AE\r
+    u'\xc6'     #  0x0092 -> LATIN CAPITAL LIGATURE AE\r
+    u'\xf4'     #  0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf2'     #  0x0095 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xfb'     #  0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xf9'     #  0x0097 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xff'     #  0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\xd6'     #  0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xf8'     #  0x009b -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\xd8'     #  0x009d -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xd7'     #  0x009e -> MULTIPLICATION SIGN\r
+    u'\u0192'   #  0x009f -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\xe1'     #  0x00a0 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xed'     #  0x00a1 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xfa'     #  0x00a3 -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf1'     #  0x00a4 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xd1'     #  0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xaa'     #  0x00a6 -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0x00a7 -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbf'     #  0x00a8 -> INVERTED QUESTION MARK\r
+    u'\xae'     #  0x00a9 -> REGISTERED SIGN\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0x00ac -> VULGAR FRACTION ONE QUARTER\r
+    u'\xa1'     #  0x00ad -> INVERTED EXCLAMATION MARK\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\xc1'     #  0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc0'     #  0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xa9'     #  0x00b8 -> COPYRIGHT SIGN\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\xa2'     #  0x00bd -> CENT SIGN\r
+    u'\xa5'     #  0x00be -> YEN SIGN\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\xe3'     #  0x00c6 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xc3'     #  0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\xa4'     #  0x00cf -> CURRENCY SIGN\r
+    u'\xf0'     #  0x00d0 -> LATIN SMALL LETTER ETH\r
+    u'\xd0'     #  0x00d1 -> LATIN CAPITAL LETTER ETH\r
+    u'\xca'     #  0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\u0131'   #  0x00d5 -> LATIN SMALL LETTER DOTLESS I\r
+    u'\xcd'     #  0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\xa6'     #  0x00dd -> BROKEN BAR\r
+    u'\xcc'     #  0x00de -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\xd3'     #  0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S\r
+    u'\xd4'     #  0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd2'     #  0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xf5'     #  0x00e4 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xd5'     #  0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xb5'     #  0x00e6 -> MICRO SIGN\r
+    u'\xfe'     #  0x00e7 -> LATIN SMALL LETTER THORN\r
+    u'\xde'     #  0x00e8 -> LATIN CAPITAL LETTER THORN\r
+    u'\xda'     #  0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xd9'     #  0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xfd'     #  0x00ec -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xdd'     #  0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xaf'     #  0x00ee -> MACRON\r
+    u'\xb4'     #  0x00ef -> ACUTE ACCENT\r
+    u'\xad'     #  0x00f0 -> SOFT HYPHEN\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u2017'   #  0x00f2 -> DOUBLE LOW LINE\r
+    u'\xbe'     #  0x00f3 -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xb6'     #  0x00f4 -> PILCROW SIGN\r
+    u'\xa7'     #  0x00f5 -> SECTION SIGN\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\xb8'     #  0x00f7 -> CEDILLA\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\xa8'     #  0x00f9 -> DIAERESIS\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\xb9'     #  0x00fb -> SUPERSCRIPT ONE\r
+    u'\xb3'     #  0x00fc -> SUPERSCRIPT THREE\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a1: 0x00ad,     #  INVERTED EXCLAMATION MARK\r
+    0x00a2: 0x00bd,     #  CENT SIGN\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00a4: 0x00cf,     #  CURRENCY SIGN\r
+    0x00a5: 0x00be,     #  YEN SIGN\r
+    0x00a6: 0x00dd,     #  BROKEN BAR\r
+    0x00a7: 0x00f5,     #  SECTION SIGN\r
+    0x00a8: 0x00f9,     #  DIAERESIS\r
+    0x00a9: 0x00b8,     #  COPYRIGHT SIGN\r
+    0x00aa: 0x00a6,     #  FEMININE ORDINAL INDICATOR\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00ad: 0x00f0,     #  SOFT HYPHEN\r
+    0x00ae: 0x00a9,     #  REGISTERED SIGN\r
+    0x00af: 0x00ee,     #  MACRON\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b3: 0x00fc,     #  SUPERSCRIPT THREE\r
+    0x00b4: 0x00ef,     #  ACUTE ACCENT\r
+    0x00b5: 0x00e6,     #  MICRO SIGN\r
+    0x00b6: 0x00f4,     #  PILCROW SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00b8: 0x00f7,     #  CEDILLA\r
+    0x00b9: 0x00fb,     #  SUPERSCRIPT ONE\r
+    0x00ba: 0x00a7,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00bc: 0x00ac,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x00be: 0x00f3,     #  VULGAR FRACTION THREE QUARTERS\r
+    0x00bf: 0x00a8,     #  INVERTED QUESTION MARK\r
+    0x00c0: 0x00b7,     #  LATIN CAPITAL LETTER A WITH GRAVE\r
+    0x00c1: 0x00b5,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00c2: 0x00b6,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x00c3: 0x00c7,     #  LATIN CAPITAL LETTER A WITH TILDE\r
+    0x00c4: 0x008e,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x00c5: 0x008f,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x00c6: 0x0092,     #  LATIN CAPITAL LIGATURE AE\r
+    0x00c7: 0x0080,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x00c8: 0x00d4,     #  LATIN CAPITAL LETTER E WITH GRAVE\r
+    0x00c9: 0x0090,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00ca: 0x00d2,     #  LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    0x00cb: 0x00d3,     #  LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    0x00cc: 0x00de,     #  LATIN CAPITAL LETTER I WITH GRAVE\r
+    0x00cd: 0x00d6,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00ce: 0x00d7,     #  LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    0x00cf: 0x00d8,     #  LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    0x00d0: 0x00d1,     #  LATIN CAPITAL LETTER ETH\r
+    0x00d1: 0x00a5,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00d2: 0x00e3,     #  LATIN CAPITAL LETTER O WITH GRAVE\r
+    0x00d3: 0x00e0,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00d4: 0x00e2,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x00d5: 0x00e5,     #  LATIN CAPITAL LETTER O WITH TILDE\r
+    0x00d6: 0x0099,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x00d7: 0x009e,     #  MULTIPLICATION SIGN\r
+    0x00d8: 0x009d,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x00d9: 0x00eb,     #  LATIN CAPITAL LETTER U WITH GRAVE\r
+    0x00da: 0x00e9,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00db: 0x00ea,     #  LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    0x00dc: 0x009a,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00dd: 0x00ed,     #  LATIN CAPITAL LETTER Y WITH ACUTE\r
+    0x00de: 0x00e8,     #  LATIN CAPITAL LETTER THORN\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e0: 0x0085,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x00e1: 0x00a0,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00e2: 0x0083,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x00e3: 0x00c6,     #  LATIN SMALL LETTER A WITH TILDE\r
+    0x00e4: 0x0084,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x00e5: 0x0086,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x00e6: 0x0091,     #  LATIN SMALL LIGATURE AE\r
+    0x00e7: 0x0087,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x00e8: 0x008a,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x00e9: 0x0082,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00ea: 0x0088,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x00eb: 0x0089,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x00ec: 0x008d,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x00ed: 0x00a1,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00ee: 0x008c,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x00ef: 0x008b,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x00f0: 0x00d0,     #  LATIN SMALL LETTER ETH\r
+    0x00f1: 0x00a4,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00f2: 0x0095,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f4: 0x0093,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x00f5: 0x00e4,     #  LATIN SMALL LETTER O WITH TILDE\r
+    0x00f6: 0x0094,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00f8: 0x009b,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x00f9: 0x0097,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x00fa: 0x00a3,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00fb: 0x0096,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x00fc: 0x0081,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x00fd: 0x00ec,     #  LATIN SMALL LETTER Y WITH ACUTE\r
+    0x00fe: 0x00e7,     #  LATIN SMALL LETTER THORN\r
+    0x00ff: 0x0098,     #  LATIN SMALL LETTER Y WITH DIAERESIS\r
+    0x0131: 0x00d5,     #  LATIN SMALL LETTER DOTLESS I\r
+    0x0192: 0x009f,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x2017: 0x00f2,     #  DOUBLE LOW LINE\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp852.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp852.py
new file mode 100644 (file)
index 0000000..c004282
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP852.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp852',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x00c7,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x0081: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0082: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x0083: 0x00e2,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x0084: 0x00e4,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x0085: 0x016f,     #  LATIN SMALL LETTER U WITH RING ABOVE\r
+    0x0086: 0x0107,     #  LATIN SMALL LETTER C WITH ACUTE\r
+    0x0087: 0x00e7,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x0088: 0x0142,     #  LATIN SMALL LETTER L WITH STROKE\r
+    0x0089: 0x00eb,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x008a: 0x0150,     #  LATIN CAPITAL LETTER O WITH DOUBLE ACUTE\r
+    0x008b: 0x0151,     #  LATIN SMALL LETTER O WITH DOUBLE ACUTE\r
+    0x008c: 0x00ee,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x008d: 0x0179,     #  LATIN CAPITAL LETTER Z WITH ACUTE\r
+    0x008e: 0x00c4,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x008f: 0x0106,     #  LATIN CAPITAL LETTER C WITH ACUTE\r
+    0x0090: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0091: 0x0139,     #  LATIN CAPITAL LETTER L WITH ACUTE\r
+    0x0092: 0x013a,     #  LATIN SMALL LETTER L WITH ACUTE\r
+    0x0093: 0x00f4,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x0094: 0x00f6,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x0095: 0x013d,     #  LATIN CAPITAL LETTER L WITH CARON\r
+    0x0096: 0x013e,     #  LATIN SMALL LETTER L WITH CARON\r
+    0x0097: 0x015a,     #  LATIN CAPITAL LETTER S WITH ACUTE\r
+    0x0098: 0x015b,     #  LATIN SMALL LETTER S WITH ACUTE\r
+    0x0099: 0x00d6,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x009a: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x009b: 0x0164,     #  LATIN CAPITAL LETTER T WITH CARON\r
+    0x009c: 0x0165,     #  LATIN SMALL LETTER T WITH CARON\r
+    0x009d: 0x0141,     #  LATIN CAPITAL LETTER L WITH STROKE\r
+    0x009e: 0x00d7,     #  MULTIPLICATION SIGN\r
+    0x009f: 0x010d,     #  LATIN SMALL LETTER C WITH CARON\r
+    0x00a0: 0x00e1,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00a1: 0x00ed,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00a4: 0x0104,     #  LATIN CAPITAL LETTER A WITH OGONEK\r
+    0x00a5: 0x0105,     #  LATIN SMALL LETTER A WITH OGONEK\r
+    0x00a6: 0x017d,     #  LATIN CAPITAL LETTER Z WITH CARON\r
+    0x00a7: 0x017e,     #  LATIN SMALL LETTER Z WITH CARON\r
+    0x00a8: 0x0118,     #  LATIN CAPITAL LETTER E WITH OGONEK\r
+    0x00a9: 0x0119,     #  LATIN SMALL LETTER E WITH OGONEK\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x017a,     #  LATIN SMALL LETTER Z WITH ACUTE\r
+    0x00ac: 0x010c,     #  LATIN CAPITAL LETTER C WITH CARON\r
+    0x00ad: 0x015f,     #  LATIN SMALL LETTER S WITH CEDILLA\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x00c1,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00b6: 0x00c2,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x00b7: 0x011a,     #  LATIN CAPITAL LETTER E WITH CARON\r
+    0x00b8: 0x015e,     #  LATIN CAPITAL LETTER S WITH CEDILLA\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x017b,     #  LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    0x00be: 0x017c,     #  LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x0102,     #  LATIN CAPITAL LETTER A WITH BREVE\r
+    0x00c7: 0x0103,     #  LATIN SMALL LETTER A WITH BREVE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x00a4,     #  CURRENCY SIGN\r
+    0x00d0: 0x0111,     #  LATIN SMALL LETTER D WITH STROKE\r
+    0x00d1: 0x0110,     #  LATIN CAPITAL LETTER D WITH STROKE\r
+    0x00d2: 0x010e,     #  LATIN CAPITAL LETTER D WITH CARON\r
+    0x00d3: 0x00cb,     #  LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    0x00d4: 0x010f,     #  LATIN SMALL LETTER D WITH CARON\r
+    0x00d5: 0x0147,     #  LATIN CAPITAL LETTER N WITH CARON\r
+    0x00d6: 0x00cd,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00d7: 0x00ce,     #  LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    0x00d8: 0x011b,     #  LATIN SMALL LETTER E WITH CARON\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x0162,     #  LATIN CAPITAL LETTER T WITH CEDILLA\r
+    0x00de: 0x016e,     #  LATIN CAPITAL LETTER U WITH RING ABOVE\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x00d3,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e2: 0x00d4,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x00e3: 0x0143,     #  LATIN CAPITAL LETTER N WITH ACUTE\r
+    0x00e4: 0x0144,     #  LATIN SMALL LETTER N WITH ACUTE\r
+    0x00e5: 0x0148,     #  LATIN SMALL LETTER N WITH CARON\r
+    0x00e6: 0x0160,     #  LATIN CAPITAL LETTER S WITH CARON\r
+    0x00e7: 0x0161,     #  LATIN SMALL LETTER S WITH CARON\r
+    0x00e8: 0x0154,     #  LATIN CAPITAL LETTER R WITH ACUTE\r
+    0x00e9: 0x00da,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00ea: 0x0155,     #  LATIN SMALL LETTER R WITH ACUTE\r
+    0x00eb: 0x0170,     #  LATIN CAPITAL LETTER U WITH DOUBLE ACUTE\r
+    0x00ec: 0x00fd,     #  LATIN SMALL LETTER Y WITH ACUTE\r
+    0x00ed: 0x00dd,     #  LATIN CAPITAL LETTER Y WITH ACUTE\r
+    0x00ee: 0x0163,     #  LATIN SMALL LETTER T WITH CEDILLA\r
+    0x00ef: 0x00b4,     #  ACUTE ACCENT\r
+    0x00f0: 0x00ad,     #  SOFT HYPHEN\r
+    0x00f1: 0x02dd,     #  DOUBLE ACUTE ACCENT\r
+    0x00f2: 0x02db,     #  OGONEK\r
+    0x00f3: 0x02c7,     #  CARON\r
+    0x00f4: 0x02d8,     #  BREVE\r
+    0x00f5: 0x00a7,     #  SECTION SIGN\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x00b8,     #  CEDILLA\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x00a8,     #  DIAERESIS\r
+    0x00fa: 0x02d9,     #  DOT ABOVE\r
+    0x00fb: 0x0171,     #  LATIN SMALL LETTER U WITH DOUBLE ACUTE\r
+    0x00fc: 0x0158,     #  LATIN CAPITAL LETTER R WITH CARON\r
+    0x00fd: 0x0159,     #  LATIN SMALL LETTER R WITH CARON\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\xc7'     #  0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xfc'     #  0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xe9'     #  0x0082 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe2'     #  0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\u016f'   #  0x0085 -> LATIN SMALL LETTER U WITH RING ABOVE\r
+    u'\u0107'   #  0x0086 -> LATIN SMALL LETTER C WITH ACUTE\r
+    u'\xe7'     #  0x0087 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\u0142'   #  0x0088 -> LATIN SMALL LETTER L WITH STROKE\r
+    u'\xeb'     #  0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\u0150'   #  0x008a -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE\r
+    u'\u0151'   #  0x008b -> LATIN SMALL LETTER O WITH DOUBLE ACUTE\r
+    u'\xee'     #  0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\u0179'   #  0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE\r
+    u'\xc4'     #  0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\u0106'   #  0x008f -> LATIN CAPITAL LETTER C WITH ACUTE\r
+    u'\xc9'     #  0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\u0139'   #  0x0091 -> LATIN CAPITAL LETTER L WITH ACUTE\r
+    u'\u013a'   #  0x0092 -> LATIN SMALL LETTER L WITH ACUTE\r
+    u'\xf4'     #  0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\u013d'   #  0x0095 -> LATIN CAPITAL LETTER L WITH CARON\r
+    u'\u013e'   #  0x0096 -> LATIN SMALL LETTER L WITH CARON\r
+    u'\u015a'   #  0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE\r
+    u'\u015b'   #  0x0098 -> LATIN SMALL LETTER S WITH ACUTE\r
+    u'\xd6'     #  0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\u0164'   #  0x009b -> LATIN CAPITAL LETTER T WITH CARON\r
+    u'\u0165'   #  0x009c -> LATIN SMALL LETTER T WITH CARON\r
+    u'\u0141'   #  0x009d -> LATIN CAPITAL LETTER L WITH STROKE\r
+    u'\xd7'     #  0x009e -> MULTIPLICATION SIGN\r
+    u'\u010d'   #  0x009f -> LATIN SMALL LETTER C WITH CARON\r
+    u'\xe1'     #  0x00a0 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xed'     #  0x00a1 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xfa'     #  0x00a3 -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\u0104'   #  0x00a4 -> LATIN CAPITAL LETTER A WITH OGONEK\r
+    u'\u0105'   #  0x00a5 -> LATIN SMALL LETTER A WITH OGONEK\r
+    u'\u017d'   #  0x00a6 -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\u017e'   #  0x00a7 -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u0118'   #  0x00a8 -> LATIN CAPITAL LETTER E WITH OGONEK\r
+    u'\u0119'   #  0x00a9 -> LATIN SMALL LETTER E WITH OGONEK\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\u017a'   #  0x00ab -> LATIN SMALL LETTER Z WITH ACUTE\r
+    u'\u010c'   #  0x00ac -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\u015f'   #  0x00ad -> LATIN SMALL LETTER S WITH CEDILLA\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\xc1'     #  0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\u011a'   #  0x00b7 -> LATIN CAPITAL LETTER E WITH CARON\r
+    u'\u015e'   #  0x00b8 -> LATIN CAPITAL LETTER S WITH CEDILLA\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u017b'   #  0x00bd -> LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    u'\u017c'   #  0x00be -> LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u0102'   #  0x00c6 -> LATIN CAPITAL LETTER A WITH BREVE\r
+    u'\u0103'   #  0x00c7 -> LATIN SMALL LETTER A WITH BREVE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\xa4'     #  0x00cf -> CURRENCY SIGN\r
+    u'\u0111'   #  0x00d0 -> LATIN SMALL LETTER D WITH STROKE\r
+    u'\u0110'   #  0x00d1 -> LATIN CAPITAL LETTER D WITH STROKE\r
+    u'\u010e'   #  0x00d2 -> LATIN CAPITAL LETTER D WITH CARON\r
+    u'\xcb'     #  0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\u010f'   #  0x00d4 -> LATIN SMALL LETTER D WITH CARON\r
+    u'\u0147'   #  0x00d5 -> LATIN CAPITAL LETTER N WITH CARON\r
+    u'\xcd'     #  0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\u011b'   #  0x00d8 -> LATIN SMALL LETTER E WITH CARON\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u0162'   #  0x00dd -> LATIN CAPITAL LETTER T WITH CEDILLA\r
+    u'\u016e'   #  0x00de -> LATIN CAPITAL LETTER U WITH RING ABOVE\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\xd3'     #  0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S\r
+    u'\xd4'     #  0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\u0143'   #  0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE\r
+    u'\u0144'   #  0x00e4 -> LATIN SMALL LETTER N WITH ACUTE\r
+    u'\u0148'   #  0x00e5 -> LATIN SMALL LETTER N WITH CARON\r
+    u'\u0160'   #  0x00e6 -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u0161'   #  0x00e7 -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u0154'   #  0x00e8 -> LATIN CAPITAL LETTER R WITH ACUTE\r
+    u'\xda'     #  0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\u0155'   #  0x00ea -> LATIN SMALL LETTER R WITH ACUTE\r
+    u'\u0170'   #  0x00eb -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE\r
+    u'\xfd'     #  0x00ec -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xdd'     #  0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\u0163'   #  0x00ee -> LATIN SMALL LETTER T WITH CEDILLA\r
+    u'\xb4'     #  0x00ef -> ACUTE ACCENT\r
+    u'\xad'     #  0x00f0 -> SOFT HYPHEN\r
+    u'\u02dd'   #  0x00f1 -> DOUBLE ACUTE ACCENT\r
+    u'\u02db'   #  0x00f2 -> OGONEK\r
+    u'\u02c7'   #  0x00f3 -> CARON\r
+    u'\u02d8'   #  0x00f4 -> BREVE\r
+    u'\xa7'     #  0x00f5 -> SECTION SIGN\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\xb8'     #  0x00f7 -> CEDILLA\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\xa8'     #  0x00f9 -> DIAERESIS\r
+    u'\u02d9'   #  0x00fa -> DOT ABOVE\r
+    u'\u0171'   #  0x00fb -> LATIN SMALL LETTER U WITH DOUBLE ACUTE\r
+    u'\u0158'   #  0x00fc -> LATIN CAPITAL LETTER R WITH CARON\r
+    u'\u0159'   #  0x00fd -> LATIN SMALL LETTER R WITH CARON\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a4: 0x00cf,     #  CURRENCY SIGN\r
+    0x00a7: 0x00f5,     #  SECTION SIGN\r
+    0x00a8: 0x00f9,     #  DIAERESIS\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00ad: 0x00f0,     #  SOFT HYPHEN\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b4: 0x00ef,     #  ACUTE ACCENT\r
+    0x00b8: 0x00f7,     #  CEDILLA\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00c1: 0x00b5,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00c2: 0x00b6,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x00c4: 0x008e,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x00c7: 0x0080,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x00c9: 0x0090,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00cb: 0x00d3,     #  LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    0x00cd: 0x00d6,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00ce: 0x00d7,     #  LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    0x00d3: 0x00e0,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00d4: 0x00e2,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x00d6: 0x0099,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x00d7: 0x009e,     #  MULTIPLICATION SIGN\r
+    0x00da: 0x00e9,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00dc: 0x009a,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00dd: 0x00ed,     #  LATIN CAPITAL LETTER Y WITH ACUTE\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e1: 0x00a0,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00e2: 0x0083,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x00e4: 0x0084,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x00e7: 0x0087,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x00e9: 0x0082,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00eb: 0x0089,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x00ed: 0x00a1,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00ee: 0x008c,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f4: 0x0093,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x00f6: 0x0094,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00fa: 0x00a3,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00fc: 0x0081,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x00fd: 0x00ec,     #  LATIN SMALL LETTER Y WITH ACUTE\r
+    0x0102: 0x00c6,     #  LATIN CAPITAL LETTER A WITH BREVE\r
+    0x0103: 0x00c7,     #  LATIN SMALL LETTER A WITH BREVE\r
+    0x0104: 0x00a4,     #  LATIN CAPITAL LETTER A WITH OGONEK\r
+    0x0105: 0x00a5,     #  LATIN SMALL LETTER A WITH OGONEK\r
+    0x0106: 0x008f,     #  LATIN CAPITAL LETTER C WITH ACUTE\r
+    0x0107: 0x0086,     #  LATIN SMALL LETTER C WITH ACUTE\r
+    0x010c: 0x00ac,     #  LATIN CAPITAL LETTER C WITH CARON\r
+    0x010d: 0x009f,     #  LATIN SMALL LETTER C WITH CARON\r
+    0x010e: 0x00d2,     #  LATIN CAPITAL LETTER D WITH CARON\r
+    0x010f: 0x00d4,     #  LATIN SMALL LETTER D WITH CARON\r
+    0x0110: 0x00d1,     #  LATIN CAPITAL LETTER D WITH STROKE\r
+    0x0111: 0x00d0,     #  LATIN SMALL LETTER D WITH STROKE\r
+    0x0118: 0x00a8,     #  LATIN CAPITAL LETTER E WITH OGONEK\r
+    0x0119: 0x00a9,     #  LATIN SMALL LETTER E WITH OGONEK\r
+    0x011a: 0x00b7,     #  LATIN CAPITAL LETTER E WITH CARON\r
+    0x011b: 0x00d8,     #  LATIN SMALL LETTER E WITH CARON\r
+    0x0139: 0x0091,     #  LATIN CAPITAL LETTER L WITH ACUTE\r
+    0x013a: 0x0092,     #  LATIN SMALL LETTER L WITH ACUTE\r
+    0x013d: 0x0095,     #  LATIN CAPITAL LETTER L WITH CARON\r
+    0x013e: 0x0096,     #  LATIN SMALL LETTER L WITH CARON\r
+    0x0141: 0x009d,     #  LATIN CAPITAL LETTER L WITH STROKE\r
+    0x0142: 0x0088,     #  LATIN SMALL LETTER L WITH STROKE\r
+    0x0143: 0x00e3,     #  LATIN CAPITAL LETTER N WITH ACUTE\r
+    0x0144: 0x00e4,     #  LATIN SMALL LETTER N WITH ACUTE\r
+    0x0147: 0x00d5,     #  LATIN CAPITAL LETTER N WITH CARON\r
+    0x0148: 0x00e5,     #  LATIN SMALL LETTER N WITH CARON\r
+    0x0150: 0x008a,     #  LATIN CAPITAL LETTER O WITH DOUBLE ACUTE\r
+    0x0151: 0x008b,     #  LATIN SMALL LETTER O WITH DOUBLE ACUTE\r
+    0x0154: 0x00e8,     #  LATIN CAPITAL LETTER R WITH ACUTE\r
+    0x0155: 0x00ea,     #  LATIN SMALL LETTER R WITH ACUTE\r
+    0x0158: 0x00fc,     #  LATIN CAPITAL LETTER R WITH CARON\r
+    0x0159: 0x00fd,     #  LATIN SMALL LETTER R WITH CARON\r
+    0x015a: 0x0097,     #  LATIN CAPITAL LETTER S WITH ACUTE\r
+    0x015b: 0x0098,     #  LATIN SMALL LETTER S WITH ACUTE\r
+    0x015e: 0x00b8,     #  LATIN CAPITAL LETTER S WITH CEDILLA\r
+    0x015f: 0x00ad,     #  LATIN SMALL LETTER S WITH CEDILLA\r
+    0x0160: 0x00e6,     #  LATIN CAPITAL LETTER S WITH CARON\r
+    0x0161: 0x00e7,     #  LATIN SMALL LETTER S WITH CARON\r
+    0x0162: 0x00dd,     #  LATIN CAPITAL LETTER T WITH CEDILLA\r
+    0x0163: 0x00ee,     #  LATIN SMALL LETTER T WITH CEDILLA\r
+    0x0164: 0x009b,     #  LATIN CAPITAL LETTER T WITH CARON\r
+    0x0165: 0x009c,     #  LATIN SMALL LETTER T WITH CARON\r
+    0x016e: 0x00de,     #  LATIN CAPITAL LETTER U WITH RING ABOVE\r
+    0x016f: 0x0085,     #  LATIN SMALL LETTER U WITH RING ABOVE\r
+    0x0170: 0x00eb,     #  LATIN CAPITAL LETTER U WITH DOUBLE ACUTE\r
+    0x0171: 0x00fb,     #  LATIN SMALL LETTER U WITH DOUBLE ACUTE\r
+    0x0179: 0x008d,     #  LATIN CAPITAL LETTER Z WITH ACUTE\r
+    0x017a: 0x00ab,     #  LATIN SMALL LETTER Z WITH ACUTE\r
+    0x017b: 0x00bd,     #  LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    0x017c: 0x00be,     #  LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    0x017d: 0x00a6,     #  LATIN CAPITAL LETTER Z WITH CARON\r
+    0x017e: 0x00a7,     #  LATIN SMALL LETTER Z WITH CARON\r
+    0x02c7: 0x00f3,     #  CARON\r
+    0x02d8: 0x00f4,     #  BREVE\r
+    0x02d9: 0x00fa,     #  DOT ABOVE\r
+    0x02db: 0x00f2,     #  OGONEK\r
+    0x02dd: 0x00f1,     #  DOUBLE ACUTE ACCENT\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp855.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp855.py
new file mode 100644 (file)
index 0000000..f72e8cc
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP855.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp855',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x0452,     #  CYRILLIC SMALL LETTER DJE\r
+    0x0081: 0x0402,     #  CYRILLIC CAPITAL LETTER DJE\r
+    0x0082: 0x0453,     #  CYRILLIC SMALL LETTER GJE\r
+    0x0083: 0x0403,     #  CYRILLIC CAPITAL LETTER GJE\r
+    0x0084: 0x0451,     #  CYRILLIC SMALL LETTER IO\r
+    0x0085: 0x0401,     #  CYRILLIC CAPITAL LETTER IO\r
+    0x0086: 0x0454,     #  CYRILLIC SMALL LETTER UKRAINIAN IE\r
+    0x0087: 0x0404,     #  CYRILLIC CAPITAL LETTER UKRAINIAN IE\r
+    0x0088: 0x0455,     #  CYRILLIC SMALL LETTER DZE\r
+    0x0089: 0x0405,     #  CYRILLIC CAPITAL LETTER DZE\r
+    0x008a: 0x0456,     #  CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    0x008b: 0x0406,     #  CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    0x008c: 0x0457,     #  CYRILLIC SMALL LETTER YI\r
+    0x008d: 0x0407,     #  CYRILLIC CAPITAL LETTER YI\r
+    0x008e: 0x0458,     #  CYRILLIC SMALL LETTER JE\r
+    0x008f: 0x0408,     #  CYRILLIC CAPITAL LETTER JE\r
+    0x0090: 0x0459,     #  CYRILLIC SMALL LETTER LJE\r
+    0x0091: 0x0409,     #  CYRILLIC CAPITAL LETTER LJE\r
+    0x0092: 0x045a,     #  CYRILLIC SMALL LETTER NJE\r
+    0x0093: 0x040a,     #  CYRILLIC CAPITAL LETTER NJE\r
+    0x0094: 0x045b,     #  CYRILLIC SMALL LETTER TSHE\r
+    0x0095: 0x040b,     #  CYRILLIC CAPITAL LETTER TSHE\r
+    0x0096: 0x045c,     #  CYRILLIC SMALL LETTER KJE\r
+    0x0097: 0x040c,     #  CYRILLIC CAPITAL LETTER KJE\r
+    0x0098: 0x045e,     #  CYRILLIC SMALL LETTER SHORT U\r
+    0x0099: 0x040e,     #  CYRILLIC CAPITAL LETTER SHORT U\r
+    0x009a: 0x045f,     #  CYRILLIC SMALL LETTER DZHE\r
+    0x009b: 0x040f,     #  CYRILLIC CAPITAL LETTER DZHE\r
+    0x009c: 0x044e,     #  CYRILLIC SMALL LETTER YU\r
+    0x009d: 0x042e,     #  CYRILLIC CAPITAL LETTER YU\r
+    0x009e: 0x044a,     #  CYRILLIC SMALL LETTER HARD SIGN\r
+    0x009f: 0x042a,     #  CYRILLIC CAPITAL LETTER HARD SIGN\r
+    0x00a0: 0x0430,     #  CYRILLIC SMALL LETTER A\r
+    0x00a1: 0x0410,     #  CYRILLIC CAPITAL LETTER A\r
+    0x00a2: 0x0431,     #  CYRILLIC SMALL LETTER BE\r
+    0x00a3: 0x0411,     #  CYRILLIC CAPITAL LETTER BE\r
+    0x00a4: 0x0446,     #  CYRILLIC SMALL LETTER TSE\r
+    0x00a5: 0x0426,     #  CYRILLIC CAPITAL LETTER TSE\r
+    0x00a6: 0x0434,     #  CYRILLIC SMALL LETTER DE\r
+    0x00a7: 0x0414,     #  CYRILLIC CAPITAL LETTER DE\r
+    0x00a8: 0x0435,     #  CYRILLIC SMALL LETTER IE\r
+    0x00a9: 0x0415,     #  CYRILLIC CAPITAL LETTER IE\r
+    0x00aa: 0x0444,     #  CYRILLIC SMALL LETTER EF\r
+    0x00ab: 0x0424,     #  CYRILLIC CAPITAL LETTER EF\r
+    0x00ac: 0x0433,     #  CYRILLIC SMALL LETTER GHE\r
+    0x00ad: 0x0413,     #  CYRILLIC CAPITAL LETTER GHE\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x0445,     #  CYRILLIC SMALL LETTER HA\r
+    0x00b6: 0x0425,     #  CYRILLIC CAPITAL LETTER HA\r
+    0x00b7: 0x0438,     #  CYRILLIC SMALL LETTER I\r
+    0x00b8: 0x0418,     #  CYRILLIC CAPITAL LETTER I\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x0439,     #  CYRILLIC SMALL LETTER SHORT I\r
+    0x00be: 0x0419,     #  CYRILLIC CAPITAL LETTER SHORT I\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x043a,     #  CYRILLIC SMALL LETTER KA\r
+    0x00c7: 0x041a,     #  CYRILLIC CAPITAL LETTER KA\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x00a4,     #  CURRENCY SIGN\r
+    0x00d0: 0x043b,     #  CYRILLIC SMALL LETTER EL\r
+    0x00d1: 0x041b,     #  CYRILLIC CAPITAL LETTER EL\r
+    0x00d2: 0x043c,     #  CYRILLIC SMALL LETTER EM\r
+    0x00d3: 0x041c,     #  CYRILLIC CAPITAL LETTER EM\r
+    0x00d4: 0x043d,     #  CYRILLIC SMALL LETTER EN\r
+    0x00d5: 0x041d,     #  CYRILLIC CAPITAL LETTER EN\r
+    0x00d6: 0x043e,     #  CYRILLIC SMALL LETTER O\r
+    0x00d7: 0x041e,     #  CYRILLIC CAPITAL LETTER O\r
+    0x00d8: 0x043f,     #  CYRILLIC SMALL LETTER PE\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x041f,     #  CYRILLIC CAPITAL LETTER PE\r
+    0x00de: 0x044f,     #  CYRILLIC SMALL LETTER YA\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x042f,     #  CYRILLIC CAPITAL LETTER YA\r
+    0x00e1: 0x0440,     #  CYRILLIC SMALL LETTER ER\r
+    0x00e2: 0x0420,     #  CYRILLIC CAPITAL LETTER ER\r
+    0x00e3: 0x0441,     #  CYRILLIC SMALL LETTER ES\r
+    0x00e4: 0x0421,     #  CYRILLIC CAPITAL LETTER ES\r
+    0x00e5: 0x0442,     #  CYRILLIC SMALL LETTER TE\r
+    0x00e6: 0x0422,     #  CYRILLIC CAPITAL LETTER TE\r
+    0x00e7: 0x0443,     #  CYRILLIC SMALL LETTER U\r
+    0x00e8: 0x0423,     #  CYRILLIC CAPITAL LETTER U\r
+    0x00e9: 0x0436,     #  CYRILLIC SMALL LETTER ZHE\r
+    0x00ea: 0x0416,     #  CYRILLIC CAPITAL LETTER ZHE\r
+    0x00eb: 0x0432,     #  CYRILLIC SMALL LETTER VE\r
+    0x00ec: 0x0412,     #  CYRILLIC CAPITAL LETTER VE\r
+    0x00ed: 0x044c,     #  CYRILLIC SMALL LETTER SOFT SIGN\r
+    0x00ee: 0x042c,     #  CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    0x00ef: 0x2116,     #  NUMERO SIGN\r
+    0x00f0: 0x00ad,     #  SOFT HYPHEN\r
+    0x00f1: 0x044b,     #  CYRILLIC SMALL LETTER YERU\r
+    0x00f2: 0x042b,     #  CYRILLIC CAPITAL LETTER YERU\r
+    0x00f3: 0x0437,     #  CYRILLIC SMALL LETTER ZE\r
+    0x00f4: 0x0417,     #  CYRILLIC CAPITAL LETTER ZE\r
+    0x00f5: 0x0448,     #  CYRILLIC SMALL LETTER SHA\r
+    0x00f6: 0x0428,     #  CYRILLIC CAPITAL LETTER SHA\r
+    0x00f7: 0x044d,     #  CYRILLIC SMALL LETTER E\r
+    0x00f8: 0x042d,     #  CYRILLIC CAPITAL LETTER E\r
+    0x00f9: 0x0449,     #  CYRILLIC SMALL LETTER SHCHA\r
+    0x00fa: 0x0429,     #  CYRILLIC CAPITAL LETTER SHCHA\r
+    0x00fb: 0x0447,     #  CYRILLIC SMALL LETTER CHE\r
+    0x00fc: 0x0427,     #  CYRILLIC CAPITAL LETTER CHE\r
+    0x00fd: 0x00a7,     #  SECTION SIGN\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\u0452'   #  0x0080 -> CYRILLIC SMALL LETTER DJE\r
+    u'\u0402'   #  0x0081 -> CYRILLIC CAPITAL LETTER DJE\r
+    u'\u0453'   #  0x0082 -> CYRILLIC SMALL LETTER GJE\r
+    u'\u0403'   #  0x0083 -> CYRILLIC CAPITAL LETTER GJE\r
+    u'\u0451'   #  0x0084 -> CYRILLIC SMALL LETTER IO\r
+    u'\u0401'   #  0x0085 -> CYRILLIC CAPITAL LETTER IO\r
+    u'\u0454'   #  0x0086 -> CYRILLIC SMALL LETTER UKRAINIAN IE\r
+    u'\u0404'   #  0x0087 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE\r
+    u'\u0455'   #  0x0088 -> CYRILLIC SMALL LETTER DZE\r
+    u'\u0405'   #  0x0089 -> CYRILLIC CAPITAL LETTER DZE\r
+    u'\u0456'   #  0x008a -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    u'\u0406'   #  0x008b -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    u'\u0457'   #  0x008c -> CYRILLIC SMALL LETTER YI\r
+    u'\u0407'   #  0x008d -> CYRILLIC CAPITAL LETTER YI\r
+    u'\u0458'   #  0x008e -> CYRILLIC SMALL LETTER JE\r
+    u'\u0408'   #  0x008f -> CYRILLIC CAPITAL LETTER JE\r
+    u'\u0459'   #  0x0090 -> CYRILLIC SMALL LETTER LJE\r
+    u'\u0409'   #  0x0091 -> CYRILLIC CAPITAL LETTER LJE\r
+    u'\u045a'   #  0x0092 -> CYRILLIC SMALL LETTER NJE\r
+    u'\u040a'   #  0x0093 -> CYRILLIC CAPITAL LETTER NJE\r
+    u'\u045b'   #  0x0094 -> CYRILLIC SMALL LETTER TSHE\r
+    u'\u040b'   #  0x0095 -> CYRILLIC CAPITAL LETTER TSHE\r
+    u'\u045c'   #  0x0096 -> CYRILLIC SMALL LETTER KJE\r
+    u'\u040c'   #  0x0097 -> CYRILLIC CAPITAL LETTER KJE\r
+    u'\u045e'   #  0x0098 -> CYRILLIC SMALL LETTER SHORT U\r
+    u'\u040e'   #  0x0099 -> CYRILLIC CAPITAL LETTER SHORT U\r
+    u'\u045f'   #  0x009a -> CYRILLIC SMALL LETTER DZHE\r
+    u'\u040f'   #  0x009b -> CYRILLIC CAPITAL LETTER DZHE\r
+    u'\u044e'   #  0x009c -> CYRILLIC SMALL LETTER YU\r
+    u'\u042e'   #  0x009d -> CYRILLIC CAPITAL LETTER YU\r
+    u'\u044a'   #  0x009e -> CYRILLIC SMALL LETTER HARD SIGN\r
+    u'\u042a'   #  0x009f -> CYRILLIC CAPITAL LETTER HARD SIGN\r
+    u'\u0430'   #  0x00a0 -> CYRILLIC SMALL LETTER A\r
+    u'\u0410'   #  0x00a1 -> CYRILLIC CAPITAL LETTER A\r
+    u'\u0431'   #  0x00a2 -> CYRILLIC SMALL LETTER BE\r
+    u'\u0411'   #  0x00a3 -> CYRILLIC CAPITAL LETTER BE\r
+    u'\u0446'   #  0x00a4 -> CYRILLIC SMALL LETTER TSE\r
+    u'\u0426'   #  0x00a5 -> CYRILLIC CAPITAL LETTER TSE\r
+    u'\u0434'   #  0x00a6 -> CYRILLIC SMALL LETTER DE\r
+    u'\u0414'   #  0x00a7 -> CYRILLIC CAPITAL LETTER DE\r
+    u'\u0435'   #  0x00a8 -> CYRILLIC SMALL LETTER IE\r
+    u'\u0415'   #  0x00a9 -> CYRILLIC CAPITAL LETTER IE\r
+    u'\u0444'   #  0x00aa -> CYRILLIC SMALL LETTER EF\r
+    u'\u0424'   #  0x00ab -> CYRILLIC CAPITAL LETTER EF\r
+    u'\u0433'   #  0x00ac -> CYRILLIC SMALL LETTER GHE\r
+    u'\u0413'   #  0x00ad -> CYRILLIC CAPITAL LETTER GHE\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u0445'   #  0x00b5 -> CYRILLIC SMALL LETTER HA\r
+    u'\u0425'   #  0x00b6 -> CYRILLIC CAPITAL LETTER HA\r
+    u'\u0438'   #  0x00b7 -> CYRILLIC SMALL LETTER I\r
+    u'\u0418'   #  0x00b8 -> CYRILLIC CAPITAL LETTER I\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u0439'   #  0x00bd -> CYRILLIC SMALL LETTER SHORT I\r
+    u'\u0419'   #  0x00be -> CYRILLIC CAPITAL LETTER SHORT I\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u043a'   #  0x00c6 -> CYRILLIC SMALL LETTER KA\r
+    u'\u041a'   #  0x00c7 -> CYRILLIC CAPITAL LETTER KA\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\xa4'     #  0x00cf -> CURRENCY SIGN\r
+    u'\u043b'   #  0x00d0 -> CYRILLIC SMALL LETTER EL\r
+    u'\u041b'   #  0x00d1 -> CYRILLIC CAPITAL LETTER EL\r
+    u'\u043c'   #  0x00d2 -> CYRILLIC SMALL LETTER EM\r
+    u'\u041c'   #  0x00d3 -> CYRILLIC CAPITAL LETTER EM\r
+    u'\u043d'   #  0x00d4 -> CYRILLIC SMALL LETTER EN\r
+    u'\u041d'   #  0x00d5 -> CYRILLIC CAPITAL LETTER EN\r
+    u'\u043e'   #  0x00d6 -> CYRILLIC SMALL LETTER O\r
+    u'\u041e'   #  0x00d7 -> CYRILLIC CAPITAL LETTER O\r
+    u'\u043f'   #  0x00d8 -> CYRILLIC SMALL LETTER PE\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u041f'   #  0x00dd -> CYRILLIC CAPITAL LETTER PE\r
+    u'\u044f'   #  0x00de -> CYRILLIC SMALL LETTER YA\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\u042f'   #  0x00e0 -> CYRILLIC CAPITAL LETTER YA\r
+    u'\u0440'   #  0x00e1 -> CYRILLIC SMALL LETTER ER\r
+    u'\u0420'   #  0x00e2 -> CYRILLIC CAPITAL LETTER ER\r
+    u'\u0441'   #  0x00e3 -> CYRILLIC SMALL LETTER ES\r
+    u'\u0421'   #  0x00e4 -> CYRILLIC CAPITAL LETTER ES\r
+    u'\u0442'   #  0x00e5 -> CYRILLIC SMALL LETTER TE\r
+    u'\u0422'   #  0x00e6 -> CYRILLIC CAPITAL LETTER TE\r
+    u'\u0443'   #  0x00e7 -> CYRILLIC SMALL LETTER U\r
+    u'\u0423'   #  0x00e8 -> CYRILLIC CAPITAL LETTER U\r
+    u'\u0436'   #  0x00e9 -> CYRILLIC SMALL LETTER ZHE\r
+    u'\u0416'   #  0x00ea -> CYRILLIC CAPITAL LETTER ZHE\r
+    u'\u0432'   #  0x00eb -> CYRILLIC SMALL LETTER VE\r
+    u'\u0412'   #  0x00ec -> CYRILLIC CAPITAL LETTER VE\r
+    u'\u044c'   #  0x00ed -> CYRILLIC SMALL LETTER SOFT SIGN\r
+    u'\u042c'   #  0x00ee -> CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    u'\u2116'   #  0x00ef -> NUMERO SIGN\r
+    u'\xad'     #  0x00f0 -> SOFT HYPHEN\r
+    u'\u044b'   #  0x00f1 -> CYRILLIC SMALL LETTER YERU\r
+    u'\u042b'   #  0x00f2 -> CYRILLIC CAPITAL LETTER YERU\r
+    u'\u0437'   #  0x00f3 -> CYRILLIC SMALL LETTER ZE\r
+    u'\u0417'   #  0x00f4 -> CYRILLIC CAPITAL LETTER ZE\r
+    u'\u0448'   #  0x00f5 -> CYRILLIC SMALL LETTER SHA\r
+    u'\u0428'   #  0x00f6 -> CYRILLIC CAPITAL LETTER SHA\r
+    u'\u044d'   #  0x00f7 -> CYRILLIC SMALL LETTER E\r
+    u'\u042d'   #  0x00f8 -> CYRILLIC CAPITAL LETTER E\r
+    u'\u0449'   #  0x00f9 -> CYRILLIC SMALL LETTER SHCHA\r
+    u'\u0429'   #  0x00fa -> CYRILLIC CAPITAL LETTER SHCHA\r
+    u'\u0447'   #  0x00fb -> CYRILLIC SMALL LETTER CHE\r
+    u'\u0427'   #  0x00fc -> CYRILLIC CAPITAL LETTER CHE\r
+    u'\xa7'     #  0x00fd -> SECTION SIGN\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a4: 0x00cf,     #  CURRENCY SIGN\r
+    0x00a7: 0x00fd,     #  SECTION SIGN\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ad: 0x00f0,     #  SOFT HYPHEN\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x0401: 0x0085,     #  CYRILLIC CAPITAL LETTER IO\r
+    0x0402: 0x0081,     #  CYRILLIC CAPITAL LETTER DJE\r
+    0x0403: 0x0083,     #  CYRILLIC CAPITAL LETTER GJE\r
+    0x0404: 0x0087,     #  CYRILLIC CAPITAL LETTER UKRAINIAN IE\r
+    0x0405: 0x0089,     #  CYRILLIC CAPITAL LETTER DZE\r
+    0x0406: 0x008b,     #  CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    0x0407: 0x008d,     #  CYRILLIC CAPITAL LETTER YI\r
+    0x0408: 0x008f,     #  CYRILLIC CAPITAL LETTER JE\r
+    0x0409: 0x0091,     #  CYRILLIC CAPITAL LETTER LJE\r
+    0x040a: 0x0093,     #  CYRILLIC CAPITAL LETTER NJE\r
+    0x040b: 0x0095,     #  CYRILLIC CAPITAL LETTER TSHE\r
+    0x040c: 0x0097,     #  CYRILLIC CAPITAL LETTER KJE\r
+    0x040e: 0x0099,     #  CYRILLIC CAPITAL LETTER SHORT U\r
+    0x040f: 0x009b,     #  CYRILLIC CAPITAL LETTER DZHE\r
+    0x0410: 0x00a1,     #  CYRILLIC CAPITAL LETTER A\r
+    0x0411: 0x00a3,     #  CYRILLIC CAPITAL LETTER BE\r
+    0x0412: 0x00ec,     #  CYRILLIC CAPITAL LETTER VE\r
+    0x0413: 0x00ad,     #  CYRILLIC CAPITAL LETTER GHE\r
+    0x0414: 0x00a7,     #  CYRILLIC CAPITAL LETTER DE\r
+    0x0415: 0x00a9,     #  CYRILLIC CAPITAL LETTER IE\r
+    0x0416: 0x00ea,     #  CYRILLIC CAPITAL LETTER ZHE\r
+    0x0417: 0x00f4,     #  CYRILLIC CAPITAL LETTER ZE\r
+    0x0418: 0x00b8,     #  CYRILLIC CAPITAL LETTER I\r
+    0x0419: 0x00be,     #  CYRILLIC CAPITAL LETTER SHORT I\r
+    0x041a: 0x00c7,     #  CYRILLIC CAPITAL LETTER KA\r
+    0x041b: 0x00d1,     #  CYRILLIC CAPITAL LETTER EL\r
+    0x041c: 0x00d3,     #  CYRILLIC CAPITAL LETTER EM\r
+    0x041d: 0x00d5,     #  CYRILLIC CAPITAL LETTER EN\r
+    0x041e: 0x00d7,     #  CYRILLIC CAPITAL LETTER O\r
+    0x041f: 0x00dd,     #  CYRILLIC CAPITAL LETTER PE\r
+    0x0420: 0x00e2,     #  CYRILLIC CAPITAL LETTER ER\r
+    0x0421: 0x00e4,     #  CYRILLIC CAPITAL LETTER ES\r
+    0x0422: 0x00e6,     #  CYRILLIC CAPITAL LETTER TE\r
+    0x0423: 0x00e8,     #  CYRILLIC CAPITAL LETTER U\r
+    0x0424: 0x00ab,     #  CYRILLIC CAPITAL LETTER EF\r
+    0x0425: 0x00b6,     #  CYRILLIC CAPITAL LETTER HA\r
+    0x0426: 0x00a5,     #  CYRILLIC CAPITAL LETTER TSE\r
+    0x0427: 0x00fc,     #  CYRILLIC CAPITAL LETTER CHE\r
+    0x0428: 0x00f6,     #  CYRILLIC CAPITAL LETTER SHA\r
+    0x0429: 0x00fa,     #  CYRILLIC CAPITAL LETTER SHCHA\r
+    0x042a: 0x009f,     #  CYRILLIC CAPITAL LETTER HARD SIGN\r
+    0x042b: 0x00f2,     #  CYRILLIC CAPITAL LETTER YERU\r
+    0x042c: 0x00ee,     #  CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    0x042d: 0x00f8,     #  CYRILLIC CAPITAL LETTER E\r
+    0x042e: 0x009d,     #  CYRILLIC CAPITAL LETTER YU\r
+    0x042f: 0x00e0,     #  CYRILLIC CAPITAL LETTER YA\r
+    0x0430: 0x00a0,     #  CYRILLIC SMALL LETTER A\r
+    0x0431: 0x00a2,     #  CYRILLIC SMALL LETTER BE\r
+    0x0432: 0x00eb,     #  CYRILLIC SMALL LETTER VE\r
+    0x0433: 0x00ac,     #  CYRILLIC SMALL LETTER GHE\r
+    0x0434: 0x00a6,     #  CYRILLIC SMALL LETTER DE\r
+    0x0435: 0x00a8,     #  CYRILLIC SMALL LETTER IE\r
+    0x0436: 0x00e9,     #  CYRILLIC SMALL LETTER ZHE\r
+    0x0437: 0x00f3,     #  CYRILLIC SMALL LETTER ZE\r
+    0x0438: 0x00b7,     #  CYRILLIC SMALL LETTER I\r
+    0x0439: 0x00bd,     #  CYRILLIC SMALL LETTER SHORT I\r
+    0x043a: 0x00c6,     #  CYRILLIC SMALL LETTER KA\r
+    0x043b: 0x00d0,     #  CYRILLIC SMALL LETTER EL\r
+    0x043c: 0x00d2,     #  CYRILLIC SMALL LETTER EM\r
+    0x043d: 0x00d4,     #  CYRILLIC SMALL LETTER EN\r
+    0x043e: 0x00d6,     #  CYRILLIC SMALL LETTER O\r
+    0x043f: 0x00d8,     #  CYRILLIC SMALL LETTER PE\r
+    0x0440: 0x00e1,     #  CYRILLIC SMALL LETTER ER\r
+    0x0441: 0x00e3,     #  CYRILLIC SMALL LETTER ES\r
+    0x0442: 0x00e5,     #  CYRILLIC SMALL LETTER TE\r
+    0x0443: 0x00e7,     #  CYRILLIC SMALL LETTER U\r
+    0x0444: 0x00aa,     #  CYRILLIC SMALL LETTER EF\r
+    0x0445: 0x00b5,     #  CYRILLIC SMALL LETTER HA\r
+    0x0446: 0x00a4,     #  CYRILLIC SMALL LETTER TSE\r
+    0x0447: 0x00fb,     #  CYRILLIC SMALL LETTER CHE\r
+    0x0448: 0x00f5,     #  CYRILLIC SMALL LETTER SHA\r
+    0x0449: 0x00f9,     #  CYRILLIC SMALL LETTER SHCHA\r
+    0x044a: 0x009e,     #  CYRILLIC SMALL LETTER HARD SIGN\r
+    0x044b: 0x00f1,     #  CYRILLIC SMALL LETTER YERU\r
+    0x044c: 0x00ed,     #  CYRILLIC SMALL LETTER SOFT SIGN\r
+    0x044d: 0x00f7,     #  CYRILLIC SMALL LETTER E\r
+    0x044e: 0x009c,     #  CYRILLIC SMALL LETTER YU\r
+    0x044f: 0x00de,     #  CYRILLIC SMALL LETTER YA\r
+    0x0451: 0x0084,     #  CYRILLIC SMALL LETTER IO\r
+    0x0452: 0x0080,     #  CYRILLIC SMALL LETTER DJE\r
+    0x0453: 0x0082,     #  CYRILLIC SMALL LETTER GJE\r
+    0x0454: 0x0086,     #  CYRILLIC SMALL LETTER UKRAINIAN IE\r
+    0x0455: 0x0088,     #  CYRILLIC SMALL LETTER DZE\r
+    0x0456: 0x008a,     #  CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    0x0457: 0x008c,     #  CYRILLIC SMALL LETTER YI\r
+    0x0458: 0x008e,     #  CYRILLIC SMALL LETTER JE\r
+    0x0459: 0x0090,     #  CYRILLIC SMALL LETTER LJE\r
+    0x045a: 0x0092,     #  CYRILLIC SMALL LETTER NJE\r
+    0x045b: 0x0094,     #  CYRILLIC SMALL LETTER TSHE\r
+    0x045c: 0x0096,     #  CYRILLIC SMALL LETTER KJE\r
+    0x045e: 0x0098,     #  CYRILLIC SMALL LETTER SHORT U\r
+    0x045f: 0x009a,     #  CYRILLIC SMALL LETTER DZHE\r
+    0x2116: 0x00ef,     #  NUMERO SIGN\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp856.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp856.py
new file mode 100644 (file)
index 0000000..e26af0b
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp856 generated from 'MAPPINGS/VENDORS/MISC/CP856.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp856',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u05d0'   #  0x80 -> HEBREW LETTER ALEF\r
+    u'\u05d1'   #  0x81 -> HEBREW LETTER BET\r
+    u'\u05d2'   #  0x82 -> HEBREW LETTER GIMEL\r
+    u'\u05d3'   #  0x83 -> HEBREW LETTER DALET\r
+    u'\u05d4'   #  0x84 -> HEBREW LETTER HE\r
+    u'\u05d5'   #  0x85 -> HEBREW LETTER VAV\r
+    u'\u05d6'   #  0x86 -> HEBREW LETTER ZAYIN\r
+    u'\u05d7'   #  0x87 -> HEBREW LETTER HET\r
+    u'\u05d8'   #  0x88 -> HEBREW LETTER TET\r
+    u'\u05d9'   #  0x89 -> HEBREW LETTER YOD\r
+    u'\u05da'   #  0x8A -> HEBREW LETTER FINAL KAF\r
+    u'\u05db'   #  0x8B -> HEBREW LETTER KAF\r
+    u'\u05dc'   #  0x8C -> HEBREW LETTER LAMED\r
+    u'\u05dd'   #  0x8D -> HEBREW LETTER FINAL MEM\r
+    u'\u05de'   #  0x8E -> HEBREW LETTER MEM\r
+    u'\u05df'   #  0x8F -> HEBREW LETTER FINAL NUN\r
+    u'\u05e0'   #  0x90 -> HEBREW LETTER NUN\r
+    u'\u05e1'   #  0x91 -> HEBREW LETTER SAMEKH\r
+    u'\u05e2'   #  0x92 -> HEBREW LETTER AYIN\r
+    u'\u05e3'   #  0x93 -> HEBREW LETTER FINAL PE\r
+    u'\u05e4'   #  0x94 -> HEBREW LETTER PE\r
+    u'\u05e5'   #  0x95 -> HEBREW LETTER FINAL TSADI\r
+    u'\u05e6'   #  0x96 -> HEBREW LETTER TSADI\r
+    u'\u05e7'   #  0x97 -> HEBREW LETTER QOF\r
+    u'\u05e8'   #  0x98 -> HEBREW LETTER RESH\r
+    u'\u05e9'   #  0x99 -> HEBREW LETTER SHIN\r
+    u'\u05ea'   #  0x9A -> HEBREW LETTER TAV\r
+    u'\ufffe'   #  0x9B -> UNDEFINED\r
+    u'\xa3'     #  0x9C -> POUND SIGN\r
+    u'\ufffe'   #  0x9D -> UNDEFINED\r
+    u'\xd7'     #  0x9E -> MULTIPLICATION SIGN\r
+    u'\ufffe'   #  0x9F -> UNDEFINED\r
+    u'\ufffe'   #  0xA0 -> UNDEFINED\r
+    u'\ufffe'   #  0xA1 -> UNDEFINED\r
+    u'\ufffe'   #  0xA2 -> UNDEFINED\r
+    u'\ufffe'   #  0xA3 -> UNDEFINED\r
+    u'\ufffe'   #  0xA4 -> UNDEFINED\r
+    u'\ufffe'   #  0xA5 -> UNDEFINED\r
+    u'\ufffe'   #  0xA6 -> UNDEFINED\r
+    u'\ufffe'   #  0xA7 -> UNDEFINED\r
+    u'\ufffe'   #  0xA8 -> UNDEFINED\r
+    u'\xae'     #  0xA9 -> REGISTERED SIGN\r
+    u'\xac'     #  0xAA -> NOT SIGN\r
+    u'\xbd'     #  0xAB -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0xAC -> VULGAR FRACTION ONE QUARTER\r
+    u'\ufffe'   #  0xAD -> UNDEFINED\r
+    u'\xab'     #  0xAE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0xAF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0xB0 -> LIGHT SHADE\r
+    u'\u2592'   #  0xB1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0xB2 -> DARK SHADE\r
+    u'\u2502'   #  0xB3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0xB4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\ufffe'   #  0xB5 -> UNDEFINED\r
+    u'\ufffe'   #  0xB6 -> UNDEFINED\r
+    u'\ufffe'   #  0xB7 -> UNDEFINED\r
+    u'\xa9'     #  0xB8 -> COPYRIGHT SIGN\r
+    u'\u2563'   #  0xB9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0xBA -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0xBB -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0xBC -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\xa2'     #  0xBD -> CENT SIGN\r
+    u'\xa5'     #  0xBE -> YEN SIGN\r
+    u'\u2510'   #  0xBF -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0xC0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0xC1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0xC2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0xC3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0xC4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0xC5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\ufffe'   #  0xC6 -> UNDEFINED\r
+    u'\ufffe'   #  0xC7 -> UNDEFINED\r
+    u'\u255a'   #  0xC8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0xC9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0xCA -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0xCB -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0xCC -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0xCD -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0xCE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\xa4'     #  0xCF -> CURRENCY SIGN\r
+    u'\ufffe'   #  0xD0 -> UNDEFINED\r
+    u'\ufffe'   #  0xD1 -> UNDEFINED\r
+    u'\ufffe'   #  0xD2 -> UNDEFINED\r
+    u'\ufffe'   #  0xD3 -> UNDEFINEDS\r
+    u'\ufffe'   #  0xD4 -> UNDEFINED\r
+    u'\ufffe'   #  0xD5 -> UNDEFINED\r
+    u'\ufffe'   #  0xD6 -> UNDEFINEDE\r
+    u'\ufffe'   #  0xD7 -> UNDEFINED\r
+    u'\ufffe'   #  0xD8 -> UNDEFINED\r
+    u'\u2518'   #  0xD9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0xDA -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0xDB -> FULL BLOCK\r
+    u'\u2584'   #  0xDC -> LOWER HALF BLOCK\r
+    u'\xa6'     #  0xDD -> BROKEN BAR\r
+    u'\ufffe'   #  0xDE -> UNDEFINED\r
+    u'\u2580'   #  0xDF -> UPPER HALF BLOCK\r
+    u'\ufffe'   #  0xE0 -> UNDEFINED\r
+    u'\ufffe'   #  0xE1 -> UNDEFINED\r
+    u'\ufffe'   #  0xE2 -> UNDEFINED\r
+    u'\ufffe'   #  0xE3 -> UNDEFINED\r
+    u'\ufffe'   #  0xE4 -> UNDEFINED\r
+    u'\ufffe'   #  0xE5 -> UNDEFINED\r
+    u'\xb5'     #  0xE6 -> MICRO SIGN\r
+    u'\ufffe'   #  0xE7 -> UNDEFINED\r
+    u'\ufffe'   #  0xE8 -> UNDEFINED\r
+    u'\ufffe'   #  0xE9 -> UNDEFINED\r
+    u'\ufffe'   #  0xEA -> UNDEFINED\r
+    u'\ufffe'   #  0xEB -> UNDEFINED\r
+    u'\ufffe'   #  0xEC -> UNDEFINED\r
+    u'\ufffe'   #  0xED -> UNDEFINED\r
+    u'\xaf'     #  0xEE -> MACRON\r
+    u'\xb4'     #  0xEF -> ACUTE ACCENT\r
+    u'\xad'     #  0xF0 -> SOFT HYPHEN\r
+    u'\xb1'     #  0xF1 -> PLUS-MINUS SIGN\r
+    u'\u2017'   #  0xF2 -> DOUBLE LOW LINE\r
+    u'\xbe'     #  0xF3 -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xb6'     #  0xF4 -> PILCROW SIGN\r
+    u'\xa7'     #  0xF5 -> SECTION SIGN\r
+    u'\xf7'     #  0xF6 -> DIVISION SIGN\r
+    u'\xb8'     #  0xF7 -> CEDILLA\r
+    u'\xb0'     #  0xF8 -> DEGREE SIGN\r
+    u'\xa8'     #  0xF9 -> DIAERESIS\r
+    u'\xb7'     #  0xFA -> MIDDLE DOT\r
+    u'\xb9'     #  0xFB -> SUPERSCRIPT ONE\r
+    u'\xb3'     #  0xFC -> SUPERSCRIPT THREE\r
+    u'\xb2'     #  0xFD -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0xFE -> BLACK SQUARE\r
+    u'\xa0'     #  0xFF -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp857.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp857.py
new file mode 100644 (file)
index 0000000..d337e5b
--- /dev/null
@@ -0,0 +1,694 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP857.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp857',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x00c7,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x0081: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0082: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x0083: 0x00e2,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x0084: 0x00e4,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x0085: 0x00e0,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x0086: 0x00e5,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x0087: 0x00e7,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x0088: 0x00ea,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x0089: 0x00eb,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x008a: 0x00e8,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x008b: 0x00ef,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x008c: 0x00ee,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x008d: 0x0131,     #  LATIN SMALL LETTER DOTLESS I\r
+    0x008e: 0x00c4,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x008f: 0x00c5,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x0090: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0091: 0x00e6,     #  LATIN SMALL LIGATURE AE\r
+    0x0092: 0x00c6,     #  LATIN CAPITAL LIGATURE AE\r
+    0x0093: 0x00f4,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x0094: 0x00f6,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x0095: 0x00f2,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x0096: 0x00fb,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x0097: 0x00f9,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x0098: 0x0130,     #  LATIN CAPITAL LETTER I WITH DOT ABOVE\r
+    0x0099: 0x00d6,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x009a: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x009b: 0x00f8,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x00d8,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x009e: 0x015e,     #  LATIN CAPITAL LETTER S WITH CEDILLA\r
+    0x009f: 0x015f,     #  LATIN SMALL LETTER S WITH CEDILLA\r
+    0x00a0: 0x00e1,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00a1: 0x00ed,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00a4: 0x00f1,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00a5: 0x00d1,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00a6: 0x011e,     #  LATIN CAPITAL LETTER G WITH BREVE\r
+    0x00a7: 0x011f,     #  LATIN SMALL LETTER G WITH BREVE\r
+    0x00a8: 0x00bf,     #  INVERTED QUESTION MARK\r
+    0x00a9: 0x00ae,     #  REGISTERED SIGN\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x00bc,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00ad: 0x00a1,     #  INVERTED EXCLAMATION MARK\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x00c1,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00b6: 0x00c2,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x00b7: 0x00c0,     #  LATIN CAPITAL LETTER A WITH GRAVE\r
+    0x00b8: 0x00a9,     #  COPYRIGHT SIGN\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x00a2,     #  CENT SIGN\r
+    0x00be: 0x00a5,     #  YEN SIGN\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x00e3,     #  LATIN SMALL LETTER A WITH TILDE\r
+    0x00c7: 0x00c3,     #  LATIN CAPITAL LETTER A WITH TILDE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x00a4,     #  CURRENCY SIGN\r
+    0x00d0: 0x00ba,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00d1: 0x00aa,     #  FEMININE ORDINAL INDICATOR\r
+    0x00d2: 0x00ca,     #  LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    0x00d3: 0x00cb,     #  LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    0x00d4: 0x00c8,     #  LATIN CAPITAL LETTER E WITH GRAVE\r
+    0x00d5: None,       #  UNDEFINED\r
+    0x00d6: 0x00cd,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00d7: 0x00ce,     #  LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    0x00d8: 0x00cf,     #  LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x00a6,     #  BROKEN BAR\r
+    0x00de: 0x00cc,     #  LATIN CAPITAL LETTER I WITH GRAVE\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x00d3,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e2: 0x00d4,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x00e3: 0x00d2,     #  LATIN CAPITAL LETTER O WITH GRAVE\r
+    0x00e4: 0x00f5,     #  LATIN SMALL LETTER O WITH TILDE\r
+    0x00e5: 0x00d5,     #  LATIN CAPITAL LETTER O WITH TILDE\r
+    0x00e6: 0x00b5,     #  MICRO SIGN\r
+    0x00e7: None,       #  UNDEFINED\r
+    0x00e8: 0x00d7,     #  MULTIPLICATION SIGN\r
+    0x00e9: 0x00da,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00ea: 0x00db,     #  LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    0x00eb: 0x00d9,     #  LATIN CAPITAL LETTER U WITH GRAVE\r
+    0x00ed: 0x00ff,     #  LATIN SMALL LETTER Y WITH DIAERESIS\r
+    0x00ee: 0x00af,     #  MACRON\r
+    0x00ef: 0x00b4,     #  ACUTE ACCENT\r
+    0x00f0: 0x00ad,     #  SOFT HYPHEN\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: None,       #  UNDEFINED\r
+    0x00f3: 0x00be,     #  VULGAR FRACTION THREE QUARTERS\r
+    0x00f4: 0x00b6,     #  PILCROW SIGN\r
+    0x00f5: 0x00a7,     #  SECTION SIGN\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x00b8,     #  CEDILLA\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x00a8,     #  DIAERESIS\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x00b9,     #  SUPERSCRIPT ONE\r
+    0x00fc: 0x00b3,     #  SUPERSCRIPT THREE\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\xc7'     #  0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xfc'     #  0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xe9'     #  0x0082 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe2'     #  0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe0'     #  0x0085 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe5'     #  0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x0087 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xea'     #  0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x008a -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xef'     #  0x008b -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xee'     #  0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\u0131'   #  0x008d -> LATIN SMALL LETTER DOTLESS I\r
+    u'\xc4'     #  0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc9'     #  0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xe6'     #  0x0091 -> LATIN SMALL LIGATURE AE\r
+    u'\xc6'     #  0x0092 -> LATIN CAPITAL LIGATURE AE\r
+    u'\xf4'     #  0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf2'     #  0x0095 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xfb'     #  0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xf9'     #  0x0097 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\u0130'   #  0x0098 -> LATIN CAPITAL LETTER I WITH DOT ABOVE\r
+    u'\xd6'     #  0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xf8'     #  0x009b -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\xd8'     #  0x009d -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\u015e'   #  0x009e -> LATIN CAPITAL LETTER S WITH CEDILLA\r
+    u'\u015f'   #  0x009f -> LATIN SMALL LETTER S WITH CEDILLA\r
+    u'\xe1'     #  0x00a0 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xed'     #  0x00a1 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xfa'     #  0x00a3 -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf1'     #  0x00a4 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xd1'     #  0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\u011e'   #  0x00a6 -> LATIN CAPITAL LETTER G WITH BREVE\r
+    u'\u011f'   #  0x00a7 -> LATIN SMALL LETTER G WITH BREVE\r
+    u'\xbf'     #  0x00a8 -> INVERTED QUESTION MARK\r
+    u'\xae'     #  0x00a9 -> REGISTERED SIGN\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0x00ac -> VULGAR FRACTION ONE QUARTER\r
+    u'\xa1'     #  0x00ad -> INVERTED EXCLAMATION MARK\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\xc1'     #  0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc0'     #  0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xa9'     #  0x00b8 -> COPYRIGHT SIGN\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\xa2'     #  0x00bd -> CENT SIGN\r
+    u'\xa5'     #  0x00be -> YEN SIGN\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\xe3'     #  0x00c6 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xc3'     #  0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\xa4'     #  0x00cf -> CURRENCY SIGN\r
+    u'\xba'     #  0x00d0 -> MASCULINE ORDINAL INDICATOR\r
+    u'\xaa'     #  0x00d1 -> FEMININE ORDINAL INDICATOR\r
+    u'\xca'     #  0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\ufffe'   #  0x00d5 -> UNDEFINED\r
+    u'\xcd'     #  0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\xa6'     #  0x00dd -> BROKEN BAR\r
+    u'\xcc'     #  0x00de -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\xd3'     #  0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S\r
+    u'\xd4'     #  0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd2'     #  0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xf5'     #  0x00e4 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xd5'     #  0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xb5'     #  0x00e6 -> MICRO SIGN\r
+    u'\ufffe'   #  0x00e7 -> UNDEFINED\r
+    u'\xd7'     #  0x00e8 -> MULTIPLICATION SIGN\r
+    u'\xda'     #  0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xd9'     #  0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xec'     #  0x00ec -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xff'     #  0x00ed -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\xaf'     #  0x00ee -> MACRON\r
+    u'\xb4'     #  0x00ef -> ACUTE ACCENT\r
+    u'\xad'     #  0x00f0 -> SOFT HYPHEN\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\ufffe'   #  0x00f2 -> UNDEFINED\r
+    u'\xbe'     #  0x00f3 -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xb6'     #  0x00f4 -> PILCROW SIGN\r
+    u'\xa7'     #  0x00f5 -> SECTION SIGN\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\xb8'     #  0x00f7 -> CEDILLA\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\xa8'     #  0x00f9 -> DIAERESIS\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\xb9'     #  0x00fb -> SUPERSCRIPT ONE\r
+    u'\xb3'     #  0x00fc -> SUPERSCRIPT THREE\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a1: 0x00ad,     #  INVERTED EXCLAMATION MARK\r
+    0x00a2: 0x00bd,     #  CENT SIGN\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00a4: 0x00cf,     #  CURRENCY SIGN\r
+    0x00a5: 0x00be,     #  YEN SIGN\r
+    0x00a6: 0x00dd,     #  BROKEN BAR\r
+    0x00a7: 0x00f5,     #  SECTION SIGN\r
+    0x00a8: 0x00f9,     #  DIAERESIS\r
+    0x00a9: 0x00b8,     #  COPYRIGHT SIGN\r
+    0x00aa: 0x00d1,     #  FEMININE ORDINAL INDICATOR\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00ad: 0x00f0,     #  SOFT HYPHEN\r
+    0x00ae: 0x00a9,     #  REGISTERED SIGN\r
+    0x00af: 0x00ee,     #  MACRON\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b3: 0x00fc,     #  SUPERSCRIPT THREE\r
+    0x00b4: 0x00ef,     #  ACUTE ACCENT\r
+    0x00b5: 0x00e6,     #  MICRO SIGN\r
+    0x00b6: 0x00f4,     #  PILCROW SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00b8: 0x00f7,     #  CEDILLA\r
+    0x00b9: 0x00fb,     #  SUPERSCRIPT ONE\r
+    0x00ba: 0x00d0,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00bc: 0x00ac,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x00be: 0x00f3,     #  VULGAR FRACTION THREE QUARTERS\r
+    0x00bf: 0x00a8,     #  INVERTED QUESTION MARK\r
+    0x00c0: 0x00b7,     #  LATIN CAPITAL LETTER A WITH GRAVE\r
+    0x00c1: 0x00b5,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00c2: 0x00b6,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x00c3: 0x00c7,     #  LATIN CAPITAL LETTER A WITH TILDE\r
+    0x00c4: 0x008e,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x00c5: 0x008f,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x00c6: 0x0092,     #  LATIN CAPITAL LIGATURE AE\r
+    0x00c7: 0x0080,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x00c8: 0x00d4,     #  LATIN CAPITAL LETTER E WITH GRAVE\r
+    0x00c9: 0x0090,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00ca: 0x00d2,     #  LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    0x00cb: 0x00d3,     #  LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    0x00cc: 0x00de,     #  LATIN CAPITAL LETTER I WITH GRAVE\r
+    0x00cd: 0x00d6,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00ce: 0x00d7,     #  LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    0x00cf: 0x00d8,     #  LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    0x00d1: 0x00a5,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00d2: 0x00e3,     #  LATIN CAPITAL LETTER O WITH GRAVE\r
+    0x00d3: 0x00e0,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00d4: 0x00e2,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x00d5: 0x00e5,     #  LATIN CAPITAL LETTER O WITH TILDE\r
+    0x00d6: 0x0099,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x00d7: 0x00e8,     #  MULTIPLICATION SIGN\r
+    0x00d8: 0x009d,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x00d9: 0x00eb,     #  LATIN CAPITAL LETTER U WITH GRAVE\r
+    0x00da: 0x00e9,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00db: 0x00ea,     #  LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    0x00dc: 0x009a,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e0: 0x0085,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x00e1: 0x00a0,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00e2: 0x0083,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x00e3: 0x00c6,     #  LATIN SMALL LETTER A WITH TILDE\r
+    0x00e4: 0x0084,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x00e5: 0x0086,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x00e6: 0x0091,     #  LATIN SMALL LIGATURE AE\r
+    0x00e7: 0x0087,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x00e8: 0x008a,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x00e9: 0x0082,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00ea: 0x0088,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x00eb: 0x0089,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x00ec: 0x00ec,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x00ed: 0x00a1,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00ee: 0x008c,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x00ef: 0x008b,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x00f1: 0x00a4,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00f2: 0x0095,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f4: 0x0093,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x00f5: 0x00e4,     #  LATIN SMALL LETTER O WITH TILDE\r
+    0x00f6: 0x0094,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00f8: 0x009b,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x00f9: 0x0097,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x00fa: 0x00a3,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00fb: 0x0096,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x00fc: 0x0081,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x00ff: 0x00ed,     #  LATIN SMALL LETTER Y WITH DIAERESIS\r
+    0x011e: 0x00a6,     #  LATIN CAPITAL LETTER G WITH BREVE\r
+    0x011f: 0x00a7,     #  LATIN SMALL LETTER G WITH BREVE\r
+    0x0130: 0x0098,     #  LATIN CAPITAL LETTER I WITH DOT ABOVE\r
+    0x0131: 0x008d,     #  LATIN SMALL LETTER DOTLESS I\r
+    0x015e: 0x009e,     #  LATIN CAPITAL LETTER S WITH CEDILLA\r
+    0x015f: 0x009f,     #  LATIN SMALL LETTER S WITH CEDILLA\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp858.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp858.py
new file mode 100644 (file)
index 0000000..427a20d
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec for CP858, modified from cp850.\r
+\r
+"""\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp858',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x00c7,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x0081: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0082: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x0083: 0x00e2,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x0084: 0x00e4,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x0085: 0x00e0,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x0086: 0x00e5,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x0087: 0x00e7,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x0088: 0x00ea,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x0089: 0x00eb,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x008a: 0x00e8,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x008b: 0x00ef,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x008c: 0x00ee,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x008d: 0x00ec,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x008e: 0x00c4,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x008f: 0x00c5,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x0090: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0091: 0x00e6,     #  LATIN SMALL LIGATURE AE\r
+    0x0092: 0x00c6,     #  LATIN CAPITAL LIGATURE AE\r
+    0x0093: 0x00f4,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x0094: 0x00f6,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x0095: 0x00f2,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x0096: 0x00fb,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x0097: 0x00f9,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x0098: 0x00ff,     #  LATIN SMALL LETTER Y WITH DIAERESIS\r
+    0x0099: 0x00d6,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x009a: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x009b: 0x00f8,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x00d8,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x009e: 0x00d7,     #  MULTIPLICATION SIGN\r
+    0x009f: 0x0192,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x00a0: 0x00e1,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00a1: 0x00ed,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00a4: 0x00f1,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00a5: 0x00d1,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00a6: 0x00aa,     #  FEMININE ORDINAL INDICATOR\r
+    0x00a7: 0x00ba,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00a8: 0x00bf,     #  INVERTED QUESTION MARK\r
+    0x00a9: 0x00ae,     #  REGISTERED SIGN\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x00bc,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00ad: 0x00a1,     #  INVERTED EXCLAMATION MARK\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x00c1,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00b6: 0x00c2,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x00b7: 0x00c0,     #  LATIN CAPITAL LETTER A WITH GRAVE\r
+    0x00b8: 0x00a9,     #  COPYRIGHT SIGN\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x00a2,     #  CENT SIGN\r
+    0x00be: 0x00a5,     #  YEN SIGN\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x00e3,     #  LATIN SMALL LETTER A WITH TILDE\r
+    0x00c7: 0x00c3,     #  LATIN CAPITAL LETTER A WITH TILDE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x00a4,     #  CURRENCY SIGN\r
+    0x00d0: 0x00f0,     #  LATIN SMALL LETTER ETH\r
+    0x00d1: 0x00d0,     #  LATIN CAPITAL LETTER ETH\r
+    0x00d2: 0x00ca,     #  LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    0x00d3: 0x00cb,     #  LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    0x00d4: 0x00c8,     #  LATIN CAPITAL LETTER E WITH GRAVE\r
+    0x00d5: 0x20ac,     #  EURO SIGN\r
+    0x00d6: 0x00cd,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00d7: 0x00ce,     #  LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    0x00d8: 0x00cf,     #  LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x00a6,     #  BROKEN BAR\r
+    0x00de: 0x00cc,     #  LATIN CAPITAL LETTER I WITH GRAVE\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x00d3,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e2: 0x00d4,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x00e3: 0x00d2,     #  LATIN CAPITAL LETTER O WITH GRAVE\r
+    0x00e4: 0x00f5,     #  LATIN SMALL LETTER O WITH TILDE\r
+    0x00e5: 0x00d5,     #  LATIN CAPITAL LETTER O WITH TILDE\r
+    0x00e6: 0x00b5,     #  MICRO SIGN\r
+    0x00e7: 0x00fe,     #  LATIN SMALL LETTER THORN\r
+    0x00e8: 0x00de,     #  LATIN CAPITAL LETTER THORN\r
+    0x00e9: 0x00da,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00ea: 0x00db,     #  LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    0x00eb: 0x00d9,     #  LATIN CAPITAL LETTER U WITH GRAVE\r
+    0x00ec: 0x00fd,     #  LATIN SMALL LETTER Y WITH ACUTE\r
+    0x00ed: 0x00dd,     #  LATIN CAPITAL LETTER Y WITH ACUTE\r
+    0x00ee: 0x00af,     #  MACRON\r
+    0x00ef: 0x00b4,     #  ACUTE ACCENT\r
+    0x00f0: 0x00ad,     #  SOFT HYPHEN\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x2017,     #  DOUBLE LOW LINE\r
+    0x00f3: 0x00be,     #  VULGAR FRACTION THREE QUARTERS\r
+    0x00f4: 0x00b6,     #  PILCROW SIGN\r
+    0x00f5: 0x00a7,     #  SECTION SIGN\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x00b8,     #  CEDILLA\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x00a8,     #  DIAERESIS\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x00b9,     #  SUPERSCRIPT ONE\r
+    0x00fc: 0x00b3,     #  SUPERSCRIPT THREE\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\xc7'     #  0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xfc'     #  0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xe9'     #  0x0082 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe2'     #  0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe0'     #  0x0085 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe5'     #  0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x0087 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xea'     #  0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x008a -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xef'     #  0x008b -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xee'     #  0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xec'     #  0x008d -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xc4'     #  0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc9'     #  0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xe6'     #  0x0091 -> LATIN SMALL LIGATURE AE\r
+    u'\xc6'     #  0x0092 -> LATIN CAPITAL LIGATURE AE\r
+    u'\xf4'     #  0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf2'     #  0x0095 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xfb'     #  0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xf9'     #  0x0097 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xff'     #  0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\xd6'     #  0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xf8'     #  0x009b -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\xd8'     #  0x009d -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xd7'     #  0x009e -> MULTIPLICATION SIGN\r
+    u'\u0192'   #  0x009f -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\xe1'     #  0x00a0 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xed'     #  0x00a1 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xfa'     #  0x00a3 -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf1'     #  0x00a4 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xd1'     #  0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xaa'     #  0x00a6 -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0x00a7 -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbf'     #  0x00a8 -> INVERTED QUESTION MARK\r
+    u'\xae'     #  0x00a9 -> REGISTERED SIGN\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0x00ac -> VULGAR FRACTION ONE QUARTER\r
+    u'\xa1'     #  0x00ad -> INVERTED EXCLAMATION MARK\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\xc1'     #  0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc0'     #  0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xa9'     #  0x00b8 -> COPYRIGHT SIGN\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\xa2'     #  0x00bd -> CENT SIGN\r
+    u'\xa5'     #  0x00be -> YEN SIGN\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\xe3'     #  0x00c6 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xc3'     #  0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\xa4'     #  0x00cf -> CURRENCY SIGN\r
+    u'\xf0'     #  0x00d0 -> LATIN SMALL LETTER ETH\r
+    u'\xd0'     #  0x00d1 -> LATIN CAPITAL LETTER ETH\r
+    u'\xca'     #  0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\u20ac'   #  0x00d5 -> EURO SIGN\r
+    u'\xcd'     #  0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\xa6'     #  0x00dd -> BROKEN BAR\r
+    u'\xcc'     #  0x00de -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\xd3'     #  0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S\r
+    u'\xd4'     #  0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd2'     #  0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xf5'     #  0x00e4 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xd5'     #  0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xb5'     #  0x00e6 -> MICRO SIGN\r
+    u'\xfe'     #  0x00e7 -> LATIN SMALL LETTER THORN\r
+    u'\xde'     #  0x00e8 -> LATIN CAPITAL LETTER THORN\r
+    u'\xda'     #  0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xd9'     #  0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xfd'     #  0x00ec -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xdd'     #  0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xaf'     #  0x00ee -> MACRON\r
+    u'\xb4'     #  0x00ef -> ACUTE ACCENT\r
+    u'\xad'     #  0x00f0 -> SOFT HYPHEN\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u2017'   #  0x00f2 -> DOUBLE LOW LINE\r
+    u'\xbe'     #  0x00f3 -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xb6'     #  0x00f4 -> PILCROW SIGN\r
+    u'\xa7'     #  0x00f5 -> SECTION SIGN\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\xb8'     #  0x00f7 -> CEDILLA\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\xa8'     #  0x00f9 -> DIAERESIS\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\xb9'     #  0x00fb -> SUPERSCRIPT ONE\r
+    u'\xb3'     #  0x00fc -> SUPERSCRIPT THREE\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a1: 0x00ad,     #  INVERTED EXCLAMATION MARK\r
+    0x00a2: 0x00bd,     #  CENT SIGN\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00a4: 0x00cf,     #  CURRENCY SIGN\r
+    0x00a5: 0x00be,     #  YEN SIGN\r
+    0x00a6: 0x00dd,     #  BROKEN BAR\r
+    0x00a7: 0x00f5,     #  SECTION SIGN\r
+    0x00a8: 0x00f9,     #  DIAERESIS\r
+    0x00a9: 0x00b8,     #  COPYRIGHT SIGN\r
+    0x00aa: 0x00a6,     #  FEMININE ORDINAL INDICATOR\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00ad: 0x00f0,     #  SOFT HYPHEN\r
+    0x00ae: 0x00a9,     #  REGISTERED SIGN\r
+    0x00af: 0x00ee,     #  MACRON\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b3: 0x00fc,     #  SUPERSCRIPT THREE\r
+    0x00b4: 0x00ef,     #  ACUTE ACCENT\r
+    0x00b5: 0x00e6,     #  MICRO SIGN\r
+    0x00b6: 0x00f4,     #  PILCROW SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00b8: 0x00f7,     #  CEDILLA\r
+    0x00b9: 0x00fb,     #  SUPERSCRIPT ONE\r
+    0x00ba: 0x00a7,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00bc: 0x00ac,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x00be: 0x00f3,     #  VULGAR FRACTION THREE QUARTERS\r
+    0x00bf: 0x00a8,     #  INVERTED QUESTION MARK\r
+    0x00c0: 0x00b7,     #  LATIN CAPITAL LETTER A WITH GRAVE\r
+    0x00c1: 0x00b5,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00c2: 0x00b6,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x00c3: 0x00c7,     #  LATIN CAPITAL LETTER A WITH TILDE\r
+    0x00c4: 0x008e,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x00c5: 0x008f,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x00c6: 0x0092,     #  LATIN CAPITAL LIGATURE AE\r
+    0x00c7: 0x0080,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x00c8: 0x00d4,     #  LATIN CAPITAL LETTER E WITH GRAVE\r
+    0x00c9: 0x0090,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00ca: 0x00d2,     #  LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    0x00cb: 0x00d3,     #  LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    0x00cc: 0x00de,     #  LATIN CAPITAL LETTER I WITH GRAVE\r
+    0x00cd: 0x00d6,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00ce: 0x00d7,     #  LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    0x00cf: 0x00d8,     #  LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    0x00d0: 0x00d1,     #  LATIN CAPITAL LETTER ETH\r
+    0x00d1: 0x00a5,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00d2: 0x00e3,     #  LATIN CAPITAL LETTER O WITH GRAVE\r
+    0x00d3: 0x00e0,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00d4: 0x00e2,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x00d5: 0x00e5,     #  LATIN CAPITAL LETTER O WITH TILDE\r
+    0x00d6: 0x0099,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x00d7: 0x009e,     #  MULTIPLICATION SIGN\r
+    0x00d8: 0x009d,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x00d9: 0x00eb,     #  LATIN CAPITAL LETTER U WITH GRAVE\r
+    0x00da: 0x00e9,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00db: 0x00ea,     #  LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    0x00dc: 0x009a,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00dd: 0x00ed,     #  LATIN CAPITAL LETTER Y WITH ACUTE\r
+    0x00de: 0x00e8,     #  LATIN CAPITAL LETTER THORN\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e0: 0x0085,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x00e1: 0x00a0,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00e2: 0x0083,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x00e3: 0x00c6,     #  LATIN SMALL LETTER A WITH TILDE\r
+    0x00e4: 0x0084,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x00e5: 0x0086,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x00e6: 0x0091,     #  LATIN SMALL LIGATURE AE\r
+    0x00e7: 0x0087,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x00e8: 0x008a,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x00e9: 0x0082,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00ea: 0x0088,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x00eb: 0x0089,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x00ec: 0x008d,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x00ed: 0x00a1,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00ee: 0x008c,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x00ef: 0x008b,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x00f0: 0x00d0,     #  LATIN SMALL LETTER ETH\r
+    0x00f1: 0x00a4,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00f2: 0x0095,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f4: 0x0093,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x00f5: 0x00e4,     #  LATIN SMALL LETTER O WITH TILDE\r
+    0x00f6: 0x0094,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00f8: 0x009b,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x00f9: 0x0097,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x00fa: 0x00a3,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00fb: 0x0096,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x00fc: 0x0081,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x00fd: 0x00ec,     #  LATIN SMALL LETTER Y WITH ACUTE\r
+    0x00fe: 0x00e7,     #  LATIN SMALL LETTER THORN\r
+    0x00ff: 0x0098,     #  LATIN SMALL LETTER Y WITH DIAERESIS\r
+    0x20ac: 0x00d5,     #  EURO SIGN\r
+    0x0192: 0x009f,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x2017: 0x00f2,     #  DOUBLE LOW LINE\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp860.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp860.py
new file mode 100644 (file)
index 0000000..ca96653
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP860.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp860',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x00c7,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x0081: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0082: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x0083: 0x00e2,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x0084: 0x00e3,     #  LATIN SMALL LETTER A WITH TILDE\r
+    0x0085: 0x00e0,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x0086: 0x00c1,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x0087: 0x00e7,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x0088: 0x00ea,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x0089: 0x00ca,     #  LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    0x008a: 0x00e8,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x008b: 0x00cd,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x008c: 0x00d4,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x008d: 0x00ec,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x008e: 0x00c3,     #  LATIN CAPITAL LETTER A WITH TILDE\r
+    0x008f: 0x00c2,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x0090: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0091: 0x00c0,     #  LATIN CAPITAL LETTER A WITH GRAVE\r
+    0x0092: 0x00c8,     #  LATIN CAPITAL LETTER E WITH GRAVE\r
+    0x0093: 0x00f4,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x0094: 0x00f5,     #  LATIN SMALL LETTER O WITH TILDE\r
+    0x0095: 0x00f2,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x0096: 0x00da,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x0097: 0x00f9,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x0098: 0x00cc,     #  LATIN CAPITAL LETTER I WITH GRAVE\r
+    0x0099: 0x00d5,     #  LATIN CAPITAL LETTER O WITH TILDE\r
+    0x009a: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x009b: 0x00a2,     #  CENT SIGN\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x00d9,     #  LATIN CAPITAL LETTER U WITH GRAVE\r
+    0x009e: 0x20a7,     #  PESETA SIGN\r
+    0x009f: 0x00d3,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00a0: 0x00e1,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00a1: 0x00ed,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00a4: 0x00f1,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00a5: 0x00d1,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00a6: 0x00aa,     #  FEMININE ORDINAL INDICATOR\r
+    0x00a7: 0x00ba,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00a8: 0x00bf,     #  INVERTED QUESTION MARK\r
+    0x00a9: 0x00d2,     #  LATIN CAPITAL LETTER O WITH GRAVE\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x00bc,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00ad: 0x00a1,     #  INVERTED EXCLAMATION MARK\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x2561,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x00b6: 0x2562,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x00b7: 0x2556,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x00b8: 0x2555,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x255c,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x00be: 0x255b,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x255e,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x00c7: 0x255f,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x2567,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d0: 0x2568,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d1: 0x2564,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d2: 0x2565,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d3: 0x2559,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x00d4: 0x2558,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x00d5: 0x2552,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x00d6: 0x2553,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x00d7: 0x256b,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d8: 0x256a,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x258c,     #  LEFT HALF BLOCK\r
+    0x00de: 0x2590,     #  RIGHT HALF BLOCK\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x03b1,     #  GREEK SMALL LETTER ALPHA\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e2: 0x0393,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x00e3: 0x03c0,     #  GREEK SMALL LETTER PI\r
+    0x00e4: 0x03a3,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x00e5: 0x03c3,     #  GREEK SMALL LETTER SIGMA\r
+    0x00e6: 0x00b5,     #  MICRO SIGN\r
+    0x00e7: 0x03c4,     #  GREEK SMALL LETTER TAU\r
+    0x00e8: 0x03a6,     #  GREEK CAPITAL LETTER PHI\r
+    0x00e9: 0x0398,     #  GREEK CAPITAL LETTER THETA\r
+    0x00ea: 0x03a9,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x00eb: 0x03b4,     #  GREEK SMALL LETTER DELTA\r
+    0x00ec: 0x221e,     #  INFINITY\r
+    0x00ed: 0x03c6,     #  GREEK SMALL LETTER PHI\r
+    0x00ee: 0x03b5,     #  GREEK SMALL LETTER EPSILON\r
+    0x00ef: 0x2229,     #  INTERSECTION\r
+    0x00f0: 0x2261,     #  IDENTICAL TO\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x2265,     #  GREATER-THAN OR EQUAL TO\r
+    0x00f3: 0x2264,     #  LESS-THAN OR EQUAL TO\r
+    0x00f4: 0x2320,     #  TOP HALF INTEGRAL\r
+    0x00f5: 0x2321,     #  BOTTOM HALF INTEGRAL\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x2248,     #  ALMOST EQUAL TO\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x2219,     #  BULLET OPERATOR\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x221a,     #  SQUARE ROOT\r
+    0x00fc: 0x207f,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\xc7'     #  0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xfc'     #  0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xe9'     #  0x0082 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe2'     #  0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe3'     #  0x0084 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe0'     #  0x0085 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0x0086 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xe7'     #  0x0087 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xea'     #  0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xca'     #  0x0089 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xe8'     #  0x008a -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xcd'     #  0x008b -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xd4'     #  0x008c -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xec'     #  0x008d -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xc3'     #  0x008e -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc2'     #  0x008f -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc9'     #  0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xc0'     #  0x0091 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc8'     #  0x0092 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xf4'     #  0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf5'     #  0x0094 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf2'     #  0x0095 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xda'     #  0x0096 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xf9'     #  0x0097 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xcc'     #  0x0098 -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xd5'     #  0x0099 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xdc'     #  0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xa2'     #  0x009b -> CENT SIGN\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\xd9'     #  0x009d -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\u20a7'   #  0x009e -> PESETA SIGN\r
+    u'\xd3'     #  0x009f -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xe1'     #  0x00a0 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xed'     #  0x00a1 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xfa'     #  0x00a3 -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf1'     #  0x00a4 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xd1'     #  0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xaa'     #  0x00a6 -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0x00a7 -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbf'     #  0x00a8 -> INVERTED QUESTION MARK\r
+    u'\xd2'     #  0x00a9 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0x00ac -> VULGAR FRACTION ONE QUARTER\r
+    u'\xa1'     #  0x00ad -> INVERTED EXCLAMATION MARK\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u2561'   #  0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u2562'   #  0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    u'\u2556'   #  0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    u'\u2555'   #  0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255c'   #  0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    u'\u255b'   #  0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u255e'   #  0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u2567'   #  0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2564'   #  0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2565'   #  0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2559'   #  0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u2558'   #  0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2552'   #  0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u2553'   #  0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    u'\u256b'   #  0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u256a'   #  0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u258c'   #  0x00dd -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x00de -> RIGHT HALF BLOCK\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\u03b1'   #  0x00e0 -> GREEK SMALL LETTER ALPHA\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S\r
+    u'\u0393'   #  0x00e2 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u03c0'   #  0x00e3 -> GREEK SMALL LETTER PI\r
+    u'\u03a3'   #  0x00e4 -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03c3'   #  0x00e5 -> GREEK SMALL LETTER SIGMA\r
+    u'\xb5'     #  0x00e6 -> MICRO SIGN\r
+    u'\u03c4'   #  0x00e7 -> GREEK SMALL LETTER TAU\r
+    u'\u03a6'   #  0x00e8 -> GREEK CAPITAL LETTER PHI\r
+    u'\u0398'   #  0x00e9 -> GREEK CAPITAL LETTER THETA\r
+    u'\u03a9'   #  0x00ea -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03b4'   #  0x00eb -> GREEK SMALL LETTER DELTA\r
+    u'\u221e'   #  0x00ec -> INFINITY\r
+    u'\u03c6'   #  0x00ed -> GREEK SMALL LETTER PHI\r
+    u'\u03b5'   #  0x00ee -> GREEK SMALL LETTER EPSILON\r
+    u'\u2229'   #  0x00ef -> INTERSECTION\r
+    u'\u2261'   #  0x00f0 -> IDENTICAL TO\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u2265'   #  0x00f2 -> GREATER-THAN OR EQUAL TO\r
+    u'\u2264'   #  0x00f3 -> LESS-THAN OR EQUAL TO\r
+    u'\u2320'   #  0x00f4 -> TOP HALF INTEGRAL\r
+    u'\u2321'   #  0x00f5 -> BOTTOM HALF INTEGRAL\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\u2248'   #  0x00f7 -> ALMOST EQUAL TO\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\u2219'   #  0x00f9 -> BULLET OPERATOR\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\u221a'   #  0x00fb -> SQUARE ROOT\r
+    u'\u207f'   #  0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a1: 0x00ad,     #  INVERTED EXCLAMATION MARK\r
+    0x00a2: 0x009b,     #  CENT SIGN\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00aa: 0x00a6,     #  FEMININE ORDINAL INDICATOR\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b5: 0x00e6,     #  MICRO SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00ba: 0x00a7,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00bc: 0x00ac,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x00bf: 0x00a8,     #  INVERTED QUESTION MARK\r
+    0x00c0: 0x0091,     #  LATIN CAPITAL LETTER A WITH GRAVE\r
+    0x00c1: 0x0086,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00c2: 0x008f,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x00c3: 0x008e,     #  LATIN CAPITAL LETTER A WITH TILDE\r
+    0x00c7: 0x0080,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x00c8: 0x0092,     #  LATIN CAPITAL LETTER E WITH GRAVE\r
+    0x00c9: 0x0090,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00ca: 0x0089,     #  LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    0x00cc: 0x0098,     #  LATIN CAPITAL LETTER I WITH GRAVE\r
+    0x00cd: 0x008b,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00d1: 0x00a5,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00d2: 0x00a9,     #  LATIN CAPITAL LETTER O WITH GRAVE\r
+    0x00d3: 0x009f,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00d4: 0x008c,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x00d5: 0x0099,     #  LATIN CAPITAL LETTER O WITH TILDE\r
+    0x00d9: 0x009d,     #  LATIN CAPITAL LETTER U WITH GRAVE\r
+    0x00da: 0x0096,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00dc: 0x009a,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e0: 0x0085,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x00e1: 0x00a0,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00e2: 0x0083,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x00e3: 0x0084,     #  LATIN SMALL LETTER A WITH TILDE\r
+    0x00e7: 0x0087,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x00e8: 0x008a,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x00e9: 0x0082,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00ea: 0x0088,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x00ec: 0x008d,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x00ed: 0x00a1,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00f1: 0x00a4,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00f2: 0x0095,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f4: 0x0093,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x00f5: 0x0094,     #  LATIN SMALL LETTER O WITH TILDE\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00f9: 0x0097,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x00fa: 0x00a3,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00fc: 0x0081,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0393: 0x00e2,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x0398: 0x00e9,     #  GREEK CAPITAL LETTER THETA\r
+    0x03a3: 0x00e4,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x03a6: 0x00e8,     #  GREEK CAPITAL LETTER PHI\r
+    0x03a9: 0x00ea,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x03b1: 0x00e0,     #  GREEK SMALL LETTER ALPHA\r
+    0x03b4: 0x00eb,     #  GREEK SMALL LETTER DELTA\r
+    0x03b5: 0x00ee,     #  GREEK SMALL LETTER EPSILON\r
+    0x03c0: 0x00e3,     #  GREEK SMALL LETTER PI\r
+    0x03c3: 0x00e5,     #  GREEK SMALL LETTER SIGMA\r
+    0x03c4: 0x00e7,     #  GREEK SMALL LETTER TAU\r
+    0x03c6: 0x00ed,     #  GREEK SMALL LETTER PHI\r
+    0x207f: 0x00fc,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x20a7: 0x009e,     #  PESETA SIGN\r
+    0x2219: 0x00f9,     #  BULLET OPERATOR\r
+    0x221a: 0x00fb,     #  SQUARE ROOT\r
+    0x221e: 0x00ec,     #  INFINITY\r
+    0x2229: 0x00ef,     #  INTERSECTION\r
+    0x2248: 0x00f7,     #  ALMOST EQUAL TO\r
+    0x2261: 0x00f0,     #  IDENTICAL TO\r
+    0x2264: 0x00f3,     #  LESS-THAN OR EQUAL TO\r
+    0x2265: 0x00f2,     #  GREATER-THAN OR EQUAL TO\r
+    0x2320: 0x00f4,     #  TOP HALF INTEGRAL\r
+    0x2321: 0x00f5,     #  BOTTOM HALF INTEGRAL\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2552: 0x00d5,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x2553: 0x00d6,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2555: 0x00b8,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x2556: 0x00b7,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x2558: 0x00d4,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x2559: 0x00d3,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255b: 0x00be,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x255c: 0x00bd,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x255e: 0x00c6,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x255f: 0x00c7,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2561: 0x00b5,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x2562: 0x00b6,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2564: 0x00d1,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x2565: 0x00d2,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2567: 0x00cf,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x2568: 0x00d0,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256a: 0x00d8,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x256b: 0x00d7,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x258c: 0x00dd,     #  LEFT HALF BLOCK\r
+    0x2590: 0x00de,     #  RIGHT HALF BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp861.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp861.py
new file mode 100644 (file)
index 0000000..ce08f10
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP861.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp861',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x00c7,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x0081: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0082: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x0083: 0x00e2,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x0084: 0x00e4,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x0085: 0x00e0,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x0086: 0x00e5,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x0087: 0x00e7,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x0088: 0x00ea,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x0089: 0x00eb,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x008a: 0x00e8,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x008b: 0x00d0,     #  LATIN CAPITAL LETTER ETH\r
+    0x008c: 0x00f0,     #  LATIN SMALL LETTER ETH\r
+    0x008d: 0x00de,     #  LATIN CAPITAL LETTER THORN\r
+    0x008e: 0x00c4,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x008f: 0x00c5,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x0090: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0091: 0x00e6,     #  LATIN SMALL LIGATURE AE\r
+    0x0092: 0x00c6,     #  LATIN CAPITAL LIGATURE AE\r
+    0x0093: 0x00f4,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x0094: 0x00f6,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x0095: 0x00fe,     #  LATIN SMALL LETTER THORN\r
+    0x0096: 0x00fb,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x0097: 0x00dd,     #  LATIN CAPITAL LETTER Y WITH ACUTE\r
+    0x0098: 0x00fd,     #  LATIN SMALL LETTER Y WITH ACUTE\r
+    0x0099: 0x00d6,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x009a: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x009b: 0x00f8,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x00d8,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x009e: 0x20a7,     #  PESETA SIGN\r
+    0x009f: 0x0192,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x00a0: 0x00e1,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00a1: 0x00ed,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00a4: 0x00c1,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00a5: 0x00cd,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00a6: 0x00d3,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00a7: 0x00da,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00a8: 0x00bf,     #  INVERTED QUESTION MARK\r
+    0x00a9: 0x2310,     #  REVERSED NOT SIGN\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x00bc,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00ad: 0x00a1,     #  INVERTED EXCLAMATION MARK\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x2561,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x00b6: 0x2562,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x00b7: 0x2556,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x00b8: 0x2555,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x255c,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x00be: 0x255b,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x255e,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x00c7: 0x255f,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x2567,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d0: 0x2568,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d1: 0x2564,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d2: 0x2565,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d3: 0x2559,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x00d4: 0x2558,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x00d5: 0x2552,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x00d6: 0x2553,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x00d7: 0x256b,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d8: 0x256a,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x258c,     #  LEFT HALF BLOCK\r
+    0x00de: 0x2590,     #  RIGHT HALF BLOCK\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x03b1,     #  GREEK SMALL LETTER ALPHA\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e2: 0x0393,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x00e3: 0x03c0,     #  GREEK SMALL LETTER PI\r
+    0x00e4: 0x03a3,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x00e5: 0x03c3,     #  GREEK SMALL LETTER SIGMA\r
+    0x00e6: 0x00b5,     #  MICRO SIGN\r
+    0x00e7: 0x03c4,     #  GREEK SMALL LETTER TAU\r
+    0x00e8: 0x03a6,     #  GREEK CAPITAL LETTER PHI\r
+    0x00e9: 0x0398,     #  GREEK CAPITAL LETTER THETA\r
+    0x00ea: 0x03a9,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x00eb: 0x03b4,     #  GREEK SMALL LETTER DELTA\r
+    0x00ec: 0x221e,     #  INFINITY\r
+    0x00ed: 0x03c6,     #  GREEK SMALL LETTER PHI\r
+    0x00ee: 0x03b5,     #  GREEK SMALL LETTER EPSILON\r
+    0x00ef: 0x2229,     #  INTERSECTION\r
+    0x00f0: 0x2261,     #  IDENTICAL TO\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x2265,     #  GREATER-THAN OR EQUAL TO\r
+    0x00f3: 0x2264,     #  LESS-THAN OR EQUAL TO\r
+    0x00f4: 0x2320,     #  TOP HALF INTEGRAL\r
+    0x00f5: 0x2321,     #  BOTTOM HALF INTEGRAL\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x2248,     #  ALMOST EQUAL TO\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x2219,     #  BULLET OPERATOR\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x221a,     #  SQUARE ROOT\r
+    0x00fc: 0x207f,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\xc7'     #  0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xfc'     #  0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xe9'     #  0x0082 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe2'     #  0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe0'     #  0x0085 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe5'     #  0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x0087 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xea'     #  0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x008a -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xd0'     #  0x008b -> LATIN CAPITAL LETTER ETH\r
+    u'\xf0'     #  0x008c -> LATIN SMALL LETTER ETH\r
+    u'\xde'     #  0x008d -> LATIN CAPITAL LETTER THORN\r
+    u'\xc4'     #  0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc9'     #  0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xe6'     #  0x0091 -> LATIN SMALL LIGATURE AE\r
+    u'\xc6'     #  0x0092 -> LATIN CAPITAL LIGATURE AE\r
+    u'\xf4'     #  0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xfe'     #  0x0095 -> LATIN SMALL LETTER THORN\r
+    u'\xfb'     #  0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xdd'     #  0x0097 -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xfd'     #  0x0098 -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xd6'     #  0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xf8'     #  0x009b -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\xd8'     #  0x009d -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\u20a7'   #  0x009e -> PESETA SIGN\r
+    u'\u0192'   #  0x009f -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\xe1'     #  0x00a0 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xed'     #  0x00a1 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xfa'     #  0x00a3 -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xc1'     #  0x00a4 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xcd'     #  0x00a5 -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xd3'     #  0x00a6 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xda'     #  0x00a7 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xbf'     #  0x00a8 -> INVERTED QUESTION MARK\r
+    u'\u2310'   #  0x00a9 -> REVERSED NOT SIGN\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0x00ac -> VULGAR FRACTION ONE QUARTER\r
+    u'\xa1'     #  0x00ad -> INVERTED EXCLAMATION MARK\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u2561'   #  0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u2562'   #  0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    u'\u2556'   #  0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    u'\u2555'   #  0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255c'   #  0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    u'\u255b'   #  0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u255e'   #  0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u2567'   #  0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2564'   #  0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2565'   #  0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2559'   #  0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u2558'   #  0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2552'   #  0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u2553'   #  0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    u'\u256b'   #  0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u256a'   #  0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u258c'   #  0x00dd -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x00de -> RIGHT HALF BLOCK\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\u03b1'   #  0x00e0 -> GREEK SMALL LETTER ALPHA\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S\r
+    u'\u0393'   #  0x00e2 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u03c0'   #  0x00e3 -> GREEK SMALL LETTER PI\r
+    u'\u03a3'   #  0x00e4 -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03c3'   #  0x00e5 -> GREEK SMALL LETTER SIGMA\r
+    u'\xb5'     #  0x00e6 -> MICRO SIGN\r
+    u'\u03c4'   #  0x00e7 -> GREEK SMALL LETTER TAU\r
+    u'\u03a6'   #  0x00e8 -> GREEK CAPITAL LETTER PHI\r
+    u'\u0398'   #  0x00e9 -> GREEK CAPITAL LETTER THETA\r
+    u'\u03a9'   #  0x00ea -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03b4'   #  0x00eb -> GREEK SMALL LETTER DELTA\r
+    u'\u221e'   #  0x00ec -> INFINITY\r
+    u'\u03c6'   #  0x00ed -> GREEK SMALL LETTER PHI\r
+    u'\u03b5'   #  0x00ee -> GREEK SMALL LETTER EPSILON\r
+    u'\u2229'   #  0x00ef -> INTERSECTION\r
+    u'\u2261'   #  0x00f0 -> IDENTICAL TO\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u2265'   #  0x00f2 -> GREATER-THAN OR EQUAL TO\r
+    u'\u2264'   #  0x00f3 -> LESS-THAN OR EQUAL TO\r
+    u'\u2320'   #  0x00f4 -> TOP HALF INTEGRAL\r
+    u'\u2321'   #  0x00f5 -> BOTTOM HALF INTEGRAL\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\u2248'   #  0x00f7 -> ALMOST EQUAL TO\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\u2219'   #  0x00f9 -> BULLET OPERATOR\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\u221a'   #  0x00fb -> SQUARE ROOT\r
+    u'\u207f'   #  0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a1: 0x00ad,     #  INVERTED EXCLAMATION MARK\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b5: 0x00e6,     #  MICRO SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00bc: 0x00ac,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x00bf: 0x00a8,     #  INVERTED QUESTION MARK\r
+    0x00c1: 0x00a4,     #  LATIN CAPITAL LETTER A WITH ACUTE\r
+    0x00c4: 0x008e,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x00c5: 0x008f,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x00c6: 0x0092,     #  LATIN CAPITAL LIGATURE AE\r
+    0x00c7: 0x0080,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x00c9: 0x0090,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00cd: 0x00a5,     #  LATIN CAPITAL LETTER I WITH ACUTE\r
+    0x00d0: 0x008b,     #  LATIN CAPITAL LETTER ETH\r
+    0x00d3: 0x00a6,     #  LATIN CAPITAL LETTER O WITH ACUTE\r
+    0x00d6: 0x0099,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x00d8: 0x009d,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x00da: 0x00a7,     #  LATIN CAPITAL LETTER U WITH ACUTE\r
+    0x00dc: 0x009a,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00dd: 0x0097,     #  LATIN CAPITAL LETTER Y WITH ACUTE\r
+    0x00de: 0x008d,     #  LATIN CAPITAL LETTER THORN\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e0: 0x0085,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x00e1: 0x00a0,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00e2: 0x0083,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x00e4: 0x0084,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x00e5: 0x0086,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x00e6: 0x0091,     #  LATIN SMALL LIGATURE AE\r
+    0x00e7: 0x0087,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x00e8: 0x008a,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x00e9: 0x0082,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00ea: 0x0088,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x00eb: 0x0089,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x00ed: 0x00a1,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00f0: 0x008c,     #  LATIN SMALL LETTER ETH\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f4: 0x0093,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x00f6: 0x0094,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00f8: 0x009b,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x00fa: 0x00a3,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00fb: 0x0096,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x00fc: 0x0081,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x00fd: 0x0098,     #  LATIN SMALL LETTER Y WITH ACUTE\r
+    0x00fe: 0x0095,     #  LATIN SMALL LETTER THORN\r
+    0x0192: 0x009f,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x0393: 0x00e2,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x0398: 0x00e9,     #  GREEK CAPITAL LETTER THETA\r
+    0x03a3: 0x00e4,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x03a6: 0x00e8,     #  GREEK CAPITAL LETTER PHI\r
+    0x03a9: 0x00ea,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x03b1: 0x00e0,     #  GREEK SMALL LETTER ALPHA\r
+    0x03b4: 0x00eb,     #  GREEK SMALL LETTER DELTA\r
+    0x03b5: 0x00ee,     #  GREEK SMALL LETTER EPSILON\r
+    0x03c0: 0x00e3,     #  GREEK SMALL LETTER PI\r
+    0x03c3: 0x00e5,     #  GREEK SMALL LETTER SIGMA\r
+    0x03c4: 0x00e7,     #  GREEK SMALL LETTER TAU\r
+    0x03c6: 0x00ed,     #  GREEK SMALL LETTER PHI\r
+    0x207f: 0x00fc,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x20a7: 0x009e,     #  PESETA SIGN\r
+    0x2219: 0x00f9,     #  BULLET OPERATOR\r
+    0x221a: 0x00fb,     #  SQUARE ROOT\r
+    0x221e: 0x00ec,     #  INFINITY\r
+    0x2229: 0x00ef,     #  INTERSECTION\r
+    0x2248: 0x00f7,     #  ALMOST EQUAL TO\r
+    0x2261: 0x00f0,     #  IDENTICAL TO\r
+    0x2264: 0x00f3,     #  LESS-THAN OR EQUAL TO\r
+    0x2265: 0x00f2,     #  GREATER-THAN OR EQUAL TO\r
+    0x2310: 0x00a9,     #  REVERSED NOT SIGN\r
+    0x2320: 0x00f4,     #  TOP HALF INTEGRAL\r
+    0x2321: 0x00f5,     #  BOTTOM HALF INTEGRAL\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2552: 0x00d5,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x2553: 0x00d6,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2555: 0x00b8,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x2556: 0x00b7,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x2558: 0x00d4,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x2559: 0x00d3,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255b: 0x00be,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x255c: 0x00bd,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x255e: 0x00c6,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x255f: 0x00c7,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2561: 0x00b5,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x2562: 0x00b6,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2564: 0x00d1,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x2565: 0x00d2,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2567: 0x00cf,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x2568: 0x00d0,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256a: 0x00d8,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x256b: 0x00d7,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x258c: 0x00dd,     #  LEFT HALF BLOCK\r
+    0x2590: 0x00de,     #  RIGHT HALF BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp862.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp862.py
new file mode 100644 (file)
index 0000000..ac81345
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP862.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp862',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x05d0,     #  HEBREW LETTER ALEF\r
+    0x0081: 0x05d1,     #  HEBREW LETTER BET\r
+    0x0082: 0x05d2,     #  HEBREW LETTER GIMEL\r
+    0x0083: 0x05d3,     #  HEBREW LETTER DALET\r
+    0x0084: 0x05d4,     #  HEBREW LETTER HE\r
+    0x0085: 0x05d5,     #  HEBREW LETTER VAV\r
+    0x0086: 0x05d6,     #  HEBREW LETTER ZAYIN\r
+    0x0087: 0x05d7,     #  HEBREW LETTER HET\r
+    0x0088: 0x05d8,     #  HEBREW LETTER TET\r
+    0x0089: 0x05d9,     #  HEBREW LETTER YOD\r
+    0x008a: 0x05da,     #  HEBREW LETTER FINAL KAF\r
+    0x008b: 0x05db,     #  HEBREW LETTER KAF\r
+    0x008c: 0x05dc,     #  HEBREW LETTER LAMED\r
+    0x008d: 0x05dd,     #  HEBREW LETTER FINAL MEM\r
+    0x008e: 0x05de,     #  HEBREW LETTER MEM\r
+    0x008f: 0x05df,     #  HEBREW LETTER FINAL NUN\r
+    0x0090: 0x05e0,     #  HEBREW LETTER NUN\r
+    0x0091: 0x05e1,     #  HEBREW LETTER SAMEKH\r
+    0x0092: 0x05e2,     #  HEBREW LETTER AYIN\r
+    0x0093: 0x05e3,     #  HEBREW LETTER FINAL PE\r
+    0x0094: 0x05e4,     #  HEBREW LETTER PE\r
+    0x0095: 0x05e5,     #  HEBREW LETTER FINAL TSADI\r
+    0x0096: 0x05e6,     #  HEBREW LETTER TSADI\r
+    0x0097: 0x05e7,     #  HEBREW LETTER QOF\r
+    0x0098: 0x05e8,     #  HEBREW LETTER RESH\r
+    0x0099: 0x05e9,     #  HEBREW LETTER SHIN\r
+    0x009a: 0x05ea,     #  HEBREW LETTER TAV\r
+    0x009b: 0x00a2,     #  CENT SIGN\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x00a5,     #  YEN SIGN\r
+    0x009e: 0x20a7,     #  PESETA SIGN\r
+    0x009f: 0x0192,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x00a0: 0x00e1,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00a1: 0x00ed,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00a4: 0x00f1,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00a5: 0x00d1,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00a6: 0x00aa,     #  FEMININE ORDINAL INDICATOR\r
+    0x00a7: 0x00ba,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00a8: 0x00bf,     #  INVERTED QUESTION MARK\r
+    0x00a9: 0x2310,     #  REVERSED NOT SIGN\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x00bc,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00ad: 0x00a1,     #  INVERTED EXCLAMATION MARK\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x2561,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x00b6: 0x2562,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x00b7: 0x2556,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x00b8: 0x2555,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x255c,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x00be: 0x255b,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x255e,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x00c7: 0x255f,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x2567,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d0: 0x2568,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d1: 0x2564,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d2: 0x2565,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d3: 0x2559,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x00d4: 0x2558,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x00d5: 0x2552,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x00d6: 0x2553,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x00d7: 0x256b,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d8: 0x256a,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x258c,     #  LEFT HALF BLOCK\r
+    0x00de: 0x2590,     #  RIGHT HALF BLOCK\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x03b1,     #  GREEK SMALL LETTER ALPHA\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S (GERMAN)\r
+    0x00e2: 0x0393,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x00e3: 0x03c0,     #  GREEK SMALL LETTER PI\r
+    0x00e4: 0x03a3,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x00e5: 0x03c3,     #  GREEK SMALL LETTER SIGMA\r
+    0x00e6: 0x00b5,     #  MICRO SIGN\r
+    0x00e7: 0x03c4,     #  GREEK SMALL LETTER TAU\r
+    0x00e8: 0x03a6,     #  GREEK CAPITAL LETTER PHI\r
+    0x00e9: 0x0398,     #  GREEK CAPITAL LETTER THETA\r
+    0x00ea: 0x03a9,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x00eb: 0x03b4,     #  GREEK SMALL LETTER DELTA\r
+    0x00ec: 0x221e,     #  INFINITY\r
+    0x00ed: 0x03c6,     #  GREEK SMALL LETTER PHI\r
+    0x00ee: 0x03b5,     #  GREEK SMALL LETTER EPSILON\r
+    0x00ef: 0x2229,     #  INTERSECTION\r
+    0x00f0: 0x2261,     #  IDENTICAL TO\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x2265,     #  GREATER-THAN OR EQUAL TO\r
+    0x00f3: 0x2264,     #  LESS-THAN OR EQUAL TO\r
+    0x00f4: 0x2320,     #  TOP HALF INTEGRAL\r
+    0x00f5: 0x2321,     #  BOTTOM HALF INTEGRAL\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x2248,     #  ALMOST EQUAL TO\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x2219,     #  BULLET OPERATOR\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x221a,     #  SQUARE ROOT\r
+    0x00fc: 0x207f,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\u05d0'   #  0x0080 -> HEBREW LETTER ALEF\r
+    u'\u05d1'   #  0x0081 -> HEBREW LETTER BET\r
+    u'\u05d2'   #  0x0082 -> HEBREW LETTER GIMEL\r
+    u'\u05d3'   #  0x0083 -> HEBREW LETTER DALET\r
+    u'\u05d4'   #  0x0084 -> HEBREW LETTER HE\r
+    u'\u05d5'   #  0x0085 -> HEBREW LETTER VAV\r
+    u'\u05d6'   #  0x0086 -> HEBREW LETTER ZAYIN\r
+    u'\u05d7'   #  0x0087 -> HEBREW LETTER HET\r
+    u'\u05d8'   #  0x0088 -> HEBREW LETTER TET\r
+    u'\u05d9'   #  0x0089 -> HEBREW LETTER YOD\r
+    u'\u05da'   #  0x008a -> HEBREW LETTER FINAL KAF\r
+    u'\u05db'   #  0x008b -> HEBREW LETTER KAF\r
+    u'\u05dc'   #  0x008c -> HEBREW LETTER LAMED\r
+    u'\u05dd'   #  0x008d -> HEBREW LETTER FINAL MEM\r
+    u'\u05de'   #  0x008e -> HEBREW LETTER MEM\r
+    u'\u05df'   #  0x008f -> HEBREW LETTER FINAL NUN\r
+    u'\u05e0'   #  0x0090 -> HEBREW LETTER NUN\r
+    u'\u05e1'   #  0x0091 -> HEBREW LETTER SAMEKH\r
+    u'\u05e2'   #  0x0092 -> HEBREW LETTER AYIN\r
+    u'\u05e3'   #  0x0093 -> HEBREW LETTER FINAL PE\r
+    u'\u05e4'   #  0x0094 -> HEBREW LETTER PE\r
+    u'\u05e5'   #  0x0095 -> HEBREW LETTER FINAL TSADI\r
+    u'\u05e6'   #  0x0096 -> HEBREW LETTER TSADI\r
+    u'\u05e7'   #  0x0097 -> HEBREW LETTER QOF\r
+    u'\u05e8'   #  0x0098 -> HEBREW LETTER RESH\r
+    u'\u05e9'   #  0x0099 -> HEBREW LETTER SHIN\r
+    u'\u05ea'   #  0x009a -> HEBREW LETTER TAV\r
+    u'\xa2'     #  0x009b -> CENT SIGN\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\xa5'     #  0x009d -> YEN SIGN\r
+    u'\u20a7'   #  0x009e -> PESETA SIGN\r
+    u'\u0192'   #  0x009f -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\xe1'     #  0x00a0 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xed'     #  0x00a1 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xfa'     #  0x00a3 -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf1'     #  0x00a4 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xd1'     #  0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xaa'     #  0x00a6 -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0x00a7 -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbf'     #  0x00a8 -> INVERTED QUESTION MARK\r
+    u'\u2310'   #  0x00a9 -> REVERSED NOT SIGN\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0x00ac -> VULGAR FRACTION ONE QUARTER\r
+    u'\xa1'     #  0x00ad -> INVERTED EXCLAMATION MARK\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u2561'   #  0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u2562'   #  0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    u'\u2556'   #  0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    u'\u2555'   #  0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255c'   #  0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    u'\u255b'   #  0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u255e'   #  0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u2567'   #  0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2564'   #  0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2565'   #  0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2559'   #  0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u2558'   #  0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2552'   #  0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u2553'   #  0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    u'\u256b'   #  0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u256a'   #  0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u258c'   #  0x00dd -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x00de -> RIGHT HALF BLOCK\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\u03b1'   #  0x00e0 -> GREEK SMALL LETTER ALPHA\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN)\r
+    u'\u0393'   #  0x00e2 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u03c0'   #  0x00e3 -> GREEK SMALL LETTER PI\r
+    u'\u03a3'   #  0x00e4 -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03c3'   #  0x00e5 -> GREEK SMALL LETTER SIGMA\r
+    u'\xb5'     #  0x00e6 -> MICRO SIGN\r
+    u'\u03c4'   #  0x00e7 -> GREEK SMALL LETTER TAU\r
+    u'\u03a6'   #  0x00e8 -> GREEK CAPITAL LETTER PHI\r
+    u'\u0398'   #  0x00e9 -> GREEK CAPITAL LETTER THETA\r
+    u'\u03a9'   #  0x00ea -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03b4'   #  0x00eb -> GREEK SMALL LETTER DELTA\r
+    u'\u221e'   #  0x00ec -> INFINITY\r
+    u'\u03c6'   #  0x00ed -> GREEK SMALL LETTER PHI\r
+    u'\u03b5'   #  0x00ee -> GREEK SMALL LETTER EPSILON\r
+    u'\u2229'   #  0x00ef -> INTERSECTION\r
+    u'\u2261'   #  0x00f0 -> IDENTICAL TO\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u2265'   #  0x00f2 -> GREATER-THAN OR EQUAL TO\r
+    u'\u2264'   #  0x00f3 -> LESS-THAN OR EQUAL TO\r
+    u'\u2320'   #  0x00f4 -> TOP HALF INTEGRAL\r
+    u'\u2321'   #  0x00f5 -> BOTTOM HALF INTEGRAL\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\u2248'   #  0x00f7 -> ALMOST EQUAL TO\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\u2219'   #  0x00f9 -> BULLET OPERATOR\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\u221a'   #  0x00fb -> SQUARE ROOT\r
+    u'\u207f'   #  0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a1: 0x00ad,     #  INVERTED EXCLAMATION MARK\r
+    0x00a2: 0x009b,     #  CENT SIGN\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00a5: 0x009d,     #  YEN SIGN\r
+    0x00aa: 0x00a6,     #  FEMININE ORDINAL INDICATOR\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b5: 0x00e6,     #  MICRO SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00ba: 0x00a7,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00bc: 0x00ac,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x00bf: 0x00a8,     #  INVERTED QUESTION MARK\r
+    0x00d1: 0x00a5,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S (GERMAN)\r
+    0x00e1: 0x00a0,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00ed: 0x00a1,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00f1: 0x00a4,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00fa: 0x00a3,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x0192: 0x009f,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x0393: 0x00e2,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x0398: 0x00e9,     #  GREEK CAPITAL LETTER THETA\r
+    0x03a3: 0x00e4,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x03a6: 0x00e8,     #  GREEK CAPITAL LETTER PHI\r
+    0x03a9: 0x00ea,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x03b1: 0x00e0,     #  GREEK SMALL LETTER ALPHA\r
+    0x03b4: 0x00eb,     #  GREEK SMALL LETTER DELTA\r
+    0x03b5: 0x00ee,     #  GREEK SMALL LETTER EPSILON\r
+    0x03c0: 0x00e3,     #  GREEK SMALL LETTER PI\r
+    0x03c3: 0x00e5,     #  GREEK SMALL LETTER SIGMA\r
+    0x03c4: 0x00e7,     #  GREEK SMALL LETTER TAU\r
+    0x03c6: 0x00ed,     #  GREEK SMALL LETTER PHI\r
+    0x05d0: 0x0080,     #  HEBREW LETTER ALEF\r
+    0x05d1: 0x0081,     #  HEBREW LETTER BET\r
+    0x05d2: 0x0082,     #  HEBREW LETTER GIMEL\r
+    0x05d3: 0x0083,     #  HEBREW LETTER DALET\r
+    0x05d4: 0x0084,     #  HEBREW LETTER HE\r
+    0x05d5: 0x0085,     #  HEBREW LETTER VAV\r
+    0x05d6: 0x0086,     #  HEBREW LETTER ZAYIN\r
+    0x05d7: 0x0087,     #  HEBREW LETTER HET\r
+    0x05d8: 0x0088,     #  HEBREW LETTER TET\r
+    0x05d9: 0x0089,     #  HEBREW LETTER YOD\r
+    0x05da: 0x008a,     #  HEBREW LETTER FINAL KAF\r
+    0x05db: 0x008b,     #  HEBREW LETTER KAF\r
+    0x05dc: 0x008c,     #  HEBREW LETTER LAMED\r
+    0x05dd: 0x008d,     #  HEBREW LETTER FINAL MEM\r
+    0x05de: 0x008e,     #  HEBREW LETTER MEM\r
+    0x05df: 0x008f,     #  HEBREW LETTER FINAL NUN\r
+    0x05e0: 0x0090,     #  HEBREW LETTER NUN\r
+    0x05e1: 0x0091,     #  HEBREW LETTER SAMEKH\r
+    0x05e2: 0x0092,     #  HEBREW LETTER AYIN\r
+    0x05e3: 0x0093,     #  HEBREW LETTER FINAL PE\r
+    0x05e4: 0x0094,     #  HEBREW LETTER PE\r
+    0x05e5: 0x0095,     #  HEBREW LETTER FINAL TSADI\r
+    0x05e6: 0x0096,     #  HEBREW LETTER TSADI\r
+    0x05e7: 0x0097,     #  HEBREW LETTER QOF\r
+    0x05e8: 0x0098,     #  HEBREW LETTER RESH\r
+    0x05e9: 0x0099,     #  HEBREW LETTER SHIN\r
+    0x05ea: 0x009a,     #  HEBREW LETTER TAV\r
+    0x207f: 0x00fc,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x20a7: 0x009e,     #  PESETA SIGN\r
+    0x2219: 0x00f9,     #  BULLET OPERATOR\r
+    0x221a: 0x00fb,     #  SQUARE ROOT\r
+    0x221e: 0x00ec,     #  INFINITY\r
+    0x2229: 0x00ef,     #  INTERSECTION\r
+    0x2248: 0x00f7,     #  ALMOST EQUAL TO\r
+    0x2261: 0x00f0,     #  IDENTICAL TO\r
+    0x2264: 0x00f3,     #  LESS-THAN OR EQUAL TO\r
+    0x2265: 0x00f2,     #  GREATER-THAN OR EQUAL TO\r
+    0x2310: 0x00a9,     #  REVERSED NOT SIGN\r
+    0x2320: 0x00f4,     #  TOP HALF INTEGRAL\r
+    0x2321: 0x00f5,     #  BOTTOM HALF INTEGRAL\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2552: 0x00d5,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x2553: 0x00d6,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2555: 0x00b8,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x2556: 0x00b7,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x2558: 0x00d4,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x2559: 0x00d3,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255b: 0x00be,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x255c: 0x00bd,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x255e: 0x00c6,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x255f: 0x00c7,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2561: 0x00b5,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x2562: 0x00b6,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2564: 0x00d1,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x2565: 0x00d2,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2567: 0x00cf,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x2568: 0x00d0,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256a: 0x00d8,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x256b: 0x00d7,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x258c: 0x00dd,     #  LEFT HALF BLOCK\r
+    0x2590: 0x00de,     #  RIGHT HALF BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp863.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp863.py
new file mode 100644 (file)
index 0000000..fc8dfa5
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP863.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp863',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x00c7,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x0081: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0082: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x0083: 0x00e2,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x0084: 0x00c2,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x0085: 0x00e0,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x0086: 0x00b6,     #  PILCROW SIGN\r
+    0x0087: 0x00e7,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x0088: 0x00ea,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x0089: 0x00eb,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x008a: 0x00e8,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x008b: 0x00ef,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x008c: 0x00ee,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x008d: 0x2017,     #  DOUBLE LOW LINE\r
+    0x008e: 0x00c0,     #  LATIN CAPITAL LETTER A WITH GRAVE\r
+    0x008f: 0x00a7,     #  SECTION SIGN\r
+    0x0090: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0091: 0x00c8,     #  LATIN CAPITAL LETTER E WITH GRAVE\r
+    0x0092: 0x00ca,     #  LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    0x0093: 0x00f4,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x0094: 0x00cb,     #  LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    0x0095: 0x00cf,     #  LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    0x0096: 0x00fb,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x0097: 0x00f9,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x0098: 0x00a4,     #  CURRENCY SIGN\r
+    0x0099: 0x00d4,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x009a: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x009b: 0x00a2,     #  CENT SIGN\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x00d9,     #  LATIN CAPITAL LETTER U WITH GRAVE\r
+    0x009e: 0x00db,     #  LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    0x009f: 0x0192,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x00a0: 0x00a6,     #  BROKEN BAR\r
+    0x00a1: 0x00b4,     #  ACUTE ACCENT\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00a4: 0x00a8,     #  DIAERESIS\r
+    0x00a5: 0x00b8,     #  CEDILLA\r
+    0x00a6: 0x00b3,     #  SUPERSCRIPT THREE\r
+    0x00a7: 0x00af,     #  MACRON\r
+    0x00a8: 0x00ce,     #  LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    0x00a9: 0x2310,     #  REVERSED NOT SIGN\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x00bc,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00ad: 0x00be,     #  VULGAR FRACTION THREE QUARTERS\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x2561,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x00b6: 0x2562,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x00b7: 0x2556,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x00b8: 0x2555,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x255c,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x00be: 0x255b,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x255e,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x00c7: 0x255f,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x2567,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d0: 0x2568,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d1: 0x2564,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d2: 0x2565,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d3: 0x2559,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x00d4: 0x2558,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x00d5: 0x2552,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x00d6: 0x2553,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x00d7: 0x256b,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d8: 0x256a,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x258c,     #  LEFT HALF BLOCK\r
+    0x00de: 0x2590,     #  RIGHT HALF BLOCK\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x03b1,     #  GREEK SMALL LETTER ALPHA\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e2: 0x0393,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x00e3: 0x03c0,     #  GREEK SMALL LETTER PI\r
+    0x00e4: 0x03a3,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x00e5: 0x03c3,     #  GREEK SMALL LETTER SIGMA\r
+    0x00e6: 0x00b5,     #  MICRO SIGN\r
+    0x00e7: 0x03c4,     #  GREEK SMALL LETTER TAU\r
+    0x00e8: 0x03a6,     #  GREEK CAPITAL LETTER PHI\r
+    0x00e9: 0x0398,     #  GREEK CAPITAL LETTER THETA\r
+    0x00ea: 0x03a9,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x00eb: 0x03b4,     #  GREEK SMALL LETTER DELTA\r
+    0x00ec: 0x221e,     #  INFINITY\r
+    0x00ed: 0x03c6,     #  GREEK SMALL LETTER PHI\r
+    0x00ee: 0x03b5,     #  GREEK SMALL LETTER EPSILON\r
+    0x00ef: 0x2229,     #  INTERSECTION\r
+    0x00f0: 0x2261,     #  IDENTICAL TO\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x2265,     #  GREATER-THAN OR EQUAL TO\r
+    0x00f3: 0x2264,     #  LESS-THAN OR EQUAL TO\r
+    0x00f4: 0x2320,     #  TOP HALF INTEGRAL\r
+    0x00f5: 0x2321,     #  BOTTOM HALF INTEGRAL\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x2248,     #  ALMOST EQUAL TO\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x2219,     #  BULLET OPERATOR\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x221a,     #  SQUARE ROOT\r
+    0x00fc: 0x207f,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\xc7'     #  0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xfc'     #  0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xe9'     #  0x0082 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe2'     #  0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xc2'     #  0x0084 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xe0'     #  0x0085 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xb6'     #  0x0086 -> PILCROW SIGN\r
+    u'\xe7'     #  0x0087 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xea'     #  0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x008a -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xef'     #  0x008b -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xee'     #  0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\u2017'   #  0x008d -> DOUBLE LOW LINE\r
+    u'\xc0'     #  0x008e -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xa7'     #  0x008f -> SECTION SIGN\r
+    u'\xc9'     #  0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xc8'     #  0x0091 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xca'     #  0x0092 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xf4'     #  0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xcb'     #  0x0094 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xcf'     #  0x0095 -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xfb'     #  0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xf9'     #  0x0097 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xa4'     #  0x0098 -> CURRENCY SIGN\r
+    u'\xd4'     #  0x0099 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xdc'     #  0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xa2'     #  0x009b -> CENT SIGN\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\xd9'     #  0x009d -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xdb'     #  0x009e -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\u0192'   #  0x009f -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\xa6'     #  0x00a0 -> BROKEN BAR\r
+    u'\xb4'     #  0x00a1 -> ACUTE ACCENT\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xfa'     #  0x00a3 -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xa8'     #  0x00a4 -> DIAERESIS\r
+    u'\xb8'     #  0x00a5 -> CEDILLA\r
+    u'\xb3'     #  0x00a6 -> SUPERSCRIPT THREE\r
+    u'\xaf'     #  0x00a7 -> MACRON\r
+    u'\xce'     #  0x00a8 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\u2310'   #  0x00a9 -> REVERSED NOT SIGN\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0x00ac -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbe'     #  0x00ad -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u2561'   #  0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u2562'   #  0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    u'\u2556'   #  0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    u'\u2555'   #  0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255c'   #  0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    u'\u255b'   #  0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u255e'   #  0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u2567'   #  0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2564'   #  0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2565'   #  0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2559'   #  0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u2558'   #  0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2552'   #  0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u2553'   #  0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    u'\u256b'   #  0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u256a'   #  0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u258c'   #  0x00dd -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x00de -> RIGHT HALF BLOCK\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\u03b1'   #  0x00e0 -> GREEK SMALL LETTER ALPHA\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S\r
+    u'\u0393'   #  0x00e2 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u03c0'   #  0x00e3 -> GREEK SMALL LETTER PI\r
+    u'\u03a3'   #  0x00e4 -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03c3'   #  0x00e5 -> GREEK SMALL LETTER SIGMA\r
+    u'\xb5'     #  0x00e6 -> MICRO SIGN\r
+    u'\u03c4'   #  0x00e7 -> GREEK SMALL LETTER TAU\r
+    u'\u03a6'   #  0x00e8 -> GREEK CAPITAL LETTER PHI\r
+    u'\u0398'   #  0x00e9 -> GREEK CAPITAL LETTER THETA\r
+    u'\u03a9'   #  0x00ea -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03b4'   #  0x00eb -> GREEK SMALL LETTER DELTA\r
+    u'\u221e'   #  0x00ec -> INFINITY\r
+    u'\u03c6'   #  0x00ed -> GREEK SMALL LETTER PHI\r
+    u'\u03b5'   #  0x00ee -> GREEK SMALL LETTER EPSILON\r
+    u'\u2229'   #  0x00ef -> INTERSECTION\r
+    u'\u2261'   #  0x00f0 -> IDENTICAL TO\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u2265'   #  0x00f2 -> GREATER-THAN OR EQUAL TO\r
+    u'\u2264'   #  0x00f3 -> LESS-THAN OR EQUAL TO\r
+    u'\u2320'   #  0x00f4 -> TOP HALF INTEGRAL\r
+    u'\u2321'   #  0x00f5 -> BOTTOM HALF INTEGRAL\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\u2248'   #  0x00f7 -> ALMOST EQUAL TO\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\u2219'   #  0x00f9 -> BULLET OPERATOR\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\u221a'   #  0x00fb -> SQUARE ROOT\r
+    u'\u207f'   #  0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a2: 0x009b,     #  CENT SIGN\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00a4: 0x0098,     #  CURRENCY SIGN\r
+    0x00a6: 0x00a0,     #  BROKEN BAR\r
+    0x00a7: 0x008f,     #  SECTION SIGN\r
+    0x00a8: 0x00a4,     #  DIAERESIS\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00af: 0x00a7,     #  MACRON\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b3: 0x00a6,     #  SUPERSCRIPT THREE\r
+    0x00b4: 0x00a1,     #  ACUTE ACCENT\r
+    0x00b5: 0x00e6,     #  MICRO SIGN\r
+    0x00b6: 0x0086,     #  PILCROW SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00b8: 0x00a5,     #  CEDILLA\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00bc: 0x00ac,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x00be: 0x00ad,     #  VULGAR FRACTION THREE QUARTERS\r
+    0x00c0: 0x008e,     #  LATIN CAPITAL LETTER A WITH GRAVE\r
+    0x00c2: 0x0084,     #  LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    0x00c7: 0x0080,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x00c8: 0x0091,     #  LATIN CAPITAL LETTER E WITH GRAVE\r
+    0x00c9: 0x0090,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00ca: 0x0092,     #  LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    0x00cb: 0x0094,     #  LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    0x00ce: 0x00a8,     #  LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    0x00cf: 0x0095,     #  LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    0x00d4: 0x0099,     #  LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    0x00d9: 0x009d,     #  LATIN CAPITAL LETTER U WITH GRAVE\r
+    0x00db: 0x009e,     #  LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    0x00dc: 0x009a,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e0: 0x0085,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x00e2: 0x0083,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x00e7: 0x0087,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x00e8: 0x008a,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x00e9: 0x0082,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00ea: 0x0088,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x00eb: 0x0089,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x00ee: 0x008c,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x00ef: 0x008b,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f4: 0x0093,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00f9: 0x0097,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x00fa: 0x00a3,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00fb: 0x0096,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x00fc: 0x0081,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0192: 0x009f,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x0393: 0x00e2,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x0398: 0x00e9,     #  GREEK CAPITAL LETTER THETA\r
+    0x03a3: 0x00e4,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x03a6: 0x00e8,     #  GREEK CAPITAL LETTER PHI\r
+    0x03a9: 0x00ea,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x03b1: 0x00e0,     #  GREEK SMALL LETTER ALPHA\r
+    0x03b4: 0x00eb,     #  GREEK SMALL LETTER DELTA\r
+    0x03b5: 0x00ee,     #  GREEK SMALL LETTER EPSILON\r
+    0x03c0: 0x00e3,     #  GREEK SMALL LETTER PI\r
+    0x03c3: 0x00e5,     #  GREEK SMALL LETTER SIGMA\r
+    0x03c4: 0x00e7,     #  GREEK SMALL LETTER TAU\r
+    0x03c6: 0x00ed,     #  GREEK SMALL LETTER PHI\r
+    0x2017: 0x008d,     #  DOUBLE LOW LINE\r
+    0x207f: 0x00fc,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x2219: 0x00f9,     #  BULLET OPERATOR\r
+    0x221a: 0x00fb,     #  SQUARE ROOT\r
+    0x221e: 0x00ec,     #  INFINITY\r
+    0x2229: 0x00ef,     #  INTERSECTION\r
+    0x2248: 0x00f7,     #  ALMOST EQUAL TO\r
+    0x2261: 0x00f0,     #  IDENTICAL TO\r
+    0x2264: 0x00f3,     #  LESS-THAN OR EQUAL TO\r
+    0x2265: 0x00f2,     #  GREATER-THAN OR EQUAL TO\r
+    0x2310: 0x00a9,     #  REVERSED NOT SIGN\r
+    0x2320: 0x00f4,     #  TOP HALF INTEGRAL\r
+    0x2321: 0x00f5,     #  BOTTOM HALF INTEGRAL\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2552: 0x00d5,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x2553: 0x00d6,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2555: 0x00b8,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x2556: 0x00b7,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x2558: 0x00d4,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x2559: 0x00d3,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255b: 0x00be,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x255c: 0x00bd,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x255e: 0x00c6,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x255f: 0x00c7,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2561: 0x00b5,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x2562: 0x00b6,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2564: 0x00d1,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x2565: 0x00d2,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2567: 0x00cf,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x2568: 0x00d0,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256a: 0x00d8,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x256b: 0x00d7,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x258c: 0x00dd,     #  LEFT HALF BLOCK\r
+    0x2590: 0x00de,     #  RIGHT HALF BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp864.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp864.py
new file mode 100644 (file)
index 0000000..9733ada
--- /dev/null
@@ -0,0 +1,690 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP864.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp864',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0025: 0x066a,     #  ARABIC PERCENT SIGN\r
+    0x0080: 0x00b0,     #  DEGREE SIGN\r
+    0x0081: 0x00b7,     #  MIDDLE DOT\r
+    0x0082: 0x2219,     #  BULLET OPERATOR\r
+    0x0083: 0x221a,     #  SQUARE ROOT\r
+    0x0084: 0x2592,     #  MEDIUM SHADE\r
+    0x0085: 0x2500,     #  FORMS LIGHT HORIZONTAL\r
+    0x0086: 0x2502,     #  FORMS LIGHT VERTICAL\r
+    0x0087: 0x253c,     #  FORMS LIGHT VERTICAL AND HORIZONTAL\r
+    0x0088: 0x2524,     #  FORMS LIGHT VERTICAL AND LEFT\r
+    0x0089: 0x252c,     #  FORMS LIGHT DOWN AND HORIZONTAL\r
+    0x008a: 0x251c,     #  FORMS LIGHT VERTICAL AND RIGHT\r
+    0x008b: 0x2534,     #  FORMS LIGHT UP AND HORIZONTAL\r
+    0x008c: 0x2510,     #  FORMS LIGHT DOWN AND LEFT\r
+    0x008d: 0x250c,     #  FORMS LIGHT DOWN AND RIGHT\r
+    0x008e: 0x2514,     #  FORMS LIGHT UP AND RIGHT\r
+    0x008f: 0x2518,     #  FORMS LIGHT UP AND LEFT\r
+    0x0090: 0x03b2,     #  GREEK SMALL BETA\r
+    0x0091: 0x221e,     #  INFINITY\r
+    0x0092: 0x03c6,     #  GREEK SMALL PHI\r
+    0x0093: 0x00b1,     #  PLUS-OR-MINUS SIGN\r
+    0x0094: 0x00bd,     #  FRACTION 1/2\r
+    0x0095: 0x00bc,     #  FRACTION 1/4\r
+    0x0096: 0x2248,     #  ALMOST EQUAL TO\r
+    0x0097: 0x00ab,     #  LEFT POINTING GUILLEMET\r
+    0x0098: 0x00bb,     #  RIGHT POINTING GUILLEMET\r
+    0x0099: 0xfef7,     #  ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM\r
+    0x009a: 0xfef8,     #  ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM\r
+    0x009b: None,       #  UNDEFINED\r
+    0x009c: None,       #  UNDEFINED\r
+    0x009d: 0xfefb,     #  ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM\r
+    0x009e: 0xfefc,     #  ARABIC LIGATURE LAM WITH ALEF FINAL FORM\r
+    0x009f: None,       #  UNDEFINED\r
+    0x00a1: 0x00ad,     #  SOFT HYPHEN\r
+    0x00a2: 0xfe82,     #  ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM\r
+    0x00a5: 0xfe84,     #  ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM\r
+    0x00a6: None,       #  UNDEFINED\r
+    0x00a7: None,       #  UNDEFINED\r
+    0x00a8: 0xfe8e,     #  ARABIC LETTER ALEF FINAL FORM\r
+    0x00a9: 0xfe8f,     #  ARABIC LETTER BEH ISOLATED FORM\r
+    0x00aa: 0xfe95,     #  ARABIC LETTER TEH ISOLATED FORM\r
+    0x00ab: 0xfe99,     #  ARABIC LETTER THEH ISOLATED FORM\r
+    0x00ac: 0x060c,     #  ARABIC COMMA\r
+    0x00ad: 0xfe9d,     #  ARABIC LETTER JEEM ISOLATED FORM\r
+    0x00ae: 0xfea1,     #  ARABIC LETTER HAH ISOLATED FORM\r
+    0x00af: 0xfea5,     #  ARABIC LETTER KHAH ISOLATED FORM\r
+    0x00b0: 0x0660,     #  ARABIC-INDIC DIGIT ZERO\r
+    0x00b1: 0x0661,     #  ARABIC-INDIC DIGIT ONE\r
+    0x00b2: 0x0662,     #  ARABIC-INDIC DIGIT TWO\r
+    0x00b3: 0x0663,     #  ARABIC-INDIC DIGIT THREE\r
+    0x00b4: 0x0664,     #  ARABIC-INDIC DIGIT FOUR\r
+    0x00b5: 0x0665,     #  ARABIC-INDIC DIGIT FIVE\r
+    0x00b6: 0x0666,     #  ARABIC-INDIC DIGIT SIX\r
+    0x00b7: 0x0667,     #  ARABIC-INDIC DIGIT SEVEN\r
+    0x00b8: 0x0668,     #  ARABIC-INDIC DIGIT EIGHT\r
+    0x00b9: 0x0669,     #  ARABIC-INDIC DIGIT NINE\r
+    0x00ba: 0xfed1,     #  ARABIC LETTER FEH ISOLATED FORM\r
+    0x00bb: 0x061b,     #  ARABIC SEMICOLON\r
+    0x00bc: 0xfeb1,     #  ARABIC LETTER SEEN ISOLATED FORM\r
+    0x00bd: 0xfeb5,     #  ARABIC LETTER SHEEN ISOLATED FORM\r
+    0x00be: 0xfeb9,     #  ARABIC LETTER SAD ISOLATED FORM\r
+    0x00bf: 0x061f,     #  ARABIC QUESTION MARK\r
+    0x00c0: 0x00a2,     #  CENT SIGN\r
+    0x00c1: 0xfe80,     #  ARABIC LETTER HAMZA ISOLATED FORM\r
+    0x00c2: 0xfe81,     #  ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM\r
+    0x00c3: 0xfe83,     #  ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM\r
+    0x00c4: 0xfe85,     #  ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM\r
+    0x00c5: 0xfeca,     #  ARABIC LETTER AIN FINAL FORM\r
+    0x00c6: 0xfe8b,     #  ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM\r
+    0x00c7: 0xfe8d,     #  ARABIC LETTER ALEF ISOLATED FORM\r
+    0x00c8: 0xfe91,     #  ARABIC LETTER BEH INITIAL FORM\r
+    0x00c9: 0xfe93,     #  ARABIC LETTER TEH MARBUTA ISOLATED FORM\r
+    0x00ca: 0xfe97,     #  ARABIC LETTER TEH INITIAL FORM\r
+    0x00cb: 0xfe9b,     #  ARABIC LETTER THEH INITIAL FORM\r
+    0x00cc: 0xfe9f,     #  ARABIC LETTER JEEM INITIAL FORM\r
+    0x00cd: 0xfea3,     #  ARABIC LETTER HAH INITIAL FORM\r
+    0x00ce: 0xfea7,     #  ARABIC LETTER KHAH INITIAL FORM\r
+    0x00cf: 0xfea9,     #  ARABIC LETTER DAL ISOLATED FORM\r
+    0x00d0: 0xfeab,     #  ARABIC LETTER THAL ISOLATED FORM\r
+    0x00d1: 0xfead,     #  ARABIC LETTER REH ISOLATED FORM\r
+    0x00d2: 0xfeaf,     #  ARABIC LETTER ZAIN ISOLATED FORM\r
+    0x00d3: 0xfeb3,     #  ARABIC LETTER SEEN INITIAL FORM\r
+    0x00d4: 0xfeb7,     #  ARABIC LETTER SHEEN INITIAL FORM\r
+    0x00d5: 0xfebb,     #  ARABIC LETTER SAD INITIAL FORM\r
+    0x00d6: 0xfebf,     #  ARABIC LETTER DAD INITIAL FORM\r
+    0x00d7: 0xfec1,     #  ARABIC LETTER TAH ISOLATED FORM\r
+    0x00d8: 0xfec5,     #  ARABIC LETTER ZAH ISOLATED FORM\r
+    0x00d9: 0xfecb,     #  ARABIC LETTER AIN INITIAL FORM\r
+    0x00da: 0xfecf,     #  ARABIC LETTER GHAIN INITIAL FORM\r
+    0x00db: 0x00a6,     #  BROKEN VERTICAL BAR\r
+    0x00dc: 0x00ac,     #  NOT SIGN\r
+    0x00dd: 0x00f7,     #  DIVISION SIGN\r
+    0x00de: 0x00d7,     #  MULTIPLICATION SIGN\r
+    0x00df: 0xfec9,     #  ARABIC LETTER AIN ISOLATED FORM\r
+    0x00e0: 0x0640,     #  ARABIC TATWEEL\r
+    0x00e1: 0xfed3,     #  ARABIC LETTER FEH INITIAL FORM\r
+    0x00e2: 0xfed7,     #  ARABIC LETTER QAF INITIAL FORM\r
+    0x00e3: 0xfedb,     #  ARABIC LETTER KAF INITIAL FORM\r
+    0x00e4: 0xfedf,     #  ARABIC LETTER LAM INITIAL FORM\r
+    0x00e5: 0xfee3,     #  ARABIC LETTER MEEM INITIAL FORM\r
+    0x00e6: 0xfee7,     #  ARABIC LETTER NOON INITIAL FORM\r
+    0x00e7: 0xfeeb,     #  ARABIC LETTER HEH INITIAL FORM\r
+    0x00e8: 0xfeed,     #  ARABIC LETTER WAW ISOLATED FORM\r
+    0x00e9: 0xfeef,     #  ARABIC LETTER ALEF MAKSURA ISOLATED FORM\r
+    0x00ea: 0xfef3,     #  ARABIC LETTER YEH INITIAL FORM\r
+    0x00eb: 0xfebd,     #  ARABIC LETTER DAD ISOLATED FORM\r
+    0x00ec: 0xfecc,     #  ARABIC LETTER AIN MEDIAL FORM\r
+    0x00ed: 0xfece,     #  ARABIC LETTER GHAIN FINAL FORM\r
+    0x00ee: 0xfecd,     #  ARABIC LETTER GHAIN ISOLATED FORM\r
+    0x00ef: 0xfee1,     #  ARABIC LETTER MEEM ISOLATED FORM\r
+    0x00f0: 0xfe7d,     #  ARABIC SHADDA MEDIAL FORM\r
+    0x00f1: 0x0651,     #  ARABIC SHADDAH\r
+    0x00f2: 0xfee5,     #  ARABIC LETTER NOON ISOLATED FORM\r
+    0x00f3: 0xfee9,     #  ARABIC LETTER HEH ISOLATED FORM\r
+    0x00f4: 0xfeec,     #  ARABIC LETTER HEH MEDIAL FORM\r
+    0x00f5: 0xfef0,     #  ARABIC LETTER ALEF MAKSURA FINAL FORM\r
+    0x00f6: 0xfef2,     #  ARABIC LETTER YEH FINAL FORM\r
+    0x00f7: 0xfed0,     #  ARABIC LETTER GHAIN MEDIAL FORM\r
+    0x00f8: 0xfed5,     #  ARABIC LETTER QAF ISOLATED FORM\r
+    0x00f9: 0xfef5,     #  ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM\r
+    0x00fa: 0xfef6,     #  ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM\r
+    0x00fb: 0xfedd,     #  ARABIC LETTER LAM ISOLATED FORM\r
+    0x00fc: 0xfed9,     #  ARABIC LETTER KAF ISOLATED FORM\r
+    0x00fd: 0xfef1,     #  ARABIC LETTER YEH ISOLATED FORM\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: None,       #  UNDEFINED\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'\u066a'   #  0x0025 -> ARABIC PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\xb0'     #  0x0080 -> DEGREE SIGN\r
+    u'\xb7'     #  0x0081 -> MIDDLE DOT\r
+    u'\u2219'   #  0x0082 -> BULLET OPERATOR\r
+    u'\u221a'   #  0x0083 -> SQUARE ROOT\r
+    u'\u2592'   #  0x0084 -> MEDIUM SHADE\r
+    u'\u2500'   #  0x0085 -> FORMS LIGHT HORIZONTAL\r
+    u'\u2502'   #  0x0086 -> FORMS LIGHT VERTICAL\r
+    u'\u253c'   #  0x0087 -> FORMS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u2524'   #  0x0088 -> FORMS LIGHT VERTICAL AND LEFT\r
+    u'\u252c'   #  0x0089 -> FORMS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x008a -> FORMS LIGHT VERTICAL AND RIGHT\r
+    u'\u2534'   #  0x008b -> FORMS LIGHT UP AND HORIZONTAL\r
+    u'\u2510'   #  0x008c -> FORMS LIGHT DOWN AND LEFT\r
+    u'\u250c'   #  0x008d -> FORMS LIGHT DOWN AND RIGHT\r
+    u'\u2514'   #  0x008e -> FORMS LIGHT UP AND RIGHT\r
+    u'\u2518'   #  0x008f -> FORMS LIGHT UP AND LEFT\r
+    u'\u03b2'   #  0x0090 -> GREEK SMALL BETA\r
+    u'\u221e'   #  0x0091 -> INFINITY\r
+    u'\u03c6'   #  0x0092 -> GREEK SMALL PHI\r
+    u'\xb1'     #  0x0093 -> PLUS-OR-MINUS SIGN\r
+    u'\xbd'     #  0x0094 -> FRACTION 1/2\r
+    u'\xbc'     #  0x0095 -> FRACTION 1/4\r
+    u'\u2248'   #  0x0096 -> ALMOST EQUAL TO\r
+    u'\xab'     #  0x0097 -> LEFT POINTING GUILLEMET\r
+    u'\xbb'     #  0x0098 -> RIGHT POINTING GUILLEMET\r
+    u'\ufef7'   #  0x0099 -> ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM\r
+    u'\ufef8'   #  0x009a -> ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM\r
+    u'\ufffe'   #  0x009b -> UNDEFINED\r
+    u'\ufffe'   #  0x009c -> UNDEFINED\r
+    u'\ufefb'   #  0x009d -> ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM\r
+    u'\ufefc'   #  0x009e -> ARABIC LIGATURE LAM WITH ALEF FINAL FORM\r
+    u'\ufffe'   #  0x009f -> UNDEFINED\r
+    u'\xa0'     #  0x00a0 -> NON-BREAKING SPACE\r
+    u'\xad'     #  0x00a1 -> SOFT HYPHEN\r
+    u'\ufe82'   #  0x00a2 -> ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM\r
+    u'\xa3'     #  0x00a3 -> POUND SIGN\r
+    u'\xa4'     #  0x00a4 -> CURRENCY SIGN\r
+    u'\ufe84'   #  0x00a5 -> ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM\r
+    u'\ufffe'   #  0x00a6 -> UNDEFINED\r
+    u'\ufffe'   #  0x00a7 -> UNDEFINED\r
+    u'\ufe8e'   #  0x00a8 -> ARABIC LETTER ALEF FINAL FORM\r
+    u'\ufe8f'   #  0x00a9 -> ARABIC LETTER BEH ISOLATED FORM\r
+    u'\ufe95'   #  0x00aa -> ARABIC LETTER TEH ISOLATED FORM\r
+    u'\ufe99'   #  0x00ab -> ARABIC LETTER THEH ISOLATED FORM\r
+    u'\u060c'   #  0x00ac -> ARABIC COMMA\r
+    u'\ufe9d'   #  0x00ad -> ARABIC LETTER JEEM ISOLATED FORM\r
+    u'\ufea1'   #  0x00ae -> ARABIC LETTER HAH ISOLATED FORM\r
+    u'\ufea5'   #  0x00af -> ARABIC LETTER KHAH ISOLATED FORM\r
+    u'\u0660'   #  0x00b0 -> ARABIC-INDIC DIGIT ZERO\r
+    u'\u0661'   #  0x00b1 -> ARABIC-INDIC DIGIT ONE\r
+    u'\u0662'   #  0x00b2 -> ARABIC-INDIC DIGIT TWO\r
+    u'\u0663'   #  0x00b3 -> ARABIC-INDIC DIGIT THREE\r
+    u'\u0664'   #  0x00b4 -> ARABIC-INDIC DIGIT FOUR\r
+    u'\u0665'   #  0x00b5 -> ARABIC-INDIC DIGIT FIVE\r
+    u'\u0666'   #  0x00b6 -> ARABIC-INDIC DIGIT SIX\r
+    u'\u0667'   #  0x00b7 -> ARABIC-INDIC DIGIT SEVEN\r
+    u'\u0668'   #  0x00b8 -> ARABIC-INDIC DIGIT EIGHT\r
+    u'\u0669'   #  0x00b9 -> ARABIC-INDIC DIGIT NINE\r
+    u'\ufed1'   #  0x00ba -> ARABIC LETTER FEH ISOLATED FORM\r
+    u'\u061b'   #  0x00bb -> ARABIC SEMICOLON\r
+    u'\ufeb1'   #  0x00bc -> ARABIC LETTER SEEN ISOLATED FORM\r
+    u'\ufeb5'   #  0x00bd -> ARABIC LETTER SHEEN ISOLATED FORM\r
+    u'\ufeb9'   #  0x00be -> ARABIC LETTER SAD ISOLATED FORM\r
+    u'\u061f'   #  0x00bf -> ARABIC QUESTION MARK\r
+    u'\xa2'     #  0x00c0 -> CENT SIGN\r
+    u'\ufe80'   #  0x00c1 -> ARABIC LETTER HAMZA ISOLATED FORM\r
+    u'\ufe81'   #  0x00c2 -> ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM\r
+    u'\ufe83'   #  0x00c3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM\r
+    u'\ufe85'   #  0x00c4 -> ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM\r
+    u'\ufeca'   #  0x00c5 -> ARABIC LETTER AIN FINAL FORM\r
+    u'\ufe8b'   #  0x00c6 -> ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM\r
+    u'\ufe8d'   #  0x00c7 -> ARABIC LETTER ALEF ISOLATED FORM\r
+    u'\ufe91'   #  0x00c8 -> ARABIC LETTER BEH INITIAL FORM\r
+    u'\ufe93'   #  0x00c9 -> ARABIC LETTER TEH MARBUTA ISOLATED FORM\r
+    u'\ufe97'   #  0x00ca -> ARABIC LETTER TEH INITIAL FORM\r
+    u'\ufe9b'   #  0x00cb -> ARABIC LETTER THEH INITIAL FORM\r
+    u'\ufe9f'   #  0x00cc -> ARABIC LETTER JEEM INITIAL FORM\r
+    u'\ufea3'   #  0x00cd -> ARABIC LETTER HAH INITIAL FORM\r
+    u'\ufea7'   #  0x00ce -> ARABIC LETTER KHAH INITIAL FORM\r
+    u'\ufea9'   #  0x00cf -> ARABIC LETTER DAL ISOLATED FORM\r
+    u'\ufeab'   #  0x00d0 -> ARABIC LETTER THAL ISOLATED FORM\r
+    u'\ufead'   #  0x00d1 -> ARABIC LETTER REH ISOLATED FORM\r
+    u'\ufeaf'   #  0x00d2 -> ARABIC LETTER ZAIN ISOLATED FORM\r
+    u'\ufeb3'   #  0x00d3 -> ARABIC LETTER SEEN INITIAL FORM\r
+    u'\ufeb7'   #  0x00d4 -> ARABIC LETTER SHEEN INITIAL FORM\r
+    u'\ufebb'   #  0x00d5 -> ARABIC LETTER SAD INITIAL FORM\r
+    u'\ufebf'   #  0x00d6 -> ARABIC LETTER DAD INITIAL FORM\r
+    u'\ufec1'   #  0x00d7 -> ARABIC LETTER TAH ISOLATED FORM\r
+    u'\ufec5'   #  0x00d8 -> ARABIC LETTER ZAH ISOLATED FORM\r
+    u'\ufecb'   #  0x00d9 -> ARABIC LETTER AIN INITIAL FORM\r
+    u'\ufecf'   #  0x00da -> ARABIC LETTER GHAIN INITIAL FORM\r
+    u'\xa6'     #  0x00db -> BROKEN VERTICAL BAR\r
+    u'\xac'     #  0x00dc -> NOT SIGN\r
+    u'\xf7'     #  0x00dd -> DIVISION SIGN\r
+    u'\xd7'     #  0x00de -> MULTIPLICATION SIGN\r
+    u'\ufec9'   #  0x00df -> ARABIC LETTER AIN ISOLATED FORM\r
+    u'\u0640'   #  0x00e0 -> ARABIC TATWEEL\r
+    u'\ufed3'   #  0x00e1 -> ARABIC LETTER FEH INITIAL FORM\r
+    u'\ufed7'   #  0x00e2 -> ARABIC LETTER QAF INITIAL FORM\r
+    u'\ufedb'   #  0x00e3 -> ARABIC LETTER KAF INITIAL FORM\r
+    u'\ufedf'   #  0x00e4 -> ARABIC LETTER LAM INITIAL FORM\r
+    u'\ufee3'   #  0x00e5 -> ARABIC LETTER MEEM INITIAL FORM\r
+    u'\ufee7'   #  0x00e6 -> ARABIC LETTER NOON INITIAL FORM\r
+    u'\ufeeb'   #  0x00e7 -> ARABIC LETTER HEH INITIAL FORM\r
+    u'\ufeed'   #  0x00e8 -> ARABIC LETTER WAW ISOLATED FORM\r
+    u'\ufeef'   #  0x00e9 -> ARABIC LETTER ALEF MAKSURA ISOLATED FORM\r
+    u'\ufef3'   #  0x00ea -> ARABIC LETTER YEH INITIAL FORM\r
+    u'\ufebd'   #  0x00eb -> ARABIC LETTER DAD ISOLATED FORM\r
+    u'\ufecc'   #  0x00ec -> ARABIC LETTER AIN MEDIAL FORM\r
+    u'\ufece'   #  0x00ed -> ARABIC LETTER GHAIN FINAL FORM\r
+    u'\ufecd'   #  0x00ee -> ARABIC LETTER GHAIN ISOLATED FORM\r
+    u'\ufee1'   #  0x00ef -> ARABIC LETTER MEEM ISOLATED FORM\r
+    u'\ufe7d'   #  0x00f0 -> ARABIC SHADDA MEDIAL FORM\r
+    u'\u0651'   #  0x00f1 -> ARABIC SHADDAH\r
+    u'\ufee5'   #  0x00f2 -> ARABIC LETTER NOON ISOLATED FORM\r
+    u'\ufee9'   #  0x00f3 -> ARABIC LETTER HEH ISOLATED FORM\r
+    u'\ufeec'   #  0x00f4 -> ARABIC LETTER HEH MEDIAL FORM\r
+    u'\ufef0'   #  0x00f5 -> ARABIC LETTER ALEF MAKSURA FINAL FORM\r
+    u'\ufef2'   #  0x00f6 -> ARABIC LETTER YEH FINAL FORM\r
+    u'\ufed0'   #  0x00f7 -> ARABIC LETTER GHAIN MEDIAL FORM\r
+    u'\ufed5'   #  0x00f8 -> ARABIC LETTER QAF ISOLATED FORM\r
+    u'\ufef5'   #  0x00f9 -> ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM\r
+    u'\ufef6'   #  0x00fa -> ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM\r
+    u'\ufedd'   #  0x00fb -> ARABIC LETTER LAM ISOLATED FORM\r
+    u'\ufed9'   #  0x00fc -> ARABIC LETTER KAF ISOLATED FORM\r
+    u'\ufef1'   #  0x00fd -> ARABIC LETTER YEH ISOLATED FORM\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\ufffe'   #  0x00ff -> UNDEFINED\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00a0,     #  NON-BREAKING SPACE\r
+    0x00a2: 0x00c0,     #  CENT SIGN\r
+    0x00a3: 0x00a3,     #  POUND SIGN\r
+    0x00a4: 0x00a4,     #  CURRENCY SIGN\r
+    0x00a6: 0x00db,     #  BROKEN VERTICAL BAR\r
+    0x00ab: 0x0097,     #  LEFT POINTING GUILLEMET\r
+    0x00ac: 0x00dc,     #  NOT SIGN\r
+    0x00ad: 0x00a1,     #  SOFT HYPHEN\r
+    0x00b0: 0x0080,     #  DEGREE SIGN\r
+    0x00b1: 0x0093,     #  PLUS-OR-MINUS SIGN\r
+    0x00b7: 0x0081,     #  MIDDLE DOT\r
+    0x00bb: 0x0098,     #  RIGHT POINTING GUILLEMET\r
+    0x00bc: 0x0095,     #  FRACTION 1/4\r
+    0x00bd: 0x0094,     #  FRACTION 1/2\r
+    0x00d7: 0x00de,     #  MULTIPLICATION SIGN\r
+    0x00f7: 0x00dd,     #  DIVISION SIGN\r
+    0x03b2: 0x0090,     #  GREEK SMALL BETA\r
+    0x03c6: 0x0092,     #  GREEK SMALL PHI\r
+    0x060c: 0x00ac,     #  ARABIC COMMA\r
+    0x061b: 0x00bb,     #  ARABIC SEMICOLON\r
+    0x061f: 0x00bf,     #  ARABIC QUESTION MARK\r
+    0x0640: 0x00e0,     #  ARABIC TATWEEL\r
+    0x0651: 0x00f1,     #  ARABIC SHADDAH\r
+    0x0660: 0x00b0,     #  ARABIC-INDIC DIGIT ZERO\r
+    0x0661: 0x00b1,     #  ARABIC-INDIC DIGIT ONE\r
+    0x0662: 0x00b2,     #  ARABIC-INDIC DIGIT TWO\r
+    0x0663: 0x00b3,     #  ARABIC-INDIC DIGIT THREE\r
+    0x0664: 0x00b4,     #  ARABIC-INDIC DIGIT FOUR\r
+    0x0665: 0x00b5,     #  ARABIC-INDIC DIGIT FIVE\r
+    0x0666: 0x00b6,     #  ARABIC-INDIC DIGIT SIX\r
+    0x0667: 0x00b7,     #  ARABIC-INDIC DIGIT SEVEN\r
+    0x0668: 0x00b8,     #  ARABIC-INDIC DIGIT EIGHT\r
+    0x0669: 0x00b9,     #  ARABIC-INDIC DIGIT NINE\r
+    0x066a: 0x0025,     #  ARABIC PERCENT SIGN\r
+    0x2219: 0x0082,     #  BULLET OPERATOR\r
+    0x221a: 0x0083,     #  SQUARE ROOT\r
+    0x221e: 0x0091,     #  INFINITY\r
+    0x2248: 0x0096,     #  ALMOST EQUAL TO\r
+    0x2500: 0x0085,     #  FORMS LIGHT HORIZONTAL\r
+    0x2502: 0x0086,     #  FORMS LIGHT VERTICAL\r
+    0x250c: 0x008d,     #  FORMS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x008c,     #  FORMS LIGHT DOWN AND LEFT\r
+    0x2514: 0x008e,     #  FORMS LIGHT UP AND RIGHT\r
+    0x2518: 0x008f,     #  FORMS LIGHT UP AND LEFT\r
+    0x251c: 0x008a,     #  FORMS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x0088,     #  FORMS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x0089,     #  FORMS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x008b,     #  FORMS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x0087,     #  FORMS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2592: 0x0084,     #  MEDIUM SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+    0xfe7d: 0x00f0,     #  ARABIC SHADDA MEDIAL FORM\r
+    0xfe80: 0x00c1,     #  ARABIC LETTER HAMZA ISOLATED FORM\r
+    0xfe81: 0x00c2,     #  ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM\r
+    0xfe82: 0x00a2,     #  ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM\r
+    0xfe83: 0x00c3,     #  ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM\r
+    0xfe84: 0x00a5,     #  ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM\r
+    0xfe85: 0x00c4,     #  ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM\r
+    0xfe8b: 0x00c6,     #  ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM\r
+    0xfe8d: 0x00c7,     #  ARABIC LETTER ALEF ISOLATED FORM\r
+    0xfe8e: 0x00a8,     #  ARABIC LETTER ALEF FINAL FORM\r
+    0xfe8f: 0x00a9,     #  ARABIC LETTER BEH ISOLATED FORM\r
+    0xfe91: 0x00c8,     #  ARABIC LETTER BEH INITIAL FORM\r
+    0xfe93: 0x00c9,     #  ARABIC LETTER TEH MARBUTA ISOLATED FORM\r
+    0xfe95: 0x00aa,     #  ARABIC LETTER TEH ISOLATED FORM\r
+    0xfe97: 0x00ca,     #  ARABIC LETTER TEH INITIAL FORM\r
+    0xfe99: 0x00ab,     #  ARABIC LETTER THEH ISOLATED FORM\r
+    0xfe9b: 0x00cb,     #  ARABIC LETTER THEH INITIAL FORM\r
+    0xfe9d: 0x00ad,     #  ARABIC LETTER JEEM ISOLATED FORM\r
+    0xfe9f: 0x00cc,     #  ARABIC LETTER JEEM INITIAL FORM\r
+    0xfea1: 0x00ae,     #  ARABIC LETTER HAH ISOLATED FORM\r
+    0xfea3: 0x00cd,     #  ARABIC LETTER HAH INITIAL FORM\r
+    0xfea5: 0x00af,     #  ARABIC LETTER KHAH ISOLATED FORM\r
+    0xfea7: 0x00ce,     #  ARABIC LETTER KHAH INITIAL FORM\r
+    0xfea9: 0x00cf,     #  ARABIC LETTER DAL ISOLATED FORM\r
+    0xfeab: 0x00d0,     #  ARABIC LETTER THAL ISOLATED FORM\r
+    0xfead: 0x00d1,     #  ARABIC LETTER REH ISOLATED FORM\r
+    0xfeaf: 0x00d2,     #  ARABIC LETTER ZAIN ISOLATED FORM\r
+    0xfeb1: 0x00bc,     #  ARABIC LETTER SEEN ISOLATED FORM\r
+    0xfeb3: 0x00d3,     #  ARABIC LETTER SEEN INITIAL FORM\r
+    0xfeb5: 0x00bd,     #  ARABIC LETTER SHEEN ISOLATED FORM\r
+    0xfeb7: 0x00d4,     #  ARABIC LETTER SHEEN INITIAL FORM\r
+    0xfeb9: 0x00be,     #  ARABIC LETTER SAD ISOLATED FORM\r
+    0xfebb: 0x00d5,     #  ARABIC LETTER SAD INITIAL FORM\r
+    0xfebd: 0x00eb,     #  ARABIC LETTER DAD ISOLATED FORM\r
+    0xfebf: 0x00d6,     #  ARABIC LETTER DAD INITIAL FORM\r
+    0xfec1: 0x00d7,     #  ARABIC LETTER TAH ISOLATED FORM\r
+    0xfec5: 0x00d8,     #  ARABIC LETTER ZAH ISOLATED FORM\r
+    0xfec9: 0x00df,     #  ARABIC LETTER AIN ISOLATED FORM\r
+    0xfeca: 0x00c5,     #  ARABIC LETTER AIN FINAL FORM\r
+    0xfecb: 0x00d9,     #  ARABIC LETTER AIN INITIAL FORM\r
+    0xfecc: 0x00ec,     #  ARABIC LETTER AIN MEDIAL FORM\r
+    0xfecd: 0x00ee,     #  ARABIC LETTER GHAIN ISOLATED FORM\r
+    0xfece: 0x00ed,     #  ARABIC LETTER GHAIN FINAL FORM\r
+    0xfecf: 0x00da,     #  ARABIC LETTER GHAIN INITIAL FORM\r
+    0xfed0: 0x00f7,     #  ARABIC LETTER GHAIN MEDIAL FORM\r
+    0xfed1: 0x00ba,     #  ARABIC LETTER FEH ISOLATED FORM\r
+    0xfed3: 0x00e1,     #  ARABIC LETTER FEH INITIAL FORM\r
+    0xfed5: 0x00f8,     #  ARABIC LETTER QAF ISOLATED FORM\r
+    0xfed7: 0x00e2,     #  ARABIC LETTER QAF INITIAL FORM\r
+    0xfed9: 0x00fc,     #  ARABIC LETTER KAF ISOLATED FORM\r
+    0xfedb: 0x00e3,     #  ARABIC LETTER KAF INITIAL FORM\r
+    0xfedd: 0x00fb,     #  ARABIC LETTER LAM ISOLATED FORM\r
+    0xfedf: 0x00e4,     #  ARABIC LETTER LAM INITIAL FORM\r
+    0xfee1: 0x00ef,     #  ARABIC LETTER MEEM ISOLATED FORM\r
+    0xfee3: 0x00e5,     #  ARABIC LETTER MEEM INITIAL FORM\r
+    0xfee5: 0x00f2,     #  ARABIC LETTER NOON ISOLATED FORM\r
+    0xfee7: 0x00e6,     #  ARABIC LETTER NOON INITIAL FORM\r
+    0xfee9: 0x00f3,     #  ARABIC LETTER HEH ISOLATED FORM\r
+    0xfeeb: 0x00e7,     #  ARABIC LETTER HEH INITIAL FORM\r
+    0xfeec: 0x00f4,     #  ARABIC LETTER HEH MEDIAL FORM\r
+    0xfeed: 0x00e8,     #  ARABIC LETTER WAW ISOLATED FORM\r
+    0xfeef: 0x00e9,     #  ARABIC LETTER ALEF MAKSURA ISOLATED FORM\r
+    0xfef0: 0x00f5,     #  ARABIC LETTER ALEF MAKSURA FINAL FORM\r
+    0xfef1: 0x00fd,     #  ARABIC LETTER YEH ISOLATED FORM\r
+    0xfef2: 0x00f6,     #  ARABIC LETTER YEH FINAL FORM\r
+    0xfef3: 0x00ea,     #  ARABIC LETTER YEH INITIAL FORM\r
+    0xfef5: 0x00f9,     #  ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM\r
+    0xfef6: 0x00fa,     #  ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM\r
+    0xfef7: 0x0099,     #  ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM\r
+    0xfef8: 0x009a,     #  ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM\r
+    0xfefb: 0x009d,     #  ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM\r
+    0xfefc: 0x009e,     #  ARABIC LIGATURE LAM WITH ALEF FINAL FORM\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp865.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp865.py
new file mode 100644 (file)
index 0000000..b246a49
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP865.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp865',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x00c7,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x0081: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x0082: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x0083: 0x00e2,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x0084: 0x00e4,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x0085: 0x00e0,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x0086: 0x00e5,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x0087: 0x00e7,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x0088: 0x00ea,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x0089: 0x00eb,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x008a: 0x00e8,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x008b: 0x00ef,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x008c: 0x00ee,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x008d: 0x00ec,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x008e: 0x00c4,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x008f: 0x00c5,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x0090: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0091: 0x00e6,     #  LATIN SMALL LIGATURE AE\r
+    0x0092: 0x00c6,     #  LATIN CAPITAL LIGATURE AE\r
+    0x0093: 0x00f4,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x0094: 0x00f6,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x0095: 0x00f2,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x0096: 0x00fb,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x0097: 0x00f9,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x0098: 0x00ff,     #  LATIN SMALL LETTER Y WITH DIAERESIS\r
+    0x0099: 0x00d6,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x009a: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x009b: 0x00f8,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x00d8,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x009e: 0x20a7,     #  PESETA SIGN\r
+    0x009f: 0x0192,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x00a0: 0x00e1,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00a1: 0x00ed,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00a2: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00a3: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00a4: 0x00f1,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00a5: 0x00d1,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00a6: 0x00aa,     #  FEMININE ORDINAL INDICATOR\r
+    0x00a7: 0x00ba,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00a8: 0x00bf,     #  INVERTED QUESTION MARK\r
+    0x00a9: 0x2310,     #  REVERSED NOT SIGN\r
+    0x00aa: 0x00ac,     #  NOT SIGN\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x00bc,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00ad: 0x00a1,     #  INVERTED EXCLAMATION MARK\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00a4,     #  CURRENCY SIGN\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x2561,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x00b6: 0x2562,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x00b7: 0x2556,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x00b8: 0x2555,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x255c,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x00be: 0x255b,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x255e,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x00c7: 0x255f,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x2567,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d0: 0x2568,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d1: 0x2564,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d2: 0x2565,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d3: 0x2559,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x00d4: 0x2558,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x00d5: 0x2552,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x00d6: 0x2553,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x00d7: 0x256b,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d8: 0x256a,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x258c,     #  LEFT HALF BLOCK\r
+    0x00de: 0x2590,     #  RIGHT HALF BLOCK\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x03b1,     #  GREEK SMALL LETTER ALPHA\r
+    0x00e1: 0x00df,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e2: 0x0393,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x00e3: 0x03c0,     #  GREEK SMALL LETTER PI\r
+    0x00e4: 0x03a3,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x00e5: 0x03c3,     #  GREEK SMALL LETTER SIGMA\r
+    0x00e6: 0x00b5,     #  MICRO SIGN\r
+    0x00e7: 0x03c4,     #  GREEK SMALL LETTER TAU\r
+    0x00e8: 0x03a6,     #  GREEK CAPITAL LETTER PHI\r
+    0x00e9: 0x0398,     #  GREEK CAPITAL LETTER THETA\r
+    0x00ea: 0x03a9,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x00eb: 0x03b4,     #  GREEK SMALL LETTER DELTA\r
+    0x00ec: 0x221e,     #  INFINITY\r
+    0x00ed: 0x03c6,     #  GREEK SMALL LETTER PHI\r
+    0x00ee: 0x03b5,     #  GREEK SMALL LETTER EPSILON\r
+    0x00ef: 0x2229,     #  INTERSECTION\r
+    0x00f0: 0x2261,     #  IDENTICAL TO\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x2265,     #  GREATER-THAN OR EQUAL TO\r
+    0x00f3: 0x2264,     #  LESS-THAN OR EQUAL TO\r
+    0x00f4: 0x2320,     #  TOP HALF INTEGRAL\r
+    0x00f5: 0x2321,     #  BOTTOM HALF INTEGRAL\r
+    0x00f6: 0x00f7,     #  DIVISION SIGN\r
+    0x00f7: 0x2248,     #  ALMOST EQUAL TO\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x2219,     #  BULLET OPERATOR\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x221a,     #  SQUARE ROOT\r
+    0x00fc: 0x207f,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x00fd: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\xc7'     #  0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xfc'     #  0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xe9'     #  0x0082 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe2'     #  0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe0'     #  0x0085 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe5'     #  0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x0087 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xea'     #  0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xe8'     #  0x008a -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xef'     #  0x008b -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xee'     #  0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xec'     #  0x008d -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xc4'     #  0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc9'     #  0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xe6'     #  0x0091 -> LATIN SMALL LIGATURE AE\r
+    u'\xc6'     #  0x0092 -> LATIN CAPITAL LIGATURE AE\r
+    u'\xf4'     #  0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf2'     #  0x0095 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xfb'     #  0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xf9'     #  0x0097 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xff'     #  0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\xd6'     #  0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xf8'     #  0x009b -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\xd8'     #  0x009d -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\u20a7'   #  0x009e -> PESETA SIGN\r
+    u'\u0192'   #  0x009f -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\xe1'     #  0x00a0 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xed'     #  0x00a1 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xf3'     #  0x00a2 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xfa'     #  0x00a3 -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf1'     #  0x00a4 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xd1'     #  0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xaa'     #  0x00a6 -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0x00a7 -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbf'     #  0x00a8 -> INVERTED QUESTION MARK\r
+    u'\u2310'   #  0x00a9 -> REVERSED NOT SIGN\r
+    u'\xac'     #  0x00aa -> NOT SIGN\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\xbc'     #  0x00ac -> VULGAR FRACTION ONE QUARTER\r
+    u'\xa1'     #  0x00ad -> INVERTED EXCLAMATION MARK\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xa4'     #  0x00af -> CURRENCY SIGN\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u2561'   #  0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u2562'   #  0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    u'\u2556'   #  0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    u'\u2555'   #  0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255c'   #  0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    u'\u255b'   #  0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u255e'   #  0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u2567'   #  0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2564'   #  0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2565'   #  0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2559'   #  0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u2558'   #  0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2552'   #  0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u2553'   #  0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    u'\u256b'   #  0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u256a'   #  0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u258c'   #  0x00dd -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x00de -> RIGHT HALF BLOCK\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\u03b1'   #  0x00e0 -> GREEK SMALL LETTER ALPHA\r
+    u'\xdf'     #  0x00e1 -> LATIN SMALL LETTER SHARP S\r
+    u'\u0393'   #  0x00e2 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u03c0'   #  0x00e3 -> GREEK SMALL LETTER PI\r
+    u'\u03a3'   #  0x00e4 -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03c3'   #  0x00e5 -> GREEK SMALL LETTER SIGMA\r
+    u'\xb5'     #  0x00e6 -> MICRO SIGN\r
+    u'\u03c4'   #  0x00e7 -> GREEK SMALL LETTER TAU\r
+    u'\u03a6'   #  0x00e8 -> GREEK CAPITAL LETTER PHI\r
+    u'\u0398'   #  0x00e9 -> GREEK CAPITAL LETTER THETA\r
+    u'\u03a9'   #  0x00ea -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03b4'   #  0x00eb -> GREEK SMALL LETTER DELTA\r
+    u'\u221e'   #  0x00ec -> INFINITY\r
+    u'\u03c6'   #  0x00ed -> GREEK SMALL LETTER PHI\r
+    u'\u03b5'   #  0x00ee -> GREEK SMALL LETTER EPSILON\r
+    u'\u2229'   #  0x00ef -> INTERSECTION\r
+    u'\u2261'   #  0x00f0 -> IDENTICAL TO\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u2265'   #  0x00f2 -> GREATER-THAN OR EQUAL TO\r
+    u'\u2264'   #  0x00f3 -> LESS-THAN OR EQUAL TO\r
+    u'\u2320'   #  0x00f4 -> TOP HALF INTEGRAL\r
+    u'\u2321'   #  0x00f5 -> BOTTOM HALF INTEGRAL\r
+    u'\xf7'     #  0x00f6 -> DIVISION SIGN\r
+    u'\u2248'   #  0x00f7 -> ALMOST EQUAL TO\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\u2219'   #  0x00f9 -> BULLET OPERATOR\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\u221a'   #  0x00fb -> SQUARE ROOT\r
+    u'\u207f'   #  0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N\r
+    u'\xb2'     #  0x00fd -> SUPERSCRIPT TWO\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a1: 0x00ad,     #  INVERTED EXCLAMATION MARK\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00a4: 0x00af,     #  CURRENCY SIGN\r
+    0x00aa: 0x00a6,     #  FEMININE ORDINAL INDICATOR\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x00aa,     #  NOT SIGN\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x00fd,     #  SUPERSCRIPT TWO\r
+    0x00b5: 0x00e6,     #  MICRO SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x00ba: 0x00a7,     #  MASCULINE ORDINAL INDICATOR\r
+    0x00bc: 0x00ac,     #  VULGAR FRACTION ONE QUARTER\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x00bf: 0x00a8,     #  INVERTED QUESTION MARK\r
+    0x00c4: 0x008e,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x00c5: 0x008f,     #  LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    0x00c6: 0x0092,     #  LATIN CAPITAL LIGATURE AE\r
+    0x00c7: 0x0080,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x00c9: 0x0090,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00d1: 0x00a5,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00d6: 0x0099,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x00d8: 0x009d,     #  LATIN CAPITAL LETTER O WITH STROKE\r
+    0x00dc: 0x009a,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00df: 0x00e1,     #  LATIN SMALL LETTER SHARP S\r
+    0x00e0: 0x0085,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x00e1: 0x00a0,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00e2: 0x0083,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x00e4: 0x0084,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x00e5: 0x0086,     #  LATIN SMALL LETTER A WITH RING ABOVE\r
+    0x00e6: 0x0091,     #  LATIN SMALL LIGATURE AE\r
+    0x00e7: 0x0087,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x00e8: 0x008a,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x00e9: 0x0082,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00ea: 0x0088,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x00eb: 0x0089,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x00ec: 0x008d,     #  LATIN SMALL LETTER I WITH GRAVE\r
+    0x00ed: 0x00a1,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00ee: 0x008c,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x00ef: 0x008b,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x00f1: 0x00a4,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00f2: 0x0095,     #  LATIN SMALL LETTER O WITH GRAVE\r
+    0x00f3: 0x00a2,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f4: 0x0093,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x00f6: 0x0094,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x00f7: 0x00f6,     #  DIVISION SIGN\r
+    0x00f8: 0x009b,     #  LATIN SMALL LETTER O WITH STROKE\r
+    0x00f9: 0x0097,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x00fa: 0x00a3,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00fb: 0x0096,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x00fc: 0x0081,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x00ff: 0x0098,     #  LATIN SMALL LETTER Y WITH DIAERESIS\r
+    0x0192: 0x009f,     #  LATIN SMALL LETTER F WITH HOOK\r
+    0x0393: 0x00e2,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x0398: 0x00e9,     #  GREEK CAPITAL LETTER THETA\r
+    0x03a3: 0x00e4,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x03a6: 0x00e8,     #  GREEK CAPITAL LETTER PHI\r
+    0x03a9: 0x00ea,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x03b1: 0x00e0,     #  GREEK SMALL LETTER ALPHA\r
+    0x03b4: 0x00eb,     #  GREEK SMALL LETTER DELTA\r
+    0x03b5: 0x00ee,     #  GREEK SMALL LETTER EPSILON\r
+    0x03c0: 0x00e3,     #  GREEK SMALL LETTER PI\r
+    0x03c3: 0x00e5,     #  GREEK SMALL LETTER SIGMA\r
+    0x03c4: 0x00e7,     #  GREEK SMALL LETTER TAU\r
+    0x03c6: 0x00ed,     #  GREEK SMALL LETTER PHI\r
+    0x207f: 0x00fc,     #  SUPERSCRIPT LATIN SMALL LETTER N\r
+    0x20a7: 0x009e,     #  PESETA SIGN\r
+    0x2219: 0x00f9,     #  BULLET OPERATOR\r
+    0x221a: 0x00fb,     #  SQUARE ROOT\r
+    0x221e: 0x00ec,     #  INFINITY\r
+    0x2229: 0x00ef,     #  INTERSECTION\r
+    0x2248: 0x00f7,     #  ALMOST EQUAL TO\r
+    0x2261: 0x00f0,     #  IDENTICAL TO\r
+    0x2264: 0x00f3,     #  LESS-THAN OR EQUAL TO\r
+    0x2265: 0x00f2,     #  GREATER-THAN OR EQUAL TO\r
+    0x2310: 0x00a9,     #  REVERSED NOT SIGN\r
+    0x2320: 0x00f4,     #  TOP HALF INTEGRAL\r
+    0x2321: 0x00f5,     #  BOTTOM HALF INTEGRAL\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2552: 0x00d5,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x2553: 0x00d6,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2555: 0x00b8,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x2556: 0x00b7,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x2558: 0x00d4,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x2559: 0x00d3,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255b: 0x00be,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x255c: 0x00bd,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x255e: 0x00c6,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x255f: 0x00c7,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2561: 0x00b5,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x2562: 0x00b6,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2564: 0x00d1,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x2565: 0x00d2,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2567: 0x00cf,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x2568: 0x00d0,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256a: 0x00d8,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x256b: 0x00d7,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x258c: 0x00dd,     #  LEFT HALF BLOCK\r
+    0x2590: 0x00de,     #  RIGHT HALF BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp866.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp866.py
new file mode 100644 (file)
index 0000000..70e5139
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP866.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp866',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x0410,     #  CYRILLIC CAPITAL LETTER A\r
+    0x0081: 0x0411,     #  CYRILLIC CAPITAL LETTER BE\r
+    0x0082: 0x0412,     #  CYRILLIC CAPITAL LETTER VE\r
+    0x0083: 0x0413,     #  CYRILLIC CAPITAL LETTER GHE\r
+    0x0084: 0x0414,     #  CYRILLIC CAPITAL LETTER DE\r
+    0x0085: 0x0415,     #  CYRILLIC CAPITAL LETTER IE\r
+    0x0086: 0x0416,     #  CYRILLIC CAPITAL LETTER ZHE\r
+    0x0087: 0x0417,     #  CYRILLIC CAPITAL LETTER ZE\r
+    0x0088: 0x0418,     #  CYRILLIC CAPITAL LETTER I\r
+    0x0089: 0x0419,     #  CYRILLIC CAPITAL LETTER SHORT I\r
+    0x008a: 0x041a,     #  CYRILLIC CAPITAL LETTER KA\r
+    0x008b: 0x041b,     #  CYRILLIC CAPITAL LETTER EL\r
+    0x008c: 0x041c,     #  CYRILLIC CAPITAL LETTER EM\r
+    0x008d: 0x041d,     #  CYRILLIC CAPITAL LETTER EN\r
+    0x008e: 0x041e,     #  CYRILLIC CAPITAL LETTER O\r
+    0x008f: 0x041f,     #  CYRILLIC CAPITAL LETTER PE\r
+    0x0090: 0x0420,     #  CYRILLIC CAPITAL LETTER ER\r
+    0x0091: 0x0421,     #  CYRILLIC CAPITAL LETTER ES\r
+    0x0092: 0x0422,     #  CYRILLIC CAPITAL LETTER TE\r
+    0x0093: 0x0423,     #  CYRILLIC CAPITAL LETTER U\r
+    0x0094: 0x0424,     #  CYRILLIC CAPITAL LETTER EF\r
+    0x0095: 0x0425,     #  CYRILLIC CAPITAL LETTER HA\r
+    0x0096: 0x0426,     #  CYRILLIC CAPITAL LETTER TSE\r
+    0x0097: 0x0427,     #  CYRILLIC CAPITAL LETTER CHE\r
+    0x0098: 0x0428,     #  CYRILLIC CAPITAL LETTER SHA\r
+    0x0099: 0x0429,     #  CYRILLIC CAPITAL LETTER SHCHA\r
+    0x009a: 0x042a,     #  CYRILLIC CAPITAL LETTER HARD SIGN\r
+    0x009b: 0x042b,     #  CYRILLIC CAPITAL LETTER YERU\r
+    0x009c: 0x042c,     #  CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    0x009d: 0x042d,     #  CYRILLIC CAPITAL LETTER E\r
+    0x009e: 0x042e,     #  CYRILLIC CAPITAL LETTER YU\r
+    0x009f: 0x042f,     #  CYRILLIC CAPITAL LETTER YA\r
+    0x00a0: 0x0430,     #  CYRILLIC SMALL LETTER A\r
+    0x00a1: 0x0431,     #  CYRILLIC SMALL LETTER BE\r
+    0x00a2: 0x0432,     #  CYRILLIC SMALL LETTER VE\r
+    0x00a3: 0x0433,     #  CYRILLIC SMALL LETTER GHE\r
+    0x00a4: 0x0434,     #  CYRILLIC SMALL LETTER DE\r
+    0x00a5: 0x0435,     #  CYRILLIC SMALL LETTER IE\r
+    0x00a6: 0x0436,     #  CYRILLIC SMALL LETTER ZHE\r
+    0x00a7: 0x0437,     #  CYRILLIC SMALL LETTER ZE\r
+    0x00a8: 0x0438,     #  CYRILLIC SMALL LETTER I\r
+    0x00a9: 0x0439,     #  CYRILLIC SMALL LETTER SHORT I\r
+    0x00aa: 0x043a,     #  CYRILLIC SMALL LETTER KA\r
+    0x00ab: 0x043b,     #  CYRILLIC SMALL LETTER EL\r
+    0x00ac: 0x043c,     #  CYRILLIC SMALL LETTER EM\r
+    0x00ad: 0x043d,     #  CYRILLIC SMALL LETTER EN\r
+    0x00ae: 0x043e,     #  CYRILLIC SMALL LETTER O\r
+    0x00af: 0x043f,     #  CYRILLIC SMALL LETTER PE\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x2561,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x00b6: 0x2562,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x00b7: 0x2556,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x00b8: 0x2555,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x255c,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x00be: 0x255b,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x255e,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x00c7: 0x255f,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x2567,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d0: 0x2568,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d1: 0x2564,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d2: 0x2565,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d3: 0x2559,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x00d4: 0x2558,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x00d5: 0x2552,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x00d6: 0x2553,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x00d7: 0x256b,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x00d8: 0x256a,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x258c,     #  LEFT HALF BLOCK\r
+    0x00de: 0x2590,     #  RIGHT HALF BLOCK\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x0440,     #  CYRILLIC SMALL LETTER ER\r
+    0x00e1: 0x0441,     #  CYRILLIC SMALL LETTER ES\r
+    0x00e2: 0x0442,     #  CYRILLIC SMALL LETTER TE\r
+    0x00e3: 0x0443,     #  CYRILLIC SMALL LETTER U\r
+    0x00e4: 0x0444,     #  CYRILLIC SMALL LETTER EF\r
+    0x00e5: 0x0445,     #  CYRILLIC SMALL LETTER HA\r
+    0x00e6: 0x0446,     #  CYRILLIC SMALL LETTER TSE\r
+    0x00e7: 0x0447,     #  CYRILLIC SMALL LETTER CHE\r
+    0x00e8: 0x0448,     #  CYRILLIC SMALL LETTER SHA\r
+    0x00e9: 0x0449,     #  CYRILLIC SMALL LETTER SHCHA\r
+    0x00ea: 0x044a,     #  CYRILLIC SMALL LETTER HARD SIGN\r
+    0x00eb: 0x044b,     #  CYRILLIC SMALL LETTER YERU\r
+    0x00ec: 0x044c,     #  CYRILLIC SMALL LETTER SOFT SIGN\r
+    0x00ed: 0x044d,     #  CYRILLIC SMALL LETTER E\r
+    0x00ee: 0x044e,     #  CYRILLIC SMALL LETTER YU\r
+    0x00ef: 0x044f,     #  CYRILLIC SMALL LETTER YA\r
+    0x00f0: 0x0401,     #  CYRILLIC CAPITAL LETTER IO\r
+    0x00f1: 0x0451,     #  CYRILLIC SMALL LETTER IO\r
+    0x00f2: 0x0404,     #  CYRILLIC CAPITAL LETTER UKRAINIAN IE\r
+    0x00f3: 0x0454,     #  CYRILLIC SMALL LETTER UKRAINIAN IE\r
+    0x00f4: 0x0407,     #  CYRILLIC CAPITAL LETTER YI\r
+    0x00f5: 0x0457,     #  CYRILLIC SMALL LETTER YI\r
+    0x00f6: 0x040e,     #  CYRILLIC CAPITAL LETTER SHORT U\r
+    0x00f7: 0x045e,     #  CYRILLIC SMALL LETTER SHORT U\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x2219,     #  BULLET OPERATOR\r
+    0x00fa: 0x00b7,     #  MIDDLE DOT\r
+    0x00fb: 0x221a,     #  SQUARE ROOT\r
+    0x00fc: 0x2116,     #  NUMERO SIGN\r
+    0x00fd: 0x00a4,     #  CURRENCY SIGN\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\u0410'   #  0x0080 -> CYRILLIC CAPITAL LETTER A\r
+    u'\u0411'   #  0x0081 -> CYRILLIC CAPITAL LETTER BE\r
+    u'\u0412'   #  0x0082 -> CYRILLIC CAPITAL LETTER VE\r
+    u'\u0413'   #  0x0083 -> CYRILLIC CAPITAL LETTER GHE\r
+    u'\u0414'   #  0x0084 -> CYRILLIC CAPITAL LETTER DE\r
+    u'\u0415'   #  0x0085 -> CYRILLIC CAPITAL LETTER IE\r
+    u'\u0416'   #  0x0086 -> CYRILLIC CAPITAL LETTER ZHE\r
+    u'\u0417'   #  0x0087 -> CYRILLIC CAPITAL LETTER ZE\r
+    u'\u0418'   #  0x0088 -> CYRILLIC CAPITAL LETTER I\r
+    u'\u0419'   #  0x0089 -> CYRILLIC CAPITAL LETTER SHORT I\r
+    u'\u041a'   #  0x008a -> CYRILLIC CAPITAL LETTER KA\r
+    u'\u041b'   #  0x008b -> CYRILLIC CAPITAL LETTER EL\r
+    u'\u041c'   #  0x008c -> CYRILLIC CAPITAL LETTER EM\r
+    u'\u041d'   #  0x008d -> CYRILLIC CAPITAL LETTER EN\r
+    u'\u041e'   #  0x008e -> CYRILLIC CAPITAL LETTER O\r
+    u'\u041f'   #  0x008f -> CYRILLIC CAPITAL LETTER PE\r
+    u'\u0420'   #  0x0090 -> CYRILLIC CAPITAL LETTER ER\r
+    u'\u0421'   #  0x0091 -> CYRILLIC CAPITAL LETTER ES\r
+    u'\u0422'   #  0x0092 -> CYRILLIC CAPITAL LETTER TE\r
+    u'\u0423'   #  0x0093 -> CYRILLIC CAPITAL LETTER U\r
+    u'\u0424'   #  0x0094 -> CYRILLIC CAPITAL LETTER EF\r
+    u'\u0425'   #  0x0095 -> CYRILLIC CAPITAL LETTER HA\r
+    u'\u0426'   #  0x0096 -> CYRILLIC CAPITAL LETTER TSE\r
+    u'\u0427'   #  0x0097 -> CYRILLIC CAPITAL LETTER CHE\r
+    u'\u0428'   #  0x0098 -> CYRILLIC CAPITAL LETTER SHA\r
+    u'\u0429'   #  0x0099 -> CYRILLIC CAPITAL LETTER SHCHA\r
+    u'\u042a'   #  0x009a -> CYRILLIC CAPITAL LETTER HARD SIGN\r
+    u'\u042b'   #  0x009b -> CYRILLIC CAPITAL LETTER YERU\r
+    u'\u042c'   #  0x009c -> CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    u'\u042d'   #  0x009d -> CYRILLIC CAPITAL LETTER E\r
+    u'\u042e'   #  0x009e -> CYRILLIC CAPITAL LETTER YU\r
+    u'\u042f'   #  0x009f -> CYRILLIC CAPITAL LETTER YA\r
+    u'\u0430'   #  0x00a0 -> CYRILLIC SMALL LETTER A\r
+    u'\u0431'   #  0x00a1 -> CYRILLIC SMALL LETTER BE\r
+    u'\u0432'   #  0x00a2 -> CYRILLIC SMALL LETTER VE\r
+    u'\u0433'   #  0x00a3 -> CYRILLIC SMALL LETTER GHE\r
+    u'\u0434'   #  0x00a4 -> CYRILLIC SMALL LETTER DE\r
+    u'\u0435'   #  0x00a5 -> CYRILLIC SMALL LETTER IE\r
+    u'\u0436'   #  0x00a6 -> CYRILLIC SMALL LETTER ZHE\r
+    u'\u0437'   #  0x00a7 -> CYRILLIC SMALL LETTER ZE\r
+    u'\u0438'   #  0x00a8 -> CYRILLIC SMALL LETTER I\r
+    u'\u0439'   #  0x00a9 -> CYRILLIC SMALL LETTER SHORT I\r
+    u'\u043a'   #  0x00aa -> CYRILLIC SMALL LETTER KA\r
+    u'\u043b'   #  0x00ab -> CYRILLIC SMALL LETTER EL\r
+    u'\u043c'   #  0x00ac -> CYRILLIC SMALL LETTER EM\r
+    u'\u043d'   #  0x00ad -> CYRILLIC SMALL LETTER EN\r
+    u'\u043e'   #  0x00ae -> CYRILLIC SMALL LETTER O\r
+    u'\u043f'   #  0x00af -> CYRILLIC SMALL LETTER PE\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u2561'   #  0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u2562'   #  0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    u'\u2556'   #  0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    u'\u2555'   #  0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255c'   #  0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    u'\u255b'   #  0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u255e'   #  0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u2567'   #  0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2564'   #  0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2565'   #  0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2559'   #  0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u2558'   #  0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2552'   #  0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u2553'   #  0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    u'\u256b'   #  0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u256a'   #  0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u258c'   #  0x00dd -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x00de -> RIGHT HALF BLOCK\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\u0440'   #  0x00e0 -> CYRILLIC SMALL LETTER ER\r
+    u'\u0441'   #  0x00e1 -> CYRILLIC SMALL LETTER ES\r
+    u'\u0442'   #  0x00e2 -> CYRILLIC SMALL LETTER TE\r
+    u'\u0443'   #  0x00e3 -> CYRILLIC SMALL LETTER U\r
+    u'\u0444'   #  0x00e4 -> CYRILLIC SMALL LETTER EF\r
+    u'\u0445'   #  0x00e5 -> CYRILLIC SMALL LETTER HA\r
+    u'\u0446'   #  0x00e6 -> CYRILLIC SMALL LETTER TSE\r
+    u'\u0447'   #  0x00e7 -> CYRILLIC SMALL LETTER CHE\r
+    u'\u0448'   #  0x00e8 -> CYRILLIC SMALL LETTER SHA\r
+    u'\u0449'   #  0x00e9 -> CYRILLIC SMALL LETTER SHCHA\r
+    u'\u044a'   #  0x00ea -> CYRILLIC SMALL LETTER HARD SIGN\r
+    u'\u044b'   #  0x00eb -> CYRILLIC SMALL LETTER YERU\r
+    u'\u044c'   #  0x00ec -> CYRILLIC SMALL LETTER SOFT SIGN\r
+    u'\u044d'   #  0x00ed -> CYRILLIC SMALL LETTER E\r
+    u'\u044e'   #  0x00ee -> CYRILLIC SMALL LETTER YU\r
+    u'\u044f'   #  0x00ef -> CYRILLIC SMALL LETTER YA\r
+    u'\u0401'   #  0x00f0 -> CYRILLIC CAPITAL LETTER IO\r
+    u'\u0451'   #  0x00f1 -> CYRILLIC SMALL LETTER IO\r
+    u'\u0404'   #  0x00f2 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE\r
+    u'\u0454'   #  0x00f3 -> CYRILLIC SMALL LETTER UKRAINIAN IE\r
+    u'\u0407'   #  0x00f4 -> CYRILLIC CAPITAL LETTER YI\r
+    u'\u0457'   #  0x00f5 -> CYRILLIC SMALL LETTER YI\r
+    u'\u040e'   #  0x00f6 -> CYRILLIC CAPITAL LETTER SHORT U\r
+    u'\u045e'   #  0x00f7 -> CYRILLIC SMALL LETTER SHORT U\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\u2219'   #  0x00f9 -> BULLET OPERATOR\r
+    u'\xb7'     #  0x00fa -> MIDDLE DOT\r
+    u'\u221a'   #  0x00fb -> SQUARE ROOT\r
+    u'\u2116'   #  0x00fc -> NUMERO SIGN\r
+    u'\xa4'     #  0x00fd -> CURRENCY SIGN\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a4: 0x00fd,     #  CURRENCY SIGN\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b7: 0x00fa,     #  MIDDLE DOT\r
+    0x0401: 0x00f0,     #  CYRILLIC CAPITAL LETTER IO\r
+    0x0404: 0x00f2,     #  CYRILLIC CAPITAL LETTER UKRAINIAN IE\r
+    0x0407: 0x00f4,     #  CYRILLIC CAPITAL LETTER YI\r
+    0x040e: 0x00f6,     #  CYRILLIC CAPITAL LETTER SHORT U\r
+    0x0410: 0x0080,     #  CYRILLIC CAPITAL LETTER A\r
+    0x0411: 0x0081,     #  CYRILLIC CAPITAL LETTER BE\r
+    0x0412: 0x0082,     #  CYRILLIC CAPITAL LETTER VE\r
+    0x0413: 0x0083,     #  CYRILLIC CAPITAL LETTER GHE\r
+    0x0414: 0x0084,     #  CYRILLIC CAPITAL LETTER DE\r
+    0x0415: 0x0085,     #  CYRILLIC CAPITAL LETTER IE\r
+    0x0416: 0x0086,     #  CYRILLIC CAPITAL LETTER ZHE\r
+    0x0417: 0x0087,     #  CYRILLIC CAPITAL LETTER ZE\r
+    0x0418: 0x0088,     #  CYRILLIC CAPITAL LETTER I\r
+    0x0419: 0x0089,     #  CYRILLIC CAPITAL LETTER SHORT I\r
+    0x041a: 0x008a,     #  CYRILLIC CAPITAL LETTER KA\r
+    0x041b: 0x008b,     #  CYRILLIC CAPITAL LETTER EL\r
+    0x041c: 0x008c,     #  CYRILLIC CAPITAL LETTER EM\r
+    0x041d: 0x008d,     #  CYRILLIC CAPITAL LETTER EN\r
+    0x041e: 0x008e,     #  CYRILLIC CAPITAL LETTER O\r
+    0x041f: 0x008f,     #  CYRILLIC CAPITAL LETTER PE\r
+    0x0420: 0x0090,     #  CYRILLIC CAPITAL LETTER ER\r
+    0x0421: 0x0091,     #  CYRILLIC CAPITAL LETTER ES\r
+    0x0422: 0x0092,     #  CYRILLIC CAPITAL LETTER TE\r
+    0x0423: 0x0093,     #  CYRILLIC CAPITAL LETTER U\r
+    0x0424: 0x0094,     #  CYRILLIC CAPITAL LETTER EF\r
+    0x0425: 0x0095,     #  CYRILLIC CAPITAL LETTER HA\r
+    0x0426: 0x0096,     #  CYRILLIC CAPITAL LETTER TSE\r
+    0x0427: 0x0097,     #  CYRILLIC CAPITAL LETTER CHE\r
+    0x0428: 0x0098,     #  CYRILLIC CAPITAL LETTER SHA\r
+    0x0429: 0x0099,     #  CYRILLIC CAPITAL LETTER SHCHA\r
+    0x042a: 0x009a,     #  CYRILLIC CAPITAL LETTER HARD SIGN\r
+    0x042b: 0x009b,     #  CYRILLIC CAPITAL LETTER YERU\r
+    0x042c: 0x009c,     #  CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    0x042d: 0x009d,     #  CYRILLIC CAPITAL LETTER E\r
+    0x042e: 0x009e,     #  CYRILLIC CAPITAL LETTER YU\r
+    0x042f: 0x009f,     #  CYRILLIC CAPITAL LETTER YA\r
+    0x0430: 0x00a0,     #  CYRILLIC SMALL LETTER A\r
+    0x0431: 0x00a1,     #  CYRILLIC SMALL LETTER BE\r
+    0x0432: 0x00a2,     #  CYRILLIC SMALL LETTER VE\r
+    0x0433: 0x00a3,     #  CYRILLIC SMALL LETTER GHE\r
+    0x0434: 0x00a4,     #  CYRILLIC SMALL LETTER DE\r
+    0x0435: 0x00a5,     #  CYRILLIC SMALL LETTER IE\r
+    0x0436: 0x00a6,     #  CYRILLIC SMALL LETTER ZHE\r
+    0x0437: 0x00a7,     #  CYRILLIC SMALL LETTER ZE\r
+    0x0438: 0x00a8,     #  CYRILLIC SMALL LETTER I\r
+    0x0439: 0x00a9,     #  CYRILLIC SMALL LETTER SHORT I\r
+    0x043a: 0x00aa,     #  CYRILLIC SMALL LETTER KA\r
+    0x043b: 0x00ab,     #  CYRILLIC SMALL LETTER EL\r
+    0x043c: 0x00ac,     #  CYRILLIC SMALL LETTER EM\r
+    0x043d: 0x00ad,     #  CYRILLIC SMALL LETTER EN\r
+    0x043e: 0x00ae,     #  CYRILLIC SMALL LETTER O\r
+    0x043f: 0x00af,     #  CYRILLIC SMALL LETTER PE\r
+    0x0440: 0x00e0,     #  CYRILLIC SMALL LETTER ER\r
+    0x0441: 0x00e1,     #  CYRILLIC SMALL LETTER ES\r
+    0x0442: 0x00e2,     #  CYRILLIC SMALL LETTER TE\r
+    0x0443: 0x00e3,     #  CYRILLIC SMALL LETTER U\r
+    0x0444: 0x00e4,     #  CYRILLIC SMALL LETTER EF\r
+    0x0445: 0x00e5,     #  CYRILLIC SMALL LETTER HA\r
+    0x0446: 0x00e6,     #  CYRILLIC SMALL LETTER TSE\r
+    0x0447: 0x00e7,     #  CYRILLIC SMALL LETTER CHE\r
+    0x0448: 0x00e8,     #  CYRILLIC SMALL LETTER SHA\r
+    0x0449: 0x00e9,     #  CYRILLIC SMALL LETTER SHCHA\r
+    0x044a: 0x00ea,     #  CYRILLIC SMALL LETTER HARD SIGN\r
+    0x044b: 0x00eb,     #  CYRILLIC SMALL LETTER YERU\r
+    0x044c: 0x00ec,     #  CYRILLIC SMALL LETTER SOFT SIGN\r
+    0x044d: 0x00ed,     #  CYRILLIC SMALL LETTER E\r
+    0x044e: 0x00ee,     #  CYRILLIC SMALL LETTER YU\r
+    0x044f: 0x00ef,     #  CYRILLIC SMALL LETTER YA\r
+    0x0451: 0x00f1,     #  CYRILLIC SMALL LETTER IO\r
+    0x0454: 0x00f3,     #  CYRILLIC SMALL LETTER UKRAINIAN IE\r
+    0x0457: 0x00f5,     #  CYRILLIC SMALL LETTER YI\r
+    0x045e: 0x00f7,     #  CYRILLIC SMALL LETTER SHORT U\r
+    0x2116: 0x00fc,     #  NUMERO SIGN\r
+    0x2219: 0x00f9,     #  BULLET OPERATOR\r
+    0x221a: 0x00fb,     #  SQUARE ROOT\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2552: 0x00d5,     #  BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    0x2553: 0x00d6,     #  BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2555: 0x00b8,     #  BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    0x2556: 0x00b7,     #  BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x2558: 0x00d4,     #  BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    0x2559: 0x00d3,     #  BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255b: 0x00be,     #  BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    0x255c: 0x00bd,     #  BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x255e: 0x00c6,     #  BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    0x255f: 0x00c7,     #  BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2561: 0x00b5,     #  BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    0x2562: 0x00b6,     #  BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2564: 0x00d1,     #  BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    0x2565: 0x00d2,     #  BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2567: 0x00cf,     #  BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    0x2568: 0x00d0,     #  BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256a: 0x00d8,     #  BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    0x256b: 0x00d7,     #  BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x258c: 0x00dd,     #  LEFT HALF BLOCK\r
+    0x2590: 0x00de,     #  RIGHT HALF BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp869.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp869.py
new file mode 100644 (file)
index 0000000..59e3318
--- /dev/null
@@ -0,0 +1,689 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP869.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp869',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: None,       #  UNDEFINED\r
+    0x0081: None,       #  UNDEFINED\r
+    0x0082: None,       #  UNDEFINED\r
+    0x0083: None,       #  UNDEFINED\r
+    0x0084: None,       #  UNDEFINED\r
+    0x0085: None,       #  UNDEFINED\r
+    0x0086: 0x0386,     #  GREEK CAPITAL LETTER ALPHA WITH TONOS\r
+    0x0087: None,       #  UNDEFINED\r
+    0x0088: 0x00b7,     #  MIDDLE DOT\r
+    0x0089: 0x00ac,     #  NOT SIGN\r
+    0x008a: 0x00a6,     #  BROKEN BAR\r
+    0x008b: 0x2018,     #  LEFT SINGLE QUOTATION MARK\r
+    0x008c: 0x2019,     #  RIGHT SINGLE QUOTATION MARK\r
+    0x008d: 0x0388,     #  GREEK CAPITAL LETTER EPSILON WITH TONOS\r
+    0x008e: 0x2015,     #  HORIZONTAL BAR\r
+    0x008f: 0x0389,     #  GREEK CAPITAL LETTER ETA WITH TONOS\r
+    0x0090: 0x038a,     #  GREEK CAPITAL LETTER IOTA WITH TONOS\r
+    0x0091: 0x03aa,     #  GREEK CAPITAL LETTER IOTA WITH DIALYTIKA\r
+    0x0092: 0x038c,     #  GREEK CAPITAL LETTER OMICRON WITH TONOS\r
+    0x0093: None,       #  UNDEFINED\r
+    0x0094: None,       #  UNDEFINED\r
+    0x0095: 0x038e,     #  GREEK CAPITAL LETTER UPSILON WITH TONOS\r
+    0x0096: 0x03ab,     #  GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA\r
+    0x0097: 0x00a9,     #  COPYRIGHT SIGN\r
+    0x0098: 0x038f,     #  GREEK CAPITAL LETTER OMEGA WITH TONOS\r
+    0x0099: 0x00b2,     #  SUPERSCRIPT TWO\r
+    0x009a: 0x00b3,     #  SUPERSCRIPT THREE\r
+    0x009b: 0x03ac,     #  GREEK SMALL LETTER ALPHA WITH TONOS\r
+    0x009c: 0x00a3,     #  POUND SIGN\r
+    0x009d: 0x03ad,     #  GREEK SMALL LETTER EPSILON WITH TONOS\r
+    0x009e: 0x03ae,     #  GREEK SMALL LETTER ETA WITH TONOS\r
+    0x009f: 0x03af,     #  GREEK SMALL LETTER IOTA WITH TONOS\r
+    0x00a0: 0x03ca,     #  GREEK SMALL LETTER IOTA WITH DIALYTIKA\r
+    0x00a1: 0x0390,     #  GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS\r
+    0x00a2: 0x03cc,     #  GREEK SMALL LETTER OMICRON WITH TONOS\r
+    0x00a3: 0x03cd,     #  GREEK SMALL LETTER UPSILON WITH TONOS\r
+    0x00a4: 0x0391,     #  GREEK CAPITAL LETTER ALPHA\r
+    0x00a5: 0x0392,     #  GREEK CAPITAL LETTER BETA\r
+    0x00a6: 0x0393,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x00a7: 0x0394,     #  GREEK CAPITAL LETTER DELTA\r
+    0x00a8: 0x0395,     #  GREEK CAPITAL LETTER EPSILON\r
+    0x00a9: 0x0396,     #  GREEK CAPITAL LETTER ZETA\r
+    0x00aa: 0x0397,     #  GREEK CAPITAL LETTER ETA\r
+    0x00ab: 0x00bd,     #  VULGAR FRACTION ONE HALF\r
+    0x00ac: 0x0398,     #  GREEK CAPITAL LETTER THETA\r
+    0x00ad: 0x0399,     #  GREEK CAPITAL LETTER IOTA\r
+    0x00ae: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00af: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00b0: 0x2591,     #  LIGHT SHADE\r
+    0x00b1: 0x2592,     #  MEDIUM SHADE\r
+    0x00b2: 0x2593,     #  DARK SHADE\r
+    0x00b3: 0x2502,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x00b4: 0x2524,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x00b5: 0x039a,     #  GREEK CAPITAL LETTER KAPPA\r
+    0x00b6: 0x039b,     #  GREEK CAPITAL LETTER LAMDA\r
+    0x00b7: 0x039c,     #  GREEK CAPITAL LETTER MU\r
+    0x00b8: 0x039d,     #  GREEK CAPITAL LETTER NU\r
+    0x00b9: 0x2563,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x00ba: 0x2551,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x00bb: 0x2557,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x00bc: 0x255d,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x00bd: 0x039e,     #  GREEK CAPITAL LETTER XI\r
+    0x00be: 0x039f,     #  GREEK CAPITAL LETTER OMICRON\r
+    0x00bf: 0x2510,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x00c0: 0x2514,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x00c1: 0x2534,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x00c2: 0x252c,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x00c3: 0x251c,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x00c4: 0x2500,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x00c5: 0x253c,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x00c6: 0x03a0,     #  GREEK CAPITAL LETTER PI\r
+    0x00c7: 0x03a1,     #  GREEK CAPITAL LETTER RHO\r
+    0x00c8: 0x255a,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x00c9: 0x2554,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x00ca: 0x2569,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x00cb: 0x2566,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x00cc: 0x2560,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x00cd: 0x2550,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x00ce: 0x256c,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x00cf: 0x03a3,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x00d0: 0x03a4,     #  GREEK CAPITAL LETTER TAU\r
+    0x00d1: 0x03a5,     #  GREEK CAPITAL LETTER UPSILON\r
+    0x00d2: 0x03a6,     #  GREEK CAPITAL LETTER PHI\r
+    0x00d3: 0x03a7,     #  GREEK CAPITAL LETTER CHI\r
+    0x00d4: 0x03a8,     #  GREEK CAPITAL LETTER PSI\r
+    0x00d5: 0x03a9,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x00d6: 0x03b1,     #  GREEK SMALL LETTER ALPHA\r
+    0x00d7: 0x03b2,     #  GREEK SMALL LETTER BETA\r
+    0x00d8: 0x03b3,     #  GREEK SMALL LETTER GAMMA\r
+    0x00d9: 0x2518,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x00da: 0x250c,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x00db: 0x2588,     #  FULL BLOCK\r
+    0x00dc: 0x2584,     #  LOWER HALF BLOCK\r
+    0x00dd: 0x03b4,     #  GREEK SMALL LETTER DELTA\r
+    0x00de: 0x03b5,     #  GREEK SMALL LETTER EPSILON\r
+    0x00df: 0x2580,     #  UPPER HALF BLOCK\r
+    0x00e0: 0x03b6,     #  GREEK SMALL LETTER ZETA\r
+    0x00e1: 0x03b7,     #  GREEK SMALL LETTER ETA\r
+    0x00e2: 0x03b8,     #  GREEK SMALL LETTER THETA\r
+    0x00e3: 0x03b9,     #  GREEK SMALL LETTER IOTA\r
+    0x00e4: 0x03ba,     #  GREEK SMALL LETTER KAPPA\r
+    0x00e5: 0x03bb,     #  GREEK SMALL LETTER LAMDA\r
+    0x00e6: 0x03bc,     #  GREEK SMALL LETTER MU\r
+    0x00e7: 0x03bd,     #  GREEK SMALL LETTER NU\r
+    0x00e8: 0x03be,     #  GREEK SMALL LETTER XI\r
+    0x00e9: 0x03bf,     #  GREEK SMALL LETTER OMICRON\r
+    0x00ea: 0x03c0,     #  GREEK SMALL LETTER PI\r
+    0x00eb: 0x03c1,     #  GREEK SMALL LETTER RHO\r
+    0x00ec: 0x03c3,     #  GREEK SMALL LETTER SIGMA\r
+    0x00ed: 0x03c2,     #  GREEK SMALL LETTER FINAL SIGMA\r
+    0x00ee: 0x03c4,     #  GREEK SMALL LETTER TAU\r
+    0x00ef: 0x0384,     #  GREEK TONOS\r
+    0x00f0: 0x00ad,     #  SOFT HYPHEN\r
+    0x00f1: 0x00b1,     #  PLUS-MINUS SIGN\r
+    0x00f2: 0x03c5,     #  GREEK SMALL LETTER UPSILON\r
+    0x00f3: 0x03c6,     #  GREEK SMALL LETTER PHI\r
+    0x00f4: 0x03c7,     #  GREEK SMALL LETTER CHI\r
+    0x00f5: 0x00a7,     #  SECTION SIGN\r
+    0x00f6: 0x03c8,     #  GREEK SMALL LETTER PSI\r
+    0x00f7: 0x0385,     #  GREEK DIALYTIKA TONOS\r
+    0x00f8: 0x00b0,     #  DEGREE SIGN\r
+    0x00f9: 0x00a8,     #  DIAERESIS\r
+    0x00fa: 0x03c9,     #  GREEK SMALL LETTER OMEGA\r
+    0x00fb: 0x03cb,     #  GREEK SMALL LETTER UPSILON WITH DIALYTIKA\r
+    0x00fc: 0x03b0,     #  GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS\r
+    0x00fd: 0x03ce,     #  GREEK SMALL LETTER OMEGA WITH TONOS\r
+    0x00fe: 0x25a0,     #  BLACK SQUARE\r
+    0x00ff: 0x00a0,     #  NO-BREAK SPACE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> NULL\r
+    u'\x01'     #  0x0001 -> START OF HEADING\r
+    u'\x02'     #  0x0002 -> START OF TEXT\r
+    u'\x03'     #  0x0003 -> END OF TEXT\r
+    u'\x04'     #  0x0004 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x0005 -> ENQUIRY\r
+    u'\x06'     #  0x0006 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x0007 -> BELL\r
+    u'\x08'     #  0x0008 -> BACKSPACE\r
+    u'\t'       #  0x0009 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x000a -> LINE FEED\r
+    u'\x0b'     #  0x000b -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x000c -> FORM FEED\r
+    u'\r'       #  0x000d -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x000e -> SHIFT OUT\r
+    u'\x0f'     #  0x000f -> SHIFT IN\r
+    u'\x10'     #  0x0010 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x0011 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x0012 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x0013 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x0014 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x0015 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x0016 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x0017 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x0018 -> CANCEL\r
+    u'\x19'     #  0x0019 -> END OF MEDIUM\r
+    u'\x1a'     #  0x001a -> SUBSTITUTE\r
+    u'\x1b'     #  0x001b -> ESCAPE\r
+    u'\x1c'     #  0x001c -> FILE SEPARATOR\r
+    u'\x1d'     #  0x001d -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x001e -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x001f -> UNIT SEPARATOR\r
+    u' '        #  0x0020 -> SPACE\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK\r
+    u'"'        #  0x0022 -> QUOTATION MARK\r
+    u'#'        #  0x0023 -> NUMBER SIGN\r
+    u'$'        #  0x0024 -> DOLLAR SIGN\r
+    u'%'        #  0x0025 -> PERCENT SIGN\r
+    u'&'        #  0x0026 -> AMPERSAND\r
+    u"'"        #  0x0027 -> APOSTROPHE\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x002a -> ASTERISK\r
+    u'+'        #  0x002b -> PLUS SIGN\r
+    u','        #  0x002c -> COMMA\r
+    u'-'        #  0x002d -> HYPHEN-MINUS\r
+    u'.'        #  0x002e -> FULL STOP\r
+    u'/'        #  0x002f -> SOLIDUS\r
+    u'0'        #  0x0030 -> DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE\r
+    u':'        #  0x003a -> COLON\r
+    u';'        #  0x003b -> SEMICOLON\r
+    u'<'        #  0x003c -> LESS-THAN SIGN\r
+    u'='        #  0x003d -> EQUALS SIGN\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN\r
+    u'?'        #  0x003f -> QUESTION MARK\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x005f -> LOW LINE\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET\r
+    u'|'        #  0x007c -> VERTICAL LINE\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> DELETE\r
+    u'\ufffe'   #  0x0080 -> UNDEFINED\r
+    u'\ufffe'   #  0x0081 -> UNDEFINED\r
+    u'\ufffe'   #  0x0082 -> UNDEFINED\r
+    u'\ufffe'   #  0x0083 -> UNDEFINED\r
+    u'\ufffe'   #  0x0084 -> UNDEFINED\r
+    u'\ufffe'   #  0x0085 -> UNDEFINED\r
+    u'\u0386'   #  0x0086 -> GREEK CAPITAL LETTER ALPHA WITH TONOS\r
+    u'\ufffe'   #  0x0087 -> UNDEFINED\r
+    u'\xb7'     #  0x0088 -> MIDDLE DOT\r
+    u'\xac'     #  0x0089 -> NOT SIGN\r
+    u'\xa6'     #  0x008a -> BROKEN BAR\r
+    u'\u2018'   #  0x008b -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x008c -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u0388'   #  0x008d -> GREEK CAPITAL LETTER EPSILON WITH TONOS\r
+    u'\u2015'   #  0x008e -> HORIZONTAL BAR\r
+    u'\u0389'   #  0x008f -> GREEK CAPITAL LETTER ETA WITH TONOS\r
+    u'\u038a'   #  0x0090 -> GREEK CAPITAL LETTER IOTA WITH TONOS\r
+    u'\u03aa'   #  0x0091 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA\r
+    u'\u038c'   #  0x0092 -> GREEK CAPITAL LETTER OMICRON WITH TONOS\r
+    u'\ufffe'   #  0x0093 -> UNDEFINED\r
+    u'\ufffe'   #  0x0094 -> UNDEFINED\r
+    u'\u038e'   #  0x0095 -> GREEK CAPITAL LETTER UPSILON WITH TONOS\r
+    u'\u03ab'   #  0x0096 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA\r
+    u'\xa9'     #  0x0097 -> COPYRIGHT SIGN\r
+    u'\u038f'   #  0x0098 -> GREEK CAPITAL LETTER OMEGA WITH TONOS\r
+    u'\xb2'     #  0x0099 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0x009a -> SUPERSCRIPT THREE\r
+    u'\u03ac'   #  0x009b -> GREEK SMALL LETTER ALPHA WITH TONOS\r
+    u'\xa3'     #  0x009c -> POUND SIGN\r
+    u'\u03ad'   #  0x009d -> GREEK SMALL LETTER EPSILON WITH TONOS\r
+    u'\u03ae'   #  0x009e -> GREEK SMALL LETTER ETA WITH TONOS\r
+    u'\u03af'   #  0x009f -> GREEK SMALL LETTER IOTA WITH TONOS\r
+    u'\u03ca'   #  0x00a0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA\r
+    u'\u0390'   #  0x00a1 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS\r
+    u'\u03cc'   #  0x00a2 -> GREEK SMALL LETTER OMICRON WITH TONOS\r
+    u'\u03cd'   #  0x00a3 -> GREEK SMALL LETTER UPSILON WITH TONOS\r
+    u'\u0391'   #  0x00a4 -> GREEK CAPITAL LETTER ALPHA\r
+    u'\u0392'   #  0x00a5 -> GREEK CAPITAL LETTER BETA\r
+    u'\u0393'   #  0x00a6 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u0394'   #  0x00a7 -> GREEK CAPITAL LETTER DELTA\r
+    u'\u0395'   #  0x00a8 -> GREEK CAPITAL LETTER EPSILON\r
+    u'\u0396'   #  0x00a9 -> GREEK CAPITAL LETTER ZETA\r
+    u'\u0397'   #  0x00aa -> GREEK CAPITAL LETTER ETA\r
+    u'\xbd'     #  0x00ab -> VULGAR FRACTION ONE HALF\r
+    u'\u0398'   #  0x00ac -> GREEK CAPITAL LETTER THETA\r
+    u'\u0399'   #  0x00ad -> GREEK CAPITAL LETTER IOTA\r
+    u'\xab'     #  0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2591'   #  0x00b0 -> LIGHT SHADE\r
+    u'\u2592'   #  0x00b1 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x00b2 -> DARK SHADE\r
+    u'\u2502'   #  0x00b3 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u2524'   #  0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u039a'   #  0x00b5 -> GREEK CAPITAL LETTER KAPPA\r
+    u'\u039b'   #  0x00b6 -> GREEK CAPITAL LETTER LAMDA\r
+    u'\u039c'   #  0x00b7 -> GREEK CAPITAL LETTER MU\r
+    u'\u039d'   #  0x00b8 -> GREEK CAPITAL LETTER NU\r
+    u'\u2563'   #  0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2551'   #  0x00ba -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2557'   #  0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u255d'   #  0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u039e'   #  0x00bd -> GREEK CAPITAL LETTER XI\r
+    u'\u039f'   #  0x00be -> GREEK CAPITAL LETTER OMICRON\r
+    u'\u2510'   #  0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2534'   #  0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u252c'   #  0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u251c'   #  0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2500'   #  0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u253c'   #  0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u03a0'   #  0x00c6 -> GREEK CAPITAL LETTER PI\r
+    u'\u03a1'   #  0x00c7 -> GREEK CAPITAL LETTER RHO\r
+    u'\u255a'   #  0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u2554'   #  0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2569'   #  0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u2566'   #  0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2560'   #  0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2550'   #  0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u256c'   #  0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\u03a3'   #  0x00cf -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03a4'   #  0x00d0 -> GREEK CAPITAL LETTER TAU\r
+    u'\u03a5'   #  0x00d1 -> GREEK CAPITAL LETTER UPSILON\r
+    u'\u03a6'   #  0x00d2 -> GREEK CAPITAL LETTER PHI\r
+    u'\u03a7'   #  0x00d3 -> GREEK CAPITAL LETTER CHI\r
+    u'\u03a8'   #  0x00d4 -> GREEK CAPITAL LETTER PSI\r
+    u'\u03a9'   #  0x00d5 -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03b1'   #  0x00d6 -> GREEK SMALL LETTER ALPHA\r
+    u'\u03b2'   #  0x00d7 -> GREEK SMALL LETTER BETA\r
+    u'\u03b3'   #  0x00d8 -> GREEK SMALL LETTER GAMMA\r
+    u'\u2518'   #  0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u250c'   #  0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2588'   #  0x00db -> FULL BLOCK\r
+    u'\u2584'   #  0x00dc -> LOWER HALF BLOCK\r
+    u'\u03b4'   #  0x00dd -> GREEK SMALL LETTER DELTA\r
+    u'\u03b5'   #  0x00de -> GREEK SMALL LETTER EPSILON\r
+    u'\u2580'   #  0x00df -> UPPER HALF BLOCK\r
+    u'\u03b6'   #  0x00e0 -> GREEK SMALL LETTER ZETA\r
+    u'\u03b7'   #  0x00e1 -> GREEK SMALL LETTER ETA\r
+    u'\u03b8'   #  0x00e2 -> GREEK SMALL LETTER THETA\r
+    u'\u03b9'   #  0x00e3 -> GREEK SMALL LETTER IOTA\r
+    u'\u03ba'   #  0x00e4 -> GREEK SMALL LETTER KAPPA\r
+    u'\u03bb'   #  0x00e5 -> GREEK SMALL LETTER LAMDA\r
+    u'\u03bc'   #  0x00e6 -> GREEK SMALL LETTER MU\r
+    u'\u03bd'   #  0x00e7 -> GREEK SMALL LETTER NU\r
+    u'\u03be'   #  0x00e8 -> GREEK SMALL LETTER XI\r
+    u'\u03bf'   #  0x00e9 -> GREEK SMALL LETTER OMICRON\r
+    u'\u03c0'   #  0x00ea -> GREEK SMALL LETTER PI\r
+    u'\u03c1'   #  0x00eb -> GREEK SMALL LETTER RHO\r
+    u'\u03c3'   #  0x00ec -> GREEK SMALL LETTER SIGMA\r
+    u'\u03c2'   #  0x00ed -> GREEK SMALL LETTER FINAL SIGMA\r
+    u'\u03c4'   #  0x00ee -> GREEK SMALL LETTER TAU\r
+    u'\u0384'   #  0x00ef -> GREEK TONOS\r
+    u'\xad'     #  0x00f0 -> SOFT HYPHEN\r
+    u'\xb1'     #  0x00f1 -> PLUS-MINUS SIGN\r
+    u'\u03c5'   #  0x00f2 -> GREEK SMALL LETTER UPSILON\r
+    u'\u03c6'   #  0x00f3 -> GREEK SMALL LETTER PHI\r
+    u'\u03c7'   #  0x00f4 -> GREEK SMALL LETTER CHI\r
+    u'\xa7'     #  0x00f5 -> SECTION SIGN\r
+    u'\u03c8'   #  0x00f6 -> GREEK SMALL LETTER PSI\r
+    u'\u0385'   #  0x00f7 -> GREEK DIALYTIKA TONOS\r
+    u'\xb0'     #  0x00f8 -> DEGREE SIGN\r
+    u'\xa8'     #  0x00f9 -> DIAERESIS\r
+    u'\u03c9'   #  0x00fa -> GREEK SMALL LETTER OMEGA\r
+    u'\u03cb'   #  0x00fb -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA\r
+    u'\u03b0'   #  0x00fc -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS\r
+    u'\u03ce'   #  0x00fd -> GREEK SMALL LETTER OMEGA WITH TONOS\r
+    u'\u25a0'   #  0x00fe -> BLACK SQUARE\r
+    u'\xa0'     #  0x00ff -> NO-BREAK SPACE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  NULL\r
+    0x0001: 0x0001,     #  START OF HEADING\r
+    0x0002: 0x0002,     #  START OF TEXT\r
+    0x0003: 0x0003,     #  END OF TEXT\r
+    0x0004: 0x0004,     #  END OF TRANSMISSION\r
+    0x0005: 0x0005,     #  ENQUIRY\r
+    0x0006: 0x0006,     #  ACKNOWLEDGE\r
+    0x0007: 0x0007,     #  BELL\r
+    0x0008: 0x0008,     #  BACKSPACE\r
+    0x0009: 0x0009,     #  HORIZONTAL TABULATION\r
+    0x000a: 0x000a,     #  LINE FEED\r
+    0x000b: 0x000b,     #  VERTICAL TABULATION\r
+    0x000c: 0x000c,     #  FORM FEED\r
+    0x000d: 0x000d,     #  CARRIAGE RETURN\r
+    0x000e: 0x000e,     #  SHIFT OUT\r
+    0x000f: 0x000f,     #  SHIFT IN\r
+    0x0010: 0x0010,     #  DATA LINK ESCAPE\r
+    0x0011: 0x0011,     #  DEVICE CONTROL ONE\r
+    0x0012: 0x0012,     #  DEVICE CONTROL TWO\r
+    0x0013: 0x0013,     #  DEVICE CONTROL THREE\r
+    0x0014: 0x0014,     #  DEVICE CONTROL FOUR\r
+    0x0015: 0x0015,     #  NEGATIVE ACKNOWLEDGE\r
+    0x0016: 0x0016,     #  SYNCHRONOUS IDLE\r
+    0x0017: 0x0017,     #  END OF TRANSMISSION BLOCK\r
+    0x0018: 0x0018,     #  CANCEL\r
+    0x0019: 0x0019,     #  END OF MEDIUM\r
+    0x001a: 0x001a,     #  SUBSTITUTE\r
+    0x001b: 0x001b,     #  ESCAPE\r
+    0x001c: 0x001c,     #  FILE SEPARATOR\r
+    0x001d: 0x001d,     #  GROUP SEPARATOR\r
+    0x001e: 0x001e,     #  RECORD SEPARATOR\r
+    0x001f: 0x001f,     #  UNIT SEPARATOR\r
+    0x0020: 0x0020,     #  SPACE\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK\r
+    0x0022: 0x0022,     #  QUOTATION MARK\r
+    0x0023: 0x0023,     #  NUMBER SIGN\r
+    0x0024: 0x0024,     #  DOLLAR SIGN\r
+    0x0025: 0x0025,     #  PERCENT SIGN\r
+    0x0026: 0x0026,     #  AMPERSAND\r
+    0x0027: 0x0027,     #  APOSTROPHE\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS\r
+    0x002a: 0x002a,     #  ASTERISK\r
+    0x002b: 0x002b,     #  PLUS SIGN\r
+    0x002c: 0x002c,     #  COMMA\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS\r
+    0x002e: 0x002e,     #  FULL STOP\r
+    0x002f: 0x002f,     #  SOLIDUS\r
+    0x0030: 0x0030,     #  DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON\r
+    0x003b: 0x003b,     #  SEMICOLON\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN\r
+    0x003d: 0x003d,     #  EQUALS SIGN\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN\r
+    0x003f: 0x003f,     #  QUESTION MARK\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT\r
+    0x005f: 0x005f,     #  LOW LINE\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET\r
+    0x007c: 0x007c,     #  VERTICAL LINE\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  DELETE\r
+    0x00a0: 0x00ff,     #  NO-BREAK SPACE\r
+    0x00a3: 0x009c,     #  POUND SIGN\r
+    0x00a6: 0x008a,     #  BROKEN BAR\r
+    0x00a7: 0x00f5,     #  SECTION SIGN\r
+    0x00a8: 0x00f9,     #  DIAERESIS\r
+    0x00a9: 0x0097,     #  COPYRIGHT SIGN\r
+    0x00ab: 0x00ae,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00ac: 0x0089,     #  NOT SIGN\r
+    0x00ad: 0x00f0,     #  SOFT HYPHEN\r
+    0x00b0: 0x00f8,     #  DEGREE SIGN\r
+    0x00b1: 0x00f1,     #  PLUS-MINUS SIGN\r
+    0x00b2: 0x0099,     #  SUPERSCRIPT TWO\r
+    0x00b3: 0x009a,     #  SUPERSCRIPT THREE\r
+    0x00b7: 0x0088,     #  MIDDLE DOT\r
+    0x00bb: 0x00af,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    0x00bd: 0x00ab,     #  VULGAR FRACTION ONE HALF\r
+    0x0384: 0x00ef,     #  GREEK TONOS\r
+    0x0385: 0x00f7,     #  GREEK DIALYTIKA TONOS\r
+    0x0386: 0x0086,     #  GREEK CAPITAL LETTER ALPHA WITH TONOS\r
+    0x0388: 0x008d,     #  GREEK CAPITAL LETTER EPSILON WITH TONOS\r
+    0x0389: 0x008f,     #  GREEK CAPITAL LETTER ETA WITH TONOS\r
+    0x038a: 0x0090,     #  GREEK CAPITAL LETTER IOTA WITH TONOS\r
+    0x038c: 0x0092,     #  GREEK CAPITAL LETTER OMICRON WITH TONOS\r
+    0x038e: 0x0095,     #  GREEK CAPITAL LETTER UPSILON WITH TONOS\r
+    0x038f: 0x0098,     #  GREEK CAPITAL LETTER OMEGA WITH TONOS\r
+    0x0390: 0x00a1,     #  GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS\r
+    0x0391: 0x00a4,     #  GREEK CAPITAL LETTER ALPHA\r
+    0x0392: 0x00a5,     #  GREEK CAPITAL LETTER BETA\r
+    0x0393: 0x00a6,     #  GREEK CAPITAL LETTER GAMMA\r
+    0x0394: 0x00a7,     #  GREEK CAPITAL LETTER DELTA\r
+    0x0395: 0x00a8,     #  GREEK CAPITAL LETTER EPSILON\r
+    0x0396: 0x00a9,     #  GREEK CAPITAL LETTER ZETA\r
+    0x0397: 0x00aa,     #  GREEK CAPITAL LETTER ETA\r
+    0x0398: 0x00ac,     #  GREEK CAPITAL LETTER THETA\r
+    0x0399: 0x00ad,     #  GREEK CAPITAL LETTER IOTA\r
+    0x039a: 0x00b5,     #  GREEK CAPITAL LETTER KAPPA\r
+    0x039b: 0x00b6,     #  GREEK CAPITAL LETTER LAMDA\r
+    0x039c: 0x00b7,     #  GREEK CAPITAL LETTER MU\r
+    0x039d: 0x00b8,     #  GREEK CAPITAL LETTER NU\r
+    0x039e: 0x00bd,     #  GREEK CAPITAL LETTER XI\r
+    0x039f: 0x00be,     #  GREEK CAPITAL LETTER OMICRON\r
+    0x03a0: 0x00c6,     #  GREEK CAPITAL LETTER PI\r
+    0x03a1: 0x00c7,     #  GREEK CAPITAL LETTER RHO\r
+    0x03a3: 0x00cf,     #  GREEK CAPITAL LETTER SIGMA\r
+    0x03a4: 0x00d0,     #  GREEK CAPITAL LETTER TAU\r
+    0x03a5: 0x00d1,     #  GREEK CAPITAL LETTER UPSILON\r
+    0x03a6: 0x00d2,     #  GREEK CAPITAL LETTER PHI\r
+    0x03a7: 0x00d3,     #  GREEK CAPITAL LETTER CHI\r
+    0x03a8: 0x00d4,     #  GREEK CAPITAL LETTER PSI\r
+    0x03a9: 0x00d5,     #  GREEK CAPITAL LETTER OMEGA\r
+    0x03aa: 0x0091,     #  GREEK CAPITAL LETTER IOTA WITH DIALYTIKA\r
+    0x03ab: 0x0096,     #  GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA\r
+    0x03ac: 0x009b,     #  GREEK SMALL LETTER ALPHA WITH TONOS\r
+    0x03ad: 0x009d,     #  GREEK SMALL LETTER EPSILON WITH TONOS\r
+    0x03ae: 0x009e,     #  GREEK SMALL LETTER ETA WITH TONOS\r
+    0x03af: 0x009f,     #  GREEK SMALL LETTER IOTA WITH TONOS\r
+    0x03b0: 0x00fc,     #  GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS\r
+    0x03b1: 0x00d6,     #  GREEK SMALL LETTER ALPHA\r
+    0x03b2: 0x00d7,     #  GREEK SMALL LETTER BETA\r
+    0x03b3: 0x00d8,     #  GREEK SMALL LETTER GAMMA\r
+    0x03b4: 0x00dd,     #  GREEK SMALL LETTER DELTA\r
+    0x03b5: 0x00de,     #  GREEK SMALL LETTER EPSILON\r
+    0x03b6: 0x00e0,     #  GREEK SMALL LETTER ZETA\r
+    0x03b7: 0x00e1,     #  GREEK SMALL LETTER ETA\r
+    0x03b8: 0x00e2,     #  GREEK SMALL LETTER THETA\r
+    0x03b9: 0x00e3,     #  GREEK SMALL LETTER IOTA\r
+    0x03ba: 0x00e4,     #  GREEK SMALL LETTER KAPPA\r
+    0x03bb: 0x00e5,     #  GREEK SMALL LETTER LAMDA\r
+    0x03bc: 0x00e6,     #  GREEK SMALL LETTER MU\r
+    0x03bd: 0x00e7,     #  GREEK SMALL LETTER NU\r
+    0x03be: 0x00e8,     #  GREEK SMALL LETTER XI\r
+    0x03bf: 0x00e9,     #  GREEK SMALL LETTER OMICRON\r
+    0x03c0: 0x00ea,     #  GREEK SMALL LETTER PI\r
+    0x03c1: 0x00eb,     #  GREEK SMALL LETTER RHO\r
+    0x03c2: 0x00ed,     #  GREEK SMALL LETTER FINAL SIGMA\r
+    0x03c3: 0x00ec,     #  GREEK SMALL LETTER SIGMA\r
+    0x03c4: 0x00ee,     #  GREEK SMALL LETTER TAU\r
+    0x03c5: 0x00f2,     #  GREEK SMALL LETTER UPSILON\r
+    0x03c6: 0x00f3,     #  GREEK SMALL LETTER PHI\r
+    0x03c7: 0x00f4,     #  GREEK SMALL LETTER CHI\r
+    0x03c8: 0x00f6,     #  GREEK SMALL LETTER PSI\r
+    0x03c9: 0x00fa,     #  GREEK SMALL LETTER OMEGA\r
+    0x03ca: 0x00a0,     #  GREEK SMALL LETTER IOTA WITH DIALYTIKA\r
+    0x03cb: 0x00fb,     #  GREEK SMALL LETTER UPSILON WITH DIALYTIKA\r
+    0x03cc: 0x00a2,     #  GREEK SMALL LETTER OMICRON WITH TONOS\r
+    0x03cd: 0x00a3,     #  GREEK SMALL LETTER UPSILON WITH TONOS\r
+    0x03ce: 0x00fd,     #  GREEK SMALL LETTER OMEGA WITH TONOS\r
+    0x2015: 0x008e,     #  HORIZONTAL BAR\r
+    0x2018: 0x008b,     #  LEFT SINGLE QUOTATION MARK\r
+    0x2019: 0x008c,     #  RIGHT SINGLE QUOTATION MARK\r
+    0x2500: 0x00c4,     #  BOX DRAWINGS LIGHT HORIZONTAL\r
+    0x2502: 0x00b3,     #  BOX DRAWINGS LIGHT VERTICAL\r
+    0x250c: 0x00da,     #  BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    0x2510: 0x00bf,     #  BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    0x2514: 0x00c0,     #  BOX DRAWINGS LIGHT UP AND RIGHT\r
+    0x2518: 0x00d9,     #  BOX DRAWINGS LIGHT UP AND LEFT\r
+    0x251c: 0x00c3,     #  BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    0x2524: 0x00b4,     #  BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    0x252c: 0x00c2,     #  BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    0x2534: 0x00c1,     #  BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    0x253c: 0x00c5,     #  BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    0x2550: 0x00cd,     #  BOX DRAWINGS DOUBLE HORIZONTAL\r
+    0x2551: 0x00ba,     #  BOX DRAWINGS DOUBLE VERTICAL\r
+    0x2554: 0x00c9,     #  BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    0x2557: 0x00bb,     #  BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    0x255a: 0x00c8,     #  BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    0x255d: 0x00bc,     #  BOX DRAWINGS DOUBLE UP AND LEFT\r
+    0x2560: 0x00cc,     #  BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    0x2563: 0x00b9,     #  BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    0x2566: 0x00cb,     #  BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    0x2569: 0x00ca,     #  BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    0x256c: 0x00ce,     #  BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    0x2580: 0x00df,     #  UPPER HALF BLOCK\r
+    0x2584: 0x00dc,     #  LOWER HALF BLOCK\r
+    0x2588: 0x00db,     #  FULL BLOCK\r
+    0x2591: 0x00b0,     #  LIGHT SHADE\r
+    0x2592: 0x00b1,     #  MEDIUM SHADE\r
+    0x2593: 0x00b2,     #  DARK SHADE\r
+    0x25a0: 0x00fe,     #  BLACK SQUARE\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp874.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp874.py
new file mode 100644 (file)
index 0000000..66f112f
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp874 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP874.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp874',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u20ac'   #  0x80 -> EURO SIGN\r
+    u'\ufffe'   #  0x81 -> UNDEFINED\r
+    u'\ufffe'   #  0x82 -> UNDEFINED\r
+    u'\ufffe'   #  0x83 -> UNDEFINED\r
+    u'\ufffe'   #  0x84 -> UNDEFINED\r
+    u'\u2026'   #  0x85 -> HORIZONTAL ELLIPSIS\r
+    u'\ufffe'   #  0x86 -> UNDEFINED\r
+    u'\ufffe'   #  0x87 -> UNDEFINED\r
+    u'\ufffe'   #  0x88 -> UNDEFINED\r
+    u'\ufffe'   #  0x89 -> UNDEFINED\r
+    u'\ufffe'   #  0x8A -> UNDEFINED\r
+    u'\ufffe'   #  0x8B -> UNDEFINED\r
+    u'\ufffe'   #  0x8C -> UNDEFINED\r
+    u'\ufffe'   #  0x8D -> UNDEFINED\r
+    u'\ufffe'   #  0x8E -> UNDEFINED\r
+    u'\ufffe'   #  0x8F -> UNDEFINED\r
+    u'\ufffe'   #  0x90 -> UNDEFINED\r
+    u'\u2018'   #  0x91 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0x92 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\u201c'   #  0x93 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0x94 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2022'   #  0x95 -> BULLET\r
+    u'\u2013'   #  0x96 -> EN DASH\r
+    u'\u2014'   #  0x97 -> EM DASH\r
+    u'\ufffe'   #  0x98 -> UNDEFINED\r
+    u'\ufffe'   #  0x99 -> UNDEFINED\r
+    u'\ufffe'   #  0x9A -> UNDEFINED\r
+    u'\ufffe'   #  0x9B -> UNDEFINED\r
+    u'\ufffe'   #  0x9C -> UNDEFINED\r
+    u'\ufffe'   #  0x9D -> UNDEFINED\r
+    u'\ufffe'   #  0x9E -> UNDEFINED\r
+    u'\ufffe'   #  0x9F -> UNDEFINED\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u0e01'   #  0xA1 -> THAI CHARACTER KO KAI\r
+    u'\u0e02'   #  0xA2 -> THAI CHARACTER KHO KHAI\r
+    u'\u0e03'   #  0xA3 -> THAI CHARACTER KHO KHUAT\r
+    u'\u0e04'   #  0xA4 -> THAI CHARACTER KHO KHWAI\r
+    u'\u0e05'   #  0xA5 -> THAI CHARACTER KHO KHON\r
+    u'\u0e06'   #  0xA6 -> THAI CHARACTER KHO RAKHANG\r
+    u'\u0e07'   #  0xA7 -> THAI CHARACTER NGO NGU\r
+    u'\u0e08'   #  0xA8 -> THAI CHARACTER CHO CHAN\r
+    u'\u0e09'   #  0xA9 -> THAI CHARACTER CHO CHING\r
+    u'\u0e0a'   #  0xAA -> THAI CHARACTER CHO CHANG\r
+    u'\u0e0b'   #  0xAB -> THAI CHARACTER SO SO\r
+    u'\u0e0c'   #  0xAC -> THAI CHARACTER CHO CHOE\r
+    u'\u0e0d'   #  0xAD -> THAI CHARACTER YO YING\r
+    u'\u0e0e'   #  0xAE -> THAI CHARACTER DO CHADA\r
+    u'\u0e0f'   #  0xAF -> THAI CHARACTER TO PATAK\r
+    u'\u0e10'   #  0xB0 -> THAI CHARACTER THO THAN\r
+    u'\u0e11'   #  0xB1 -> THAI CHARACTER THO NANGMONTHO\r
+    u'\u0e12'   #  0xB2 -> THAI CHARACTER THO PHUTHAO\r
+    u'\u0e13'   #  0xB3 -> THAI CHARACTER NO NEN\r
+    u'\u0e14'   #  0xB4 -> THAI CHARACTER DO DEK\r
+    u'\u0e15'   #  0xB5 -> THAI CHARACTER TO TAO\r
+    u'\u0e16'   #  0xB6 -> THAI CHARACTER THO THUNG\r
+    u'\u0e17'   #  0xB7 -> THAI CHARACTER THO THAHAN\r
+    u'\u0e18'   #  0xB8 -> THAI CHARACTER THO THONG\r
+    u'\u0e19'   #  0xB9 -> THAI CHARACTER NO NU\r
+    u'\u0e1a'   #  0xBA -> THAI CHARACTER BO BAIMAI\r
+    u'\u0e1b'   #  0xBB -> THAI CHARACTER PO PLA\r
+    u'\u0e1c'   #  0xBC -> THAI CHARACTER PHO PHUNG\r
+    u'\u0e1d'   #  0xBD -> THAI CHARACTER FO FA\r
+    u'\u0e1e'   #  0xBE -> THAI CHARACTER PHO PHAN\r
+    u'\u0e1f'   #  0xBF -> THAI CHARACTER FO FAN\r
+    u'\u0e20'   #  0xC0 -> THAI CHARACTER PHO SAMPHAO\r
+    u'\u0e21'   #  0xC1 -> THAI CHARACTER MO MA\r
+    u'\u0e22'   #  0xC2 -> THAI CHARACTER YO YAK\r
+    u'\u0e23'   #  0xC3 -> THAI CHARACTER RO RUA\r
+    u'\u0e24'   #  0xC4 -> THAI CHARACTER RU\r
+    u'\u0e25'   #  0xC5 -> THAI CHARACTER LO LING\r
+    u'\u0e26'   #  0xC6 -> THAI CHARACTER LU\r
+    u'\u0e27'   #  0xC7 -> THAI CHARACTER WO WAEN\r
+    u'\u0e28'   #  0xC8 -> THAI CHARACTER SO SALA\r
+    u'\u0e29'   #  0xC9 -> THAI CHARACTER SO RUSI\r
+    u'\u0e2a'   #  0xCA -> THAI CHARACTER SO SUA\r
+    u'\u0e2b'   #  0xCB -> THAI CHARACTER HO HIP\r
+    u'\u0e2c'   #  0xCC -> THAI CHARACTER LO CHULA\r
+    u'\u0e2d'   #  0xCD -> THAI CHARACTER O ANG\r
+    u'\u0e2e'   #  0xCE -> THAI CHARACTER HO NOKHUK\r
+    u'\u0e2f'   #  0xCF -> THAI CHARACTER PAIYANNOI\r
+    u'\u0e30'   #  0xD0 -> THAI CHARACTER SARA A\r
+    u'\u0e31'   #  0xD1 -> THAI CHARACTER MAI HAN-AKAT\r
+    u'\u0e32'   #  0xD2 -> THAI CHARACTER SARA AA\r
+    u'\u0e33'   #  0xD3 -> THAI CHARACTER SARA AM\r
+    u'\u0e34'   #  0xD4 -> THAI CHARACTER SARA I\r
+    u'\u0e35'   #  0xD5 -> THAI CHARACTER SARA II\r
+    u'\u0e36'   #  0xD6 -> THAI CHARACTER SARA UE\r
+    u'\u0e37'   #  0xD7 -> THAI CHARACTER SARA UEE\r
+    u'\u0e38'   #  0xD8 -> THAI CHARACTER SARA U\r
+    u'\u0e39'   #  0xD9 -> THAI CHARACTER SARA UU\r
+    u'\u0e3a'   #  0xDA -> THAI CHARACTER PHINTHU\r
+    u'\ufffe'   #  0xDB -> UNDEFINED\r
+    u'\ufffe'   #  0xDC -> UNDEFINED\r
+    u'\ufffe'   #  0xDD -> UNDEFINED\r
+    u'\ufffe'   #  0xDE -> UNDEFINED\r
+    u'\u0e3f'   #  0xDF -> THAI CURRENCY SYMBOL BAHT\r
+    u'\u0e40'   #  0xE0 -> THAI CHARACTER SARA E\r
+    u'\u0e41'   #  0xE1 -> THAI CHARACTER SARA AE\r
+    u'\u0e42'   #  0xE2 -> THAI CHARACTER SARA O\r
+    u'\u0e43'   #  0xE3 -> THAI CHARACTER SARA AI MAIMUAN\r
+    u'\u0e44'   #  0xE4 -> THAI CHARACTER SARA AI MAIMALAI\r
+    u'\u0e45'   #  0xE5 -> THAI CHARACTER LAKKHANGYAO\r
+    u'\u0e46'   #  0xE6 -> THAI CHARACTER MAIYAMOK\r
+    u'\u0e47'   #  0xE7 -> THAI CHARACTER MAITAIKHU\r
+    u'\u0e48'   #  0xE8 -> THAI CHARACTER MAI EK\r
+    u'\u0e49'   #  0xE9 -> THAI CHARACTER MAI THO\r
+    u'\u0e4a'   #  0xEA -> THAI CHARACTER MAI TRI\r
+    u'\u0e4b'   #  0xEB -> THAI CHARACTER MAI CHATTAWA\r
+    u'\u0e4c'   #  0xEC -> THAI CHARACTER THANTHAKHAT\r
+    u'\u0e4d'   #  0xED -> THAI CHARACTER NIKHAHIT\r
+    u'\u0e4e'   #  0xEE -> THAI CHARACTER YAMAKKAN\r
+    u'\u0e4f'   #  0xEF -> THAI CHARACTER FONGMAN\r
+    u'\u0e50'   #  0xF0 -> THAI DIGIT ZERO\r
+    u'\u0e51'   #  0xF1 -> THAI DIGIT ONE\r
+    u'\u0e52'   #  0xF2 -> THAI DIGIT TWO\r
+    u'\u0e53'   #  0xF3 -> THAI DIGIT THREE\r
+    u'\u0e54'   #  0xF4 -> THAI DIGIT FOUR\r
+    u'\u0e55'   #  0xF5 -> THAI DIGIT FIVE\r
+    u'\u0e56'   #  0xF6 -> THAI DIGIT SIX\r
+    u'\u0e57'   #  0xF7 -> THAI DIGIT SEVEN\r
+    u'\u0e58'   #  0xF8 -> THAI DIGIT EIGHT\r
+    u'\u0e59'   #  0xF9 -> THAI DIGIT NINE\r
+    u'\u0e5a'   #  0xFA -> THAI CHARACTER ANGKHANKHU\r
+    u'\u0e5b'   #  0xFB -> THAI CHARACTER KHOMUT\r
+    u'\ufffe'   #  0xFC -> UNDEFINED\r
+    u'\ufffe'   #  0xFD -> UNDEFINED\r
+    u'\ufffe'   #  0xFE -> UNDEFINED\r
+    u'\ufffe'   #  0xFF -> UNDEFINED\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp875.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp875.py
new file mode 100644 (file)
index 0000000..50bbef3
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp875 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP875.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp875',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x9c'     #  0x04 -> CONTROL\r
+    u'\t'       #  0x05 -> HORIZONTAL TABULATION\r
+    u'\x86'     #  0x06 -> CONTROL\r
+    u'\x7f'     #  0x07 -> DELETE\r
+    u'\x97'     #  0x08 -> CONTROL\r
+    u'\x8d'     #  0x09 -> CONTROL\r
+    u'\x8e'     #  0x0A -> CONTROL\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x9d'     #  0x14 -> CONTROL\r
+    u'\x85'     #  0x15 -> CONTROL\r
+    u'\x08'     #  0x16 -> BACKSPACE\r
+    u'\x87'     #  0x17 -> CONTROL\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x92'     #  0x1A -> CONTROL\r
+    u'\x8f'     #  0x1B -> CONTROL\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u'\x80'     #  0x20 -> CONTROL\r
+    u'\x81'     #  0x21 -> CONTROL\r
+    u'\x82'     #  0x22 -> CONTROL\r
+    u'\x83'     #  0x23 -> CONTROL\r
+    u'\x84'     #  0x24 -> CONTROL\r
+    u'\n'       #  0x25 -> LINE FEED\r
+    u'\x17'     #  0x26 -> END OF TRANSMISSION BLOCK\r
+    u'\x1b'     #  0x27 -> ESCAPE\r
+    u'\x88'     #  0x28 -> CONTROL\r
+    u'\x89'     #  0x29 -> CONTROL\r
+    u'\x8a'     #  0x2A -> CONTROL\r
+    u'\x8b'     #  0x2B -> CONTROL\r
+    u'\x8c'     #  0x2C -> CONTROL\r
+    u'\x05'     #  0x2D -> ENQUIRY\r
+    u'\x06'     #  0x2E -> ACKNOWLEDGE\r
+    u'\x07'     #  0x2F -> BELL\r
+    u'\x90'     #  0x30 -> CONTROL\r
+    u'\x91'     #  0x31 -> CONTROL\r
+    u'\x16'     #  0x32 -> SYNCHRONOUS IDLE\r
+    u'\x93'     #  0x33 -> CONTROL\r
+    u'\x94'     #  0x34 -> CONTROL\r
+    u'\x95'     #  0x35 -> CONTROL\r
+    u'\x96'     #  0x36 -> CONTROL\r
+    u'\x04'     #  0x37 -> END OF TRANSMISSION\r
+    u'\x98'     #  0x38 -> CONTROL\r
+    u'\x99'     #  0x39 -> CONTROL\r
+    u'\x9a'     #  0x3A -> CONTROL\r
+    u'\x9b'     #  0x3B -> CONTROL\r
+    u'\x14'     #  0x3C -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x3D -> NEGATIVE ACKNOWLEDGE\r
+    u'\x9e'     #  0x3E -> CONTROL\r
+    u'\x1a'     #  0x3F -> SUBSTITUTE\r
+    u' '        #  0x40 -> SPACE\r
+    u'\u0391'   #  0x41 -> GREEK CAPITAL LETTER ALPHA\r
+    u'\u0392'   #  0x42 -> GREEK CAPITAL LETTER BETA\r
+    u'\u0393'   #  0x43 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u0394'   #  0x44 -> GREEK CAPITAL LETTER DELTA\r
+    u'\u0395'   #  0x45 -> GREEK CAPITAL LETTER EPSILON\r
+    u'\u0396'   #  0x46 -> GREEK CAPITAL LETTER ZETA\r
+    u'\u0397'   #  0x47 -> GREEK CAPITAL LETTER ETA\r
+    u'\u0398'   #  0x48 -> GREEK CAPITAL LETTER THETA\r
+    u'\u0399'   #  0x49 -> GREEK CAPITAL LETTER IOTA\r
+    u'['        #  0x4A -> LEFT SQUARE BRACKET\r
+    u'.'        #  0x4B -> FULL STOP\r
+    u'<'        #  0x4C -> LESS-THAN SIGN\r
+    u'('        #  0x4D -> LEFT PARENTHESIS\r
+    u'+'        #  0x4E -> PLUS SIGN\r
+    u'!'        #  0x4F -> EXCLAMATION MARK\r
+    u'&'        #  0x50 -> AMPERSAND\r
+    u'\u039a'   #  0x51 -> GREEK CAPITAL LETTER KAPPA\r
+    u'\u039b'   #  0x52 -> GREEK CAPITAL LETTER LAMDA\r
+    u'\u039c'   #  0x53 -> GREEK CAPITAL LETTER MU\r
+    u'\u039d'   #  0x54 -> GREEK CAPITAL LETTER NU\r
+    u'\u039e'   #  0x55 -> GREEK CAPITAL LETTER XI\r
+    u'\u039f'   #  0x56 -> GREEK CAPITAL LETTER OMICRON\r
+    u'\u03a0'   #  0x57 -> GREEK CAPITAL LETTER PI\r
+    u'\u03a1'   #  0x58 -> GREEK CAPITAL LETTER RHO\r
+    u'\u03a3'   #  0x59 -> GREEK CAPITAL LETTER SIGMA\r
+    u']'        #  0x5A -> RIGHT SQUARE BRACKET\r
+    u'$'        #  0x5B -> DOLLAR SIGN\r
+    u'*'        #  0x5C -> ASTERISK\r
+    u')'        #  0x5D -> RIGHT PARENTHESIS\r
+    u';'        #  0x5E -> SEMICOLON\r
+    u'^'        #  0x5F -> CIRCUMFLEX ACCENT\r
+    u'-'        #  0x60 -> HYPHEN-MINUS\r
+    u'/'        #  0x61 -> SOLIDUS\r
+    u'\u03a4'   #  0x62 -> GREEK CAPITAL LETTER TAU\r
+    u'\u03a5'   #  0x63 -> GREEK CAPITAL LETTER UPSILON\r
+    u'\u03a6'   #  0x64 -> GREEK CAPITAL LETTER PHI\r
+    u'\u03a7'   #  0x65 -> GREEK CAPITAL LETTER CHI\r
+    u'\u03a8'   #  0x66 -> GREEK CAPITAL LETTER PSI\r
+    u'\u03a9'   #  0x67 -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03aa'   #  0x68 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA\r
+    u'\u03ab'   #  0x69 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA\r
+    u'|'        #  0x6A -> VERTICAL LINE\r
+    u','        #  0x6B -> COMMA\r
+    u'%'        #  0x6C -> PERCENT SIGN\r
+    u'_'        #  0x6D -> LOW LINE\r
+    u'>'        #  0x6E -> GREATER-THAN SIGN\r
+    u'?'        #  0x6F -> QUESTION MARK\r
+    u'\xa8'     #  0x70 -> DIAERESIS\r
+    u'\u0386'   #  0x71 -> GREEK CAPITAL LETTER ALPHA WITH TONOS\r
+    u'\u0388'   #  0x72 -> GREEK CAPITAL LETTER EPSILON WITH TONOS\r
+    u'\u0389'   #  0x73 -> GREEK CAPITAL LETTER ETA WITH TONOS\r
+    u'\xa0'     #  0x74 -> NO-BREAK SPACE\r
+    u'\u038a'   #  0x75 -> GREEK CAPITAL LETTER IOTA WITH TONOS\r
+    u'\u038c'   #  0x76 -> GREEK CAPITAL LETTER OMICRON WITH TONOS\r
+    u'\u038e'   #  0x77 -> GREEK CAPITAL LETTER UPSILON WITH TONOS\r
+    u'\u038f'   #  0x78 -> GREEK CAPITAL LETTER OMEGA WITH TONOS\r
+    u'`'        #  0x79 -> GRAVE ACCENT\r
+    u':'        #  0x7A -> COLON\r
+    u'#'        #  0x7B -> NUMBER SIGN\r
+    u'@'        #  0x7C -> COMMERCIAL AT\r
+    u"'"        #  0x7D -> APOSTROPHE\r
+    u'='        #  0x7E -> EQUALS SIGN\r
+    u'"'        #  0x7F -> QUOTATION MARK\r
+    u'\u0385'   #  0x80 -> GREEK DIALYTIKA TONOS\r
+    u'a'        #  0x81 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x82 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x83 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x84 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x85 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x86 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x87 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x88 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x89 -> LATIN SMALL LETTER I\r
+    u'\u03b1'   #  0x8A -> GREEK SMALL LETTER ALPHA\r
+    u'\u03b2'   #  0x8B -> GREEK SMALL LETTER BETA\r
+    u'\u03b3'   #  0x8C -> GREEK SMALL LETTER GAMMA\r
+    u'\u03b4'   #  0x8D -> GREEK SMALL LETTER DELTA\r
+    u'\u03b5'   #  0x8E -> GREEK SMALL LETTER EPSILON\r
+    u'\u03b6'   #  0x8F -> GREEK SMALL LETTER ZETA\r
+    u'\xb0'     #  0x90 -> DEGREE SIGN\r
+    u'j'        #  0x91 -> LATIN SMALL LETTER J\r
+    u'k'        #  0x92 -> LATIN SMALL LETTER K\r
+    u'l'        #  0x93 -> LATIN SMALL LETTER L\r
+    u'm'        #  0x94 -> LATIN SMALL LETTER M\r
+    u'n'        #  0x95 -> LATIN SMALL LETTER N\r
+    u'o'        #  0x96 -> LATIN SMALL LETTER O\r
+    u'p'        #  0x97 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x98 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x99 -> LATIN SMALL LETTER R\r
+    u'\u03b7'   #  0x9A -> GREEK SMALL LETTER ETA\r
+    u'\u03b8'   #  0x9B -> GREEK SMALL LETTER THETA\r
+    u'\u03b9'   #  0x9C -> GREEK SMALL LETTER IOTA\r
+    u'\u03ba'   #  0x9D -> GREEK SMALL LETTER KAPPA\r
+    u'\u03bb'   #  0x9E -> GREEK SMALL LETTER LAMDA\r
+    u'\u03bc'   #  0x9F -> GREEK SMALL LETTER MU\r
+    u'\xb4'     #  0xA0 -> ACUTE ACCENT\r
+    u'~'        #  0xA1 -> TILDE\r
+    u's'        #  0xA2 -> LATIN SMALL LETTER S\r
+    u't'        #  0xA3 -> LATIN SMALL LETTER T\r
+    u'u'        #  0xA4 -> LATIN SMALL LETTER U\r
+    u'v'        #  0xA5 -> LATIN SMALL LETTER V\r
+    u'w'        #  0xA6 -> LATIN SMALL LETTER W\r
+    u'x'        #  0xA7 -> LATIN SMALL LETTER X\r
+    u'y'        #  0xA8 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0xA9 -> LATIN SMALL LETTER Z\r
+    u'\u03bd'   #  0xAA -> GREEK SMALL LETTER NU\r
+    u'\u03be'   #  0xAB -> GREEK SMALL LETTER XI\r
+    u'\u03bf'   #  0xAC -> GREEK SMALL LETTER OMICRON\r
+    u'\u03c0'   #  0xAD -> GREEK SMALL LETTER PI\r
+    u'\u03c1'   #  0xAE -> GREEK SMALL LETTER RHO\r
+    u'\u03c3'   #  0xAF -> GREEK SMALL LETTER SIGMA\r
+    u'\xa3'     #  0xB0 -> POUND SIGN\r
+    u'\u03ac'   #  0xB1 -> GREEK SMALL LETTER ALPHA WITH TONOS\r
+    u'\u03ad'   #  0xB2 -> GREEK SMALL LETTER EPSILON WITH TONOS\r
+    u'\u03ae'   #  0xB3 -> GREEK SMALL LETTER ETA WITH TONOS\r
+    u'\u03ca'   #  0xB4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA\r
+    u'\u03af'   #  0xB5 -> GREEK SMALL LETTER IOTA WITH TONOS\r
+    u'\u03cc'   #  0xB6 -> GREEK SMALL LETTER OMICRON WITH TONOS\r
+    u'\u03cd'   #  0xB7 -> GREEK SMALL LETTER UPSILON WITH TONOS\r
+    u'\u03cb'   #  0xB8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA\r
+    u'\u03ce'   #  0xB9 -> GREEK SMALL LETTER OMEGA WITH TONOS\r
+    u'\u03c2'   #  0xBA -> GREEK SMALL LETTER FINAL SIGMA\r
+    u'\u03c4'   #  0xBB -> GREEK SMALL LETTER TAU\r
+    u'\u03c5'   #  0xBC -> GREEK SMALL LETTER UPSILON\r
+    u'\u03c6'   #  0xBD -> GREEK SMALL LETTER PHI\r
+    u'\u03c7'   #  0xBE -> GREEK SMALL LETTER CHI\r
+    u'\u03c8'   #  0xBF -> GREEK SMALL LETTER PSI\r
+    u'{'        #  0xC0 -> LEFT CURLY BRACKET\r
+    u'A'        #  0xC1 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0xC2 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0xC3 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0xC4 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0xC5 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0xC6 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0xC7 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0xC8 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0xC9 -> LATIN CAPITAL LETTER I\r
+    u'\xad'     #  0xCA -> SOFT HYPHEN\r
+    u'\u03c9'   #  0xCB -> GREEK SMALL LETTER OMEGA\r
+    u'\u0390'   #  0xCC -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS\r
+    u'\u03b0'   #  0xCD -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS\r
+    u'\u2018'   #  0xCE -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2015'   #  0xCF -> HORIZONTAL BAR\r
+    u'}'        #  0xD0 -> RIGHT CURLY BRACKET\r
+    u'J'        #  0xD1 -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0xD2 -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0xD3 -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0xD4 -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0xD5 -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0xD6 -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0xD7 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0xD8 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0xD9 -> LATIN CAPITAL LETTER R\r
+    u'\xb1'     #  0xDA -> PLUS-MINUS SIGN\r
+    u'\xbd'     #  0xDB -> VULGAR FRACTION ONE HALF\r
+    u'\x1a'     #  0xDC -> SUBSTITUTE\r
+    u'\u0387'   #  0xDD -> GREEK ANO TELEIA\r
+    u'\u2019'   #  0xDE -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xa6'     #  0xDF -> BROKEN BAR\r
+    u'\\'       #  0xE0 -> REVERSE SOLIDUS\r
+    u'\x1a'     #  0xE1 -> SUBSTITUTE\r
+    u'S'        #  0xE2 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0xE3 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0xE4 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0xE5 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0xE6 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0xE7 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0xE8 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0xE9 -> LATIN CAPITAL LETTER Z\r
+    u'\xb2'     #  0xEA -> SUPERSCRIPT TWO\r
+    u'\xa7'     #  0xEB -> SECTION SIGN\r
+    u'\x1a'     #  0xEC -> SUBSTITUTE\r
+    u'\x1a'     #  0xED -> SUBSTITUTE\r
+    u'\xab'     #  0xEE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xEF -> NOT SIGN\r
+    u'0'        #  0xF0 -> DIGIT ZERO\r
+    u'1'        #  0xF1 -> DIGIT ONE\r
+    u'2'        #  0xF2 -> DIGIT TWO\r
+    u'3'        #  0xF3 -> DIGIT THREE\r
+    u'4'        #  0xF4 -> DIGIT FOUR\r
+    u'5'        #  0xF5 -> DIGIT FIVE\r
+    u'6'        #  0xF6 -> DIGIT SIX\r
+    u'7'        #  0xF7 -> DIGIT SEVEN\r
+    u'8'        #  0xF8 -> DIGIT EIGHT\r
+    u'9'        #  0xF9 -> DIGIT NINE\r
+    u'\xb3'     #  0xFA -> SUPERSCRIPT THREE\r
+    u'\xa9'     #  0xFB -> COPYRIGHT SIGN\r
+    u'\x1a'     #  0xFC -> SUBSTITUTE\r
+    u'\x1a'     #  0xFD -> SUBSTITUTE\r
+    u'\xbb'     #  0xFE -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\x9f'     #  0xFF -> CONTROL\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp932.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp932.py
new file mode 100644 (file)
index 0000000..6321c20
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# cp932.py: Python Unicode Codec for CP932\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_jp, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_jp.getcodec('cp932')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp932',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp949.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp949.py
new file mode 100644 (file)
index 0000000..1d9725d
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# cp949.py: Python Unicode Codec for CP949\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_kr, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_kr.getcodec('cp949')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp949',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp950.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp950.py
new file mode 100644 (file)
index 0000000..e7772b1
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# cp950.py: Python Unicode Codec for CP950\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_tw, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_tw.getcodec('cp950')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='cp950',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jis_2004.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jis_2004.py
new file mode 100644 (file)
index 0000000..bb35520
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# euc_jis_2004.py: Python Unicode Codec for EUC_JIS_2004\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_jp, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_jp.getcodec('euc_jis_2004')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='euc_jis_2004',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jisx0213.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jisx0213.py
new file mode 100644 (file)
index 0000000..9914c4f
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# euc_jisx0213.py: Python Unicode Codec for EUC_JISX0213\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_jp, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_jp.getcodec('euc_jisx0213')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='euc_jisx0213',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jp.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jp.py
new file mode 100644 (file)
index 0000000..29406b6
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# euc_jp.py: Python Unicode Codec for EUC_JP\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_jp, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_jp.getcodec('euc_jp')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='euc_jp',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_kr.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_kr.py
new file mode 100644 (file)
index 0000000..7d5eca4
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# euc_kr.py: Python Unicode Codec for EUC_KR\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_kr, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_kr.getcodec('euc_kr')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='euc_kr',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb18030.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb18030.py
new file mode 100644 (file)
index 0000000..99059ff
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# gb18030.py: Python Unicode Codec for GB18030\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_cn, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_cn.getcodec('gb18030')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='gb18030',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb2312.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb2312.py
new file mode 100644 (file)
index 0000000..4e396fa
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# gb2312.py: Python Unicode Codec for GB2312\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_cn, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_cn.getcodec('gb2312')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='gb2312',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gbk.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gbk.py
new file mode 100644 (file)
index 0000000..0fd2734
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# gbk.py: Python Unicode Codec for GBK\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_cn, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_cn.getcodec('gbk')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='gbk',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hex_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hex_codec.py
new file mode 100644 (file)
index 0000000..5262bff
--- /dev/null
@@ -0,0 +1,79 @@
+""" Python 'hex_codec' Codec - 2-digit hex content transfer encoding\r
+\r
+    Unlike most of the other codecs which target Unicode, this codec\r
+    will return Python string objects for both encode and decode.\r
+\r
+    Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+"""\r
+import codecs, binascii\r
+\r
+### Codec APIs\r
+\r
+def hex_encode(input,errors='strict'):\r
+\r
+    """ Encodes the object input and returns a tuple (output\r
+        object, length consumed).\r
+\r
+        errors defines the error handling to apply. It defaults to\r
+        'strict' handling which is the only currently supported\r
+        error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    output = binascii.b2a_hex(input)\r
+    return (output, len(input))\r
+\r
+def hex_decode(input,errors='strict'):\r
+\r
+    """ Decodes the object input and returns a tuple (output\r
+        object, length consumed).\r
+\r
+        input must be an object which provides the bf_getreadbuf\r
+        buffer slot. Python strings, buffer objects and memory\r
+        mapped files are examples of objects providing this slot.\r
+\r
+        errors defines the error handling to apply. It defaults to\r
+        'strict' handling which is the only currently supported\r
+        error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    output = binascii.a2b_hex(input)\r
+    return (output, len(input))\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self, input,errors='strict'):\r
+        return hex_encode(input,errors)\r
+    def decode(self, input,errors='strict'):\r
+        return hex_decode(input,errors)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        assert self.errors == 'strict'\r
+        return binascii.b2a_hex(input)\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        assert self.errors == 'strict'\r
+        return binascii.a2b_hex(input)\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='hex',\r
+        encode=hex_encode,\r
+        decode=hex_decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hp_roman8.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hp_roman8.py
new file mode 100644 (file)
index 0000000..70c1ccc
--- /dev/null
@@ -0,0 +1,152 @@
+""" Python Character Mapping Codec generated from 'hp_roman8.txt' with gencodec.py.\r
+\r
+    Based on data from ftp://dkuug.dk/i18n/charmaps/HP-ROMAN8 (Keld Simonsen)\r
+\r
+    Original source: LaserJet IIP Printer User's Manual HP part no\r
+    33471-90901, Hewlet-Packard, June 1989.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_map)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_map)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='hp-roman8',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+        0x00a1: 0x00c0, #       LATIN CAPITAL LETTER A WITH GRAVE\r
+        0x00a2: 0x00c2, #       LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+        0x00a3: 0x00c8, #       LATIN CAPITAL LETTER E WITH GRAVE\r
+        0x00a4: 0x00ca, #       LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+        0x00a5: 0x00cb, #       LATIN CAPITAL LETTER E WITH DIAERESIS\r
+        0x00a6: 0x00ce, #       LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+        0x00a7: 0x00cf, #       LATIN CAPITAL LETTER I WITH DIAERESIS\r
+        0x00a8: 0x00b4, #       ACUTE ACCENT\r
+        0x00a9: 0x02cb, #       MODIFIER LETTER GRAVE ACCENT (Mandarin Chinese fourth tone)\r
+        0x00aa: 0x02c6, #       MODIFIER LETTER CIRCUMFLEX ACCENT\r
+        0x00ab: 0x00a8, #       DIAERESIS\r
+        0x00ac: 0x02dc, #       SMALL TILDE\r
+        0x00ad: 0x00d9, #       LATIN CAPITAL LETTER U WITH GRAVE\r
+        0x00ae: 0x00db, #       LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+        0x00af: 0x20a4, #       LIRA SIGN\r
+        0x00b0: 0x00af, #       MACRON\r
+        0x00b1: 0x00dd, #       LATIN CAPITAL LETTER Y WITH ACUTE\r
+        0x00b2: 0x00fd, #       LATIN SMALL LETTER Y WITH ACUTE\r
+        0x00b3: 0x00b0, #       DEGREE SIGN\r
+        0x00b4: 0x00c7, #       LATIN CAPITAL LETTER C WITH CEDILLA\r
+        0x00b5: 0x00e7, #       LATIN SMALL LETTER C WITH CEDILLA\r
+        0x00b6: 0x00d1, #       LATIN CAPITAL LETTER N WITH TILDE\r
+        0x00b7: 0x00f1, #       LATIN SMALL LETTER N WITH TILDE\r
+        0x00b8: 0x00a1, #       INVERTED EXCLAMATION MARK\r
+        0x00b9: 0x00bf, #       INVERTED QUESTION MARK\r
+        0x00ba: 0x00a4, #       CURRENCY SIGN\r
+        0x00bb: 0x00a3, #       POUND SIGN\r
+        0x00bc: 0x00a5, #       YEN SIGN\r
+        0x00bd: 0x00a7, #       SECTION SIGN\r
+        0x00be: 0x0192, #       LATIN SMALL LETTER F WITH HOOK\r
+        0x00bf: 0x00a2, #       CENT SIGN\r
+        0x00c0: 0x00e2, #       LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+        0x00c1: 0x00ea, #       LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+        0x00c2: 0x00f4, #       LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+        0x00c3: 0x00fb, #       LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+        0x00c4: 0x00e1, #       LATIN SMALL LETTER A WITH ACUTE\r
+        0x00c5: 0x00e9, #       LATIN SMALL LETTER E WITH ACUTE\r
+        0x00c6: 0x00f3, #       LATIN SMALL LETTER O WITH ACUTE\r
+        0x00c7: 0x00fa, #       LATIN SMALL LETTER U WITH ACUTE\r
+        0x00c8: 0x00e0, #       LATIN SMALL LETTER A WITH GRAVE\r
+        0x00c9: 0x00e8, #       LATIN SMALL LETTER E WITH GRAVE\r
+        0x00ca: 0x00f2, #       LATIN SMALL LETTER O WITH GRAVE\r
+        0x00cb: 0x00f9, #       LATIN SMALL LETTER U WITH GRAVE\r
+        0x00cc: 0x00e4, #       LATIN SMALL LETTER A WITH DIAERESIS\r
+        0x00cd: 0x00eb, #       LATIN SMALL LETTER E WITH DIAERESIS\r
+        0x00ce: 0x00f6, #       LATIN SMALL LETTER O WITH DIAERESIS\r
+        0x00cf: 0x00fc, #       LATIN SMALL LETTER U WITH DIAERESIS\r
+        0x00d0: 0x00c5, #       LATIN CAPITAL LETTER A WITH RING ABOVE\r
+        0x00d1: 0x00ee, #       LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+        0x00d2: 0x00d8, #       LATIN CAPITAL LETTER O WITH STROKE\r
+        0x00d3: 0x00c6, #       LATIN CAPITAL LETTER AE\r
+        0x00d4: 0x00e5, #       LATIN SMALL LETTER A WITH RING ABOVE\r
+        0x00d5: 0x00ed, #       LATIN SMALL LETTER I WITH ACUTE\r
+        0x00d6: 0x00f8, #       LATIN SMALL LETTER O WITH STROKE\r
+        0x00d7: 0x00e6, #       LATIN SMALL LETTER AE\r
+        0x00d8: 0x00c4, #       LATIN CAPITAL LETTER A WITH DIAERESIS\r
+        0x00d9: 0x00ec, #       LATIN SMALL LETTER I WITH GRAVE\r
+        0x00da: 0x00d6, #       LATIN CAPITAL LETTER O WITH DIAERESIS\r
+        0x00db: 0x00dc, #       LATIN CAPITAL LETTER U WITH DIAERESIS\r
+        0x00dc: 0x00c9, #       LATIN CAPITAL LETTER E WITH ACUTE\r
+        0x00dd: 0x00ef, #       LATIN SMALL LETTER I WITH DIAERESIS\r
+        0x00de: 0x00df, #       LATIN SMALL LETTER SHARP S (German)\r
+        0x00df: 0x00d4, #       LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+        0x00e0: 0x00c1, #       LATIN CAPITAL LETTER A WITH ACUTE\r
+        0x00e1: 0x00c3, #       LATIN CAPITAL LETTER A WITH TILDE\r
+        0x00e2: 0x00e3, #       LATIN SMALL LETTER A WITH TILDE\r
+        0x00e3: 0x00d0, #       LATIN CAPITAL LETTER ETH (Icelandic)\r
+        0x00e4: 0x00f0, #       LATIN SMALL LETTER ETH (Icelandic)\r
+        0x00e5: 0x00cd, #       LATIN CAPITAL LETTER I WITH ACUTE\r
+        0x00e6: 0x00cc, #       LATIN CAPITAL LETTER I WITH GRAVE\r
+        0x00e7: 0x00d3, #       LATIN CAPITAL LETTER O WITH ACUTE\r
+        0x00e8: 0x00d2, #       LATIN CAPITAL LETTER O WITH GRAVE\r
+        0x00e9: 0x00d5, #       LATIN CAPITAL LETTER O WITH TILDE\r
+        0x00ea: 0x00f5, #       LATIN SMALL LETTER O WITH TILDE\r
+        0x00eb: 0x0160, #       LATIN CAPITAL LETTER S WITH CARON\r
+        0x00ec: 0x0161, #       LATIN SMALL LETTER S WITH CARON\r
+        0x00ed: 0x00da, #       LATIN CAPITAL LETTER U WITH ACUTE\r
+        0x00ee: 0x0178, #       LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+        0x00ef: 0x00ff, #       LATIN SMALL LETTER Y WITH DIAERESIS\r
+        0x00f0: 0x00de, #       LATIN CAPITAL LETTER THORN (Icelandic)\r
+        0x00f1: 0x00fe, #       LATIN SMALL LETTER THORN (Icelandic)\r
+        0x00f2: 0x00b7, #       MIDDLE DOT\r
+        0x00f3: 0x00b5, #       MICRO SIGN\r
+        0x00f4: 0x00b6, #       PILCROW SIGN\r
+        0x00f5: 0x00be, #       VULGAR FRACTION THREE QUARTERS\r
+        0x00f6: 0x2014, #       EM DASH\r
+        0x00f7: 0x00bc, #       VULGAR FRACTION ONE QUARTER\r
+        0x00f8: 0x00bd, #       VULGAR FRACTION ONE HALF\r
+        0x00f9: 0x00aa, #       FEMININE ORDINAL INDICATOR\r
+        0x00fa: 0x00ba, #       MASCULINE ORDINAL INDICATOR\r
+        0x00fb: 0x00ab, #       LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+        0x00fc: 0x25a0, #       BLACK SQUARE\r
+        0x00fd: 0x00bb, #       RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+        0x00fe: 0x00b1, #       PLUS-MINUS SIGN\r
+        0x00ff: None,\r
+})\r
+\r
+### Encoding Map\r
+\r
+encoding_map = codecs.make_encoding_map(decoding_map)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hz.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hz.py
new file mode 100644 (file)
index 0000000..027c4fb
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# hz.py: Python Unicode Codec for HZ\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_cn, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_cn.getcodec('hz')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='hz',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/idna.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/idna.py
new file mode 100644 (file)
index 0000000..ecbf2be
--- /dev/null
@@ -0,0 +1,288 @@
+# This module implements the RFCs 3490 (IDNA) and 3491 (Nameprep)\r
+\r
+import stringprep, re, codecs\r
+from unicodedata import ucd_3_2_0 as unicodedata\r
+\r
+# IDNA section 3.1\r
+dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]")\r
+\r
+# IDNA section 5\r
+ace_prefix = "xn--"\r
+uace_prefix = unicode(ace_prefix, "ascii")\r
+\r
+# This assumes query strings, so AllowUnassigned is true\r
+def nameprep(label):\r
+    # Map\r
+    newlabel = []\r
+    for c in label:\r
+        if stringprep.in_table_b1(c):\r
+            # Map to nothing\r
+            continue\r
+        newlabel.append(stringprep.map_table_b2(c))\r
+    label = u"".join(newlabel)\r
+\r
+    # Normalize\r
+    label = unicodedata.normalize("NFKC", label)\r
+\r
+    # Prohibit\r
+    for c in label:\r
+        if stringprep.in_table_c12(c) or \\r
+           stringprep.in_table_c22(c) or \\r
+           stringprep.in_table_c3(c) or \\r
+           stringprep.in_table_c4(c) or \\r
+           stringprep.in_table_c5(c) or \\r
+           stringprep.in_table_c6(c) or \\r
+           stringprep.in_table_c7(c) or \\r
+           stringprep.in_table_c8(c) or \\r
+           stringprep.in_table_c9(c):\r
+            raise UnicodeError("Invalid character %r" % c)\r
+\r
+    # Check bidi\r
+    RandAL = map(stringprep.in_table_d1, label)\r
+    for c in RandAL:\r
+        if c:\r
+            # There is a RandAL char in the string. Must perform further\r
+            # tests:\r
+            # 1) The characters in section 5.8 MUST be prohibited.\r
+            # This is table C.8, which was already checked\r
+            # 2) If a string contains any RandALCat character, the string\r
+            # MUST NOT contain any LCat character.\r
+            if filter(stringprep.in_table_d2, label):\r
+                raise UnicodeError("Violation of BIDI requirement 2")\r
+\r
+            # 3) If a string contains any RandALCat character, a\r
+            # RandALCat character MUST be the first character of the\r
+            # string, and a RandALCat character MUST be the last\r
+            # character of the string.\r
+            if not RandAL[0] or not RandAL[-1]:\r
+                raise UnicodeError("Violation of BIDI requirement 3")\r
+\r
+    return label\r
+\r
+def ToASCII(label):\r
+    try:\r
+        # Step 1: try ASCII\r
+        label = label.encode("ascii")\r
+    except UnicodeError:\r
+        pass\r
+    else:\r
+        # Skip to step 3: UseSTD3ASCIIRules is false, so\r
+        # Skip to step 8.\r
+        if 0 < len(label) < 64:\r
+            return label\r
+        raise UnicodeError("label empty or too long")\r
+\r
+    # Step 2: nameprep\r
+    label = nameprep(label)\r
+\r
+    # Step 3: UseSTD3ASCIIRules is false\r
+    # Step 4: try ASCII\r
+    try:\r
+        label = label.encode("ascii")\r
+    except UnicodeError:\r
+        pass\r
+    else:\r
+        # Skip to step 8.\r
+        if 0 < len(label) < 64:\r
+            return label\r
+        raise UnicodeError("label empty or too long")\r
+\r
+    # Step 5: Check ACE prefix\r
+    if label.startswith(uace_prefix):\r
+        raise UnicodeError("Label starts with ACE prefix")\r
+\r
+    # Step 6: Encode with PUNYCODE\r
+    label = label.encode("punycode")\r
+\r
+    # Step 7: Prepend ACE prefix\r
+    label = ace_prefix + label\r
+\r
+    # Step 8: Check size\r
+    if 0 < len(label) < 64:\r
+        return label\r
+    raise UnicodeError("label empty or too long")\r
+\r
+def ToUnicode(label):\r
+    # Step 1: Check for ASCII\r
+    if isinstance(label, str):\r
+        pure_ascii = True\r
+    else:\r
+        try:\r
+            label = label.encode("ascii")\r
+            pure_ascii = True\r
+        except UnicodeError:\r
+            pure_ascii = False\r
+    if not pure_ascii:\r
+        # Step 2: Perform nameprep\r
+        label = nameprep(label)\r
+        # It doesn't say this, but apparently, it should be ASCII now\r
+        try:\r
+            label = label.encode("ascii")\r
+        except UnicodeError:\r
+            raise UnicodeError("Invalid character in IDN label")\r
+    # Step 3: Check for ACE prefix\r
+    if not label.startswith(ace_prefix):\r
+        return unicode(label, "ascii")\r
+\r
+    # Step 4: Remove ACE prefix\r
+    label1 = label[len(ace_prefix):]\r
+\r
+    # Step 5: Decode using PUNYCODE\r
+    result = label1.decode("punycode")\r
+\r
+    # Step 6: Apply ToASCII\r
+    label2 = ToASCII(result)\r
+\r
+    # Step 7: Compare the result of step 6 with the one of step 3\r
+    # label2 will already be in lower case.\r
+    if label.lower() != label2:\r
+        raise UnicodeError("IDNA does not round-trip", label, label2)\r
+\r
+    # Step 8: return the result of step 5\r
+    return result\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+    def encode(self,input,errors='strict'):\r
+\r
+        if errors != 'strict':\r
+            # IDNA is quite clear that implementations must be strict\r
+            raise UnicodeError("unsupported error handling "+errors)\r
+\r
+        if not input:\r
+            return "", 0\r
+\r
+        result = []\r
+        labels = dots.split(input)\r
+        if labels and len(labels[-1])==0:\r
+            trailing_dot = '.'\r
+            del labels[-1]\r
+        else:\r
+            trailing_dot = ''\r
+        for label in labels:\r
+            result.append(ToASCII(label))\r
+        # Join with U+002E\r
+        return ".".join(result)+trailing_dot, len(input)\r
+\r
+    def decode(self,input,errors='strict'):\r
+\r
+        if errors != 'strict':\r
+            raise UnicodeError("Unsupported error handling "+errors)\r
+\r
+        if not input:\r
+            return u"", 0\r
+\r
+        # IDNA allows decoding to operate on Unicode strings, too.\r
+        if isinstance(input, unicode):\r
+            labels = dots.split(input)\r
+        else:\r
+            # Must be ASCII string\r
+            input = str(input)\r
+            unicode(input, "ascii")\r
+            labels = input.split(".")\r
+\r
+        if labels and len(labels[-1]) == 0:\r
+            trailing_dot = u'.'\r
+            del labels[-1]\r
+        else:\r
+            trailing_dot = u''\r
+\r
+        result = []\r
+        for label in labels:\r
+            result.append(ToUnicode(label))\r
+\r
+        return u".".join(result)+trailing_dot, len(input)\r
+\r
+class IncrementalEncoder(codecs.BufferedIncrementalEncoder):\r
+    def _buffer_encode(self, input, errors, final):\r
+        if errors != 'strict':\r
+            # IDNA is quite clear that implementations must be strict\r
+            raise UnicodeError("unsupported error handling "+errors)\r
+\r
+        if not input:\r
+            return ("", 0)\r
+\r
+        labels = dots.split(input)\r
+        trailing_dot = u''\r
+        if labels:\r
+            if not labels[-1]:\r
+                trailing_dot = '.'\r
+                del labels[-1]\r
+            elif not final:\r
+                # Keep potentially unfinished label until the next call\r
+                del labels[-1]\r
+                if labels:\r
+                    trailing_dot = '.'\r
+\r
+        result = []\r
+        size = 0\r
+        for label in labels:\r
+            result.append(ToASCII(label))\r
+            if size:\r
+                size += 1\r
+            size += len(label)\r
+\r
+        # Join with U+002E\r
+        result = ".".join(result) + trailing_dot\r
+        size += len(trailing_dot)\r
+        return (result, size)\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    def _buffer_decode(self, input, errors, final):\r
+        if errors != 'strict':\r
+            raise UnicodeError("Unsupported error handling "+errors)\r
+\r
+        if not input:\r
+            return (u"", 0)\r
+\r
+        # IDNA allows decoding to operate on Unicode strings, too.\r
+        if isinstance(input, unicode):\r
+            labels = dots.split(input)\r
+        else:\r
+            # Must be ASCII string\r
+            input = str(input)\r
+            unicode(input, "ascii")\r
+            labels = input.split(".")\r
+\r
+        trailing_dot = u''\r
+        if labels:\r
+            if not labels[-1]:\r
+                trailing_dot = u'.'\r
+                del labels[-1]\r
+            elif not final:\r
+                # Keep potentially unfinished label until the next call\r
+                del labels[-1]\r
+                if labels:\r
+                    trailing_dot = u'.'\r
+\r
+        result = []\r
+        size = 0\r
+        for label in labels:\r
+            result.append(ToUnicode(label))\r
+            if size:\r
+                size += 1\r
+            size += len(label)\r
+\r
+        result = u".".join(result) + trailing_dot\r
+        size += len(trailing_dot)\r
+        return (result, size)\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='idna',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp.py
new file mode 100644 (file)
index 0000000..3471999
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# iso2022_jp.py: Python Unicode Codec for ISO2022_JP\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_iso2022, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_iso2022.getcodec('iso2022_jp')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso2022_jp',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_1.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_1.py
new file mode 100644 (file)
index 0000000..8b04b84
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# iso2022_jp_1.py: Python Unicode Codec for ISO2022_JP_1\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_iso2022, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_iso2022.getcodec('iso2022_jp_1')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso2022_jp_1',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2.py
new file mode 100644 (file)
index 0000000..df92673
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# iso2022_jp_2.py: Python Unicode Codec for ISO2022_JP_2\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_iso2022, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_iso2022.getcodec('iso2022_jp_2')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso2022_jp_2',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2004.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2004.py
new file mode 100644 (file)
index 0000000..138e628
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# iso2022_jp_2004.py: Python Unicode Codec for ISO2022_JP_2004\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_iso2022, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_iso2022.getcodec('iso2022_jp_2004')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso2022_jp_2004',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_3.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_3.py
new file mode 100644 (file)
index 0000000..5fd5825
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# iso2022_jp_3.py: Python Unicode Codec for ISO2022_JP_3\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_iso2022, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_iso2022.getcodec('iso2022_jp_3')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso2022_jp_3',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_ext.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_ext.py
new file mode 100644 (file)
index 0000000..4ac8a0c
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# iso2022_jp_ext.py: Python Unicode Codec for ISO2022_JP_EXT\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_iso2022, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_iso2022.getcodec('iso2022_jp_ext')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso2022_jp_ext',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_kr.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_kr.py
new file mode 100644 (file)
index 0000000..3dfe986
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# iso2022_kr.py: Python Unicode Codec for ISO2022_KR\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_iso2022, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_iso2022.getcodec('iso2022_kr')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso2022_kr',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_1.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_1.py
new file mode 100644 (file)
index 0000000..7f6be30
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_1 generated from 'MAPPINGS/ISO8859/8859-1.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-1',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\xa1'     #  0xA1 -> INVERTED EXCLAMATION MARK\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\xa5'     #  0xA5 -> YEN SIGN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\xaa'     #  0xAA -> FEMININE ORDINAL INDICATOR\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xaf'     #  0xAF -> MACRON\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\xba'     #  0xBA -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbc'     #  0xBC -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xBE -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xbf'     #  0xBF -> INVERTED QUESTION MARK\r
+    u'\xc0'     #  0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc3'     #  0xC3 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc6'     #  0xC6 -> LATIN CAPITAL LETTER AE\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc8'     #  0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xcc'     #  0xCC -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xd0'     #  0xD0 -> LATIN CAPITAL LETTER ETH (Icelandic)\r
+    u'\xd1'     #  0xD1 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd2'     #  0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd5'     #  0xD5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\xd8'     #  0xD8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xd9'     #  0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xdd'     #  0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xde'     #  0xDE -> LATIN CAPITAL LETTER THORN (Icelandic)\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S (German)\r
+    u'\xe0'     #  0xE0 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe3'     #  0xE3 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe6'     #  0xE6 -> LATIN SMALL LETTER AE\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe8'     #  0xE8 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xec'     #  0xEC -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf0'     #  0xF0 -> LATIN SMALL LETTER ETH (Icelandic)\r
+    u'\xf1'     #  0xF1 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf2'     #  0xF2 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf5'     #  0xF5 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\xf8'     #  0xF8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xf9'     #  0xF9 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xfd'     #  0xFD -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xfe'     #  0xFE -> LATIN SMALL LETTER THORN (Icelandic)\r
+    u'\xff'     #  0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_10.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_10.py
new file mode 100644 (file)
index 0000000..d2a7a51
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_10 generated from 'MAPPINGS/ISO8859/8859-10.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-10',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u0104'   #  0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK\r
+    u'\u0112'   #  0xA2 -> LATIN CAPITAL LETTER E WITH MACRON\r
+    u'\u0122'   #  0xA3 -> LATIN CAPITAL LETTER G WITH CEDILLA\r
+    u'\u012a'   #  0xA4 -> LATIN CAPITAL LETTER I WITH MACRON\r
+    u'\u0128'   #  0xA5 -> LATIN CAPITAL LETTER I WITH TILDE\r
+    u'\u0136'   #  0xA6 -> LATIN CAPITAL LETTER K WITH CEDILLA\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\u013b'   #  0xA8 -> LATIN CAPITAL LETTER L WITH CEDILLA\r
+    u'\u0110'   #  0xA9 -> LATIN CAPITAL LETTER D WITH STROKE\r
+    u'\u0160'   #  0xAA -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u0166'   #  0xAB -> LATIN CAPITAL LETTER T WITH STROKE\r
+    u'\u017d'   #  0xAC -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\u016a'   #  0xAE -> LATIN CAPITAL LETTER U WITH MACRON\r
+    u'\u014a'   #  0xAF -> LATIN CAPITAL LETTER ENG\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\u0105'   #  0xB1 -> LATIN SMALL LETTER A WITH OGONEK\r
+    u'\u0113'   #  0xB2 -> LATIN SMALL LETTER E WITH MACRON\r
+    u'\u0123'   #  0xB3 -> LATIN SMALL LETTER G WITH CEDILLA\r
+    u'\u012b'   #  0xB4 -> LATIN SMALL LETTER I WITH MACRON\r
+    u'\u0129'   #  0xB5 -> LATIN SMALL LETTER I WITH TILDE\r
+    u'\u0137'   #  0xB6 -> LATIN SMALL LETTER K WITH CEDILLA\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\u013c'   #  0xB8 -> LATIN SMALL LETTER L WITH CEDILLA\r
+    u'\u0111'   #  0xB9 -> LATIN SMALL LETTER D WITH STROKE\r
+    u'\u0161'   #  0xBA -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u0167'   #  0xBB -> LATIN SMALL LETTER T WITH STROKE\r
+    u'\u017e'   #  0xBC -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u2015'   #  0xBD -> HORIZONTAL BAR\r
+    u'\u016b'   #  0xBE -> LATIN SMALL LETTER U WITH MACRON\r
+    u'\u014b'   #  0xBF -> LATIN SMALL LETTER ENG\r
+    u'\u0100'   #  0xC0 -> LATIN CAPITAL LETTER A WITH MACRON\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc3'     #  0xC3 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc6'     #  0xC6 -> LATIN CAPITAL LETTER AE\r
+    u'\u012e'   #  0xC7 -> LATIN CAPITAL LETTER I WITH OGONEK\r
+    u'\u010c'   #  0xC8 -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\u0118'   #  0xCA -> LATIN CAPITAL LETTER E WITH OGONEK\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\u0116'   #  0xCC -> LATIN CAPITAL LETTER E WITH DOT ABOVE\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xd0'     #  0xD0 -> LATIN CAPITAL LETTER ETH (Icelandic)\r
+    u'\u0145'   #  0xD1 -> LATIN CAPITAL LETTER N WITH CEDILLA\r
+    u'\u014c'   #  0xD2 -> LATIN CAPITAL LETTER O WITH MACRON\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd5'     #  0xD5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\u0168'   #  0xD7 -> LATIN CAPITAL LETTER U WITH TILDE\r
+    u'\xd8'     #  0xD8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\u0172'   #  0xD9 -> LATIN CAPITAL LETTER U WITH OGONEK\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xdd'     #  0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xde'     #  0xDE -> LATIN CAPITAL LETTER THORN (Icelandic)\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S (German)\r
+    u'\u0101'   #  0xE0 -> LATIN SMALL LETTER A WITH MACRON\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe3'     #  0xE3 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe6'     #  0xE6 -> LATIN SMALL LETTER AE\r
+    u'\u012f'   #  0xE7 -> LATIN SMALL LETTER I WITH OGONEK\r
+    u'\u010d'   #  0xE8 -> LATIN SMALL LETTER C WITH CARON\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\u0119'   #  0xEA -> LATIN SMALL LETTER E WITH OGONEK\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\u0117'   #  0xEC -> LATIN SMALL LETTER E WITH DOT ABOVE\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf0'     #  0xF0 -> LATIN SMALL LETTER ETH (Icelandic)\r
+    u'\u0146'   #  0xF1 -> LATIN SMALL LETTER N WITH CEDILLA\r
+    u'\u014d'   #  0xF2 -> LATIN SMALL LETTER O WITH MACRON\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf5'     #  0xF5 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\u0169'   #  0xF7 -> LATIN SMALL LETTER U WITH TILDE\r
+    u'\xf8'     #  0xF8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\u0173'   #  0xF9 -> LATIN SMALL LETTER U WITH OGONEK\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xfd'     #  0xFD -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xfe'     #  0xFE -> LATIN SMALL LETTER THORN (Icelandic)\r
+    u'\u0138'   #  0xFF -> LATIN SMALL LETTER KRA\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_11.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_11.py
new file mode 100644 (file)
index 0000000..2f6252a
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_11 generated from 'MAPPINGS/ISO8859/8859-11.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-11',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u0e01'   #  0xA1 -> THAI CHARACTER KO KAI\r
+    u'\u0e02'   #  0xA2 -> THAI CHARACTER KHO KHAI\r
+    u'\u0e03'   #  0xA3 -> THAI CHARACTER KHO KHUAT\r
+    u'\u0e04'   #  0xA4 -> THAI CHARACTER KHO KHWAI\r
+    u'\u0e05'   #  0xA5 -> THAI CHARACTER KHO KHON\r
+    u'\u0e06'   #  0xA6 -> THAI CHARACTER KHO RAKHANG\r
+    u'\u0e07'   #  0xA7 -> THAI CHARACTER NGO NGU\r
+    u'\u0e08'   #  0xA8 -> THAI CHARACTER CHO CHAN\r
+    u'\u0e09'   #  0xA9 -> THAI CHARACTER CHO CHING\r
+    u'\u0e0a'   #  0xAA -> THAI CHARACTER CHO CHANG\r
+    u'\u0e0b'   #  0xAB -> THAI CHARACTER SO SO\r
+    u'\u0e0c'   #  0xAC -> THAI CHARACTER CHO CHOE\r
+    u'\u0e0d'   #  0xAD -> THAI CHARACTER YO YING\r
+    u'\u0e0e'   #  0xAE -> THAI CHARACTER DO CHADA\r
+    u'\u0e0f'   #  0xAF -> THAI CHARACTER TO PATAK\r
+    u'\u0e10'   #  0xB0 -> THAI CHARACTER THO THAN\r
+    u'\u0e11'   #  0xB1 -> THAI CHARACTER THO NANGMONTHO\r
+    u'\u0e12'   #  0xB2 -> THAI CHARACTER THO PHUTHAO\r
+    u'\u0e13'   #  0xB3 -> THAI CHARACTER NO NEN\r
+    u'\u0e14'   #  0xB4 -> THAI CHARACTER DO DEK\r
+    u'\u0e15'   #  0xB5 -> THAI CHARACTER TO TAO\r
+    u'\u0e16'   #  0xB6 -> THAI CHARACTER THO THUNG\r
+    u'\u0e17'   #  0xB7 -> THAI CHARACTER THO THAHAN\r
+    u'\u0e18'   #  0xB8 -> THAI CHARACTER THO THONG\r
+    u'\u0e19'   #  0xB9 -> THAI CHARACTER NO NU\r
+    u'\u0e1a'   #  0xBA -> THAI CHARACTER BO BAIMAI\r
+    u'\u0e1b'   #  0xBB -> THAI CHARACTER PO PLA\r
+    u'\u0e1c'   #  0xBC -> THAI CHARACTER PHO PHUNG\r
+    u'\u0e1d'   #  0xBD -> THAI CHARACTER FO FA\r
+    u'\u0e1e'   #  0xBE -> THAI CHARACTER PHO PHAN\r
+    u'\u0e1f'   #  0xBF -> THAI CHARACTER FO FAN\r
+    u'\u0e20'   #  0xC0 -> THAI CHARACTER PHO SAMPHAO\r
+    u'\u0e21'   #  0xC1 -> THAI CHARACTER MO MA\r
+    u'\u0e22'   #  0xC2 -> THAI CHARACTER YO YAK\r
+    u'\u0e23'   #  0xC3 -> THAI CHARACTER RO RUA\r
+    u'\u0e24'   #  0xC4 -> THAI CHARACTER RU\r
+    u'\u0e25'   #  0xC5 -> THAI CHARACTER LO LING\r
+    u'\u0e26'   #  0xC6 -> THAI CHARACTER LU\r
+    u'\u0e27'   #  0xC7 -> THAI CHARACTER WO WAEN\r
+    u'\u0e28'   #  0xC8 -> THAI CHARACTER SO SALA\r
+    u'\u0e29'   #  0xC9 -> THAI CHARACTER SO RUSI\r
+    u'\u0e2a'   #  0xCA -> THAI CHARACTER SO SUA\r
+    u'\u0e2b'   #  0xCB -> THAI CHARACTER HO HIP\r
+    u'\u0e2c'   #  0xCC -> THAI CHARACTER LO CHULA\r
+    u'\u0e2d'   #  0xCD -> THAI CHARACTER O ANG\r
+    u'\u0e2e'   #  0xCE -> THAI CHARACTER HO NOKHUK\r
+    u'\u0e2f'   #  0xCF -> THAI CHARACTER PAIYANNOI\r
+    u'\u0e30'   #  0xD0 -> THAI CHARACTER SARA A\r
+    u'\u0e31'   #  0xD1 -> THAI CHARACTER MAI HAN-AKAT\r
+    u'\u0e32'   #  0xD2 -> THAI CHARACTER SARA AA\r
+    u'\u0e33'   #  0xD3 -> THAI CHARACTER SARA AM\r
+    u'\u0e34'   #  0xD4 -> THAI CHARACTER SARA I\r
+    u'\u0e35'   #  0xD5 -> THAI CHARACTER SARA II\r
+    u'\u0e36'   #  0xD6 -> THAI CHARACTER SARA UE\r
+    u'\u0e37'   #  0xD7 -> THAI CHARACTER SARA UEE\r
+    u'\u0e38'   #  0xD8 -> THAI CHARACTER SARA U\r
+    u'\u0e39'   #  0xD9 -> THAI CHARACTER SARA UU\r
+    u'\u0e3a'   #  0xDA -> THAI CHARACTER PHINTHU\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\u0e3f'   #  0xDF -> THAI CURRENCY SYMBOL BAHT\r
+    u'\u0e40'   #  0xE0 -> THAI CHARACTER SARA E\r
+    u'\u0e41'   #  0xE1 -> THAI CHARACTER SARA AE\r
+    u'\u0e42'   #  0xE2 -> THAI CHARACTER SARA O\r
+    u'\u0e43'   #  0xE3 -> THAI CHARACTER SARA AI MAIMUAN\r
+    u'\u0e44'   #  0xE4 -> THAI CHARACTER SARA AI MAIMALAI\r
+    u'\u0e45'   #  0xE5 -> THAI CHARACTER LAKKHANGYAO\r
+    u'\u0e46'   #  0xE6 -> THAI CHARACTER MAIYAMOK\r
+    u'\u0e47'   #  0xE7 -> THAI CHARACTER MAITAIKHU\r
+    u'\u0e48'   #  0xE8 -> THAI CHARACTER MAI EK\r
+    u'\u0e49'   #  0xE9 -> THAI CHARACTER MAI THO\r
+    u'\u0e4a'   #  0xEA -> THAI CHARACTER MAI TRI\r
+    u'\u0e4b'   #  0xEB -> THAI CHARACTER MAI CHATTAWA\r
+    u'\u0e4c'   #  0xEC -> THAI CHARACTER THANTHAKHAT\r
+    u'\u0e4d'   #  0xED -> THAI CHARACTER NIKHAHIT\r
+    u'\u0e4e'   #  0xEE -> THAI CHARACTER YAMAKKAN\r
+    u'\u0e4f'   #  0xEF -> THAI CHARACTER FONGMAN\r
+    u'\u0e50'   #  0xF0 -> THAI DIGIT ZERO\r
+    u'\u0e51'   #  0xF1 -> THAI DIGIT ONE\r
+    u'\u0e52'   #  0xF2 -> THAI DIGIT TWO\r
+    u'\u0e53'   #  0xF3 -> THAI DIGIT THREE\r
+    u'\u0e54'   #  0xF4 -> THAI DIGIT FOUR\r
+    u'\u0e55'   #  0xF5 -> THAI DIGIT FIVE\r
+    u'\u0e56'   #  0xF6 -> THAI DIGIT SIX\r
+    u'\u0e57'   #  0xF7 -> THAI DIGIT SEVEN\r
+    u'\u0e58'   #  0xF8 -> THAI DIGIT EIGHT\r
+    u'\u0e59'   #  0xF9 -> THAI DIGIT NINE\r
+    u'\u0e5a'   #  0xFA -> THAI CHARACTER ANGKHANKHU\r
+    u'\u0e5b'   #  0xFB -> THAI CHARACTER KHOMUT\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_13.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_13.py
new file mode 100644 (file)
index 0000000..0523133
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_13 generated from 'MAPPINGS/ISO8859/8859-13.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-13',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u201d'   #  0xA1 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\u201e'   #  0xA5 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xd8'     #  0xA8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u0156'   #  0xAA -> LATIN CAPITAL LETTER R WITH CEDILLA\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xc6'     #  0xAF -> LATIN CAPITAL LETTER AE\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\u201c'   #  0xB4 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xf8'     #  0xB8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\u0157'   #  0xBA -> LATIN SMALL LETTER R WITH CEDILLA\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbc'     #  0xBC -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xBE -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xe6'     #  0xBF -> LATIN SMALL LETTER AE\r
+    u'\u0104'   #  0xC0 -> LATIN CAPITAL LETTER A WITH OGONEK\r
+    u'\u012e'   #  0xC1 -> LATIN CAPITAL LETTER I WITH OGONEK\r
+    u'\u0100'   #  0xC2 -> LATIN CAPITAL LETTER A WITH MACRON\r
+    u'\u0106'   #  0xC3 -> LATIN CAPITAL LETTER C WITH ACUTE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\u0118'   #  0xC6 -> LATIN CAPITAL LETTER E WITH OGONEK\r
+    u'\u0112'   #  0xC7 -> LATIN CAPITAL LETTER E WITH MACRON\r
+    u'\u010c'   #  0xC8 -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\u0179'   #  0xCA -> LATIN CAPITAL LETTER Z WITH ACUTE\r
+    u'\u0116'   #  0xCB -> LATIN CAPITAL LETTER E WITH DOT ABOVE\r
+    u'\u0122'   #  0xCC -> LATIN CAPITAL LETTER G WITH CEDILLA\r
+    u'\u0136'   #  0xCD -> LATIN CAPITAL LETTER K WITH CEDILLA\r
+    u'\u012a'   #  0xCE -> LATIN CAPITAL LETTER I WITH MACRON\r
+    u'\u013b'   #  0xCF -> LATIN CAPITAL LETTER L WITH CEDILLA\r
+    u'\u0160'   #  0xD0 -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u0143'   #  0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE\r
+    u'\u0145'   #  0xD2 -> LATIN CAPITAL LETTER N WITH CEDILLA\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\u014c'   #  0xD4 -> LATIN CAPITAL LETTER O WITH MACRON\r
+    u'\xd5'     #  0xD5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\u0172'   #  0xD8 -> LATIN CAPITAL LETTER U WITH OGONEK\r
+    u'\u0141'   #  0xD9 -> LATIN CAPITAL LETTER L WITH STROKE\r
+    u'\u015a'   #  0xDA -> LATIN CAPITAL LETTER S WITH ACUTE\r
+    u'\u016a'   #  0xDB -> LATIN CAPITAL LETTER U WITH MACRON\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\u017b'   #  0xDD -> LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    u'\u017d'   #  0xDE -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S (German)\r
+    u'\u0105'   #  0xE0 -> LATIN SMALL LETTER A WITH OGONEK\r
+    u'\u012f'   #  0xE1 -> LATIN SMALL LETTER I WITH OGONEK\r
+    u'\u0101'   #  0xE2 -> LATIN SMALL LETTER A WITH MACRON\r
+    u'\u0107'   #  0xE3 -> LATIN SMALL LETTER C WITH ACUTE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\u0119'   #  0xE6 -> LATIN SMALL LETTER E WITH OGONEK\r
+    u'\u0113'   #  0xE7 -> LATIN SMALL LETTER E WITH MACRON\r
+    u'\u010d'   #  0xE8 -> LATIN SMALL LETTER C WITH CARON\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\u017a'   #  0xEA -> LATIN SMALL LETTER Z WITH ACUTE\r
+    u'\u0117'   #  0xEB -> LATIN SMALL LETTER E WITH DOT ABOVE\r
+    u'\u0123'   #  0xEC -> LATIN SMALL LETTER G WITH CEDILLA\r
+    u'\u0137'   #  0xED -> LATIN SMALL LETTER K WITH CEDILLA\r
+    u'\u012b'   #  0xEE -> LATIN SMALL LETTER I WITH MACRON\r
+    u'\u013c'   #  0xEF -> LATIN SMALL LETTER L WITH CEDILLA\r
+    u'\u0161'   #  0xF0 -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u0144'   #  0xF1 -> LATIN SMALL LETTER N WITH ACUTE\r
+    u'\u0146'   #  0xF2 -> LATIN SMALL LETTER N WITH CEDILLA\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\u014d'   #  0xF4 -> LATIN SMALL LETTER O WITH MACRON\r
+    u'\xf5'     #  0xF5 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\u0173'   #  0xF8 -> LATIN SMALL LETTER U WITH OGONEK\r
+    u'\u0142'   #  0xF9 -> LATIN SMALL LETTER L WITH STROKE\r
+    u'\u015b'   #  0xFA -> LATIN SMALL LETTER S WITH ACUTE\r
+    u'\u016b'   #  0xFB -> LATIN SMALL LETTER U WITH MACRON\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u017c'   #  0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    u'\u017e'   #  0xFE -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u2019'   #  0xFF -> RIGHT SINGLE QUOTATION MARK\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_14.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_14.py
new file mode 100644 (file)
index 0000000..f0ed8fa
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_14 generated from 'MAPPINGS/ISO8859/8859-14.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-14',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u1e02'   #  0xA1 -> LATIN CAPITAL LETTER B WITH DOT ABOVE\r
+    u'\u1e03'   #  0xA2 -> LATIN SMALL LETTER B WITH DOT ABOVE\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\u010a'   #  0xA4 -> LATIN CAPITAL LETTER C WITH DOT ABOVE\r
+    u'\u010b'   #  0xA5 -> LATIN SMALL LETTER C WITH DOT ABOVE\r
+    u'\u1e0a'   #  0xA6 -> LATIN CAPITAL LETTER D WITH DOT ABOVE\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\u1e80'   #  0xA8 -> LATIN CAPITAL LETTER W WITH GRAVE\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u1e82'   #  0xAA -> LATIN CAPITAL LETTER W WITH ACUTE\r
+    u'\u1e0b'   #  0xAB -> LATIN SMALL LETTER D WITH DOT ABOVE\r
+    u'\u1ef2'   #  0xAC -> LATIN CAPITAL LETTER Y WITH GRAVE\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\u0178'   #  0xAF -> LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+    u'\u1e1e'   #  0xB0 -> LATIN CAPITAL LETTER F WITH DOT ABOVE\r
+    u'\u1e1f'   #  0xB1 -> LATIN SMALL LETTER F WITH DOT ABOVE\r
+    u'\u0120'   #  0xB2 -> LATIN CAPITAL LETTER G WITH DOT ABOVE\r
+    u'\u0121'   #  0xB3 -> LATIN SMALL LETTER G WITH DOT ABOVE\r
+    u'\u1e40'   #  0xB4 -> LATIN CAPITAL LETTER M WITH DOT ABOVE\r
+    u'\u1e41'   #  0xB5 -> LATIN SMALL LETTER M WITH DOT ABOVE\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\u1e56'   #  0xB7 -> LATIN CAPITAL LETTER P WITH DOT ABOVE\r
+    u'\u1e81'   #  0xB8 -> LATIN SMALL LETTER W WITH GRAVE\r
+    u'\u1e57'   #  0xB9 -> LATIN SMALL LETTER P WITH DOT ABOVE\r
+    u'\u1e83'   #  0xBA -> LATIN SMALL LETTER W WITH ACUTE\r
+    u'\u1e60'   #  0xBB -> LATIN CAPITAL LETTER S WITH DOT ABOVE\r
+    u'\u1ef3'   #  0xBC -> LATIN SMALL LETTER Y WITH GRAVE\r
+    u'\u1e84'   #  0xBD -> LATIN CAPITAL LETTER W WITH DIAERESIS\r
+    u'\u1e85'   #  0xBE -> LATIN SMALL LETTER W WITH DIAERESIS\r
+    u'\u1e61'   #  0xBF -> LATIN SMALL LETTER S WITH DOT ABOVE\r
+    u'\xc0'     #  0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc3'     #  0xC3 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc6'     #  0xC6 -> LATIN CAPITAL LETTER AE\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc8'     #  0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xcc'     #  0xCC -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\u0174'   #  0xD0 -> LATIN CAPITAL LETTER W WITH CIRCUMFLEX\r
+    u'\xd1'     #  0xD1 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd2'     #  0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd5'     #  0xD5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\u1e6a'   #  0xD7 -> LATIN CAPITAL LETTER T WITH DOT ABOVE\r
+    u'\xd8'     #  0xD8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xd9'     #  0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xdd'     #  0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\u0176'   #  0xDE -> LATIN CAPITAL LETTER Y WITH CIRCUMFLEX\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\xe0'     #  0xE0 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe3'     #  0xE3 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe6'     #  0xE6 -> LATIN SMALL LETTER AE\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe8'     #  0xE8 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xec'     #  0xEC -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\u0175'   #  0xF0 -> LATIN SMALL LETTER W WITH CIRCUMFLEX\r
+    u'\xf1'     #  0xF1 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf2'     #  0xF2 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf5'     #  0xF5 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\u1e6b'   #  0xF7 -> LATIN SMALL LETTER T WITH DOT ABOVE\r
+    u'\xf8'     #  0xF8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xf9'     #  0xF9 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xfd'     #  0xFD -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\u0177'   #  0xFE -> LATIN SMALL LETTER Y WITH CIRCUMFLEX\r
+    u'\xff'     #  0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_15.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_15.py
new file mode 100644 (file)
index 0000000..4c322be
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_15 generated from 'MAPPINGS/ISO8859/8859-15.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-15',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\xa1'     #  0xA1 -> INVERTED EXCLAMATION MARK\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\u20ac'   #  0xA4 -> EURO SIGN\r
+    u'\xa5'     #  0xA5 -> YEN SIGN\r
+    u'\u0160'   #  0xA6 -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\u0161'   #  0xA8 -> LATIN SMALL LETTER S WITH CARON\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\xaa'     #  0xAA -> FEMININE ORDINAL INDICATOR\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xaf'     #  0xAF -> MACRON\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\u017d'   #  0xB4 -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\u017e'   #  0xB8 -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\xba'     #  0xBA -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u0152'   #  0xBC -> LATIN CAPITAL LIGATURE OE\r
+    u'\u0153'   #  0xBD -> LATIN SMALL LIGATURE OE\r
+    u'\u0178'   #  0xBE -> LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+    u'\xbf'     #  0xBF -> INVERTED QUESTION MARK\r
+    u'\xc0'     #  0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc3'     #  0xC3 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc6'     #  0xC6 -> LATIN CAPITAL LETTER AE\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc8'     #  0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xcc'     #  0xCC -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xd0'     #  0xD0 -> LATIN CAPITAL LETTER ETH\r
+    u'\xd1'     #  0xD1 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd2'     #  0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd5'     #  0xD5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\xd8'     #  0xD8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xd9'     #  0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xdd'     #  0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xde'     #  0xDE -> LATIN CAPITAL LETTER THORN\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\xe0'     #  0xE0 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe3'     #  0xE3 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe6'     #  0xE6 -> LATIN SMALL LETTER AE\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe8'     #  0xE8 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xec'     #  0xEC -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf0'     #  0xF0 -> LATIN SMALL LETTER ETH\r
+    u'\xf1'     #  0xF1 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf2'     #  0xF2 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf5'     #  0xF5 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\xf8'     #  0xF8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xf9'     #  0xF9 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xfd'     #  0xFD -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xfe'     #  0xFE -> LATIN SMALL LETTER THORN\r
+    u'\xff'     #  0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_16.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_16.py
new file mode 100644 (file)
index 0000000..e1bce0a
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_16 generated from 'MAPPINGS/ISO8859/8859-16.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-16',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u0104'   #  0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK\r
+    u'\u0105'   #  0xA2 -> LATIN SMALL LETTER A WITH OGONEK\r
+    u'\u0141'   #  0xA3 -> LATIN CAPITAL LETTER L WITH STROKE\r
+    u'\u20ac'   #  0xA4 -> EURO SIGN\r
+    u'\u201e'   #  0xA5 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u0160'   #  0xA6 -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\u0161'   #  0xA8 -> LATIN SMALL LETTER S WITH CARON\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u0218'   #  0xAA -> LATIN CAPITAL LETTER S WITH COMMA BELOW\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u0179'   #  0xAC -> LATIN CAPITAL LETTER Z WITH ACUTE\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\u017a'   #  0xAE -> LATIN SMALL LETTER Z WITH ACUTE\r
+    u'\u017b'   #  0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\u010c'   #  0xB2 -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\u0142'   #  0xB3 -> LATIN SMALL LETTER L WITH STROKE\r
+    u'\u017d'   #  0xB4 -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\u201d'   #  0xB5 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\u017e'   #  0xB8 -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u010d'   #  0xB9 -> LATIN SMALL LETTER C WITH CARON\r
+    u'\u0219'   #  0xBA -> LATIN SMALL LETTER S WITH COMMA BELOW\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u0152'   #  0xBC -> LATIN CAPITAL LIGATURE OE\r
+    u'\u0153'   #  0xBD -> LATIN SMALL LIGATURE OE\r
+    u'\u0178'   #  0xBE -> LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+    u'\u017c'   #  0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    u'\xc0'     #  0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\u0102'   #  0xC3 -> LATIN CAPITAL LETTER A WITH BREVE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\u0106'   #  0xC5 -> LATIN CAPITAL LETTER C WITH ACUTE\r
+    u'\xc6'     #  0xC6 -> LATIN CAPITAL LETTER AE\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc8'     #  0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xcc'     #  0xCC -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\u0110'   #  0xD0 -> LATIN CAPITAL LETTER D WITH STROKE\r
+    u'\u0143'   #  0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE\r
+    u'\xd2'     #  0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\u0150'   #  0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\u015a'   #  0xD7 -> LATIN CAPITAL LETTER S WITH ACUTE\r
+    u'\u0170'   #  0xD8 -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE\r
+    u'\xd9'     #  0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\u0118'   #  0xDD -> LATIN CAPITAL LETTER E WITH OGONEK\r
+    u'\u021a'   #  0xDE -> LATIN CAPITAL LETTER T WITH COMMA BELOW\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\xe0'     #  0xE0 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\u0103'   #  0xE3 -> LATIN SMALL LETTER A WITH BREVE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\u0107'   #  0xE5 -> LATIN SMALL LETTER C WITH ACUTE\r
+    u'\xe6'     #  0xE6 -> LATIN SMALL LETTER AE\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe8'     #  0xE8 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xec'     #  0xEC -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\u0111'   #  0xF0 -> LATIN SMALL LETTER D WITH STROKE\r
+    u'\u0144'   #  0xF1 -> LATIN SMALL LETTER N WITH ACUTE\r
+    u'\xf2'     #  0xF2 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\u0151'   #  0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\u015b'   #  0xF7 -> LATIN SMALL LETTER S WITH ACUTE\r
+    u'\u0171'   #  0xF8 -> LATIN SMALL LETTER U WITH DOUBLE ACUTE\r
+    u'\xf9'     #  0xF9 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u0119'   #  0xFD -> LATIN SMALL LETTER E WITH OGONEK\r
+    u'\u021b'   #  0xFE -> LATIN SMALL LETTER T WITH COMMA BELOW\r
+    u'\xff'     #  0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_2.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_2.py
new file mode 100644 (file)
index 0000000..fb3606f
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_2 generated from 'MAPPINGS/ISO8859/8859-2.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-2',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u0104'   #  0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK\r
+    u'\u02d8'   #  0xA2 -> BREVE\r
+    u'\u0141'   #  0xA3 -> LATIN CAPITAL LETTER L WITH STROKE\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\u013d'   #  0xA5 -> LATIN CAPITAL LETTER L WITH CARON\r
+    u'\u015a'   #  0xA6 -> LATIN CAPITAL LETTER S WITH ACUTE\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\u0160'   #  0xA9 -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u015e'   #  0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA\r
+    u'\u0164'   #  0xAB -> LATIN CAPITAL LETTER T WITH CARON\r
+    u'\u0179'   #  0xAC -> LATIN CAPITAL LETTER Z WITH ACUTE\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\u017d'   #  0xAE -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\u017b'   #  0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\u0105'   #  0xB1 -> LATIN SMALL LETTER A WITH OGONEK\r
+    u'\u02db'   #  0xB2 -> OGONEK\r
+    u'\u0142'   #  0xB3 -> LATIN SMALL LETTER L WITH STROKE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\u013e'   #  0xB5 -> LATIN SMALL LETTER L WITH CARON\r
+    u'\u015b'   #  0xB6 -> LATIN SMALL LETTER S WITH ACUTE\r
+    u'\u02c7'   #  0xB7 -> CARON\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\u0161'   #  0xB9 -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u015f'   #  0xBA -> LATIN SMALL LETTER S WITH CEDILLA\r
+    u'\u0165'   #  0xBB -> LATIN SMALL LETTER T WITH CARON\r
+    u'\u017a'   #  0xBC -> LATIN SMALL LETTER Z WITH ACUTE\r
+    u'\u02dd'   #  0xBD -> DOUBLE ACUTE ACCENT\r
+    u'\u017e'   #  0xBE -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u017c'   #  0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    u'\u0154'   #  0xC0 -> LATIN CAPITAL LETTER R WITH ACUTE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\u0102'   #  0xC3 -> LATIN CAPITAL LETTER A WITH BREVE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\u0139'   #  0xC5 -> LATIN CAPITAL LETTER L WITH ACUTE\r
+    u'\u0106'   #  0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\u010c'   #  0xC8 -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\u0118'   #  0xCA -> LATIN CAPITAL LETTER E WITH OGONEK\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\u011a'   #  0xCC -> LATIN CAPITAL LETTER E WITH CARON\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\u010e'   #  0xCF -> LATIN CAPITAL LETTER D WITH CARON\r
+    u'\u0110'   #  0xD0 -> LATIN CAPITAL LETTER D WITH STROKE\r
+    u'\u0143'   #  0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE\r
+    u'\u0147'   #  0xD2 -> LATIN CAPITAL LETTER N WITH CARON\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\u0150'   #  0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\u0158'   #  0xD8 -> LATIN CAPITAL LETTER R WITH CARON\r
+    u'\u016e'   #  0xD9 -> LATIN CAPITAL LETTER U WITH RING ABOVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\u0170'   #  0xDB -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xdd'     #  0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\u0162'   #  0xDE -> LATIN CAPITAL LETTER T WITH CEDILLA\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\u0155'   #  0xE0 -> LATIN SMALL LETTER R WITH ACUTE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\u0103'   #  0xE3 -> LATIN SMALL LETTER A WITH BREVE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\u013a'   #  0xE5 -> LATIN SMALL LETTER L WITH ACUTE\r
+    u'\u0107'   #  0xE6 -> LATIN SMALL LETTER C WITH ACUTE\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\u010d'   #  0xE8 -> LATIN SMALL LETTER C WITH CARON\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\u0119'   #  0xEA -> LATIN SMALL LETTER E WITH OGONEK\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\u011b'   #  0xEC -> LATIN SMALL LETTER E WITH CARON\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\u010f'   #  0xEF -> LATIN SMALL LETTER D WITH CARON\r
+    u'\u0111'   #  0xF0 -> LATIN SMALL LETTER D WITH STROKE\r
+    u'\u0144'   #  0xF1 -> LATIN SMALL LETTER N WITH ACUTE\r
+    u'\u0148'   #  0xF2 -> LATIN SMALL LETTER N WITH CARON\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\u0151'   #  0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\u0159'   #  0xF8 -> LATIN SMALL LETTER R WITH CARON\r
+    u'\u016f'   #  0xF9 -> LATIN SMALL LETTER U WITH RING ABOVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\u0171'   #  0xFB -> LATIN SMALL LETTER U WITH DOUBLE ACUTE\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xfd'     #  0xFD -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\u0163'   #  0xFE -> LATIN SMALL LETTER T WITH CEDILLA\r
+    u'\u02d9'   #  0xFF -> DOT ABOVE\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_3.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_3.py
new file mode 100644 (file)
index 0000000..aaa2f52
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_3 generated from 'MAPPINGS/ISO8859/8859-3.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-3',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u0126'   #  0xA1 -> LATIN CAPITAL LETTER H WITH STROKE\r
+    u'\u02d8'   #  0xA2 -> BREVE\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\ufffe'\r
+    u'\u0124'   #  0xA6 -> LATIN CAPITAL LETTER H WITH CIRCUMFLEX\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\u0130'   #  0xA9 -> LATIN CAPITAL LETTER I WITH DOT ABOVE\r
+    u'\u015e'   #  0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA\r
+    u'\u011e'   #  0xAB -> LATIN CAPITAL LETTER G WITH BREVE\r
+    u'\u0134'   #  0xAC -> LATIN CAPITAL LETTER J WITH CIRCUMFLEX\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\ufffe'\r
+    u'\u017b'   #  0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\u0127'   #  0xB1 -> LATIN SMALL LETTER H WITH STROKE\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\u0125'   #  0xB6 -> LATIN SMALL LETTER H WITH CIRCUMFLEX\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\u0131'   #  0xB9 -> LATIN SMALL LETTER DOTLESS I\r
+    u'\u015f'   #  0xBA -> LATIN SMALL LETTER S WITH CEDILLA\r
+    u'\u011f'   #  0xBB -> LATIN SMALL LETTER G WITH BREVE\r
+    u'\u0135'   #  0xBC -> LATIN SMALL LETTER J WITH CIRCUMFLEX\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\ufffe'\r
+    u'\u017c'   #  0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    u'\xc0'     #  0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\ufffe'\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\u010a'   #  0xC5 -> LATIN CAPITAL LETTER C WITH DOT ABOVE\r
+    u'\u0108'   #  0xC6 -> LATIN CAPITAL LETTER C WITH CIRCUMFLEX\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc8'     #  0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xcc'     #  0xCC -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\ufffe'\r
+    u'\xd1'     #  0xD1 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd2'     #  0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\u0120'   #  0xD5 -> LATIN CAPITAL LETTER G WITH DOT ABOVE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\u011c'   #  0xD8 -> LATIN CAPITAL LETTER G WITH CIRCUMFLEX\r
+    u'\xd9'     #  0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\u016c'   #  0xDD -> LATIN CAPITAL LETTER U WITH BREVE\r
+    u'\u015c'   #  0xDE -> LATIN CAPITAL LETTER S WITH CIRCUMFLEX\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\xe0'     #  0xE0 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\ufffe'\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\u010b'   #  0xE5 -> LATIN SMALL LETTER C WITH DOT ABOVE\r
+    u'\u0109'   #  0xE6 -> LATIN SMALL LETTER C WITH CIRCUMFLEX\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe8'     #  0xE8 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xec'     #  0xEC -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\ufffe'\r
+    u'\xf1'     #  0xF1 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf2'     #  0xF2 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\u0121'   #  0xF5 -> LATIN SMALL LETTER G WITH DOT ABOVE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\u011d'   #  0xF8 -> LATIN SMALL LETTER G WITH CIRCUMFLEX\r
+    u'\xf9'     #  0xF9 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u016d'   #  0xFD -> LATIN SMALL LETTER U WITH BREVE\r
+    u'\u015d'   #  0xFE -> LATIN SMALL LETTER S WITH CIRCUMFLEX\r
+    u'\u02d9'   #  0xFF -> DOT ABOVE\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_4.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_4.py
new file mode 100644 (file)
index 0000000..6e86ed1
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_4 generated from 'MAPPINGS/ISO8859/8859-4.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-4',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u0104'   #  0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK\r
+    u'\u0138'   #  0xA2 -> LATIN SMALL LETTER KRA\r
+    u'\u0156'   #  0xA3 -> LATIN CAPITAL LETTER R WITH CEDILLA\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\u0128'   #  0xA5 -> LATIN CAPITAL LETTER I WITH TILDE\r
+    u'\u013b'   #  0xA6 -> LATIN CAPITAL LETTER L WITH CEDILLA\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\u0160'   #  0xA9 -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u0112'   #  0xAA -> LATIN CAPITAL LETTER E WITH MACRON\r
+    u'\u0122'   #  0xAB -> LATIN CAPITAL LETTER G WITH CEDILLA\r
+    u'\u0166'   #  0xAC -> LATIN CAPITAL LETTER T WITH STROKE\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\u017d'   #  0xAE -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\xaf'     #  0xAF -> MACRON\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\u0105'   #  0xB1 -> LATIN SMALL LETTER A WITH OGONEK\r
+    u'\u02db'   #  0xB2 -> OGONEK\r
+    u'\u0157'   #  0xB3 -> LATIN SMALL LETTER R WITH CEDILLA\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\u0129'   #  0xB5 -> LATIN SMALL LETTER I WITH TILDE\r
+    u'\u013c'   #  0xB6 -> LATIN SMALL LETTER L WITH CEDILLA\r
+    u'\u02c7'   #  0xB7 -> CARON\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\u0161'   #  0xB9 -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u0113'   #  0xBA -> LATIN SMALL LETTER E WITH MACRON\r
+    u'\u0123'   #  0xBB -> LATIN SMALL LETTER G WITH CEDILLA\r
+    u'\u0167'   #  0xBC -> LATIN SMALL LETTER T WITH STROKE\r
+    u'\u014a'   #  0xBD -> LATIN CAPITAL LETTER ENG\r
+    u'\u017e'   #  0xBE -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u014b'   #  0xBF -> LATIN SMALL LETTER ENG\r
+    u'\u0100'   #  0xC0 -> LATIN CAPITAL LETTER A WITH MACRON\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc3'     #  0xC3 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc6'     #  0xC6 -> LATIN CAPITAL LETTER AE\r
+    u'\u012e'   #  0xC7 -> LATIN CAPITAL LETTER I WITH OGONEK\r
+    u'\u010c'   #  0xC8 -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\u0118'   #  0xCA -> LATIN CAPITAL LETTER E WITH OGONEK\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\u0116'   #  0xCC -> LATIN CAPITAL LETTER E WITH DOT ABOVE\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\u012a'   #  0xCF -> LATIN CAPITAL LETTER I WITH MACRON\r
+    u'\u0110'   #  0xD0 -> LATIN CAPITAL LETTER D WITH STROKE\r
+    u'\u0145'   #  0xD1 -> LATIN CAPITAL LETTER N WITH CEDILLA\r
+    u'\u014c'   #  0xD2 -> LATIN CAPITAL LETTER O WITH MACRON\r
+    u'\u0136'   #  0xD3 -> LATIN CAPITAL LETTER K WITH CEDILLA\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd5'     #  0xD5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\xd8'     #  0xD8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\u0172'   #  0xD9 -> LATIN CAPITAL LETTER U WITH OGONEK\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\u0168'   #  0xDD -> LATIN CAPITAL LETTER U WITH TILDE\r
+    u'\u016a'   #  0xDE -> LATIN CAPITAL LETTER U WITH MACRON\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\u0101'   #  0xE0 -> LATIN SMALL LETTER A WITH MACRON\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe3'     #  0xE3 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe6'     #  0xE6 -> LATIN SMALL LETTER AE\r
+    u'\u012f'   #  0xE7 -> LATIN SMALL LETTER I WITH OGONEK\r
+    u'\u010d'   #  0xE8 -> LATIN SMALL LETTER C WITH CARON\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\u0119'   #  0xEA -> LATIN SMALL LETTER E WITH OGONEK\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\u0117'   #  0xEC -> LATIN SMALL LETTER E WITH DOT ABOVE\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\u012b'   #  0xEF -> LATIN SMALL LETTER I WITH MACRON\r
+    u'\u0111'   #  0xF0 -> LATIN SMALL LETTER D WITH STROKE\r
+    u'\u0146'   #  0xF1 -> LATIN SMALL LETTER N WITH CEDILLA\r
+    u'\u014d'   #  0xF2 -> LATIN SMALL LETTER O WITH MACRON\r
+    u'\u0137'   #  0xF3 -> LATIN SMALL LETTER K WITH CEDILLA\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf5'     #  0xF5 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\xf8'     #  0xF8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\u0173'   #  0xF9 -> LATIN SMALL LETTER U WITH OGONEK\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u0169'   #  0xFD -> LATIN SMALL LETTER U WITH TILDE\r
+    u'\u016b'   #  0xFE -> LATIN SMALL LETTER U WITH MACRON\r
+    u'\u02d9'   #  0xFF -> DOT ABOVE\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_5.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_5.py
new file mode 100644 (file)
index 0000000..c93283e
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_5 generated from 'MAPPINGS/ISO8859/8859-5.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-5',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u0401'   #  0xA1 -> CYRILLIC CAPITAL LETTER IO\r
+    u'\u0402'   #  0xA2 -> CYRILLIC CAPITAL LETTER DJE\r
+    u'\u0403'   #  0xA3 -> CYRILLIC CAPITAL LETTER GJE\r
+    u'\u0404'   #  0xA4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE\r
+    u'\u0405'   #  0xA5 -> CYRILLIC CAPITAL LETTER DZE\r
+    u'\u0406'   #  0xA6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    u'\u0407'   #  0xA7 -> CYRILLIC CAPITAL LETTER YI\r
+    u'\u0408'   #  0xA8 -> CYRILLIC CAPITAL LETTER JE\r
+    u'\u0409'   #  0xA9 -> CYRILLIC CAPITAL LETTER LJE\r
+    u'\u040a'   #  0xAA -> CYRILLIC CAPITAL LETTER NJE\r
+    u'\u040b'   #  0xAB -> CYRILLIC CAPITAL LETTER TSHE\r
+    u'\u040c'   #  0xAC -> CYRILLIC CAPITAL LETTER KJE\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\u040e'   #  0xAE -> CYRILLIC CAPITAL LETTER SHORT U\r
+    u'\u040f'   #  0xAF -> CYRILLIC CAPITAL LETTER DZHE\r
+    u'\u0410'   #  0xB0 -> CYRILLIC CAPITAL LETTER A\r
+    u'\u0411'   #  0xB1 -> CYRILLIC CAPITAL LETTER BE\r
+    u'\u0412'   #  0xB2 -> CYRILLIC CAPITAL LETTER VE\r
+    u'\u0413'   #  0xB3 -> CYRILLIC CAPITAL LETTER GHE\r
+    u'\u0414'   #  0xB4 -> CYRILLIC CAPITAL LETTER DE\r
+    u'\u0415'   #  0xB5 -> CYRILLIC CAPITAL LETTER IE\r
+    u'\u0416'   #  0xB6 -> CYRILLIC CAPITAL LETTER ZHE\r
+    u'\u0417'   #  0xB7 -> CYRILLIC CAPITAL LETTER ZE\r
+    u'\u0418'   #  0xB8 -> CYRILLIC CAPITAL LETTER I\r
+    u'\u0419'   #  0xB9 -> CYRILLIC CAPITAL LETTER SHORT I\r
+    u'\u041a'   #  0xBA -> CYRILLIC CAPITAL LETTER KA\r
+    u'\u041b'   #  0xBB -> CYRILLIC CAPITAL LETTER EL\r
+    u'\u041c'   #  0xBC -> CYRILLIC CAPITAL LETTER EM\r
+    u'\u041d'   #  0xBD -> CYRILLIC CAPITAL LETTER EN\r
+    u'\u041e'   #  0xBE -> CYRILLIC CAPITAL LETTER O\r
+    u'\u041f'   #  0xBF -> CYRILLIC CAPITAL LETTER PE\r
+    u'\u0420'   #  0xC0 -> CYRILLIC CAPITAL LETTER ER\r
+    u'\u0421'   #  0xC1 -> CYRILLIC CAPITAL LETTER ES\r
+    u'\u0422'   #  0xC2 -> CYRILLIC CAPITAL LETTER TE\r
+    u'\u0423'   #  0xC3 -> CYRILLIC CAPITAL LETTER U\r
+    u'\u0424'   #  0xC4 -> CYRILLIC CAPITAL LETTER EF\r
+    u'\u0425'   #  0xC5 -> CYRILLIC CAPITAL LETTER HA\r
+    u'\u0426'   #  0xC6 -> CYRILLIC CAPITAL LETTER TSE\r
+    u'\u0427'   #  0xC7 -> CYRILLIC CAPITAL LETTER CHE\r
+    u'\u0428'   #  0xC8 -> CYRILLIC CAPITAL LETTER SHA\r
+    u'\u0429'   #  0xC9 -> CYRILLIC CAPITAL LETTER SHCHA\r
+    u'\u042a'   #  0xCA -> CYRILLIC CAPITAL LETTER HARD SIGN\r
+    u'\u042b'   #  0xCB -> CYRILLIC CAPITAL LETTER YERU\r
+    u'\u042c'   #  0xCC -> CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    u'\u042d'   #  0xCD -> CYRILLIC CAPITAL LETTER E\r
+    u'\u042e'   #  0xCE -> CYRILLIC CAPITAL LETTER YU\r
+    u'\u042f'   #  0xCF -> CYRILLIC CAPITAL LETTER YA\r
+    u'\u0430'   #  0xD0 -> CYRILLIC SMALL LETTER A\r
+    u'\u0431'   #  0xD1 -> CYRILLIC SMALL LETTER BE\r
+    u'\u0432'   #  0xD2 -> CYRILLIC SMALL LETTER VE\r
+    u'\u0433'   #  0xD3 -> CYRILLIC SMALL LETTER GHE\r
+    u'\u0434'   #  0xD4 -> CYRILLIC SMALL LETTER DE\r
+    u'\u0435'   #  0xD5 -> CYRILLIC SMALL LETTER IE\r
+    u'\u0436'   #  0xD6 -> CYRILLIC SMALL LETTER ZHE\r
+    u'\u0437'   #  0xD7 -> CYRILLIC SMALL LETTER ZE\r
+    u'\u0438'   #  0xD8 -> CYRILLIC SMALL LETTER I\r
+    u'\u0439'   #  0xD9 -> CYRILLIC SMALL LETTER SHORT I\r
+    u'\u043a'   #  0xDA -> CYRILLIC SMALL LETTER KA\r
+    u'\u043b'   #  0xDB -> CYRILLIC SMALL LETTER EL\r
+    u'\u043c'   #  0xDC -> CYRILLIC SMALL LETTER EM\r
+    u'\u043d'   #  0xDD -> CYRILLIC SMALL LETTER EN\r
+    u'\u043e'   #  0xDE -> CYRILLIC SMALL LETTER O\r
+    u'\u043f'   #  0xDF -> CYRILLIC SMALL LETTER PE\r
+    u'\u0440'   #  0xE0 -> CYRILLIC SMALL LETTER ER\r
+    u'\u0441'   #  0xE1 -> CYRILLIC SMALL LETTER ES\r
+    u'\u0442'   #  0xE2 -> CYRILLIC SMALL LETTER TE\r
+    u'\u0443'   #  0xE3 -> CYRILLIC SMALL LETTER U\r
+    u'\u0444'   #  0xE4 -> CYRILLIC SMALL LETTER EF\r
+    u'\u0445'   #  0xE5 -> CYRILLIC SMALL LETTER HA\r
+    u'\u0446'   #  0xE6 -> CYRILLIC SMALL LETTER TSE\r
+    u'\u0447'   #  0xE7 -> CYRILLIC SMALL LETTER CHE\r
+    u'\u0448'   #  0xE8 -> CYRILLIC SMALL LETTER SHA\r
+    u'\u0449'   #  0xE9 -> CYRILLIC SMALL LETTER SHCHA\r
+    u'\u044a'   #  0xEA -> CYRILLIC SMALL LETTER HARD SIGN\r
+    u'\u044b'   #  0xEB -> CYRILLIC SMALL LETTER YERU\r
+    u'\u044c'   #  0xEC -> CYRILLIC SMALL LETTER SOFT SIGN\r
+    u'\u044d'   #  0xED -> CYRILLIC SMALL LETTER E\r
+    u'\u044e'   #  0xEE -> CYRILLIC SMALL LETTER YU\r
+    u'\u044f'   #  0xEF -> CYRILLIC SMALL LETTER YA\r
+    u'\u2116'   #  0xF0 -> NUMERO SIGN\r
+    u'\u0451'   #  0xF1 -> CYRILLIC SMALL LETTER IO\r
+    u'\u0452'   #  0xF2 -> CYRILLIC SMALL LETTER DJE\r
+    u'\u0453'   #  0xF3 -> CYRILLIC SMALL LETTER GJE\r
+    u'\u0454'   #  0xF4 -> CYRILLIC SMALL LETTER UKRAINIAN IE\r
+    u'\u0455'   #  0xF5 -> CYRILLIC SMALL LETTER DZE\r
+    u'\u0456'   #  0xF6 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    u'\u0457'   #  0xF7 -> CYRILLIC SMALL LETTER YI\r
+    u'\u0458'   #  0xF8 -> CYRILLIC SMALL LETTER JE\r
+    u'\u0459'   #  0xF9 -> CYRILLIC SMALL LETTER LJE\r
+    u'\u045a'   #  0xFA -> CYRILLIC SMALL LETTER NJE\r
+    u'\u045b'   #  0xFB -> CYRILLIC SMALL LETTER TSHE\r
+    u'\u045c'   #  0xFC -> CYRILLIC SMALL LETTER KJE\r
+    u'\xa7'     #  0xFD -> SECTION SIGN\r
+    u'\u045e'   #  0xFE -> CYRILLIC SMALL LETTER SHORT U\r
+    u'\u045f'   #  0xFF -> CYRILLIC SMALL LETTER DZHE\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_6.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_6.py
new file mode 100644 (file)
index 0000000..6fc769a
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_6 generated from 'MAPPINGS/ISO8859/8859-6.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-6',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\u060c'   #  0xAC -> ARABIC COMMA\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\u061b'   #  0xBB -> ARABIC SEMICOLON\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\u061f'   #  0xBF -> ARABIC QUESTION MARK\r
+    u'\ufffe'\r
+    u'\u0621'   #  0xC1 -> ARABIC LETTER HAMZA\r
+    u'\u0622'   #  0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE\r
+    u'\u0623'   #  0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE\r
+    u'\u0624'   #  0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE\r
+    u'\u0625'   #  0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW\r
+    u'\u0626'   #  0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE\r
+    u'\u0627'   #  0xC7 -> ARABIC LETTER ALEF\r
+    u'\u0628'   #  0xC8 -> ARABIC LETTER BEH\r
+    u'\u0629'   #  0xC9 -> ARABIC LETTER TEH MARBUTA\r
+    u'\u062a'   #  0xCA -> ARABIC LETTER TEH\r
+    u'\u062b'   #  0xCB -> ARABIC LETTER THEH\r
+    u'\u062c'   #  0xCC -> ARABIC LETTER JEEM\r
+    u'\u062d'   #  0xCD -> ARABIC LETTER HAH\r
+    u'\u062e'   #  0xCE -> ARABIC LETTER KHAH\r
+    u'\u062f'   #  0xCF -> ARABIC LETTER DAL\r
+    u'\u0630'   #  0xD0 -> ARABIC LETTER THAL\r
+    u'\u0631'   #  0xD1 -> ARABIC LETTER REH\r
+    u'\u0632'   #  0xD2 -> ARABIC LETTER ZAIN\r
+    u'\u0633'   #  0xD3 -> ARABIC LETTER SEEN\r
+    u'\u0634'   #  0xD4 -> ARABIC LETTER SHEEN\r
+    u'\u0635'   #  0xD5 -> ARABIC LETTER SAD\r
+    u'\u0636'   #  0xD6 -> ARABIC LETTER DAD\r
+    u'\u0637'   #  0xD7 -> ARABIC LETTER TAH\r
+    u'\u0638'   #  0xD8 -> ARABIC LETTER ZAH\r
+    u'\u0639'   #  0xD9 -> ARABIC LETTER AIN\r
+    u'\u063a'   #  0xDA -> ARABIC LETTER GHAIN\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\u0640'   #  0xE0 -> ARABIC TATWEEL\r
+    u'\u0641'   #  0xE1 -> ARABIC LETTER FEH\r
+    u'\u0642'   #  0xE2 -> ARABIC LETTER QAF\r
+    u'\u0643'   #  0xE3 -> ARABIC LETTER KAF\r
+    u'\u0644'   #  0xE4 -> ARABIC LETTER LAM\r
+    u'\u0645'   #  0xE5 -> ARABIC LETTER MEEM\r
+    u'\u0646'   #  0xE6 -> ARABIC LETTER NOON\r
+    u'\u0647'   #  0xE7 -> ARABIC LETTER HEH\r
+    u'\u0648'   #  0xE8 -> ARABIC LETTER WAW\r
+    u'\u0649'   #  0xE9 -> ARABIC LETTER ALEF MAKSURA\r
+    u'\u064a'   #  0xEA -> ARABIC LETTER YEH\r
+    u'\u064b'   #  0xEB -> ARABIC FATHATAN\r
+    u'\u064c'   #  0xEC -> ARABIC DAMMATAN\r
+    u'\u064d'   #  0xED -> ARABIC KASRATAN\r
+    u'\u064e'   #  0xEE -> ARABIC FATHA\r
+    u'\u064f'   #  0xEF -> ARABIC DAMMA\r
+    u'\u0650'   #  0xF0 -> ARABIC KASRA\r
+    u'\u0651'   #  0xF1 -> ARABIC SHADDA\r
+    u'\u0652'   #  0xF2 -> ARABIC SUKUN\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_7.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_7.py
new file mode 100644 (file)
index 0000000..9fc2785
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_7 generated from 'MAPPINGS/ISO8859/8859-7.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-7',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\u2018'   #  0xA1 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0xA2 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\u20ac'   #  0xA4 -> EURO SIGN\r
+    u'\u20af'   #  0xA5 -> DRACHMA SIGN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u037a'   #  0xAA -> GREEK YPOGEGRAMMENI\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\ufffe'\r
+    u'\u2015'   #  0xAF -> HORIZONTAL BAR\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\u0384'   #  0xB4 -> GREEK TONOS\r
+    u'\u0385'   #  0xB5 -> GREEK DIALYTIKA TONOS\r
+    u'\u0386'   #  0xB6 -> GREEK CAPITAL LETTER ALPHA WITH TONOS\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\u0388'   #  0xB8 -> GREEK CAPITAL LETTER EPSILON WITH TONOS\r
+    u'\u0389'   #  0xB9 -> GREEK CAPITAL LETTER ETA WITH TONOS\r
+    u'\u038a'   #  0xBA -> GREEK CAPITAL LETTER IOTA WITH TONOS\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u038c'   #  0xBC -> GREEK CAPITAL LETTER OMICRON WITH TONOS\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\u038e'   #  0xBE -> GREEK CAPITAL LETTER UPSILON WITH TONOS\r
+    u'\u038f'   #  0xBF -> GREEK CAPITAL LETTER OMEGA WITH TONOS\r
+    u'\u0390'   #  0xC0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS\r
+    u'\u0391'   #  0xC1 -> GREEK CAPITAL LETTER ALPHA\r
+    u'\u0392'   #  0xC2 -> GREEK CAPITAL LETTER BETA\r
+    u'\u0393'   #  0xC3 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u0394'   #  0xC4 -> GREEK CAPITAL LETTER DELTA\r
+    u'\u0395'   #  0xC5 -> GREEK CAPITAL LETTER EPSILON\r
+    u'\u0396'   #  0xC6 -> GREEK CAPITAL LETTER ZETA\r
+    u'\u0397'   #  0xC7 -> GREEK CAPITAL LETTER ETA\r
+    u'\u0398'   #  0xC8 -> GREEK CAPITAL LETTER THETA\r
+    u'\u0399'   #  0xC9 -> GREEK CAPITAL LETTER IOTA\r
+    u'\u039a'   #  0xCA -> GREEK CAPITAL LETTER KAPPA\r
+    u'\u039b'   #  0xCB -> GREEK CAPITAL LETTER LAMDA\r
+    u'\u039c'   #  0xCC -> GREEK CAPITAL LETTER MU\r
+    u'\u039d'   #  0xCD -> GREEK CAPITAL LETTER NU\r
+    u'\u039e'   #  0xCE -> GREEK CAPITAL LETTER XI\r
+    u'\u039f'   #  0xCF -> GREEK CAPITAL LETTER OMICRON\r
+    u'\u03a0'   #  0xD0 -> GREEK CAPITAL LETTER PI\r
+    u'\u03a1'   #  0xD1 -> GREEK CAPITAL LETTER RHO\r
+    u'\ufffe'\r
+    u'\u03a3'   #  0xD3 -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03a4'   #  0xD4 -> GREEK CAPITAL LETTER TAU\r
+    u'\u03a5'   #  0xD5 -> GREEK CAPITAL LETTER UPSILON\r
+    u'\u03a6'   #  0xD6 -> GREEK CAPITAL LETTER PHI\r
+    u'\u03a7'   #  0xD7 -> GREEK CAPITAL LETTER CHI\r
+    u'\u03a8'   #  0xD8 -> GREEK CAPITAL LETTER PSI\r
+    u'\u03a9'   #  0xD9 -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03aa'   #  0xDA -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA\r
+    u'\u03ab'   #  0xDB -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA\r
+    u'\u03ac'   #  0xDC -> GREEK SMALL LETTER ALPHA WITH TONOS\r
+    u'\u03ad'   #  0xDD -> GREEK SMALL LETTER EPSILON WITH TONOS\r
+    u'\u03ae'   #  0xDE -> GREEK SMALL LETTER ETA WITH TONOS\r
+    u'\u03af'   #  0xDF -> GREEK SMALL LETTER IOTA WITH TONOS\r
+    u'\u03b0'   #  0xE0 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS\r
+    u'\u03b1'   #  0xE1 -> GREEK SMALL LETTER ALPHA\r
+    u'\u03b2'   #  0xE2 -> GREEK SMALL LETTER BETA\r
+    u'\u03b3'   #  0xE3 -> GREEK SMALL LETTER GAMMA\r
+    u'\u03b4'   #  0xE4 -> GREEK SMALL LETTER DELTA\r
+    u'\u03b5'   #  0xE5 -> GREEK SMALL LETTER EPSILON\r
+    u'\u03b6'   #  0xE6 -> GREEK SMALL LETTER ZETA\r
+    u'\u03b7'   #  0xE7 -> GREEK SMALL LETTER ETA\r
+    u'\u03b8'   #  0xE8 -> GREEK SMALL LETTER THETA\r
+    u'\u03b9'   #  0xE9 -> GREEK SMALL LETTER IOTA\r
+    u'\u03ba'   #  0xEA -> GREEK SMALL LETTER KAPPA\r
+    u'\u03bb'   #  0xEB -> GREEK SMALL LETTER LAMDA\r
+    u'\u03bc'   #  0xEC -> GREEK SMALL LETTER MU\r
+    u'\u03bd'   #  0xED -> GREEK SMALL LETTER NU\r
+    u'\u03be'   #  0xEE -> GREEK SMALL LETTER XI\r
+    u'\u03bf'   #  0xEF -> GREEK SMALL LETTER OMICRON\r
+    u'\u03c0'   #  0xF0 -> GREEK SMALL LETTER PI\r
+    u'\u03c1'   #  0xF1 -> GREEK SMALL LETTER RHO\r
+    u'\u03c2'   #  0xF2 -> GREEK SMALL LETTER FINAL SIGMA\r
+    u'\u03c3'   #  0xF3 -> GREEK SMALL LETTER SIGMA\r
+    u'\u03c4'   #  0xF4 -> GREEK SMALL LETTER TAU\r
+    u'\u03c5'   #  0xF5 -> GREEK SMALL LETTER UPSILON\r
+    u'\u03c6'   #  0xF6 -> GREEK SMALL LETTER PHI\r
+    u'\u03c7'   #  0xF7 -> GREEK SMALL LETTER CHI\r
+    u'\u03c8'   #  0xF8 -> GREEK SMALL LETTER PSI\r
+    u'\u03c9'   #  0xF9 -> GREEK SMALL LETTER OMEGA\r
+    u'\u03ca'   #  0xFA -> GREEK SMALL LETTER IOTA WITH DIALYTIKA\r
+    u'\u03cb'   #  0xFB -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA\r
+    u'\u03cc'   #  0xFC -> GREEK SMALL LETTER OMICRON WITH TONOS\r
+    u'\u03cd'   #  0xFD -> GREEK SMALL LETTER UPSILON WITH TONOS\r
+    u'\u03ce'   #  0xFE -> GREEK SMALL LETTER OMEGA WITH TONOS\r
+    u'\ufffe'\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_8.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_8.py
new file mode 100644 (file)
index 0000000..8810aed
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_8 generated from 'MAPPINGS/ISO8859/8859-8.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-8',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\ufffe'\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\xa5'     #  0xA5 -> YEN SIGN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\xd7'     #  0xAA -> MULTIPLICATION SIGN\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xaf'     #  0xAF -> MACRON\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\xf7'     #  0xBA -> DIVISION SIGN\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbc'     #  0xBC -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xBE -> VULGAR FRACTION THREE QUARTERS\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\u2017'   #  0xDF -> DOUBLE LOW LINE\r
+    u'\u05d0'   #  0xE0 -> HEBREW LETTER ALEF\r
+    u'\u05d1'   #  0xE1 -> HEBREW LETTER BET\r
+    u'\u05d2'   #  0xE2 -> HEBREW LETTER GIMEL\r
+    u'\u05d3'   #  0xE3 -> HEBREW LETTER DALET\r
+    u'\u05d4'   #  0xE4 -> HEBREW LETTER HE\r
+    u'\u05d5'   #  0xE5 -> HEBREW LETTER VAV\r
+    u'\u05d6'   #  0xE6 -> HEBREW LETTER ZAYIN\r
+    u'\u05d7'   #  0xE7 -> HEBREW LETTER HET\r
+    u'\u05d8'   #  0xE8 -> HEBREW LETTER TET\r
+    u'\u05d9'   #  0xE9 -> HEBREW LETTER YOD\r
+    u'\u05da'   #  0xEA -> HEBREW LETTER FINAL KAF\r
+    u'\u05db'   #  0xEB -> HEBREW LETTER KAF\r
+    u'\u05dc'   #  0xEC -> HEBREW LETTER LAMED\r
+    u'\u05dd'   #  0xED -> HEBREW LETTER FINAL MEM\r
+    u'\u05de'   #  0xEE -> HEBREW LETTER MEM\r
+    u'\u05df'   #  0xEF -> HEBREW LETTER FINAL NUN\r
+    u'\u05e0'   #  0xF0 -> HEBREW LETTER NUN\r
+    u'\u05e1'   #  0xF1 -> HEBREW LETTER SAMEKH\r
+    u'\u05e2'   #  0xF2 -> HEBREW LETTER AYIN\r
+    u'\u05e3'   #  0xF3 -> HEBREW LETTER FINAL PE\r
+    u'\u05e4'   #  0xF4 -> HEBREW LETTER PE\r
+    u'\u05e5'   #  0xF5 -> HEBREW LETTER FINAL TSADI\r
+    u'\u05e6'   #  0xF6 -> HEBREW LETTER TSADI\r
+    u'\u05e7'   #  0xF7 -> HEBREW LETTER QOF\r
+    u'\u05e8'   #  0xF8 -> HEBREW LETTER RESH\r
+    u'\u05e9'   #  0xF9 -> HEBREW LETTER SHIN\r
+    u'\u05ea'   #  0xFA -> HEBREW LETTER TAV\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\u200e'   #  0xFD -> LEFT-TO-RIGHT MARK\r
+    u'\u200f'   #  0xFE -> RIGHT-TO-LEFT MARK\r
+    u'\ufffe'\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_9.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_9.py
new file mode 100644 (file)
index 0000000..980e994
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_9 generated from 'MAPPINGS/ISO8859/8859-9.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-9',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\xa0'     #  0xA0 -> NO-BREAK SPACE\r
+    u'\xa1'     #  0xA1 -> INVERTED EXCLAMATION MARK\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa4'     #  0xA4 -> CURRENCY SIGN\r
+    u'\xa5'     #  0xA5 -> YEN SIGN\r
+    u'\xa6'     #  0xA6 -> BROKEN BAR\r
+    u'\xa7'     #  0xA7 -> SECTION SIGN\r
+    u'\xa8'     #  0xA8 -> DIAERESIS\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\xaa'     #  0xAA -> FEMININE ORDINAL INDICATOR\r
+    u'\xab'     #  0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xac'     #  0xAC -> NOT SIGN\r
+    u'\xad'     #  0xAD -> SOFT HYPHEN\r
+    u'\xae'     #  0xAE -> REGISTERED SIGN\r
+    u'\xaf'     #  0xAF -> MACRON\r
+    u'\xb0'     #  0xB0 -> DEGREE SIGN\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\xb2'     #  0xB2 -> SUPERSCRIPT TWO\r
+    u'\xb3'     #  0xB3 -> SUPERSCRIPT THREE\r
+    u'\xb4'     #  0xB4 -> ACUTE ACCENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\xb6'     #  0xB6 -> PILCROW SIGN\r
+    u'\xb7'     #  0xB7 -> MIDDLE DOT\r
+    u'\xb8'     #  0xB8 -> CEDILLA\r
+    u'\xb9'     #  0xB9 -> SUPERSCRIPT ONE\r
+    u'\xba'     #  0xBA -> MASCULINE ORDINAL INDICATOR\r
+    u'\xbb'     #  0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbc'     #  0xBC -> VULGAR FRACTION ONE QUARTER\r
+    u'\xbd'     #  0xBD -> VULGAR FRACTION ONE HALF\r
+    u'\xbe'     #  0xBE -> VULGAR FRACTION THREE QUARTERS\r
+    u'\xbf'     #  0xBF -> INVERTED QUESTION MARK\r
+    u'\xc0'     #  0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc1'     #  0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xc2'     #  0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xc3'     #  0xC3 -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xc4'     #  0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc6'     #  0xC6 -> LATIN CAPITAL LETTER AE\r
+    u'\xc7'     #  0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc8'     #  0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xc9'     #  0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xca'     #  0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xcb'     #  0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xcc'     #  0xCC -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xcd'     #  0xCD -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\u011e'   #  0xD0 -> LATIN CAPITAL LETTER G WITH BREVE\r
+    u'\xd1'     #  0xD1 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd2'     #  0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xd3'     #  0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\xd5'     #  0xD5 -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\xd6'     #  0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xd7'     #  0xD7 -> MULTIPLICATION SIGN\r
+    u'\xd8'     #  0xD8 -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\xd9'     #  0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\xda'     #  0xDA -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xdc'     #  0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\u0130'   #  0xDD -> LATIN CAPITAL LETTER I WITH DOT ABOVE\r
+    u'\u015e'   #  0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA\r
+    u'\xdf'     #  0xDF -> LATIN SMALL LETTER SHARP S\r
+    u'\xe0'     #  0xE0 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe1'     #  0xE1 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe2'     #  0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe3'     #  0xE3 -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe4'     #  0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe5'     #  0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe6'     #  0xE6 -> LATIN SMALL LETTER AE\r
+    u'\xe7'     #  0xE7 -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe8'     #  0xE8 -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xe9'     #  0xE9 -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xea'     #  0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0xEB -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xec'     #  0xEC -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xed'     #  0xED -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xee'     #  0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0xEF -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\u011f'   #  0xF0 -> LATIN SMALL LETTER G WITH BREVE\r
+    u'\xf1'     #  0xF1 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf2'     #  0xF2 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf3'     #  0xF3 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf4'     #  0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf5'     #  0xF5 -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xf6'     #  0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0xF7 -> DIVISION SIGN\r
+    u'\xf8'     #  0xF8 -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xf9'     #  0xF9 -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfa'     #  0xFA -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xfb'     #  0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0xFC -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u0131'   #  0xFD -> LATIN SMALL LETTER DOTLESS I\r
+    u'\u015f'   #  0xFE -> LATIN SMALL LETTER S WITH CEDILLA\r
+    u'\xff'     #  0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/johab.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/johab.py
new file mode 100644 (file)
index 0000000..5c767cd
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# johab.py: Python Unicode Codec for JOHAB\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_kr, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_kr.getcodec('johab')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='johab',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_r.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_r.py
new file mode 100644 (file)
index 0000000..492a618
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec koi8_r generated from 'MAPPINGS/VENDORS/MISC/KOI8-R.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='koi8-r',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u2500'   #  0x80 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u2502'   #  0x81 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u250c'   #  0x82 -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2510'   #  0x83 -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x84 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2518'   #  0x85 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u251c'   #  0x86 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2524'   #  0x87 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u252c'   #  0x88 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u2534'   #  0x89 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u253c'   #  0x8A -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u2580'   #  0x8B -> UPPER HALF BLOCK\r
+    u'\u2584'   #  0x8C -> LOWER HALF BLOCK\r
+    u'\u2588'   #  0x8D -> FULL BLOCK\r
+    u'\u258c'   #  0x8E -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x8F -> RIGHT HALF BLOCK\r
+    u'\u2591'   #  0x90 -> LIGHT SHADE\r
+    u'\u2592'   #  0x91 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x92 -> DARK SHADE\r
+    u'\u2320'   #  0x93 -> TOP HALF INTEGRAL\r
+    u'\u25a0'   #  0x94 -> BLACK SQUARE\r
+    u'\u2219'   #  0x95 -> BULLET OPERATOR\r
+    u'\u221a'   #  0x96 -> SQUARE ROOT\r
+    u'\u2248'   #  0x97 -> ALMOST EQUAL TO\r
+    u'\u2264'   #  0x98 -> LESS-THAN OR EQUAL TO\r
+    u'\u2265'   #  0x99 -> GREATER-THAN OR EQUAL TO\r
+    u'\xa0'     #  0x9A -> NO-BREAK SPACE\r
+    u'\u2321'   #  0x9B -> BOTTOM HALF INTEGRAL\r
+    u'\xb0'     #  0x9C -> DEGREE SIGN\r
+    u'\xb2'     #  0x9D -> SUPERSCRIPT TWO\r
+    u'\xb7'     #  0x9E -> MIDDLE DOT\r
+    u'\xf7'     #  0x9F -> DIVISION SIGN\r
+    u'\u2550'   #  0xA0 -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u2551'   #  0xA1 -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2552'   #  0xA2 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u0451'   #  0xA3 -> CYRILLIC SMALL LETTER IO\r
+    u'\u2553'   #  0xA4 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE\r
+    u'\u2554'   #  0xA5 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u2555'   #  0xA6 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE\r
+    u'\u2556'   #  0xA7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE\r
+    u'\u2557'   #  0xA8 -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u2558'   #  0xA9 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2559'   #  0xAA -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0xAB -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u255b'   #  0xAC -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u255c'   #  0xAD -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE\r
+    u'\u255d'   #  0xAE -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255e'   #  0xAF -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0xB0 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u2560'   #  0xB1 -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2561'   #  0xB2 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u0401'   #  0xB3 -> CYRILLIC CAPITAL LETTER IO\r
+    u'\u2562'   #  0xB4 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE\r
+    u'\u2563'   #  0xB5 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u2564'   #  0xB6 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2565'   #  0xB7 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2566'   #  0xB8 -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2567'   #  0xB9 -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0xBA -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2569'   #  0xBB -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u256a'   #  0xBC -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u256b'   #  0xBD -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u256c'   #  0xBE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\xa9'     #  0xBF -> COPYRIGHT SIGN\r
+    u'\u044e'   #  0xC0 -> CYRILLIC SMALL LETTER YU\r
+    u'\u0430'   #  0xC1 -> CYRILLIC SMALL LETTER A\r
+    u'\u0431'   #  0xC2 -> CYRILLIC SMALL LETTER BE\r
+    u'\u0446'   #  0xC3 -> CYRILLIC SMALL LETTER TSE\r
+    u'\u0434'   #  0xC4 -> CYRILLIC SMALL LETTER DE\r
+    u'\u0435'   #  0xC5 -> CYRILLIC SMALL LETTER IE\r
+    u'\u0444'   #  0xC6 -> CYRILLIC SMALL LETTER EF\r
+    u'\u0433'   #  0xC7 -> CYRILLIC SMALL LETTER GHE\r
+    u'\u0445'   #  0xC8 -> CYRILLIC SMALL LETTER HA\r
+    u'\u0438'   #  0xC9 -> CYRILLIC SMALL LETTER I\r
+    u'\u0439'   #  0xCA -> CYRILLIC SMALL LETTER SHORT I\r
+    u'\u043a'   #  0xCB -> CYRILLIC SMALL LETTER KA\r
+    u'\u043b'   #  0xCC -> CYRILLIC SMALL LETTER EL\r
+    u'\u043c'   #  0xCD -> CYRILLIC SMALL LETTER EM\r
+    u'\u043d'   #  0xCE -> CYRILLIC SMALL LETTER EN\r
+    u'\u043e'   #  0xCF -> CYRILLIC SMALL LETTER O\r
+    u'\u043f'   #  0xD0 -> CYRILLIC SMALL LETTER PE\r
+    u'\u044f'   #  0xD1 -> CYRILLIC SMALL LETTER YA\r
+    u'\u0440'   #  0xD2 -> CYRILLIC SMALL LETTER ER\r
+    u'\u0441'   #  0xD3 -> CYRILLIC SMALL LETTER ES\r
+    u'\u0442'   #  0xD4 -> CYRILLIC SMALL LETTER TE\r
+    u'\u0443'   #  0xD5 -> CYRILLIC SMALL LETTER U\r
+    u'\u0436'   #  0xD6 -> CYRILLIC SMALL LETTER ZHE\r
+    u'\u0432'   #  0xD7 -> CYRILLIC SMALL LETTER VE\r
+    u'\u044c'   #  0xD8 -> CYRILLIC SMALL LETTER SOFT SIGN\r
+    u'\u044b'   #  0xD9 -> CYRILLIC SMALL LETTER YERU\r
+    u'\u0437'   #  0xDA -> CYRILLIC SMALL LETTER ZE\r
+    u'\u0448'   #  0xDB -> CYRILLIC SMALL LETTER SHA\r
+    u'\u044d'   #  0xDC -> CYRILLIC SMALL LETTER E\r
+    u'\u0449'   #  0xDD -> CYRILLIC SMALL LETTER SHCHA\r
+    u'\u0447'   #  0xDE -> CYRILLIC SMALL LETTER CHE\r
+    u'\u044a'   #  0xDF -> CYRILLIC SMALL LETTER HARD SIGN\r
+    u'\u042e'   #  0xE0 -> CYRILLIC CAPITAL LETTER YU\r
+    u'\u0410'   #  0xE1 -> CYRILLIC CAPITAL LETTER A\r
+    u'\u0411'   #  0xE2 -> CYRILLIC CAPITAL LETTER BE\r
+    u'\u0426'   #  0xE3 -> CYRILLIC CAPITAL LETTER TSE\r
+    u'\u0414'   #  0xE4 -> CYRILLIC CAPITAL LETTER DE\r
+    u'\u0415'   #  0xE5 -> CYRILLIC CAPITAL LETTER IE\r
+    u'\u0424'   #  0xE6 -> CYRILLIC CAPITAL LETTER EF\r
+    u'\u0413'   #  0xE7 -> CYRILLIC CAPITAL LETTER GHE\r
+    u'\u0425'   #  0xE8 -> CYRILLIC CAPITAL LETTER HA\r
+    u'\u0418'   #  0xE9 -> CYRILLIC CAPITAL LETTER I\r
+    u'\u0419'   #  0xEA -> CYRILLIC CAPITAL LETTER SHORT I\r
+    u'\u041a'   #  0xEB -> CYRILLIC CAPITAL LETTER KA\r
+    u'\u041b'   #  0xEC -> CYRILLIC CAPITAL LETTER EL\r
+    u'\u041c'   #  0xED -> CYRILLIC CAPITAL LETTER EM\r
+    u'\u041d'   #  0xEE -> CYRILLIC CAPITAL LETTER EN\r
+    u'\u041e'   #  0xEF -> CYRILLIC CAPITAL LETTER O\r
+    u'\u041f'   #  0xF0 -> CYRILLIC CAPITAL LETTER PE\r
+    u'\u042f'   #  0xF1 -> CYRILLIC CAPITAL LETTER YA\r
+    u'\u0420'   #  0xF2 -> CYRILLIC CAPITAL LETTER ER\r
+    u'\u0421'   #  0xF3 -> CYRILLIC CAPITAL LETTER ES\r
+    u'\u0422'   #  0xF4 -> CYRILLIC CAPITAL LETTER TE\r
+    u'\u0423'   #  0xF5 -> CYRILLIC CAPITAL LETTER U\r
+    u'\u0416'   #  0xF6 -> CYRILLIC CAPITAL LETTER ZHE\r
+    u'\u0412'   #  0xF7 -> CYRILLIC CAPITAL LETTER VE\r
+    u'\u042c'   #  0xF8 -> CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    u'\u042b'   #  0xF9 -> CYRILLIC CAPITAL LETTER YERU\r
+    u'\u0417'   #  0xFA -> CYRILLIC CAPITAL LETTER ZE\r
+    u'\u0428'   #  0xFB -> CYRILLIC CAPITAL LETTER SHA\r
+    u'\u042d'   #  0xFC -> CYRILLIC CAPITAL LETTER E\r
+    u'\u0429'   #  0xFD -> CYRILLIC CAPITAL LETTER SHCHA\r
+    u'\u0427'   #  0xFE -> CYRILLIC CAPITAL LETTER CHE\r
+    u'\u042a'   #  0xFF -> CYRILLIC CAPITAL LETTER HARD SIGN\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_u.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_u.py
new file mode 100644 (file)
index 0000000..edb85f4
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec koi8_u generated from 'python-mappings/KOI8-U.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='koi8-u',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\u2500'   #  0x80 -> BOX DRAWINGS LIGHT HORIZONTAL\r
+    u'\u2502'   #  0x81 -> BOX DRAWINGS LIGHT VERTICAL\r
+    u'\u250c'   #  0x82 -> BOX DRAWINGS LIGHT DOWN AND RIGHT\r
+    u'\u2510'   #  0x83 -> BOX DRAWINGS LIGHT DOWN AND LEFT\r
+    u'\u2514'   #  0x84 -> BOX DRAWINGS LIGHT UP AND RIGHT\r
+    u'\u2518'   #  0x85 -> BOX DRAWINGS LIGHT UP AND LEFT\r
+    u'\u251c'   #  0x86 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT\r
+    u'\u2524'   #  0x87 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT\r
+    u'\u252c'   #  0x88 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL\r
+    u'\u2534'   #  0x89 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL\r
+    u'\u253c'   #  0x8A -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL\r
+    u'\u2580'   #  0x8B -> UPPER HALF BLOCK\r
+    u'\u2584'   #  0x8C -> LOWER HALF BLOCK\r
+    u'\u2588'   #  0x8D -> FULL BLOCK\r
+    u'\u258c'   #  0x8E -> LEFT HALF BLOCK\r
+    u'\u2590'   #  0x8F -> RIGHT HALF BLOCK\r
+    u'\u2591'   #  0x90 -> LIGHT SHADE\r
+    u'\u2592'   #  0x91 -> MEDIUM SHADE\r
+    u'\u2593'   #  0x92 -> DARK SHADE\r
+    u'\u2320'   #  0x93 -> TOP HALF INTEGRAL\r
+    u'\u25a0'   #  0x94 -> BLACK SQUARE\r
+    u'\u2219'   #  0x95 -> BULLET OPERATOR\r
+    u'\u221a'   #  0x96 -> SQUARE ROOT\r
+    u'\u2248'   #  0x97 -> ALMOST EQUAL TO\r
+    u'\u2264'   #  0x98 -> LESS-THAN OR EQUAL TO\r
+    u'\u2265'   #  0x99 -> GREATER-THAN OR EQUAL TO\r
+    u'\xa0'     #  0x9A -> NO-BREAK SPACE\r
+    u'\u2321'   #  0x9B -> BOTTOM HALF INTEGRAL\r
+    u'\xb0'     #  0x9C -> DEGREE SIGN\r
+    u'\xb2'     #  0x9D -> SUPERSCRIPT TWO\r
+    u'\xb7'     #  0x9E -> MIDDLE DOT\r
+    u'\xf7'     #  0x9F -> DIVISION SIGN\r
+    u'\u2550'   #  0xA0 -> BOX DRAWINGS DOUBLE HORIZONTAL\r
+    u'\u2551'   #  0xA1 -> BOX DRAWINGS DOUBLE VERTICAL\r
+    u'\u2552'   #  0xA2 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE\r
+    u'\u0451'   #  0xA3 -> CYRILLIC SMALL LETTER IO\r
+    u'\u0454'   #  0xA4 -> CYRILLIC SMALL LETTER UKRAINIAN IE\r
+    u'\u2554'   #  0xA5 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT\r
+    u'\u0456'   #  0xA6 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    u'\u0457'   #  0xA7 -> CYRILLIC SMALL LETTER YI (UKRAINIAN)\r
+    u'\u2557'   #  0xA8 -> BOX DRAWINGS DOUBLE DOWN AND LEFT\r
+    u'\u2558'   #  0xA9 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE\r
+    u'\u2559'   #  0xAA -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE\r
+    u'\u255a'   #  0xAB -> BOX DRAWINGS DOUBLE UP AND RIGHT\r
+    u'\u255b'   #  0xAC -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE\r
+    u'\u0491'   #  0xAD -> CYRILLIC SMALL LETTER UKRAINIAN GHE WITH UPTURN\r
+    u'\u255d'   #  0xAE -> BOX DRAWINGS DOUBLE UP AND LEFT\r
+    u'\u255e'   #  0xAF -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE\r
+    u'\u255f'   #  0xB0 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE\r
+    u'\u2560'   #  0xB1 -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT\r
+    u'\u2561'   #  0xB2 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE\r
+    u'\u0401'   #  0xB3 -> CYRILLIC CAPITAL LETTER IO\r
+    u'\u0404'   #  0xB4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE\r
+    u'\u2563'   #  0xB5 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT\r
+    u'\u0406'   #  0xB6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    u'\u0407'   #  0xB7 -> CYRILLIC CAPITAL LETTER YI (UKRAINIAN)\r
+    u'\u2566'   #  0xB8 -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL\r
+    u'\u2567'   #  0xB9 -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u2568'   #  0xBA -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE\r
+    u'\u2569'   #  0xBB -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL\r
+    u'\u256a'   #  0xBC -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE\r
+    u'\u0490'   #  0xBD -> CYRILLIC CAPITAL LETTER UKRAINIAN GHE WITH UPTURN\r
+    u'\u256c'   #  0xBE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL\r
+    u'\xa9'     #  0xBF -> COPYRIGHT SIGN\r
+    u'\u044e'   #  0xC0 -> CYRILLIC SMALL LETTER YU\r
+    u'\u0430'   #  0xC1 -> CYRILLIC SMALL LETTER A\r
+    u'\u0431'   #  0xC2 -> CYRILLIC SMALL LETTER BE\r
+    u'\u0446'   #  0xC3 -> CYRILLIC SMALL LETTER TSE\r
+    u'\u0434'   #  0xC4 -> CYRILLIC SMALL LETTER DE\r
+    u'\u0435'   #  0xC5 -> CYRILLIC SMALL LETTER IE\r
+    u'\u0444'   #  0xC6 -> CYRILLIC SMALL LETTER EF\r
+    u'\u0433'   #  0xC7 -> CYRILLIC SMALL LETTER GHE\r
+    u'\u0445'   #  0xC8 -> CYRILLIC SMALL LETTER HA\r
+    u'\u0438'   #  0xC9 -> CYRILLIC SMALL LETTER I\r
+    u'\u0439'   #  0xCA -> CYRILLIC SMALL LETTER SHORT I\r
+    u'\u043a'   #  0xCB -> CYRILLIC SMALL LETTER KA\r
+    u'\u043b'   #  0xCC -> CYRILLIC SMALL LETTER EL\r
+    u'\u043c'   #  0xCD -> CYRILLIC SMALL LETTER EM\r
+    u'\u043d'   #  0xCE -> CYRILLIC SMALL LETTER EN\r
+    u'\u043e'   #  0xCF -> CYRILLIC SMALL LETTER O\r
+    u'\u043f'   #  0xD0 -> CYRILLIC SMALL LETTER PE\r
+    u'\u044f'   #  0xD1 -> CYRILLIC SMALL LETTER YA\r
+    u'\u0440'   #  0xD2 -> CYRILLIC SMALL LETTER ER\r
+    u'\u0441'   #  0xD3 -> CYRILLIC SMALL LETTER ES\r
+    u'\u0442'   #  0xD4 -> CYRILLIC SMALL LETTER TE\r
+    u'\u0443'   #  0xD5 -> CYRILLIC SMALL LETTER U\r
+    u'\u0436'   #  0xD6 -> CYRILLIC SMALL LETTER ZHE\r
+    u'\u0432'   #  0xD7 -> CYRILLIC SMALL LETTER VE\r
+    u'\u044c'   #  0xD8 -> CYRILLIC SMALL LETTER SOFT SIGN\r
+    u'\u044b'   #  0xD9 -> CYRILLIC SMALL LETTER YERU\r
+    u'\u0437'   #  0xDA -> CYRILLIC SMALL LETTER ZE\r
+    u'\u0448'   #  0xDB -> CYRILLIC SMALL LETTER SHA\r
+    u'\u044d'   #  0xDC -> CYRILLIC SMALL LETTER E\r
+    u'\u0449'   #  0xDD -> CYRILLIC SMALL LETTER SHCHA\r
+    u'\u0447'   #  0xDE -> CYRILLIC SMALL LETTER CHE\r
+    u'\u044a'   #  0xDF -> CYRILLIC SMALL LETTER HARD SIGN\r
+    u'\u042e'   #  0xE0 -> CYRILLIC CAPITAL LETTER YU\r
+    u'\u0410'   #  0xE1 -> CYRILLIC CAPITAL LETTER A\r
+    u'\u0411'   #  0xE2 -> CYRILLIC CAPITAL LETTER BE\r
+    u'\u0426'   #  0xE3 -> CYRILLIC CAPITAL LETTER TSE\r
+    u'\u0414'   #  0xE4 -> CYRILLIC CAPITAL LETTER DE\r
+    u'\u0415'   #  0xE5 -> CYRILLIC CAPITAL LETTER IE\r
+    u'\u0424'   #  0xE6 -> CYRILLIC CAPITAL LETTER EF\r
+    u'\u0413'   #  0xE7 -> CYRILLIC CAPITAL LETTER GHE\r
+    u'\u0425'   #  0xE8 -> CYRILLIC CAPITAL LETTER HA\r
+    u'\u0418'   #  0xE9 -> CYRILLIC CAPITAL LETTER I\r
+    u'\u0419'   #  0xEA -> CYRILLIC CAPITAL LETTER SHORT I\r
+    u'\u041a'   #  0xEB -> CYRILLIC CAPITAL LETTER KA\r
+    u'\u041b'   #  0xEC -> CYRILLIC CAPITAL LETTER EL\r
+    u'\u041c'   #  0xED -> CYRILLIC CAPITAL LETTER EM\r
+    u'\u041d'   #  0xEE -> CYRILLIC CAPITAL LETTER EN\r
+    u'\u041e'   #  0xEF -> CYRILLIC CAPITAL LETTER O\r
+    u'\u041f'   #  0xF0 -> CYRILLIC CAPITAL LETTER PE\r
+    u'\u042f'   #  0xF1 -> CYRILLIC CAPITAL LETTER YA\r
+    u'\u0420'   #  0xF2 -> CYRILLIC CAPITAL LETTER ER\r
+    u'\u0421'   #  0xF3 -> CYRILLIC CAPITAL LETTER ES\r
+    u'\u0422'   #  0xF4 -> CYRILLIC CAPITAL LETTER TE\r
+    u'\u0423'   #  0xF5 -> CYRILLIC CAPITAL LETTER U\r
+    u'\u0416'   #  0xF6 -> CYRILLIC CAPITAL LETTER ZHE\r
+    u'\u0412'   #  0xF7 -> CYRILLIC CAPITAL LETTER VE\r
+    u'\u042c'   #  0xF8 -> CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    u'\u042b'   #  0xF9 -> CYRILLIC CAPITAL LETTER YERU\r
+    u'\u0417'   #  0xFA -> CYRILLIC CAPITAL LETTER ZE\r
+    u'\u0428'   #  0xFB -> CYRILLIC CAPITAL LETTER SHA\r
+    u'\u042d'   #  0xFC -> CYRILLIC CAPITAL LETTER E\r
+    u'\u0429'   #  0xFD -> CYRILLIC CAPITAL LETTER SHCHA\r
+    u'\u0427'   #  0xFE -> CYRILLIC CAPITAL LETTER CHE\r
+    u'\u042a'   #  0xFF -> CYRILLIC CAPITAL LETTER HARD SIGN\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/latin_1.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/latin_1.py
new file mode 100644 (file)
index 0000000..a6193bc
--- /dev/null
@@ -0,0 +1,50 @@
+""" Python 'latin-1' Codec\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    # Note: Binding these as C functions will result in the class not\r
+    # converting them to methods. This is intended.\r
+    encode = codecs.latin_1_encode\r
+    decode = codecs.latin_1_decode\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.latin_1_encode(input,self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.latin_1_decode(input,self.errors)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+class StreamConverter(StreamWriter,StreamReader):\r
+\r
+    encode = codecs.latin_1_decode\r
+    decode = codecs.latin_1_encode\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='iso8859-1',\r
+        encode=Codec.encode,\r
+        decode=Codec.decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_arabic.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_arabic.py
new file mode 100644 (file)
index 0000000..e5e63e3
--- /dev/null
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/APPLE/ARABIC.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-arabic',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+    0x0080: 0x00c4,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x0081: 0x00a0,     #  NO-BREAK SPACE, right-left\r
+    0x0082: 0x00c7,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x0083: 0x00c9,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x0084: 0x00d1,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x0085: 0x00d6,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x0086: 0x00dc,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x0087: 0x00e1,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x0088: 0x00e0,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x0089: 0x00e2,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x008a: 0x00e4,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x008b: 0x06ba,     #  ARABIC LETTER NOON GHUNNA\r
+    0x008c: 0x00ab,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left\r
+    0x008d: 0x00e7,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x008e: 0x00e9,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x008f: 0x00e8,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x0090: 0x00ea,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x0091: 0x00eb,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x0092: 0x00ed,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x0093: 0x2026,     #  HORIZONTAL ELLIPSIS, right-left\r
+    0x0094: 0x00ee,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x0095: 0x00ef,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x0096: 0x00f1,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x0097: 0x00f3,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x0098: 0x00bb,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left\r
+    0x0099: 0x00f4,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x009a: 0x00f6,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x009b: 0x00f7,     #  DIVISION SIGN, right-left\r
+    0x009c: 0x00fa,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x009d: 0x00f9,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x009e: 0x00fb,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x009f: 0x00fc,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x00a0: 0x0020,     #  SPACE, right-left\r
+    0x00a1: 0x0021,     #  EXCLAMATION MARK, right-left\r
+    0x00a2: 0x0022,     #  QUOTATION MARK, right-left\r
+    0x00a3: 0x0023,     #  NUMBER SIGN, right-left\r
+    0x00a4: 0x0024,     #  DOLLAR SIGN, right-left\r
+    0x00a5: 0x066a,     #  ARABIC PERCENT SIGN\r
+    0x00a6: 0x0026,     #  AMPERSAND, right-left\r
+    0x00a7: 0x0027,     #  APOSTROPHE, right-left\r
+    0x00a8: 0x0028,     #  LEFT PARENTHESIS, right-left\r
+    0x00a9: 0x0029,     #  RIGHT PARENTHESIS, right-left\r
+    0x00aa: 0x002a,     #  ASTERISK, right-left\r
+    0x00ab: 0x002b,     #  PLUS SIGN, right-left\r
+    0x00ac: 0x060c,     #  ARABIC COMMA\r
+    0x00ad: 0x002d,     #  HYPHEN-MINUS, right-left\r
+    0x00ae: 0x002e,     #  FULL STOP, right-left\r
+    0x00af: 0x002f,     #  SOLIDUS, right-left\r
+    0x00b0: 0x0660,     #  ARABIC-INDIC DIGIT ZERO, right-left (need override)\r
+    0x00b1: 0x0661,     #  ARABIC-INDIC DIGIT ONE, right-left (need override)\r
+    0x00b2: 0x0662,     #  ARABIC-INDIC DIGIT TWO, right-left (need override)\r
+    0x00b3: 0x0663,     #  ARABIC-INDIC DIGIT THREE, right-left (need override)\r
+    0x00b4: 0x0664,     #  ARABIC-INDIC DIGIT FOUR, right-left (need override)\r
+    0x00b5: 0x0665,     #  ARABIC-INDIC DIGIT FIVE, right-left (need override)\r
+    0x00b6: 0x0666,     #  ARABIC-INDIC DIGIT SIX, right-left (need override)\r
+    0x00b7: 0x0667,     #  ARABIC-INDIC DIGIT SEVEN, right-left (need override)\r
+    0x00b8: 0x0668,     #  ARABIC-INDIC DIGIT EIGHT, right-left (need override)\r
+    0x00b9: 0x0669,     #  ARABIC-INDIC DIGIT NINE, right-left (need override)\r
+    0x00ba: 0x003a,     #  COLON, right-left\r
+    0x00bb: 0x061b,     #  ARABIC SEMICOLON\r
+    0x00bc: 0x003c,     #  LESS-THAN SIGN, right-left\r
+    0x00bd: 0x003d,     #  EQUALS SIGN, right-left\r
+    0x00be: 0x003e,     #  GREATER-THAN SIGN, right-left\r
+    0x00bf: 0x061f,     #  ARABIC QUESTION MARK\r
+    0x00c0: 0x274a,     #  EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left\r
+    0x00c1: 0x0621,     #  ARABIC LETTER HAMZA\r
+    0x00c2: 0x0622,     #  ARABIC LETTER ALEF WITH MADDA ABOVE\r
+    0x00c3: 0x0623,     #  ARABIC LETTER ALEF WITH HAMZA ABOVE\r
+    0x00c4: 0x0624,     #  ARABIC LETTER WAW WITH HAMZA ABOVE\r
+    0x00c5: 0x0625,     #  ARABIC LETTER ALEF WITH HAMZA BELOW\r
+    0x00c6: 0x0626,     #  ARABIC LETTER YEH WITH HAMZA ABOVE\r
+    0x00c7: 0x0627,     #  ARABIC LETTER ALEF\r
+    0x00c8: 0x0628,     #  ARABIC LETTER BEH\r
+    0x00c9: 0x0629,     #  ARABIC LETTER TEH MARBUTA\r
+    0x00ca: 0x062a,     #  ARABIC LETTER TEH\r
+    0x00cb: 0x062b,     #  ARABIC LETTER THEH\r
+    0x00cc: 0x062c,     #  ARABIC LETTER JEEM\r
+    0x00cd: 0x062d,     #  ARABIC LETTER HAH\r
+    0x00ce: 0x062e,     #  ARABIC LETTER KHAH\r
+    0x00cf: 0x062f,     #  ARABIC LETTER DAL\r
+    0x00d0: 0x0630,     #  ARABIC LETTER THAL\r
+    0x00d1: 0x0631,     #  ARABIC LETTER REH\r
+    0x00d2: 0x0632,     #  ARABIC LETTER ZAIN\r
+    0x00d3: 0x0633,     #  ARABIC LETTER SEEN\r
+    0x00d4: 0x0634,     #  ARABIC LETTER SHEEN\r
+    0x00d5: 0x0635,     #  ARABIC LETTER SAD\r
+    0x00d6: 0x0636,     #  ARABIC LETTER DAD\r
+    0x00d7: 0x0637,     #  ARABIC LETTER TAH\r
+    0x00d8: 0x0638,     #  ARABIC LETTER ZAH\r
+    0x00d9: 0x0639,     #  ARABIC LETTER AIN\r
+    0x00da: 0x063a,     #  ARABIC LETTER GHAIN\r
+    0x00db: 0x005b,     #  LEFT SQUARE BRACKET, right-left\r
+    0x00dc: 0x005c,     #  REVERSE SOLIDUS, right-left\r
+    0x00dd: 0x005d,     #  RIGHT SQUARE BRACKET, right-left\r
+    0x00de: 0x005e,     #  CIRCUMFLEX ACCENT, right-left\r
+    0x00df: 0x005f,     #  LOW LINE, right-left\r
+    0x00e0: 0x0640,     #  ARABIC TATWEEL\r
+    0x00e1: 0x0641,     #  ARABIC LETTER FEH\r
+    0x00e2: 0x0642,     #  ARABIC LETTER QAF\r
+    0x00e3: 0x0643,     #  ARABIC LETTER KAF\r
+    0x00e4: 0x0644,     #  ARABIC LETTER LAM\r
+    0x00e5: 0x0645,     #  ARABIC LETTER MEEM\r
+    0x00e6: 0x0646,     #  ARABIC LETTER NOON\r
+    0x00e7: 0x0647,     #  ARABIC LETTER HEH\r
+    0x00e8: 0x0648,     #  ARABIC LETTER WAW\r
+    0x00e9: 0x0649,     #  ARABIC LETTER ALEF MAKSURA\r
+    0x00ea: 0x064a,     #  ARABIC LETTER YEH\r
+    0x00eb: 0x064b,     #  ARABIC FATHATAN\r
+    0x00ec: 0x064c,     #  ARABIC DAMMATAN\r
+    0x00ed: 0x064d,     #  ARABIC KASRATAN\r
+    0x00ee: 0x064e,     #  ARABIC FATHA\r
+    0x00ef: 0x064f,     #  ARABIC DAMMA\r
+    0x00f0: 0x0650,     #  ARABIC KASRA\r
+    0x00f1: 0x0651,     #  ARABIC SHADDA\r
+    0x00f2: 0x0652,     #  ARABIC SUKUN\r
+    0x00f3: 0x067e,     #  ARABIC LETTER PEH\r
+    0x00f4: 0x0679,     #  ARABIC LETTER TTEH\r
+    0x00f5: 0x0686,     #  ARABIC LETTER TCHEH\r
+    0x00f6: 0x06d5,     #  ARABIC LETTER AE\r
+    0x00f7: 0x06a4,     #  ARABIC LETTER VEH\r
+    0x00f8: 0x06af,     #  ARABIC LETTER GAF\r
+    0x00f9: 0x0688,     #  ARABIC LETTER DDAL\r
+    0x00fa: 0x0691,     #  ARABIC LETTER RREH\r
+    0x00fb: 0x007b,     #  LEFT CURLY BRACKET, right-left\r
+    0x00fc: 0x007c,     #  VERTICAL LINE, right-left\r
+    0x00fd: 0x007d,     #  RIGHT CURLY BRACKET, right-left\r
+    0x00fe: 0x0698,     #  ARABIC LETTER JEH\r
+    0x00ff: 0x06d2,     #  ARABIC LETTER YEH BARREE\r
+})\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x0000 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x0001 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x0002 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x0003 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x0004 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x0005 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x0006 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x0007 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x0008 -> CONTROL CHARACTER\r
+    u'\t'       #  0x0009 -> CONTROL CHARACTER\r
+    u'\n'       #  0x000a -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x000b -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x000c -> CONTROL CHARACTER\r
+    u'\r'       #  0x000d -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x000e -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x000f -> CONTROL CHARACTER\r
+    u'\x10'     #  0x0010 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x0011 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x0012 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x0013 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x0014 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x0015 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x0016 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x0017 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x0018 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x0019 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x001a -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x001b -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x001c -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x001d -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x001e -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x001f -> CONTROL CHARACTER\r
+    u' '        #  0x0020 -> SPACE, left-right\r
+    u'!'        #  0x0021 -> EXCLAMATION MARK, left-right\r
+    u'"'        #  0x0022 -> QUOTATION MARK, left-right\r
+    u'#'        #  0x0023 -> NUMBER SIGN, left-right\r
+    u'$'        #  0x0024 -> DOLLAR SIGN, left-right\r
+    u'%'        #  0x0025 -> PERCENT SIGN, left-right\r
+    u'&'        #  0x0026 -> AMPERSAND, left-right\r
+    u"'"        #  0x0027 -> APOSTROPHE, left-right\r
+    u'('        #  0x0028 -> LEFT PARENTHESIS, left-right\r
+    u')'        #  0x0029 -> RIGHT PARENTHESIS, left-right\r
+    u'*'        #  0x002a -> ASTERISK, left-right\r
+    u'+'        #  0x002b -> PLUS SIGN, left-right\r
+    u','        #  0x002c -> COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR\r
+    u'-'        #  0x002d -> HYPHEN-MINUS, left-right\r
+    u'.'        #  0x002e -> FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR\r
+    u'/'        #  0x002f -> SOLIDUS, left-right\r
+    u'0'        #  0x0030 -> DIGIT ZERO;  in Arabic-script context, displayed as 0x0660 ARABIC-INDIC DIGIT ZERO\r
+    u'1'        #  0x0031 -> DIGIT ONE;   in Arabic-script context, displayed as 0x0661 ARABIC-INDIC DIGIT ONE\r
+    u'2'        #  0x0032 -> DIGIT TWO;   in Arabic-script context, displayed as 0x0662 ARABIC-INDIC DIGIT TWO\r
+    u'3'        #  0x0033 -> DIGIT THREE; in Arabic-script context, displayed as 0x0663 ARABIC-INDIC DIGIT THREE\r
+    u'4'        #  0x0034 -> DIGIT FOUR;  in Arabic-script context, displayed as 0x0664 ARABIC-INDIC DIGIT FOUR\r
+    u'5'        #  0x0035 -> DIGIT FIVE;  in Arabic-script context, displayed as 0x0665 ARABIC-INDIC DIGIT FIVE\r
+    u'6'        #  0x0036 -> DIGIT SIX;   in Arabic-script context, displayed as 0x0666 ARABIC-INDIC DIGIT SIX\r
+    u'7'        #  0x0037 -> DIGIT SEVEN; in Arabic-script context, displayed as 0x0667 ARABIC-INDIC DIGIT SEVEN\r
+    u'8'        #  0x0038 -> DIGIT EIGHT; in Arabic-script context, displayed as 0x0668 ARABIC-INDIC DIGIT EIGHT\r
+    u'9'        #  0x0039 -> DIGIT NINE;  in Arabic-script context, displayed as 0x0669 ARABIC-INDIC DIGIT NINE\r
+    u':'        #  0x003a -> COLON, left-right\r
+    u';'        #  0x003b -> SEMICOLON, left-right\r
+    u'<'        #  0x003c -> LESS-THAN SIGN, left-right\r
+    u'='        #  0x003d -> EQUALS SIGN, left-right\r
+    u'>'        #  0x003e -> GREATER-THAN SIGN, left-right\r
+    u'?'        #  0x003f -> QUESTION MARK, left-right\r
+    u'@'        #  0x0040 -> COMMERCIAL AT\r
+    u'A'        #  0x0041 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x0042 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x0043 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x0044 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x0045 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x0046 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x0047 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x0048 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x0049 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x004a -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x004b -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x004c -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x004d -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x004e -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x004f -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x0050 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x0051 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x0052 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x0053 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x0054 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x0055 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x0056 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x0057 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x0058 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x0059 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x005a -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x005b -> LEFT SQUARE BRACKET, left-right\r
+    u'\\'       #  0x005c -> REVERSE SOLIDUS, left-right\r
+    u']'        #  0x005d -> RIGHT SQUARE BRACKET, left-right\r
+    u'^'        #  0x005e -> CIRCUMFLEX ACCENT, left-right\r
+    u'_'        #  0x005f -> LOW LINE, left-right\r
+    u'`'        #  0x0060 -> GRAVE ACCENT\r
+    u'a'        #  0x0061 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x0062 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x0063 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x0064 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x0065 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x0066 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x0067 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x0068 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x0069 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x006a -> LATIN SMALL LETTER J\r
+    u'k'        #  0x006b -> LATIN SMALL LETTER K\r
+    u'l'        #  0x006c -> LATIN SMALL LETTER L\r
+    u'm'        #  0x006d -> LATIN SMALL LETTER M\r
+    u'n'        #  0x006e -> LATIN SMALL LETTER N\r
+    u'o'        #  0x006f -> LATIN SMALL LETTER O\r
+    u'p'        #  0x0070 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x0071 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x0072 -> LATIN SMALL LETTER R\r
+    u's'        #  0x0073 -> LATIN SMALL LETTER S\r
+    u't'        #  0x0074 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x0075 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x0076 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x0077 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x0078 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x0079 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x007a -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x007b -> LEFT CURLY BRACKET, left-right\r
+    u'|'        #  0x007c -> VERTICAL LINE, left-right\r
+    u'}'        #  0x007d -> RIGHT CURLY BRACKET, left-right\r
+    u'~'        #  0x007e -> TILDE\r
+    u'\x7f'     #  0x007f -> CONTROL CHARACTER\r
+    u'\xc4'     #  0x0080 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xa0'     #  0x0081 -> NO-BREAK SPACE, right-left\r
+    u'\xc7'     #  0x0082 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc9'     #  0x0083 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xd1'     #  0x0084 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd6'     #  0x0085 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x0086 -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xe1'     #  0x0087 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe0'     #  0x0088 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe2'     #  0x0089 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x008a -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\u06ba'   #  0x008b -> ARABIC LETTER NOON GHUNNA\r
+    u'\xab'     #  0x008c -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left\r
+    u'\xe7'     #  0x008d -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe9'     #  0x008e -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe8'     #  0x008f -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xea'     #  0x0090 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x0091 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xed'     #  0x0092 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\u2026'   #  0x0093 -> HORIZONTAL ELLIPSIS, right-left\r
+    u'\xee'     #  0x0094 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x0095 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf1'     #  0x0096 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf3'     #  0x0097 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xbb'     #  0x0098 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left\r
+    u'\xf4'     #  0x0099 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x009a -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0x009b -> DIVISION SIGN, right-left\r
+    u'\xfa'     #  0x009c -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf9'     #  0x009d -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfb'     #  0x009e -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0x009f -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u' '        #  0x00a0 -> SPACE, right-left\r
+    u'!'        #  0x00a1 -> EXCLAMATION MARK, right-left\r
+    u'"'        #  0x00a2 -> QUOTATION MARK, right-left\r
+    u'#'        #  0x00a3 -> NUMBER SIGN, right-left\r
+    u'$'        #  0x00a4 -> DOLLAR SIGN, right-left\r
+    u'\u066a'   #  0x00a5 -> ARABIC PERCENT SIGN\r
+    u'&'        #  0x00a6 -> AMPERSAND, right-left\r
+    u"'"        #  0x00a7 -> APOSTROPHE, right-left\r
+    u'('        #  0x00a8 -> LEFT PARENTHESIS, right-left\r
+    u')'        #  0x00a9 -> RIGHT PARENTHESIS, right-left\r
+    u'*'        #  0x00aa -> ASTERISK, right-left\r
+    u'+'        #  0x00ab -> PLUS SIGN, right-left\r
+    u'\u060c'   #  0x00ac -> ARABIC COMMA\r
+    u'-'        #  0x00ad -> HYPHEN-MINUS, right-left\r
+    u'.'        #  0x00ae -> FULL STOP, right-left\r
+    u'/'        #  0x00af -> SOLIDUS, right-left\r
+    u'\u0660'   #  0x00b0 -> ARABIC-INDIC DIGIT ZERO, right-left (need override)\r
+    u'\u0661'   #  0x00b1 -> ARABIC-INDIC DIGIT ONE, right-left (need override)\r
+    u'\u0662'   #  0x00b2 -> ARABIC-INDIC DIGIT TWO, right-left (need override)\r
+    u'\u0663'   #  0x00b3 -> ARABIC-INDIC DIGIT THREE, right-left (need override)\r
+    u'\u0664'   #  0x00b4 -> ARABIC-INDIC DIGIT FOUR, right-left (need override)\r
+    u'\u0665'   #  0x00b5 -> ARABIC-INDIC DIGIT FIVE, right-left (need override)\r
+    u'\u0666'   #  0x00b6 -> ARABIC-INDIC DIGIT SIX, right-left (need override)\r
+    u'\u0667'   #  0x00b7 -> ARABIC-INDIC DIGIT SEVEN, right-left (need override)\r
+    u'\u0668'   #  0x00b8 -> ARABIC-INDIC DIGIT EIGHT, right-left (need override)\r
+    u'\u0669'   #  0x00b9 -> ARABIC-INDIC DIGIT NINE, right-left (need override)\r
+    u':'        #  0x00ba -> COLON, right-left\r
+    u'\u061b'   #  0x00bb -> ARABIC SEMICOLON\r
+    u'<'        #  0x00bc -> LESS-THAN SIGN, right-left\r
+    u'='        #  0x00bd -> EQUALS SIGN, right-left\r
+    u'>'        #  0x00be -> GREATER-THAN SIGN, right-left\r
+    u'\u061f'   #  0x00bf -> ARABIC QUESTION MARK\r
+    u'\u274a'   #  0x00c0 -> EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left\r
+    u'\u0621'   #  0x00c1 -> ARABIC LETTER HAMZA\r
+    u'\u0622'   #  0x00c2 -> ARABIC LETTER ALEF WITH MADDA ABOVE\r
+    u'\u0623'   #  0x00c3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE\r
+    u'\u0624'   #  0x00c4 -> ARABIC LETTER WAW WITH HAMZA ABOVE\r
+    u'\u0625'   #  0x00c5 -> ARABIC LETTER ALEF WITH HAMZA BELOW\r
+    u'\u0626'   #  0x00c6 -> ARABIC LETTER YEH WITH HAMZA ABOVE\r
+    u'\u0627'   #  0x00c7 -> ARABIC LETTER ALEF\r
+    u'\u0628'   #  0x00c8 -> ARABIC LETTER BEH\r
+    u'\u0629'   #  0x00c9 -> ARABIC LETTER TEH MARBUTA\r
+    u'\u062a'   #  0x00ca -> ARABIC LETTER TEH\r
+    u'\u062b'   #  0x00cb -> ARABIC LETTER THEH\r
+    u'\u062c'   #  0x00cc -> ARABIC LETTER JEEM\r
+    u'\u062d'   #  0x00cd -> ARABIC LETTER HAH\r
+    u'\u062e'   #  0x00ce -> ARABIC LETTER KHAH\r
+    u'\u062f'   #  0x00cf -> ARABIC LETTER DAL\r
+    u'\u0630'   #  0x00d0 -> ARABIC LETTER THAL\r
+    u'\u0631'   #  0x00d1 -> ARABIC LETTER REH\r
+    u'\u0632'   #  0x00d2 -> ARABIC LETTER ZAIN\r
+    u'\u0633'   #  0x00d3 -> ARABIC LETTER SEEN\r
+    u'\u0634'   #  0x00d4 -> ARABIC LETTER SHEEN\r
+    u'\u0635'   #  0x00d5 -> ARABIC LETTER SAD\r
+    u'\u0636'   #  0x00d6 -> ARABIC LETTER DAD\r
+    u'\u0637'   #  0x00d7 -> ARABIC LETTER TAH\r
+    u'\u0638'   #  0x00d8 -> ARABIC LETTER ZAH\r
+    u'\u0639'   #  0x00d9 -> ARABIC LETTER AIN\r
+    u'\u063a'   #  0x00da -> ARABIC LETTER GHAIN\r
+    u'['        #  0x00db -> LEFT SQUARE BRACKET, right-left\r
+    u'\\'       #  0x00dc -> REVERSE SOLIDUS, right-left\r
+    u']'        #  0x00dd -> RIGHT SQUARE BRACKET, right-left\r
+    u'^'        #  0x00de -> CIRCUMFLEX ACCENT, right-left\r
+    u'_'        #  0x00df -> LOW LINE, right-left\r
+    u'\u0640'   #  0x00e0 -> ARABIC TATWEEL\r
+    u'\u0641'   #  0x00e1 -> ARABIC LETTER FEH\r
+    u'\u0642'   #  0x00e2 -> ARABIC LETTER QAF\r
+    u'\u0643'   #  0x00e3 -> ARABIC LETTER KAF\r
+    u'\u0644'   #  0x00e4 -> ARABIC LETTER LAM\r
+    u'\u0645'   #  0x00e5 -> ARABIC LETTER MEEM\r
+    u'\u0646'   #  0x00e6 -> ARABIC LETTER NOON\r
+    u'\u0647'   #  0x00e7 -> ARABIC LETTER HEH\r
+    u'\u0648'   #  0x00e8 -> ARABIC LETTER WAW\r
+    u'\u0649'   #  0x00e9 -> ARABIC LETTER ALEF MAKSURA\r
+    u'\u064a'   #  0x00ea -> ARABIC LETTER YEH\r
+    u'\u064b'   #  0x00eb -> ARABIC FATHATAN\r
+    u'\u064c'   #  0x00ec -> ARABIC DAMMATAN\r
+    u'\u064d'   #  0x00ed -> ARABIC KASRATAN\r
+    u'\u064e'   #  0x00ee -> ARABIC FATHA\r
+    u'\u064f'   #  0x00ef -> ARABIC DAMMA\r
+    u'\u0650'   #  0x00f0 -> ARABIC KASRA\r
+    u'\u0651'   #  0x00f1 -> ARABIC SHADDA\r
+    u'\u0652'   #  0x00f2 -> ARABIC SUKUN\r
+    u'\u067e'   #  0x00f3 -> ARABIC LETTER PEH\r
+    u'\u0679'   #  0x00f4 -> ARABIC LETTER TTEH\r
+    u'\u0686'   #  0x00f5 -> ARABIC LETTER TCHEH\r
+    u'\u06d5'   #  0x00f6 -> ARABIC LETTER AE\r
+    u'\u06a4'   #  0x00f7 -> ARABIC LETTER VEH\r
+    u'\u06af'   #  0x00f8 -> ARABIC LETTER GAF\r
+    u'\u0688'   #  0x00f9 -> ARABIC LETTER DDAL\r
+    u'\u0691'   #  0x00fa -> ARABIC LETTER RREH\r
+    u'{'        #  0x00fb -> LEFT CURLY BRACKET, right-left\r
+    u'|'        #  0x00fc -> VERTICAL LINE, right-left\r
+    u'}'        #  0x00fd -> RIGHT CURLY BRACKET, right-left\r
+    u'\u0698'   #  0x00fe -> ARABIC LETTER JEH\r
+    u'\u06d2'   #  0x00ff -> ARABIC LETTER YEH BARREE\r
+)\r
+\r
+### Encoding Map\r
+\r
+encoding_map = {\r
+    0x0000: 0x0000,     #  CONTROL CHARACTER\r
+    0x0001: 0x0001,     #  CONTROL CHARACTER\r
+    0x0002: 0x0002,     #  CONTROL CHARACTER\r
+    0x0003: 0x0003,     #  CONTROL CHARACTER\r
+    0x0004: 0x0004,     #  CONTROL CHARACTER\r
+    0x0005: 0x0005,     #  CONTROL CHARACTER\r
+    0x0006: 0x0006,     #  CONTROL CHARACTER\r
+    0x0007: 0x0007,     #  CONTROL CHARACTER\r
+    0x0008: 0x0008,     #  CONTROL CHARACTER\r
+    0x0009: 0x0009,     #  CONTROL CHARACTER\r
+    0x000a: 0x000a,     #  CONTROL CHARACTER\r
+    0x000b: 0x000b,     #  CONTROL CHARACTER\r
+    0x000c: 0x000c,     #  CONTROL CHARACTER\r
+    0x000d: 0x000d,     #  CONTROL CHARACTER\r
+    0x000e: 0x000e,     #  CONTROL CHARACTER\r
+    0x000f: 0x000f,     #  CONTROL CHARACTER\r
+    0x0010: 0x0010,     #  CONTROL CHARACTER\r
+    0x0011: 0x0011,     #  CONTROL CHARACTER\r
+    0x0012: 0x0012,     #  CONTROL CHARACTER\r
+    0x0013: 0x0013,     #  CONTROL CHARACTER\r
+    0x0014: 0x0014,     #  CONTROL CHARACTER\r
+    0x0015: 0x0015,     #  CONTROL CHARACTER\r
+    0x0016: 0x0016,     #  CONTROL CHARACTER\r
+    0x0017: 0x0017,     #  CONTROL CHARACTER\r
+    0x0018: 0x0018,     #  CONTROL CHARACTER\r
+    0x0019: 0x0019,     #  CONTROL CHARACTER\r
+    0x001a: 0x001a,     #  CONTROL CHARACTER\r
+    0x001b: 0x001b,     #  CONTROL CHARACTER\r
+    0x001c: 0x001c,     #  CONTROL CHARACTER\r
+    0x001d: 0x001d,     #  CONTROL CHARACTER\r
+    0x001e: 0x001e,     #  CONTROL CHARACTER\r
+    0x001f: 0x001f,     #  CONTROL CHARACTER\r
+    0x0020: 0x0020,     #  SPACE, left-right\r
+    0x0020: 0x00a0,     #  SPACE, right-left\r
+    0x0021: 0x0021,     #  EXCLAMATION MARK, left-right\r
+    0x0021: 0x00a1,     #  EXCLAMATION MARK, right-left\r
+    0x0022: 0x0022,     #  QUOTATION MARK, left-right\r
+    0x0022: 0x00a2,     #  QUOTATION MARK, right-left\r
+    0x0023: 0x0023,     #  NUMBER SIGN, left-right\r
+    0x0023: 0x00a3,     #  NUMBER SIGN, right-left\r
+    0x0024: 0x0024,     #  DOLLAR SIGN, left-right\r
+    0x0024: 0x00a4,     #  DOLLAR SIGN, right-left\r
+    0x0025: 0x0025,     #  PERCENT SIGN, left-right\r
+    0x0026: 0x0026,     #  AMPERSAND, left-right\r
+    0x0026: 0x00a6,     #  AMPERSAND, right-left\r
+    0x0027: 0x0027,     #  APOSTROPHE, left-right\r
+    0x0027: 0x00a7,     #  APOSTROPHE, right-left\r
+    0x0028: 0x0028,     #  LEFT PARENTHESIS, left-right\r
+    0x0028: 0x00a8,     #  LEFT PARENTHESIS, right-left\r
+    0x0029: 0x0029,     #  RIGHT PARENTHESIS, left-right\r
+    0x0029: 0x00a9,     #  RIGHT PARENTHESIS, right-left\r
+    0x002a: 0x002a,     #  ASTERISK, left-right\r
+    0x002a: 0x00aa,     #  ASTERISK, right-left\r
+    0x002b: 0x002b,     #  PLUS SIGN, left-right\r
+    0x002b: 0x00ab,     #  PLUS SIGN, right-left\r
+    0x002c: 0x002c,     #  COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR\r
+    0x002d: 0x002d,     #  HYPHEN-MINUS, left-right\r
+    0x002d: 0x00ad,     #  HYPHEN-MINUS, right-left\r
+    0x002e: 0x002e,     #  FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR\r
+    0x002e: 0x00ae,     #  FULL STOP, right-left\r
+    0x002f: 0x002f,     #  SOLIDUS, left-right\r
+    0x002f: 0x00af,     #  SOLIDUS, right-left\r
+    0x0030: 0x0030,     #  DIGIT ZERO;  in Arabic-script context, displayed as 0x0660 ARABIC-INDIC DIGIT ZERO\r
+    0x0031: 0x0031,     #  DIGIT ONE;   in Arabic-script context, displayed as 0x0661 ARABIC-INDIC DIGIT ONE\r
+    0x0032: 0x0032,     #  DIGIT TWO;   in Arabic-script context, displayed as 0x0662 ARABIC-INDIC DIGIT TWO\r
+    0x0033: 0x0033,     #  DIGIT THREE; in Arabic-script context, displayed as 0x0663 ARABIC-INDIC DIGIT THREE\r
+    0x0034: 0x0034,     #  DIGIT FOUR;  in Arabic-script context, displayed as 0x0664 ARABIC-INDIC DIGIT FOUR\r
+    0x0035: 0x0035,     #  DIGIT FIVE;  in Arabic-script context, displayed as 0x0665 ARABIC-INDIC DIGIT FIVE\r
+    0x0036: 0x0036,     #  DIGIT SIX;   in Arabic-script context, displayed as 0x0666 ARABIC-INDIC DIGIT SIX\r
+    0x0037: 0x0037,     #  DIGIT SEVEN; in Arabic-script context, displayed as 0x0667 ARABIC-INDIC DIGIT SEVEN\r
+    0x0038: 0x0038,     #  DIGIT EIGHT; in Arabic-script context, displayed as 0x0668 ARABIC-INDIC DIGIT EIGHT\r
+    0x0039: 0x0039,     #  DIGIT NINE;  in Arabic-script context, displayed as 0x0669 ARABIC-INDIC DIGIT NINE\r
+    0x003a: 0x003a,     #  COLON, left-right\r
+    0x003a: 0x00ba,     #  COLON, right-left\r
+    0x003b: 0x003b,     #  SEMICOLON, left-right\r
+    0x003c: 0x003c,     #  LESS-THAN SIGN, left-right\r
+    0x003c: 0x00bc,     #  LESS-THAN SIGN, right-left\r
+    0x003d: 0x003d,     #  EQUALS SIGN, left-right\r
+    0x003d: 0x00bd,     #  EQUALS SIGN, right-left\r
+    0x003e: 0x003e,     #  GREATER-THAN SIGN, left-right\r
+    0x003e: 0x00be,     #  GREATER-THAN SIGN, right-left\r
+    0x003f: 0x003f,     #  QUESTION MARK, left-right\r
+    0x0040: 0x0040,     #  COMMERCIAL AT\r
+    0x0041: 0x0041,     #  LATIN CAPITAL LETTER A\r
+    0x0042: 0x0042,     #  LATIN CAPITAL LETTER B\r
+    0x0043: 0x0043,     #  LATIN CAPITAL LETTER C\r
+    0x0044: 0x0044,     #  LATIN CAPITAL LETTER D\r
+    0x0045: 0x0045,     #  LATIN CAPITAL LETTER E\r
+    0x0046: 0x0046,     #  LATIN CAPITAL LETTER F\r
+    0x0047: 0x0047,     #  LATIN CAPITAL LETTER G\r
+    0x0048: 0x0048,     #  LATIN CAPITAL LETTER H\r
+    0x0049: 0x0049,     #  LATIN CAPITAL LETTER I\r
+    0x004a: 0x004a,     #  LATIN CAPITAL LETTER J\r
+    0x004b: 0x004b,     #  LATIN CAPITAL LETTER K\r
+    0x004c: 0x004c,     #  LATIN CAPITAL LETTER L\r
+    0x004d: 0x004d,     #  LATIN CAPITAL LETTER M\r
+    0x004e: 0x004e,     #  LATIN CAPITAL LETTER N\r
+    0x004f: 0x004f,     #  LATIN CAPITAL LETTER O\r
+    0x0050: 0x0050,     #  LATIN CAPITAL LETTER P\r
+    0x0051: 0x0051,     #  LATIN CAPITAL LETTER Q\r
+    0x0052: 0x0052,     #  LATIN CAPITAL LETTER R\r
+    0x0053: 0x0053,     #  LATIN CAPITAL LETTER S\r
+    0x0054: 0x0054,     #  LATIN CAPITAL LETTER T\r
+    0x0055: 0x0055,     #  LATIN CAPITAL LETTER U\r
+    0x0056: 0x0056,     #  LATIN CAPITAL LETTER V\r
+    0x0057: 0x0057,     #  LATIN CAPITAL LETTER W\r
+    0x0058: 0x0058,     #  LATIN CAPITAL LETTER X\r
+    0x0059: 0x0059,     #  LATIN CAPITAL LETTER Y\r
+    0x005a: 0x005a,     #  LATIN CAPITAL LETTER Z\r
+    0x005b: 0x005b,     #  LEFT SQUARE BRACKET, left-right\r
+    0x005b: 0x00db,     #  LEFT SQUARE BRACKET, right-left\r
+    0x005c: 0x005c,     #  REVERSE SOLIDUS, left-right\r
+    0x005c: 0x00dc,     #  REVERSE SOLIDUS, right-left\r
+    0x005d: 0x005d,     #  RIGHT SQUARE BRACKET, left-right\r
+    0x005d: 0x00dd,     #  RIGHT SQUARE BRACKET, right-left\r
+    0x005e: 0x005e,     #  CIRCUMFLEX ACCENT, left-right\r
+    0x005e: 0x00de,     #  CIRCUMFLEX ACCENT, right-left\r
+    0x005f: 0x005f,     #  LOW LINE, left-right\r
+    0x005f: 0x00df,     #  LOW LINE, right-left\r
+    0x0060: 0x0060,     #  GRAVE ACCENT\r
+    0x0061: 0x0061,     #  LATIN SMALL LETTER A\r
+    0x0062: 0x0062,     #  LATIN SMALL LETTER B\r
+    0x0063: 0x0063,     #  LATIN SMALL LETTER C\r
+    0x0064: 0x0064,     #  LATIN SMALL LETTER D\r
+    0x0065: 0x0065,     #  LATIN SMALL LETTER E\r
+    0x0066: 0x0066,     #  LATIN SMALL LETTER F\r
+    0x0067: 0x0067,     #  LATIN SMALL LETTER G\r
+    0x0068: 0x0068,     #  LATIN SMALL LETTER H\r
+    0x0069: 0x0069,     #  LATIN SMALL LETTER I\r
+    0x006a: 0x006a,     #  LATIN SMALL LETTER J\r
+    0x006b: 0x006b,     #  LATIN SMALL LETTER K\r
+    0x006c: 0x006c,     #  LATIN SMALL LETTER L\r
+    0x006d: 0x006d,     #  LATIN SMALL LETTER M\r
+    0x006e: 0x006e,     #  LATIN SMALL LETTER N\r
+    0x006f: 0x006f,     #  LATIN SMALL LETTER O\r
+    0x0070: 0x0070,     #  LATIN SMALL LETTER P\r
+    0x0071: 0x0071,     #  LATIN SMALL LETTER Q\r
+    0x0072: 0x0072,     #  LATIN SMALL LETTER R\r
+    0x0073: 0x0073,     #  LATIN SMALL LETTER S\r
+    0x0074: 0x0074,     #  LATIN SMALL LETTER T\r
+    0x0075: 0x0075,     #  LATIN SMALL LETTER U\r
+    0x0076: 0x0076,     #  LATIN SMALL LETTER V\r
+    0x0077: 0x0077,     #  LATIN SMALL LETTER W\r
+    0x0078: 0x0078,     #  LATIN SMALL LETTER X\r
+    0x0079: 0x0079,     #  LATIN SMALL LETTER Y\r
+    0x007a: 0x007a,     #  LATIN SMALL LETTER Z\r
+    0x007b: 0x007b,     #  LEFT CURLY BRACKET, left-right\r
+    0x007b: 0x00fb,     #  LEFT CURLY BRACKET, right-left\r
+    0x007c: 0x007c,     #  VERTICAL LINE, left-right\r
+    0x007c: 0x00fc,     #  VERTICAL LINE, right-left\r
+    0x007d: 0x007d,     #  RIGHT CURLY BRACKET, left-right\r
+    0x007d: 0x00fd,     #  RIGHT CURLY BRACKET, right-left\r
+    0x007e: 0x007e,     #  TILDE\r
+    0x007f: 0x007f,     #  CONTROL CHARACTER\r
+    0x00a0: 0x0081,     #  NO-BREAK SPACE, right-left\r
+    0x00ab: 0x008c,     #  LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left\r
+    0x00bb: 0x0098,     #  RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left\r
+    0x00c4: 0x0080,     #  LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    0x00c7: 0x0082,     #  LATIN CAPITAL LETTER C WITH CEDILLA\r
+    0x00c9: 0x0083,     #  LATIN CAPITAL LETTER E WITH ACUTE\r
+    0x00d1: 0x0084,     #  LATIN CAPITAL LETTER N WITH TILDE\r
+    0x00d6: 0x0085,     #  LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    0x00dc: 0x0086,     #  LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    0x00e0: 0x0088,     #  LATIN SMALL LETTER A WITH GRAVE\r
+    0x00e1: 0x0087,     #  LATIN SMALL LETTER A WITH ACUTE\r
+    0x00e2: 0x0089,     #  LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    0x00e4: 0x008a,     #  LATIN SMALL LETTER A WITH DIAERESIS\r
+    0x00e7: 0x008d,     #  LATIN SMALL LETTER C WITH CEDILLA\r
+    0x00e8: 0x008f,     #  LATIN SMALL LETTER E WITH GRAVE\r
+    0x00e9: 0x008e,     #  LATIN SMALL LETTER E WITH ACUTE\r
+    0x00ea: 0x0090,     #  LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    0x00eb: 0x0091,     #  LATIN SMALL LETTER E WITH DIAERESIS\r
+    0x00ed: 0x0092,     #  LATIN SMALL LETTER I WITH ACUTE\r
+    0x00ee: 0x0094,     #  LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    0x00ef: 0x0095,     #  LATIN SMALL LETTER I WITH DIAERESIS\r
+    0x00f1: 0x0096,     #  LATIN SMALL LETTER N WITH TILDE\r
+    0x00f3: 0x0097,     #  LATIN SMALL LETTER O WITH ACUTE\r
+    0x00f4: 0x0099,     #  LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    0x00f6: 0x009a,     #  LATIN SMALL LETTER O WITH DIAERESIS\r
+    0x00f7: 0x009b,     #  DIVISION SIGN, right-left\r
+    0x00f9: 0x009d,     #  LATIN SMALL LETTER U WITH GRAVE\r
+    0x00fa: 0x009c,     #  LATIN SMALL LETTER U WITH ACUTE\r
+    0x00fb: 0x009e,     #  LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    0x00fc: 0x009f,     #  LATIN SMALL LETTER U WITH DIAERESIS\r
+    0x060c: 0x00ac,     #  ARABIC COMMA\r
+    0x061b: 0x00bb,     #  ARABIC SEMICOLON\r
+    0x061f: 0x00bf,     #  ARABIC QUESTION MARK\r
+    0x0621: 0x00c1,     #  ARABIC LETTER HAMZA\r
+    0x0622: 0x00c2,     #  ARABIC LETTER ALEF WITH MADDA ABOVE\r
+    0x0623: 0x00c3,     #  ARABIC LETTER ALEF WITH HAMZA ABOVE\r
+    0x0624: 0x00c4,     #  ARABIC LETTER WAW WITH HAMZA ABOVE\r
+    0x0625: 0x00c5,     #  ARABIC LETTER ALEF WITH HAMZA BELOW\r
+    0x0626: 0x00c6,     #  ARABIC LETTER YEH WITH HAMZA ABOVE\r
+    0x0627: 0x00c7,     #  ARABIC LETTER ALEF\r
+    0x0628: 0x00c8,     #  ARABIC LETTER BEH\r
+    0x0629: 0x00c9,     #  ARABIC LETTER TEH MARBUTA\r
+    0x062a: 0x00ca,     #  ARABIC LETTER TEH\r
+    0x062b: 0x00cb,     #  ARABIC LETTER THEH\r
+    0x062c: 0x00cc,     #  ARABIC LETTER JEEM\r
+    0x062d: 0x00cd,     #  ARABIC LETTER HAH\r
+    0x062e: 0x00ce,     #  ARABIC LETTER KHAH\r
+    0x062f: 0x00cf,     #  ARABIC LETTER DAL\r
+    0x0630: 0x00d0,     #  ARABIC LETTER THAL\r
+    0x0631: 0x00d1,     #  ARABIC LETTER REH\r
+    0x0632: 0x00d2,     #  ARABIC LETTER ZAIN\r
+    0x0633: 0x00d3,     #  ARABIC LETTER SEEN\r
+    0x0634: 0x00d4,     #  ARABIC LETTER SHEEN\r
+    0x0635: 0x00d5,     #  ARABIC LETTER SAD\r
+    0x0636: 0x00d6,     #  ARABIC LETTER DAD\r
+    0x0637: 0x00d7,     #  ARABIC LETTER TAH\r
+    0x0638: 0x00d8,     #  ARABIC LETTER ZAH\r
+    0x0639: 0x00d9,     #  ARABIC LETTER AIN\r
+    0x063a: 0x00da,     #  ARABIC LETTER GHAIN\r
+    0x0640: 0x00e0,     #  ARABIC TATWEEL\r
+    0x0641: 0x00e1,     #  ARABIC LETTER FEH\r
+    0x0642: 0x00e2,     #  ARABIC LETTER QAF\r
+    0x0643: 0x00e3,     #  ARABIC LETTER KAF\r
+    0x0644: 0x00e4,     #  ARABIC LETTER LAM\r
+    0x0645: 0x00e5,     #  ARABIC LETTER MEEM\r
+    0x0646: 0x00e6,     #  ARABIC LETTER NOON\r
+    0x0647: 0x00e7,     #  ARABIC LETTER HEH\r
+    0x0648: 0x00e8,     #  ARABIC LETTER WAW\r
+    0x0649: 0x00e9,     #  ARABIC LETTER ALEF MAKSURA\r
+    0x064a: 0x00ea,     #  ARABIC LETTER YEH\r
+    0x064b: 0x00eb,     #  ARABIC FATHATAN\r
+    0x064c: 0x00ec,     #  ARABIC DAMMATAN\r
+    0x064d: 0x00ed,     #  ARABIC KASRATAN\r
+    0x064e: 0x00ee,     #  ARABIC FATHA\r
+    0x064f: 0x00ef,     #  ARABIC DAMMA\r
+    0x0650: 0x00f0,     #  ARABIC KASRA\r
+    0x0651: 0x00f1,     #  ARABIC SHADDA\r
+    0x0652: 0x00f2,     #  ARABIC SUKUN\r
+    0x0660: 0x00b0,     #  ARABIC-INDIC DIGIT ZERO, right-left (need override)\r
+    0x0661: 0x00b1,     #  ARABIC-INDIC DIGIT ONE, right-left (need override)\r
+    0x0662: 0x00b2,     #  ARABIC-INDIC DIGIT TWO, right-left (need override)\r
+    0x0663: 0x00b3,     #  ARABIC-INDIC DIGIT THREE, right-left (need override)\r
+    0x0664: 0x00b4,     #  ARABIC-INDIC DIGIT FOUR, right-left (need override)\r
+    0x0665: 0x00b5,     #  ARABIC-INDIC DIGIT FIVE, right-left (need override)\r
+    0x0666: 0x00b6,     #  ARABIC-INDIC DIGIT SIX, right-left (need override)\r
+    0x0667: 0x00b7,     #  ARABIC-INDIC DIGIT SEVEN, right-left (need override)\r
+    0x0668: 0x00b8,     #  ARABIC-INDIC DIGIT EIGHT, right-left (need override)\r
+    0x0669: 0x00b9,     #  ARABIC-INDIC DIGIT NINE, right-left (need override)\r
+    0x066a: 0x00a5,     #  ARABIC PERCENT SIGN\r
+    0x0679: 0x00f4,     #  ARABIC LETTER TTEH\r
+    0x067e: 0x00f3,     #  ARABIC LETTER PEH\r
+    0x0686: 0x00f5,     #  ARABIC LETTER TCHEH\r
+    0x0688: 0x00f9,     #  ARABIC LETTER DDAL\r
+    0x0691: 0x00fa,     #  ARABIC LETTER RREH\r
+    0x0698: 0x00fe,     #  ARABIC LETTER JEH\r
+    0x06a4: 0x00f7,     #  ARABIC LETTER VEH\r
+    0x06af: 0x00f8,     #  ARABIC LETTER GAF\r
+    0x06ba: 0x008b,     #  ARABIC LETTER NOON GHUNNA\r
+    0x06d2: 0x00ff,     #  ARABIC LETTER YEH BARREE\r
+    0x06d5: 0x00f6,     #  ARABIC LETTER AE\r
+    0x2026: 0x0093,     #  HORIZONTAL ELLIPSIS, right-left\r
+    0x274a: 0x00c0,     #  EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left\r
+}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_centeuro.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_centeuro.py
new file mode 100644 (file)
index 0000000..3ef432c
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_centeuro generated from 'MAPPINGS/VENDORS/APPLE/CENTEURO.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-centeuro',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x01 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x02 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x03 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x04 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x05 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x06 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x07 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x08 -> CONTROL CHARACTER\r
+    u'\t'       #  0x09 -> CONTROL CHARACTER\r
+    u'\n'       #  0x0A -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x0B -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x0C -> CONTROL CHARACTER\r
+    u'\r'       #  0x0D -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x0E -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x0F -> CONTROL CHARACTER\r
+    u'\x10'     #  0x10 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x11 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x12 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x13 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x14 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x15 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x16 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x17 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x18 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x19 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x1A -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x1B -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x1C -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x1D -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x1E -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x1F -> CONTROL CHARACTER\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> CONTROL CHARACTER\r
+    u'\xc4'     #  0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\u0100'   #  0x81 -> LATIN CAPITAL LETTER A WITH MACRON\r
+    u'\u0101'   #  0x82 -> LATIN SMALL LETTER A WITH MACRON\r
+    u'\xc9'     #  0x83 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\u0104'   #  0x84 -> LATIN CAPITAL LETTER A WITH OGONEK\r
+    u'\xd6'     #  0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xe1'     #  0x87 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\u0105'   #  0x88 -> LATIN SMALL LETTER A WITH OGONEK\r
+    u'\u010c'   #  0x89 -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\xe4'     #  0x8A -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\u010d'   #  0x8B -> LATIN SMALL LETTER C WITH CARON\r
+    u'\u0106'   #  0x8C -> LATIN CAPITAL LETTER C WITH ACUTE\r
+    u'\u0107'   #  0x8D -> LATIN SMALL LETTER C WITH ACUTE\r
+    u'\xe9'     #  0x8E -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\u0179'   #  0x8F -> LATIN CAPITAL LETTER Z WITH ACUTE\r
+    u'\u017a'   #  0x90 -> LATIN SMALL LETTER Z WITH ACUTE\r
+    u'\u010e'   #  0x91 -> LATIN CAPITAL LETTER D WITH CARON\r
+    u'\xed'     #  0x92 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\u010f'   #  0x93 -> LATIN SMALL LETTER D WITH CARON\r
+    u'\u0112'   #  0x94 -> LATIN CAPITAL LETTER E WITH MACRON\r
+    u'\u0113'   #  0x95 -> LATIN SMALL LETTER E WITH MACRON\r
+    u'\u0116'   #  0x96 -> LATIN CAPITAL LETTER E WITH DOT ABOVE\r
+    u'\xf3'     #  0x97 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\u0117'   #  0x98 -> LATIN SMALL LETTER E WITH DOT ABOVE\r
+    u'\xf4'     #  0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x9A -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf5'     #  0x9B -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xfa'     #  0x9C -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\u011a'   #  0x9D -> LATIN CAPITAL LETTER E WITH CARON\r
+    u'\u011b'   #  0x9E -> LATIN SMALL LETTER E WITH CARON\r
+    u'\xfc'     #  0x9F -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u2020'   #  0xA0 -> DAGGER\r
+    u'\xb0'     #  0xA1 -> DEGREE SIGN\r
+    u'\u0118'   #  0xA2 -> LATIN CAPITAL LETTER E WITH OGONEK\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa7'     #  0xA4 -> SECTION SIGN\r
+    u'\u2022'   #  0xA5 -> BULLET\r
+    u'\xb6'     #  0xA6 -> PILCROW SIGN\r
+    u'\xdf'     #  0xA7 -> LATIN SMALL LETTER SHARP S\r
+    u'\xae'     #  0xA8 -> REGISTERED SIGN\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u2122'   #  0xAA -> TRADE MARK SIGN\r
+    u'\u0119'   #  0xAB -> LATIN SMALL LETTER E WITH OGONEK\r
+    u'\xa8'     #  0xAC -> DIAERESIS\r
+    u'\u2260'   #  0xAD -> NOT EQUAL TO\r
+    u'\u0123'   #  0xAE -> LATIN SMALL LETTER G WITH CEDILLA\r
+    u'\u012e'   #  0xAF -> LATIN CAPITAL LETTER I WITH OGONEK\r
+    u'\u012f'   #  0xB0 -> LATIN SMALL LETTER I WITH OGONEK\r
+    u'\u012a'   #  0xB1 -> LATIN CAPITAL LETTER I WITH MACRON\r
+    u'\u2264'   #  0xB2 -> LESS-THAN OR EQUAL TO\r
+    u'\u2265'   #  0xB3 -> GREATER-THAN OR EQUAL TO\r
+    u'\u012b'   #  0xB4 -> LATIN SMALL LETTER I WITH MACRON\r
+    u'\u0136'   #  0xB5 -> LATIN CAPITAL LETTER K WITH CEDILLA\r
+    u'\u2202'   #  0xB6 -> PARTIAL DIFFERENTIAL\r
+    u'\u2211'   #  0xB7 -> N-ARY SUMMATION\r
+    u'\u0142'   #  0xB8 -> LATIN SMALL LETTER L WITH STROKE\r
+    u'\u013b'   #  0xB9 -> LATIN CAPITAL LETTER L WITH CEDILLA\r
+    u'\u013c'   #  0xBA -> LATIN SMALL LETTER L WITH CEDILLA\r
+    u'\u013d'   #  0xBB -> LATIN CAPITAL LETTER L WITH CARON\r
+    u'\u013e'   #  0xBC -> LATIN SMALL LETTER L WITH CARON\r
+    u'\u0139'   #  0xBD -> LATIN CAPITAL LETTER L WITH ACUTE\r
+    u'\u013a'   #  0xBE -> LATIN SMALL LETTER L WITH ACUTE\r
+    u'\u0145'   #  0xBF -> LATIN CAPITAL LETTER N WITH CEDILLA\r
+    u'\u0146'   #  0xC0 -> LATIN SMALL LETTER N WITH CEDILLA\r
+    u'\u0143'   #  0xC1 -> LATIN CAPITAL LETTER N WITH ACUTE\r
+    u'\xac'     #  0xC2 -> NOT SIGN\r
+    u'\u221a'   #  0xC3 -> SQUARE ROOT\r
+    u'\u0144'   #  0xC4 -> LATIN SMALL LETTER N WITH ACUTE\r
+    u'\u0147'   #  0xC5 -> LATIN CAPITAL LETTER N WITH CARON\r
+    u'\u2206'   #  0xC6 -> INCREMENT\r
+    u'\xab'     #  0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2026'   #  0xC9 -> HORIZONTAL ELLIPSIS\r
+    u'\xa0'     #  0xCA -> NO-BREAK SPACE\r
+    u'\u0148'   #  0xCB -> LATIN SMALL LETTER N WITH CARON\r
+    u'\u0150'   #  0xCC -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE\r
+    u'\xd5'     #  0xCD -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\u0151'   #  0xCE -> LATIN SMALL LETTER O WITH DOUBLE ACUTE\r
+    u'\u014c'   #  0xCF -> LATIN CAPITAL LETTER O WITH MACRON\r
+    u'\u2013'   #  0xD0 -> EN DASH\r
+    u'\u2014'   #  0xD1 -> EM DASH\r
+    u'\u201c'   #  0xD2 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0xD3 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2018'   #  0xD4 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0xD5 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xf7'     #  0xD6 -> DIVISION SIGN\r
+    u'\u25ca'   #  0xD7 -> LOZENGE\r
+    u'\u014d'   #  0xD8 -> LATIN SMALL LETTER O WITH MACRON\r
+    u'\u0154'   #  0xD9 -> LATIN CAPITAL LETTER R WITH ACUTE\r
+    u'\u0155'   #  0xDA -> LATIN SMALL LETTER R WITH ACUTE\r
+    u'\u0158'   #  0xDB -> LATIN CAPITAL LETTER R WITH CARON\r
+    u'\u2039'   #  0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\u203a'   #  0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\u0159'   #  0xDE -> LATIN SMALL LETTER R WITH CARON\r
+    u'\u0156'   #  0xDF -> LATIN CAPITAL LETTER R WITH CEDILLA\r
+    u'\u0157'   #  0xE0 -> LATIN SMALL LETTER R WITH CEDILLA\r
+    u'\u0160'   #  0xE1 -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u201a'   #  0xE2 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u201e'   #  0xE3 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u0161'   #  0xE4 -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u015a'   #  0xE5 -> LATIN CAPITAL LETTER S WITH ACUTE\r
+    u'\u015b'   #  0xE6 -> LATIN SMALL LETTER S WITH ACUTE\r
+    u'\xc1'     #  0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\u0164'   #  0xE8 -> LATIN CAPITAL LETTER T WITH CARON\r
+    u'\u0165'   #  0xE9 -> LATIN SMALL LETTER T WITH CARON\r
+    u'\xcd'     #  0xEA -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\u017d'   #  0xEB -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\u017e'   #  0xEC -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\u016a'   #  0xED -> LATIN CAPITAL LETTER U WITH MACRON\r
+    u'\xd3'     #  0xEE -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\u016b'   #  0xF0 -> LATIN SMALL LETTER U WITH MACRON\r
+    u'\u016e'   #  0xF1 -> LATIN CAPITAL LETTER U WITH RING ABOVE\r
+    u'\xda'     #  0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\u016f'   #  0xF3 -> LATIN SMALL LETTER U WITH RING ABOVE\r
+    u'\u0170'   #  0xF4 -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE\r
+    u'\u0171'   #  0xF5 -> LATIN SMALL LETTER U WITH DOUBLE ACUTE\r
+    u'\u0172'   #  0xF6 -> LATIN CAPITAL LETTER U WITH OGONEK\r
+    u'\u0173'   #  0xF7 -> LATIN SMALL LETTER U WITH OGONEK\r
+    u'\xdd'     #  0xF8 -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xfd'     #  0xF9 -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\u0137'   #  0xFA -> LATIN SMALL LETTER K WITH CEDILLA\r
+    u'\u017b'   #  0xFB -> LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+    u'\u0141'   #  0xFC -> LATIN CAPITAL LETTER L WITH STROKE\r
+    u'\u017c'   #  0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE\r
+    u'\u0122'   #  0xFE -> LATIN CAPITAL LETTER G WITH CEDILLA\r
+    u'\u02c7'   #  0xFF -> CARON\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_croatian.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_croatian.py
new file mode 100644 (file)
index 0000000..ebcb1cc
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_croatian generated from 'MAPPINGS/VENDORS/APPLE/CROATIAN.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-croatian',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x01 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x02 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x03 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x04 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x05 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x06 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x07 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x08 -> CONTROL CHARACTER\r
+    u'\t'       #  0x09 -> CONTROL CHARACTER\r
+    u'\n'       #  0x0A -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x0B -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x0C -> CONTROL CHARACTER\r
+    u'\r'       #  0x0D -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x0E -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x0F -> CONTROL CHARACTER\r
+    u'\x10'     #  0x10 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x11 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x12 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x13 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x14 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x15 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x16 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x17 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x18 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x19 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x1A -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x1B -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x1C -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x1D -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x1E -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x1F -> CONTROL CHARACTER\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> CONTROL CHARACTER\r
+    u'\xc4'     #  0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc7'     #  0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc9'     #  0x83 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xd1'     #  0x84 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd6'     #  0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xe1'     #  0x87 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe0'     #  0x88 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe2'     #  0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x8A -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe3'     #  0x8B -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe5'     #  0x8C -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x8D -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe9'     #  0x8E -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe8'     #  0x8F -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xea'     #  0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x91 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xed'     #  0x92 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xec'     #  0x93 -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xee'     #  0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x95 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf1'     #  0x96 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf3'     #  0x97 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf2'     #  0x98 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf4'     #  0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x9A -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf5'     #  0x9B -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xfa'     #  0x9C -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf9'     #  0x9D -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfb'     #  0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0x9F -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u2020'   #  0xA0 -> DAGGER\r
+    u'\xb0'     #  0xA1 -> DEGREE SIGN\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa7'     #  0xA4 -> SECTION SIGN\r
+    u'\u2022'   #  0xA5 -> BULLET\r
+    u'\xb6'     #  0xA6 -> PILCROW SIGN\r
+    u'\xdf'     #  0xA7 -> LATIN SMALL LETTER SHARP S\r
+    u'\xae'     #  0xA8 -> REGISTERED SIGN\r
+    u'\u0160'   #  0xA9 -> LATIN CAPITAL LETTER S WITH CARON\r
+    u'\u2122'   #  0xAA -> TRADE MARK SIGN\r
+    u'\xb4'     #  0xAB -> ACUTE ACCENT\r
+    u'\xa8'     #  0xAC -> DIAERESIS\r
+    u'\u2260'   #  0xAD -> NOT EQUAL TO\r
+    u'\u017d'   #  0xAE -> LATIN CAPITAL LETTER Z WITH CARON\r
+    u'\xd8'     #  0xAF -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\u221e'   #  0xB0 -> INFINITY\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\u2264'   #  0xB2 -> LESS-THAN OR EQUAL TO\r
+    u'\u2265'   #  0xB3 -> GREATER-THAN OR EQUAL TO\r
+    u'\u2206'   #  0xB4 -> INCREMENT\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\u2202'   #  0xB6 -> PARTIAL DIFFERENTIAL\r
+    u'\u2211'   #  0xB7 -> N-ARY SUMMATION\r
+    u'\u220f'   #  0xB8 -> N-ARY PRODUCT\r
+    u'\u0161'   #  0xB9 -> LATIN SMALL LETTER S WITH CARON\r
+    u'\u222b'   #  0xBA -> INTEGRAL\r
+    u'\xaa'     #  0xBB -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0xBC -> MASCULINE ORDINAL INDICATOR\r
+    u'\u03a9'   #  0xBD -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u017e'   #  0xBE -> LATIN SMALL LETTER Z WITH CARON\r
+    u'\xf8'     #  0xBF -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xbf'     #  0xC0 -> INVERTED QUESTION MARK\r
+    u'\xa1'     #  0xC1 -> INVERTED EXCLAMATION MARK\r
+    u'\xac'     #  0xC2 -> NOT SIGN\r
+    u'\u221a'   #  0xC3 -> SQUARE ROOT\r
+    u'\u0192'   #  0xC4 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u2248'   #  0xC5 -> ALMOST EQUAL TO\r
+    u'\u0106'   #  0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE\r
+    u'\xab'     #  0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u010c'   #  0xC8 -> LATIN CAPITAL LETTER C WITH CARON\r
+    u'\u2026'   #  0xC9 -> HORIZONTAL ELLIPSIS\r
+    u'\xa0'     #  0xCA -> NO-BREAK SPACE\r
+    u'\xc0'     #  0xCB -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc3'     #  0xCC -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xd5'     #  0xCD -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\u0152'   #  0xCE -> LATIN CAPITAL LIGATURE OE\r
+    u'\u0153'   #  0xCF -> LATIN SMALL LIGATURE OE\r
+    u'\u0110'   #  0xD0 -> LATIN CAPITAL LETTER D WITH STROKE\r
+    u'\u2014'   #  0xD1 -> EM DASH\r
+    u'\u201c'   #  0xD2 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0xD3 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2018'   #  0xD4 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0xD5 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xf7'     #  0xD6 -> DIVISION SIGN\r
+    u'\u25ca'   #  0xD7 -> LOZENGE\r
+    u'\uf8ff'   #  0xD8 -> Apple logo\r
+    u'\xa9'     #  0xD9 -> COPYRIGHT SIGN\r
+    u'\u2044'   #  0xDA -> FRACTION SLASH\r
+    u'\u20ac'   #  0xDB -> EURO SIGN\r
+    u'\u2039'   #  0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\u203a'   #  0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\xc6'     #  0xDE -> LATIN CAPITAL LETTER AE\r
+    u'\xbb'     #  0xDF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2013'   #  0xE0 -> EN DASH\r
+    u'\xb7'     #  0xE1 -> MIDDLE DOT\r
+    u'\u201a'   #  0xE2 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u201e'   #  0xE3 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2030'   #  0xE4 -> PER MILLE SIGN\r
+    u'\xc2'     #  0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\u0107'   #  0xE6 -> LATIN SMALL LETTER C WITH ACUTE\r
+    u'\xc1'     #  0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\u010d'   #  0xE8 -> LATIN SMALL LETTER C WITH CARON\r
+    u'\xc8'     #  0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xcd'     #  0xEA -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xcc'     #  0xED -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xd3'     #  0xEE -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\u0111'   #  0xF0 -> LATIN SMALL LETTER D WITH STROKE\r
+    u'\xd2'     #  0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xda'     #  0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xd9'     #  0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\u0131'   #  0xF5 -> LATIN SMALL LETTER DOTLESS I\r
+    u'\u02c6'   #  0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT\r
+    u'\u02dc'   #  0xF7 -> SMALL TILDE\r
+    u'\xaf'     #  0xF8 -> MACRON\r
+    u'\u03c0'   #  0xF9 -> GREEK SMALL LETTER PI\r
+    u'\xcb'     #  0xFA -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\u02da'   #  0xFB -> RING ABOVE\r
+    u'\xb8'     #  0xFC -> CEDILLA\r
+    u'\xca'     #  0xFD -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xe6'     #  0xFE -> LATIN SMALL LETTER AE\r
+    u'\u02c7'   #  0xFF -> CARON\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_cyrillic.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_cyrillic.py
new file mode 100644 (file)
index 0000000..bca866f
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_cyrillic generated from 'MAPPINGS/VENDORS/APPLE/CYRILLIC.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-cyrillic',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x01 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x02 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x03 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x04 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x05 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x06 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x07 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x08 -> CONTROL CHARACTER\r
+    u'\t'       #  0x09 -> CONTROL CHARACTER\r
+    u'\n'       #  0x0A -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x0B -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x0C -> CONTROL CHARACTER\r
+    u'\r'       #  0x0D -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x0E -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x0F -> CONTROL CHARACTER\r
+    u'\x10'     #  0x10 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x11 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x12 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x13 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x14 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x15 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x16 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x17 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x18 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x19 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x1A -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x1B -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x1C -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x1D -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x1E -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x1F -> CONTROL CHARACTER\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> CONTROL CHARACTER\r
+    u'\u0410'   #  0x80 -> CYRILLIC CAPITAL LETTER A\r
+    u'\u0411'   #  0x81 -> CYRILLIC CAPITAL LETTER BE\r
+    u'\u0412'   #  0x82 -> CYRILLIC CAPITAL LETTER VE\r
+    u'\u0413'   #  0x83 -> CYRILLIC CAPITAL LETTER GHE\r
+    u'\u0414'   #  0x84 -> CYRILLIC CAPITAL LETTER DE\r
+    u'\u0415'   #  0x85 -> CYRILLIC CAPITAL LETTER IE\r
+    u'\u0416'   #  0x86 -> CYRILLIC CAPITAL LETTER ZHE\r
+    u'\u0417'   #  0x87 -> CYRILLIC CAPITAL LETTER ZE\r
+    u'\u0418'   #  0x88 -> CYRILLIC CAPITAL LETTER I\r
+    u'\u0419'   #  0x89 -> CYRILLIC CAPITAL LETTER SHORT I\r
+    u'\u041a'   #  0x8A -> CYRILLIC CAPITAL LETTER KA\r
+    u'\u041b'   #  0x8B -> CYRILLIC CAPITAL LETTER EL\r
+    u'\u041c'   #  0x8C -> CYRILLIC CAPITAL LETTER EM\r
+    u'\u041d'   #  0x8D -> CYRILLIC CAPITAL LETTER EN\r
+    u'\u041e'   #  0x8E -> CYRILLIC CAPITAL LETTER O\r
+    u'\u041f'   #  0x8F -> CYRILLIC CAPITAL LETTER PE\r
+    u'\u0420'   #  0x90 -> CYRILLIC CAPITAL LETTER ER\r
+    u'\u0421'   #  0x91 -> CYRILLIC CAPITAL LETTER ES\r
+    u'\u0422'   #  0x92 -> CYRILLIC CAPITAL LETTER TE\r
+    u'\u0423'   #  0x93 -> CYRILLIC CAPITAL LETTER U\r
+    u'\u0424'   #  0x94 -> CYRILLIC CAPITAL LETTER EF\r
+    u'\u0425'   #  0x95 -> CYRILLIC CAPITAL LETTER HA\r
+    u'\u0426'   #  0x96 -> CYRILLIC CAPITAL LETTER TSE\r
+    u'\u0427'   #  0x97 -> CYRILLIC CAPITAL LETTER CHE\r
+    u'\u0428'   #  0x98 -> CYRILLIC CAPITAL LETTER SHA\r
+    u'\u0429'   #  0x99 -> CYRILLIC CAPITAL LETTER SHCHA\r
+    u'\u042a'   #  0x9A -> CYRILLIC CAPITAL LETTER HARD SIGN\r
+    u'\u042b'   #  0x9B -> CYRILLIC CAPITAL LETTER YERU\r
+    u'\u042c'   #  0x9C -> CYRILLIC CAPITAL LETTER SOFT SIGN\r
+    u'\u042d'   #  0x9D -> CYRILLIC CAPITAL LETTER E\r
+    u'\u042e'   #  0x9E -> CYRILLIC CAPITAL LETTER YU\r
+    u'\u042f'   #  0x9F -> CYRILLIC CAPITAL LETTER YA\r
+    u'\u2020'   #  0xA0 -> DAGGER\r
+    u'\xb0'     #  0xA1 -> DEGREE SIGN\r
+    u'\u0490'   #  0xA2 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa7'     #  0xA4 -> SECTION SIGN\r
+    u'\u2022'   #  0xA5 -> BULLET\r
+    u'\xb6'     #  0xA6 -> PILCROW SIGN\r
+    u'\u0406'   #  0xA7 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    u'\xae'     #  0xA8 -> REGISTERED SIGN\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u2122'   #  0xAA -> TRADE MARK SIGN\r
+    u'\u0402'   #  0xAB -> CYRILLIC CAPITAL LETTER DJE\r
+    u'\u0452'   #  0xAC -> CYRILLIC SMALL LETTER DJE\r
+    u'\u2260'   #  0xAD -> NOT EQUAL TO\r
+    u'\u0403'   #  0xAE -> CYRILLIC CAPITAL LETTER GJE\r
+    u'\u0453'   #  0xAF -> CYRILLIC SMALL LETTER GJE\r
+    u'\u221e'   #  0xB0 -> INFINITY\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\u2264'   #  0xB2 -> LESS-THAN OR EQUAL TO\r
+    u'\u2265'   #  0xB3 -> GREATER-THAN OR EQUAL TO\r
+    u'\u0456'   #  0xB4 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\u0491'   #  0xB6 -> CYRILLIC SMALL LETTER GHE WITH UPTURN\r
+    u'\u0408'   #  0xB7 -> CYRILLIC CAPITAL LETTER JE\r
+    u'\u0404'   #  0xB8 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE\r
+    u'\u0454'   #  0xB9 -> CYRILLIC SMALL LETTER UKRAINIAN IE\r
+    u'\u0407'   #  0xBA -> CYRILLIC CAPITAL LETTER YI\r
+    u'\u0457'   #  0xBB -> CYRILLIC SMALL LETTER YI\r
+    u'\u0409'   #  0xBC -> CYRILLIC CAPITAL LETTER LJE\r
+    u'\u0459'   #  0xBD -> CYRILLIC SMALL LETTER LJE\r
+    u'\u040a'   #  0xBE -> CYRILLIC CAPITAL LETTER NJE\r
+    u'\u045a'   #  0xBF -> CYRILLIC SMALL LETTER NJE\r
+    u'\u0458'   #  0xC0 -> CYRILLIC SMALL LETTER JE\r
+    u'\u0405'   #  0xC1 -> CYRILLIC CAPITAL LETTER DZE\r
+    u'\xac'     #  0xC2 -> NOT SIGN\r
+    u'\u221a'   #  0xC3 -> SQUARE ROOT\r
+    u'\u0192'   #  0xC4 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u2248'   #  0xC5 -> ALMOST EQUAL TO\r
+    u'\u2206'   #  0xC6 -> INCREMENT\r
+    u'\xab'     #  0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2026'   #  0xC9 -> HORIZONTAL ELLIPSIS\r
+    u'\xa0'     #  0xCA -> NO-BREAK SPACE\r
+    u'\u040b'   #  0xCB -> CYRILLIC CAPITAL LETTER TSHE\r
+    u'\u045b'   #  0xCC -> CYRILLIC SMALL LETTER TSHE\r
+    u'\u040c'   #  0xCD -> CYRILLIC CAPITAL LETTER KJE\r
+    u'\u045c'   #  0xCE -> CYRILLIC SMALL LETTER KJE\r
+    u'\u0455'   #  0xCF -> CYRILLIC SMALL LETTER DZE\r
+    u'\u2013'   #  0xD0 -> EN DASH\r
+    u'\u2014'   #  0xD1 -> EM DASH\r
+    u'\u201c'   #  0xD2 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0xD3 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2018'   #  0xD4 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0xD5 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xf7'     #  0xD6 -> DIVISION SIGN\r
+    u'\u201e'   #  0xD7 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u040e'   #  0xD8 -> CYRILLIC CAPITAL LETTER SHORT U\r
+    u'\u045e'   #  0xD9 -> CYRILLIC SMALL LETTER SHORT U\r
+    u'\u040f'   #  0xDA -> CYRILLIC CAPITAL LETTER DZHE\r
+    u'\u045f'   #  0xDB -> CYRILLIC SMALL LETTER DZHE\r
+    u'\u2116'   #  0xDC -> NUMERO SIGN\r
+    u'\u0401'   #  0xDD -> CYRILLIC CAPITAL LETTER IO\r
+    u'\u0451'   #  0xDE -> CYRILLIC SMALL LETTER IO\r
+    u'\u044f'   #  0xDF -> CYRILLIC SMALL LETTER YA\r
+    u'\u0430'   #  0xE0 -> CYRILLIC SMALL LETTER A\r
+    u'\u0431'   #  0xE1 -> CYRILLIC SMALL LETTER BE\r
+    u'\u0432'   #  0xE2 -> CYRILLIC SMALL LETTER VE\r
+    u'\u0433'   #  0xE3 -> CYRILLIC SMALL LETTER GHE\r
+    u'\u0434'   #  0xE4 -> CYRILLIC SMALL LETTER DE\r
+    u'\u0435'   #  0xE5 -> CYRILLIC SMALL LETTER IE\r
+    u'\u0436'   #  0xE6 -> CYRILLIC SMALL LETTER ZHE\r
+    u'\u0437'   #  0xE7 -> CYRILLIC SMALL LETTER ZE\r
+    u'\u0438'   #  0xE8 -> CYRILLIC SMALL LETTER I\r
+    u'\u0439'   #  0xE9 -> CYRILLIC SMALL LETTER SHORT I\r
+    u'\u043a'   #  0xEA -> CYRILLIC SMALL LETTER KA\r
+    u'\u043b'   #  0xEB -> CYRILLIC SMALL LETTER EL\r
+    u'\u043c'   #  0xEC -> CYRILLIC SMALL LETTER EM\r
+    u'\u043d'   #  0xED -> CYRILLIC SMALL LETTER EN\r
+    u'\u043e'   #  0xEE -> CYRILLIC SMALL LETTER O\r
+    u'\u043f'   #  0xEF -> CYRILLIC SMALL LETTER PE\r
+    u'\u0440'   #  0xF0 -> CYRILLIC SMALL LETTER ER\r
+    u'\u0441'   #  0xF1 -> CYRILLIC SMALL LETTER ES\r
+    u'\u0442'   #  0xF2 -> CYRILLIC SMALL LETTER TE\r
+    u'\u0443'   #  0xF3 -> CYRILLIC SMALL LETTER U\r
+    u'\u0444'   #  0xF4 -> CYRILLIC SMALL LETTER EF\r
+    u'\u0445'   #  0xF5 -> CYRILLIC SMALL LETTER HA\r
+    u'\u0446'   #  0xF6 -> CYRILLIC SMALL LETTER TSE\r
+    u'\u0447'   #  0xF7 -> CYRILLIC SMALL LETTER CHE\r
+    u'\u0448'   #  0xF8 -> CYRILLIC SMALL LETTER SHA\r
+    u'\u0449'   #  0xF9 -> CYRILLIC SMALL LETTER SHCHA\r
+    u'\u044a'   #  0xFA -> CYRILLIC SMALL LETTER HARD SIGN\r
+    u'\u044b'   #  0xFB -> CYRILLIC SMALL LETTER YERU\r
+    u'\u044c'   #  0xFC -> CYRILLIC SMALL LETTER SOFT SIGN\r
+    u'\u044d'   #  0xFD -> CYRILLIC SMALL LETTER E\r
+    u'\u044e'   #  0xFE -> CYRILLIC SMALL LETTER YU\r
+    u'\u20ac'   #  0xFF -> EURO SIGN\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_farsi.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_farsi.py
new file mode 100644 (file)
index 0000000..06d9285
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_farsi generated from 'MAPPINGS/VENDORS/APPLE/FARSI.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-farsi',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x01 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x02 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x03 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x04 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x05 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x06 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x07 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x08 -> CONTROL CHARACTER\r
+    u'\t'       #  0x09 -> CONTROL CHARACTER\r
+    u'\n'       #  0x0A -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x0B -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x0C -> CONTROL CHARACTER\r
+    u'\r'       #  0x0D -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x0E -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x0F -> CONTROL CHARACTER\r
+    u'\x10'     #  0x10 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x11 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x12 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x13 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x14 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x15 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x16 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x17 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x18 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x19 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x1A -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x1B -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x1C -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x1D -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x1E -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x1F -> CONTROL CHARACTER\r
+    u' '        #  0x20 -> SPACE, left-right\r
+    u'!'        #  0x21 -> EXCLAMATION MARK, left-right\r
+    u'"'        #  0x22 -> QUOTATION MARK, left-right\r
+    u'#'        #  0x23 -> NUMBER SIGN, left-right\r
+    u'$'        #  0x24 -> DOLLAR SIGN, left-right\r
+    u'%'        #  0x25 -> PERCENT SIGN, left-right\r
+    u'&'        #  0x26 -> AMPERSAND, left-right\r
+    u"'"        #  0x27 -> APOSTROPHE, left-right\r
+    u'('        #  0x28 -> LEFT PARENTHESIS, left-right\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS, left-right\r
+    u'*'        #  0x2A -> ASTERISK, left-right\r
+    u'+'        #  0x2B -> PLUS SIGN, left-right\r
+    u','        #  0x2C -> COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR\r
+    u'-'        #  0x2D -> HYPHEN-MINUS, left-right\r
+    u'.'        #  0x2E -> FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR\r
+    u'/'        #  0x2F -> SOLIDUS, left-right\r
+    u'0'        #  0x30 -> DIGIT ZERO;  in Arabic-script context, displayed as 0x06F0 EXTENDED ARABIC-INDIC DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE;   in Arabic-script context, displayed as 0x06F1 EXTENDED ARABIC-INDIC DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO;   in Arabic-script context, displayed as 0x06F2 EXTENDED ARABIC-INDIC DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE; in Arabic-script context, displayed as 0x06F3 EXTENDED ARABIC-INDIC DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR;  in Arabic-script context, displayed as 0x06F4 EXTENDED ARABIC-INDIC DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE;  in Arabic-script context, displayed as 0x06F5 EXTENDED ARABIC-INDIC DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX;   in Arabic-script context, displayed as 0x06F6 EXTENDED ARABIC-INDIC DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN; in Arabic-script context, displayed as 0x06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT; in Arabic-script context, displayed as 0x06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE;  in Arabic-script context, displayed as 0x06F9 EXTENDED ARABIC-INDIC DIGIT NINE\r
+    u':'        #  0x3A -> COLON, left-right\r
+    u';'        #  0x3B -> SEMICOLON, left-right\r
+    u'<'        #  0x3C -> LESS-THAN SIGN, left-right\r
+    u'='        #  0x3D -> EQUALS SIGN, left-right\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN, left-right\r
+    u'?'        #  0x3F -> QUESTION MARK, left-right\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET, left-right\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS, left-right\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET, left-right\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT, left-right\r
+    u'_'        #  0x5F -> LOW LINE, left-right\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET, left-right\r
+    u'|'        #  0x7C -> VERTICAL LINE, left-right\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET, left-right\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> CONTROL CHARACTER\r
+    u'\xc4'     #  0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xa0'     #  0x81 -> NO-BREAK SPACE, right-left\r
+    u'\xc7'     #  0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc9'     #  0x83 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xd1'     #  0x84 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd6'     #  0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xe1'     #  0x87 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe0'     #  0x88 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe2'     #  0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x8A -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\u06ba'   #  0x8B -> ARABIC LETTER NOON GHUNNA\r
+    u'\xab'     #  0x8C -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left\r
+    u'\xe7'     #  0x8D -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe9'     #  0x8E -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe8'     #  0x8F -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xea'     #  0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x91 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xed'     #  0x92 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\u2026'   #  0x93 -> HORIZONTAL ELLIPSIS, right-left\r
+    u'\xee'     #  0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x95 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf1'     #  0x96 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf3'     #  0x97 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xbb'     #  0x98 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left\r
+    u'\xf4'     #  0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x9A -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf7'     #  0x9B -> DIVISION SIGN, right-left\r
+    u'\xfa'     #  0x9C -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf9'     #  0x9D -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfb'     #  0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0x9F -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u' '        #  0xA0 -> SPACE, right-left\r
+    u'!'        #  0xA1 -> EXCLAMATION MARK, right-left\r
+    u'"'        #  0xA2 -> QUOTATION MARK, right-left\r
+    u'#'        #  0xA3 -> NUMBER SIGN, right-left\r
+    u'$'        #  0xA4 -> DOLLAR SIGN, right-left\r
+    u'\u066a'   #  0xA5 -> ARABIC PERCENT SIGN\r
+    u'&'        #  0xA6 -> AMPERSAND, right-left\r
+    u"'"        #  0xA7 -> APOSTROPHE, right-left\r
+    u'('        #  0xA8 -> LEFT PARENTHESIS, right-left\r
+    u')'        #  0xA9 -> RIGHT PARENTHESIS, right-left\r
+    u'*'        #  0xAA -> ASTERISK, right-left\r
+    u'+'        #  0xAB -> PLUS SIGN, right-left\r
+    u'\u060c'   #  0xAC -> ARABIC COMMA\r
+    u'-'        #  0xAD -> HYPHEN-MINUS, right-left\r
+    u'.'        #  0xAE -> FULL STOP, right-left\r
+    u'/'        #  0xAF -> SOLIDUS, right-left\r
+    u'\u06f0'   #  0xB0 -> EXTENDED ARABIC-INDIC DIGIT ZERO, right-left (need override)\r
+    u'\u06f1'   #  0xB1 -> EXTENDED ARABIC-INDIC DIGIT ONE, right-left (need override)\r
+    u'\u06f2'   #  0xB2 -> EXTENDED ARABIC-INDIC DIGIT TWO, right-left (need override)\r
+    u'\u06f3'   #  0xB3 -> EXTENDED ARABIC-INDIC DIGIT THREE, right-left (need override)\r
+    u'\u06f4'   #  0xB4 -> EXTENDED ARABIC-INDIC DIGIT FOUR, right-left (need override)\r
+    u'\u06f5'   #  0xB5 -> EXTENDED ARABIC-INDIC DIGIT FIVE, right-left (need override)\r
+    u'\u06f6'   #  0xB6 -> EXTENDED ARABIC-INDIC DIGIT SIX, right-left (need override)\r
+    u'\u06f7'   #  0xB7 -> EXTENDED ARABIC-INDIC DIGIT SEVEN, right-left (need override)\r
+    u'\u06f8'   #  0xB8 -> EXTENDED ARABIC-INDIC DIGIT EIGHT, right-left (need override)\r
+    u'\u06f9'   #  0xB9 -> EXTENDED ARABIC-INDIC DIGIT NINE, right-left (need override)\r
+    u':'        #  0xBA -> COLON, right-left\r
+    u'\u061b'   #  0xBB -> ARABIC SEMICOLON\r
+    u'<'        #  0xBC -> LESS-THAN SIGN, right-left\r
+    u'='        #  0xBD -> EQUALS SIGN, right-left\r
+    u'>'        #  0xBE -> GREATER-THAN SIGN, right-left\r
+    u'\u061f'   #  0xBF -> ARABIC QUESTION MARK\r
+    u'\u274a'   #  0xC0 -> EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left\r
+    u'\u0621'   #  0xC1 -> ARABIC LETTER HAMZA\r
+    u'\u0622'   #  0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE\r
+    u'\u0623'   #  0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE\r
+    u'\u0624'   #  0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE\r
+    u'\u0625'   #  0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW\r
+    u'\u0626'   #  0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE\r
+    u'\u0627'   #  0xC7 -> ARABIC LETTER ALEF\r
+    u'\u0628'   #  0xC8 -> ARABIC LETTER BEH\r
+    u'\u0629'   #  0xC9 -> ARABIC LETTER TEH MARBUTA\r
+    u'\u062a'   #  0xCA -> ARABIC LETTER TEH\r
+    u'\u062b'   #  0xCB -> ARABIC LETTER THEH\r
+    u'\u062c'   #  0xCC -> ARABIC LETTER JEEM\r
+    u'\u062d'   #  0xCD -> ARABIC LETTER HAH\r
+    u'\u062e'   #  0xCE -> ARABIC LETTER KHAH\r
+    u'\u062f'   #  0xCF -> ARABIC LETTER DAL\r
+    u'\u0630'   #  0xD0 -> ARABIC LETTER THAL\r
+    u'\u0631'   #  0xD1 -> ARABIC LETTER REH\r
+    u'\u0632'   #  0xD2 -> ARABIC LETTER ZAIN\r
+    u'\u0633'   #  0xD3 -> ARABIC LETTER SEEN\r
+    u'\u0634'   #  0xD4 -> ARABIC LETTER SHEEN\r
+    u'\u0635'   #  0xD5 -> ARABIC LETTER SAD\r
+    u'\u0636'   #  0xD6 -> ARABIC LETTER DAD\r
+    u'\u0637'   #  0xD7 -> ARABIC LETTER TAH\r
+    u'\u0638'   #  0xD8 -> ARABIC LETTER ZAH\r
+    u'\u0639'   #  0xD9 -> ARABIC LETTER AIN\r
+    u'\u063a'   #  0xDA -> ARABIC LETTER GHAIN\r
+    u'['        #  0xDB -> LEFT SQUARE BRACKET, right-left\r
+    u'\\'       #  0xDC -> REVERSE SOLIDUS, right-left\r
+    u']'        #  0xDD -> RIGHT SQUARE BRACKET, right-left\r
+    u'^'        #  0xDE -> CIRCUMFLEX ACCENT, right-left\r
+    u'_'        #  0xDF -> LOW LINE, right-left\r
+    u'\u0640'   #  0xE0 -> ARABIC TATWEEL\r
+    u'\u0641'   #  0xE1 -> ARABIC LETTER FEH\r
+    u'\u0642'   #  0xE2 -> ARABIC LETTER QAF\r
+    u'\u0643'   #  0xE3 -> ARABIC LETTER KAF\r
+    u'\u0644'   #  0xE4 -> ARABIC LETTER LAM\r
+    u'\u0645'   #  0xE5 -> ARABIC LETTER MEEM\r
+    u'\u0646'   #  0xE6 -> ARABIC LETTER NOON\r
+    u'\u0647'   #  0xE7 -> ARABIC LETTER HEH\r
+    u'\u0648'   #  0xE8 -> ARABIC LETTER WAW\r
+    u'\u0649'   #  0xE9 -> ARABIC LETTER ALEF MAKSURA\r
+    u'\u064a'   #  0xEA -> ARABIC LETTER YEH\r
+    u'\u064b'   #  0xEB -> ARABIC FATHATAN\r
+    u'\u064c'   #  0xEC -> ARABIC DAMMATAN\r
+    u'\u064d'   #  0xED -> ARABIC KASRATAN\r
+    u'\u064e'   #  0xEE -> ARABIC FATHA\r
+    u'\u064f'   #  0xEF -> ARABIC DAMMA\r
+    u'\u0650'   #  0xF0 -> ARABIC KASRA\r
+    u'\u0651'   #  0xF1 -> ARABIC SHADDA\r
+    u'\u0652'   #  0xF2 -> ARABIC SUKUN\r
+    u'\u067e'   #  0xF3 -> ARABIC LETTER PEH\r
+    u'\u0679'   #  0xF4 -> ARABIC LETTER TTEH\r
+    u'\u0686'   #  0xF5 -> ARABIC LETTER TCHEH\r
+    u'\u06d5'   #  0xF6 -> ARABIC LETTER AE\r
+    u'\u06a4'   #  0xF7 -> ARABIC LETTER VEH\r
+    u'\u06af'   #  0xF8 -> ARABIC LETTER GAF\r
+    u'\u0688'   #  0xF9 -> ARABIC LETTER DDAL\r
+    u'\u0691'   #  0xFA -> ARABIC LETTER RREH\r
+    u'{'        #  0xFB -> LEFT CURLY BRACKET, right-left\r
+    u'|'        #  0xFC -> VERTICAL LINE, right-left\r
+    u'}'        #  0xFD -> RIGHT CURLY BRACKET, right-left\r
+    u'\u0698'   #  0xFE -> ARABIC LETTER JEH\r
+    u'\u06d2'   #  0xFF -> ARABIC LETTER YEH BARREE\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_greek.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_greek.py
new file mode 100644 (file)
index 0000000..77a25f4
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_greek generated from 'MAPPINGS/VENDORS/APPLE/GREEK.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-greek',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x01 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x02 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x03 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x04 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x05 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x06 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x07 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x08 -> CONTROL CHARACTER\r
+    u'\t'       #  0x09 -> CONTROL CHARACTER\r
+    u'\n'       #  0x0A -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x0B -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x0C -> CONTROL CHARACTER\r
+    u'\r'       #  0x0D -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x0E -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x0F -> CONTROL CHARACTER\r
+    u'\x10'     #  0x10 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x11 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x12 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x13 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x14 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x15 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x16 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x17 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x18 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x19 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x1A -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x1B -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x1C -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x1D -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x1E -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x1F -> CONTROL CHARACTER\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> CONTROL CHARACTER\r
+    u'\xc4'     #  0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xb9'     #  0x81 -> SUPERSCRIPT ONE\r
+    u'\xb2'     #  0x82 -> SUPERSCRIPT TWO\r
+    u'\xc9'     #  0x83 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xb3'     #  0x84 -> SUPERSCRIPT THREE\r
+    u'\xd6'     #  0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\u0385'   #  0x87 -> GREEK DIALYTIKA TONOS\r
+    u'\xe0'     #  0x88 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe2'     #  0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x8A -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\u0384'   #  0x8B -> GREEK TONOS\r
+    u'\xa8'     #  0x8C -> DIAERESIS\r
+    u'\xe7'     #  0x8D -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe9'     #  0x8E -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe8'     #  0x8F -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xea'     #  0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x91 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xa3'     #  0x92 -> POUND SIGN\r
+    u'\u2122'   #  0x93 -> TRADE MARK SIGN\r
+    u'\xee'     #  0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x95 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\u2022'   #  0x96 -> BULLET\r
+    u'\xbd'     #  0x97 -> VULGAR FRACTION ONE HALF\r
+    u'\u2030'   #  0x98 -> PER MILLE SIGN\r
+    u'\xf4'     #  0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x9A -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xa6'     #  0x9B -> BROKEN BAR\r
+    u'\u20ac'   #  0x9C -> EURO SIGN # before Mac OS 9.2.2, was SOFT HYPHEN\r
+    u'\xf9'     #  0x9D -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfb'     #  0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0x9F -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u2020'   #  0xA0 -> DAGGER\r
+    u'\u0393'   #  0xA1 -> GREEK CAPITAL LETTER GAMMA\r
+    u'\u0394'   #  0xA2 -> GREEK CAPITAL LETTER DELTA\r
+    u'\u0398'   #  0xA3 -> GREEK CAPITAL LETTER THETA\r
+    u'\u039b'   #  0xA4 -> GREEK CAPITAL LETTER LAMDA\r
+    u'\u039e'   #  0xA5 -> GREEK CAPITAL LETTER XI\r
+    u'\u03a0'   #  0xA6 -> GREEK CAPITAL LETTER PI\r
+    u'\xdf'     #  0xA7 -> LATIN SMALL LETTER SHARP S\r
+    u'\xae'     #  0xA8 -> REGISTERED SIGN\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u03a3'   #  0xAA -> GREEK CAPITAL LETTER SIGMA\r
+    u'\u03aa'   #  0xAB -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA\r
+    u'\xa7'     #  0xAC -> SECTION SIGN\r
+    u'\u2260'   #  0xAD -> NOT EQUAL TO\r
+    u'\xb0'     #  0xAE -> DEGREE SIGN\r
+    u'\xb7'     #  0xAF -> MIDDLE DOT\r
+    u'\u0391'   #  0xB0 -> GREEK CAPITAL LETTER ALPHA\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\u2264'   #  0xB2 -> LESS-THAN OR EQUAL TO\r
+    u'\u2265'   #  0xB3 -> GREATER-THAN OR EQUAL TO\r
+    u'\xa5'     #  0xB4 -> YEN SIGN\r
+    u'\u0392'   #  0xB5 -> GREEK CAPITAL LETTER BETA\r
+    u'\u0395'   #  0xB6 -> GREEK CAPITAL LETTER EPSILON\r
+    u'\u0396'   #  0xB7 -> GREEK CAPITAL LETTER ZETA\r
+    u'\u0397'   #  0xB8 -> GREEK CAPITAL LETTER ETA\r
+    u'\u0399'   #  0xB9 -> GREEK CAPITAL LETTER IOTA\r
+    u'\u039a'   #  0xBA -> GREEK CAPITAL LETTER KAPPA\r
+    u'\u039c'   #  0xBB -> GREEK CAPITAL LETTER MU\r
+    u'\u03a6'   #  0xBC -> GREEK CAPITAL LETTER PHI\r
+    u'\u03ab'   #  0xBD -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA\r
+    u'\u03a8'   #  0xBE -> GREEK CAPITAL LETTER PSI\r
+    u'\u03a9'   #  0xBF -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u03ac'   #  0xC0 -> GREEK SMALL LETTER ALPHA WITH TONOS\r
+    u'\u039d'   #  0xC1 -> GREEK CAPITAL LETTER NU\r
+    u'\xac'     #  0xC2 -> NOT SIGN\r
+    u'\u039f'   #  0xC3 -> GREEK CAPITAL LETTER OMICRON\r
+    u'\u03a1'   #  0xC4 -> GREEK CAPITAL LETTER RHO\r
+    u'\u2248'   #  0xC5 -> ALMOST EQUAL TO\r
+    u'\u03a4'   #  0xC6 -> GREEK CAPITAL LETTER TAU\r
+    u'\xab'     #  0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2026'   #  0xC9 -> HORIZONTAL ELLIPSIS\r
+    u'\xa0'     #  0xCA -> NO-BREAK SPACE\r
+    u'\u03a5'   #  0xCB -> GREEK CAPITAL LETTER UPSILON\r
+    u'\u03a7'   #  0xCC -> GREEK CAPITAL LETTER CHI\r
+    u'\u0386'   #  0xCD -> GREEK CAPITAL LETTER ALPHA WITH TONOS\r
+    u'\u0388'   #  0xCE -> GREEK CAPITAL LETTER EPSILON WITH TONOS\r
+    u'\u0153'   #  0xCF -> LATIN SMALL LIGATURE OE\r
+    u'\u2013'   #  0xD0 -> EN DASH\r
+    u'\u2015'   #  0xD1 -> HORIZONTAL BAR\r
+    u'\u201c'   #  0xD2 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0xD3 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2018'   #  0xD4 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0xD5 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xf7'     #  0xD6 -> DIVISION SIGN\r
+    u'\u0389'   #  0xD7 -> GREEK CAPITAL LETTER ETA WITH TONOS\r
+    u'\u038a'   #  0xD8 -> GREEK CAPITAL LETTER IOTA WITH TONOS\r
+    u'\u038c'   #  0xD9 -> GREEK CAPITAL LETTER OMICRON WITH TONOS\r
+    u'\u038e'   #  0xDA -> GREEK CAPITAL LETTER UPSILON WITH TONOS\r
+    u'\u03ad'   #  0xDB -> GREEK SMALL LETTER EPSILON WITH TONOS\r
+    u'\u03ae'   #  0xDC -> GREEK SMALL LETTER ETA WITH TONOS\r
+    u'\u03af'   #  0xDD -> GREEK SMALL LETTER IOTA WITH TONOS\r
+    u'\u03cc'   #  0xDE -> GREEK SMALL LETTER OMICRON WITH TONOS\r
+    u'\u038f'   #  0xDF -> GREEK CAPITAL LETTER OMEGA WITH TONOS\r
+    u'\u03cd'   #  0xE0 -> GREEK SMALL LETTER UPSILON WITH TONOS\r
+    u'\u03b1'   #  0xE1 -> GREEK SMALL LETTER ALPHA\r
+    u'\u03b2'   #  0xE2 -> GREEK SMALL LETTER BETA\r
+    u'\u03c8'   #  0xE3 -> GREEK SMALL LETTER PSI\r
+    u'\u03b4'   #  0xE4 -> GREEK SMALL LETTER DELTA\r
+    u'\u03b5'   #  0xE5 -> GREEK SMALL LETTER EPSILON\r
+    u'\u03c6'   #  0xE6 -> GREEK SMALL LETTER PHI\r
+    u'\u03b3'   #  0xE7 -> GREEK SMALL LETTER GAMMA\r
+    u'\u03b7'   #  0xE8 -> GREEK SMALL LETTER ETA\r
+    u'\u03b9'   #  0xE9 -> GREEK SMALL LETTER IOTA\r
+    u'\u03be'   #  0xEA -> GREEK SMALL LETTER XI\r
+    u'\u03ba'   #  0xEB -> GREEK SMALL LETTER KAPPA\r
+    u'\u03bb'   #  0xEC -> GREEK SMALL LETTER LAMDA\r
+    u'\u03bc'   #  0xED -> GREEK SMALL LETTER MU\r
+    u'\u03bd'   #  0xEE -> GREEK SMALL LETTER NU\r
+    u'\u03bf'   #  0xEF -> GREEK SMALL LETTER OMICRON\r
+    u'\u03c0'   #  0xF0 -> GREEK SMALL LETTER PI\r
+    u'\u03ce'   #  0xF1 -> GREEK SMALL LETTER OMEGA WITH TONOS\r
+    u'\u03c1'   #  0xF2 -> GREEK SMALL LETTER RHO\r
+    u'\u03c3'   #  0xF3 -> GREEK SMALL LETTER SIGMA\r
+    u'\u03c4'   #  0xF4 -> GREEK SMALL LETTER TAU\r
+    u'\u03b8'   #  0xF5 -> GREEK SMALL LETTER THETA\r
+    u'\u03c9'   #  0xF6 -> GREEK SMALL LETTER OMEGA\r
+    u'\u03c2'   #  0xF7 -> GREEK SMALL LETTER FINAL SIGMA\r
+    u'\u03c7'   #  0xF8 -> GREEK SMALL LETTER CHI\r
+    u'\u03c5'   #  0xF9 -> GREEK SMALL LETTER UPSILON\r
+    u'\u03b6'   #  0xFA -> GREEK SMALL LETTER ZETA\r
+    u'\u03ca'   #  0xFB -> GREEK SMALL LETTER IOTA WITH DIALYTIKA\r
+    u'\u03cb'   #  0xFC -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA\r
+    u'\u0390'   #  0xFD -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS\r
+    u'\u03b0'   #  0xFE -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS\r
+    u'\xad'     #  0xFF -> SOFT HYPHEN # before Mac OS 9.2.2, was undefined\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_iceland.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_iceland.py
new file mode 100644 (file)
index 0000000..7045dc1
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_iceland generated from 'MAPPINGS/VENDORS/APPLE/ICELAND.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-iceland',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x01 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x02 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x03 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x04 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x05 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x06 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x07 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x08 -> CONTROL CHARACTER\r
+    u'\t'       #  0x09 -> CONTROL CHARACTER\r
+    u'\n'       #  0x0A -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x0B -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x0C -> CONTROL CHARACTER\r
+    u'\r'       #  0x0D -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x0E -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x0F -> CONTROL CHARACTER\r
+    u'\x10'     #  0x10 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x11 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x12 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x13 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x14 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x15 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x16 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x17 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x18 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x19 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x1A -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x1B -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x1C -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x1D -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x1E -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x1F -> CONTROL CHARACTER\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> CONTROL CHARACTER\r
+    u'\xc4'     #  0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc7'     #  0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc9'     #  0x83 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xd1'     #  0x84 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd6'     #  0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xe1'     #  0x87 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe0'     #  0x88 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe2'     #  0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x8A -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe3'     #  0x8B -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe5'     #  0x8C -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x8D -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe9'     #  0x8E -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe8'     #  0x8F -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xea'     #  0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x91 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xed'     #  0x92 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xec'     #  0x93 -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xee'     #  0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x95 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf1'     #  0x96 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf3'     #  0x97 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf2'     #  0x98 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf4'     #  0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x9A -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf5'     #  0x9B -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xfa'     #  0x9C -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf9'     #  0x9D -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfb'     #  0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0x9F -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\xdd'     #  0xA0 -> LATIN CAPITAL LETTER Y WITH ACUTE\r
+    u'\xb0'     #  0xA1 -> DEGREE SIGN\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa7'     #  0xA4 -> SECTION SIGN\r
+    u'\u2022'   #  0xA5 -> BULLET\r
+    u'\xb6'     #  0xA6 -> PILCROW SIGN\r
+    u'\xdf'     #  0xA7 -> LATIN SMALL LETTER SHARP S\r
+    u'\xae'     #  0xA8 -> REGISTERED SIGN\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u2122'   #  0xAA -> TRADE MARK SIGN\r
+    u'\xb4'     #  0xAB -> ACUTE ACCENT\r
+    u'\xa8'     #  0xAC -> DIAERESIS\r
+    u'\u2260'   #  0xAD -> NOT EQUAL TO\r
+    u'\xc6'     #  0xAE -> LATIN CAPITAL LETTER AE\r
+    u'\xd8'     #  0xAF -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\u221e'   #  0xB0 -> INFINITY\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\u2264'   #  0xB2 -> LESS-THAN OR EQUAL TO\r
+    u'\u2265'   #  0xB3 -> GREATER-THAN OR EQUAL TO\r
+    u'\xa5'     #  0xB4 -> YEN SIGN\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\u2202'   #  0xB6 -> PARTIAL DIFFERENTIAL\r
+    u'\u2211'   #  0xB7 -> N-ARY SUMMATION\r
+    u'\u220f'   #  0xB8 -> N-ARY PRODUCT\r
+    u'\u03c0'   #  0xB9 -> GREEK SMALL LETTER PI\r
+    u'\u222b'   #  0xBA -> INTEGRAL\r
+    u'\xaa'     #  0xBB -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0xBC -> MASCULINE ORDINAL INDICATOR\r
+    u'\u03a9'   #  0xBD -> GREEK CAPITAL LETTER OMEGA\r
+    u'\xe6'     #  0xBE -> LATIN SMALL LETTER AE\r
+    u'\xf8'     #  0xBF -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xbf'     #  0xC0 -> INVERTED QUESTION MARK\r
+    u'\xa1'     #  0xC1 -> INVERTED EXCLAMATION MARK\r
+    u'\xac'     #  0xC2 -> NOT SIGN\r
+    u'\u221a'   #  0xC3 -> SQUARE ROOT\r
+    u'\u0192'   #  0xC4 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u2248'   #  0xC5 -> ALMOST EQUAL TO\r
+    u'\u2206'   #  0xC6 -> INCREMENT\r
+    u'\xab'     #  0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2026'   #  0xC9 -> HORIZONTAL ELLIPSIS\r
+    u'\xa0'     #  0xCA -> NO-BREAK SPACE\r
+    u'\xc0'     #  0xCB -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc3'     #  0xCC -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xd5'     #  0xCD -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\u0152'   #  0xCE -> LATIN CAPITAL LIGATURE OE\r
+    u'\u0153'   #  0xCF -> LATIN SMALL LIGATURE OE\r
+    u'\u2013'   #  0xD0 -> EN DASH\r
+    u'\u2014'   #  0xD1 -> EM DASH\r
+    u'\u201c'   #  0xD2 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0xD3 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2018'   #  0xD4 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0xD5 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xf7'     #  0xD6 -> DIVISION SIGN\r
+    u'\u25ca'   #  0xD7 -> LOZENGE\r
+    u'\xff'     #  0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\u0178'   #  0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+    u'\u2044'   #  0xDA -> FRACTION SLASH\r
+    u'\u20ac'   #  0xDB -> EURO SIGN\r
+    u'\xd0'     #  0xDC -> LATIN CAPITAL LETTER ETH\r
+    u'\xf0'     #  0xDD -> LATIN SMALL LETTER ETH\r
+    u'\xde'     #  0xDE -> LATIN CAPITAL LETTER THORN\r
+    u'\xfe'     #  0xDF -> LATIN SMALL LETTER THORN\r
+    u'\xfd'     #  0xE0 -> LATIN SMALL LETTER Y WITH ACUTE\r
+    u'\xb7'     #  0xE1 -> MIDDLE DOT\r
+    u'\u201a'   #  0xE2 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u201e'   #  0xE3 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2030'   #  0xE4 -> PER MILLE SIGN\r
+    u'\xc2'     #  0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xca'     #  0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xc1'     #  0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xcb'     #  0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xcd'     #  0xEA -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xcc'     #  0xED -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xd3'     #  0xEE -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\uf8ff'   #  0xF0 -> Apple logo\r
+    u'\xd2'     #  0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xda'     #  0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xd9'     #  0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\u0131'   #  0xF5 -> LATIN SMALL LETTER DOTLESS I\r
+    u'\u02c6'   #  0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT\r
+    u'\u02dc'   #  0xF7 -> SMALL TILDE\r
+    u'\xaf'     #  0xF8 -> MACRON\r
+    u'\u02d8'   #  0xF9 -> BREVE\r
+    u'\u02d9'   #  0xFA -> DOT ABOVE\r
+    u'\u02da'   #  0xFB -> RING ABOVE\r
+    u'\xb8'     #  0xFC -> CEDILLA\r
+    u'\u02dd'   #  0xFD -> DOUBLE ACUTE ACCENT\r
+    u'\u02db'   #  0xFE -> OGONEK\r
+    u'\u02c7'   #  0xFF -> CARON\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_latin2.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_latin2.py
new file mode 100644 (file)
index 0000000..324b4af
--- /dev/null
@@ -0,0 +1,183 @@
+""" Python Character Mapping Codec generated from 'LATIN2.TXT' with gencodec.py.\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+(c) Copyright 2000 Guido van Rossum.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_map)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_map)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-latin2',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+        0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS\r
+        0x0081: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON\r
+        0x0082: 0x0101, # LATIN SMALL LETTER A WITH MACRON\r
+        0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE\r
+        0x0084: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK\r
+        0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS\r
+        0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS\r
+        0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE\r
+        0x0088: 0x0105, # LATIN SMALL LETTER A WITH OGONEK\r
+        0x0089: 0x010c, # LATIN CAPITAL LETTER C WITH CARON\r
+        0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS\r
+        0x008b: 0x010d, # LATIN SMALL LETTER C WITH CARON\r
+        0x008c: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE\r
+        0x008d: 0x0107, # LATIN SMALL LETTER C WITH ACUTE\r
+        0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE\r
+        0x008f: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE\r
+        0x0090: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE\r
+        0x0091: 0x010e, # LATIN CAPITAL LETTER D WITH CARON\r
+        0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE\r
+        0x0093: 0x010f, # LATIN SMALL LETTER D WITH CARON\r
+        0x0094: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON\r
+        0x0095: 0x0113, # LATIN SMALL LETTER E WITH MACRON\r
+        0x0096: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE\r
+        0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE\r
+        0x0098: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE\r
+        0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+        0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS\r
+        0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE\r
+        0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE\r
+        0x009d: 0x011a, # LATIN CAPITAL LETTER E WITH CARON\r
+        0x009e: 0x011b, # LATIN SMALL LETTER E WITH CARON\r
+        0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS\r
+        0x00a0: 0x2020, # DAGGER\r
+        0x00a1: 0x00b0, # DEGREE SIGN\r
+        0x00a2: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK\r
+        0x00a4: 0x00a7, # SECTION SIGN\r
+        0x00a5: 0x2022, # BULLET\r
+        0x00a6: 0x00b6, # PILCROW SIGN\r
+        0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S\r
+        0x00a8: 0x00ae, # REGISTERED SIGN\r
+        0x00aa: 0x2122, # TRADE MARK SIGN\r
+        0x00ab: 0x0119, # LATIN SMALL LETTER E WITH OGONEK\r
+        0x00ac: 0x00a8, # DIAERESIS\r
+        0x00ad: 0x2260, # NOT EQUAL TO\r
+        0x00ae: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA\r
+        0x00af: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK\r
+        0x00b0: 0x012f, # LATIN SMALL LETTER I WITH OGONEK\r
+        0x00b1: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON\r
+        0x00b2: 0x2264, # LESS-THAN OR EQUAL TO\r
+        0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO\r
+        0x00b4: 0x012b, # LATIN SMALL LETTER I WITH MACRON\r
+        0x00b5: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA\r
+        0x00b6: 0x2202, # PARTIAL DIFFERENTIAL\r
+        0x00b7: 0x2211, # N-ARY SUMMATION\r
+        0x00b8: 0x0142, # LATIN SMALL LETTER L WITH STROKE\r
+        0x00b9: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA\r
+        0x00ba: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA\r
+        0x00bb: 0x013d, # LATIN CAPITAL LETTER L WITH CARON\r
+        0x00bc: 0x013e, # LATIN SMALL LETTER L WITH CARON\r
+        0x00bd: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE\r
+        0x00be: 0x013a, # LATIN SMALL LETTER L WITH ACUTE\r
+        0x00bf: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA\r
+        0x00c0: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA\r
+        0x00c1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE\r
+        0x00c2: 0x00ac, # NOT SIGN\r
+        0x00c3: 0x221a, # SQUARE ROOT\r
+        0x00c4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE\r
+        0x00c5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON\r
+        0x00c6: 0x2206, # INCREMENT\r
+        0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+        0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+        0x00c9: 0x2026, # HORIZONTAL ELLIPSIS\r
+        0x00ca: 0x00a0, # NO-BREAK SPACE\r
+        0x00cb: 0x0148, # LATIN SMALL LETTER N WITH CARON\r
+        0x00cc: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE\r
+        0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE\r
+        0x00ce: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE\r
+        0x00cf: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON\r
+        0x00d0: 0x2013, # EN DASH\r
+        0x00d1: 0x2014, # EM DASH\r
+        0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK\r
+        0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK\r
+        0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK\r
+        0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK\r
+        0x00d6: 0x00f7, # DIVISION SIGN\r
+        0x00d7: 0x25ca, # LOZENGE\r
+        0x00d8: 0x014d, # LATIN SMALL LETTER O WITH MACRON\r
+        0x00d9: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE\r
+        0x00da: 0x0155, # LATIN SMALL LETTER R WITH ACUTE\r
+        0x00db: 0x0158, # LATIN CAPITAL LETTER R WITH CARON\r
+        0x00dc: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+        0x00dd: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+        0x00de: 0x0159, # LATIN SMALL LETTER R WITH CARON\r
+        0x00df: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA\r
+        0x00e0: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA\r
+        0x00e1: 0x0160, # LATIN CAPITAL LETTER S WITH CARON\r
+        0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK\r
+        0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK\r
+        0x00e4: 0x0161, # LATIN SMALL LETTER S WITH CARON\r
+        0x00e5: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE\r
+        0x00e6: 0x015b, # LATIN SMALL LETTER S WITH ACUTE\r
+        0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE\r
+        0x00e8: 0x0164, # LATIN CAPITAL LETTER T WITH CARON\r
+        0x00e9: 0x0165, # LATIN SMALL LETTER T WITH CARON\r
+        0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE\r
+        0x00eb: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON\r
+        0x00ec: 0x017e, # LATIN SMALL LETTER Z WITH CARON\r
+        0x00ed: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON\r
+        0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE\r
+        0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+        0x00f0: 0x016b, # LATIN SMALL LETTER U WITH MACRON\r
+        0x00f1: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE\r
+        0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE\r
+        0x00f3: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE\r
+        0x00f4: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE\r
+        0x00f5: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE\r
+        0x00f6: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK\r
+        0x00f7: 0x0173, # LATIN SMALL LETTER U WITH OGONEK\r
+        0x00f8: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE\r
+        0x00f9: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE\r
+        0x00fa: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA\r
+        0x00fb: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE\r
+        0x00fc: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE\r
+        0x00fd: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE\r
+        0x00fe: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA\r
+        0x00ff: 0x02c7, # CARON\r
+})\r
+\r
+### Encoding Map\r
+\r
+encoding_map = codecs.make_encoding_map(decoding_map)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_roman.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_roman.py
new file mode 100644 (file)
index 0000000..1098501
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_roman generated from 'MAPPINGS/VENDORS/APPLE/ROMAN.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-roman',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x01 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x02 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x03 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x04 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x05 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x06 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x07 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x08 -> CONTROL CHARACTER\r
+    u'\t'       #  0x09 -> CONTROL CHARACTER\r
+    u'\n'       #  0x0A -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x0B -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x0C -> CONTROL CHARACTER\r
+    u'\r'       #  0x0D -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x0E -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x0F -> CONTROL CHARACTER\r
+    u'\x10'     #  0x10 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x11 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x12 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x13 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x14 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x15 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x16 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x17 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x18 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x19 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x1A -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x1B -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x1C -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x1D -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x1E -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x1F -> CONTROL CHARACTER\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> CONTROL CHARACTER\r
+    u'\xc4'     #  0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc7'     #  0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc9'     #  0x83 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xd1'     #  0x84 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd6'     #  0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xe1'     #  0x87 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe0'     #  0x88 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe2'     #  0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x8A -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe3'     #  0x8B -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe5'     #  0x8C -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x8D -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe9'     #  0x8E -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe8'     #  0x8F -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xea'     #  0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x91 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xed'     #  0x92 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xec'     #  0x93 -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xee'     #  0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x95 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf1'     #  0x96 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf3'     #  0x97 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf2'     #  0x98 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf4'     #  0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x9A -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf5'     #  0x9B -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xfa'     #  0x9C -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf9'     #  0x9D -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfb'     #  0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0x9F -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u2020'   #  0xA0 -> DAGGER\r
+    u'\xb0'     #  0xA1 -> DEGREE SIGN\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa7'     #  0xA4 -> SECTION SIGN\r
+    u'\u2022'   #  0xA5 -> BULLET\r
+    u'\xb6'     #  0xA6 -> PILCROW SIGN\r
+    u'\xdf'     #  0xA7 -> LATIN SMALL LETTER SHARP S\r
+    u'\xae'     #  0xA8 -> REGISTERED SIGN\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u2122'   #  0xAA -> TRADE MARK SIGN\r
+    u'\xb4'     #  0xAB -> ACUTE ACCENT\r
+    u'\xa8'     #  0xAC -> DIAERESIS\r
+    u'\u2260'   #  0xAD -> NOT EQUAL TO\r
+    u'\xc6'     #  0xAE -> LATIN CAPITAL LETTER AE\r
+    u'\xd8'     #  0xAF -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\u221e'   #  0xB0 -> INFINITY\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\u2264'   #  0xB2 -> LESS-THAN OR EQUAL TO\r
+    u'\u2265'   #  0xB3 -> GREATER-THAN OR EQUAL TO\r
+    u'\xa5'     #  0xB4 -> YEN SIGN\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\u2202'   #  0xB6 -> PARTIAL DIFFERENTIAL\r
+    u'\u2211'   #  0xB7 -> N-ARY SUMMATION\r
+    u'\u220f'   #  0xB8 -> N-ARY PRODUCT\r
+    u'\u03c0'   #  0xB9 -> GREEK SMALL LETTER PI\r
+    u'\u222b'   #  0xBA -> INTEGRAL\r
+    u'\xaa'     #  0xBB -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0xBC -> MASCULINE ORDINAL INDICATOR\r
+    u'\u03a9'   #  0xBD -> GREEK CAPITAL LETTER OMEGA\r
+    u'\xe6'     #  0xBE -> LATIN SMALL LETTER AE\r
+    u'\xf8'     #  0xBF -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xbf'     #  0xC0 -> INVERTED QUESTION MARK\r
+    u'\xa1'     #  0xC1 -> INVERTED EXCLAMATION MARK\r
+    u'\xac'     #  0xC2 -> NOT SIGN\r
+    u'\u221a'   #  0xC3 -> SQUARE ROOT\r
+    u'\u0192'   #  0xC4 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u2248'   #  0xC5 -> ALMOST EQUAL TO\r
+    u'\u2206'   #  0xC6 -> INCREMENT\r
+    u'\xab'     #  0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2026'   #  0xC9 -> HORIZONTAL ELLIPSIS\r
+    u'\xa0'     #  0xCA -> NO-BREAK SPACE\r
+    u'\xc0'     #  0xCB -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc3'     #  0xCC -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xd5'     #  0xCD -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\u0152'   #  0xCE -> LATIN CAPITAL LIGATURE OE\r
+    u'\u0153'   #  0xCF -> LATIN SMALL LIGATURE OE\r
+    u'\u2013'   #  0xD0 -> EN DASH\r
+    u'\u2014'   #  0xD1 -> EM DASH\r
+    u'\u201c'   #  0xD2 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0xD3 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2018'   #  0xD4 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0xD5 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xf7'     #  0xD6 -> DIVISION SIGN\r
+    u'\u25ca'   #  0xD7 -> LOZENGE\r
+    u'\xff'     #  0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\u0178'   #  0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+    u'\u2044'   #  0xDA -> FRACTION SLASH\r
+    u'\u20ac'   #  0xDB -> EURO SIGN\r
+    u'\u2039'   #  0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\u203a'   #  0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\ufb01'   #  0xDE -> LATIN SMALL LIGATURE FI\r
+    u'\ufb02'   #  0xDF -> LATIN SMALL LIGATURE FL\r
+    u'\u2021'   #  0xE0 -> DOUBLE DAGGER\r
+    u'\xb7'     #  0xE1 -> MIDDLE DOT\r
+    u'\u201a'   #  0xE2 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u201e'   #  0xE3 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2030'   #  0xE4 -> PER MILLE SIGN\r
+    u'\xc2'     #  0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xca'     #  0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xc1'     #  0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xcb'     #  0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xcd'     #  0xEA -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xcc'     #  0xED -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xd3'     #  0xEE -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\uf8ff'   #  0xF0 -> Apple logo\r
+    u'\xd2'     #  0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xda'     #  0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xd9'     #  0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\u0131'   #  0xF5 -> LATIN SMALL LETTER DOTLESS I\r
+    u'\u02c6'   #  0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT\r
+    u'\u02dc'   #  0xF7 -> SMALL TILDE\r
+    u'\xaf'     #  0xF8 -> MACRON\r
+    u'\u02d8'   #  0xF9 -> BREVE\r
+    u'\u02d9'   #  0xFA -> DOT ABOVE\r
+    u'\u02da'   #  0xFB -> RING ABOVE\r
+    u'\xb8'     #  0xFC -> CEDILLA\r
+    u'\u02dd'   #  0xFD -> DOUBLE ACUTE ACCENT\r
+    u'\u02db'   #  0xFE -> OGONEK\r
+    u'\u02c7'   #  0xFF -> CARON\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_romanian.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_romanian.py
new file mode 100644 (file)
index 0000000..26a5e53
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_romanian generated from 'MAPPINGS/VENDORS/APPLE/ROMANIAN.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-romanian',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x01 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x02 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x03 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x04 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x05 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x06 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x07 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x08 -> CONTROL CHARACTER\r
+    u'\t'       #  0x09 -> CONTROL CHARACTER\r
+    u'\n'       #  0x0A -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x0B -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x0C -> CONTROL CHARACTER\r
+    u'\r'       #  0x0D -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x0E -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x0F -> CONTROL CHARACTER\r
+    u'\x10'     #  0x10 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x11 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x12 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x13 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x14 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x15 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x16 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x17 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x18 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x19 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x1A -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x1B -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x1C -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x1D -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x1E -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x1F -> CONTROL CHARACTER\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> CONTROL CHARACTER\r
+    u'\xc4'     #  0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc7'     #  0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc9'     #  0x83 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xd1'     #  0x84 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd6'     #  0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xe1'     #  0x87 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe0'     #  0x88 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe2'     #  0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x8A -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe3'     #  0x8B -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe5'     #  0x8C -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x8D -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe9'     #  0x8E -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe8'     #  0x8F -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xea'     #  0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x91 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xed'     #  0x92 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xec'     #  0x93 -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xee'     #  0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x95 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf1'     #  0x96 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf3'     #  0x97 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf2'     #  0x98 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf4'     #  0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x9A -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf5'     #  0x9B -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xfa'     #  0x9C -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf9'     #  0x9D -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfb'     #  0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0x9F -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u2020'   #  0xA0 -> DAGGER\r
+    u'\xb0'     #  0xA1 -> DEGREE SIGN\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa7'     #  0xA4 -> SECTION SIGN\r
+    u'\u2022'   #  0xA5 -> BULLET\r
+    u'\xb6'     #  0xA6 -> PILCROW SIGN\r
+    u'\xdf'     #  0xA7 -> LATIN SMALL LETTER SHARP S\r
+    u'\xae'     #  0xA8 -> REGISTERED SIGN\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u2122'   #  0xAA -> TRADE MARK SIGN\r
+    u'\xb4'     #  0xAB -> ACUTE ACCENT\r
+    u'\xa8'     #  0xAC -> DIAERESIS\r
+    u'\u2260'   #  0xAD -> NOT EQUAL TO\r
+    u'\u0102'   #  0xAE -> LATIN CAPITAL LETTER A WITH BREVE\r
+    u'\u0218'   #  0xAF -> LATIN CAPITAL LETTER S WITH COMMA BELOW # for Unicode 3.0 and later\r
+    u'\u221e'   #  0xB0 -> INFINITY\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\u2264'   #  0xB2 -> LESS-THAN OR EQUAL TO\r
+    u'\u2265'   #  0xB3 -> GREATER-THAN OR EQUAL TO\r
+    u'\xa5'     #  0xB4 -> YEN SIGN\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\u2202'   #  0xB6 -> PARTIAL DIFFERENTIAL\r
+    u'\u2211'   #  0xB7 -> N-ARY SUMMATION\r
+    u'\u220f'   #  0xB8 -> N-ARY PRODUCT\r
+    u'\u03c0'   #  0xB9 -> GREEK SMALL LETTER PI\r
+    u'\u222b'   #  0xBA -> INTEGRAL\r
+    u'\xaa'     #  0xBB -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0xBC -> MASCULINE ORDINAL INDICATOR\r
+    u'\u03a9'   #  0xBD -> GREEK CAPITAL LETTER OMEGA\r
+    u'\u0103'   #  0xBE -> LATIN SMALL LETTER A WITH BREVE\r
+    u'\u0219'   #  0xBF -> LATIN SMALL LETTER S WITH COMMA BELOW # for Unicode 3.0 and later\r
+    u'\xbf'     #  0xC0 -> INVERTED QUESTION MARK\r
+    u'\xa1'     #  0xC1 -> INVERTED EXCLAMATION MARK\r
+    u'\xac'     #  0xC2 -> NOT SIGN\r
+    u'\u221a'   #  0xC3 -> SQUARE ROOT\r
+    u'\u0192'   #  0xC4 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u2248'   #  0xC5 -> ALMOST EQUAL TO\r
+    u'\u2206'   #  0xC6 -> INCREMENT\r
+    u'\xab'     #  0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2026'   #  0xC9 -> HORIZONTAL ELLIPSIS\r
+    u'\xa0'     #  0xCA -> NO-BREAK SPACE\r
+    u'\xc0'     #  0xCB -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc3'     #  0xCC -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xd5'     #  0xCD -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\u0152'   #  0xCE -> LATIN CAPITAL LIGATURE OE\r
+    u'\u0153'   #  0xCF -> LATIN SMALL LIGATURE OE\r
+    u'\u2013'   #  0xD0 -> EN DASH\r
+    u'\u2014'   #  0xD1 -> EM DASH\r
+    u'\u201c'   #  0xD2 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0xD3 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2018'   #  0xD4 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0xD5 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xf7'     #  0xD6 -> DIVISION SIGN\r
+    u'\u25ca'   #  0xD7 -> LOZENGE\r
+    u'\xff'     #  0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\u0178'   #  0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+    u'\u2044'   #  0xDA -> FRACTION SLASH\r
+    u'\u20ac'   #  0xDB -> EURO SIGN\r
+    u'\u2039'   #  0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+    u'\u203a'   #  0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\r
+    u'\u021a'   #  0xDE -> LATIN CAPITAL LETTER T WITH COMMA BELOW # for Unicode 3.0 and later\r
+    u'\u021b'   #  0xDF -> LATIN SMALL LETTER T WITH COMMA BELOW # for Unicode 3.0 and later\r
+    u'\u2021'   #  0xE0 -> DOUBLE DAGGER\r
+    u'\xb7'     #  0xE1 -> MIDDLE DOT\r
+    u'\u201a'   #  0xE2 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u201e'   #  0xE3 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2030'   #  0xE4 -> PER MILLE SIGN\r
+    u'\xc2'     #  0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xca'     #  0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xc1'     #  0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xcb'     #  0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xcd'     #  0xEA -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xcc'     #  0xED -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xd3'     #  0xEE -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\uf8ff'   #  0xF0 -> Apple logo\r
+    u'\xd2'     #  0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xda'     #  0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xd9'     #  0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\u0131'   #  0xF5 -> LATIN SMALL LETTER DOTLESS I\r
+    u'\u02c6'   #  0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT\r
+    u'\u02dc'   #  0xF7 -> SMALL TILDE\r
+    u'\xaf'     #  0xF8 -> MACRON\r
+    u'\u02d8'   #  0xF9 -> BREVE\r
+    u'\u02d9'   #  0xFA -> DOT ABOVE\r
+    u'\u02da'   #  0xFB -> RING ABOVE\r
+    u'\xb8'     #  0xFC -> CEDILLA\r
+    u'\u02dd'   #  0xFD -> DOUBLE ACUTE ACCENT\r
+    u'\u02db'   #  0xFE -> OGONEK\r
+    u'\u02c7'   #  0xFF -> CARON\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_turkish.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_turkish.py
new file mode 100644 (file)
index 0000000..fafcc64
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_turkish generated from 'MAPPINGS/VENDORS/APPLE/TURKISH.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mac-turkish',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> CONTROL CHARACTER\r
+    u'\x01'     #  0x01 -> CONTROL CHARACTER\r
+    u'\x02'     #  0x02 -> CONTROL CHARACTER\r
+    u'\x03'     #  0x03 -> CONTROL CHARACTER\r
+    u'\x04'     #  0x04 -> CONTROL CHARACTER\r
+    u'\x05'     #  0x05 -> CONTROL CHARACTER\r
+    u'\x06'     #  0x06 -> CONTROL CHARACTER\r
+    u'\x07'     #  0x07 -> CONTROL CHARACTER\r
+    u'\x08'     #  0x08 -> CONTROL CHARACTER\r
+    u'\t'       #  0x09 -> CONTROL CHARACTER\r
+    u'\n'       #  0x0A -> CONTROL CHARACTER\r
+    u'\x0b'     #  0x0B -> CONTROL CHARACTER\r
+    u'\x0c'     #  0x0C -> CONTROL CHARACTER\r
+    u'\r'       #  0x0D -> CONTROL CHARACTER\r
+    u'\x0e'     #  0x0E -> CONTROL CHARACTER\r
+    u'\x0f'     #  0x0F -> CONTROL CHARACTER\r
+    u'\x10'     #  0x10 -> CONTROL CHARACTER\r
+    u'\x11'     #  0x11 -> CONTROL CHARACTER\r
+    u'\x12'     #  0x12 -> CONTROL CHARACTER\r
+    u'\x13'     #  0x13 -> CONTROL CHARACTER\r
+    u'\x14'     #  0x14 -> CONTROL CHARACTER\r
+    u'\x15'     #  0x15 -> CONTROL CHARACTER\r
+    u'\x16'     #  0x16 -> CONTROL CHARACTER\r
+    u'\x17'     #  0x17 -> CONTROL CHARACTER\r
+    u'\x18'     #  0x18 -> CONTROL CHARACTER\r
+    u'\x19'     #  0x19 -> CONTROL CHARACTER\r
+    u'\x1a'     #  0x1A -> CONTROL CHARACTER\r
+    u'\x1b'     #  0x1B -> CONTROL CHARACTER\r
+    u'\x1c'     #  0x1C -> CONTROL CHARACTER\r
+    u'\x1d'     #  0x1D -> CONTROL CHARACTER\r
+    u'\x1e'     #  0x1E -> CONTROL CHARACTER\r
+    u'\x1f'     #  0x1F -> CONTROL CHARACTER\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> CONTROL CHARACTER\r
+    u'\xc4'     #  0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS\r
+    u'\xc5'     #  0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE\r
+    u'\xc7'     #  0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA\r
+    u'\xc9'     #  0x83 -> LATIN CAPITAL LETTER E WITH ACUTE\r
+    u'\xd1'     #  0x84 -> LATIN CAPITAL LETTER N WITH TILDE\r
+    u'\xd6'     #  0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS\r
+    u'\xdc'     #  0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS\r
+    u'\xe1'     #  0x87 -> LATIN SMALL LETTER A WITH ACUTE\r
+    u'\xe0'     #  0x88 -> LATIN SMALL LETTER A WITH GRAVE\r
+    u'\xe2'     #  0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX\r
+    u'\xe4'     #  0x8A -> LATIN SMALL LETTER A WITH DIAERESIS\r
+    u'\xe3'     #  0x8B -> LATIN SMALL LETTER A WITH TILDE\r
+    u'\xe5'     #  0x8C -> LATIN SMALL LETTER A WITH RING ABOVE\r
+    u'\xe7'     #  0x8D -> LATIN SMALL LETTER C WITH CEDILLA\r
+    u'\xe9'     #  0x8E -> LATIN SMALL LETTER E WITH ACUTE\r
+    u'\xe8'     #  0x8F -> LATIN SMALL LETTER E WITH GRAVE\r
+    u'\xea'     #  0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX\r
+    u'\xeb'     #  0x91 -> LATIN SMALL LETTER E WITH DIAERESIS\r
+    u'\xed'     #  0x92 -> LATIN SMALL LETTER I WITH ACUTE\r
+    u'\xec'     #  0x93 -> LATIN SMALL LETTER I WITH GRAVE\r
+    u'\xee'     #  0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX\r
+    u'\xef'     #  0x95 -> LATIN SMALL LETTER I WITH DIAERESIS\r
+    u'\xf1'     #  0x96 -> LATIN SMALL LETTER N WITH TILDE\r
+    u'\xf3'     #  0x97 -> LATIN SMALL LETTER O WITH ACUTE\r
+    u'\xf2'     #  0x98 -> LATIN SMALL LETTER O WITH GRAVE\r
+    u'\xf4'     #  0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX\r
+    u'\xf6'     #  0x9A -> LATIN SMALL LETTER O WITH DIAERESIS\r
+    u'\xf5'     #  0x9B -> LATIN SMALL LETTER O WITH TILDE\r
+    u'\xfa'     #  0x9C -> LATIN SMALL LETTER U WITH ACUTE\r
+    u'\xf9'     #  0x9D -> LATIN SMALL LETTER U WITH GRAVE\r
+    u'\xfb'     #  0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX\r
+    u'\xfc'     #  0x9F -> LATIN SMALL LETTER U WITH DIAERESIS\r
+    u'\u2020'   #  0xA0 -> DAGGER\r
+    u'\xb0'     #  0xA1 -> DEGREE SIGN\r
+    u'\xa2'     #  0xA2 -> CENT SIGN\r
+    u'\xa3'     #  0xA3 -> POUND SIGN\r
+    u'\xa7'     #  0xA4 -> SECTION SIGN\r
+    u'\u2022'   #  0xA5 -> BULLET\r
+    u'\xb6'     #  0xA6 -> PILCROW SIGN\r
+    u'\xdf'     #  0xA7 -> LATIN SMALL LETTER SHARP S\r
+    u'\xae'     #  0xA8 -> REGISTERED SIGN\r
+    u'\xa9'     #  0xA9 -> COPYRIGHT SIGN\r
+    u'\u2122'   #  0xAA -> TRADE MARK SIGN\r
+    u'\xb4'     #  0xAB -> ACUTE ACCENT\r
+    u'\xa8'     #  0xAC -> DIAERESIS\r
+    u'\u2260'   #  0xAD -> NOT EQUAL TO\r
+    u'\xc6'     #  0xAE -> LATIN CAPITAL LETTER AE\r
+    u'\xd8'     #  0xAF -> LATIN CAPITAL LETTER O WITH STROKE\r
+    u'\u221e'   #  0xB0 -> INFINITY\r
+    u'\xb1'     #  0xB1 -> PLUS-MINUS SIGN\r
+    u'\u2264'   #  0xB2 -> LESS-THAN OR EQUAL TO\r
+    u'\u2265'   #  0xB3 -> GREATER-THAN OR EQUAL TO\r
+    u'\xa5'     #  0xB4 -> YEN SIGN\r
+    u'\xb5'     #  0xB5 -> MICRO SIGN\r
+    u'\u2202'   #  0xB6 -> PARTIAL DIFFERENTIAL\r
+    u'\u2211'   #  0xB7 -> N-ARY SUMMATION\r
+    u'\u220f'   #  0xB8 -> N-ARY PRODUCT\r
+    u'\u03c0'   #  0xB9 -> GREEK SMALL LETTER PI\r
+    u'\u222b'   #  0xBA -> INTEGRAL\r
+    u'\xaa'     #  0xBB -> FEMININE ORDINAL INDICATOR\r
+    u'\xba'     #  0xBC -> MASCULINE ORDINAL INDICATOR\r
+    u'\u03a9'   #  0xBD -> GREEK CAPITAL LETTER OMEGA\r
+    u'\xe6'     #  0xBE -> LATIN SMALL LETTER AE\r
+    u'\xf8'     #  0xBF -> LATIN SMALL LETTER O WITH STROKE\r
+    u'\xbf'     #  0xC0 -> INVERTED QUESTION MARK\r
+    u'\xa1'     #  0xC1 -> INVERTED EXCLAMATION MARK\r
+    u'\xac'     #  0xC2 -> NOT SIGN\r
+    u'\u221a'   #  0xC3 -> SQUARE ROOT\r
+    u'\u0192'   #  0xC4 -> LATIN SMALL LETTER F WITH HOOK\r
+    u'\u2248'   #  0xC5 -> ALMOST EQUAL TO\r
+    u'\u2206'   #  0xC6 -> INCREMENT\r
+    u'\xab'     #  0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\xbb'     #  0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\r
+    u'\u2026'   #  0xC9 -> HORIZONTAL ELLIPSIS\r
+    u'\xa0'     #  0xCA -> NO-BREAK SPACE\r
+    u'\xc0'     #  0xCB -> LATIN CAPITAL LETTER A WITH GRAVE\r
+    u'\xc3'     #  0xCC -> LATIN CAPITAL LETTER A WITH TILDE\r
+    u'\xd5'     #  0xCD -> LATIN CAPITAL LETTER O WITH TILDE\r
+    u'\u0152'   #  0xCE -> LATIN CAPITAL LIGATURE OE\r
+    u'\u0153'   #  0xCF -> LATIN SMALL LIGATURE OE\r
+    u'\u2013'   #  0xD0 -> EN DASH\r
+    u'\u2014'   #  0xD1 -> EM DASH\r
+    u'\u201c'   #  0xD2 -> LEFT DOUBLE QUOTATION MARK\r
+    u'\u201d'   #  0xD3 -> RIGHT DOUBLE QUOTATION MARK\r
+    u'\u2018'   #  0xD4 -> LEFT SINGLE QUOTATION MARK\r
+    u'\u2019'   #  0xD5 -> RIGHT SINGLE QUOTATION MARK\r
+    u'\xf7'     #  0xD6 -> DIVISION SIGN\r
+    u'\u25ca'   #  0xD7 -> LOZENGE\r
+    u'\xff'     #  0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS\r
+    u'\u0178'   #  0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+    u'\u011e'   #  0xDA -> LATIN CAPITAL LETTER G WITH BREVE\r
+    u'\u011f'   #  0xDB -> LATIN SMALL LETTER G WITH BREVE\r
+    u'\u0130'   #  0xDC -> LATIN CAPITAL LETTER I WITH DOT ABOVE\r
+    u'\u0131'   #  0xDD -> LATIN SMALL LETTER DOTLESS I\r
+    u'\u015e'   #  0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA\r
+    u'\u015f'   #  0xDF -> LATIN SMALL LETTER S WITH CEDILLA\r
+    u'\u2021'   #  0xE0 -> DOUBLE DAGGER\r
+    u'\xb7'     #  0xE1 -> MIDDLE DOT\r
+    u'\u201a'   #  0xE2 -> SINGLE LOW-9 QUOTATION MARK\r
+    u'\u201e'   #  0xE3 -> DOUBLE LOW-9 QUOTATION MARK\r
+    u'\u2030'   #  0xE4 -> PER MILLE SIGN\r
+    u'\xc2'     #  0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX\r
+    u'\xca'     #  0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX\r
+    u'\xc1'     #  0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE\r
+    u'\xcb'     #  0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS\r
+    u'\xc8'     #  0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE\r
+    u'\xcd'     #  0xEA -> LATIN CAPITAL LETTER I WITH ACUTE\r
+    u'\xce'     #  0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX\r
+    u'\xcf'     #  0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS\r
+    u'\xcc'     #  0xED -> LATIN CAPITAL LETTER I WITH GRAVE\r
+    u'\xd3'     #  0xEE -> LATIN CAPITAL LETTER O WITH ACUTE\r
+    u'\xd4'     #  0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX\r
+    u'\uf8ff'   #  0xF0 -> Apple logo\r
+    u'\xd2'     #  0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE\r
+    u'\xda'     #  0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE\r
+    u'\xdb'     #  0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX\r
+    u'\xd9'     #  0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE\r
+    u'\uf8a0'   #  0xF5 -> undefined1\r
+    u'\u02c6'   #  0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT\r
+    u'\u02dc'   #  0xF7 -> SMALL TILDE\r
+    u'\xaf'     #  0xF8 -> MACRON\r
+    u'\u02d8'   #  0xF9 -> BREVE\r
+    u'\u02d9'   #  0xFA -> DOT ABOVE\r
+    u'\u02da'   #  0xFB -> RING ABOVE\r
+    u'\xb8'     #  0xFC -> CEDILLA\r
+    u'\u02dd'   #  0xFD -> DOUBLE ACUTE ACCENT\r
+    u'\u02db'   #  0xFE -> OGONEK\r
+    u'\u02c7'   #  0xFF -> CARON\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mbcs.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mbcs.py
new file mode 100644 (file)
index 0000000..d6b17b5
--- /dev/null
@@ -0,0 +1,47 @@
+""" Python 'mbcs' Codec for Windows\r
+\r
+\r
+Cloned by Mark Hammond (mhammond@skippinet.com.au) from ascii.py,\r
+which was written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+# Import them explicitly to cause an ImportError\r
+# on non-Windows systems\r
+from codecs import mbcs_encode, mbcs_decode\r
+# for IncrementalDecoder, IncrementalEncoder, ...\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+encode = mbcs_encode\r
+\r
+def decode(input, errors='strict'):\r
+    return mbcs_decode(input, errors, True)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return mbcs_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    _buffer_decode = mbcs_decode\r
+\r
+class StreamWriter(codecs.StreamWriter):\r
+    encode = mbcs_encode\r
+\r
+class StreamReader(codecs.StreamReader):\r
+    decode = mbcs_decode\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='mbcs',\r
+        encode=encode,\r
+        decode=decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/palmos.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/palmos.py
new file mode 100644 (file)
index 0000000..4fc4b72
--- /dev/null
@@ -0,0 +1,83 @@
+""" Python Character Mapping Codec for PalmOS 3.5.\r
+\r
+Written by Sjoerd Mullender (sjoerd@acm.org); based on iso8859_15.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_map)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_map)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='palmos',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+\r
+# The PalmOS character set is mostly iso-8859-1 with some differences.\r
+decoding_map.update({\r
+        0x0080: 0x20ac, #       EURO SIGN\r
+        0x0082: 0x201a, #       SINGLE LOW-9 QUOTATION MARK\r
+        0x0083: 0x0192, #       LATIN SMALL LETTER F WITH HOOK\r
+        0x0084: 0x201e, #       DOUBLE LOW-9 QUOTATION MARK\r
+        0x0085: 0x2026, #       HORIZONTAL ELLIPSIS\r
+        0x0086: 0x2020, #       DAGGER\r
+        0x0087: 0x2021, #       DOUBLE DAGGER\r
+        0x0088: 0x02c6, #       MODIFIER LETTER CIRCUMFLEX ACCENT\r
+        0x0089: 0x2030, #       PER MILLE SIGN\r
+        0x008a: 0x0160, #       LATIN CAPITAL LETTER S WITH CARON\r
+        0x008b: 0x2039, #       SINGLE LEFT-POINTING ANGLE QUOTATION MARK\r
+        0x008c: 0x0152, #       LATIN CAPITAL LIGATURE OE\r
+        0x008d: 0x2666, #       BLACK DIAMOND SUIT\r
+        0x008e: 0x2663, #       BLACK CLUB SUIT\r
+        0x008f: 0x2665, #       BLACK HEART SUIT\r
+        0x0090: 0x2660, #       BLACK SPADE SUIT\r
+        0x0091: 0x2018, #       LEFT SINGLE QUOTATION MARK\r
+        0x0092: 0x2019, #       RIGHT SINGLE QUOTATION MARK\r
+        0x0093: 0x201c, #       LEFT DOUBLE QUOTATION MARK\r
+        0x0094: 0x201d, #       RIGHT DOUBLE QUOTATION MARK\r
+        0x0095: 0x2022, #       BULLET\r
+        0x0096: 0x2013, #       EN DASH\r
+        0x0097: 0x2014, #       EM DASH\r
+        0x0098: 0x02dc, #       SMALL TILDE\r
+        0x0099: 0x2122, #       TRADE MARK SIGN\r
+        0x009a: 0x0161, #       LATIN SMALL LETTER S WITH CARON\r
+        0x009c: 0x0153, #       LATIN SMALL LIGATURE OE\r
+        0x009f: 0x0178, #       LATIN CAPITAL LETTER Y WITH DIAERESIS\r
+})\r
+\r
+### Encoding Map\r
+\r
+encoding_map = codecs.make_encoding_map(decoding_map)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ptcp154.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ptcp154.py
new file mode 100644 (file)
index 0000000..f197da5
--- /dev/null
@@ -0,0 +1,175 @@
+""" Python Character Mapping Codec generated from 'PTCP154.txt' with gencodec.py.\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+(c) Copyright 2000 Guido van Rossum.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_map)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_map)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='ptcp154',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+        0x0080: 0x0496, #        CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER\r
+        0x0081: 0x0492, #        CYRILLIC CAPITAL LETTER GHE WITH STROKE\r
+        0x0082: 0x04ee, #        CYRILLIC CAPITAL LETTER U WITH MACRON\r
+        0x0083: 0x0493, #        CYRILLIC SMALL LETTER GHE WITH STROKE\r
+        0x0084: 0x201e, #        DOUBLE LOW-9 QUOTATION MARK\r
+        0x0085: 0x2026, #        HORIZONTAL ELLIPSIS\r
+        0x0086: 0x04b6, #        CYRILLIC CAPITAL LETTER CHE WITH DESCENDER\r
+        0x0087: 0x04ae, #        CYRILLIC CAPITAL LETTER STRAIGHT U\r
+        0x0088: 0x04b2, #        CYRILLIC CAPITAL LETTER HA WITH DESCENDER\r
+        0x0089: 0x04af, #        CYRILLIC SMALL LETTER STRAIGHT U\r
+        0x008a: 0x04a0, #        CYRILLIC CAPITAL LETTER BASHKIR KA\r
+        0x008b: 0x04e2, #        CYRILLIC CAPITAL LETTER I WITH MACRON\r
+        0x008c: 0x04a2, #        CYRILLIC CAPITAL LETTER EN WITH DESCENDER\r
+        0x008d: 0x049a, #        CYRILLIC CAPITAL LETTER KA WITH DESCENDER\r
+        0x008e: 0x04ba, #        CYRILLIC CAPITAL LETTER SHHA\r
+        0x008f: 0x04b8, #        CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE\r
+        0x0090: 0x0497, #        CYRILLIC SMALL LETTER ZHE WITH DESCENDER\r
+        0x0091: 0x2018, #        LEFT SINGLE QUOTATION MARK\r
+        0x0092: 0x2019, #        RIGHT SINGLE QUOTATION MARK\r
+        0x0093: 0x201c, #        LEFT DOUBLE QUOTATION MARK\r
+        0x0094: 0x201d, #        RIGHT DOUBLE QUOTATION MARK\r
+        0x0095: 0x2022, #        BULLET\r
+        0x0096: 0x2013, #        EN DASH\r
+        0x0097: 0x2014, #        EM DASH\r
+        0x0098: 0x04b3, #        CYRILLIC SMALL LETTER HA WITH DESCENDER\r
+        0x0099: 0x04b7, #        CYRILLIC SMALL LETTER CHE WITH DESCENDER\r
+        0x009a: 0x04a1, #        CYRILLIC SMALL LETTER BASHKIR KA\r
+        0x009b: 0x04e3, #        CYRILLIC SMALL LETTER I WITH MACRON\r
+        0x009c: 0x04a3, #        CYRILLIC SMALL LETTER EN WITH DESCENDER\r
+        0x009d: 0x049b, #        CYRILLIC SMALL LETTER KA WITH DESCENDER\r
+        0x009e: 0x04bb, #        CYRILLIC SMALL LETTER SHHA\r
+        0x009f: 0x04b9, #        CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE\r
+        0x00a1: 0x040e, #        CYRILLIC CAPITAL LETTER SHORT U (Byelorussian)\r
+        0x00a2: 0x045e, #        CYRILLIC SMALL LETTER SHORT U (Byelorussian)\r
+        0x00a3: 0x0408, #        CYRILLIC CAPITAL LETTER JE\r
+        0x00a4: 0x04e8, #        CYRILLIC CAPITAL LETTER BARRED O\r
+        0x00a5: 0x0498, #        CYRILLIC CAPITAL LETTER ZE WITH DESCENDER\r
+        0x00a6: 0x04b0, #        CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE\r
+        0x00a8: 0x0401, #        CYRILLIC CAPITAL LETTER IO\r
+        0x00aa: 0x04d8, #        CYRILLIC CAPITAL LETTER SCHWA\r
+        0x00ad: 0x04ef, #        CYRILLIC SMALL LETTER U WITH MACRON\r
+        0x00af: 0x049c, #        CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE\r
+        0x00b1: 0x04b1, #        CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE\r
+        0x00b2: 0x0406, #        CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I\r
+        0x00b3: 0x0456, #        CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I\r
+        0x00b4: 0x0499, #        CYRILLIC SMALL LETTER ZE WITH DESCENDER\r
+        0x00b5: 0x04e9, #        CYRILLIC SMALL LETTER BARRED O\r
+        0x00b8: 0x0451, #        CYRILLIC SMALL LETTER IO\r
+        0x00b9: 0x2116, #        NUMERO SIGN\r
+        0x00ba: 0x04d9, #        CYRILLIC SMALL LETTER SCHWA\r
+        0x00bc: 0x0458, #        CYRILLIC SMALL LETTER JE\r
+        0x00bd: 0x04aa, #        CYRILLIC CAPITAL LETTER ES WITH DESCENDER\r
+        0x00be: 0x04ab, #        CYRILLIC SMALL LETTER ES WITH DESCENDER\r
+        0x00bf: 0x049d, #        CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE\r
+        0x00c0: 0x0410, #        CYRILLIC CAPITAL LETTER A\r
+        0x00c1: 0x0411, #        CYRILLIC CAPITAL LETTER BE\r
+        0x00c2: 0x0412, #        CYRILLIC CAPITAL LETTER VE\r
+        0x00c3: 0x0413, #        CYRILLIC CAPITAL LETTER GHE\r
+        0x00c4: 0x0414, #        CYRILLIC CAPITAL LETTER DE\r
+        0x00c5: 0x0415, #        CYRILLIC CAPITAL LETTER IE\r
+        0x00c6: 0x0416, #        CYRILLIC CAPITAL LETTER ZHE\r
+        0x00c7: 0x0417, #        CYRILLIC CAPITAL LETTER ZE\r
+        0x00c8: 0x0418, #        CYRILLIC CAPITAL LETTER I\r
+        0x00c9: 0x0419, #        CYRILLIC CAPITAL LETTER SHORT I\r
+        0x00ca: 0x041a, #        CYRILLIC CAPITAL LETTER KA\r
+        0x00cb: 0x041b, #        CYRILLIC CAPITAL LETTER EL\r
+        0x00cc: 0x041c, #        CYRILLIC CAPITAL LETTER EM\r
+        0x00cd: 0x041d, #        CYRILLIC CAPITAL LETTER EN\r
+        0x00ce: 0x041e, #        CYRILLIC CAPITAL LETTER O\r
+        0x00cf: 0x041f, #        CYRILLIC CAPITAL LETTER PE\r
+        0x00d0: 0x0420, #        CYRILLIC CAPITAL LETTER ER\r
+        0x00d1: 0x0421, #        CYRILLIC CAPITAL LETTER ES\r
+        0x00d2: 0x0422, #        CYRILLIC CAPITAL LETTER TE\r
+        0x00d3: 0x0423, #        CYRILLIC CAPITAL LETTER U\r
+        0x00d4: 0x0424, #        CYRILLIC CAPITAL LETTER EF\r
+        0x00d5: 0x0425, #        CYRILLIC CAPITAL LETTER HA\r
+        0x00d6: 0x0426, #        CYRILLIC CAPITAL LETTER TSE\r
+        0x00d7: 0x0427, #        CYRILLIC CAPITAL LETTER CHE\r
+        0x00d8: 0x0428, #        CYRILLIC CAPITAL LETTER SHA\r
+        0x00d9: 0x0429, #        CYRILLIC CAPITAL LETTER SHCHA\r
+        0x00da: 0x042a, #        CYRILLIC CAPITAL LETTER HARD SIGN\r
+        0x00db: 0x042b, #        CYRILLIC CAPITAL LETTER YERU\r
+        0x00dc: 0x042c, #        CYRILLIC CAPITAL LETTER SOFT SIGN\r
+        0x00dd: 0x042d, #        CYRILLIC CAPITAL LETTER E\r
+        0x00de: 0x042e, #        CYRILLIC CAPITAL LETTER YU\r
+        0x00df: 0x042f, #        CYRILLIC CAPITAL LETTER YA\r
+        0x00e0: 0x0430, #        CYRILLIC SMALL LETTER A\r
+        0x00e1: 0x0431, #        CYRILLIC SMALL LETTER BE\r
+        0x00e2: 0x0432, #        CYRILLIC SMALL LETTER VE\r
+        0x00e3: 0x0433, #        CYRILLIC SMALL LETTER GHE\r
+        0x00e4: 0x0434, #        CYRILLIC SMALL LETTER DE\r
+        0x00e5: 0x0435, #        CYRILLIC SMALL LETTER IE\r
+        0x00e6: 0x0436, #        CYRILLIC SMALL LETTER ZHE\r
+        0x00e7: 0x0437, #        CYRILLIC SMALL LETTER ZE\r
+        0x00e8: 0x0438, #        CYRILLIC SMALL LETTER I\r
+        0x00e9: 0x0439, #        CYRILLIC SMALL LETTER SHORT I\r
+        0x00ea: 0x043a, #        CYRILLIC SMALL LETTER KA\r
+        0x00eb: 0x043b, #        CYRILLIC SMALL LETTER EL\r
+        0x00ec: 0x043c, #        CYRILLIC SMALL LETTER EM\r
+        0x00ed: 0x043d, #        CYRILLIC SMALL LETTER EN\r
+        0x00ee: 0x043e, #        CYRILLIC SMALL LETTER O\r
+        0x00ef: 0x043f, #        CYRILLIC SMALL LETTER PE\r
+        0x00f0: 0x0440, #        CYRILLIC SMALL LETTER ER\r
+        0x00f1: 0x0441, #        CYRILLIC SMALL LETTER ES\r
+        0x00f2: 0x0442, #        CYRILLIC SMALL LETTER TE\r
+        0x00f3: 0x0443, #        CYRILLIC SMALL LETTER U\r
+        0x00f4: 0x0444, #        CYRILLIC SMALL LETTER EF\r
+        0x00f5: 0x0445, #        CYRILLIC SMALL LETTER HA\r
+        0x00f6: 0x0446, #        CYRILLIC SMALL LETTER TSE\r
+        0x00f7: 0x0447, #        CYRILLIC SMALL LETTER CHE\r
+        0x00f8: 0x0448, #        CYRILLIC SMALL LETTER SHA\r
+        0x00f9: 0x0449, #        CYRILLIC SMALL LETTER SHCHA\r
+        0x00fa: 0x044a, #        CYRILLIC SMALL LETTER HARD SIGN\r
+        0x00fb: 0x044b, #        CYRILLIC SMALL LETTER YERU\r
+        0x00fc: 0x044c, #        CYRILLIC SMALL LETTER SOFT SIGN\r
+        0x00fd: 0x044d, #        CYRILLIC SMALL LETTER E\r
+        0x00fe: 0x044e, #        CYRILLIC SMALL LETTER YU\r
+        0x00ff: 0x044f, #        CYRILLIC SMALL LETTER YA\r
+})\r
+\r
+### Encoding Map\r
+\r
+encoding_map = codecs.make_encoding_map(decoding_map)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/punycode.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/punycode.py
new file mode 100644 (file)
index 0000000..ad3cc55
--- /dev/null
@@ -0,0 +1,238 @@
+# -*- coding: iso-8859-1 -*-\r
+""" Codec for the Punicode encoding, as specified in RFC 3492\r
+\r
+Written by Martin v. Löwis.\r
+"""\r
+\r
+import codecs\r
+\r
+##################### Encoding #####################################\r
+\r
+def segregate(str):\r
+    """3.1 Basic code point segregation"""\r
+    base = []\r
+    extended = {}\r
+    for c in str:\r
+        if ord(c) < 128:\r
+            base.append(c)\r
+        else:\r
+            extended[c] = 1\r
+    extended = extended.keys()\r
+    extended.sort()\r
+    return "".join(base).encode("ascii"),extended\r
+\r
+def selective_len(str, max):\r
+    """Return the length of str, considering only characters below max."""\r
+    res = 0\r
+    for c in str:\r
+        if ord(c) < max:\r
+            res += 1\r
+    return res\r
+\r
+def selective_find(str, char, index, pos):\r
+    """Return a pair (index, pos), indicating the next occurrence of\r
+    char in str. index is the position of the character considering\r
+    only ordinals up to and including char, and pos is the position in\r
+    the full string. index/pos is the starting position in the full\r
+    string."""\r
+\r
+    l = len(str)\r
+    while 1:\r
+        pos += 1\r
+        if pos == l:\r
+            return (-1, -1)\r
+        c = str[pos]\r
+        if c == char:\r
+            return index+1, pos\r
+        elif c < char:\r
+            index += 1\r
+\r
+def insertion_unsort(str, extended):\r
+    """3.2 Insertion unsort coding"""\r
+    oldchar = 0x80\r
+    result = []\r
+    oldindex = -1\r
+    for c in extended:\r
+        index = pos = -1\r
+        char = ord(c)\r
+        curlen = selective_len(str, char)\r
+        delta = (curlen+1) * (char - oldchar)\r
+        while 1:\r
+            index,pos = selective_find(str,c,index,pos)\r
+            if index == -1:\r
+                break\r
+            delta += index - oldindex\r
+            result.append(delta-1)\r
+            oldindex = index\r
+            delta = 0\r
+        oldchar = char\r
+\r
+    return result\r
+\r
+def T(j, bias):\r
+    # Punycode parameters: tmin = 1, tmax = 26, base = 36\r
+    res = 36 * (j + 1) - bias\r
+    if res < 1: return 1\r
+    if res > 26: return 26\r
+    return res\r
+\r
+digits = "abcdefghijklmnopqrstuvwxyz0123456789"\r
+def generate_generalized_integer(N, bias):\r
+    """3.3 Generalized variable-length integers"""\r
+    result = []\r
+    j = 0\r
+    while 1:\r
+        t = T(j, bias)\r
+        if N < t:\r
+            result.append(digits[N])\r
+            return result\r
+        result.append(digits[t + ((N - t) % (36 - t))])\r
+        N = (N - t) // (36 - t)\r
+        j += 1\r
+\r
+def adapt(delta, first, numchars):\r
+    if first:\r
+        delta //= 700\r
+    else:\r
+        delta //= 2\r
+    delta += delta // numchars\r
+    # ((base - tmin) * tmax) // 2 == 455\r
+    divisions = 0\r
+    while delta > 455:\r
+        delta = delta // 35 # base - tmin\r
+        divisions += 36\r
+    bias = divisions + (36 * delta // (delta + 38))\r
+    return bias\r
+\r
+\r
+def generate_integers(baselen, deltas):\r
+    """3.4 Bias adaptation"""\r
+    # Punycode parameters: initial bias = 72, damp = 700, skew = 38\r
+    result = []\r
+    bias = 72\r
+    for points, delta in enumerate(deltas):\r
+        s = generate_generalized_integer(delta, bias)\r
+        result.extend(s)\r
+        bias = adapt(delta, points==0, baselen+points+1)\r
+    return "".join(result)\r
+\r
+def punycode_encode(text):\r
+    base, extended = segregate(text)\r
+    base = base.encode("ascii")\r
+    deltas = insertion_unsort(text, extended)\r
+    extended = generate_integers(len(base), deltas)\r
+    if base:\r
+        return base + "-" + extended\r
+    return extended\r
+\r
+##################### Decoding #####################################\r
+\r
+def decode_generalized_number(extended, extpos, bias, errors):\r
+    """3.3 Generalized variable-length integers"""\r
+    result = 0\r
+    w = 1\r
+    j = 0\r
+    while 1:\r
+        try:\r
+            char = ord(extended[extpos])\r
+        except IndexError:\r
+            if errors == "strict":\r
+                raise UnicodeError, "incomplete punicode string"\r
+            return extpos + 1, None\r
+        extpos += 1\r
+        if 0x41 <= char <= 0x5A: # A-Z\r
+            digit = char - 0x41\r
+        elif 0x30 <= char <= 0x39:\r
+            digit = char - 22 # 0x30-26\r
+        elif errors == "strict":\r
+            raise UnicodeError("Invalid extended code point '%s'"\r
+                               % extended[extpos])\r
+        else:\r
+            return extpos, None\r
+        t = T(j, bias)\r
+        result += digit * w\r
+        if digit < t:\r
+            return extpos, result\r
+        w = w * (36 - t)\r
+        j += 1\r
+\r
+\r
+def insertion_sort(base, extended, errors):\r
+    """3.2 Insertion unsort coding"""\r
+    char = 0x80\r
+    pos = -1\r
+    bias = 72\r
+    extpos = 0\r
+    while extpos < len(extended):\r
+        newpos, delta = decode_generalized_number(extended, extpos,\r
+                                                  bias, errors)\r
+        if delta is None:\r
+            # There was an error in decoding. We can't continue because\r
+            # synchronization is lost.\r
+            return base\r
+        pos += delta+1\r
+        char += pos // (len(base) + 1)\r
+        if char > 0x10FFFF:\r
+            if errors == "strict":\r
+                raise UnicodeError, ("Invalid character U+%x" % char)\r
+            char = ord('?')\r
+        pos = pos % (len(base) + 1)\r
+        base = base[:pos] + unichr(char) + base[pos:]\r
+        bias = adapt(delta, (extpos == 0), len(base))\r
+        extpos = newpos\r
+    return base\r
+\r
+def punycode_decode(text, errors):\r
+    pos = text.rfind("-")\r
+    if pos == -1:\r
+        base = ""\r
+        extended = text\r
+    else:\r
+        base = text[:pos]\r
+        extended = text[pos+1:]\r
+    base = unicode(base, "ascii", errors)\r
+    extended = extended.upper()\r
+    return insertion_sort(base, extended, errors)\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        res = punycode_encode(input)\r
+        return res, len(input)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        if errors not in ('strict', 'replace', 'ignore'):\r
+            raise UnicodeError, "Unsupported error handling "+errors\r
+        res = punycode_decode(input, errors)\r
+        return res, len(input)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return punycode_encode(input)\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        if self.errors not in ('strict', 'replace', 'ignore'):\r
+            raise UnicodeError, "Unsupported error handling "+self.errors\r
+        return punycode_decode(input, self.errors)\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='punycode',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/quopri_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/quopri_codec.py
new file mode 100644 (file)
index 0000000..663d6a6
--- /dev/null
@@ -0,0 +1,75 @@
+"""Codec for quoted-printable encoding.\r
+\r
+Like base64 and rot13, this returns Python strings, not Unicode.\r
+"""\r
+\r
+import codecs, quopri\r
+try:\r
+    from cStringIO import StringIO\r
+except ImportError:\r
+    from StringIO import StringIO\r
+\r
+def quopri_encode(input, errors='strict'):\r
+    """Encode the input, returning a tuple (output object, length consumed).\r
+\r
+    errors defines the error handling to apply. It defaults to\r
+    'strict' handling which is the only currently supported\r
+    error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    # using str() because of cStringIO's Unicode undesired Unicode behavior.\r
+    f = StringIO(str(input))\r
+    g = StringIO()\r
+    quopri.encode(f, g, 1)\r
+    output = g.getvalue()\r
+    return (output, len(input))\r
+\r
+def quopri_decode(input, errors='strict'):\r
+    """Decode the input, returning a tuple (output object, length consumed).\r
+\r
+    errors defines the error handling to apply. It defaults to\r
+    'strict' handling which is the only currently supported\r
+    error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    f = StringIO(str(input))\r
+    g = StringIO()\r
+    quopri.decode(f, g)\r
+    output = g.getvalue()\r
+    return (output, len(input))\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self, input,errors='strict'):\r
+        return quopri_encode(input,errors)\r
+    def decode(self, input,errors='strict'):\r
+        return quopri_decode(input,errors)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return quopri_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return quopri_decode(input, self.errors)[0]\r
+\r
+class StreamWriter(Codec, codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+# encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='quopri',\r
+        encode=quopri_encode,\r
+        decode=quopri_decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py
new file mode 100644 (file)
index 0000000..cb0abfb
--- /dev/null
@@ -0,0 +1,45 @@
+""" Python 'raw-unicode-escape' Codec\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    # Note: Binding these as C functions will result in the class not\r
+    # converting them to methods. This is intended.\r
+    encode = codecs.raw_unicode_escape_encode\r
+    decode = codecs.raw_unicode_escape_decode\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.raw_unicode_escape_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.raw_unicode_escape_decode(input, self.errors)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='raw-unicode-escape',\r
+        encode=Codec.encode,\r
+        decode=Codec.decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/rot_13.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/rot_13.py
new file mode 100644 (file)
index 0000000..cb25ecb
--- /dev/null
@@ -0,0 +1,118 @@
+#!/usr/bin/env python\r
+""" Python Character Mapping Codec for ROT13.\r
+\r
+    See http://ucsub.colorado.edu/~kominek/rot13/ for details.\r
+\r
+    Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_map)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_map)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_map)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='rot-13',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
+\r
+### Decoding Map\r
+\r
+decoding_map = codecs.make_identity_dict(range(256))\r
+decoding_map.update({\r
+   0x0041: 0x004e,\r
+   0x0042: 0x004f,\r
+   0x0043: 0x0050,\r
+   0x0044: 0x0051,\r
+   0x0045: 0x0052,\r
+   0x0046: 0x0053,\r
+   0x0047: 0x0054,\r
+   0x0048: 0x0055,\r
+   0x0049: 0x0056,\r
+   0x004a: 0x0057,\r
+   0x004b: 0x0058,\r
+   0x004c: 0x0059,\r
+   0x004d: 0x005a,\r
+   0x004e: 0x0041,\r
+   0x004f: 0x0042,\r
+   0x0050: 0x0043,\r
+   0x0051: 0x0044,\r
+   0x0052: 0x0045,\r
+   0x0053: 0x0046,\r
+   0x0054: 0x0047,\r
+   0x0055: 0x0048,\r
+   0x0056: 0x0049,\r
+   0x0057: 0x004a,\r
+   0x0058: 0x004b,\r
+   0x0059: 0x004c,\r
+   0x005a: 0x004d,\r
+   0x0061: 0x006e,\r
+   0x0062: 0x006f,\r
+   0x0063: 0x0070,\r
+   0x0064: 0x0071,\r
+   0x0065: 0x0072,\r
+   0x0066: 0x0073,\r
+   0x0067: 0x0074,\r
+   0x0068: 0x0075,\r
+   0x0069: 0x0076,\r
+   0x006a: 0x0077,\r
+   0x006b: 0x0078,\r
+   0x006c: 0x0079,\r
+   0x006d: 0x007a,\r
+   0x006e: 0x0061,\r
+   0x006f: 0x0062,\r
+   0x0070: 0x0063,\r
+   0x0071: 0x0064,\r
+   0x0072: 0x0065,\r
+   0x0073: 0x0066,\r
+   0x0074: 0x0067,\r
+   0x0075: 0x0068,\r
+   0x0076: 0x0069,\r
+   0x0077: 0x006a,\r
+   0x0078: 0x006b,\r
+   0x0079: 0x006c,\r
+   0x007a: 0x006d,\r
+})\r
+\r
+### Encoding Map\r
+\r
+encoding_map = codecs.make_encoding_map(decoding_map)\r
+\r
+### Filter API\r
+\r
+def rot13(infile, outfile):\r
+    outfile.write(infile.read().encode('rot-13'))\r
+\r
+if __name__ == '__main__':\r
+    import sys\r
+    rot13(sys.stdin, sys.stdout)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis.py
new file mode 100644 (file)
index 0000000..3db9364
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# shift_jis.py: Python Unicode Codec for SHIFT_JIS\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_jp, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_jp.getcodec('shift_jis')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='shift_jis',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis_2004.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis_2004.py
new file mode 100644 (file)
index 0000000..3e48bb7
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# shift_jis_2004.py: Python Unicode Codec for SHIFT_JIS_2004\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_jp, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_jp.getcodec('shift_jis_2004')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='shift_jis_2004',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jisx0213.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jisx0213.py
new file mode 100644 (file)
index 0000000..4092e41
--- /dev/null
@@ -0,0 +1,39 @@
+#\r
+# shift_jisx0213.py: Python Unicode Codec for SHIFT_JISX0213\r
+#\r
+# Written by Hye-Shik Chang <perky@FreeBSD.org>\r
+#\r
+\r
+import _codecs_jp, codecs\r
+import _multibytecodec as mbc\r
+\r
+codec = _codecs_jp.getcodec('shift_jisx0213')\r
+\r
+class Codec(codecs.Codec):\r
+    encode = codec.encode\r
+    decode = codec.decode\r
+\r
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,\r
+                         codecs.IncrementalEncoder):\r
+    codec = codec\r
+\r
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,\r
+                         codecs.IncrementalDecoder):\r
+    codec = codec\r
+\r
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):\r
+    codec = codec\r
+\r
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):\r
+    codec = codec\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='shift_jisx0213',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/string_escape.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/string_escape.py
new file mode 100644 (file)
index 0000000..cb11794
--- /dev/null
@@ -0,0 +1,38 @@
+# -*- coding: iso-8859-1 -*-\r
+""" Python 'escape' Codec\r
+\r
+\r
+Written by Martin v. Löwis (martin@v.loewis.de).\r
+\r
+"""\r
+import codecs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    encode = codecs.escape_encode\r
+    decode = codecs.escape_decode\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.escape_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.escape_decode(input, self.errors)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='string-escape',\r
+        encode=Codec.encode,\r
+        decode=Codec.decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/tis_620.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/tis_620.py
new file mode 100644 (file)
index 0000000..776525e
--- /dev/null
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec tis_620 generated from 'python-mappings/TIS-620.TXT' with gencodec.py.\r
+\r
+"""#"\r
+\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return codecs.charmap_encode(input,errors,encoding_table)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return codecs.charmap_decode(input,errors,decoding_table)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.charmap_encode(input,self.errors,encoding_table)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='tis-620',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
+\r
+\r
+### Decoding Table\r
+\r
+decoding_table = (\r
+    u'\x00'     #  0x00 -> NULL\r
+    u'\x01'     #  0x01 -> START OF HEADING\r
+    u'\x02'     #  0x02 -> START OF TEXT\r
+    u'\x03'     #  0x03 -> END OF TEXT\r
+    u'\x04'     #  0x04 -> END OF TRANSMISSION\r
+    u'\x05'     #  0x05 -> ENQUIRY\r
+    u'\x06'     #  0x06 -> ACKNOWLEDGE\r
+    u'\x07'     #  0x07 -> BELL\r
+    u'\x08'     #  0x08 -> BACKSPACE\r
+    u'\t'       #  0x09 -> HORIZONTAL TABULATION\r
+    u'\n'       #  0x0A -> LINE FEED\r
+    u'\x0b'     #  0x0B -> VERTICAL TABULATION\r
+    u'\x0c'     #  0x0C -> FORM FEED\r
+    u'\r'       #  0x0D -> CARRIAGE RETURN\r
+    u'\x0e'     #  0x0E -> SHIFT OUT\r
+    u'\x0f'     #  0x0F -> SHIFT IN\r
+    u'\x10'     #  0x10 -> DATA LINK ESCAPE\r
+    u'\x11'     #  0x11 -> DEVICE CONTROL ONE\r
+    u'\x12'     #  0x12 -> DEVICE CONTROL TWO\r
+    u'\x13'     #  0x13 -> DEVICE CONTROL THREE\r
+    u'\x14'     #  0x14 -> DEVICE CONTROL FOUR\r
+    u'\x15'     #  0x15 -> NEGATIVE ACKNOWLEDGE\r
+    u'\x16'     #  0x16 -> SYNCHRONOUS IDLE\r
+    u'\x17'     #  0x17 -> END OF TRANSMISSION BLOCK\r
+    u'\x18'     #  0x18 -> CANCEL\r
+    u'\x19'     #  0x19 -> END OF MEDIUM\r
+    u'\x1a'     #  0x1A -> SUBSTITUTE\r
+    u'\x1b'     #  0x1B -> ESCAPE\r
+    u'\x1c'     #  0x1C -> FILE SEPARATOR\r
+    u'\x1d'     #  0x1D -> GROUP SEPARATOR\r
+    u'\x1e'     #  0x1E -> RECORD SEPARATOR\r
+    u'\x1f'     #  0x1F -> UNIT SEPARATOR\r
+    u' '        #  0x20 -> SPACE\r
+    u'!'        #  0x21 -> EXCLAMATION MARK\r
+    u'"'        #  0x22 -> QUOTATION MARK\r
+    u'#'        #  0x23 -> NUMBER SIGN\r
+    u'$'        #  0x24 -> DOLLAR SIGN\r
+    u'%'        #  0x25 -> PERCENT SIGN\r
+    u'&'        #  0x26 -> AMPERSAND\r
+    u"'"        #  0x27 -> APOSTROPHE\r
+    u'('        #  0x28 -> LEFT PARENTHESIS\r
+    u')'        #  0x29 -> RIGHT PARENTHESIS\r
+    u'*'        #  0x2A -> ASTERISK\r
+    u'+'        #  0x2B -> PLUS SIGN\r
+    u','        #  0x2C -> COMMA\r
+    u'-'        #  0x2D -> HYPHEN-MINUS\r
+    u'.'        #  0x2E -> FULL STOP\r
+    u'/'        #  0x2F -> SOLIDUS\r
+    u'0'        #  0x30 -> DIGIT ZERO\r
+    u'1'        #  0x31 -> DIGIT ONE\r
+    u'2'        #  0x32 -> DIGIT TWO\r
+    u'3'        #  0x33 -> DIGIT THREE\r
+    u'4'        #  0x34 -> DIGIT FOUR\r
+    u'5'        #  0x35 -> DIGIT FIVE\r
+    u'6'        #  0x36 -> DIGIT SIX\r
+    u'7'        #  0x37 -> DIGIT SEVEN\r
+    u'8'        #  0x38 -> DIGIT EIGHT\r
+    u'9'        #  0x39 -> DIGIT NINE\r
+    u':'        #  0x3A -> COLON\r
+    u';'        #  0x3B -> SEMICOLON\r
+    u'<'        #  0x3C -> LESS-THAN SIGN\r
+    u'='        #  0x3D -> EQUALS SIGN\r
+    u'>'        #  0x3E -> GREATER-THAN SIGN\r
+    u'?'        #  0x3F -> QUESTION MARK\r
+    u'@'        #  0x40 -> COMMERCIAL AT\r
+    u'A'        #  0x41 -> LATIN CAPITAL LETTER A\r
+    u'B'        #  0x42 -> LATIN CAPITAL LETTER B\r
+    u'C'        #  0x43 -> LATIN CAPITAL LETTER C\r
+    u'D'        #  0x44 -> LATIN CAPITAL LETTER D\r
+    u'E'        #  0x45 -> LATIN CAPITAL LETTER E\r
+    u'F'        #  0x46 -> LATIN CAPITAL LETTER F\r
+    u'G'        #  0x47 -> LATIN CAPITAL LETTER G\r
+    u'H'        #  0x48 -> LATIN CAPITAL LETTER H\r
+    u'I'        #  0x49 -> LATIN CAPITAL LETTER I\r
+    u'J'        #  0x4A -> LATIN CAPITAL LETTER J\r
+    u'K'        #  0x4B -> LATIN CAPITAL LETTER K\r
+    u'L'        #  0x4C -> LATIN CAPITAL LETTER L\r
+    u'M'        #  0x4D -> LATIN CAPITAL LETTER M\r
+    u'N'        #  0x4E -> LATIN CAPITAL LETTER N\r
+    u'O'        #  0x4F -> LATIN CAPITAL LETTER O\r
+    u'P'        #  0x50 -> LATIN CAPITAL LETTER P\r
+    u'Q'        #  0x51 -> LATIN CAPITAL LETTER Q\r
+    u'R'        #  0x52 -> LATIN CAPITAL LETTER R\r
+    u'S'        #  0x53 -> LATIN CAPITAL LETTER S\r
+    u'T'        #  0x54 -> LATIN CAPITAL LETTER T\r
+    u'U'        #  0x55 -> LATIN CAPITAL LETTER U\r
+    u'V'        #  0x56 -> LATIN CAPITAL LETTER V\r
+    u'W'        #  0x57 -> LATIN CAPITAL LETTER W\r
+    u'X'        #  0x58 -> LATIN CAPITAL LETTER X\r
+    u'Y'        #  0x59 -> LATIN CAPITAL LETTER Y\r
+    u'Z'        #  0x5A -> LATIN CAPITAL LETTER Z\r
+    u'['        #  0x5B -> LEFT SQUARE BRACKET\r
+    u'\\'       #  0x5C -> REVERSE SOLIDUS\r
+    u']'        #  0x5D -> RIGHT SQUARE BRACKET\r
+    u'^'        #  0x5E -> CIRCUMFLEX ACCENT\r
+    u'_'        #  0x5F -> LOW LINE\r
+    u'`'        #  0x60 -> GRAVE ACCENT\r
+    u'a'        #  0x61 -> LATIN SMALL LETTER A\r
+    u'b'        #  0x62 -> LATIN SMALL LETTER B\r
+    u'c'        #  0x63 -> LATIN SMALL LETTER C\r
+    u'd'        #  0x64 -> LATIN SMALL LETTER D\r
+    u'e'        #  0x65 -> LATIN SMALL LETTER E\r
+    u'f'        #  0x66 -> LATIN SMALL LETTER F\r
+    u'g'        #  0x67 -> LATIN SMALL LETTER G\r
+    u'h'        #  0x68 -> LATIN SMALL LETTER H\r
+    u'i'        #  0x69 -> LATIN SMALL LETTER I\r
+    u'j'        #  0x6A -> LATIN SMALL LETTER J\r
+    u'k'        #  0x6B -> LATIN SMALL LETTER K\r
+    u'l'        #  0x6C -> LATIN SMALL LETTER L\r
+    u'm'        #  0x6D -> LATIN SMALL LETTER M\r
+    u'n'        #  0x6E -> LATIN SMALL LETTER N\r
+    u'o'        #  0x6F -> LATIN SMALL LETTER O\r
+    u'p'        #  0x70 -> LATIN SMALL LETTER P\r
+    u'q'        #  0x71 -> LATIN SMALL LETTER Q\r
+    u'r'        #  0x72 -> LATIN SMALL LETTER R\r
+    u's'        #  0x73 -> LATIN SMALL LETTER S\r
+    u't'        #  0x74 -> LATIN SMALL LETTER T\r
+    u'u'        #  0x75 -> LATIN SMALL LETTER U\r
+    u'v'        #  0x76 -> LATIN SMALL LETTER V\r
+    u'w'        #  0x77 -> LATIN SMALL LETTER W\r
+    u'x'        #  0x78 -> LATIN SMALL LETTER X\r
+    u'y'        #  0x79 -> LATIN SMALL LETTER Y\r
+    u'z'        #  0x7A -> LATIN SMALL LETTER Z\r
+    u'{'        #  0x7B -> LEFT CURLY BRACKET\r
+    u'|'        #  0x7C -> VERTICAL LINE\r
+    u'}'        #  0x7D -> RIGHT CURLY BRACKET\r
+    u'~'        #  0x7E -> TILDE\r
+    u'\x7f'     #  0x7F -> DELETE\r
+    u'\x80'     #  0x80 -> <control>\r
+    u'\x81'     #  0x81 -> <control>\r
+    u'\x82'     #  0x82 -> <control>\r
+    u'\x83'     #  0x83 -> <control>\r
+    u'\x84'     #  0x84 -> <control>\r
+    u'\x85'     #  0x85 -> <control>\r
+    u'\x86'     #  0x86 -> <control>\r
+    u'\x87'     #  0x87 -> <control>\r
+    u'\x88'     #  0x88 -> <control>\r
+    u'\x89'     #  0x89 -> <control>\r
+    u'\x8a'     #  0x8A -> <control>\r
+    u'\x8b'     #  0x8B -> <control>\r
+    u'\x8c'     #  0x8C -> <control>\r
+    u'\x8d'     #  0x8D -> <control>\r
+    u'\x8e'     #  0x8E -> <control>\r
+    u'\x8f'     #  0x8F -> <control>\r
+    u'\x90'     #  0x90 -> <control>\r
+    u'\x91'     #  0x91 -> <control>\r
+    u'\x92'     #  0x92 -> <control>\r
+    u'\x93'     #  0x93 -> <control>\r
+    u'\x94'     #  0x94 -> <control>\r
+    u'\x95'     #  0x95 -> <control>\r
+    u'\x96'     #  0x96 -> <control>\r
+    u'\x97'     #  0x97 -> <control>\r
+    u'\x98'     #  0x98 -> <control>\r
+    u'\x99'     #  0x99 -> <control>\r
+    u'\x9a'     #  0x9A -> <control>\r
+    u'\x9b'     #  0x9B -> <control>\r
+    u'\x9c'     #  0x9C -> <control>\r
+    u'\x9d'     #  0x9D -> <control>\r
+    u'\x9e'     #  0x9E -> <control>\r
+    u'\x9f'     #  0x9F -> <control>\r
+    u'\ufffe'\r
+    u'\u0e01'   #  0xA1 -> THAI CHARACTER KO KAI\r
+    u'\u0e02'   #  0xA2 -> THAI CHARACTER KHO KHAI\r
+    u'\u0e03'   #  0xA3 -> THAI CHARACTER KHO KHUAT\r
+    u'\u0e04'   #  0xA4 -> THAI CHARACTER KHO KHWAI\r
+    u'\u0e05'   #  0xA5 -> THAI CHARACTER KHO KHON\r
+    u'\u0e06'   #  0xA6 -> THAI CHARACTER KHO RAKHANG\r
+    u'\u0e07'   #  0xA7 -> THAI CHARACTER NGO NGU\r
+    u'\u0e08'   #  0xA8 -> THAI CHARACTER CHO CHAN\r
+    u'\u0e09'   #  0xA9 -> THAI CHARACTER CHO CHING\r
+    u'\u0e0a'   #  0xAA -> THAI CHARACTER CHO CHANG\r
+    u'\u0e0b'   #  0xAB -> THAI CHARACTER SO SO\r
+    u'\u0e0c'   #  0xAC -> THAI CHARACTER CHO CHOE\r
+    u'\u0e0d'   #  0xAD -> THAI CHARACTER YO YING\r
+    u'\u0e0e'   #  0xAE -> THAI CHARACTER DO CHADA\r
+    u'\u0e0f'   #  0xAF -> THAI CHARACTER TO PATAK\r
+    u'\u0e10'   #  0xB0 -> THAI CHARACTER THO THAN\r
+    u'\u0e11'   #  0xB1 -> THAI CHARACTER THO NANGMONTHO\r
+    u'\u0e12'   #  0xB2 -> THAI CHARACTER THO PHUTHAO\r
+    u'\u0e13'   #  0xB3 -> THAI CHARACTER NO NEN\r
+    u'\u0e14'   #  0xB4 -> THAI CHARACTER DO DEK\r
+    u'\u0e15'   #  0xB5 -> THAI CHARACTER TO TAO\r
+    u'\u0e16'   #  0xB6 -> THAI CHARACTER THO THUNG\r
+    u'\u0e17'   #  0xB7 -> THAI CHARACTER THO THAHAN\r
+    u'\u0e18'   #  0xB8 -> THAI CHARACTER THO THONG\r
+    u'\u0e19'   #  0xB9 -> THAI CHARACTER NO NU\r
+    u'\u0e1a'   #  0xBA -> THAI CHARACTER BO BAIMAI\r
+    u'\u0e1b'   #  0xBB -> THAI CHARACTER PO PLA\r
+    u'\u0e1c'   #  0xBC -> THAI CHARACTER PHO PHUNG\r
+    u'\u0e1d'   #  0xBD -> THAI CHARACTER FO FA\r
+    u'\u0e1e'   #  0xBE -> THAI CHARACTER PHO PHAN\r
+    u'\u0e1f'   #  0xBF -> THAI CHARACTER FO FAN\r
+    u'\u0e20'   #  0xC0 -> THAI CHARACTER PHO SAMPHAO\r
+    u'\u0e21'   #  0xC1 -> THAI CHARACTER MO MA\r
+    u'\u0e22'   #  0xC2 -> THAI CHARACTER YO YAK\r
+    u'\u0e23'   #  0xC3 -> THAI CHARACTER RO RUA\r
+    u'\u0e24'   #  0xC4 -> THAI CHARACTER RU\r
+    u'\u0e25'   #  0xC5 -> THAI CHARACTER LO LING\r
+    u'\u0e26'   #  0xC6 -> THAI CHARACTER LU\r
+    u'\u0e27'   #  0xC7 -> THAI CHARACTER WO WAEN\r
+    u'\u0e28'   #  0xC8 -> THAI CHARACTER SO SALA\r
+    u'\u0e29'   #  0xC9 -> THAI CHARACTER SO RUSI\r
+    u'\u0e2a'   #  0xCA -> THAI CHARACTER SO SUA\r
+    u'\u0e2b'   #  0xCB -> THAI CHARACTER HO HIP\r
+    u'\u0e2c'   #  0xCC -> THAI CHARACTER LO CHULA\r
+    u'\u0e2d'   #  0xCD -> THAI CHARACTER O ANG\r
+    u'\u0e2e'   #  0xCE -> THAI CHARACTER HO NOKHUK\r
+    u'\u0e2f'   #  0xCF -> THAI CHARACTER PAIYANNOI\r
+    u'\u0e30'   #  0xD0 -> THAI CHARACTER SARA A\r
+    u'\u0e31'   #  0xD1 -> THAI CHARACTER MAI HAN-AKAT\r
+    u'\u0e32'   #  0xD2 -> THAI CHARACTER SARA AA\r
+    u'\u0e33'   #  0xD3 -> THAI CHARACTER SARA AM\r
+    u'\u0e34'   #  0xD4 -> THAI CHARACTER SARA I\r
+    u'\u0e35'   #  0xD5 -> THAI CHARACTER SARA II\r
+    u'\u0e36'   #  0xD6 -> THAI CHARACTER SARA UE\r
+    u'\u0e37'   #  0xD7 -> THAI CHARACTER SARA UEE\r
+    u'\u0e38'   #  0xD8 -> THAI CHARACTER SARA U\r
+    u'\u0e39'   #  0xD9 -> THAI CHARACTER SARA UU\r
+    u'\u0e3a'   #  0xDA -> THAI CHARACTER PHINTHU\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\u0e3f'   #  0xDF -> THAI CURRENCY SYMBOL BAHT\r
+    u'\u0e40'   #  0xE0 -> THAI CHARACTER SARA E\r
+    u'\u0e41'   #  0xE1 -> THAI CHARACTER SARA AE\r
+    u'\u0e42'   #  0xE2 -> THAI CHARACTER SARA O\r
+    u'\u0e43'   #  0xE3 -> THAI CHARACTER SARA AI MAIMUAN\r
+    u'\u0e44'   #  0xE4 -> THAI CHARACTER SARA AI MAIMALAI\r
+    u'\u0e45'   #  0xE5 -> THAI CHARACTER LAKKHANGYAO\r
+    u'\u0e46'   #  0xE6 -> THAI CHARACTER MAIYAMOK\r
+    u'\u0e47'   #  0xE7 -> THAI CHARACTER MAITAIKHU\r
+    u'\u0e48'   #  0xE8 -> THAI CHARACTER MAI EK\r
+    u'\u0e49'   #  0xE9 -> THAI CHARACTER MAI THO\r
+    u'\u0e4a'   #  0xEA -> THAI CHARACTER MAI TRI\r
+    u'\u0e4b'   #  0xEB -> THAI CHARACTER MAI CHATTAWA\r
+    u'\u0e4c'   #  0xEC -> THAI CHARACTER THANTHAKHAT\r
+    u'\u0e4d'   #  0xED -> THAI CHARACTER NIKHAHIT\r
+    u'\u0e4e'   #  0xEE -> THAI CHARACTER YAMAKKAN\r
+    u'\u0e4f'   #  0xEF -> THAI CHARACTER FONGMAN\r
+    u'\u0e50'   #  0xF0 -> THAI DIGIT ZERO\r
+    u'\u0e51'   #  0xF1 -> THAI DIGIT ONE\r
+    u'\u0e52'   #  0xF2 -> THAI DIGIT TWO\r
+    u'\u0e53'   #  0xF3 -> THAI DIGIT THREE\r
+    u'\u0e54'   #  0xF4 -> THAI DIGIT FOUR\r
+    u'\u0e55'   #  0xF5 -> THAI DIGIT FIVE\r
+    u'\u0e56'   #  0xF6 -> THAI DIGIT SIX\r
+    u'\u0e57'   #  0xF7 -> THAI DIGIT SEVEN\r
+    u'\u0e58'   #  0xF8 -> THAI DIGIT EIGHT\r
+    u'\u0e59'   #  0xF9 -> THAI DIGIT NINE\r
+    u'\u0e5a'   #  0xFA -> THAI CHARACTER ANGKHANKHU\r
+    u'\u0e5b'   #  0xFB -> THAI CHARACTER KHOMUT\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+    u'\ufffe'\r
+)\r
+\r
+### Encoding table\r
+encoding_table=codecs.charmap_build(decoding_table)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py
new file mode 100644 (file)
index 0000000..a077fd6
--- /dev/null
@@ -0,0 +1,49 @@
+""" Python 'undefined' Codec\r
+\r
+    This codec will always raise a ValueError exception when being\r
+    used. It is intended for use by the site.py file to switch off\r
+    automatic string to Unicode coercion.\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        raise UnicodeError("undefined encoding")\r
+\r
+    def decode(self,input,errors='strict'):\r
+        raise UnicodeError("undefined encoding")\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        raise UnicodeError("undefined encoding")\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        raise UnicodeError("undefined encoding")\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='undefined',\r
+        encode=Codec().encode,\r
+        decode=Codec().decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_escape.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_escape.py
new file mode 100644 (file)
index 0000000..3b77cda
--- /dev/null
@@ -0,0 +1,45 @@
+""" Python 'unicode-escape' Codec\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    # Note: Binding these as C functions will result in the class not\r
+    # converting them to methods. This is intended.\r
+    encode = codecs.unicode_escape_encode\r
+    decode = codecs.unicode_escape_decode\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.unicode_escape_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.unicode_escape_decode(input, self.errors)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='unicode-escape',\r
+        encode=Codec.encode,\r
+        decode=Codec.decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_internal.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_internal.py
new file mode 100644 (file)
index 0000000..0803e7b
--- /dev/null
@@ -0,0 +1,45 @@
+""" Python 'unicode-internal' Codec\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    # Note: Binding these as C functions will result in the class not\r
+    # converting them to methods. This is intended.\r
+    encode = codecs.unicode_internal_encode\r
+    decode = codecs.unicode_internal_decode\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.unicode_internal_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return codecs.unicode_internal_decode(input, self.errors)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='unicode-internal',\r
+        encode=Codec.encode,\r
+        decode=Codec.decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamwriter=StreamWriter,\r
+        streamreader=StreamReader,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16.py
new file mode 100644 (file)
index 0000000..566bcc7
--- /dev/null
@@ -0,0 +1,126 @@
+""" Python 'utf-16' Codec\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs, sys\r
+\r
+### Codec APIs\r
+\r
+encode = codecs.utf_16_encode\r
+\r
+def decode(input, errors='strict'):\r
+    return codecs.utf_16_decode(input, errors, True)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def __init__(self, errors='strict'):\r
+        codecs.IncrementalEncoder.__init__(self, errors)\r
+        self.encoder = None\r
+\r
+    def encode(self, input, final=False):\r
+        if self.encoder is None:\r
+            result = codecs.utf_16_encode(input, self.errors)[0]\r
+            if sys.byteorder == 'little':\r
+                self.encoder = codecs.utf_16_le_encode\r
+            else:\r
+                self.encoder = codecs.utf_16_be_encode\r
+            return result\r
+        return self.encoder(input, self.errors)[0]\r
+\r
+    def reset(self):\r
+        codecs.IncrementalEncoder.reset(self)\r
+        self.encoder = None\r
+\r
+    def getstate(self):\r
+        # state info we return to the caller:\r
+        # 0: stream is in natural order for this platform\r
+        # 2: endianness hasn't been determined yet\r
+        # (we're never writing in unnatural order)\r
+        return (2 if self.encoder is None else 0)\r
+\r
+    def setstate(self, state):\r
+        if state:\r
+            self.encoder = None\r
+        else:\r
+            if sys.byteorder == 'little':\r
+                self.encoder = codecs.utf_16_le_encode\r
+            else:\r
+                self.encoder = codecs.utf_16_be_encode\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    def __init__(self, errors='strict'):\r
+        codecs.BufferedIncrementalDecoder.__init__(self, errors)\r
+        self.decoder = None\r
+\r
+    def _buffer_decode(self, input, errors, final):\r
+        if self.decoder is None:\r
+            (output, consumed, byteorder) = \\r
+                codecs.utf_16_ex_decode(input, errors, 0, final)\r
+            if byteorder == -1:\r
+                self.decoder = codecs.utf_16_le_decode\r
+            elif byteorder == 1:\r
+                self.decoder = codecs.utf_16_be_decode\r
+            elif consumed >= 2:\r
+                raise UnicodeError("UTF-16 stream does not start with BOM")\r
+            return (output, consumed)\r
+        return self.decoder(input, self.errors, final)\r
+\r
+    def reset(self):\r
+        codecs.BufferedIncrementalDecoder.reset(self)\r
+        self.decoder = None\r
+\r
+class StreamWriter(codecs.StreamWriter):\r
+    def __init__(self, stream, errors='strict'):\r
+        codecs.StreamWriter.__init__(self, stream, errors)\r
+        self.encoder = None\r
+\r
+    def reset(self):\r
+        codecs.StreamWriter.reset(self)\r
+        self.encoder = None\r
+\r
+    def encode(self, input, errors='strict'):\r
+        if self.encoder is None:\r
+            result = codecs.utf_16_encode(input, errors)\r
+            if sys.byteorder == 'little':\r
+                self.encoder = codecs.utf_16_le_encode\r
+            else:\r
+                self.encoder = codecs.utf_16_be_encode\r
+            return result\r
+        else:\r
+            return self.encoder(input, errors)\r
+\r
+class StreamReader(codecs.StreamReader):\r
+\r
+    def reset(self):\r
+        codecs.StreamReader.reset(self)\r
+        try:\r
+            del self.decode\r
+        except AttributeError:\r
+            pass\r
+\r
+    def decode(self, input, errors='strict'):\r
+        (object, consumed, byteorder) = \\r
+            codecs.utf_16_ex_decode(input, errors, 0, False)\r
+        if byteorder == -1:\r
+            self.decode = codecs.utf_16_le_decode\r
+        elif byteorder == 1:\r
+            self.decode = codecs.utf_16_be_decode\r
+        elif consumed>=2:\r
+            raise UnicodeError,"UTF-16 stream does not start with BOM"\r
+        return (object, consumed)\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='utf-16',\r
+        encode=encode,\r
+        decode=decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_be.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_be.py
new file mode 100644 (file)
index 0000000..780c499
--- /dev/null
@@ -0,0 +1,42 @@
+""" Python 'utf-16-be' Codec\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+encode = codecs.utf_16_be_encode\r
+\r
+def decode(input, errors='strict'):\r
+    return codecs.utf_16_be_decode(input, errors, True)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.utf_16_be_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    _buffer_decode = codecs.utf_16_be_decode\r
+\r
+class StreamWriter(codecs.StreamWriter):\r
+    encode = codecs.utf_16_be_encode\r
+\r
+class StreamReader(codecs.StreamReader):\r
+    decode = codecs.utf_16_be_decode\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='utf-16-be',\r
+        encode=encode,\r
+        decode=decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_le.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_le.py
new file mode 100644 (file)
index 0000000..3964124
--- /dev/null
@@ -0,0 +1,42 @@
+""" Python 'utf-16-le' Codec\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+encode = codecs.utf_16_le_encode\r
+\r
+def decode(input, errors='strict'):\r
+    return codecs.utf_16_le_decode(input, errors, True)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.utf_16_le_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    _buffer_decode = codecs.utf_16_le_decode\r
+\r
+class StreamWriter(codecs.StreamWriter):\r
+    encode = codecs.utf_16_le_encode\r
+\r
+class StreamReader(codecs.StreamReader):\r
+    decode = codecs.utf_16_le_decode\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='utf-16-le',\r
+        encode=encode,\r
+        decode=decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32.py
new file mode 100644 (file)
index 0000000..9d836ea
--- /dev/null
@@ -0,0 +1,150 @@
+"""\r
+Python 'utf-32' Codec\r
+"""\r
+import codecs, sys\r
+\r
+### Codec APIs\r
+\r
+encode = codecs.utf_32_encode\r
+\r
+def decode(input, errors='strict'):\r
+    return codecs.utf_32_decode(input, errors, True)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def __init__(self, errors='strict'):\r
+        codecs.IncrementalEncoder.__init__(self, errors)\r
+        self.encoder = None\r
+\r
+    def encode(self, input, final=False):\r
+        if self.encoder is None:\r
+            result = codecs.utf_32_encode(input, self.errors)[0]\r
+            if sys.byteorder == 'little':\r
+                self.encoder = codecs.utf_32_le_encode\r
+            else:\r
+                self.encoder = codecs.utf_32_be_encode\r
+            return result\r
+        return self.encoder(input, self.errors)[0]\r
+\r
+    def reset(self):\r
+        codecs.IncrementalEncoder.reset(self)\r
+        self.encoder = None\r
+\r
+    def getstate(self):\r
+        # state info we return to the caller:\r
+        # 0: stream is in natural order for this platform\r
+        # 2: endianness hasn't been determined yet\r
+        # (we're never writing in unnatural order)\r
+        return (2 if self.encoder is None else 0)\r
+\r
+    def setstate(self, state):\r
+        if state:\r
+            self.encoder = None\r
+        else:\r
+            if sys.byteorder == 'little':\r
+                self.encoder = codecs.utf_32_le_encode\r
+            else:\r
+                self.encoder = codecs.utf_32_be_encode\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    def __init__(self, errors='strict'):\r
+        codecs.BufferedIncrementalDecoder.__init__(self, errors)\r
+        self.decoder = None\r
+\r
+    def _buffer_decode(self, input, errors, final):\r
+        if self.decoder is None:\r
+            (output, consumed, byteorder) = \\r
+                codecs.utf_32_ex_decode(input, errors, 0, final)\r
+            if byteorder == -1:\r
+                self.decoder = codecs.utf_32_le_decode\r
+            elif byteorder == 1:\r
+                self.decoder = codecs.utf_32_be_decode\r
+            elif consumed >= 4:\r
+                raise UnicodeError("UTF-32 stream does not start with BOM")\r
+            return (output, consumed)\r
+        return self.decoder(input, self.errors, final)\r
+\r
+    def reset(self):\r
+        codecs.BufferedIncrementalDecoder.reset(self)\r
+        self.decoder = None\r
+\r
+    def getstate(self):\r
+        # additonal state info from the base class must be None here,\r
+        # as it isn't passed along to the caller\r
+        state = codecs.BufferedIncrementalDecoder.getstate(self)[0]\r
+        # additional state info we pass to the caller:\r
+        # 0: stream is in natural order for this platform\r
+        # 1: stream is in unnatural order\r
+        # 2: endianness hasn't been determined yet\r
+        if self.decoder is None:\r
+            return (state, 2)\r
+        addstate = int((sys.byteorder == "big") !=\r
+                       (self.decoder is codecs.utf_32_be_decode))\r
+        return (state, addstate)\r
+\r
+    def setstate(self, state):\r
+        # state[1] will be ignored by BufferedIncrementalDecoder.setstate()\r
+        codecs.BufferedIncrementalDecoder.setstate(self, state)\r
+        state = state[1]\r
+        if state == 0:\r
+            self.decoder = (codecs.utf_32_be_decode\r
+                            if sys.byteorder == "big"\r
+                            else codecs.utf_32_le_decode)\r
+        elif state == 1:\r
+            self.decoder = (codecs.utf_32_le_decode\r
+                            if sys.byteorder == "big"\r
+                            else codecs.utf_32_be_decode)\r
+        else:\r
+            self.decoder = None\r
+\r
+class StreamWriter(codecs.StreamWriter):\r
+    def __init__(self, stream, errors='strict'):\r
+        self.encoder = None\r
+        codecs.StreamWriter.__init__(self, stream, errors)\r
+\r
+    def reset(self):\r
+        codecs.StreamWriter.reset(self)\r
+        self.encoder = None\r
+\r
+    def encode(self, input, errors='strict'):\r
+        if self.encoder is None:\r
+            result = codecs.utf_32_encode(input, errors)\r
+            if sys.byteorder == 'little':\r
+                self.encoder = codecs.utf_32_le_encode\r
+            else:\r
+                self.encoder = codecs.utf_32_be_encode\r
+            return result\r
+        else:\r
+            return self.encoder(input, errors)\r
+\r
+class StreamReader(codecs.StreamReader):\r
+\r
+    def reset(self):\r
+        codecs.StreamReader.reset(self)\r
+        try:\r
+            del self.decode\r
+        except AttributeError:\r
+            pass\r
+\r
+    def decode(self, input, errors='strict'):\r
+        (object, consumed, byteorder) = \\r
+            codecs.utf_32_ex_decode(input, errors, 0, False)\r
+        if byteorder == -1:\r
+            self.decode = codecs.utf_32_le_decode\r
+        elif byteorder == 1:\r
+            self.decode = codecs.utf_32_be_decode\r
+        elif consumed>=4:\r
+            raise UnicodeError,"UTF-32 stream does not start with BOM"\r
+        return (object, consumed)\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='utf-32',\r
+        encode=encode,\r
+        decode=decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_be.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_be.py
new file mode 100644 (file)
index 0000000..f7c4b87
--- /dev/null
@@ -0,0 +1,37 @@
+"""\r
+Python 'utf-32-be' Codec\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+encode = codecs.utf_32_be_encode\r
+\r
+def decode(input, errors='strict'):\r
+    return codecs.utf_32_be_decode(input, errors, True)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.utf_32_be_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    _buffer_decode = codecs.utf_32_be_decode\r
+\r
+class StreamWriter(codecs.StreamWriter):\r
+    encode = codecs.utf_32_be_encode\r
+\r
+class StreamReader(codecs.StreamReader):\r
+    decode = codecs.utf_32_be_decode\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='utf-32-be',\r
+        encode=encode,\r
+        decode=decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_le.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_le.py
new file mode 100644 (file)
index 0000000..4346a12
--- /dev/null
@@ -0,0 +1,37 @@
+"""\r
+Python 'utf-32-le' Codec\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+encode = codecs.utf_32_le_encode\r
+\r
+def decode(input, errors='strict'):\r
+    return codecs.utf_32_le_decode(input, errors, True)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.utf_32_le_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    _buffer_decode = codecs.utf_32_le_decode\r
+\r
+class StreamWriter(codecs.StreamWriter):\r
+    encode = codecs.utf_32_le_encode\r
+\r
+class StreamReader(codecs.StreamReader):\r
+    decode = codecs.utf_32_le_decode\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='utf-32-le',\r
+        encode=encode,\r
+        decode=decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_7.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_7.py
new file mode 100644 (file)
index 0000000..6c30538
--- /dev/null
@@ -0,0 +1,38 @@
+""" Python 'utf-7' Codec\r
+\r
+Written by Brian Quinlan (brian@sweetapp.com).\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+encode = codecs.utf_7_encode\r
+\r
+def decode(input, errors='strict'):\r
+    return codecs.utf_7_decode(input, errors, True)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.utf_7_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    _buffer_decode = codecs.utf_7_decode\r
+\r
+class StreamWriter(codecs.StreamWriter):\r
+    encode = codecs.utf_7_encode\r
+\r
+class StreamReader(codecs.StreamReader):\r
+    decode = codecs.utf_7_decode\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='utf-7',\r
+        encode=encode,\r
+        decode=decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8.py
new file mode 100644 (file)
index 0000000..cc118ac
--- /dev/null
@@ -0,0 +1,42 @@
+""" Python 'utf-8' Codec\r
+\r
+\r
+Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.\r
+\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+encode = codecs.utf_8_encode\r
+\r
+def decode(input, errors='strict'):\r
+    return codecs.utf_8_decode(input, errors, True)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return codecs.utf_8_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    _buffer_decode = codecs.utf_8_decode\r
+\r
+class StreamWriter(codecs.StreamWriter):\r
+    encode = codecs.utf_8_encode\r
+\r
+class StreamReader(codecs.StreamReader):\r
+    decode = codecs.utf_8_decode\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='utf-8',\r
+        encode=encode,\r
+        decode=decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8_sig.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8_sig.py
new file mode 100644 (file)
index 0000000..8cafef7
--- /dev/null
@@ -0,0 +1,117 @@
+""" Python 'utf-8-sig' Codec\r
+This work similar to UTF-8 with the following changes:\r
+\r
+* On encoding/writing a UTF-8 encoded BOM will be prepended/written as the\r
+  first three bytes.\r
+\r
+* On decoding/reading if the first three bytes are a UTF-8 encoded BOM, these\r
+  bytes will be skipped.\r
+"""\r
+import codecs\r
+\r
+### Codec APIs\r
+\r
+def encode(input, errors='strict'):\r
+    return (codecs.BOM_UTF8 + codecs.utf_8_encode(input, errors)[0], len(input))\r
+\r
+def decode(input, errors='strict'):\r
+    prefix = 0\r
+    if input[:3] == codecs.BOM_UTF8:\r
+        input = input[3:]\r
+        prefix = 3\r
+    (output, consumed) = codecs.utf_8_decode(input, errors, True)\r
+    return (output, consumed+prefix)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def __init__(self, errors='strict'):\r
+        codecs.IncrementalEncoder.__init__(self, errors)\r
+        self.first = 1\r
+\r
+    def encode(self, input, final=False):\r
+        if self.first:\r
+            self.first = 0\r
+            return codecs.BOM_UTF8 + codecs.utf_8_encode(input, self.errors)[0]\r
+        else:\r
+            return codecs.utf_8_encode(input, self.errors)[0]\r
+\r
+    def reset(self):\r
+        codecs.IncrementalEncoder.reset(self)\r
+        self.first = 1\r
+\r
+    def getstate(self):\r
+        return self.first\r
+\r
+    def setstate(self, state):\r
+        self.first = state\r
+\r
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):\r
+    def __init__(self, errors='strict'):\r
+        codecs.BufferedIncrementalDecoder.__init__(self, errors)\r
+        self.first = True\r
+\r
+    def _buffer_decode(self, input, errors, final):\r
+        if self.first:\r
+            if len(input) < 3:\r
+                if codecs.BOM_UTF8.startswith(input):\r
+                    # not enough data to decide if this really is a BOM\r
+                    # => try again on the next call\r
+                    return (u"", 0)\r
+                else:\r
+                    self.first = None\r
+            else:\r
+                self.first = None\r
+                if input[:3] == codecs.BOM_UTF8:\r
+                    (output, consumed) = codecs.utf_8_decode(input[3:], errors, final)\r
+                    return (output, consumed+3)\r
+        return codecs.utf_8_decode(input, errors, final)\r
+\r
+    def reset(self):\r
+        codecs.BufferedIncrementalDecoder.reset(self)\r
+        self.first = True\r
+\r
+class StreamWriter(codecs.StreamWriter):\r
+    def reset(self):\r
+        codecs.StreamWriter.reset(self)\r
+        try:\r
+            del self.encode\r
+        except AttributeError:\r
+            pass\r
+\r
+    def encode(self, input, errors='strict'):\r
+        self.encode = codecs.utf_8_encode\r
+        return encode(input, errors)\r
+\r
+class StreamReader(codecs.StreamReader):\r
+    def reset(self):\r
+        codecs.StreamReader.reset(self)\r
+        try:\r
+            del self.decode\r
+        except AttributeError:\r
+            pass\r
+\r
+    def decode(self, input, errors='strict'):\r
+        if len(input) < 3:\r
+            if codecs.BOM_UTF8.startswith(input):\r
+                # not enough data to decide if this is a BOM\r
+                # => try again on the next call\r
+                return (u"", 0)\r
+        elif input[:3] == codecs.BOM_UTF8:\r
+            self.decode = codecs.utf_8_decode\r
+            (output, consumed) = codecs.utf_8_decode(input[3:],errors)\r
+            return (output, consumed+3)\r
+        # (else) no BOM present\r
+        self.decode = codecs.utf_8_decode\r
+        return codecs.utf_8_decode(input, errors)\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='utf-8-sig',\r
+        encode=encode,\r
+        decode=decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/uu_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/uu_codec.py
new file mode 100644 (file)
index 0000000..71ac65b
--- /dev/null
@@ -0,0 +1,129 @@
+""" Python 'uu_codec' Codec - UU content transfer encoding\r
+\r
+    Unlike most of the other codecs which target Unicode, this codec\r
+    will return Python string objects for both encode and decode.\r
+\r
+    Written by Marc-Andre Lemburg (mal@lemburg.com). Some details were\r
+    adapted from uu.py which was written by Lance Ellinghouse and\r
+    modified by Jack Jansen and Fredrik Lundh.\r
+\r
+"""\r
+import codecs, binascii\r
+\r
+### Codec APIs\r
+\r
+def uu_encode(input,errors='strict',filename='<data>',mode=0666):\r
+\r
+    """ Encodes the object input and returns a tuple (output\r
+        object, length consumed).\r
+\r
+        errors defines the error handling to apply. It defaults to\r
+        'strict' handling which is the only currently supported\r
+        error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    from cStringIO import StringIO\r
+    from binascii import b2a_uu\r
+    # using str() because of cStringIO's Unicode undesired Unicode behavior.\r
+    infile = StringIO(str(input))\r
+    outfile = StringIO()\r
+    read = infile.read\r
+    write = outfile.write\r
+\r
+    # Encode\r
+    write('begin %o %s\n' % (mode & 0777, filename))\r
+    chunk = read(45)\r
+    while chunk:\r
+        write(b2a_uu(chunk))\r
+        chunk = read(45)\r
+    write(' \nend\n')\r
+\r
+    return (outfile.getvalue(), len(input))\r
+\r
+def uu_decode(input,errors='strict'):\r
+\r
+    """ Decodes the object input and returns a tuple (output\r
+        object, length consumed).\r
+\r
+        input must be an object which provides the bf_getreadbuf\r
+        buffer slot. Python strings, buffer objects and memory\r
+        mapped files are examples of objects providing this slot.\r
+\r
+        errors defines the error handling to apply. It defaults to\r
+        'strict' handling which is the only currently supported\r
+        error handling for this codec.\r
+\r
+        Note: filename and file mode information in the input data is\r
+        ignored.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    from cStringIO import StringIO\r
+    from binascii import a2b_uu\r
+    infile = StringIO(str(input))\r
+    outfile = StringIO()\r
+    readline = infile.readline\r
+    write = outfile.write\r
+\r
+    # Find start of encoded data\r
+    while 1:\r
+        s = readline()\r
+        if not s:\r
+            raise ValueError, 'Missing "begin" line in input data'\r
+        if s[:5] == 'begin':\r
+            break\r
+\r
+    # Decode\r
+    while 1:\r
+        s = readline()\r
+        if not s or \\r
+           s == 'end\n':\r
+            break\r
+        try:\r
+            data = a2b_uu(s)\r
+        except binascii.Error, v:\r
+            # Workaround for broken uuencoders by /Fredrik Lundh\r
+            nbytes = (((ord(s[0])-32) & 63) * 4 + 5) // 3\r
+            data = a2b_uu(s[:nbytes])\r
+            #sys.stderr.write("Warning: %s\n" % str(v))\r
+        write(data)\r
+    if not s:\r
+        raise ValueError, 'Truncated input data'\r
+\r
+    return (outfile.getvalue(), len(input))\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self,input,errors='strict'):\r
+        return uu_encode(input,errors)\r
+\r
+    def decode(self,input,errors='strict'):\r
+        return uu_decode(input,errors)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def encode(self, input, final=False):\r
+        return uu_encode(input, self.errors)[0]\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def decode(self, input, final=False):\r
+        return uu_decode(input, self.errors)[0]\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='uu',\r
+        encode=uu_encode,\r
+        decode=uu_decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/zlib_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/zlib_codec.py
new file mode 100644 (file)
index 0000000..82557d0
--- /dev/null
@@ -0,0 +1,102 @@
+""" Python 'zlib_codec' Codec - zlib compression encoding\r
+\r
+    Unlike most of the other codecs which target Unicode, this codec\r
+    will return Python string objects for both encode and decode.\r
+\r
+    Written by Marc-Andre Lemburg (mal@lemburg.com).\r
+\r
+"""\r
+import codecs\r
+import zlib # this codec needs the optional zlib module !\r
+\r
+### Codec APIs\r
+\r
+def zlib_encode(input,errors='strict'):\r
+\r
+    """ Encodes the object input and returns a tuple (output\r
+        object, length consumed).\r
+\r
+        errors defines the error handling to apply. It defaults to\r
+        'strict' handling which is the only currently supported\r
+        error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    output = zlib.compress(input)\r
+    return (output, len(input))\r
+\r
+def zlib_decode(input,errors='strict'):\r
+\r
+    """ Decodes the object input and returns a tuple (output\r
+        object, length consumed).\r
+\r
+        input must be an object which provides the bf_getreadbuf\r
+        buffer slot. Python strings, buffer objects and memory\r
+        mapped files are examples of objects providing this slot.\r
+\r
+        errors defines the error handling to apply. It defaults to\r
+        'strict' handling which is the only currently supported\r
+        error handling for this codec.\r
+\r
+    """\r
+    assert errors == 'strict'\r
+    output = zlib.decompress(input)\r
+    return (output, len(input))\r
+\r
+class Codec(codecs.Codec):\r
+\r
+    def encode(self, input, errors='strict'):\r
+        return zlib_encode(input, errors)\r
+    def decode(self, input, errors='strict'):\r
+        return zlib_decode(input, errors)\r
+\r
+class IncrementalEncoder(codecs.IncrementalEncoder):\r
+    def __init__(self, errors='strict'):\r
+        assert errors == 'strict'\r
+        self.errors = errors\r
+        self.compressobj = zlib.compressobj()\r
+\r
+    def encode(self, input, final=False):\r
+        if final:\r
+            c = self.compressobj.compress(input)\r
+            return c + self.compressobj.flush()\r
+        else:\r
+            return self.compressobj.compress(input)\r
+\r
+    def reset(self):\r
+        self.compressobj = zlib.compressobj()\r
+\r
+class IncrementalDecoder(codecs.IncrementalDecoder):\r
+    def __init__(self, errors='strict'):\r
+        assert errors == 'strict'\r
+        self.errors = errors\r
+        self.decompressobj = zlib.decompressobj()\r
+\r
+    def decode(self, input, final=False):\r
+        if final:\r
+            c = self.decompressobj.decompress(input)\r
+            return c + self.decompressobj.flush()\r
+        else:\r
+            return self.decompressobj.decompress(input)\r
+\r
+    def reset(self):\r
+        self.decompressobj = zlib.decompressobj()\r
+\r
+class StreamWriter(Codec,codecs.StreamWriter):\r
+    pass\r
+\r
+class StreamReader(Codec,codecs.StreamReader):\r
+    pass\r
+\r
+### encodings module API\r
+\r
+def getregentry():\r
+    return codecs.CodecInfo(\r
+        name='zlib',\r
+        encode=zlib_encode,\r
+        decode=zlib_decode,\r
+        incrementalencoder=IncrementalEncoder,\r
+        incrementaldecoder=IncrementalDecoder,\r
+        streamreader=StreamReader,\r
+        streamwriter=StreamWriter,\r
+    )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/fileinput.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/fileinput.py
new file mode 100644 (file)
index 0000000..221c507
--- /dev/null
@@ -0,0 +1,417 @@
+"""Helper class to quickly write a loop over all standard input files.\r
+\r
+Typical use is:\r
+\r
+    import fileinput\r
+    for line in fileinput.input():\r
+        process(line)\r
+\r
+This iterates over the lines of all files listed in sys.argv[1:],\r
+defaulting to sys.stdin if the list is empty.  If a filename is '-' it\r
+is also replaced by sys.stdin.  To specify an alternative list of\r
+filenames, pass it as the argument to input().  A single file name is\r
+also allowed.\r
+\r
+Functions filename(), lineno() return the filename and cumulative line\r
+number of the line that has just been read; filelineno() returns its\r
+line number in the current file; isfirstline() returns true iff the\r
+line just read is the first line of its file; isstdin() returns true\r
+iff the line was read from sys.stdin.  Function nextfile() closes the\r
+current file so that the next iteration will read the first line from\r
+the next file (if any); lines not read from the file will not count\r
+towards the cumulative line count; the filename is not changed until\r
+after the first line of the next file has been read.  Function close()\r
+closes the sequence.\r
+\r
+Before any lines have been read, filename() returns None and both line\r
+numbers are zero; nextfile() has no effect.  After all lines have been\r
+read, filename() and the line number functions return the values\r
+pertaining to the last line read; nextfile() has no effect.\r
+\r
+All files are opened in text mode by default, you can override this by\r
+setting the mode parameter to input() or FileInput.__init__().\r
+If an I/O error occurs during opening or reading a file, the IOError\r
+exception is raised.\r
+\r
+If sys.stdin is used more than once, the second and further use will\r
+return no lines, except perhaps for interactive use, or if it has been\r
+explicitly reset (e.g. using sys.stdin.seek(0)).\r
+\r
+Empty files are opened and immediately closed; the only time their\r
+presence in the list of filenames is noticeable at all is when the\r
+last file opened is empty.\r
+\r
+It is possible that the last line of a file doesn't end in a newline\r
+character; otherwise lines are returned including the trailing\r
+newline.\r
+\r
+Class FileInput is the implementation; its methods filename(),\r
+lineno(), fileline(), isfirstline(), isstdin(), nextfile() and close()\r
+correspond to the functions in the module.  In addition it has a\r
+readline() method which returns the next input line, and a\r
+__getitem__() method which implements the sequence behavior.  The\r
+sequence must be accessed in strictly sequential order; sequence\r
+access and readline() cannot be mixed.\r
+\r
+Optional in-place filtering: if the keyword argument inplace=1 is\r
+passed to input() or to the FileInput constructor, the file is moved\r
+to a backup file and standard output is directed to the input file.\r
+This makes it possible to write a filter that rewrites its input file\r
+in place.  If the keyword argument backup=".<some extension>" is also\r
+given, it specifies the extension for the backup file, and the backup\r
+file remains around; by default, the extension is ".bak" and it is\r
+deleted when the output file is closed.  In-place filtering is\r
+disabled when standard input is read.  XXX The current implementation\r
+does not work for MS-DOS 8+3 filesystems.\r
+\r
+Performance: this module is unfortunately one of the slower ways of\r
+processing large numbers of input lines.  Nevertheless, a significant\r
+speed-up has been obtained by using readlines(bufsize) instead of\r
+readline().  A new keyword argument, bufsize=N, is present on the\r
+input() function and the FileInput() class to override the default\r
+buffer size.\r
+\r
+XXX Possible additions:\r
+\r
+- optional getopt argument processing\r
+- isatty()\r
+- read(), read(size), even readlines()\r
+\r
+"""\r
+\r
+import sys, os\r
+\r
+__all__ = ["input","close","nextfile","filename","lineno","filelineno",\r
+           "isfirstline","isstdin","FileInput"]\r
+\r
+_state = None\r
+\r
+DEFAULT_BUFSIZE = 8*1024\r
+\r
+def input(files=None, inplace=0, backup="", bufsize=0,\r
+          mode="r", openhook=None):\r
+    """Return an instance of the FileInput class, which can be iterated.\r
+\r
+    The parameters are passed to the constructor of the FileInput class.\r
+    The returned instance, in addition to being an iterator,\r
+    keeps global state for the functions of this module,.\r
+    """\r
+    global _state\r
+    if _state and _state._file:\r
+        raise RuntimeError, "input() already active"\r
+    _state = FileInput(files, inplace, backup, bufsize, mode, openhook)\r
+    return _state\r
+\r
+def close():\r
+    """Close the sequence."""\r
+    global _state\r
+    state = _state\r
+    _state = None\r
+    if state:\r
+        state.close()\r
+\r
+def nextfile():\r
+    """\r
+    Close the current file so that the next iteration will read the first\r
+    line from the next file (if any); lines not read from the file will\r
+    not count towards the cumulative line count. The filename is not\r
+    changed until after the first line of the next file has been read.\r
+    Before the first line has been read, this function has no effect;\r
+    it cannot be used to skip the first file. After the last line of the\r
+    last file has been read, this function has no effect.\r
+    """\r
+    if not _state:\r
+        raise RuntimeError, "no active input()"\r
+    return _state.nextfile()\r
+\r
+def filename():\r
+    """\r
+    Return the name of the file currently being read.\r
+    Before the first line has been read, returns None.\r
+    """\r
+    if not _state:\r
+        raise RuntimeError, "no active input()"\r
+    return _state.filename()\r
+\r
+def lineno():\r
+    """\r
+    Return the cumulative line number of the line that has just been read.\r
+    Before the first line has been read, returns 0. After the last line\r
+    of the last file has been read, returns the line number of that line.\r
+    """\r
+    if not _state:\r
+        raise RuntimeError, "no active input()"\r
+    return _state.lineno()\r
+\r
+def filelineno():\r
+    """\r
+    Return the line number in the current file. Before the first line\r
+    has been read, returns 0. After the last line of the last file has\r
+    been read, returns the line number of that line within the file.\r
+    """\r
+    if not _state:\r
+        raise RuntimeError, "no active input()"\r
+    return _state.filelineno()\r
+\r
+def fileno():\r
+    """\r
+    Return the file number of the current file. When no file is currently\r
+    opened, returns -1.\r
+    """\r
+    if not _state:\r
+        raise RuntimeError, "no active input()"\r
+    return _state.fileno()\r
+\r
+def isfirstline():\r
+    """\r
+    Returns true the line just read is the first line of its file,\r
+    otherwise returns false.\r
+    """\r
+    if not _state:\r
+        raise RuntimeError, "no active input()"\r
+    return _state.isfirstline()\r
+\r
+def isstdin():\r
+    """\r
+    Returns true if the last line was read from sys.stdin,\r
+    otherwise returns false.\r
+    """\r
+    if not _state:\r
+        raise RuntimeError, "no active input()"\r
+    return _state.isstdin()\r
+\r
+class FileInput:\r
+    """FileInput([files[, inplace[, backup[, bufsize[, mode[, openhook]]]]]])\r
+\r
+    Class FileInput is the implementation of the module; its methods\r
+    filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(),\r
+    nextfile() and close() correspond to the functions of the same name\r
+    in the module.\r
+    In addition it has a readline() method which returns the next\r
+    input line, and a __getitem__() method which implements the\r
+    sequence behavior. The sequence must be accessed in strictly\r
+    sequential order; random access and readline() cannot be mixed.\r
+    """\r
+\r
+    def __init__(self, files=None, inplace=0, backup="", bufsize=0,\r
+                 mode="r", openhook=None):\r
+        if isinstance(files, basestring):\r
+            files = (files,)\r
+        else:\r
+            if files is None:\r
+                files = sys.argv[1:]\r
+            if not files:\r
+                files = ('-',)\r
+            else:\r
+                files = tuple(files)\r
+        self._files = files\r
+        self._inplace = inplace\r
+        self._backup = backup\r
+        self._bufsize = bufsize or DEFAULT_BUFSIZE\r
+        self._savestdout = None\r
+        self._output = None\r
+        self._filename = None\r
+        self._lineno = 0\r
+        self._filelineno = 0\r
+        self._file = None\r
+        self._isstdin = False\r
+        self._backupfilename = None\r
+        self._buffer = []\r
+        self._bufindex = 0\r
+        # restrict mode argument to reading modes\r
+        if mode not in ('r', 'rU', 'U', 'rb'):\r
+            raise ValueError("FileInput opening mode must be one of "\r
+                             "'r', 'rU', 'U' and 'rb'")\r
+        self._mode = mode\r
+        if inplace and openhook:\r
+            raise ValueError("FileInput cannot use an opening hook in inplace mode")\r
+        elif openhook and not hasattr(openhook, '__call__'):\r
+            raise ValueError("FileInput openhook must be callable")\r
+        self._openhook = openhook\r
+\r
+    def __del__(self):\r
+        self.close()\r
+\r
+    def close(self):\r
+        try:\r
+            self.nextfile()\r
+        finally:\r
+            self._files = ()\r
+\r
+    def __iter__(self):\r
+        return self\r
+\r
+    def next(self):\r
+        try:\r
+            line = self._buffer[self._bufindex]\r
+        except IndexError:\r
+            pass\r
+        else:\r
+            self._bufindex += 1\r
+            self._lineno += 1\r
+            self._filelineno += 1\r
+            return line\r
+        line = self.readline()\r
+        if not line:\r
+            raise StopIteration\r
+        return line\r
+\r
+    def __getitem__(self, i):\r
+        if i != self._lineno:\r
+            raise RuntimeError, "accessing lines out of order"\r
+        try:\r
+            return self.next()\r
+        except StopIteration:\r
+            raise IndexError, "end of input reached"\r
+\r
+    def nextfile(self):\r
+        savestdout = self._savestdout\r
+        self._savestdout = 0\r
+        if savestdout:\r
+            sys.stdout = savestdout\r
+\r
+        output = self._output\r
+        self._output = 0\r
+        try:\r
+            if output:\r
+                output.close()\r
+        finally:\r
+            file = self._file\r
+            self._file = 0\r
+            try:\r
+                if file and not self._isstdin:\r
+                    file.close()\r
+            finally:\r
+                backupfilename = self._backupfilename\r
+                self._backupfilename = 0\r
+                if backupfilename and not self._backup:\r
+                    try: os.unlink(backupfilename)\r
+                    except OSError: pass\r
+\r
+                self._isstdin = False\r
+                self._buffer = []\r
+                self._bufindex = 0\r
+\r
+    def readline(self):\r
+        try:\r
+            line = self._buffer[self._bufindex]\r
+        except IndexError:\r
+            pass\r
+        else:\r
+            self._bufindex += 1\r
+            self._lineno += 1\r
+            self._filelineno += 1\r
+            return line\r
+        if not self._file:\r
+            if not self._files:\r
+                return ""\r
+            self._filename = self._files[0]\r
+            self._files = self._files[1:]\r
+            self._filelineno = 0\r
+            self._file = None\r
+            self._isstdin = False\r
+            self._backupfilename = 0\r
+            if self._filename == '-':\r
+                self._filename = '<stdin>'\r
+                self._file = sys.stdin\r
+                self._isstdin = True\r
+            else:\r
+                if self._inplace:\r
+                    self._backupfilename = (\r
+                        self._filename + (self._backup or os.extsep+"bak"))\r
+                    try: os.unlink(self._backupfilename)\r
+                    except os.error: pass\r
+                    # The next few lines may raise IOError\r
+                    os.rename(self._filename, self._backupfilename)\r
+                    self._file = open(self._backupfilename, self._mode)\r
+                    try:\r
+                        perm = os.fstat(self._file.fileno()).st_mode\r
+                    except OSError:\r
+                        self._output = open(self._filename, "w")\r
+                    else:\r
+                        fd = os.open(self._filename,\r
+                                     os.O_CREAT | os.O_WRONLY | os.O_TRUNC,\r
+                                     perm)\r
+                        self._output = os.fdopen(fd, "w")\r
+                        try:\r
+                            if hasattr(os, 'chmod'):\r
+                                os.chmod(self._filename, perm)\r
+                        except OSError:\r
+                            pass\r
+                    self._savestdout = sys.stdout\r
+                    sys.stdout = self._output\r
+                else:\r
+                    # This may raise IOError\r
+                    if self._openhook:\r
+                        self._file = self._openhook(self._filename, self._mode)\r
+                    else:\r
+                        self._file = open(self._filename, self._mode)\r
+        self._buffer = self._file.readlines(self._bufsize)\r
+        self._bufindex = 0\r
+        if not self._buffer:\r
+            self.nextfile()\r
+        # Recursive call\r
+        return self.readline()\r
+\r
+    def filename(self):\r
+        return self._filename\r
+\r
+    def lineno(self):\r
+        return self._lineno\r
+\r
+    def filelineno(self):\r
+        return self._filelineno\r
+\r
+    def fileno(self):\r
+        if self._file:\r
+            try:\r
+                return self._file.fileno()\r
+            except ValueError:\r
+                return -1\r
+        else:\r
+            return -1\r
+\r
+    def isfirstline(self):\r
+        return self._filelineno == 1\r
+\r
+    def isstdin(self):\r
+        return self._isstdin\r
+\r
+\r
+def hook_compressed(filename, mode):\r
+    ext = os.path.splitext(filename)[1]\r
+    if ext == '.gz':\r
+        import gzip\r
+        return gzip.open(filename, mode)\r
+    elif ext == '.bz2':\r
+        import bz2\r
+        return bz2.BZ2File(filename, mode)\r
+    else:\r
+        return open(filename, mode)\r
+\r
+\r
+def hook_encoded(encoding):\r
+    import io\r
+    def openhook(filename, mode):\r
+        mode = mode.replace('U', '').replace('b', '') or 'r'\r
+        return io.open(filename, mode, encoding=encoding, newline='')\r
+    return openhook\r
+\r
+\r
+def _test():\r
+    import getopt\r
+    inplace = 0\r
+    backup = 0\r
+    opts, args = getopt.getopt(sys.argv[1:], "ib:")\r
+    for o, a in opts:\r
+        if o == '-i': inplace = 1\r
+        if o == '-b': backup = a\r
+    for line in input(args, inplace=inplace, backup=backup):\r
+        if line[-1:] == '\n': line = line[:-1]\r
+        if line[-1:] == '\r': line = line[:-1]\r
+        print "%d: %s[%d]%s %s" % (lineno(), filename(), filelineno(),\r
+                                   isfirstline() and "*" or "", line)\r
+    print "%d: %s[%d]" % (lineno(), filename(), filelineno())\r
+\r
+if __name__ == '__main__':\r
+    _test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/fnmatch.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/fnmatch.py
new file mode 100644 (file)
index 0000000..2a03be9
--- /dev/null
@@ -0,0 +1,120 @@
+"""Filename matching with shell patterns.\r
+\r
+fnmatch(FILENAME, PATTERN) matches according to the local convention.\r
+fnmatchcase(FILENAME, PATTERN) always takes case in account.\r
+\r
+The functions operate by translating the pattern into a regular\r
+expression.  They cache the compiled regular expressions for speed.\r
+\r
+The function translate(PATTERN) returns a regular expression\r
+corresponding to PATTERN.  (It does not compile it.)\r
+"""\r
+\r
+import re\r
+\r
+__all__ = ["filter", "fnmatch", "fnmatchcase", "translate"]\r
+\r
+_cache = {}\r
+_MAXCACHE = 100\r
+\r
+def _purge():\r
+    """Clear the pattern cache"""\r
+    _cache.clear()\r
+\r
+def fnmatch(name, pat):\r
+    """Test whether FILENAME matches PATTERN.\r
+\r
+    Patterns are Unix shell style:\r
+\r
+    *       matches everything\r
+    ?       matches any single character\r
+    [seq]   matches any character in seq\r
+    [!seq]  matches any char not in seq\r
+\r
+    An initial period in FILENAME is not special.\r
+    Both FILENAME and PATTERN are first case-normalized\r
+    if the operating system requires it.\r
+    If you don't want this, use fnmatchcase(FILENAME, PATTERN).\r
+    """\r
+\r
+    import os\r
+    name = os.path.normcase(name)\r
+    pat = os.path.normcase(pat)\r
+    return fnmatchcase(name, pat)\r
+\r
+def filter(names, pat):\r
+    """Return the subset of the list NAMES that match PAT"""\r
+    import os,posixpath\r
+    result=[]\r
+    pat=os.path.normcase(pat)\r
+    try:\r
+        re_pat = _cache[pat]\r
+    except KeyError:\r
+        res = translate(pat)\r
+        if len(_cache) >= _MAXCACHE:\r
+            _cache.clear()\r
+        _cache[pat] = re_pat = re.compile(res)\r
+    match = re_pat.match\r
+    if os.path is posixpath:\r
+        # normcase on posix is NOP. Optimize it away from the loop.\r
+        for name in names:\r
+            if match(name):\r
+                result.append(name)\r
+    else:\r
+        for name in names:\r
+            if match(os.path.normcase(name)):\r
+                result.append(name)\r
+    return result\r
+\r
+def fnmatchcase(name, pat):\r
+    """Test whether FILENAME matches PATTERN, including case.\r
+\r
+    This is a version of fnmatch() which doesn't case-normalize\r
+    its arguments.\r
+    """\r
+\r
+    try:\r
+        re_pat = _cache[pat]\r
+    except KeyError:\r
+        res = translate(pat)\r
+        if len(_cache) >= _MAXCACHE:\r
+            _cache.clear()\r
+        _cache[pat] = re_pat = re.compile(res)\r
+    return re_pat.match(name) is not None\r
+\r
+def translate(pat):\r
+    """Translate a shell PATTERN to a regular expression.\r
+\r
+    There is no way to quote meta-characters.\r
+    """\r
+\r
+    i, n = 0, len(pat)\r
+    res = ''\r
+    while i < n:\r
+        c = pat[i]\r
+        i = i+1\r
+        if c == '*':\r
+            res = res + '.*'\r
+        elif c == '?':\r
+            res = res + '.'\r
+        elif c == '[':\r
+            j = i\r
+            if j < n and pat[j] == '!':\r
+                j = j+1\r
+            if j < n and pat[j] == ']':\r
+                j = j+1\r
+            while j < n and pat[j] != ']':\r
+                j = j+1\r
+            if j >= n:\r
+                res = res + '\\['\r
+            else:\r
+                stuff = pat[i:j].replace('\\','\\\\')\r
+                i = j+1\r
+                if stuff[0] == '!':\r
+                    stuff = '^' + stuff[1:]\r
+                elif stuff[0] == '^':\r
+                    stuff = '\\' + stuff\r
+                res = '%s[%s]' % (res, stuff)\r
+        else:\r
+            res = res + re.escape(c)\r
+    return res + '\Z(?ms)'\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/formatter.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/formatter.py
new file mode 100644 (file)
index 0000000..8413f8c
--- /dev/null
@@ -0,0 +1,445 @@
+"""Generic output formatting.\r
+\r
+Formatter objects transform an abstract flow of formatting events into\r
+specific output events on writer objects. Formatters manage several stack\r
+structures to allow various properties of a writer object to be changed and\r
+restored; writers need not be able to handle relative changes nor any sort\r
+of ``change back'' operation. Specific writer properties which may be\r
+controlled via formatter objects are horizontal alignment, font, and left\r
+margin indentations. A mechanism is provided which supports providing\r
+arbitrary, non-exclusive style settings to a writer as well. Additional\r
+interfaces facilitate formatting events which are not reversible, such as\r
+paragraph separation.\r
+\r
+Writer objects encapsulate device interfaces. Abstract devices, such as\r
+file formats, are supported as well as physical devices. The provided\r
+implementations all work with abstract devices. The interface makes\r
+available mechanisms for setting the properties which formatter objects\r
+manage and inserting data into the output.\r
+"""\r
+\r
+import sys\r
+\r
+\r
+AS_IS = None\r
+\r
+\r
+class NullFormatter:\r
+    """A formatter which does nothing.\r
+\r
+    If the writer parameter is omitted, a NullWriter instance is created.\r
+    No methods of the writer are called by NullFormatter instances.\r
+\r
+    Implementations should inherit from this class if implementing a writer\r
+    interface but don't need to inherit any implementation.\r
+\r
+    """\r
+\r
+    def __init__(self, writer=None):\r
+        if writer is None:\r
+            writer = NullWriter()\r
+        self.writer = writer\r
+    def end_paragraph(self, blankline): pass\r
+    def add_line_break(self): pass\r
+    def add_hor_rule(self, *args, **kw): pass\r
+    def add_label_data(self, format, counter, blankline=None): pass\r
+    def add_flowing_data(self, data): pass\r
+    def add_literal_data(self, data): pass\r
+    def flush_softspace(self): pass\r
+    def push_alignment(self, align): pass\r
+    def pop_alignment(self): pass\r
+    def push_font(self, x): pass\r
+    def pop_font(self): pass\r
+    def push_margin(self, margin): pass\r
+    def pop_margin(self): pass\r
+    def set_spacing(self, spacing): pass\r
+    def push_style(self, *styles): pass\r
+    def pop_style(self, n=1): pass\r
+    def assert_line_data(self, flag=1): pass\r
+\r
+\r
+class AbstractFormatter:\r
+    """The standard formatter.\r
+\r
+    This implementation has demonstrated wide applicability to many writers,\r
+    and may be used directly in most circumstances.  It has been used to\r
+    implement a full-featured World Wide Web browser.\r
+\r
+    """\r
+\r
+    #  Space handling policy:  blank spaces at the boundary between elements\r
+    #  are handled by the outermost context.  "Literal" data is not checked\r
+    #  to determine context, so spaces in literal data are handled directly\r
+    #  in all circumstances.\r
+\r
+    def __init__(self, writer):\r
+        self.writer = writer            # Output device\r
+        self.align = None               # Current alignment\r
+        self.align_stack = []           # Alignment stack\r
+        self.font_stack = []            # Font state\r
+        self.margin_stack = []          # Margin state\r
+        self.spacing = None             # Vertical spacing state\r
+        self.style_stack = []           # Other state, e.g. color\r
+        self.nospace = 1                # Should leading space be suppressed\r
+        self.softspace = 0              # Should a space be inserted\r
+        self.para_end = 1               # Just ended a paragraph\r
+        self.parskip = 0                # Skipped space between paragraphs?\r
+        self.hard_break = 1             # Have a hard break\r
+        self.have_label = 0\r
+\r
+    def end_paragraph(self, blankline):\r
+        if not self.hard_break:\r
+            self.writer.send_line_break()\r
+            self.have_label = 0\r
+        if self.parskip < blankline and not self.have_label:\r
+            self.writer.send_paragraph(blankline - self.parskip)\r
+            self.parskip = blankline\r
+            self.have_label = 0\r
+        self.hard_break = self.nospace = self.para_end = 1\r
+        self.softspace = 0\r
+\r
+    def add_line_break(self):\r
+        if not (self.hard_break or self.para_end):\r
+            self.writer.send_line_break()\r
+            self.have_label = self.parskip = 0\r
+        self.hard_break = self.nospace = 1\r
+        self.softspace = 0\r
+\r
+    def add_hor_rule(self, *args, **kw):\r
+        if not self.hard_break:\r
+            self.writer.send_line_break()\r
+        self.writer.send_hor_rule(*args, **kw)\r
+        self.hard_break = self.nospace = 1\r
+        self.have_label = self.para_end = self.softspace = self.parskip = 0\r
+\r
+    def add_label_data(self, format, counter, blankline = None):\r
+        if self.have_label or not self.hard_break:\r
+            self.writer.send_line_break()\r
+        if not self.para_end:\r
+            self.writer.send_paragraph((blankline and 1) or 0)\r
+        if isinstance(format, str):\r
+            self.writer.send_label_data(self.format_counter(format, counter))\r
+        else:\r
+            self.writer.send_label_data(format)\r
+        self.nospace = self.have_label = self.hard_break = self.para_end = 1\r
+        self.softspace = self.parskip = 0\r
+\r
+    def format_counter(self, format, counter):\r
+        label = ''\r
+        for c in format:\r
+            if c == '1':\r
+                label = label + ('%d' % counter)\r
+            elif c in 'aA':\r
+                if counter > 0:\r
+                    label = label + self.format_letter(c, counter)\r
+            elif c in 'iI':\r
+                if counter > 0:\r
+                    label = label + self.format_roman(c, counter)\r
+            else:\r
+                label = label + c\r
+        return label\r
+\r
+    def format_letter(self, case, counter):\r
+        label = ''\r
+        while counter > 0:\r
+            counter, x = divmod(counter-1, 26)\r
+            # This makes a strong assumption that lowercase letters\r
+            # and uppercase letters form two contiguous blocks, with\r
+            # letters in order!\r
+            s = chr(ord(case) + x)\r
+            label = s + label\r
+        return label\r
+\r
+    def format_roman(self, case, counter):\r
+        ones = ['i', 'x', 'c', 'm']\r
+        fives = ['v', 'l', 'd']\r
+        label, index = '', 0\r
+        # This will die of IndexError when counter is too big\r
+        while counter > 0:\r
+            counter, x = divmod(counter, 10)\r
+            if x == 9:\r
+                label = ones[index] + ones[index+1] + label\r
+            elif x == 4:\r
+                label = ones[index] + fives[index] + label\r
+            else:\r
+                if x >= 5:\r
+                    s = fives[index]\r
+                    x = x-5\r
+                else:\r
+                    s = ''\r
+                s = s + ones[index]*x\r
+                label = s + label\r
+            index = index + 1\r
+        if case == 'I':\r
+            return label.upper()\r
+        return label\r
+\r
+    def add_flowing_data(self, data):\r
+        if not data: return\r
+        prespace = data[:1].isspace()\r
+        postspace = data[-1:].isspace()\r
+        data = " ".join(data.split())\r
+        if self.nospace and not data:\r
+            return\r
+        elif prespace or self.softspace:\r
+            if not data:\r
+                if not self.nospace:\r
+                    self.softspace = 1\r
+                    self.parskip = 0\r
+                return\r
+            if not self.nospace:\r
+                data = ' ' + data\r
+        self.hard_break = self.nospace = self.para_end = \\r
+                          self.parskip = self.have_label = 0\r
+        self.softspace = postspace\r
+        self.writer.send_flowing_data(data)\r
+\r
+    def add_literal_data(self, data):\r
+        if not data: return\r
+        if self.softspace:\r
+            self.writer.send_flowing_data(" ")\r
+        self.hard_break = data[-1:] == '\n'\r
+        self.nospace = self.para_end = self.softspace = \\r
+                       self.parskip = self.have_label = 0\r
+        self.writer.send_literal_data(data)\r
+\r
+    def flush_softspace(self):\r
+        if self.softspace:\r
+            self.hard_break = self.para_end = self.parskip = \\r
+                              self.have_label = self.softspace = 0\r
+            self.nospace = 1\r
+            self.writer.send_flowing_data(' ')\r
+\r
+    def push_alignment(self, align):\r
+        if align and align != self.align:\r
+            self.writer.new_alignment(align)\r
+            self.align = align\r
+            self.align_stack.append(align)\r
+        else:\r
+            self.align_stack.append(self.align)\r
+\r
+    def pop_alignment(self):\r
+        if self.align_stack:\r
+            del self.align_stack[-1]\r
+        if self.align_stack:\r
+            self.align = align = self.align_stack[-1]\r
+            self.writer.new_alignment(align)\r
+        else:\r
+            self.align = None\r
+            self.writer.new_alignment(None)\r
+\r
+    def push_font(self, font):\r
+        size, i, b, tt = font\r
+        if self.softspace:\r
+            self.hard_break = self.para_end = self.softspace = 0\r
+            self.nospace = 1\r
+            self.writer.send_flowing_data(' ')\r
+        if self.font_stack:\r
+            csize, ci, cb, ctt = self.font_stack[-1]\r
+            if size is AS_IS: size = csize\r
+            if i is AS_IS: i = ci\r
+            if b is AS_IS: b = cb\r
+            if tt is AS_IS: tt = ctt\r
+        font = (size, i, b, tt)\r
+        self.font_stack.append(font)\r
+        self.writer.new_font(font)\r
+\r
+    def pop_font(self):\r
+        if self.font_stack:\r
+            del self.font_stack[-1]\r
+        if self.font_stack:\r
+            font = self.font_stack[-1]\r
+        else:\r
+            font = None\r
+        self.writer.new_font(font)\r
+\r
+    def push_margin(self, margin):\r
+        self.margin_stack.append(margin)\r
+        fstack = filter(None, self.margin_stack)\r
+        if not margin and fstack:\r
+            margin = fstack[-1]\r
+        self.writer.new_margin(margin, len(fstack))\r
+\r
+    def pop_margin(self):\r
+        if self.margin_stack:\r
+            del self.margin_stack[-1]\r
+        fstack = filter(None, self.margin_stack)\r
+        if fstack:\r
+            margin = fstack[-1]\r
+        else:\r
+            margin = None\r
+        self.writer.new_margin(margin, len(fstack))\r
+\r
+    def set_spacing(self, spacing):\r
+        self.spacing = spacing\r
+        self.writer.new_spacing(spacing)\r
+\r
+    def push_style(self, *styles):\r
+        if self.softspace:\r
+            self.hard_break = self.para_end = self.softspace = 0\r
+            self.nospace = 1\r
+            self.writer.send_flowing_data(' ')\r
+        for style in styles:\r
+            self.style_stack.append(style)\r
+        self.writer.new_styles(tuple(self.style_stack))\r
+\r
+    def pop_style(self, n=1):\r
+        del self.style_stack[-n:]\r
+        self.writer.new_styles(tuple(self.style_stack))\r
+\r
+    def assert_line_data(self, flag=1):\r
+        self.nospace = self.hard_break = not flag\r
+        self.para_end = self.parskip = self.have_label = 0\r
+\r
+\r
+class NullWriter:\r
+    """Minimal writer interface to use in testing & inheritance.\r
+\r
+    A writer which only provides the interface definition; no actions are\r
+    taken on any methods.  This should be the base class for all writers\r
+    which do not need to inherit any implementation methods.\r
+\r
+    """\r
+    def __init__(self): pass\r
+    def flush(self): pass\r
+    def new_alignment(self, align): pass\r
+    def new_font(self, font): pass\r
+    def new_margin(self, margin, level): pass\r
+    def new_spacing(self, spacing): pass\r
+    def new_styles(self, styles): pass\r
+    def send_paragraph(self, blankline): pass\r
+    def send_line_break(self): pass\r
+    def send_hor_rule(self, *args, **kw): pass\r
+    def send_label_data(self, data): pass\r
+    def send_flowing_data(self, data): pass\r
+    def send_literal_data(self, data): pass\r
+\r
+\r
+class AbstractWriter(NullWriter):\r
+    """A writer which can be used in debugging formatters, but not much else.\r
+\r
+    Each method simply announces itself by printing its name and\r
+    arguments on standard output.\r
+\r
+    """\r
+\r
+    def new_alignment(self, align):\r
+        print "new_alignment(%r)" % (align,)\r
+\r
+    def new_font(self, font):\r
+        print "new_font(%r)" % (font,)\r
+\r
+    def new_margin(self, margin, level):\r
+        print "new_margin(%r, %d)" % (margin, level)\r
+\r
+    def new_spacing(self, spacing):\r
+        print "new_spacing(%r)" % (spacing,)\r
+\r
+    def new_styles(self, styles):\r
+        print "new_styles(%r)" % (styles,)\r
+\r
+    def send_paragraph(self, blankline):\r
+        print "send_paragraph(%r)" % (blankline,)\r
+\r
+    def send_line_break(self):\r
+        print "send_line_break()"\r
+\r
+    def send_hor_rule(self, *args, **kw):\r
+        print "send_hor_rule()"\r
+\r
+    def send_label_data(self, data):\r
+        print "send_label_data(%r)" % (data,)\r
+\r
+    def send_flowing_data(self, data):\r
+        print "send_flowing_data(%r)" % (data,)\r
+\r
+    def send_literal_data(self, data):\r
+        print "send_literal_data(%r)" % (data,)\r
+\r
+\r
+class DumbWriter(NullWriter):\r
+    """Simple writer class which writes output on the file object passed in\r
+    as the file parameter or, if file is omitted, on standard output.  The\r
+    output is simply word-wrapped to the number of columns specified by\r
+    the maxcol parameter.  This class is suitable for reflowing a sequence\r
+    of paragraphs.\r
+\r
+    """\r
+\r
+    def __init__(self, file=None, maxcol=72):\r
+        self.file = file or sys.stdout\r
+        self.maxcol = maxcol\r
+        NullWriter.__init__(self)\r
+        self.reset()\r
+\r
+    def reset(self):\r
+        self.col = 0\r
+        self.atbreak = 0\r
+\r
+    def send_paragraph(self, blankline):\r
+        self.file.write('\n'*blankline)\r
+        self.col = 0\r
+        self.atbreak = 0\r
+\r
+    def send_line_break(self):\r
+        self.file.write('\n')\r
+        self.col = 0\r
+        self.atbreak = 0\r
+\r
+    def send_hor_rule(self, *args, **kw):\r
+        self.file.write('\n')\r
+        self.file.write('-'*self.maxcol)\r
+        self.file.write('\n')\r
+        self.col = 0\r
+        self.atbreak = 0\r
+\r
+    def send_literal_data(self, data):\r
+        self.file.write(data)\r
+        i = data.rfind('\n')\r
+        if i >= 0:\r
+            self.col = 0\r
+            data = data[i+1:]\r
+        data = data.expandtabs()\r
+        self.col = self.col + len(data)\r
+        self.atbreak = 0\r
+\r
+    def send_flowing_data(self, data):\r
+        if not data: return\r
+        atbreak = self.atbreak or data[0].isspace()\r
+        col = self.col\r
+        maxcol = self.maxcol\r
+        write = self.file.write\r
+        for word in data.split():\r
+            if atbreak:\r
+                if col + len(word) >= maxcol:\r
+                    write('\n')\r
+                    col = 0\r
+                else:\r
+                    write(' ')\r
+                    col = col + 1\r
+            write(word)\r
+            col = col + len(word)\r
+            atbreak = 1\r
+        self.col = col\r
+        self.atbreak = data[-1].isspace()\r
+\r
+\r
+def test(file = None):\r
+    w = DumbWriter()\r
+    f = AbstractFormatter(w)\r
+    if file is not None:\r
+        fp = open(file)\r
+    elif sys.argv[1:]:\r
+        fp = open(sys.argv[1])\r
+    else:\r
+        fp = sys.stdin\r
+    for line in fp:\r
+        if line == '\n':\r
+            f.end_paragraph(1)\r
+        else:\r
+            f.add_flowing_data(line)\r
+    f.end_paragraph(0)\r
+\r
+\r
+if __name__ == '__main__':\r
+    test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/functools.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/functools.py
new file mode 100644 (file)
index 0000000..b267245
--- /dev/null
@@ -0,0 +1,100 @@
+"""functools.py - Tools for working with functions and callable objects\r
+"""\r
+# Python module wrapper for _functools C module\r
+# to allow utilities written in Python to be added\r
+# to the functools module.\r
+# Written by Nick Coghlan <ncoghlan at gmail.com>\r
+#   Copyright (C) 2006 Python Software Foundation.\r
+# See C source code for _functools credits/copyright\r
+\r
+from _functools import partial, reduce\r
+\r
+# update_wrapper() and wraps() are tools to help write\r
+# wrapper functions that can handle naive introspection\r
+\r
+WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__doc__')\r
+WRAPPER_UPDATES = ('__dict__',)\r
+def update_wrapper(wrapper,\r
+                   wrapped,\r
+                   assigned = WRAPPER_ASSIGNMENTS,\r
+                   updated = WRAPPER_UPDATES):\r
+    """Update a wrapper function to look like the wrapped function\r
+\r
+       wrapper is the function to be updated\r
+       wrapped is the original function\r
+       assigned is a tuple naming the attributes assigned directly\r
+       from the wrapped function to the wrapper function (defaults to\r
+       functools.WRAPPER_ASSIGNMENTS)\r
+       updated is a tuple naming the attributes of the wrapper that\r
+       are updated with the corresponding attribute from the wrapped\r
+       function (defaults to functools.WRAPPER_UPDATES)\r
+    """\r
+    for attr in assigned:\r
+        setattr(wrapper, attr, getattr(wrapped, attr))\r
+    for attr in updated:\r
+        getattr(wrapper, attr).update(getattr(wrapped, attr, {}))\r
+    # Return the wrapper so this can be used as a decorator via partial()\r
+    return wrapper\r
+\r
+def wraps(wrapped,\r
+          assigned = WRAPPER_ASSIGNMENTS,\r
+          updated = WRAPPER_UPDATES):\r
+    """Decorator factory to apply update_wrapper() to a wrapper function\r
+\r
+       Returns a decorator that invokes update_wrapper() with the decorated\r
+       function as the wrapper argument and the arguments to wraps() as the\r
+       remaining arguments. Default arguments are as for update_wrapper().\r
+       This is a convenience function to simplify applying partial() to\r
+       update_wrapper().\r
+    """\r
+    return partial(update_wrapper, wrapped=wrapped,\r
+                   assigned=assigned, updated=updated)\r
+\r
+def total_ordering(cls):\r
+    """Class decorator that fills in missing ordering methods"""\r
+    convert = {\r
+        '__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),\r
+                   ('__le__', lambda self, other: self < other or self == other),\r
+                   ('__ge__', lambda self, other: not self < other)],\r
+        '__le__': [('__ge__', lambda self, other: not self <= other or self == other),\r
+                   ('__lt__', lambda self, other: self <= other and not self == other),\r
+                   ('__gt__', lambda self, other: not self <= other)],\r
+        '__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),\r
+                   ('__ge__', lambda self, other: self > other or self == other),\r
+                   ('__le__', lambda self, other: not self > other)],\r
+        '__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),\r
+                   ('__gt__', lambda self, other: self >= other and not self == other),\r
+                   ('__lt__', lambda self, other: not self >= other)]\r
+    }\r
+    roots = set(dir(cls)) & set(convert)\r
+    if not roots:\r
+        raise ValueError('must define at least one ordering operation: < > <= >=')\r
+    root = max(roots)       # prefer __lt__ to __le__ to __gt__ to __ge__\r
+    for opname, opfunc in convert[root]:\r
+        if opname not in roots:\r
+            opfunc.__name__ = opname\r
+            opfunc.__doc__ = getattr(int, opname).__doc__\r
+            setattr(cls, opname, opfunc)\r
+    return cls\r
+\r
+def cmp_to_key(mycmp):\r
+    """Convert a cmp= function into a key= function"""\r
+    class K(object):\r
+        __slots__ = ['obj']\r
+        def __init__(self, obj, *args):\r
+            self.obj = obj\r
+        def __lt__(self, other):\r
+            return mycmp(self.obj, other.obj) < 0\r
+        def __gt__(self, other):\r
+            return mycmp(self.obj, other.obj) > 0\r
+        def __eq__(self, other):\r
+            return mycmp(self.obj, other.obj) == 0\r
+        def __le__(self, other):\r
+            return mycmp(self.obj, other.obj) <= 0\r
+        def __ge__(self, other):\r
+            return mycmp(self.obj, other.obj) >= 0\r
+        def __ne__(self, other):\r
+            return mycmp(self.obj, other.obj) != 0\r
+        def __hash__(self):\r
+            raise TypeError('hash not implemented')\r
+    return K\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/genericpath.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/genericpath.py
new file mode 100644 (file)
index 0000000..09d2c45
--- /dev/null
@@ -0,0 +1,113 @@
+"""\r
+Path operations common to more than one OS\r
+Do not use directly.  The OS specific modules import the appropriate\r
+functions from this module themselves.\r
+"""\r
+import os\r
+import stat\r
+\r
+__all__ = ['commonprefix', 'exists', 'getatime', 'getctime', 'getmtime',\r
+           'getsize', 'isdir', 'isfile']\r
+\r
+\r
+try:\r
+    _unicode = unicode\r
+except NameError:\r
+    # If Python is built without Unicode support, the unicode type\r
+    # will not exist. Fake one.\r
+    class _unicode(object):\r
+        pass\r
+\r
+# Does a path exist?\r
+# This is false for dangling symbolic links on systems that support them.\r
+def exists(path):\r
+    """Test whether a path exists.  Returns False for broken symbolic links"""\r
+    try:\r
+        os.stat(path)\r
+    except os.error:\r
+        return False\r
+    return True\r
+\r
+\r
+# This follows symbolic links, so both islink() and isdir() can be true\r
+# for the same path on systems that support symlinks\r
+def isfile(path):\r
+    """Test whether a path is a regular file"""\r
+    try:\r
+        st = os.stat(path)\r
+    except os.error:\r
+        return False\r
+    return stat.S_ISREG(st.st_mode)\r
+\r
+\r
+# Is a path a directory?\r
+# This follows symbolic links, so both islink() and isdir()\r
+# can be true for the same path on systems that support symlinks\r
+def isdir(s):\r
+    """Return true if the pathname refers to an existing directory."""\r
+    try:\r
+        st = os.stat(s)\r
+    except os.error:\r
+        return False\r
+    return stat.S_ISDIR(st.st_mode)\r
+\r
+\r
+def getsize(filename):\r
+    """Return the size of a file, reported by os.stat()."""\r
+    return os.stat(filename).st_size\r
+\r
+\r
+def getmtime(filename):\r
+    """Return the last modification time of a file, reported by os.stat()."""\r
+    return os.stat(filename).st_mtime\r
+\r
+\r
+def getatime(filename):\r
+    """Return the last access time of a file, reported by os.stat()."""\r
+    return os.stat(filename).st_atime\r
+\r
+\r
+def getctime(filename):\r
+    """Return the metadata change time of a file, reported by os.stat()."""\r
+    return os.stat(filename).st_ctime\r
+\r
+\r
+# Return the longest prefix of all list elements.\r
+def commonprefix(m):\r
+    "Given a list of pathnames, returns the longest common leading component"\r
+    if not m: return ''\r
+    s1 = min(m)\r
+    s2 = max(m)\r
+    for i, c in enumerate(s1):\r
+        if c != s2[i]:\r
+            return s1[:i]\r
+    return s1\r
+\r
+# Split a path in root and extension.\r
+# The extension is everything starting at the last dot in the last\r
+# pathname component; the root is everything before that.\r
+# It is always true that root + ext == p.\r
+\r
+# Generic implementation of splitext, to be parametrized with\r
+# the separators\r
+def _splitext(p, sep, altsep, extsep):\r
+    """Split the extension from a pathname.\r
+\r
+    Extension is everything from the last dot to the end, ignoring\r
+    leading dots.  Returns "(root, ext)"; ext may be empty."""\r
+\r
+    sepIndex = p.rfind(sep)\r
+    if altsep:\r
+        altsepIndex = p.rfind(altsep)\r
+        sepIndex = max(sepIndex, altsepIndex)\r
+\r
+    dotIndex = p.rfind(extsep)\r
+    if dotIndex > sepIndex:\r
+        # skip all leading dots\r
+        filenameIndex = sepIndex + 1\r
+        while filenameIndex < dotIndex:\r
+            if p[filenameIndex] != extsep:\r
+                return p[:dotIndex], p[dotIndex:]\r
+            filenameIndex += 1\r
+\r
+    return p, ''\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/getopt.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/getopt.py
new file mode 100644 (file)
index 0000000..c6a763a
--- /dev/null
@@ -0,0 +1,210 @@
+"""Parser for command line options.\r
+\r
+This module helps scripts to parse the command line arguments in\r
+sys.argv.  It supports the same conventions as the Unix getopt()\r
+function (including the special meanings of arguments of the form `-'\r
+and `--').  Long options similar to those supported by GNU software\r
+may be used as well via an optional third argument.  This module\r
+provides two functions and an exception:\r
+\r
+getopt() -- Parse command line options\r
+gnu_getopt() -- Like getopt(), but allow option and non-option arguments\r
+to be intermixed.\r
+GetoptError -- exception (class) raised with 'opt' attribute, which is the\r
+option involved with the exception.\r
+"""\r
+\r
+# Long option support added by Lars Wirzenius <liw@iki.fi>.\r
+#\r
+# Gerrit Holl <gerrit@nl.linux.org> moved the string-based exceptions\r
+# to class-based exceptions.\r
+#\r
+# Peter Astrand <astrand@lysator.liu.se> added gnu_getopt().\r
+#\r
+# TODO for gnu_getopt():\r
+#\r
+# - GNU getopt_long_only mechanism\r
+# - allow the caller to specify ordering\r
+# - RETURN_IN_ORDER option\r
+# - GNU extension with '-' as first character of option string\r
+# - optional arguments, specified by double colons\r
+# - a option string with a W followed by semicolon should\r
+#   treat "-W foo" as "--foo"\r
+\r
+__all__ = ["GetoptError","error","getopt","gnu_getopt"]\r
+\r
+import os\r
+\r
+class GetoptError(Exception):\r
+    opt = ''\r
+    msg = ''\r
+    def __init__(self, msg, opt=''):\r
+        self.msg = msg\r
+        self.opt = opt\r
+        Exception.__init__(self, msg, opt)\r
+\r
+    def __str__(self):\r
+        return self.msg\r
+\r
+error = GetoptError # backward compatibility\r
+\r
+def getopt(args, shortopts, longopts = []):\r
+    """getopt(args, options[, long_options]) -> opts, args\r
+\r
+    Parses command line options and parameter list.  args is the\r
+    argument list to be parsed, without the leading reference to the\r
+    running program.  Typically, this means "sys.argv[1:]".  shortopts\r
+    is the string of option letters that the script wants to\r
+    recognize, with options that require an argument followed by a\r
+    colon (i.e., the same format that Unix getopt() uses).  If\r
+    specified, longopts is a list of strings with the names of the\r
+    long options which should be supported.  The leading '--'\r
+    characters should not be included in the option name.  Options\r
+    which require an argument should be followed by an equal sign\r
+    ('=').\r
+\r
+    The return value consists of two elements: the first is a list of\r
+    (option, value) pairs; the second is the list of program arguments\r
+    left after the option list was stripped (this is a trailing slice\r
+    of the first argument).  Each option-and-value pair returned has\r
+    the option as its first element, prefixed with a hyphen (e.g.,\r
+    '-x'), and the option argument as its second element, or an empty\r
+    string if the option has no argument.  The options occur in the\r
+    list in the same order in which they were found, thus allowing\r
+    multiple occurrences.  Long and short options may be mixed.\r
+\r
+    """\r
+\r
+    opts = []\r
+    if type(longopts) == type(""):\r
+        longopts = [longopts]\r
+    else:\r
+        longopts = list(longopts)\r
+    while args and args[0].startswith('-') and args[0] != '-':\r
+        if args[0] == '--':\r
+            args = args[1:]\r
+            break\r
+        if args[0].startswith('--'):\r
+            opts, args = do_longs(opts, args[0][2:], longopts, args[1:])\r
+        else:\r
+            opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])\r
+\r
+    return opts, args\r
+\r
+def gnu_getopt(args, shortopts, longopts = []):\r
+    """getopt(args, options[, long_options]) -> opts, args\r
+\r
+    This function works like getopt(), except that GNU style scanning\r
+    mode is used by default. This means that option and non-option\r
+    arguments may be intermixed. The getopt() function stops\r
+    processing options as soon as a non-option argument is\r
+    encountered.\r
+\r
+    If the first character of the option string is `+', or if the\r
+    environment variable POSIXLY_CORRECT is set, then option\r
+    processing stops as soon as a non-option argument is encountered.\r
+\r
+    """\r
+\r
+    opts = []\r
+    prog_args = []\r
+    if isinstance(longopts, str):\r
+        longopts = [longopts]\r
+    else:\r
+        longopts = list(longopts)\r
+\r
+    # Allow options after non-option arguments?\r
+    if shortopts.startswith('+'):\r
+        shortopts = shortopts[1:]\r
+        all_options_first = True\r
+    elif os.environ.get("POSIXLY_CORRECT"):\r
+        all_options_first = True\r
+    else:\r
+        all_options_first = False\r
+\r
+    while args:\r
+        if args[0] == '--':\r
+            prog_args += args[1:]\r
+            break\r
+\r
+        if args[0][:2] == '--':\r
+            opts, args = do_longs(opts, args[0][2:], longopts, args[1:])\r
+        elif args[0][:1] == '-' and args[0] != '-':\r
+            opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])\r
+        else:\r
+            if all_options_first:\r
+                prog_args += args\r
+                break\r
+            else:\r
+                prog_args.append(args[0])\r
+                args = args[1:]\r
+\r
+    return opts, prog_args\r
+\r
+def do_longs(opts, opt, longopts, args):\r
+    try:\r
+        i = opt.index('=')\r
+    except ValueError:\r
+        optarg = None\r
+    else:\r
+        opt, optarg = opt[:i], opt[i+1:]\r
+\r
+    has_arg, opt = long_has_args(opt, longopts)\r
+    if has_arg:\r
+        if optarg is None:\r
+            if not args:\r
+                raise GetoptError('option --%s requires argument' % opt, opt)\r
+            optarg, args = args[0], args[1:]\r
+    elif optarg is not None:\r
+        raise GetoptError('option --%s must not have an argument' % opt, opt)\r
+    opts.append(('--' + opt, optarg or ''))\r
+    return opts, args\r
+\r
+# Return:\r
+#   has_arg?\r
+#   full option name\r
+def long_has_args(opt, longopts):\r
+    possibilities = [o for o in longopts if o.startswith(opt)]\r
+    if not possibilities:\r
+        raise GetoptError('option --%s not recognized' % opt, opt)\r
+    # Is there an exact match?\r
+    if opt in possibilities:\r
+        return False, opt\r
+    elif opt + '=' in possibilities:\r
+        return True, opt\r
+    # No exact match, so better be unique.\r
+    if len(possibilities) > 1:\r
+        # XXX since possibilities contains all valid continuations, might be\r
+        # nice to work them into the error msg\r
+        raise GetoptError('option --%s not a unique prefix' % opt, opt)\r
+    assert len(possibilities) == 1\r
+    unique_match = possibilities[0]\r
+    has_arg = unique_match.endswith('=')\r
+    if has_arg:\r
+        unique_match = unique_match[:-1]\r
+    return has_arg, unique_match\r
+\r
+def do_shorts(opts, optstring, shortopts, args):\r
+    while optstring != '':\r
+        opt, optstring = optstring[0], optstring[1:]\r
+        if short_has_arg(opt, shortopts):\r
+            if optstring == '':\r
+                if not args:\r
+                    raise GetoptError('option -%s requires argument' % opt,\r
+                                      opt)\r
+                optstring, args = args[0], args[1:]\r
+            optarg, optstring = optstring, ''\r
+        else:\r
+            optarg = ''\r
+        opts.append(('-' + opt, optarg))\r
+    return opts, args\r
+\r
+def short_has_arg(opt, shortopts):\r
+    for i in range(len(shortopts)):\r
+        if opt == shortopts[i] != ':':\r
+            return shortopts.startswith(':', i+1)\r
+    raise GetoptError('option -%s not recognized' % opt, opt)\r
+\r
+if __name__ == '__main__':\r
+    import sys\r
+    print getopt(sys.argv[1:], "a:b", ["alpha=", "beta"])\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/gettext.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/gettext.py
new file mode 100644 (file)
index 0000000..a531462
--- /dev/null
@@ -0,0 +1,594 @@
+"""Internationalization and localization support.\r
+\r
+This module provides internationalization (I18N) and localization (L10N)\r
+support for your Python programs by providing an interface to the GNU gettext\r
+message catalog library.\r
+\r
+I18N refers to the operation by which a program is made aware of multiple\r
+languages.  L10N refers to the adaptation of your program, once\r
+internationalized, to the local language and cultural habits.\r
+\r
+"""\r
+\r
+# This module represents the integration of work, contributions, feedback, and\r
+# suggestions from the following people:\r
+#\r
+# Martin von Loewis, who wrote the initial implementation of the underlying\r
+# C-based libintlmodule (later renamed _gettext), along with a skeletal\r
+# gettext.py implementation.\r
+#\r
+# Peter Funk, who wrote fintl.py, a fairly complete wrapper around intlmodule,\r
+# which also included a pure-Python implementation to read .mo files if\r
+# intlmodule wasn't available.\r
+#\r
+# James Henstridge, who also wrote a gettext.py module, which has some\r
+# interesting, but currently unsupported experimental features: the notion of\r
+# a Catalog class and instances, and the ability to add to a catalog file via\r
+# a Python API.\r
+#\r
+# Barry Warsaw integrated these modules, wrote the .install() API and code,\r
+# and conformed all C and Python code to Python's coding standards.\r
+#\r
+# Francois Pinard and Marc-Andre Lemburg also contributed valuably to this\r
+# module.\r
+#\r
+# J. David Ibanez implemented plural forms. Bruno Haible fixed some bugs.\r
+#\r
+# TODO:\r
+# - Lazy loading of .mo files.  Currently the entire catalog is loaded into\r
+#   memory, but that's probably bad for large translated programs.  Instead,\r
+#   the lexical sort of original strings in GNU .mo files should be exploited\r
+#   to do binary searches and lazy initializations.  Or you might want to use\r
+#   the undocumented double-hash algorithm for .mo files with hash tables, but\r
+#   you'll need to study the GNU gettext code to do this.\r
+#\r
+# - Support Solaris .mo file formats.  Unfortunately, we've been unable to\r
+#   find this format documented anywhere.\r
+\r
+\r
+import locale, copy, os, re, struct, sys\r
+from errno import ENOENT\r
+\r
+\r
+__all__ = ['NullTranslations', 'GNUTranslations', 'Catalog',\r
+           'find', 'translation', 'install', 'textdomain', 'bindtextdomain',\r
+           'bind_textdomain_codeset',\r
+           'dgettext', 'dngettext', 'gettext', 'lgettext', 'ldgettext',\r
+           'ldngettext', 'lngettext', 'ngettext',\r
+           ]\r
+\r
+_default_localedir = os.path.join(sys.prefix, 'share', 'locale')\r
+\r
+\r
+def test(condition, true, false):\r
+    """\r
+    Implements the C expression:\r
+\r
+      condition ? true : false\r
+\r
+    Required to correctly interpret plural forms.\r
+    """\r
+    if condition:\r
+        return true\r
+    else:\r
+        return false\r
+\r
+\r
+def c2py(plural):\r
+    """Gets a C expression as used in PO files for plural forms and returns a\r
+    Python lambda function that implements an equivalent expression.\r
+    """\r
+    # Security check, allow only the "n" identifier\r
+    try:\r
+        from cStringIO import StringIO\r
+    except ImportError:\r
+        from StringIO import StringIO\r
+    import token, tokenize\r
+    tokens = tokenize.generate_tokens(StringIO(plural).readline)\r
+    try:\r
+        danger = [x for x in tokens if x[0] == token.NAME and x[1] != 'n']\r
+    except tokenize.TokenError:\r
+        raise ValueError, \\r
+              'plural forms expression error, maybe unbalanced parenthesis'\r
+    else:\r
+        if danger:\r
+            raise ValueError, 'plural forms expression could be dangerous'\r
+\r
+    # Replace some C operators by their Python equivalents\r
+    plural = plural.replace('&&', ' and ')\r
+    plural = plural.replace('||', ' or ')\r
+\r
+    expr = re.compile(r'\!([^=])')\r
+    plural = expr.sub(' not \\1', plural)\r
+\r
+    # Regular expression and replacement function used to transform\r
+    # "a?b:c" to "test(a,b,c)".\r
+    expr = re.compile(r'(.*?)\?(.*?):(.*)')\r
+    def repl(x):\r
+        return "test(%s, %s, %s)" % (x.group(1), x.group(2),\r
+                                     expr.sub(repl, x.group(3)))\r
+\r
+    # Code to transform the plural expression, taking care of parentheses\r
+    stack = ['']\r
+    for c in plural:\r
+        if c == '(':\r
+            stack.append('')\r
+        elif c == ')':\r
+            if len(stack) == 1:\r
+                # Actually, we never reach this code, because unbalanced\r
+                # parentheses get caught in the security check at the\r
+                # beginning.\r
+                raise ValueError, 'unbalanced parenthesis in plural form'\r
+            s = expr.sub(repl, stack.pop())\r
+            stack[-1] += '(%s)' % s\r
+        else:\r
+            stack[-1] += c\r
+    plural = expr.sub(repl, stack.pop())\r
+\r
+    return eval('lambda n: int(%s)' % plural)\r
+\r
+\r
+\r
+def _expand_lang(locale):\r
+    from locale import normalize\r
+    locale = normalize(locale)\r
+    COMPONENT_CODESET   = 1 << 0\r
+    COMPONENT_TERRITORY = 1 << 1\r
+    COMPONENT_MODIFIER  = 1 << 2\r
+    # split up the locale into its base components\r
+    mask = 0\r
+    pos = locale.find('@')\r
+    if pos >= 0:\r
+        modifier = locale[pos:]\r
+        locale = locale[:pos]\r
+        mask |= COMPONENT_MODIFIER\r
+    else:\r
+        modifier = ''\r
+    pos = locale.find('.')\r
+    if pos >= 0:\r
+        codeset = locale[pos:]\r
+        locale = locale[:pos]\r
+        mask |= COMPONENT_CODESET\r
+    else:\r
+        codeset = ''\r
+    pos = locale.find('_')\r
+    if pos >= 0:\r
+        territory = locale[pos:]\r
+        locale = locale[:pos]\r
+        mask |= COMPONENT_TERRITORY\r
+    else:\r
+        territory = ''\r
+    language = locale\r
+    ret = []\r
+    for i in range(mask+1):\r
+        if not (i & ~mask):  # if all components for this combo exist ...\r
+            val = language\r
+            if i & COMPONENT_TERRITORY: val += territory\r
+            if i & COMPONENT_CODESET:   val += codeset\r
+            if i & COMPONENT_MODIFIER:  val += modifier\r
+            ret.append(val)\r
+    ret.reverse()\r
+    return ret\r
+\r
+\r
+\r
+class NullTranslations:\r
+    def __init__(self, fp=None):\r
+        self._info = {}\r
+        self._charset = None\r
+        self._output_charset = None\r
+        self._fallback = None\r
+        if fp is not None:\r
+            self._parse(fp)\r
+\r
+    def _parse(self, fp):\r
+        pass\r
+\r
+    def add_fallback(self, fallback):\r
+        if self._fallback:\r
+            self._fallback.add_fallback(fallback)\r
+        else:\r
+            self._fallback = fallback\r
+\r
+    def gettext(self, message):\r
+        if self._fallback:\r
+            return self._fallback.gettext(message)\r
+        return message\r
+\r
+    def lgettext(self, message):\r
+        if self._fallback:\r
+            return self._fallback.lgettext(message)\r
+        return message\r
+\r
+    def ngettext(self, msgid1, msgid2, n):\r
+        if self._fallback:\r
+            return self._fallback.ngettext(msgid1, msgid2, n)\r
+        if n == 1:\r
+            return msgid1\r
+        else:\r
+            return msgid2\r
+\r
+    def lngettext(self, msgid1, msgid2, n):\r
+        if self._fallback:\r
+            return self._fallback.lngettext(msgid1, msgid2, n)\r
+        if n == 1:\r
+            return msgid1\r
+        else:\r
+            return msgid2\r
+\r
+    def ugettext(self, message):\r
+        if self._fallback:\r
+            return self._fallback.ugettext(message)\r
+        return unicode(message)\r
+\r
+    def ungettext(self, msgid1, msgid2, n):\r
+        if self._fallback:\r
+            return self._fallback.ungettext(msgid1, msgid2, n)\r
+        if n == 1:\r
+            return unicode(msgid1)\r
+        else:\r
+            return unicode(msgid2)\r
+\r
+    def info(self):\r
+        return self._info\r
+\r
+    def charset(self):\r
+        return self._charset\r
+\r
+    def output_charset(self):\r
+        return self._output_charset\r
+\r
+    def set_output_charset(self, charset):\r
+        self._output_charset = charset\r
+\r
+    def install(self, unicode=False, names=None):\r
+        import __builtin__\r
+        __builtin__.__dict__['_'] = unicode and self.ugettext or self.gettext\r
+        if hasattr(names, "__contains__"):\r
+            if "gettext" in names:\r
+                __builtin__.__dict__['gettext'] = __builtin__.__dict__['_']\r
+            if "ngettext" in names:\r
+                __builtin__.__dict__['ngettext'] = (unicode and self.ungettext\r
+                                                             or self.ngettext)\r
+            if "lgettext" in names:\r
+                __builtin__.__dict__['lgettext'] = self.lgettext\r
+            if "lngettext" in names:\r
+                __builtin__.__dict__['lngettext'] = self.lngettext\r
+\r
+\r
+class GNUTranslations(NullTranslations):\r
+    # Magic number of .mo files\r
+    LE_MAGIC = 0x950412deL\r
+    BE_MAGIC = 0xde120495L\r
+\r
+    def _parse(self, fp):\r
+        """Override this method to support alternative .mo formats."""\r
+        unpack = struct.unpack\r
+        filename = getattr(fp, 'name', '')\r
+        # Parse the .mo file header, which consists of 5 little endian 32\r
+        # bit words.\r
+        self._catalog = catalog = {}\r
+        self.plural = lambda n: int(n != 1) # germanic plural by default\r
+        buf = fp.read()\r
+        buflen = len(buf)\r
+        # Are we big endian or little endian?\r
+        magic = unpack('<I', buf[:4])[0]\r
+        if magic == self.LE_MAGIC:\r
+            version, msgcount, masteridx, transidx = unpack('<4I', buf[4:20])\r
+            ii = '<II'\r
+        elif magic == self.BE_MAGIC:\r
+            version, msgcount, masteridx, transidx = unpack('>4I', buf[4:20])\r
+            ii = '>II'\r
+        else:\r
+            raise IOError(0, 'Bad magic number', filename)\r
+        # Now put all messages from the .mo file buffer into the catalog\r
+        # dictionary.\r
+        for i in xrange(0, msgcount):\r
+            mlen, moff = unpack(ii, buf[masteridx:masteridx+8])\r
+            mend = moff + mlen\r
+            tlen, toff = unpack(ii, buf[transidx:transidx+8])\r
+            tend = toff + tlen\r
+            if mend < buflen and tend < buflen:\r
+                msg = buf[moff:mend]\r
+                tmsg = buf[toff:tend]\r
+            else:\r
+                raise IOError(0, 'File is corrupt', filename)\r
+            # See if we're looking at GNU .mo conventions for metadata\r
+            if mlen == 0:\r
+                # Catalog description\r
+                lastk = None\r
+                for item in tmsg.splitlines():\r
+                    item = item.strip()\r
+                    if not item:\r
+                        continue\r
+                    k = v = None\r
+                    if ':' in item:\r
+                        k, v = item.split(':', 1)\r
+                        k = k.strip().lower()\r
+                        v = v.strip()\r
+                        self._info[k] = v\r
+                        lastk = k\r
+                    elif lastk:\r
+                        self._info[lastk] += '\n' + item\r
+                    if k == 'content-type':\r
+                        self._charset = v.split('charset=')[1]\r
+                    elif k == 'plural-forms':\r
+                        v = v.split(';')\r
+                        plural = v[1].split('plural=')[1]\r
+                        self.plural = c2py(plural)\r
+            # Note: we unconditionally convert both msgids and msgstrs to\r
+            # Unicode using the character encoding specified in the charset\r
+            # parameter of the Content-Type header.  The gettext documentation\r
+            # strongly encourages msgids to be us-ascii, but some applications\r
+            # require alternative encodings (e.g. Zope's ZCML and ZPT).  For\r
+            # traditional gettext applications, the msgid conversion will\r
+            # cause no problems since us-ascii should always be a subset of\r
+            # the charset encoding.  We may want to fall back to 8-bit msgids\r
+            # if the Unicode conversion fails.\r
+            if '\x00' in msg:\r
+                # Plural forms\r
+                msgid1, msgid2 = msg.split('\x00')\r
+                tmsg = tmsg.split('\x00')\r
+                if self._charset:\r
+                    msgid1 = unicode(msgid1, self._charset)\r
+                    tmsg = [unicode(x, self._charset) for x in tmsg]\r
+                for i in range(len(tmsg)):\r
+                    catalog[(msgid1, i)] = tmsg[i]\r
+            else:\r
+                if self._charset:\r
+                    msg = unicode(msg, self._charset)\r
+                    tmsg = unicode(tmsg, self._charset)\r
+                catalog[msg] = tmsg\r
+            # advance to next entry in the seek tables\r
+            masteridx += 8\r
+            transidx += 8\r
+\r
+    def gettext(self, message):\r
+        missing = object()\r
+        tmsg = self._catalog.get(message, missing)\r
+        if tmsg is missing:\r
+            if self._fallback:\r
+                return self._fallback.gettext(message)\r
+            return message\r
+        # Encode the Unicode tmsg back to an 8-bit string, if possible\r
+        if self._output_charset:\r
+            return tmsg.encode(self._output_charset)\r
+        elif self._charset:\r
+            return tmsg.encode(self._charset)\r
+        return tmsg\r
+\r
+    def lgettext(self, message):\r
+        missing = object()\r
+        tmsg = self._catalog.get(message, missing)\r
+        if tmsg is missing:\r
+            if self._fallback:\r
+                return self._fallback.lgettext(message)\r
+            return message\r
+        if self._output_charset:\r
+            return tmsg.encode(self._output_charset)\r
+        return tmsg.encode(locale.getpreferredencoding())\r
+\r
+    def ngettext(self, msgid1, msgid2, n):\r
+        try:\r
+            tmsg = self._catalog[(msgid1, self.plural(n))]\r
+            if self._output_charset:\r
+                return tmsg.encode(self._output_charset)\r
+            elif self._charset:\r
+                return tmsg.encode(self._charset)\r
+            return tmsg\r
+        except KeyError:\r
+            if self._fallback:\r
+                return self._fallback.ngettext(msgid1, msgid2, n)\r
+            if n == 1:\r
+                return msgid1\r
+            else:\r
+                return msgid2\r
+\r
+    def lngettext(self, msgid1, msgid2, n):\r
+        try:\r
+            tmsg = self._catalog[(msgid1, self.plural(n))]\r
+            if self._output_charset:\r
+                return tmsg.encode(self._output_charset)\r
+            return tmsg.encode(locale.getpreferredencoding())\r
+        except KeyError:\r
+            if self._fallback:\r
+                return self._fallback.lngettext(msgid1, msgid2, n)\r
+            if n == 1:\r
+                return msgid1\r
+            else:\r
+                return msgid2\r
+\r
+    def ugettext(self, message):\r
+        missing = object()\r
+        tmsg = self._catalog.get(message, missing)\r
+        if tmsg is missing:\r
+            if self._fallback:\r
+                return self._fallback.ugettext(message)\r
+            return unicode(message)\r
+        return tmsg\r
+\r
+    def ungettext(self, msgid1, msgid2, n):\r
+        try:\r
+            tmsg = self._catalog[(msgid1, self.plural(n))]\r
+        except KeyError:\r
+            if self._fallback:\r
+                return self._fallback.ungettext(msgid1, msgid2, n)\r
+            if n == 1:\r
+                tmsg = unicode(msgid1)\r
+            else:\r
+                tmsg = unicode(msgid2)\r
+        return tmsg\r
+\r
+\r
+# Locate a .mo file using the gettext strategy\r
+def find(domain, localedir=None, languages=None, all=0):\r
+    # Get some reasonable defaults for arguments that were not supplied\r
+    if localedir is None:\r
+        localedir = _default_localedir\r
+    if languages is None:\r
+        languages = []\r
+        for envar in ('LANGUAGE', 'LC_ALL', 'LC_MESSAGES', 'LANG'):\r
+            val = os.environ.get(envar)\r
+            if val:\r
+                languages = val.split(':')\r
+                break\r
+        if 'C' not in languages:\r
+            languages.append('C')\r
+    # now normalize and expand the languages\r
+    nelangs = []\r
+    for lang in languages:\r
+        for nelang in _expand_lang(lang):\r
+            if nelang not in nelangs:\r
+                nelangs.append(nelang)\r
+    # select a language\r
+    if all:\r
+        result = []\r
+    else:\r
+        result = None\r
+    for lang in nelangs:\r
+        if lang == 'C':\r
+            break\r
+        mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % domain)\r
+        if os.path.exists(mofile):\r
+            if all:\r
+                result.append(mofile)\r
+            else:\r
+                return mofile\r
+    return result\r
+\r
+\r
+\r
+# a mapping between absolute .mo file path and Translation object\r
+_translations = {}\r
+\r
+def translation(domain, localedir=None, languages=None,\r
+                class_=None, fallback=False, codeset=None):\r
+    if class_ is None:\r
+        class_ = GNUTranslations\r
+    mofiles = find(domain, localedir, languages, all=1)\r
+    if not mofiles:\r
+        if fallback:\r
+            return NullTranslations()\r
+        raise IOError(ENOENT, 'No translation file found for domain', domain)\r
+    # Avoid opening, reading, and parsing the .mo file after it's been done\r
+    # once.\r
+    result = None\r
+    for mofile in mofiles:\r
+        key = (class_, os.path.abspath(mofile))\r
+        t = _translations.get(key)\r
+        if t is None:\r
+            with open(mofile, 'rb') as fp:\r
+                t = _translations.setdefault(key, class_(fp))\r
+        # Copy the translation object to allow setting fallbacks and\r
+        # output charset. All other instance data is shared with the\r
+        # cached object.\r
+        t = copy.copy(t)\r
+        if codeset:\r
+            t.set_output_charset(codeset)\r
+        if result is None:\r
+            result = t\r
+        else:\r
+            result.add_fallback(t)\r
+    return result\r
+\r
+\r
+def install(domain, localedir=None, unicode=False, codeset=None, names=None):\r
+    t = translation(domain, localedir, fallback=True, codeset=codeset)\r
+    t.install(unicode, names)\r
+\r
+\r
+\r
+# a mapping b/w domains and locale directories\r
+_localedirs = {}\r
+# a mapping b/w domains and codesets\r
+_localecodesets = {}\r
+# current global domain, `messages' used for compatibility w/ GNU gettext\r
+_current_domain = 'messages'\r
+\r
+\r
+def textdomain(domain=None):\r
+    global _current_domain\r
+    if domain is not None:\r
+        _current_domain = domain\r
+    return _current_domain\r
+\r
+\r
+def bindtextdomain(domain, localedir=None):\r
+    global _localedirs\r
+    if localedir is not None:\r
+        _localedirs[domain] = localedir\r
+    return _localedirs.get(domain, _default_localedir)\r
+\r
+\r
+def bind_textdomain_codeset(domain, codeset=None):\r
+    global _localecodesets\r
+    if codeset is not None:\r
+        _localecodesets[domain] = codeset\r
+    return _localecodesets.get(domain)\r
+\r
+\r
+def dgettext(domain, message):\r
+    try:\r
+        t = translation(domain, _localedirs.get(domain, None),\r
+                        codeset=_localecodesets.get(domain))\r
+    except IOError:\r
+        return message\r
+    return t.gettext(message)\r
+\r
+def ldgettext(domain, message):\r
+    try:\r
+        t = translation(domain, _localedirs.get(domain, None),\r
+                        codeset=_localecodesets.get(domain))\r
+    except IOError:\r
+        return message\r
+    return t.lgettext(message)\r
+\r
+def dngettext(domain, msgid1, msgid2, n):\r
+    try:\r
+        t = translation(domain, _localedirs.get(domain, None),\r
+                        codeset=_localecodesets.get(domain))\r
+    except IOError:\r
+        if n == 1:\r
+            return msgid1\r
+        else:\r
+            return msgid2\r
+    return t.ngettext(msgid1, msgid2, n)\r
+\r
+def ldngettext(domain, msgid1, msgid2, n):\r
+    try:\r
+        t = translation(domain, _localedirs.get(domain, None),\r
+                        codeset=_localecodesets.get(domain))\r
+    except IOError:\r
+        if n == 1:\r
+            return msgid1\r
+        else:\r
+            return msgid2\r
+    return t.lngettext(msgid1, msgid2, n)\r
+\r
+def gettext(message):\r
+    return dgettext(_current_domain, message)\r
+\r
+def lgettext(message):\r
+    return ldgettext(_current_domain, message)\r
+\r
+def ngettext(msgid1, msgid2, n):\r
+    return dngettext(_current_domain, msgid1, msgid2, n)\r
+\r
+def lngettext(msgid1, msgid2, n):\r
+    return ldngettext(_current_domain, msgid1, msgid2, n)\r
+\r
+# dcgettext() has been deemed unnecessary and is not implemented.\r
+\r
+# James Henstridge's Catalog constructor from GNOME gettext.  Documented usage\r
+# was:\r
+#\r
+#    import gettext\r
+#    cat = gettext.Catalog(PACKAGE, localedir=LOCALEDIR)\r
+#    _ = cat.gettext\r
+#    print _('Hello World')\r
+\r
+# The resulting catalog object currently don't support access through a\r
+# dictionary API, which was supported (but apparently unused) in GNOME\r
+# gettext.\r
+\r
+Catalog = translation\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/hashlib.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/hashlib.py
new file mode 100644 (file)
index 0000000..d723f20
--- /dev/null
@@ -0,0 +1,221 @@
+# $Id$\r
+#\r
+#  Copyright (C) 2005   Gregory P. Smith (greg@krypto.org)\r
+#  Licensed to PSF under a Contributor Agreement.\r
+#\r
+\r
+__doc__ = """hashlib module - A common interface to many hash functions.\r
+\r
+new(name, string='') - returns a new hash object implementing the\r
+                       given hash function; initializing the hash\r
+                       using the given string data.\r
+\r
+Named constructor functions are also available, these are much faster\r
+than using new():\r
+\r
+md5(), sha1(), sha224(), sha256(), sha384(), and sha512()\r
+\r
+More algorithms may be available on your platform but the above are guaranteed\r
+to exist.  See the algorithms_guaranteed and algorithms_available attributes\r
+to find out what algorithm names can be passed to new().\r
+\r
+NOTE: If you want the adler32 or crc32 hash functions they are available in\r
+the zlib module.\r
+\r
+Choose your hash function wisely.  Some have known collision weaknesses.\r
+sha384 and sha512 will be slow on 32 bit platforms.\r
+\r
+Hash objects have these methods:\r
+ - update(arg): Update the hash object with the string arg. Repeated calls\r
+                are equivalent to a single call with the concatenation of all\r
+                the arguments.\r
+ - digest():    Return the digest of the strings passed to the update() method\r
+                so far. This may contain non-ASCII characters, including\r
+                NUL bytes.\r
+ - hexdigest(): Like digest() except the digest is returned as a string of\r
+                double length, containing only hexadecimal digits.\r
+ - copy():      Return a copy (clone) of the hash object. This can be used to\r
+                efficiently compute the digests of strings that share a common\r
+                initial substring.\r
+\r
+For example, to obtain the digest of the string 'Nobody inspects the\r
+spammish repetition':\r
+\r
+    >>> import hashlib\r
+    >>> m = hashlib.md5()\r
+    >>> m.update("Nobody inspects")\r
+    >>> m.update(" the spammish repetition")\r
+    >>> m.digest()\r
+    '\\xbbd\\x9c\\x83\\xdd\\x1e\\xa5\\xc9\\xd9\\xde\\xc9\\xa1\\x8d\\xf0\\xff\\xe9'\r
+\r
+More condensed:\r
+\r
+    >>> hashlib.sha224("Nobody inspects the spammish repetition").hexdigest()\r
+    'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'\r
+\r
+"""\r
+\r
+# This tuple and __get_builtin_constructor() must be modified if a new\r
+# always available algorithm is added.\r
+__always_supported = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')\r
+\r
+algorithms_guaranteed = set(__always_supported)\r
+algorithms_available = set(__always_supported)\r
+\r
+algorithms = __always_supported\r
+\r
+__all__ = __always_supported + ('new', 'algorithms_guaranteed',\r
+                                'algorithms_available', 'algorithms',\r
+                                'pbkdf2_hmac')\r
+\r
+\r
+def __get_builtin_constructor(name):\r
+    try:\r
+        if name in ('SHA1', 'sha1'):\r
+            import _sha\r
+            return _sha.new\r
+        elif name in ('MD5', 'md5'):\r
+            import _md5\r
+            return _md5.new\r
+        elif name in ('SHA256', 'sha256', 'SHA224', 'sha224'):\r
+            import _sha256\r
+            bs = name[3:]\r
+            if bs == '256':\r
+                return _sha256.sha256\r
+            elif bs == '224':\r
+                return _sha256.sha224\r
+        elif name in ('SHA512', 'sha512', 'SHA384', 'sha384'):\r
+            import _sha512\r
+            bs = name[3:]\r
+            if bs == '512':\r
+                return _sha512.sha512\r
+            elif bs == '384':\r
+                return _sha512.sha384\r
+    except ImportError:\r
+        pass  # no extension module, this hash is unsupported.\r
+\r
+    raise ValueError('unsupported hash type ' + name)\r
+\r
+\r
+def __get_openssl_constructor(name):\r
+    try:\r
+        f = getattr(_hashlib, 'openssl_' + name)\r
+        # Allow the C module to raise ValueError.  The function will be\r
+        # defined but the hash not actually available thanks to OpenSSL.\r
+        f()\r
+        # Use the C function directly (very fast)\r
+        return f\r
+    except (AttributeError, ValueError):\r
+        return __get_builtin_constructor(name)\r
+\r
+\r
+def __py_new(name, string=''):\r
+    """new(name, string='') - Return a new hashing object using the named algorithm;\r
+    optionally initialized with a string.\r
+    """\r
+    return __get_builtin_constructor(name)(string)\r
+\r
+\r
+def __hash_new(name, string=''):\r
+    """new(name, string='') - Return a new hashing object using the named algorithm;\r
+    optionally initialized with a string.\r
+    """\r
+    try:\r
+        return _hashlib.new(name, string)\r
+    except ValueError:\r
+        # If the _hashlib module (OpenSSL) doesn't support the named\r
+        # hash, try using our builtin implementations.\r
+        # This allows for SHA224/256 and SHA384/512 support even though\r
+        # the OpenSSL library prior to 0.9.8 doesn't provide them.\r
+        return __get_builtin_constructor(name)(string)\r
+\r
+\r
+try:\r
+    import _hashlib\r
+    new = __hash_new\r
+    __get_hash = __get_openssl_constructor\r
+    algorithms_available = algorithms_available.union(\r
+        _hashlib.openssl_md_meth_names)\r
+except ImportError:\r
+    new = __py_new\r
+    __get_hash = __get_builtin_constructor\r
+\r
+for __func_name in __always_supported:\r
+    # try them all, some may not work due to the OpenSSL\r
+    # version not supporting that algorithm.\r
+    try:\r
+        globals()[__func_name] = __get_hash(__func_name)\r
+    except ValueError:\r
+        import logging\r
+        logging.exception('code for hash %s was not found.', __func_name)\r
+\r
+\r
+try:\r
+    # OpenSSL's PKCS5_PBKDF2_HMAC requires OpenSSL 1.0+ with HMAC and SHA\r
+    from _hashlib import pbkdf2_hmac\r
+except ImportError:\r
+    import binascii\r
+    import struct\r
+\r
+    _trans_5C = b"".join(chr(x ^ 0x5C) for x in range(256))\r
+    _trans_36 = b"".join(chr(x ^ 0x36) for x in range(256))\r
+\r
+    def pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None):\r
+        """Password based key derivation function 2 (PKCS #5 v2.0)\r
+\r
+        This Python implementations based on the hmac module about as fast\r
+        as OpenSSL's PKCS5_PBKDF2_HMAC for short passwords and much faster\r
+        for long passwords.\r
+        """\r
+        if not isinstance(hash_name, str):\r
+            raise TypeError(hash_name)\r
+\r
+        if not isinstance(password, (bytes, bytearray)):\r
+            password = bytes(buffer(password))\r
+        if not isinstance(salt, (bytes, bytearray)):\r
+            salt = bytes(buffer(salt))\r
+\r
+        # Fast inline HMAC implementation\r
+        inner = new(hash_name)\r
+        outer = new(hash_name)\r
+        blocksize = getattr(inner, 'block_size', 64)\r
+        if len(password) > blocksize:\r
+            password = new(hash_name, password).digest()\r
+        password = password + b'\x00' * (blocksize - len(password))\r
+        inner.update(password.translate(_trans_36))\r
+        outer.update(password.translate(_trans_5C))\r
+\r
+        def prf(msg, inner=inner, outer=outer):\r
+            # PBKDF2_HMAC uses the password as key. We can re-use the same\r
+            # digest objects and just update copies to skip initialization.\r
+            icpy = inner.copy()\r
+            ocpy = outer.copy()\r
+            icpy.update(msg)\r
+            ocpy.update(icpy.digest())\r
+            return ocpy.digest()\r
+\r
+        if iterations < 1:\r
+            raise ValueError(iterations)\r
+        if dklen is None:\r
+            dklen = outer.digest_size\r
+        if dklen < 1:\r
+            raise ValueError(dklen)\r
+\r
+        hex_format_string = "%%0%ix" % (new(hash_name).digest_size * 2)\r
+\r
+        dkey = b''\r
+        loop = 1\r
+        while len(dkey) < dklen:\r
+            prev = prf(salt + struct.pack(b'>I', loop))\r
+            rkey = int(binascii.hexlify(prev), 16)\r
+            for i in xrange(iterations - 1):\r
+                prev = prf(prev)\r
+                rkey ^= int(binascii.hexlify(prev), 16)\r
+            loop += 1\r
+            dkey += binascii.unhexlify(hex_format_string % rkey)\r
+\r
+        return dkey[:dklen]\r
+\r
+# Cleanup locals()\r
+del __always_supported, __func_name, __get_hash\r
+del __py_new, __hash_new, __get_openssl_constructor\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/heapq.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/heapq.py
new file mode 100644 (file)
index 0000000..f87e9ee
--- /dev/null
@@ -0,0 +1,485 @@
+# -*- coding: latin-1 -*-\r
+\r
+"""Heap queue algorithm (a.k.a. priority queue).\r
+\r
+Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for\r
+all k, counting elements from 0.  For the sake of comparison,\r
+non-existing elements are considered to be infinite.  The interesting\r
+property of a heap is that a[0] is always its smallest element.\r
+\r
+Usage:\r
+\r
+heap = []            # creates an empty heap\r
+heappush(heap, item) # pushes a new item on the heap\r
+item = heappop(heap) # pops the smallest item from the heap\r
+item = heap[0]       # smallest item on the heap without popping it\r
+heapify(x)           # transforms list into a heap, in-place, in linear time\r
+item = heapreplace(heap, item) # pops and returns smallest item, and adds\r
+                               # new item; the heap size is unchanged\r
+\r
+Our API differs from textbook heap algorithms as follows:\r
+\r
+- We use 0-based indexing.  This makes the relationship between the\r
+  index for a node and the indexes for its children slightly less\r
+  obvious, but is more suitable since Python uses 0-based indexing.\r
+\r
+- Our heappop() method returns the smallest item, not the largest.\r
+\r
+These two make it possible to view the heap as a regular Python list\r
+without surprises: heap[0] is the smallest item, and heap.sort()\r
+maintains the heap invariant!\r
+"""\r
+\r
+# Original code by Kevin O'Connor, augmented by Tim Peters and Raymond Hettinger\r
+\r
+__about__ = """Heap queues\r
+\r
+[explanation by François Pinard]\r
+\r
+Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for\r
+all k, counting elements from 0.  For the sake of comparison,\r
+non-existing elements are considered to be infinite.  The interesting\r
+property of a heap is that a[0] is always its smallest element.\r
+\r
+The strange invariant above is meant to be an efficient memory\r
+representation for a tournament.  The numbers below are `k', not a[k]:\r
+\r
+                                   0\r
+\r
+                  1                                 2\r
+\r
+          3               4                5               6\r
+\r
+      7       8       9       10      11      12      13      14\r
+\r
+    15 16   17 18   19 20   21 22   23 24   25 26   27 28   29 30\r
+\r
+\r
+In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'.  In\r
+an usual binary tournament we see in sports, each cell is the winner\r
+over the two cells it tops, and we can trace the winner down the tree\r
+to see all opponents s/he had.  However, in many computer applications\r
+of such tournaments, we do not need to trace the history of a winner.\r
+To be more memory efficient, when a winner is promoted, we try to\r
+replace it by something else at a lower level, and the rule becomes\r
+that a cell and the two cells it tops contain three different items,\r
+but the top cell "wins" over the two topped cells.\r
+\r
+If this heap invariant is protected at all time, index 0 is clearly\r
+the overall winner.  The simplest algorithmic way to remove it and\r
+find the "next" winner is to move some loser (let's say cell 30 in the\r
+diagram above) into the 0 position, and then percolate this new 0 down\r
+the tree, exchanging values, until the invariant is re-established.\r
+This is clearly logarithmic on the total number of items in the tree.\r
+By iterating over all items, you get an O(n ln n) sort.\r
+\r
+A nice feature of this sort is that you can efficiently insert new\r
+items while the sort is going on, provided that the inserted items are\r
+not "better" than the last 0'th element you extracted.  This is\r
+especially useful in simulation contexts, where the tree holds all\r
+incoming events, and the "win" condition means the smallest scheduled\r
+time.  When an event schedule other events for execution, they are\r
+scheduled into the future, so they can easily go into the heap.  So, a\r
+heap is a good structure for implementing schedulers (this is what I\r
+used for my MIDI sequencer :-).\r
+\r
+Various structures for implementing schedulers have been extensively\r
+studied, and heaps are good for this, as they are reasonably speedy,\r
+the speed is almost constant, and the worst case is not much different\r
+than the average case.  However, there are other representations which\r
+are more efficient overall, yet the worst cases might be terrible.\r
+\r
+Heaps are also very useful in big disk sorts.  You most probably all\r
+know that a big sort implies producing "runs" (which are pre-sorted\r
+sequences, which size is usually related to the amount of CPU memory),\r
+followed by a merging passes for these runs, which merging is often\r
+very cleverly organised[1].  It is very important that the initial\r
+sort produces the longest runs possible.  Tournaments are a good way\r
+to that.  If, using all the memory available to hold a tournament, you\r
+replace and percolate items that happen to fit the current run, you'll\r
+produce runs which are twice the size of the memory for random input,\r
+and much better for input fuzzily ordered.\r
+\r
+Moreover, if you output the 0'th item on disk and get an input which\r
+may not fit in the current tournament (because the value "wins" over\r
+the last output value), it cannot fit in the heap, so the size of the\r
+heap decreases.  The freed memory could be cleverly reused immediately\r
+for progressively building a second heap, which grows at exactly the\r
+same rate the first heap is melting.  When the first heap completely\r
+vanishes, you switch heaps and start a new run.  Clever and quite\r
+effective!\r
+\r
+In a word, heaps are useful memory structures to know.  I use them in\r
+a few applications, and I think it is good to keep a `heap' module\r
+around. :-)\r
+\r
+--------------------\r
+[1] The disk balancing algorithms which are current, nowadays, are\r
+more annoying than clever, and this is a consequence of the seeking\r
+capabilities of the disks.  On devices which cannot seek, like big\r
+tape drives, the story was quite different, and one had to be very\r
+clever to ensure (far in advance) that each tape movement will be the\r
+most effective possible (that is, will best participate at\r
+"progressing" the merge).  Some tapes were even able to read\r
+backwards, and this was also used to avoid the rewinding time.\r
+Believe me, real good tape sorts were quite spectacular to watch!\r
+From all times, sorting has always been a Great Art! :-)\r
+"""\r
+\r
+__all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'merge',\r
+           'nlargest', 'nsmallest', 'heappushpop']\r
+\r
+from itertools import islice, count, imap, izip, tee, chain\r
+from operator import itemgetter\r
+\r
+def cmp_lt(x, y):\r
+    # Use __lt__ if available; otherwise, try __le__.\r
+    # In Py3.x, only __lt__ will be called.\r
+    return (x < y) if hasattr(x, '__lt__') else (not y <= x)\r
+\r
+def heappush(heap, item):\r
+    """Push item onto heap, maintaining the heap invariant."""\r
+    heap.append(item)\r
+    _siftdown(heap, 0, len(heap)-1)\r
+\r
+def heappop(heap):\r
+    """Pop the smallest item off the heap, maintaining the heap invariant."""\r
+    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty\r
+    if heap:\r
+        returnitem = heap[0]\r
+        heap[0] = lastelt\r
+        _siftup(heap, 0)\r
+    else:\r
+        returnitem = lastelt\r
+    return returnitem\r
+\r
+def heapreplace(heap, item):\r
+    """Pop and return the current smallest value, and add the new item.\r
+\r
+    This is more efficient than heappop() followed by heappush(), and can be\r
+    more appropriate when using a fixed-size heap.  Note that the value\r
+    returned may be larger than item!  That constrains reasonable uses of\r
+    this routine unless written as part of a conditional replacement:\r
+\r
+        if item > heap[0]:\r
+            item = heapreplace(heap, item)\r
+    """\r
+    returnitem = heap[0]    # raises appropriate IndexError if heap is empty\r
+    heap[0] = item\r
+    _siftup(heap, 0)\r
+    return returnitem\r
+\r
+def heappushpop(heap, item):\r
+    """Fast version of a heappush followed by a heappop."""\r
+    if heap and cmp_lt(heap[0], item):\r
+        item, heap[0] = heap[0], item\r
+        _siftup(heap, 0)\r
+    return item\r
+\r
+def heapify(x):\r
+    """Transform list into a heap, in-place, in O(len(x)) time."""\r
+    n = len(x)\r
+    # Transform bottom-up.  The largest index there's any point to looking at\r
+    # is the largest with a child index in-range, so must have 2*i + 1 < n,\r
+    # or i < (n-1)/2.  If n is even = 2*j, this is (2*j-1)/2 = j-1/2 so\r
+    # j-1 is the largest, which is n//2 - 1.  If n is odd = 2*j+1, this is\r
+    # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1.\r
+    for i in reversed(xrange(n//2)):\r
+        _siftup(x, i)\r
+\r
+def _heappushpop_max(heap, item):\r
+    """Maxheap version of a heappush followed by a heappop."""\r
+    if heap and cmp_lt(item, heap[0]):\r
+        item, heap[0] = heap[0], item\r
+        _siftup_max(heap, 0)\r
+    return item\r
+\r
+def _heapify_max(x):\r
+    """Transform list into a maxheap, in-place, in O(len(x)) time."""\r
+    n = len(x)\r
+    for i in reversed(range(n//2)):\r
+        _siftup_max(x, i)\r
+\r
+def nlargest(n, iterable):\r
+    """Find the n largest elements in a dataset.\r
+\r
+    Equivalent to:  sorted(iterable, reverse=True)[:n]\r
+    """\r
+    if n < 0:\r
+        return []\r
+    it = iter(iterable)\r
+    result = list(islice(it, n))\r
+    if not result:\r
+        return result\r
+    heapify(result)\r
+    _heappushpop = heappushpop\r
+    for elem in it:\r
+        _heappushpop(result, elem)\r
+    result.sort(reverse=True)\r
+    return result\r
+\r
+def nsmallest(n, iterable):\r
+    """Find the n smallest elements in a dataset.\r
+\r
+    Equivalent to:  sorted(iterable)[:n]\r
+    """\r
+    if n < 0:\r
+        return []\r
+    it = iter(iterable)\r
+    result = list(islice(it, n))\r
+    if not result:\r
+        return result\r
+    _heapify_max(result)\r
+    _heappushpop = _heappushpop_max\r
+    for elem in it:\r
+        _heappushpop(result, elem)\r
+    result.sort()\r
+    return result\r
+\r
+# 'heap' is a heap at all indices >= startpos, except possibly for pos.  pos\r
+# is the index of a leaf with a possibly out-of-order value.  Restore the\r
+# heap invariant.\r
+def _siftdown(heap, startpos, pos):\r
+    newitem = heap[pos]\r
+    # Follow the path to the root, moving parents down until finding a place\r
+    # newitem fits.\r
+    while pos > startpos:\r
+        parentpos = (pos - 1) >> 1\r
+        parent = heap[parentpos]\r
+        if cmp_lt(newitem, parent):\r
+            heap[pos] = parent\r
+            pos = parentpos\r
+            continue\r
+        break\r
+    heap[pos] = newitem\r
+\r
+# The child indices of heap index pos are already heaps, and we want to make\r
+# a heap at index pos too.  We do this by bubbling the smaller child of\r
+# pos up (and so on with that child's children, etc) until hitting a leaf,\r
+# then using _siftdown to move the oddball originally at index pos into place.\r
+#\r
+# We *could* break out of the loop as soon as we find a pos where newitem <=\r
+# both its children, but turns out that's not a good idea, and despite that\r
+# many books write the algorithm that way.  During a heap pop, the last array\r
+# element is sifted in, and that tends to be large, so that comparing it\r
+# against values starting from the root usually doesn't pay (= usually doesn't\r
+# get us out of the loop early).  See Knuth, Volume 3, where this is\r
+# explained and quantified in an exercise.\r
+#\r
+# Cutting the # of comparisons is important, since these routines have no\r
+# way to extract "the priority" from an array element, so that intelligence\r
+# is likely to be hiding in custom __cmp__ methods, or in array elements\r
+# storing (priority, record) tuples.  Comparisons are thus potentially\r
+# expensive.\r
+#\r
+# On random arrays of length 1000, making this change cut the number of\r
+# comparisons made by heapify() a little, and those made by exhaustive\r
+# heappop() a lot, in accord with theory.  Here are typical results from 3\r
+# runs (3 just to demonstrate how small the variance is):\r
+#\r
+# Compares needed by heapify     Compares needed by 1000 heappops\r
+# --------------------------     --------------------------------\r
+# 1837 cut to 1663               14996 cut to 8680\r
+# 1855 cut to 1659               14966 cut to 8678\r
+# 1847 cut to 1660               15024 cut to 8703\r
+#\r
+# Building the heap by using heappush() 1000 times instead required\r
+# 2198, 2148, and 2219 compares:  heapify() is more efficient, when\r
+# you can use it.\r
+#\r
+# The total compares needed by list.sort() on the same lists were 8627,\r
+# 8627, and 8632 (this should be compared to the sum of heapify() and\r
+# heappop() compares):  list.sort() is (unsurprisingly!) more efficient\r
+# for sorting.\r
+\r
+def _siftup(heap, pos):\r
+    endpos = len(heap)\r
+    startpos = pos\r
+    newitem = heap[pos]\r
+    # Bubble up the smaller child until hitting a leaf.\r
+    childpos = 2*pos + 1    # leftmost child position\r
+    while childpos < endpos:\r
+        # Set childpos to index of smaller child.\r
+        rightpos = childpos + 1\r
+        if rightpos < endpos and not cmp_lt(heap[childpos], heap[rightpos]):\r
+            childpos = rightpos\r
+        # Move the smaller child up.\r
+        heap[pos] = heap[childpos]\r
+        pos = childpos\r
+        childpos = 2*pos + 1\r
+    # The leaf at pos is empty now.  Put newitem there, and bubble it up\r
+    # to its final resting place (by sifting its parents down).\r
+    heap[pos] = newitem\r
+    _siftdown(heap, startpos, pos)\r
+\r
+def _siftdown_max(heap, startpos, pos):\r
+    'Maxheap variant of _siftdown'\r
+    newitem = heap[pos]\r
+    # Follow the path to the root, moving parents down until finding a place\r
+    # newitem fits.\r
+    while pos > startpos:\r
+        parentpos = (pos - 1) >> 1\r
+        parent = heap[parentpos]\r
+        if cmp_lt(parent, newitem):\r
+            heap[pos] = parent\r
+            pos = parentpos\r
+            continue\r
+        break\r
+    heap[pos] = newitem\r
+\r
+def _siftup_max(heap, pos):\r
+    'Maxheap variant of _siftup'\r
+    endpos = len(heap)\r
+    startpos = pos\r
+    newitem = heap[pos]\r
+    # Bubble up the larger child until hitting a leaf.\r
+    childpos = 2*pos + 1    # leftmost child position\r
+    while childpos < endpos:\r
+        # Set childpos to index of larger child.\r
+        rightpos = childpos + 1\r
+        if rightpos < endpos and not cmp_lt(heap[rightpos], heap[childpos]):\r
+            childpos = rightpos\r
+        # Move the larger child up.\r
+        heap[pos] = heap[childpos]\r
+        pos = childpos\r
+        childpos = 2*pos + 1\r
+    # The leaf at pos is empty now.  Put newitem there, and bubble it up\r
+    # to its final resting place (by sifting its parents down).\r
+    heap[pos] = newitem\r
+    _siftdown_max(heap, startpos, pos)\r
+\r
+# If available, use C implementation\r
+try:\r
+    from _heapq import *\r
+except ImportError:\r
+    pass\r
+\r
+def merge(*iterables):\r
+    '''Merge multiple sorted inputs into a single sorted output.\r
+\r
+    Similar to sorted(itertools.chain(*iterables)) but returns a generator,\r
+    does not pull the data into memory all at once, and assumes that each of\r
+    the input streams is already sorted (smallest to largest).\r
+\r
+    >>> list(merge([1,3,5,7], [0,2,4,8], [5,10,15,20], [], [25]))\r
+    [0, 1, 2, 3, 4, 5, 5, 7, 8, 10, 15, 20, 25]\r
+\r
+    '''\r
+    _heappop, _heapreplace, _StopIteration = heappop, heapreplace, StopIteration\r
+    _len = len\r
+\r
+    h = []\r
+    h_append = h.append\r
+    for itnum, it in enumerate(map(iter, iterables)):\r
+        try:\r
+            next = it.next\r
+            h_append([next(), itnum, next])\r
+        except _StopIteration:\r
+            pass\r
+    heapify(h)\r
+\r
+    while _len(h) > 1:\r
+        try:\r
+            while 1:\r
+                v, itnum, next = s = h[0]\r
+                yield v\r
+                s[0] = next()               # raises StopIteration when exhausted\r
+                _heapreplace(h, s)          # restore heap condition\r
+        except _StopIteration:\r
+            _heappop(h)                     # remove empty iterator\r
+    if h:\r
+        # fast case when only a single iterator remains\r
+        v, itnum, next = h[0]\r
+        yield v\r
+        for v in next.__self__:\r
+            yield v\r
+\r
+# Extend the implementations of nsmallest and nlargest to use a key= argument\r
+_nsmallest = nsmallest\r
+def nsmallest(n, iterable, key=None):\r
+    """Find the n smallest elements in a dataset.\r
+\r
+    Equivalent to:  sorted(iterable, key=key)[:n]\r
+    """\r
+    # Short-cut for n==1 is to use min() when len(iterable)>0\r
+    if n == 1:\r
+        it = iter(iterable)\r
+        head = list(islice(it, 1))\r
+        if not head:\r
+            return []\r
+        if key is None:\r
+            return [min(chain(head, it))]\r
+        return [min(chain(head, it), key=key)]\r
+\r
+    # When n>=size, it's faster to use sorted()\r
+    try:\r
+        size = len(iterable)\r
+    except (TypeError, AttributeError):\r
+        pass\r
+    else:\r
+        if n >= size:\r
+            return sorted(iterable, key=key)[:n]\r
+\r
+    # When key is none, use simpler decoration\r
+    if key is None:\r
+        it = izip(iterable, count())                        # decorate\r
+        result = _nsmallest(n, it)\r
+        return map(itemgetter(0), result)                   # undecorate\r
+\r
+    # General case, slowest method\r
+    in1, in2 = tee(iterable)\r
+    it = izip(imap(key, in1), count(), in2)                 # decorate\r
+    result = _nsmallest(n, it)\r
+    return map(itemgetter(2), result)                       # undecorate\r
+\r
+_nlargest = nlargest\r
+def nlargest(n, iterable, key=None):\r
+    """Find the n largest elements in a dataset.\r
+\r
+    Equivalent to:  sorted(iterable, key=key, reverse=True)[:n]\r
+    """\r
+\r
+    # Short-cut for n==1 is to use max() when len(iterable)>0\r
+    if n == 1:\r
+        it = iter(iterable)\r
+        head = list(islice(it, 1))\r
+        if not head:\r
+            return []\r
+        if key is None:\r
+            return [max(chain(head, it))]\r
+        return [max(chain(head, it), key=key)]\r
+\r
+    # When n>=size, it's faster to use sorted()\r
+    try:\r
+        size = len(iterable)\r
+    except (TypeError, AttributeError):\r
+        pass\r
+    else:\r
+        if n >= size:\r
+            return sorted(iterable, key=key, reverse=True)[:n]\r
+\r
+    # When key is none, use simpler decoration\r
+    if key is None:\r
+        it = izip(iterable, count(0,-1))                    # decorate\r
+        result = _nlargest(n, it)\r
+        return map(itemgetter(0), result)                   # undecorate\r
+\r
+    # General case, slowest method\r
+    in1, in2 = tee(iterable)\r
+    it = izip(imap(key, in1), count(0,-1), in2)             # decorate\r
+    result = _nlargest(n, it)\r
+    return map(itemgetter(2), result)                       # undecorate\r
+\r
+if __name__ == "__main__":\r
+    # Simple sanity test\r
+    heap = []\r
+    data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]\r
+    for item in data:\r
+        heappush(heap, item)\r
+    sort = []\r
+    while heap:\r
+        sort.append(heappop(heap))\r
+    print sort\r
+\r
+    import doctest\r
+    doctest.testmod()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/importlib/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/importlib/__init__.py
new file mode 100644 (file)
index 0000000..a44aea4
--- /dev/null
@@ -0,0 +1,38 @@
+"""Backport of importlib.import_module from 3.x."""\r
+# While not critical (and in no way guaranteed!), it would be nice to keep this\r
+# code compatible with Python 2.3.\r
+import sys\r
+\r
+def _resolve_name(name, package, level):\r
+    """Return the absolute name of the module to be imported."""\r
+    if not hasattr(package, 'rindex'):\r
+        raise ValueError("'package' not set to a string")\r
+    dot = len(package)\r
+    for x in xrange(level, 1, -1):\r
+        try:\r
+            dot = package.rindex('.', 0, dot)\r
+        except ValueError:\r
+            raise ValueError("attempted relative import beyond top-level "\r
+                              "package")\r
+    return "%s.%s" % (package[:dot], name)\r
+\r
+\r
+def import_module(name, package=None):\r
+    """Import a module.\r
+\r
+    The 'package' argument is required when performing a relative import. It\r
+    specifies the package to use as the anchor point from which to resolve the\r
+    relative import to an absolute import.\r
+\r
+    """\r
+    if name.startswith('.'):\r
+        if not package:\r
+            raise TypeError("relative imports require the 'package' argument")\r
+        level = 0\r
+        for character in name:\r
+            if character != '.':\r
+                break\r
+            level += 1\r
+        name = _resolve_name(name[level:], package, level)\r
+    __import__(name)\r
+    return sys.modules[name]\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/inspect.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/inspect.py
new file mode 100644 (file)
index 0000000..ada3873
--- /dev/null
@@ -0,0 +1,1059 @@
+# -*- coding: iso-8859-1 -*-\r
+"""Get useful information from live Python objects.\r
+\r
+This module encapsulates the interface provided by the internal special\r
+attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion.\r
+It also provides some help for examining source code and class layout.\r
+\r
+Here are some of the useful functions provided by this module:\r
+\r
+    ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),\r
+        isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),\r
+        isroutine() - check object types\r
+    getmembers() - get members of an object that satisfy a given condition\r
+\r
+    getfile(), getsourcefile(), getsource() - find an object's source code\r
+    getdoc(), getcomments() - get documentation on an object\r
+    getmodule() - determine the module that an object came from\r
+    getclasstree() - arrange classes so as to represent their hierarchy\r
+\r
+    getargspec(), getargvalues(), getcallargs() - get info about function arguments\r
+    formatargspec(), formatargvalues() - format an argument spec\r
+    getouterframes(), getinnerframes() - get info about frames\r
+    currentframe() - get the current stack frame\r
+    stack(), trace() - get info about frames on the stack or in a traceback\r
+"""\r
+\r
+# This module is in the public domain.  No warranties.\r
+\r
+__author__ = 'Ka-Ping Yee <ping@lfw.org>'\r
+__date__ = '1 Jan 2001'\r
+\r
+import sys\r
+import os\r
+import types\r
+import string\r
+import re\r
+import dis\r
+import imp\r
+import tokenize\r
+import linecache\r
+from operator import attrgetter\r
+from collections import namedtuple\r
+\r
+# These constants are from Include/code.h.\r
+CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 0x1, 0x2, 0x4, 0x8\r
+CO_NESTED, CO_GENERATOR, CO_NOFREE = 0x10, 0x20, 0x40\r
+# See Include/object.h\r
+TPFLAGS_IS_ABSTRACT = 1 << 20\r
+\r
+# ----------------------------------------------------------- type-checking\r
+def ismodule(object):\r
+    """Return true if the object is a module.\r
+\r
+    Module objects provide these attributes:\r
+        __doc__         documentation string\r
+        __file__        filename (missing for built-in modules)"""\r
+    return isinstance(object, types.ModuleType)\r
+\r
+def isclass(object):\r
+    """Return true if the object is a class.\r
+\r
+    Class objects provide these attributes:\r
+        __doc__         documentation string\r
+        __module__      name of module in which this class was defined"""\r
+    return isinstance(object, (type, types.ClassType))\r
+\r
+def ismethod(object):\r
+    """Return true if the object is an instance method.\r
+\r
+    Instance method objects provide these attributes:\r
+        __doc__         documentation string\r
+        __name__        name with which this method was defined\r
+        im_class        class object in which this method belongs\r
+        im_func         function object containing implementation of method\r
+        im_self         instance to which this method is bound, or None"""\r
+    return isinstance(object, types.MethodType)\r
+\r
+def ismethoddescriptor(object):\r
+    """Return true if the object is a method descriptor.\r
+\r
+    But not if ismethod() or isclass() or isfunction() are true.\r
+\r
+    This is new in Python 2.2, and, for example, is true of int.__add__.\r
+    An object passing this test has a __get__ attribute but not a __set__\r
+    attribute, but beyond that the set of attributes varies.  __name__ is\r
+    usually sensible, and __doc__ often is.\r
+\r
+    Methods implemented via descriptors that also pass one of the other\r
+    tests return false from the ismethoddescriptor() test, simply because\r
+    the other tests promise more -- you can, e.g., count on having the\r
+    im_func attribute (etc) when an object passes ismethod()."""\r
+    return (hasattr(object, "__get__")\r
+            and not hasattr(object, "__set__") # else it's a data descriptor\r
+            and not ismethod(object)           # mutual exclusion\r
+            and not isfunction(object)\r
+            and not isclass(object))\r
+\r
+def isdatadescriptor(object):\r
+    """Return true if the object is a data descriptor.\r
+\r
+    Data descriptors have both a __get__ and a __set__ attribute.  Examples are\r
+    properties (defined in Python) and getsets and members (defined in C).\r
+    Typically, data descriptors will also have __name__ and __doc__ attributes\r
+    (properties, getsets, and members have both of these attributes), but this\r
+    is not guaranteed."""\r
+    return (hasattr(object, "__set__") and hasattr(object, "__get__"))\r
+\r
+if hasattr(types, 'MemberDescriptorType'):\r
+    # CPython and equivalent\r
+    def ismemberdescriptor(object):\r
+        """Return true if the object is a member descriptor.\r
+\r
+        Member descriptors are specialized descriptors defined in extension\r
+        modules."""\r
+        return isinstance(object, types.MemberDescriptorType)\r
+else:\r
+    # Other implementations\r
+    def ismemberdescriptor(object):\r
+        """Return true if the object is a member descriptor.\r
+\r
+        Member descriptors are specialized descriptors defined in extension\r
+        modules."""\r
+        return False\r
+\r
+if hasattr(types, 'GetSetDescriptorType'):\r
+    # CPython and equivalent\r
+    def isgetsetdescriptor(object):\r
+        """Return true if the object is a getset descriptor.\r
+\r
+        getset descriptors are specialized descriptors defined in extension\r
+        modules."""\r
+        return isinstance(object, types.GetSetDescriptorType)\r
+else:\r
+    # Other implementations\r
+    def isgetsetdescriptor(object):\r
+        """Return true if the object is a getset descriptor.\r
+\r
+        getset descriptors are specialized descriptors defined in extension\r
+        modules."""\r
+        return False\r
+\r
+def isfunction(object):\r
+    """Return true if the object is a user-defined function.\r
+\r
+    Function objects provide these attributes:\r
+        __doc__         documentation string\r
+        __name__        name with which this function was defined\r
+        func_code       code object containing compiled function bytecode\r
+        func_defaults   tuple of any default values for arguments\r
+        func_doc        (same as __doc__)\r
+        func_globals    global namespace in which this function was defined\r
+        func_name       (same as __name__)"""\r
+    return isinstance(object, types.FunctionType)\r
+\r
+def isgeneratorfunction(object):\r
+    """Return true if the object is a user-defined generator function.\r
+\r
+    Generator function objects provides same attributes as functions.\r
+\r
+    See help(isfunction) for attributes listing."""\r
+    return bool((isfunction(object) or ismethod(object)) and\r
+                object.func_code.co_flags & CO_GENERATOR)\r
+\r
+def isgenerator(object):\r
+    """Return true if the object is a generator.\r
+\r
+    Generator objects provide these attributes:\r
+        __iter__        defined to support iteration over container\r
+        close           raises a new GeneratorExit exception inside the\r
+                        generator to terminate the iteration\r
+        gi_code         code object\r
+        gi_frame        frame object or possibly None once the generator has\r
+                        been exhausted\r
+        gi_running      set to 1 when generator is executing, 0 otherwise\r
+        next            return the next item from the container\r
+        send            resumes the generator and "sends" a value that becomes\r
+                        the result of the current yield-expression\r
+        throw           used to raise an exception inside the generator"""\r
+    return isinstance(object, types.GeneratorType)\r
+\r
+def istraceback(object):\r
+    """Return true if the object is a traceback.\r
+\r
+    Traceback objects provide these attributes:\r
+        tb_frame        frame object at this level\r
+        tb_lasti        index of last attempted instruction in bytecode\r
+        tb_lineno       current line number in Python source code\r
+        tb_next         next inner traceback object (called by this level)"""\r
+    return isinstance(object, types.TracebackType)\r
+\r
+def isframe(object):\r
+    """Return true if the object is a frame object.\r
+\r
+    Frame objects provide these attributes:\r
+        f_back          next outer frame object (this frame's caller)\r
+        f_builtins      built-in namespace seen by this frame\r
+        f_code          code object being executed in this frame\r
+        f_exc_traceback traceback if raised in this frame, or None\r
+        f_exc_type      exception type if raised in this frame, or None\r
+        f_exc_value     exception value if raised in this frame, or None\r
+        f_globals       global namespace seen by this frame\r
+        f_lasti         index of last attempted instruction in bytecode\r
+        f_lineno        current line number in Python source code\r
+        f_locals        local namespace seen by this frame\r
+        f_restricted    0 or 1 if frame is in restricted execution mode\r
+        f_trace         tracing function for this frame, or None"""\r
+    return isinstance(object, types.FrameType)\r
+\r
+def iscode(object):\r
+    """Return true if the object is a code object.\r
+\r
+    Code objects provide these attributes:\r
+        co_argcount     number of arguments (not including * or ** args)\r
+        co_code         string of raw compiled bytecode\r
+        co_consts       tuple of constants used in the bytecode\r
+        co_filename     name of file in which this code object was created\r
+        co_firstlineno  number of first line in Python source code\r
+        co_flags        bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg\r
+        co_lnotab       encoded mapping of line numbers to bytecode indices\r
+        co_name         name with which this code object was defined\r
+        co_names        tuple of names of local variables\r
+        co_nlocals      number of local variables\r
+        co_stacksize    virtual machine stack space required\r
+        co_varnames     tuple of names of arguments and local variables"""\r
+    return isinstance(object, types.CodeType)\r
+\r
+def isbuiltin(object):\r
+    """Return true if the object is a built-in function or method.\r
+\r
+    Built-in functions and methods provide these attributes:\r
+        __doc__         documentation string\r
+        __name__        original name of this function or method\r
+        __self__        instance to which a method is bound, or None"""\r
+    return isinstance(object, types.BuiltinFunctionType)\r
+\r
+def isroutine(object):\r
+    """Return true if the object is any kind of function or method."""\r
+    return (isbuiltin(object)\r
+            or isfunction(object)\r
+            or ismethod(object)\r
+            or ismethoddescriptor(object))\r
+\r
+def isabstract(object):\r
+    """Return true if the object is an abstract base class (ABC)."""\r
+    return bool(isinstance(object, type) and object.__flags__ & TPFLAGS_IS_ABSTRACT)\r
+\r
+def getmembers(object, predicate=None):\r
+    """Return all members of an object as (name, value) pairs sorted by name.\r
+    Optionally, only return members that satisfy a given predicate."""\r
+    results = []\r
+    for key in dir(object):\r
+        try:\r
+            value = getattr(object, key)\r
+        except AttributeError:\r
+            continue\r
+        if not predicate or predicate(value):\r
+            results.append((key, value))\r
+    results.sort()\r
+    return results\r
+\r
+Attribute = namedtuple('Attribute', 'name kind defining_class object')\r
+\r
+def classify_class_attrs(cls):\r
+    """Return list of attribute-descriptor tuples.\r
+\r
+    For each name in dir(cls), the return list contains a 4-tuple\r
+    with these elements:\r
+\r
+        0. The name (a string).\r
+\r
+        1. The kind of attribute this is, one of these strings:\r
+               'class method'    created via classmethod()\r
+               'static method'   created via staticmethod()\r
+               'property'        created via property()\r
+               'method'          any other flavor of method\r
+               'data'            not a method\r
+\r
+        2. The class which defined this attribute (a class).\r
+\r
+        3. The object as obtained directly from the defining class's\r
+           __dict__, not via getattr.  This is especially important for\r
+           data attributes:  C.data is just a data object, but\r
+           C.__dict__['data'] may be a data descriptor with additional\r
+           info, like a __doc__ string.\r
+    """\r
+\r
+    mro = getmro(cls)\r
+    names = dir(cls)\r
+    result = []\r
+    for name in names:\r
+        # Get the object associated with the name, and where it was defined.\r
+        # Getting an obj from the __dict__ sometimes reveals more than\r
+        # using getattr.  Static and class methods are dramatic examples.\r
+        # Furthermore, some objects may raise an Exception when fetched with\r
+        # getattr(). This is the case with some descriptors (bug #1785).\r
+        # Thus, we only use getattr() as a last resort.\r
+        homecls = None\r
+        for base in (cls,) + mro:\r
+            if name in base.__dict__:\r
+                obj = base.__dict__[name]\r
+                homecls = base\r
+                break\r
+        else:\r
+            obj = getattr(cls, name)\r
+            homecls = getattr(obj, "__objclass__", homecls)\r
+\r
+        # Classify the object.\r
+        if isinstance(obj, staticmethod):\r
+            kind = "static method"\r
+        elif isinstance(obj, classmethod):\r
+            kind = "class method"\r
+        elif isinstance(obj, property):\r
+            kind = "property"\r
+        elif ismethoddescriptor(obj):\r
+            kind = "method"\r
+        elif isdatadescriptor(obj):\r
+            kind = "data"\r
+        else:\r
+            obj_via_getattr = getattr(cls, name)\r
+            if (ismethod(obj_via_getattr) or\r
+                ismethoddescriptor(obj_via_getattr)):\r
+                kind = "method"\r
+            else:\r
+                kind = "data"\r
+            obj = obj_via_getattr\r
+\r
+        result.append(Attribute(name, kind, homecls, obj))\r
+\r
+    return result\r
+\r
+# ----------------------------------------------------------- class helpers\r
+def _searchbases(cls, accum):\r
+    # Simulate the "classic class" search order.\r
+    if cls in accum:\r
+        return\r
+    accum.append(cls)\r
+    for base in cls.__bases__:\r
+        _searchbases(base, accum)\r
+\r
+def getmro(cls):\r
+    "Return tuple of base classes (including cls) in method resolution order."\r
+    if hasattr(cls, "__mro__"):\r
+        return cls.__mro__\r
+    else:\r
+        result = []\r
+        _searchbases(cls, result)\r
+        return tuple(result)\r
+\r
+# -------------------------------------------------- source code extraction\r
+def indentsize(line):\r
+    """Return the indent size, in spaces, at the start of a line of text."""\r
+    expline = string.expandtabs(line)\r
+    return len(expline) - len(string.lstrip(expline))\r
+\r
+def getdoc(object):\r
+    """Get the documentation string for an object.\r
+\r
+    All tabs are expanded to spaces.  To clean up docstrings that are\r
+    indented to line up with blocks of code, any whitespace than can be\r
+    uniformly removed from the second line onwards is removed."""\r
+    try:\r
+        doc = object.__doc__\r
+    except AttributeError:\r
+        return None\r
+    if not isinstance(doc, types.StringTypes):\r
+        return None\r
+    return cleandoc(doc)\r
+\r
+def cleandoc(doc):\r
+    """Clean up indentation from docstrings.\r
+\r
+    Any whitespace that can be uniformly removed from the second line\r
+    onwards is removed."""\r
+    try:\r
+        lines = string.split(string.expandtabs(doc), '\n')\r
+    except UnicodeError:\r
+        return None\r
+    else:\r
+        # Find minimum indentation of any non-blank lines after first line.\r
+        margin = sys.maxint\r
+        for line in lines[1:]:\r
+            content = len(string.lstrip(line))\r
+            if content:\r
+                indent = len(line) - content\r
+                margin = min(margin, indent)\r
+        # Remove indentation.\r
+        if lines:\r
+            lines[0] = lines[0].lstrip()\r
+        if margin < sys.maxint:\r
+            for i in range(1, len(lines)): lines[i] = lines[i][margin:]\r
+        # Remove any trailing or leading blank lines.\r
+        while lines and not lines[-1]:\r
+            lines.pop()\r
+        while lines and not lines[0]:\r
+            lines.pop(0)\r
+        return string.join(lines, '\n')\r
+\r
+def getfile(object):\r
+    """Work out which source or compiled file an object was defined in."""\r
+    if ismodule(object):\r
+        if hasattr(object, '__file__'):\r
+            return object.__file__\r
+        raise TypeError('{!r} is a built-in module'.format(object))\r
+    if isclass(object):\r
+        object = sys.modules.get(object.__module__)\r
+        if hasattr(object, '__file__'):\r
+            return object.__file__\r
+        raise TypeError('{!r} is a built-in class'.format(object))\r
+    if ismethod(object):\r
+        object = object.im_func\r
+    if isfunction(object):\r
+        object = object.func_code\r
+    if istraceback(object):\r
+        object = object.tb_frame\r
+    if isframe(object):\r
+        object = object.f_code\r
+    if iscode(object):\r
+        return object.co_filename\r
+    raise TypeError('{!r} is not a module, class, method, '\r
+                    'function, traceback, frame, or code object'.format(object))\r
+\r
+ModuleInfo = namedtuple('ModuleInfo', 'name suffix mode module_type')\r
+\r
+def getmoduleinfo(path):\r
+    """Get the module name, suffix, mode, and module type for a given file."""\r
+    filename = os.path.basename(path)\r
+    suffixes = map(lambda info:\r
+                   (-len(info[0]), info[0], info[1], info[2]),\r
+                    imp.get_suffixes())\r
+    suffixes.sort() # try longest suffixes first, in case they overlap\r
+    for neglen, suffix, mode, mtype in suffixes:\r
+        if filename[neglen:] == suffix:\r
+            return ModuleInfo(filename[:neglen], suffix, mode, mtype)\r
+\r
+def getmodulename(path):\r
+    """Return the module name for a given file, or None."""\r
+    info = getmoduleinfo(path)\r
+    if info: return info[0]\r
+\r
+def getsourcefile(object):\r
+    """Return the filename that can be used to locate an object's source.\r
+    Return None if no way can be identified to get the source.\r
+    """\r
+    filename = getfile(object)\r
+    if string.lower(filename[-4:]) in ('.pyc', '.pyo'):\r
+        filename = filename[:-4] + '.py'\r
+    for suffix, mode, kind in imp.get_suffixes():\r
+        if 'b' in mode and string.lower(filename[-len(suffix):]) == suffix:\r
+            # Looks like a binary file.  We want to only return a text file.\r
+            return None\r
+    if os.path.exists(filename):\r
+        return filename\r
+    # only return a non-existent filename if the module has a PEP 302 loader\r
+    if hasattr(getmodule(object, filename), '__loader__'):\r
+        return filename\r
+    # or it is in the linecache\r
+    if filename in linecache.cache:\r
+        return filename\r
+\r
+def getabsfile(object, _filename=None):\r
+    """Return an absolute path to the source or compiled file for an object.\r
+\r
+    The idea is for each object to have a unique origin, so this routine\r
+    normalizes the result as much as possible."""\r
+    if _filename is None:\r
+        _filename = getsourcefile(object) or getfile(object)\r
+    return os.path.normcase(os.path.abspath(_filename))\r
+\r
+modulesbyfile = {}\r
+_filesbymodname = {}\r
+\r
+def getmodule(object, _filename=None):\r
+    """Return the module an object was defined in, or None if not found."""\r
+    if ismodule(object):\r
+        return object\r
+    if hasattr(object, '__module__'):\r
+        return sys.modules.get(object.__module__)\r
+    # Try the filename to modulename cache\r
+    if _filename is not None and _filename in modulesbyfile:\r
+        return sys.modules.get(modulesbyfile[_filename])\r
+    # Try the cache again with the absolute file name\r
+    try:\r
+        file = getabsfile(object, _filename)\r
+    except TypeError:\r
+        return None\r
+    if file in modulesbyfile:\r
+        return sys.modules.get(modulesbyfile[file])\r
+    # Update the filename to module name cache and check yet again\r
+    # Copy sys.modules in order to cope with changes while iterating\r
+    for modname, module in sys.modules.items():\r
+        if ismodule(module) and hasattr(module, '__file__'):\r
+            f = module.__file__\r
+            if f == _filesbymodname.get(modname, None):\r
+                # Have already mapped this module, so skip it\r
+                continue\r
+            _filesbymodname[modname] = f\r
+            f = getabsfile(module)\r
+            # Always map to the name the module knows itself by\r
+            modulesbyfile[f] = modulesbyfile[\r
+                os.path.realpath(f)] = module.__name__\r
+    if file in modulesbyfile:\r
+        return sys.modules.get(modulesbyfile[file])\r
+    # Check the main module\r
+    main = sys.modules['__main__']\r
+    if not hasattr(object, '__name__'):\r
+        return None\r
+    if hasattr(main, object.__name__):\r
+        mainobject = getattr(main, object.__name__)\r
+        if mainobject is object:\r
+            return main\r
+    # Check builtins\r
+    builtin = sys.modules['__builtin__']\r
+    if hasattr(builtin, object.__name__):\r
+        builtinobject = getattr(builtin, object.__name__)\r
+        if builtinobject is object:\r
+            return builtin\r
+\r
+def findsource(object):\r
+    """Return the entire source file and starting line number for an object.\r
+\r
+    The argument may be a module, class, method, function, traceback, frame,\r
+    or code object.  The source code is returned as a list of all the lines\r
+    in the file and the line number indexes a line in that list.  An IOError\r
+    is raised if the source code cannot be retrieved."""\r
+\r
+    file = getfile(object)\r
+    sourcefile = getsourcefile(object)\r
+    if not sourcefile and file[:1] + file[-1:] != '<>':\r
+        raise IOError('source code not available')\r
+    file = sourcefile if sourcefile else file\r
+\r
+    module = getmodule(object, file)\r
+    if module:\r
+        lines = linecache.getlines(file, module.__dict__)\r
+    else:\r
+        lines = linecache.getlines(file)\r
+    if not lines:\r
+        raise IOError('could not get source code')\r
+\r
+    if ismodule(object):\r
+        return lines, 0\r
+\r
+    if isclass(object):\r
+        name = object.__name__\r
+        pat = re.compile(r'^(\s*)class\s*' + name + r'\b')\r
+        # make some effort to find the best matching class definition:\r
+        # use the one with the least indentation, which is the one\r
+        # that's most probably not inside a function definition.\r
+        candidates = []\r
+        for i in range(len(lines)):\r
+            match = pat.match(lines[i])\r
+            if match:\r
+                # if it's at toplevel, it's already the best one\r
+                if lines[i][0] == 'c':\r
+                    return lines, i\r
+                # else add whitespace to candidate list\r
+                candidates.append((match.group(1), i))\r
+        if candidates:\r
+            # this will sort by whitespace, and by line number,\r
+            # less whitespace first\r
+            candidates.sort()\r
+            return lines, candidates[0][1]\r
+        else:\r
+            raise IOError('could not find class definition')\r
+\r
+    if ismethod(object):\r
+        object = object.im_func\r
+    if isfunction(object):\r
+        object = object.func_code\r
+    if istraceback(object):\r
+        object = object.tb_frame\r
+    if isframe(object):\r
+        object = object.f_code\r
+    if iscode(object):\r
+        if not hasattr(object, 'co_firstlineno'):\r
+            raise IOError('could not find function definition')\r
+        lnum = object.co_firstlineno - 1\r
+        pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)')\r
+        while lnum > 0:\r
+            if pat.match(lines[lnum]): break\r
+            lnum = lnum - 1\r
+        return lines, lnum\r
+    raise IOError('could not find code object')\r
+\r
+def getcomments(object):\r
+    """Get lines of comments immediately preceding an object's source code.\r
+\r
+    Returns None when source can't be found.\r
+    """\r
+    try:\r
+        lines, lnum = findsource(object)\r
+    except (IOError, TypeError):\r
+        return None\r
+\r
+    if ismodule(object):\r
+        # Look for a comment block at the top of the file.\r
+        start = 0\r
+        if lines and lines[0][:2] == '#!': start = 1\r
+        while start < len(lines) and string.strip(lines[start]) in ('', '#'):\r
+            start = start + 1\r
+        if start < len(lines) and lines[start][:1] == '#':\r
+            comments = []\r
+            end = start\r
+            while end < len(lines) and lines[end][:1] == '#':\r
+                comments.append(string.expandtabs(lines[end]))\r
+                end = end + 1\r
+            return string.join(comments, '')\r
+\r
+    # Look for a preceding block of comments at the same indentation.\r
+    elif lnum > 0:\r
+        indent = indentsize(lines[lnum])\r
+        end = lnum - 1\r
+        if end >= 0 and string.lstrip(lines[end])[:1] == '#' and \\r
+            indentsize(lines[end]) == indent:\r
+            comments = [string.lstrip(string.expandtabs(lines[end]))]\r
+            if end > 0:\r
+                end = end - 1\r
+                comment = string.lstrip(string.expandtabs(lines[end]))\r
+                while comment[:1] == '#' and indentsize(lines[end]) == indent:\r
+                    comments[:0] = [comment]\r
+                    end = end - 1\r
+                    if end < 0: break\r
+                    comment = string.lstrip(string.expandtabs(lines[end]))\r
+            while comments and string.strip(comments[0]) == '#':\r
+                comments[:1] = []\r
+            while comments and string.strip(comments[-1]) == '#':\r
+                comments[-1:] = []\r
+            return string.join(comments, '')\r
+\r
+class EndOfBlock(Exception): pass\r
+\r
+class BlockFinder:\r
+    """Provide a tokeneater() method to detect the end of a code block."""\r
+    def __init__(self):\r
+        self.indent = 0\r
+        self.islambda = False\r
+        self.started = False\r
+        self.passline = False\r
+        self.last = 1\r
+\r
+    def tokeneater(self, type, token, srow_scol, erow_ecol, line):\r
+        srow, scol = srow_scol\r
+        erow, ecol = erow_ecol\r
+        if not self.started:\r
+            # look for the first "def", "class" or "lambda"\r
+            if token in ("def", "class", "lambda"):\r
+                if token == "lambda":\r
+                    self.islambda = True\r
+                self.started = True\r
+            self.passline = True    # skip to the end of the line\r
+        elif type == tokenize.NEWLINE:\r
+            self.passline = False   # stop skipping when a NEWLINE is seen\r
+            self.last = srow\r
+            if self.islambda:       # lambdas always end at the first NEWLINE\r
+                raise EndOfBlock\r
+        elif self.passline:\r
+            pass\r
+        elif type == tokenize.INDENT:\r
+            self.indent = self.indent + 1\r
+            self.passline = True\r
+        elif type == tokenize.DEDENT:\r
+            self.indent = self.indent - 1\r
+            # the end of matching indent/dedent pairs end a block\r
+            # (note that this only works for "def"/"class" blocks,\r
+            #  not e.g. for "if: else:" or "try: finally:" blocks)\r
+            if self.indent <= 0:\r
+                raise EndOfBlock\r
+        elif self.indent == 0 and type not in (tokenize.COMMENT, tokenize.NL):\r
+            # any other token on the same indentation level end the previous\r
+            # block as well, except the pseudo-tokens COMMENT and NL.\r
+            raise EndOfBlock\r
+\r
+def getblock(lines):\r
+    """Extract the block of code at the top of the given list of lines."""\r
+    blockfinder = BlockFinder()\r
+    try:\r
+        tokenize.tokenize(iter(lines).next, blockfinder.tokeneater)\r
+    except (EndOfBlock, IndentationError):\r
+        pass\r
+    return lines[:blockfinder.last]\r
+\r
+def getsourcelines(object):\r
+    """Return a list of source lines and starting line number for an object.\r
+\r
+    The argument may be a module, class, method, function, traceback, frame,\r
+    or code object.  The source code is returned as a list of the lines\r
+    corresponding to the object and the line number indicates where in the\r
+    original source file the first line of code was found.  An IOError is\r
+    raised if the source code cannot be retrieved."""\r
+    lines, lnum = findsource(object)\r
+\r
+    if ismodule(object): return lines, 0\r
+    else: return getblock(lines[lnum:]), lnum + 1\r
+\r
+def getsource(object):\r
+    """Return the text of the source code for an object.\r
+\r
+    The argument may be a module, class, method, function, traceback, frame,\r
+    or code object.  The source code is returned as a single string.  An\r
+    IOError is raised if the source code cannot be retrieved."""\r
+    lines, lnum = getsourcelines(object)\r
+    return string.join(lines, '')\r
+\r
+# --------------------------------------------------- class tree extraction\r
+def walktree(classes, children, parent):\r
+    """Recursive helper function for getclasstree()."""\r
+    results = []\r
+    classes.sort(key=attrgetter('__module__', '__name__'))\r
+    for c in classes:\r
+        results.append((c, c.__bases__))\r
+        if c in children:\r
+            results.append(walktree(children[c], children, c))\r
+    return results\r
+\r
+def getclasstree(classes, unique=0):\r
+    """Arrange the given list of classes into a hierarchy of nested lists.\r
+\r
+    Where a nested list appears, it contains classes derived from the class\r
+    whose entry immediately precedes the list.  Each entry is a 2-tuple\r
+    containing a class and a tuple of its base classes.  If the 'unique'\r
+    argument is true, exactly one entry appears in the returned structure\r
+    for each class in the given list.  Otherwise, classes using multiple\r
+    inheritance and their descendants will appear multiple times."""\r
+    children = {}\r
+    roots = []\r
+    for c in classes:\r
+        if c.__bases__:\r
+            for parent in c.__bases__:\r
+                if not parent in children:\r
+                    children[parent] = []\r
+                if c not in children[parent]:\r
+                    children[parent].append(c)\r
+                if unique and parent in classes: break\r
+        elif c not in roots:\r
+            roots.append(c)\r
+    for parent in children:\r
+        if parent not in classes:\r
+            roots.append(parent)\r
+    return walktree(roots, children, None)\r
+\r
+# ------------------------------------------------ argument list extraction\r
+Arguments = namedtuple('Arguments', 'args varargs keywords')\r
+\r
+def getargs(co):\r
+    """Get information about the arguments accepted by a code object.\r
+\r
+    Three things are returned: (args, varargs, varkw), where 'args' is\r
+    a list of argument names (possibly containing nested lists), and\r
+    'varargs' and 'varkw' are the names of the * and ** arguments or None."""\r
+\r
+    if not iscode(co):\r
+        raise TypeError('{!r} is not a code object'.format(co))\r
+\r
+    nargs = co.co_argcount\r
+    names = co.co_varnames\r
+    args = list(names[:nargs])\r
+    step = 0\r
+\r
+    # The following acrobatics are for anonymous (tuple) arguments.\r
+    for i in range(nargs):\r
+        if args[i][:1] in ('', '.'):\r
+            stack, remain, count = [], [], []\r
+            while step < len(co.co_code):\r
+                op = ord(co.co_code[step])\r
+                step = step + 1\r
+                if op >= dis.HAVE_ARGUMENT:\r
+                    opname = dis.opname[op]\r
+                    value = ord(co.co_code[step]) + ord(co.co_code[step+1])*256\r
+                    step = step + 2\r
+                    if opname in ('UNPACK_TUPLE', 'UNPACK_SEQUENCE'):\r
+                        remain.append(value)\r
+                        count.append(value)\r
+                    elif opname == 'STORE_FAST':\r
+                        stack.append(names[value])\r
+\r
+                        # Special case for sublists of length 1: def foo((bar))\r
+                        # doesn't generate the UNPACK_TUPLE bytecode, so if\r
+                        # `remain` is empty here, we have such a sublist.\r
+                        if not remain:\r
+                            stack[0] = [stack[0]]\r
+                            break\r
+                        else:\r
+                            remain[-1] = remain[-1] - 1\r
+                            while remain[-1] == 0:\r
+                                remain.pop()\r
+                                size = count.pop()\r
+                                stack[-size:] = [stack[-size:]]\r
+                                if not remain: break\r
+                                remain[-1] = remain[-1] - 1\r
+                            if not remain: break\r
+            args[i] = stack[0]\r
+\r
+    varargs = None\r
+    if co.co_flags & CO_VARARGS:\r
+        varargs = co.co_varnames[nargs]\r
+        nargs = nargs + 1\r
+    varkw = None\r
+    if co.co_flags & CO_VARKEYWORDS:\r
+        varkw = co.co_varnames[nargs]\r
+    return Arguments(args, varargs, varkw)\r
+\r
+ArgSpec = namedtuple('ArgSpec', 'args varargs keywords defaults')\r
+\r
+def getargspec(func):\r
+    """Get the names and default values of a function's arguments.\r
+\r
+    A tuple of four things is returned: (args, varargs, varkw, defaults).\r
+    'args' is a list of the argument names (it may contain nested lists).\r
+    'varargs' and 'varkw' are the names of the * and ** arguments or None.\r
+    'defaults' is an n-tuple of the default values of the last n arguments.\r
+    """\r
+\r
+    if ismethod(func):\r
+        func = func.im_func\r
+    if not isfunction(func):\r
+        raise TypeError('{!r} is not a Python function'.format(func))\r
+    args, varargs, varkw = getargs(func.func_code)\r
+    return ArgSpec(args, varargs, varkw, func.func_defaults)\r
+\r
+ArgInfo = namedtuple('ArgInfo', 'args varargs keywords locals')\r
+\r
+def getargvalues(frame):\r
+    """Get information about arguments passed into a particular frame.\r
+\r
+    A tuple of four things is returned: (args, varargs, varkw, locals).\r
+    'args' is a list of the argument names (it may contain nested lists).\r
+    'varargs' and 'varkw' are the names of the * and ** arguments or None.\r
+    'locals' is the locals dictionary of the given frame."""\r
+    args, varargs, varkw = getargs(frame.f_code)\r
+    return ArgInfo(args, varargs, varkw, frame.f_locals)\r
+\r
+def joinseq(seq):\r
+    if len(seq) == 1:\r
+        return '(' + seq[0] + ',)'\r
+    else:\r
+        return '(' + string.join(seq, ', ') + ')'\r
+\r
+def strseq(object, convert, join=joinseq):\r
+    """Recursively walk a sequence, stringifying each element."""\r
+    if type(object) in (list, tuple):\r
+        return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object))\r
+    else:\r
+        return convert(object)\r
+\r
+def formatargspec(args, varargs=None, varkw=None, defaults=None,\r
+                  formatarg=str,\r
+                  formatvarargs=lambda name: '*' + name,\r
+                  formatvarkw=lambda name: '**' + name,\r
+                  formatvalue=lambda value: '=' + repr(value),\r
+                  join=joinseq):\r
+    """Format an argument spec from the 4 values returned by getargspec.\r
+\r
+    The first four arguments are (args, varargs, varkw, defaults).  The\r
+    other four arguments are the corresponding optional formatting functions\r
+    that are called to turn names and values into strings.  The ninth\r
+    argument is an optional function to format the sequence of arguments."""\r
+    specs = []\r
+    if defaults:\r
+        firstdefault = len(args) - len(defaults)\r
+    for i, arg in enumerate(args):\r
+        spec = strseq(arg, formatarg, join)\r
+        if defaults and i >= firstdefault:\r
+            spec = spec + formatvalue(defaults[i - firstdefault])\r
+        specs.append(spec)\r
+    if varargs is not None:\r
+        specs.append(formatvarargs(varargs))\r
+    if varkw is not None:\r
+        specs.append(formatvarkw(varkw))\r
+    return '(' + string.join(specs, ', ') + ')'\r
+\r
+def formatargvalues(args, varargs, varkw, locals,\r
+                    formatarg=str,\r
+                    formatvarargs=lambda name: '*' + name,\r
+                    formatvarkw=lambda name: '**' + name,\r
+                    formatvalue=lambda value: '=' + repr(value),\r
+                    join=joinseq):\r
+    """Format an argument spec from the 4 values returned by getargvalues.\r
+\r
+    The first four arguments are (args, varargs, varkw, locals).  The\r
+    next four arguments are the corresponding optional formatting functions\r
+    that are called to turn names and values into strings.  The ninth\r
+    argument is an optional function to format the sequence of arguments."""\r
+    def convert(name, locals=locals,\r
+                formatarg=formatarg, formatvalue=formatvalue):\r
+        return formatarg(name) + formatvalue(locals[name])\r
+    specs = []\r
+    for i in range(len(args)):\r
+        specs.append(strseq(args[i], convert, join))\r
+    if varargs:\r
+        specs.append(formatvarargs(varargs) + formatvalue(locals[varargs]))\r
+    if varkw:\r
+        specs.append(formatvarkw(varkw) + formatvalue(locals[varkw]))\r
+    return '(' + string.join(specs, ', ') + ')'\r
+\r
+def getcallargs(func, *positional, **named):\r
+    """Get the mapping of arguments to values.\r
+\r
+    A dict is returned, with keys the function argument names (including the\r
+    names of the * and ** arguments, if any), and values the respective bound\r
+    values from 'positional' and 'named'."""\r
+    args, varargs, varkw, defaults = getargspec(func)\r
+    f_name = func.__name__\r
+    arg2value = {}\r
+\r
+    # The following closures are basically because of tuple parameter unpacking.\r
+    assigned_tuple_params = []\r
+    def assign(arg, value):\r
+        if isinstance(arg, str):\r
+            arg2value[arg] = value\r
+        else:\r
+            assigned_tuple_params.append(arg)\r
+            value = iter(value)\r
+            for i, subarg in enumerate(arg):\r
+                try:\r
+                    subvalue = next(value)\r
+                except StopIteration:\r
+                    raise ValueError('need more than %d %s to unpack' %\r
+                                     (i, 'values' if i > 1 else 'value'))\r
+                assign(subarg,subvalue)\r
+            try:\r
+                next(value)\r
+            except StopIteration:\r
+                pass\r
+            else:\r
+                raise ValueError('too many values to unpack')\r
+    def is_assigned(arg):\r
+        if isinstance(arg,str):\r
+            return arg in arg2value\r
+        return arg in assigned_tuple_params\r
+    if ismethod(func) and func.im_self is not None:\r
+        # implicit 'self' (or 'cls' for classmethods) argument\r
+        positional = (func.im_self,) + positional\r
+    num_pos = len(positional)\r
+    num_total = num_pos + len(named)\r
+    num_args = len(args)\r
+    num_defaults = len(defaults) if defaults else 0\r
+    for arg, value in zip(args, positional):\r
+        assign(arg, value)\r
+    if varargs:\r
+        if num_pos > num_args:\r
+            assign(varargs, positional[-(num_pos-num_args):])\r
+        else:\r
+            assign(varargs, ())\r
+    elif 0 < num_args < num_pos:\r
+        raise TypeError('%s() takes %s %d %s (%d given)' % (\r
+            f_name, 'at most' if defaults else 'exactly', num_args,\r
+            'arguments' if num_args > 1 else 'argument', num_total))\r
+    elif num_args == 0 and num_total:\r
+        if varkw:\r
+            if num_pos:\r
+                # XXX: We should use num_pos, but Python also uses num_total:\r
+                raise TypeError('%s() takes exactly 0 arguments '\r
+                                '(%d given)' % (f_name, num_total))\r
+        else:\r
+            raise TypeError('%s() takes no arguments (%d given)' %\r
+                            (f_name, num_total))\r
+    for arg in args:\r
+        if isinstance(arg, str) and arg in named:\r
+            if is_assigned(arg):\r
+                raise TypeError("%s() got multiple values for keyword "\r
+                                "argument '%s'" % (f_name, arg))\r
+            else:\r
+                assign(arg, named.pop(arg))\r
+    if defaults:    # fill in any missing values with the defaults\r
+        for arg, value in zip(args[-num_defaults:], defaults):\r
+            if not is_assigned(arg):\r
+                assign(arg, value)\r
+    if varkw:\r
+        assign(varkw, named)\r
+    elif named:\r
+        unexpected = next(iter(named))\r
+        if isinstance(unexpected, unicode):\r
+            unexpected = unexpected.encode(sys.getdefaultencoding(), 'replace')\r
+        raise TypeError("%s() got an unexpected keyword argument '%s'" %\r
+                        (f_name, unexpected))\r
+    unassigned = num_args - len([arg for arg in args if is_assigned(arg)])\r
+    if unassigned:\r
+        num_required = num_args - num_defaults\r
+        raise TypeError('%s() takes %s %d %s (%d given)' % (\r
+            f_name, 'at least' if defaults else 'exactly', num_required,\r
+            'arguments' if num_required > 1 else 'argument', num_total))\r
+    return arg2value\r
+\r
+# -------------------------------------------------- stack frame extraction\r
+\r
+Traceback = namedtuple('Traceback', 'filename lineno function code_context index')\r
+\r
+def getframeinfo(frame, context=1):\r
+    """Get information about a frame or traceback object.\r
+\r
+    A tuple of five things is returned: the filename, the line number of\r
+    the current line, the function name, a list of lines of context from\r
+    the source code, and the index of the current line within that list.\r
+    The optional second argument specifies the number of lines of context\r
+    to return, which are centered around the current line."""\r
+    if istraceback(frame):\r
+        lineno = frame.tb_lineno\r
+        frame = frame.tb_frame\r
+    else:\r
+        lineno = frame.f_lineno\r
+    if not isframe(frame):\r
+        raise TypeError('{!r} is not a frame or traceback object'.format(frame))\r
+\r
+    filename = getsourcefile(frame) or getfile(frame)\r
+    if context > 0:\r
+        start = lineno - 1 - context//2\r
+        try:\r
+            lines, lnum = findsource(frame)\r
+        except IOError:\r
+            lines = index = None\r
+        else:\r
+            start = max(start, 1)\r
+            start = max(0, min(start, len(lines) - context))\r
+            lines = lines[start:start+context]\r
+            index = lineno - 1 - start\r
+    else:\r
+        lines = index = None\r
+\r
+    return Traceback(filename, lineno, frame.f_code.co_name, lines, index)\r
+\r
+def getlineno(frame):\r
+    """Get the line number from a frame object, allowing for optimization."""\r
+    # FrameType.f_lineno is now a descriptor that grovels co_lnotab\r
+    return frame.f_lineno\r
+\r
+def getouterframes(frame, context=1):\r
+    """Get a list of records for a frame and all higher (calling) frames.\r
+\r
+    Each record contains a frame object, filename, line number, function\r
+    name, a list of lines of context, and index within the context."""\r
+    framelist = []\r
+    while frame:\r
+        framelist.append((frame,) + getframeinfo(frame, context))\r
+        frame = frame.f_back\r
+    return framelist\r
+\r
+def getinnerframes(tb, context=1):\r
+    """Get a list of records for a traceback's frame and all lower frames.\r
+\r
+    Each record contains a frame object, filename, line number, function\r
+    name, a list of lines of context, and index within the context."""\r
+    framelist = []\r
+    while tb:\r
+        framelist.append((tb.tb_frame,) + getframeinfo(tb, context))\r
+        tb = tb.tb_next\r
+    return framelist\r
+\r
+if hasattr(sys, '_getframe'):\r
+    currentframe = sys._getframe\r
+else:\r
+    currentframe = lambda _=None: None\r
+\r
+def stack(context=1):\r
+    """Return a list of records for the stack above the caller's frame."""\r
+    return getouterframes(sys._getframe(1), context)\r
+\r
+def trace(context=1):\r
+    """Return a list of records for the stack below the current exception."""\r
+    return getinnerframes(sys.exc_info()[2], context)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/io.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/io.py
new file mode 100644 (file)
index 0000000..e047147
--- /dev/null
@@ -0,0 +1,90 @@
+"""The io module provides the Python interfaces to stream handling. The\r
+builtin open function is defined in this module.\r
+\r
+At the top of the I/O hierarchy is the abstract base class IOBase. It\r
+defines the basic interface to a stream. Note, however, that there is no\r
+separation between reading and writing to streams; implementations are\r
+allowed to raise an IOError if they do not support a given operation.\r
+\r
+Extending IOBase is RawIOBase which deals simply with the reading and\r
+writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide\r
+an interface to OS files.\r
+\r
+BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its\r
+subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer\r
+streams that are readable, writable, and both respectively.\r
+BufferedRandom provides a buffered interface to random access\r
+streams. BytesIO is a simple stream of in-memory bytes.\r
+\r
+Another IOBase subclass, TextIOBase, deals with the encoding and decoding\r
+of streams into text. TextIOWrapper, which extends it, is a buffered text\r
+interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO\r
+is a in-memory stream for text.\r
+\r
+Argument names are not part of the specification, and only the arguments\r
+of open() are intended to be used as keyword arguments.\r
+\r
+data:\r
+\r
+DEFAULT_BUFFER_SIZE\r
+\r
+   An int containing the default buffer size used by the module's buffered\r
+   I/O classes. open() uses the file's blksize (as obtained by os.stat) if\r
+   possible.\r
+"""\r
+# New I/O library conforming to PEP 3116.\r
+\r
+__author__ = ("Guido van Rossum <guido@python.org>, "\r
+              "Mike Verdone <mike.verdone@gmail.com>, "\r
+              "Mark Russell <mark.russell@zen.co.uk>, "\r
+              "Antoine Pitrou <solipsis@pitrou.net>, "\r
+              "Amaury Forgeot d'Arc <amauryfa@gmail.com>, "\r
+              "Benjamin Peterson <benjamin@python.org>")\r
+\r
+__all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO",\r
+           "BytesIO", "StringIO", "BufferedIOBase",\r
+           "BufferedReader", "BufferedWriter", "BufferedRWPair",\r
+           "BufferedRandom", "TextIOBase", "TextIOWrapper",\r
+           "UnsupportedOperation", "SEEK_SET", "SEEK_CUR", "SEEK_END"]\r
+\r
+\r
+import _io\r
+import abc\r
+\r
+from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,\r
+                 open, FileIO, BytesIO, StringIO, BufferedReader,\r
+                 BufferedWriter, BufferedRWPair, BufferedRandom,\r
+                 IncrementalNewlineDecoder, TextIOWrapper)\r
+\r
+OpenWrapper = _io.open # for compatibility with _pyio\r
+\r
+# for seek()\r
+SEEK_SET = 0\r
+SEEK_CUR = 1\r
+SEEK_END = 2\r
+\r
+# Declaring ABCs in C is tricky so we do it here.\r
+# Method descriptions and default implementations are inherited from the C\r
+# version however.\r
+class IOBase(_io._IOBase):\r
+    __metaclass__ = abc.ABCMeta\r
+    __doc__ = _io._IOBase.__doc__\r
+\r
+class RawIOBase(_io._RawIOBase, IOBase):\r
+    __doc__ = _io._RawIOBase.__doc__\r
+\r
+class BufferedIOBase(_io._BufferedIOBase, IOBase):\r
+    __doc__ = _io._BufferedIOBase.__doc__\r
+\r
+class TextIOBase(_io._TextIOBase, IOBase):\r
+    __doc__ = _io._TextIOBase.__doc__\r
+\r
+RawIOBase.register(FileIO)\r
+\r
+for klass in (BytesIO, BufferedReader, BufferedWriter, BufferedRandom,\r
+              BufferedRWPair):\r
+    BufferedIOBase.register(klass)\r
+\r
+for klass in (StringIO, TextIOWrapper):\r
+    TextIOBase.register(klass)\r
+del klass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/__init__.py
new file mode 100644 (file)
index 0000000..dafae51
--- /dev/null
@@ -0,0 +1,351 @@
+r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of\r
+JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\r
+interchange format.\r
+\r
+:mod:`json` exposes an API familiar to users of the standard library\r
+:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained\r
+version of the :mod:`json` library contained in Python 2.6, but maintains\r
+compatibility with Python 2.4 and Python 2.5 and (currently) has\r
+significant performance advantages, even without using the optional C\r
+extension for speedups.\r
+\r
+Encoding basic Python object hierarchies::\r
+\r
+    >>> import json\r
+    >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])\r
+    '["foo", {"bar": ["baz", null, 1.0, 2]}]'\r
+    >>> print json.dumps("\"foo\bar")\r
+    "\"foo\bar"\r
+    >>> print json.dumps(u'\u1234')\r
+    "\u1234"\r
+    >>> print json.dumps('\\')\r
+    "\\"\r
+    >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)\r
+    {"a": 0, "b": 0, "c": 0}\r
+    >>> from StringIO import StringIO\r
+    >>> io = StringIO()\r
+    >>> json.dump(['streaming API'], io)\r
+    >>> io.getvalue()\r
+    '["streaming API"]'\r
+\r
+Compact encoding::\r
+\r
+    >>> import json\r
+    >>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':'))\r
+    '[1,2,3,{"4":5,"6":7}]'\r
+\r
+Pretty printing::\r
+\r
+    >>> import json\r
+    >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True,\r
+    ...                  indent=4, separators=(',', ': '))\r
+    {\r
+        "4": 5,\r
+        "6": 7\r
+    }\r
+\r
+Decoding JSON::\r
+\r
+    >>> import json\r
+    >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]\r
+    >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj\r
+    True\r
+    >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'\r
+    True\r
+    >>> from StringIO import StringIO\r
+    >>> io = StringIO('["streaming API"]')\r
+    >>> json.load(io)[0] == 'streaming API'\r
+    True\r
+\r
+Specializing JSON object decoding::\r
+\r
+    >>> import json\r
+    >>> def as_complex(dct):\r
+    ...     if '__complex__' in dct:\r
+    ...         return complex(dct['real'], dct['imag'])\r
+    ...     return dct\r
+    ...\r
+    >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',\r
+    ...     object_hook=as_complex)\r
+    (1+2j)\r
+    >>> from decimal import Decimal\r
+    >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1')\r
+    True\r
+\r
+Specializing JSON object encoding::\r
+\r
+    >>> import json\r
+    >>> def encode_complex(obj):\r
+    ...     if isinstance(obj, complex):\r
+    ...         return [obj.real, obj.imag]\r
+    ...     raise TypeError(repr(o) + " is not JSON serializable")\r
+    ...\r
+    >>> json.dumps(2 + 1j, default=encode_complex)\r
+    '[2.0, 1.0]'\r
+    >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j)\r
+    '[2.0, 1.0]'\r
+    >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))\r
+    '[2.0, 1.0]'\r
+\r
+\r
+Using json.tool from the shell to validate and pretty-print::\r
+\r
+    $ echo '{"json":"obj"}' | python -m json.tool\r
+    {\r
+        "json": "obj"\r
+    }\r
+    $ echo '{ 1.2:3.4}' | python -m json.tool\r
+    Expecting property name enclosed in double quotes: line 1 column 3 (char 2)\r
+"""\r
+__version__ = '2.0.9'\r
+__all__ = [\r
+    'dump', 'dumps', 'load', 'loads',\r
+    'JSONDecoder', 'JSONEncoder',\r
+]\r
+\r
+__author__ = 'Bob Ippolito <bob@redivi.com>'\r
+\r
+from .decoder import JSONDecoder\r
+from .encoder import JSONEncoder\r
+\r
+_default_encoder = JSONEncoder(\r
+    skipkeys=False,\r
+    ensure_ascii=True,\r
+    check_circular=True,\r
+    allow_nan=True,\r
+    indent=None,\r
+    separators=None,\r
+    encoding='utf-8',\r
+    default=None,\r
+)\r
+\r
+def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,\r
+        allow_nan=True, cls=None, indent=None, separators=None,\r
+        encoding='utf-8', default=None, sort_keys=False, **kw):\r
+    """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\r
+    ``.write()``-supporting file-like object).\r
+\r
+    If ``skipkeys`` is true then ``dict`` keys that are not basic types\r
+    (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\r
+    will be skipped instead of raising a ``TypeError``.\r
+\r
+    If ``ensure_ascii`` is true (the default), all non-ASCII characters in the\r
+    output are escaped with ``\uXXXX`` sequences, and the result is a ``str``\r
+    instance consisting of ASCII characters only.  If ``ensure_ascii`` is\r
+    ``False``, some chunks written to ``fp`` may be ``unicode`` instances.\r
+    This usually happens because the input contains unicode strings or the\r
+    ``encoding`` parameter is used. Unless ``fp.write()`` explicitly\r
+    understands ``unicode`` (as in ``codecs.getwriter``) this is likely to\r
+    cause an error.\r
+\r
+    If ``check_circular`` is false, then the circular reference check\r
+    for container types will be skipped and a circular reference will\r
+    result in an ``OverflowError`` (or worse).\r
+\r
+    If ``allow_nan`` is false, then it will be a ``ValueError`` to\r
+    serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)\r
+    in strict compliance of the JSON specification, instead of using the\r
+    JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).\r
+\r
+    If ``indent`` is a non-negative integer, then JSON array elements and\r
+    object members will be pretty-printed with that indent level. An indent\r
+    level of 0 will only insert newlines. ``None`` is the most compact\r
+    representation.  Since the default item separator is ``', '``,  the\r
+    output might include trailing whitespace when ``indent`` is specified.\r
+    You can use ``separators=(',', ': ')`` to avoid this.\r
+\r
+    If ``separators`` is an ``(item_separator, dict_separator)`` tuple\r
+    then it will be used instead of the default ``(', ', ': ')`` separators.\r
+    ``(',', ':')`` is the most compact JSON representation.\r
+\r
+    ``encoding`` is the character encoding for str instances, default is UTF-8.\r
+\r
+    ``default(obj)`` is a function that should return a serializable version\r
+    of obj or raise TypeError. The default simply raises TypeError.\r
+\r
+    If *sort_keys* is ``True`` (default: ``False``), then the output of\r
+    dictionaries will be sorted by key.\r
+\r
+    To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the\r
+    ``.default()`` method to serialize additional types), specify it with\r
+    the ``cls`` kwarg; otherwise ``JSONEncoder`` is used.\r
+\r
+    """\r
+    # cached encoder\r
+    if (not skipkeys and ensure_ascii and\r
+        check_circular and allow_nan and\r
+        cls is None and indent is None and separators is None and\r
+        encoding == 'utf-8' and default is None and not sort_keys and not kw):\r
+        iterable = _default_encoder.iterencode(obj)\r
+    else:\r
+        if cls is None:\r
+            cls = JSONEncoder\r
+        iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,\r
+            check_circular=check_circular, allow_nan=allow_nan, indent=indent,\r
+            separators=separators, encoding=encoding,\r
+            default=default, sort_keys=sort_keys, **kw).iterencode(obj)\r
+    # could accelerate with writelines in some versions of Python, at\r
+    # a debuggability cost\r
+    for chunk in iterable:\r
+        fp.write(chunk)\r
+\r
+\r
+def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,\r
+        allow_nan=True, cls=None, indent=None, separators=None,\r
+        encoding='utf-8', default=None, sort_keys=False, **kw):\r
+    """Serialize ``obj`` to a JSON formatted ``str``.\r
+\r
+    If ``skipkeys`` is false then ``dict`` keys that are not basic types\r
+    (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\r
+    will be skipped instead of raising a ``TypeError``.\r
+\r
+    If ``ensure_ascii`` is false, all non-ASCII characters are not escaped, and\r
+    the return value may be a ``unicode`` instance. See ``dump`` for details.\r
+\r
+    If ``check_circular`` is false, then the circular reference check\r
+    for container types will be skipped and a circular reference will\r
+    result in an ``OverflowError`` (or worse).\r
+\r
+    If ``allow_nan`` is false, then it will be a ``ValueError`` to\r
+    serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in\r
+    strict compliance of the JSON specification, instead of using the\r
+    JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).\r
+\r
+    If ``indent`` is a non-negative integer, then JSON array elements and\r
+    object members will be pretty-printed with that indent level. An indent\r
+    level of 0 will only insert newlines. ``None`` is the most compact\r
+    representation.  Since the default item separator is ``', '``,  the\r
+    output might include trailing whitespace when ``indent`` is specified.\r
+    You can use ``separators=(',', ': ')`` to avoid this.\r
+\r
+    If ``separators`` is an ``(item_separator, dict_separator)`` tuple\r
+    then it will be used instead of the default ``(', ', ': ')`` separators.\r
+    ``(',', ':')`` is the most compact JSON representation.\r
+\r
+    ``encoding`` is the character encoding for str instances, default is UTF-8.\r
+\r
+    ``default(obj)`` is a function that should return a serializable version\r
+    of obj or raise TypeError. The default simply raises TypeError.\r
+\r
+    If *sort_keys* is ``True`` (default: ``False``), then the output of\r
+    dictionaries will be sorted by key.\r
+\r
+    To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the\r
+    ``.default()`` method to serialize additional types), specify it with\r
+    the ``cls`` kwarg; otherwise ``JSONEncoder`` is used.\r
+\r
+    """\r
+    # cached encoder\r
+    if (not skipkeys and ensure_ascii and\r
+        check_circular and allow_nan and\r
+        cls is None and indent is None and separators is None and\r
+        encoding == 'utf-8' and default is None and not sort_keys and not kw):\r
+        return _default_encoder.encode(obj)\r
+    if cls is None:\r
+        cls = JSONEncoder\r
+    return cls(\r
+        skipkeys=skipkeys, ensure_ascii=ensure_ascii,\r
+        check_circular=check_circular, allow_nan=allow_nan, indent=indent,\r
+        separators=separators, encoding=encoding, default=default,\r
+        sort_keys=sort_keys, **kw).encode(obj)\r
+\r
+\r
+_default_decoder = JSONDecoder(encoding=None, object_hook=None,\r
+                               object_pairs_hook=None)\r
+\r
+\r
+def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,\r
+        parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):\r
+    """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\r
+    a JSON document) to a Python object.\r
+\r
+    If the contents of ``fp`` is encoded with an ASCII based encoding other\r
+    than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must\r
+    be specified. Encodings that are not ASCII based (such as UCS-2) are\r
+    not allowed, and should be wrapped with\r
+    ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode``\r
+    object and passed to ``loads()``\r
+\r
+    ``object_hook`` is an optional function that will be called with the\r
+    result of any object literal decode (a ``dict``). The return value of\r
+    ``object_hook`` will be used instead of the ``dict``. This feature\r
+    can be used to implement custom decoders (e.g. JSON-RPC class hinting).\r
+\r
+    ``object_pairs_hook`` is an optional function that will be called with the\r
+    result of any object literal decoded with an ordered list of pairs.  The\r
+    return value of ``object_pairs_hook`` will be used instead of the ``dict``.\r
+    This feature can be used to implement custom decoders that rely on the\r
+    order that the key and value pairs are decoded (for example,\r
+    collections.OrderedDict will remember the order of insertion). If\r
+    ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority.\r
+\r
+    To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``\r
+    kwarg; otherwise ``JSONDecoder`` is used.\r
+\r
+    """\r
+    return loads(fp.read(),\r
+        encoding=encoding, cls=cls, object_hook=object_hook,\r
+        parse_float=parse_float, parse_int=parse_int,\r
+        parse_constant=parse_constant, object_pairs_hook=object_pairs_hook,\r
+        **kw)\r
+\r
+\r
+def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,\r
+        parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):\r
+    """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\r
+    document) to a Python object.\r
+\r
+    If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding\r
+    other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name\r
+    must be specified. Encodings that are not ASCII based (such as UCS-2)\r
+    are not allowed and should be decoded to ``unicode`` first.\r
+\r
+    ``object_hook`` is an optional function that will be called with the\r
+    result of any object literal decode (a ``dict``). The return value of\r
+    ``object_hook`` will be used instead of the ``dict``. This feature\r
+    can be used to implement custom decoders (e.g. JSON-RPC class hinting).\r
+\r
+    ``object_pairs_hook`` is an optional function that will be called with the\r
+    result of any object literal decoded with an ordered list of pairs.  The\r
+    return value of ``object_pairs_hook`` will be used instead of the ``dict``.\r
+    This feature can be used to implement custom decoders that rely on the\r
+    order that the key and value pairs are decoded (for example,\r
+    collections.OrderedDict will remember the order of insertion). If\r
+    ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority.\r
+\r
+    ``parse_float``, if specified, will be called with the string\r
+    of every JSON float to be decoded. By default this is equivalent to\r
+    float(num_str). This can be used to use another datatype or parser\r
+    for JSON floats (e.g. decimal.Decimal).\r
+\r
+    ``parse_int``, if specified, will be called with the string\r
+    of every JSON int to be decoded. By default this is equivalent to\r
+    int(num_str). This can be used to use another datatype or parser\r
+    for JSON integers (e.g. float).\r
+\r
+    ``parse_constant``, if specified, will be called with one of the\r
+    following strings: -Infinity, Infinity, NaN, null, true, false.\r
+    This can be used to raise an exception if invalid JSON numbers\r
+    are encountered.\r
+\r
+    To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``\r
+    kwarg; otherwise ``JSONDecoder`` is used.\r
+\r
+    """\r
+    if (cls is None and encoding is None and object_hook is None and\r
+            parse_int is None and parse_float is None and\r
+            parse_constant is None and object_pairs_hook is None and not kw):\r
+        return _default_decoder.decode(s)\r
+    if cls is None:\r
+        cls = JSONDecoder\r
+    if object_hook is not None:\r
+        kw['object_hook'] = object_hook\r
+    if object_pairs_hook is not None:\r
+        kw['object_pairs_hook'] = object_pairs_hook\r
+    if parse_float is not None:\r
+        kw['parse_float'] = parse_float\r
+    if parse_int is not None:\r
+        kw['parse_int'] = parse_int\r
+    if parse_constant is not None:\r
+        kw['parse_constant'] = parse_constant\r
+    return cls(encoding=encoding, **kw).decode(s)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/decoder.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/decoder.py
new file mode 100644 (file)
index 0000000..f2a4829
--- /dev/null
@@ -0,0 +1,385 @@
+"""Implementation of JSONDecoder\r
+"""\r
+import re\r
+import sys\r
+import struct\r
+\r
+from json import scanner\r
+try:\r
+    from _json import scanstring as c_scanstring\r
+except ImportError:\r
+    c_scanstring = None\r
+\r
+__all__ = ['JSONDecoder']\r
+\r
+FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL\r
+\r
+def _floatconstants():\r
+    _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')\r
+    if sys.byteorder != 'big':\r
+        _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1]\r
+    nan, inf = struct.unpack('dd', _BYTES)\r
+    return nan, inf, -inf\r
+\r
+NaN, PosInf, NegInf = _floatconstants()\r
+\r
+\r
+def linecol(doc, pos):\r
+    lineno = doc.count('\n', 0, pos) + 1\r
+    if lineno == 1:\r
+        colno = pos + 1\r
+    else:\r
+        colno = pos - doc.rindex('\n', 0, pos)\r
+    return lineno, colno\r
+\r
+\r
+def errmsg(msg, doc, pos, end=None):\r
+    # Note that this function is called from _json\r
+    lineno, colno = linecol(doc, pos)\r
+    if end is None:\r
+        fmt = '{0}: line {1} column {2} (char {3})'\r
+        return fmt.format(msg, lineno, colno, pos)\r
+        #fmt = '%s: line %d column %d (char %d)'\r
+        #return fmt % (msg, lineno, colno, pos)\r
+    endlineno, endcolno = linecol(doc, end)\r
+    fmt = '{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})'\r
+    return fmt.format(msg, lineno, colno, endlineno, endcolno, pos, end)\r
+    #fmt = '%s: line %d column %d - line %d column %d (char %d - %d)'\r
+    #return fmt % (msg, lineno, colno, endlineno, endcolno, pos, end)\r
+\r
+\r
+_CONSTANTS = {\r
+    '-Infinity': NegInf,\r
+    'Infinity': PosInf,\r
+    'NaN': NaN,\r
+}\r
+\r
+STRINGCHUNK = re.compile(r'(.*?)(["\\\x00-\x1f])', FLAGS)\r
+BACKSLASH = {\r
+    '"': u'"', '\\': u'\\', '/': u'/',\r
+    'b': u'\b', 'f': u'\f', 'n': u'\n', 'r': u'\r', 't': u'\t',\r
+}\r
+\r
+DEFAULT_ENCODING = "utf-8"\r
+\r
+def _decode_uXXXX(s, pos):\r
+    esc = s[pos + 1:pos + 5]\r
+    if len(esc) == 4 and esc[1] not in 'xX':\r
+        try:\r
+            return int(esc, 16)\r
+        except ValueError:\r
+            pass\r
+    msg = "Invalid \\uXXXX escape"\r
+    raise ValueError(errmsg(msg, s, pos))\r
+\r
+def py_scanstring(s, end, encoding=None, strict=True,\r
+        _b=BACKSLASH, _m=STRINGCHUNK.match):\r
+    """Scan the string s for a JSON string. End is the index of the\r
+    character in s after the quote that started the JSON string.\r
+    Unescapes all valid JSON string escape sequences and raises ValueError\r
+    on attempt to decode an invalid string. If strict is False then literal\r
+    control characters are allowed in the string.\r
+\r
+    Returns a tuple of the decoded string and the index of the character in s\r
+    after the end quote."""\r
+    if encoding is None:\r
+        encoding = DEFAULT_ENCODING\r
+    chunks = []\r
+    _append = chunks.append\r
+    begin = end - 1\r
+    while 1:\r
+        chunk = _m(s, end)\r
+        if chunk is None:\r
+            raise ValueError(\r
+                errmsg("Unterminated string starting at", s, begin))\r
+        end = chunk.end()\r
+        content, terminator = chunk.groups()\r
+        # Content is contains zero or more unescaped string characters\r
+        if content:\r
+            if not isinstance(content, unicode):\r
+                content = unicode(content, encoding)\r
+            _append(content)\r
+        # Terminator is the end of string, a literal control character,\r
+        # or a backslash denoting that an escape sequence follows\r
+        if terminator == '"':\r
+            break\r
+        elif terminator != '\\':\r
+            if strict:\r
+                #msg = "Invalid control character %r at" % (terminator,)\r
+                msg = "Invalid control character {0!r} at".format(terminator)\r
+                raise ValueError(errmsg(msg, s, end))\r
+            else:\r
+                _append(terminator)\r
+                continue\r
+        try:\r
+            esc = s[end]\r
+        except IndexError:\r
+            raise ValueError(\r
+                errmsg("Unterminated string starting at", s, begin))\r
+        # If not a unicode escape sequence, must be in the lookup table\r
+        if esc != 'u':\r
+            try:\r
+                char = _b[esc]\r
+            except KeyError:\r
+                msg = "Invalid \\escape: " + repr(esc)\r
+                raise ValueError(errmsg(msg, s, end))\r
+            end += 1\r
+        else:\r
+            # Unicode escape sequence\r
+            uni = _decode_uXXXX(s, end)\r
+            end += 5\r
+            # Check for surrogate pair on UCS-4 systems\r
+            if sys.maxunicode > 65535 and \\r
+               0xd800 <= uni <= 0xdbff and s[end:end + 2] == '\\u':\r
+                uni2 = _decode_uXXXX(s, end + 1)\r
+                if 0xdc00 <= uni2 <= 0xdfff:\r
+                    uni = 0x10000 + (((uni - 0xd800) << 10) | (uni2 - 0xdc00))\r
+                    end += 6\r
+            char = unichr(uni)\r
+        # Append the unescaped character\r
+        _append(char)\r
+    return u''.join(chunks), end\r
+\r
+\r
+# Use speedup if available\r
+scanstring = c_scanstring or py_scanstring\r
+\r
+WHITESPACE = re.compile(r'[ \t\n\r]*', FLAGS)\r
+WHITESPACE_STR = ' \t\n\r'\r
+\r
+def JSONObject(s_and_end, encoding, strict, scan_once, object_hook,\r
+               object_pairs_hook, _w=WHITESPACE.match, _ws=WHITESPACE_STR):\r
+    s, end = s_and_end\r
+    pairs = []\r
+    pairs_append = pairs.append\r
+    # Use a slice to prevent IndexError from being raised, the following\r
+    # check will raise a more specific ValueError if the string is empty\r
+    nextchar = s[end:end + 1]\r
+    # Normally we expect nextchar == '"'\r
+    if nextchar != '"':\r
+        if nextchar in _ws:\r
+            end = _w(s, end).end()\r
+            nextchar = s[end:end + 1]\r
+        # Trivial empty object\r
+        if nextchar == '}':\r
+            if object_pairs_hook is not None:\r
+                result = object_pairs_hook(pairs)\r
+                return result, end + 1\r
+            pairs = {}\r
+            if object_hook is not None:\r
+                pairs = object_hook(pairs)\r
+            return pairs, end + 1\r
+        elif nextchar != '"':\r
+            raise ValueError(errmsg(\r
+                "Expecting property name enclosed in double quotes", s, end))\r
+    end += 1\r
+    while True:\r
+        key, end = scanstring(s, end, encoding, strict)\r
+\r
+        # To skip some function call overhead we optimize the fast paths where\r
+        # the JSON key separator is ": " or just ":".\r
+        if s[end:end + 1] != ':':\r
+            end = _w(s, end).end()\r
+            if s[end:end + 1] != ':':\r
+                raise ValueError(errmsg("Expecting ':' delimiter", s, end))\r
+        end += 1\r
+\r
+        try:\r
+            if s[end] in _ws:\r
+                end += 1\r
+                if s[end] in _ws:\r
+                    end = _w(s, end + 1).end()\r
+        except IndexError:\r
+            pass\r
+\r
+        try:\r
+            value, end = scan_once(s, end)\r
+        except StopIteration:\r
+            raise ValueError(errmsg("Expecting object", s, end))\r
+        pairs_append((key, value))\r
+\r
+        try:\r
+            nextchar = s[end]\r
+            if nextchar in _ws:\r
+                end = _w(s, end + 1).end()\r
+                nextchar = s[end]\r
+        except IndexError:\r
+            nextchar = ''\r
+        end += 1\r
+\r
+        if nextchar == '}':\r
+            break\r
+        elif nextchar != ',':\r
+            raise ValueError(errmsg("Expecting ',' delimiter", s, end - 1))\r
+\r
+        try:\r
+            nextchar = s[end]\r
+            if nextchar in _ws:\r
+                end += 1\r
+                nextchar = s[end]\r
+                if nextchar in _ws:\r
+                    end = _w(s, end + 1).end()\r
+                    nextchar = s[end]\r
+        except IndexError:\r
+            nextchar = ''\r
+\r
+        end += 1\r
+        if nextchar != '"':\r
+            raise ValueError(errmsg(\r
+                "Expecting property name enclosed in double quotes", s, end - 1))\r
+    if object_pairs_hook is not None:\r
+        result = object_pairs_hook(pairs)\r
+        return result, end\r
+    pairs = dict(pairs)\r
+    if object_hook is not None:\r
+        pairs = object_hook(pairs)\r
+    return pairs, end\r
+\r
+def JSONArray(s_and_end, scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR):\r
+    s, end = s_and_end\r
+    values = []\r
+    nextchar = s[end:end + 1]\r
+    if nextchar in _ws:\r
+        end = _w(s, end + 1).end()\r
+        nextchar = s[end:end + 1]\r
+    # Look-ahead for trivial empty array\r
+    if nextchar == ']':\r
+        return values, end + 1\r
+    _append = values.append\r
+    while True:\r
+        try:\r
+            value, end = scan_once(s, end)\r
+        except StopIteration:\r
+            raise ValueError(errmsg("Expecting object", s, end))\r
+        _append(value)\r
+        nextchar = s[end:end + 1]\r
+        if nextchar in _ws:\r
+            end = _w(s, end + 1).end()\r
+            nextchar = s[end:end + 1]\r
+        end += 1\r
+        if nextchar == ']':\r
+            break\r
+        elif nextchar != ',':\r
+            raise ValueError(errmsg("Expecting ',' delimiter", s, end))\r
+        try:\r
+            if s[end] in _ws:\r
+                end += 1\r
+                if s[end] in _ws:\r
+                    end = _w(s, end + 1).end()\r
+        except IndexError:\r
+            pass\r
+\r
+    return values, end\r
+\r
+class JSONDecoder(object):\r
+    """Simple JSON <http://json.org> decoder\r
+\r
+    Performs the following translations in decoding by default:\r
+\r
+    +---------------+-------------------+\r
+    | JSON          | Python            |\r
+    +===============+===================+\r
+    | object        | dict              |\r
+    +---------------+-------------------+\r
+    | array         | list              |\r
+    +---------------+-------------------+\r
+    | string        | unicode           |\r
+    +---------------+-------------------+\r
+    | number (int)  | int, long         |\r
+    +---------------+-------------------+\r
+    | number (real) | float             |\r
+    +---------------+-------------------+\r
+    | true          | True              |\r
+    +---------------+-------------------+\r
+    | false         | False             |\r
+    +---------------+-------------------+\r
+    | null          | None              |\r
+    +---------------+-------------------+\r
+\r
+    It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as\r
+    their corresponding ``float`` values, which is outside the JSON spec.\r
+\r
+    """\r
+\r
+    def __init__(self, encoding=None, object_hook=None, parse_float=None,\r
+            parse_int=None, parse_constant=None, strict=True,\r
+            object_pairs_hook=None):\r
+        """``encoding`` determines the encoding used to interpret any ``str``\r
+        objects decoded by this instance (utf-8 by default).  It has no\r
+        effect when decoding ``unicode`` objects.\r
+\r
+        Note that currently only encodings that are a superset of ASCII work,\r
+        strings of other encodings should be passed in as ``unicode``.\r
+\r
+        ``object_hook``, if specified, will be called with the result\r
+        of every JSON object decoded and its return value will be used in\r
+        place of the given ``dict``.  This can be used to provide custom\r
+        deserializations (e.g. to support JSON-RPC class hinting).\r
+\r
+        ``object_pairs_hook``, if specified will be called with the result of\r
+        every JSON object decoded with an ordered list of pairs.  The return\r
+        value of ``object_pairs_hook`` will be used instead of the ``dict``.\r
+        This feature can be used to implement custom decoders that rely on the\r
+        order that the key and value pairs are decoded (for example,\r
+        collections.OrderedDict will remember the order of insertion). If\r
+        ``object_hook`` is also defined, the ``object_pairs_hook`` takes\r
+        priority.\r
+\r
+        ``parse_float``, if specified, will be called with the string\r
+        of every JSON float to be decoded. By default this is equivalent to\r
+        float(num_str). This can be used to use another datatype or parser\r
+        for JSON floats (e.g. decimal.Decimal).\r
+\r
+        ``parse_int``, if specified, will be called with the string\r
+        of every JSON int to be decoded. By default this is equivalent to\r
+        int(num_str). This can be used to use another datatype or parser\r
+        for JSON integers (e.g. float).\r
+\r
+        ``parse_constant``, if specified, will be called with one of the\r
+        following strings: -Infinity, Infinity, NaN.\r
+        This can be used to raise an exception if invalid JSON numbers\r
+        are encountered.\r
+\r
+        If ``strict`` is false (true is the default), then control\r
+        characters will be allowed inside strings.  Control characters in\r
+        this context are those with character codes in the 0-31 range,\r
+        including ``'\\t'`` (tab), ``'\\n'``, ``'\\r'`` and ``'\\0'``.\r
+\r
+        """\r
+        self.encoding = encoding\r
+        self.object_hook = object_hook\r
+        self.object_pairs_hook = object_pairs_hook\r
+        self.parse_float = parse_float or float\r
+        self.parse_int = parse_int or int\r
+        self.parse_constant = parse_constant or _CONSTANTS.__getitem__\r
+        self.strict = strict\r
+        self.parse_object = JSONObject\r
+        self.parse_array = JSONArray\r
+        self.parse_string = scanstring\r
+        self.scan_once = scanner.make_scanner(self)\r
+\r
+    def decode(self, s, _w=WHITESPACE.match):\r
+        """Return the Python representation of ``s`` (a ``str`` or ``unicode``\r
+        instance containing a JSON document)\r
+\r
+        """\r
+        obj, end = self.raw_decode(s, idx=_w(s, 0).end())\r
+        end = _w(s, end).end()\r
+        if end != len(s):\r
+            raise ValueError(errmsg("Extra data", s, end, len(s)))\r
+        return obj\r
+\r
+    def raw_decode(self, s, idx=0):\r
+        """Decode a JSON document from ``s`` (a ``str`` or ``unicode``\r
+        beginning with a JSON document) and return a 2-tuple of the Python\r
+        representation and the index in ``s`` where the document ended.\r
+\r
+        This can be used to decode a JSON document from a string that may\r
+        have extraneous data at the end.\r
+\r
+        """\r
+        try:\r
+            obj, end = self.scan_once(s, idx)\r
+        except StopIteration:\r
+            raise ValueError("No JSON object could be decoded")\r
+        return obj, end\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/encoder.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/encoder.py
new file mode 100644 (file)
index 0000000..cd1a120
--- /dev/null
@@ -0,0 +1,448 @@
+"""Implementation of JSONEncoder\r
+"""\r
+import re\r
+\r
+try:\r
+    from _json import encode_basestring_ascii as c_encode_basestring_ascii\r
+except ImportError:\r
+    c_encode_basestring_ascii = None\r
+try:\r
+    from _json import make_encoder as c_make_encoder\r
+except ImportError:\r
+    c_make_encoder = None\r
+\r
+ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')\r
+ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')\r
+HAS_UTF8 = re.compile(r'[\x80-\xff]')\r
+ESCAPE_DCT = {\r
+    '\\': '\\\\',\r
+    '"': '\\"',\r
+    '\b': '\\b',\r
+    '\f': '\\f',\r
+    '\n': '\\n',\r
+    '\r': '\\r',\r
+    '\t': '\\t',\r
+}\r
+for i in range(0x20):\r
+    ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i))\r
+    #ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))\r
+\r
+INFINITY = float('inf')\r
+FLOAT_REPR = repr\r
+\r
+def encode_basestring(s):\r
+    """Return a JSON representation of a Python string\r
+\r
+    """\r
+    def replace(match):\r
+        return ESCAPE_DCT[match.group(0)]\r
+    return '"' + ESCAPE.sub(replace, s) + '"'\r
+\r
+\r
+def py_encode_basestring_ascii(s):\r
+    """Return an ASCII-only JSON representation of a Python string\r
+\r
+    """\r
+    if isinstance(s, str) and HAS_UTF8.search(s) is not None:\r
+        s = s.decode('utf-8')\r
+    def replace(match):\r
+        s = match.group(0)\r
+        try:\r
+            return ESCAPE_DCT[s]\r
+        except KeyError:\r
+            n = ord(s)\r
+            if n < 0x10000:\r
+                return '\\u{0:04x}'.format(n)\r
+                #return '\\u%04x' % (n,)\r
+            else:\r
+                # surrogate pair\r
+                n -= 0x10000\r
+                s1 = 0xd800 | ((n >> 10) & 0x3ff)\r
+                s2 = 0xdc00 | (n & 0x3ff)\r
+                return '\\u{0:04x}\\u{1:04x}'.format(s1, s2)\r
+                #return '\\u%04x\\u%04x' % (s1, s2)\r
+    return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"'\r
+\r
+\r
+encode_basestring_ascii = (\r
+    c_encode_basestring_ascii or py_encode_basestring_ascii)\r
+\r
+class JSONEncoder(object):\r
+    """Extensible JSON <http://json.org> encoder for Python data structures.\r
+\r
+    Supports the following objects and types by default:\r
+\r
+    +-------------------+---------------+\r
+    | Python            | JSON          |\r
+    +===================+===============+\r
+    | dict              | object        |\r
+    +-------------------+---------------+\r
+    | list, tuple       | array         |\r
+    +-------------------+---------------+\r
+    | str, unicode      | string        |\r
+    +-------------------+---------------+\r
+    | int, long, float  | number        |\r
+    +-------------------+---------------+\r
+    | True              | true          |\r
+    +-------------------+---------------+\r
+    | False             | false         |\r
+    +-------------------+---------------+\r
+    | None              | null          |\r
+    +-------------------+---------------+\r
+\r
+    To extend this to recognize other objects, subclass and implement a\r
+    ``.default()`` method with another method that returns a serializable\r
+    object for ``o`` if possible, otherwise it should call the superclass\r
+    implementation (to raise ``TypeError``).\r
+\r
+    """\r
+    item_separator = ', '\r
+    key_separator = ': '\r
+    def __init__(self, skipkeys=False, ensure_ascii=True,\r
+            check_circular=True, allow_nan=True, sort_keys=False,\r
+            indent=None, separators=None, encoding='utf-8', default=None):\r
+        """Constructor for JSONEncoder, with sensible defaults.\r
+\r
+        If skipkeys is false, then it is a TypeError to attempt\r
+        encoding of keys that are not str, int, long, float or None.  If\r
+        skipkeys is True, such items are simply skipped.\r
+\r
+        If *ensure_ascii* is true (the default), all non-ASCII\r
+        characters in the output are escaped with \uXXXX sequences,\r
+        and the results are str instances consisting of ASCII\r
+        characters only.  If ensure_ascii is False, a result may be a\r
+        unicode instance.  This usually happens if the input contains\r
+        unicode strings or the *encoding* parameter is used.\r
+\r
+        If check_circular is true, then lists, dicts, and custom encoded\r
+        objects will be checked for circular references during encoding to\r
+        prevent an infinite recursion (which would cause an OverflowError).\r
+        Otherwise, no such check takes place.\r
+\r
+        If allow_nan is true, then NaN, Infinity, and -Infinity will be\r
+        encoded as such.  This behavior is not JSON specification compliant,\r
+        but is consistent with most JavaScript based encoders and decoders.\r
+        Otherwise, it will be a ValueError to encode such floats.\r
+\r
+        If sort_keys is true, then the output of dictionaries will be\r
+        sorted by key; this is useful for regression tests to ensure\r
+        that JSON serializations can be compared on a day-to-day basis.\r
+\r
+        If indent is a non-negative integer, then JSON array\r
+        elements and object members will be pretty-printed with that\r
+        indent level.  An indent level of 0 will only insert newlines.\r
+        None is the most compact representation.  Since the default\r
+        item separator is ', ',  the output might include trailing\r
+        whitespace when indent is specified.  You can use\r
+        separators=(',', ': ') to avoid this.\r
+\r
+        If specified, separators should be a (item_separator, key_separator)\r
+        tuple.  The default is (', ', ': ').  To get the most compact JSON\r
+        representation you should specify (',', ':') to eliminate whitespace.\r
+\r
+        If specified, default is a function that gets called for objects\r
+        that can't otherwise be serialized.  It should return a JSON encodable\r
+        version of the object or raise a ``TypeError``.\r
+\r
+        If encoding is not None, then all input strings will be\r
+        transformed into unicode using that encoding prior to JSON-encoding.\r
+        The default is UTF-8.\r
+\r
+        """\r
+\r
+        self.skipkeys = skipkeys\r
+        self.ensure_ascii = ensure_ascii\r
+        self.check_circular = check_circular\r
+        self.allow_nan = allow_nan\r
+        self.sort_keys = sort_keys\r
+        self.indent = indent\r
+        if separators is not None:\r
+            self.item_separator, self.key_separator = separators\r
+        if default is not None:\r
+            self.default = default\r
+        self.encoding = encoding\r
+\r
+    def default(self, o):\r
+        """Implement this method in a subclass such that it returns\r
+        a serializable object for ``o``, or calls the base implementation\r
+        (to raise a ``TypeError``).\r
+\r
+        For example, to support arbitrary iterators, you could\r
+        implement default like this::\r
+\r
+            def default(self, o):\r
+                try:\r
+                    iterable = iter(o)\r
+                except TypeError:\r
+                    pass\r
+                else:\r
+                    return list(iterable)\r
+                # Let the base class default method raise the TypeError\r
+                return JSONEncoder.default(self, o)\r
+\r
+        """\r
+        raise TypeError(repr(o) + " is not JSON serializable")\r
+\r
+    def encode(self, o):\r
+        """Return a JSON string representation of a Python data structure.\r
+\r
+        >>> JSONEncoder().encode({"foo": ["bar", "baz"]})\r
+        '{"foo": ["bar", "baz"]}'\r
+\r
+        """\r
+        # This is for extremely simple cases and benchmarks.\r
+        if isinstance(o, basestring):\r
+            if isinstance(o, str):\r
+                _encoding = self.encoding\r
+                if (_encoding is not None\r
+                        and not (_encoding == 'utf-8')):\r
+                    o = o.decode(_encoding)\r
+            if self.ensure_ascii:\r
+                return encode_basestring_ascii(o)\r
+            else:\r
+                return encode_basestring(o)\r
+        # This doesn't pass the iterator directly to ''.join() because the\r
+        # exceptions aren't as detailed.  The list call should be roughly\r
+        # equivalent to the PySequence_Fast that ''.join() would do.\r
+        chunks = self.iterencode(o, _one_shot=True)\r
+        if not isinstance(chunks, (list, tuple)):\r
+            chunks = list(chunks)\r
+        return ''.join(chunks)\r
+\r
+    def iterencode(self, o, _one_shot=False):\r
+        """Encode the given object and yield each string\r
+        representation as available.\r
+\r
+        For example::\r
+\r
+            for chunk in JSONEncoder().iterencode(bigobject):\r
+                mysocket.write(chunk)\r
+\r
+        """\r
+        if self.check_circular:\r
+            markers = {}\r
+        else:\r
+            markers = None\r
+        if self.ensure_ascii:\r
+            _encoder = encode_basestring_ascii\r
+        else:\r
+            _encoder = encode_basestring\r
+        if self.encoding != 'utf-8':\r
+            def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\r
+                if isinstance(o, str):\r
+                    o = o.decode(_encoding)\r
+                return _orig_encoder(o)\r
+\r
+        def floatstr(o, allow_nan=self.allow_nan,\r
+                _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY):\r
+            # Check for specials.  Note that this type of test is processor\r
+            # and/or platform-specific, so do tests which don't depend on the\r
+            # internals.\r
+\r
+            if o != o:\r
+                text = 'NaN'\r
+            elif o == _inf:\r
+                text = 'Infinity'\r
+            elif o == _neginf:\r
+                text = '-Infinity'\r
+            else:\r
+                return _repr(o)\r
+\r
+            if not allow_nan:\r
+                raise ValueError(\r
+                    "Out of range float values are not JSON compliant: " +\r
+                    repr(o))\r
+\r
+            return text\r
+\r
+\r
+        if (_one_shot and c_make_encoder is not None\r
+                and self.indent is None and not self.sort_keys):\r
+            _iterencode = c_make_encoder(\r
+                markers, self.default, _encoder, self.indent,\r
+                self.key_separator, self.item_separator, self.sort_keys,\r
+                self.skipkeys, self.allow_nan)\r
+        else:\r
+            _iterencode = _make_iterencode(\r
+                markers, self.default, _encoder, self.indent, floatstr,\r
+                self.key_separator, self.item_separator, self.sort_keys,\r
+                self.skipkeys, _one_shot)\r
+        return _iterencode(o, 0)\r
+\r
+def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,\r
+        _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,\r
+        ## HACK: hand-optimized bytecode; turn globals into locals\r
+        ValueError=ValueError,\r
+        basestring=basestring,\r
+        dict=dict,\r
+        float=float,\r
+        id=id,\r
+        int=int,\r
+        isinstance=isinstance,\r
+        list=list,\r
+        long=long,\r
+        str=str,\r
+        tuple=tuple,\r
+    ):\r
+\r
+    def _iterencode_list(lst, _current_indent_level):\r
+        if not lst:\r
+            yield '[]'\r
+            return\r
+        if markers is not None:\r
+            markerid = id(lst)\r
+            if markerid in markers:\r
+                raise ValueError("Circular reference detected")\r
+            markers[markerid] = lst\r
+        buf = '['\r
+        if _indent is not None:\r
+            _current_indent_level += 1\r
+            newline_indent = '\n' + (' ' * (_indent * _current_indent_level))\r
+            separator = _item_separator + newline_indent\r
+            buf += newline_indent\r
+        else:\r
+            newline_indent = None\r
+            separator = _item_separator\r
+        first = True\r
+        for value in lst:\r
+            if first:\r
+                first = False\r
+            else:\r
+                buf = separator\r
+            if isinstance(value, basestring):\r
+                yield buf + _encoder(value)\r
+            elif value is None:\r
+                yield buf + 'null'\r
+            elif value is True:\r
+                yield buf + 'true'\r
+            elif value is False:\r
+                yield buf + 'false'\r
+            elif isinstance(value, (int, long)):\r
+                yield buf + str(value)\r
+            elif isinstance(value, float):\r
+                yield buf + _floatstr(value)\r
+            else:\r
+                yield buf\r
+                if isinstance(value, (list, tuple)):\r
+                    chunks = _iterencode_list(value, _current_indent_level)\r
+                elif isinstance(value, dict):\r
+                    chunks = _iterencode_dict(value, _current_indent_level)\r
+                else:\r
+                    chunks = _iterencode(value, _current_indent_level)\r
+                for chunk in chunks:\r
+                    yield chunk\r
+        if newline_indent is not None:\r
+            _current_indent_level -= 1\r
+            yield '\n' + (' ' * (_indent * _current_indent_level))\r
+        yield ']'\r
+        if markers is not None:\r
+            del markers[markerid]\r
+\r
+    def _iterencode_dict(dct, _current_indent_level):\r
+        if not dct:\r
+            yield '{}'\r
+            return\r
+        if markers is not None:\r
+            markerid = id(dct)\r
+            if markerid in markers:\r
+                raise ValueError("Circular reference detected")\r
+            markers[markerid] = dct\r
+        yield '{'\r
+        if _indent is not None:\r
+            _current_indent_level += 1\r
+            newline_indent = '\n' + (' ' * (_indent * _current_indent_level))\r
+            item_separator = _item_separator + newline_indent\r
+            yield newline_indent\r
+        else:\r
+            newline_indent = None\r
+            item_separator = _item_separator\r
+        first = True\r
+        if _sort_keys:\r
+            items = sorted(dct.items(), key=lambda kv: kv[0])\r
+        else:\r
+            items = dct.iteritems()\r
+        for key, value in items:\r
+            if isinstance(key, basestring):\r
+                pass\r
+            # JavaScript is weakly typed for these, so it makes sense to\r
+            # also allow them.  Many encoders seem to do something like this.\r
+            elif isinstance(key, float):\r
+                key = _floatstr(key)\r
+            elif key is True:\r
+                key = 'true'\r
+            elif key is False:\r
+                key = 'false'\r
+            elif key is None:\r
+                key = 'null'\r
+            elif isinstance(key, (int, long)):\r
+                key = str(key)\r
+            elif _skipkeys:\r
+                continue\r
+            else:\r
+                raise TypeError("key " + repr(key) + " is not a string")\r
+            if first:\r
+                first = False\r
+            else:\r
+                yield item_separator\r
+            yield _encoder(key)\r
+            yield _key_separator\r
+            if isinstance(value, basestring):\r
+                yield _encoder(value)\r
+            elif value is None:\r
+                yield 'null'\r
+            elif value is True:\r
+                yield 'true'\r
+            elif value is False:\r
+                yield 'false'\r
+            elif isinstance(value, (int, long)):\r
+                yield str(value)\r
+            elif isinstance(value, float):\r
+                yield _floatstr(value)\r
+            else:\r
+                if isinstance(value, (list, tuple)):\r
+                    chunks = _iterencode_list(value, _current_indent_level)\r
+                elif isinstance(value, dict):\r
+                    chunks = _iterencode_dict(value, _current_indent_level)\r
+                else:\r
+                    chunks = _iterencode(value, _current_indent_level)\r
+                for chunk in chunks:\r
+                    yield chunk\r
+        if newline_indent is not None:\r
+            _current_indent_level -= 1\r
+            yield '\n' + (' ' * (_indent * _current_indent_level))\r
+        yield '}'\r
+        if markers is not None:\r
+            del markers[markerid]\r
+\r
+    def _iterencode(o, _current_indent_level):\r
+        if isinstance(o, basestring):\r
+            yield _encoder(o)\r
+        elif o is None:\r
+            yield 'null'\r
+        elif o is True:\r
+            yield 'true'\r
+        elif o is False:\r
+            yield 'false'\r
+        elif isinstance(o, (int, long)):\r
+            yield str(o)\r
+        elif isinstance(o, float):\r
+            yield _floatstr(o)\r
+        elif isinstance(o, (list, tuple)):\r
+            for chunk in _iterencode_list(o, _current_indent_level):\r
+                yield chunk\r
+        elif isinstance(o, dict):\r
+            for chunk in _iterencode_dict(o, _current_indent_level):\r
+                yield chunk\r
+        else:\r
+            if markers is not None:\r
+                markerid = id(o)\r
+                if markerid in markers:\r
+                    raise ValueError("Circular reference detected")\r
+                markers[markerid] = o\r
+            o = _default(o)\r
+            for chunk in _iterencode(o, _current_indent_level):\r
+                yield chunk\r
+            if markers is not None:\r
+                del markers[markerid]\r
+\r
+    return _iterencode\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/scanner.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/scanner.py
new file mode 100644 (file)
index 0000000..259e955
--- /dev/null
@@ -0,0 +1,67 @@
+"""JSON token scanner\r
+"""\r
+import re\r
+try:\r
+    from _json import make_scanner as c_make_scanner\r
+except ImportError:\r
+    c_make_scanner = None\r
+\r
+__all__ = ['make_scanner']\r
+\r
+NUMBER_RE = re.compile(\r
+    r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',\r
+    (re.VERBOSE | re.MULTILINE | re.DOTALL))\r
+\r
+def py_make_scanner(context):\r
+    parse_object = context.parse_object\r
+    parse_array = context.parse_array\r
+    parse_string = context.parse_string\r
+    match_number = NUMBER_RE.match\r
+    encoding = context.encoding\r
+    strict = context.strict\r
+    parse_float = context.parse_float\r
+    parse_int = context.parse_int\r
+    parse_constant = context.parse_constant\r
+    object_hook = context.object_hook\r
+    object_pairs_hook = context.object_pairs_hook\r
+\r
+    def _scan_once(string, idx):\r
+        try:\r
+            nextchar = string[idx]\r
+        except IndexError:\r
+            raise StopIteration\r
+\r
+        if nextchar == '"':\r
+            return parse_string(string, idx + 1, encoding, strict)\r
+        elif nextchar == '{':\r
+            return parse_object((string, idx + 1), encoding, strict,\r
+                _scan_once, object_hook, object_pairs_hook)\r
+        elif nextchar == '[':\r
+            return parse_array((string, idx + 1), _scan_once)\r
+        elif nextchar == 'n' and string[idx:idx + 4] == 'null':\r
+            return None, idx + 4\r
+        elif nextchar == 't' and string[idx:idx + 4] == 'true':\r
+            return True, idx + 4\r
+        elif nextchar == 'f' and string[idx:idx + 5] == 'false':\r
+            return False, idx + 5\r
+\r
+        m = match_number(string, idx)\r
+        if m is not None:\r
+            integer, frac, exp = m.groups()\r
+            if frac or exp:\r
+                res = parse_float(integer + (frac or '') + (exp or ''))\r
+            else:\r
+                res = parse_int(integer)\r
+            return res, m.end()\r
+        elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':\r
+            return parse_constant('NaN'), idx + 3\r
+        elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\r
+            return parse_constant('Infinity'), idx + 8\r
+        elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\r
+            return parse_constant('-Infinity'), idx + 9\r
+        else:\r
+            raise StopIteration\r
+\r
+    return _scan_once\r
+\r
+make_scanner = c_make_scanner or py_make_scanner\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/__init__.py
new file mode 100644 (file)
index 0000000..17d3849
--- /dev/null
@@ -0,0 +1,73 @@
+import os\r
+import sys\r
+import json\r
+import doctest\r
+import unittest\r
+\r
+from test import test_support\r
+\r
+# import json with and without accelerations\r
+cjson = test_support.import_fresh_module('json', fresh=['_json'])\r
+pyjson = test_support.import_fresh_module('json', blocked=['_json'])\r
+\r
+# create two base classes that will be used by the other tests\r
+class PyTest(unittest.TestCase):\r
+    json = pyjson\r
+    loads = staticmethod(pyjson.loads)\r
+    dumps = staticmethod(pyjson.dumps)\r
+\r
+@unittest.skipUnless(cjson, 'requires _json')\r
+class CTest(unittest.TestCase):\r
+    if cjson is not None:\r
+        json = cjson\r
+        loads = staticmethod(cjson.loads)\r
+        dumps = staticmethod(cjson.dumps)\r
+\r
+# test PyTest and CTest checking if the functions come from the right module\r
+class TestPyTest(PyTest):\r
+    def test_pyjson(self):\r
+        self.assertEqual(self.json.scanner.make_scanner.__module__,\r
+                         'json.scanner')\r
+        self.assertEqual(self.json.decoder.scanstring.__module__,\r
+                         'json.decoder')\r
+        self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__,\r
+                         'json.encoder')\r
+\r
+class TestCTest(CTest):\r
+    def test_cjson(self):\r
+        self.assertEqual(self.json.scanner.make_scanner.__module__, '_json')\r
+        self.assertEqual(self.json.decoder.scanstring.__module__, '_json')\r
+        self.assertEqual(self.json.encoder.c_make_encoder.__module__, '_json')\r
+        self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__,\r
+                         '_json')\r
+\r
+\r
+here = os.path.dirname(__file__)\r
+\r
+def test_suite():\r
+    suite = additional_tests()\r
+    loader = unittest.TestLoader()\r
+    for fn in os.listdir(here):\r
+        if fn.startswith("test") and fn.endswith(".py"):\r
+            modname = "json.tests." + fn[:-3]\r
+            __import__(modname)\r
+            module = sys.modules[modname]\r
+            suite.addTests(loader.loadTestsFromModule(module))\r
+    return suite\r
+\r
+def additional_tests():\r
+    suite = unittest.TestSuite()\r
+    for mod in (json, json.encoder, json.decoder):\r
+        suite.addTest(doctest.DocTestSuite(mod))\r
+    suite.addTest(TestPyTest('test_pyjson'))\r
+    suite.addTest(TestCTest('test_cjson'))\r
+    return suite\r
+\r
+def main():\r
+    suite = test_suite()\r
+    runner = unittest.TextTestRunner()\r
+    runner.run(suite)\r
+\r
+if __name__ == '__main__':\r
+    sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\r
+    main()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_check_circular.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_check_circular.py
new file mode 100644 (file)
index 0000000..94a63c5
--- /dev/null
@@ -0,0 +1,34 @@
+from json.tests import PyTest, CTest\r
+\r
+\r
+def default_iterable(obj):\r
+    return list(obj)\r
+\r
+class TestCheckCircular(object):\r
+    def test_circular_dict(self):\r
+        dct = {}\r
+        dct['a'] = dct\r
+        self.assertRaises(ValueError, self.dumps, dct)\r
+\r
+    def test_circular_list(self):\r
+        lst = []\r
+        lst.append(lst)\r
+        self.assertRaises(ValueError, self.dumps, lst)\r
+\r
+    def test_circular_composite(self):\r
+        dct2 = {}\r
+        dct2['a'] = []\r
+        dct2['a'].append(dct2)\r
+        self.assertRaises(ValueError, self.dumps, dct2)\r
+\r
+    def test_circular_default(self):\r
+        self.dumps([set()], default=default_iterable)\r
+        self.assertRaises(TypeError, self.dumps, [set()])\r
+\r
+    def test_circular_off_default(self):\r
+        self.dumps([set()], default=default_iterable, check_circular=False)\r
+        self.assertRaises(TypeError, self.dumps, [set()], check_circular=False)\r
+\r
+\r
+class TestPyCheckCircular(TestCheckCircular, PyTest): pass\r
+class TestCCheckCircular(TestCheckCircular, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_decode.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_decode.py
new file mode 100644 (file)
index 0000000..1c763c4
--- /dev/null
@@ -0,0 +1,69 @@
+import decimal\r
+from StringIO import StringIO\r
+from collections import OrderedDict\r
+from json.tests import PyTest, CTest\r
+\r
+\r
+class TestDecode(object):\r
+    def test_decimal(self):\r
+        rval = self.loads('1.1', parse_float=decimal.Decimal)\r
+        self.assertTrue(isinstance(rval, decimal.Decimal))\r
+        self.assertEqual(rval, decimal.Decimal('1.1'))\r
+\r
+    def test_float(self):\r
+        rval = self.loads('1', parse_int=float)\r
+        self.assertTrue(isinstance(rval, float))\r
+        self.assertEqual(rval, 1.0)\r
+\r
+    def test_decoder_optimizations(self):\r
+        # Several optimizations were made that skip over calls to\r
+        # the whitespace regex, so this test is designed to try and\r
+        # exercise the uncommon cases. The array cases are already covered.\r
+        rval = self.loads('{   "key"    :    "value"    ,  "k":"v"    }')\r
+        self.assertEqual(rval, {"key":"value", "k":"v"})\r
+\r
+    def test_empty_objects(self):\r
+        self.assertEqual(self.loads('{}'), {})\r
+        self.assertEqual(self.loads('[]'), [])\r
+        self.assertEqual(self.loads('""'), u"")\r
+        self.assertIsInstance(self.loads('""'), unicode)\r
+\r
+    def test_object_pairs_hook(self):\r
+        s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'\r
+        p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4),\r
+             ("qrt", 5), ("pad", 6), ("hoy", 7)]\r
+        self.assertEqual(self.loads(s), eval(s))\r
+        self.assertEqual(self.loads(s, object_pairs_hook=lambda x: x), p)\r
+        self.assertEqual(self.json.load(StringIO(s),\r
+                                        object_pairs_hook=lambda x: x), p)\r
+        od = self.loads(s, object_pairs_hook=OrderedDict)\r
+        self.assertEqual(od, OrderedDict(p))\r
+        self.assertEqual(type(od), OrderedDict)\r
+        # the object_pairs_hook takes priority over the object_hook\r
+        self.assertEqual(self.loads(s, object_pairs_hook=OrderedDict,\r
+                                    object_hook=lambda x: None),\r
+                         OrderedDict(p))\r
+        # check that empty objects literals work (see #17368)\r
+        self.assertEqual(self.loads('{}', object_pairs_hook=OrderedDict),\r
+                         OrderedDict())\r
+        self.assertEqual(self.loads('{"empty": {}}',\r
+                                    object_pairs_hook=OrderedDict),\r
+                         OrderedDict([('empty', OrderedDict())]))\r
+\r
+    def test_extra_data(self):\r
+        s = '[1, 2, 3]5'\r
+        msg = 'Extra data'\r
+        self.assertRaisesRegexp(ValueError, msg, self.loads, s)\r
+\r
+    def test_invalid_escape(self):\r
+        s = '["abc\\y"]'\r
+        msg = 'escape'\r
+        self.assertRaisesRegexp(ValueError, msg, self.loads, s)\r
+\r
+    def test_negative_index(self):\r
+        d = self.json.JSONDecoder()\r
+        self.assertRaises(ValueError, d.raw_decode, 'a'*42, -50000)\r
+        self.assertRaises(ValueError, d.raw_decode, u'a'*42, -50000)\r
+\r
+class TestPyDecode(TestDecode, PyTest): pass\r
+class TestCDecode(TestDecode, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_default.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_default.py
new file mode 100644 (file)
index 0000000..74aacee
--- /dev/null
@@ -0,0 +1,12 @@
+from json.tests import PyTest, CTest\r
+\r
+\r
+class TestDefault(object):\r
+    def test_default(self):\r
+        self.assertEqual(\r
+            self.dumps(type, default=repr),\r
+            self.dumps(repr(type)))\r
+\r
+\r
+class TestPyDefault(TestDefault, PyTest): pass\r
+class TestCDefault(TestDefault, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_dump.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_dump.py
new file mode 100644 (file)
index 0000000..1b46612
--- /dev/null
@@ -0,0 +1,32 @@
+from cStringIO import StringIO\r
+from json.tests import PyTest, CTest\r
+\r
+\r
+class TestDump(object):\r
+    def test_dump(self):\r
+        sio = StringIO()\r
+        self.json.dump({}, sio)\r
+        self.assertEqual(sio.getvalue(), '{}')\r
+\r
+    def test_dumps(self):\r
+        self.assertEqual(self.dumps({}), '{}')\r
+\r
+    def test_encode_truefalse(self):\r
+        self.assertEqual(self.dumps(\r
+                 {True: False, False: True}, sort_keys=True),\r
+                 '{"false": true, "true": false}')\r
+        self.assertEqual(self.dumps(\r
+                {2: 3.0, 4.0: 5L, False: 1, 6L: True}, sort_keys=True),\r
+                '{"false": 1, "2": 3.0, "4.0": 5, "6": true}')\r
+\r
+    # Issue 16228: Crash on encoding resized list\r
+    def test_encode_mutated(self):\r
+        a = [object()] * 10\r
+        def crasher(obj):\r
+            del a[-1]\r
+        self.assertEqual(self.dumps(a, default=crasher),\r
+                 '[null, null, null, null, null]')\r
+\r
+\r
+class TestPyDump(TestDump, PyTest): pass\r
+class TestCDump(TestDump, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_encode_basestring_ascii.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_encode_basestring_ascii.py
new file mode 100644 (file)
index 0000000..d3a8d5c
--- /dev/null
@@ -0,0 +1,41 @@
+from collections import OrderedDict\r
+from json.tests import PyTest, CTest\r
+\r
+\r
+CASES = [\r
+    (u'/\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\x08\x0c\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?', '"/\\\\\\"\\ucafe\\ubabe\\uab98\\ufcde\\ubcda\\uef4a\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?"'),\r
+    (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'),\r
+    (u'controls', '"controls"'),\r
+    (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'),\r
+    (u'{"object with 1 member":["array with 1 element"]}', '"{\\"object with 1 member\\":[\\"array with 1 element\\"]}"'),\r
+    (u' s p a c e d ', '" s p a c e d "'),\r
+    (u'\U0001d120', '"\\ud834\\udd20"'),\r
+    (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),\r
+    ('\xce\xb1\xce\xa9', '"\\u03b1\\u03a9"'),\r
+    (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),\r
+    ('\xce\xb1\xce\xa9', '"\\u03b1\\u03a9"'),\r
+    (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),\r
+    (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),\r
+    (u"`1~!@#$%^&*()_+-={':[,]}|;.</>?", '"`1~!@#$%^&*()_+-={\':[,]}|;.</>?"'),\r
+    (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'),\r
+    (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'),\r
+]\r
+\r
+class TestEncodeBasestringAscii(object):\r
+    def test_encode_basestring_ascii(self):\r
+        fname = self.json.encoder.encode_basestring_ascii.__name__\r
+        for input_string, expect in CASES:\r
+            result = self.json.encoder.encode_basestring_ascii(input_string)\r
+            self.assertEqual(result, expect,\r
+                '{0!r} != {1!r} for {2}({3!r})'.format(\r
+                    result, expect, fname, input_string))\r
+\r
+    def test_ordered_dict(self):\r
+        # See issue 6105\r
+        items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)]\r
+        s = self.dumps(OrderedDict(items))\r
+        self.assertEqual(s, '{"one": 1, "two": 2, "three": 3, "four": 4, "five": 5}')\r
+\r
+\r
+class TestPyEncodeBasestringAscii(TestEncodeBasestringAscii, PyTest): pass\r
+class TestCEncodeBasestringAscii(TestEncodeBasestringAscii, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_fail.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_fail.py
new file mode 100644 (file)
index 0000000..2f249cb
--- /dev/null
@@ -0,0 +1,105 @@
+from json.tests import PyTest, CTest\r
+\r
+# 2007-10-05\r
+JSONDOCS = [\r
+    # http://json.org/JSON_checker/test/fail1.json\r
+    '"A JSON payload should be an object or array, not a string."',\r
+    # http://json.org/JSON_checker/test/fail2.json\r
+    '["Unclosed array"',\r
+    # http://json.org/JSON_checker/test/fail3.json\r
+    '{unquoted_key: "keys must be quoted"}',\r
+    # http://json.org/JSON_checker/test/fail4.json\r
+    '["extra comma",]',\r
+    # http://json.org/JSON_checker/test/fail5.json\r
+    '["double extra comma",,]',\r
+    # http://json.org/JSON_checker/test/fail6.json\r
+    '[   , "<-- missing value"]',\r
+    # http://json.org/JSON_checker/test/fail7.json\r
+    '["Comma after the close"],',\r
+    # http://json.org/JSON_checker/test/fail8.json\r
+    '["Extra close"]]',\r
+    # http://json.org/JSON_checker/test/fail9.json\r
+    '{"Extra comma": true,}',\r
+    # http://json.org/JSON_checker/test/fail10.json\r
+    '{"Extra value after close": true} "misplaced quoted value"',\r
+    # http://json.org/JSON_checker/test/fail11.json\r
+    '{"Illegal expression": 1 + 2}',\r
+    # http://json.org/JSON_checker/test/fail12.json\r
+    '{"Illegal invocation": alert()}',\r
+    # http://json.org/JSON_checker/test/fail13.json\r
+    '{"Numbers cannot have leading zeroes": 013}',\r
+    # http://json.org/JSON_checker/test/fail14.json\r
+    '{"Numbers cannot be hex": 0x14}',\r
+    # http://json.org/JSON_checker/test/fail15.json\r
+    '["Illegal backslash escape: \\x15"]',\r
+    # http://json.org/JSON_checker/test/fail16.json\r
+    '[\\naked]',\r
+    # http://json.org/JSON_checker/test/fail17.json\r
+    '["Illegal backslash escape: \\017"]',\r
+    # http://json.org/JSON_checker/test/fail18.json\r
+    '[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]',\r
+    # http://json.org/JSON_checker/test/fail19.json\r
+    '{"Missing colon" null}',\r
+    # http://json.org/JSON_checker/test/fail20.json\r
+    '{"Double colon":: null}',\r
+    # http://json.org/JSON_checker/test/fail21.json\r
+    '{"Comma instead of colon", null}',\r
+    # http://json.org/JSON_checker/test/fail22.json\r
+    '["Colon instead of comma": false]',\r
+    # http://json.org/JSON_checker/test/fail23.json\r
+    '["Bad value", truth]',\r
+    # http://json.org/JSON_checker/test/fail24.json\r
+    "['single quote']",\r
+    # http://json.org/JSON_checker/test/fail25.json\r
+    '["\ttab\tcharacter\tin\tstring\t"]',\r
+    # http://json.org/JSON_checker/test/fail26.json\r
+    '["tab\\   character\\   in\\  string\\  "]',\r
+    # http://json.org/JSON_checker/test/fail27.json\r
+    '["line\nbreak"]',\r
+    # http://json.org/JSON_checker/test/fail28.json\r
+    '["line\\\nbreak"]',\r
+    # http://json.org/JSON_checker/test/fail29.json\r
+    '[0e]',\r
+    # http://json.org/JSON_checker/test/fail30.json\r
+    '[0e+]',\r
+    # http://json.org/JSON_checker/test/fail31.json\r
+    '[0e+-1]',\r
+    # http://json.org/JSON_checker/test/fail32.json\r
+    '{"Comma instead if closing brace": true,',\r
+    # http://json.org/JSON_checker/test/fail33.json\r
+    '["mismatch"}',\r
+    # http://code.google.com/p/simplejson/issues/detail?id=3\r
+    u'["A\u001FZ control characters in string"]',\r
+]\r
+\r
+SKIPS = {\r
+    1: "why not have a string payload?",\r
+    18: "spec doesn't specify any nesting limitations",\r
+}\r
+\r
+class TestFail(object):\r
+    def test_failures(self):\r
+        for idx, doc in enumerate(JSONDOCS):\r
+            idx = idx + 1\r
+            if idx in SKIPS:\r
+                self.loads(doc)\r
+                continue\r
+            try:\r
+                self.loads(doc)\r
+            except ValueError:\r
+                pass\r
+            else:\r
+                self.fail("Expected failure for fail{0}.json: {1!r}".format(idx, doc))\r
+\r
+    def test_non_string_keys_dict(self):\r
+        data = {'a' : 1, (1, 2) : 2}\r
+\r
+        #This is for c encoder\r
+        self.assertRaises(TypeError, self.dumps, data)\r
+\r
+        #This is for python encoder\r
+        self.assertRaises(TypeError, self.dumps, data, indent=True)\r
+\r
+\r
+class TestPyFail(TestFail, PyTest): pass\r
+class TestCFail(TestFail, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_float.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_float.py
new file mode 100644 (file)
index 0000000..1fba25b
--- /dev/null
@@ -0,0 +1,37 @@
+import math\r
+from json.tests import PyTest, CTest\r
+\r
+\r
+class TestFloat(object):\r
+    def test_floats(self):\r
+        for num in [1617161771.7650001, math.pi, math.pi**100,\r
+                    math.pi**-100, 3.1]:\r
+            self.assertEqual(float(self.dumps(num)), num)\r
+            self.assertEqual(self.loads(self.dumps(num)), num)\r
+            self.assertEqual(self.loads(unicode(self.dumps(num))), num)\r
+\r
+    def test_ints(self):\r
+        for num in [1, 1L, 1<<32, 1<<64]:\r
+            self.assertEqual(self.dumps(num), str(num))\r
+            self.assertEqual(int(self.dumps(num)), num)\r
+            self.assertEqual(self.loads(self.dumps(num)), num)\r
+            self.assertEqual(self.loads(unicode(self.dumps(num))), num)\r
+\r
+    def test_out_of_range(self):\r
+        self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])\r
+        self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])\r
+\r
+    def test_allow_nan(self):\r
+        for val in (float('inf'), float('-inf'), float('nan')):\r
+            out = self.dumps([val])\r
+            if val == val:  # inf\r
+                self.assertEqual(self.loads(out), [val])\r
+            else:  # nan\r
+                res = self.loads(out)\r
+                self.assertEqual(len(res), 1)\r
+                self.assertNotEqual(res[0], res[0])\r
+            self.assertRaises(ValueError, self.dumps, [val], allow_nan=False)\r
+\r
+\r
+class TestPyFloat(TestFloat, PyTest): pass\r
+class TestCFloat(TestFloat, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_indent.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_indent.py
new file mode 100644 (file)
index 0000000..866abb1
--- /dev/null
@@ -0,0 +1,60 @@
+import textwrap\r
+from StringIO import StringIO\r
+from json.tests import PyTest, CTest\r
+\r
+\r
+class TestIndent(object):\r
+    def test_indent(self):\r
+        h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth',\r
+             {'nifty': 87}, {'field': 'yes', 'morefield': False} ]\r
+\r
+        expect = textwrap.dedent("""\\r
+        [\r
+          [\r
+            "blorpie"\r
+          ],\r
+          [\r
+            "whoops"\r
+          ],\r
+          [],\r
+          "d-shtaeou",\r
+          "d-nthiouh",\r
+          "i-vhbjkhnth",\r
+          {\r
+            "nifty": 87\r
+          },\r
+          {\r
+            "field": "yes",\r
+            "morefield": false\r
+          }\r
+        ]""")\r
+\r
+\r
+        d1 = self.dumps(h)\r
+        d2 = self.dumps(h, indent=2, sort_keys=True, separators=(',', ': '))\r
+\r
+        h1 = self.loads(d1)\r
+        h2 = self.loads(d2)\r
+\r
+        self.assertEqual(h1, h)\r
+        self.assertEqual(h2, h)\r
+        self.assertEqual(d2, expect)\r
+\r
+    def test_indent0(self):\r
+        h = {3: 1}\r
+        def check(indent, expected):\r
+            d1 = self.dumps(h, indent=indent)\r
+            self.assertEqual(d1, expected)\r
+\r
+            sio = StringIO()\r
+            self.json.dump(h, sio, indent=indent)\r
+            self.assertEqual(sio.getvalue(), expected)\r
+\r
+        # indent=0 should emit newlines\r
+        check(0, '{\n"3": 1\n}')\r
+        # indent=None is more compact\r
+        check(None, '{"3": 1}')\r
+\r
+\r
+class TestPyIndent(TestIndent, PyTest): pass\r
+class TestCIndent(TestIndent, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass1.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass1.py
new file mode 100644 (file)
index 0000000..8bf73bc
--- /dev/null
@@ -0,0 +1,75 @@
+from json.tests import PyTest, CTest\r
+\r
+\r
+# from http://json.org/JSON_checker/test/pass1.json\r
+JSON = r'''\r
+[\r
+    "JSON Test Pattern pass1",\r
+    {"object with 1 member":["array with 1 element"]},\r
+    {},\r
+    [],\r
+    -42,\r
+    true,\r
+    false,\r
+    null,\r
+    {\r
+        "integer": 1234567890,\r
+        "real": -9876.543210,\r
+        "e": 0.123456789e-12,\r
+        "E": 1.234567890E+34,\r
+        "":  23456789012E66,\r
+        "zero": 0,\r
+        "one": 1,\r
+        "space": " ",\r
+        "quote": "\"",\r
+        "backslash": "\\",\r
+        "controls": "\b\f\n\r\t",\r
+        "slash": "/ & \/",\r
+        "alpha": "abcdefghijklmnopqrstuvwyz",\r
+        "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",\r
+        "digit": "0123456789",\r
+        "0123456789": "digit",\r
+        "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",\r
+        "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",\r
+        "true": true,\r
+        "false": false,\r
+        "null": null,\r
+        "array":[  ],\r
+        "object":{  },\r
+        "address": "50 St. James Street",\r
+        "url": "http://www.JSON.org/",\r
+        "comment": "// /* <!-- --",\r
+        "# -- --> */": " ",\r
+        " s p a c e d " :[1,2 , 3\r
+\r
+,\r
+\r
+4 , 5        ,          6           ,7        ],"compact":[1,2,3,4,5,6,7],\r
+        "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",\r
+        "quotes": "&#34; \u0022 %22 0x22 034 &#x22;",\r
+        "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"\r
+: "A key can be any string"\r
+    },\r
+    0.5 ,98.6\r
+,\r
+99.44\r
+,\r
+\r
+1066,\r
+1e1,\r
+0.1e1,\r
+1e-1,\r
+1e00,2e+00,2e-00\r
+,"rosebud"]\r
+'''\r
+\r
+class TestPass1(object):\r
+    def test_parse(self):\r
+        # test in/out equivalence and parsing\r
+        res = self.loads(JSON)\r
+        out = self.dumps(res)\r
+        self.assertEqual(res, self.loads(out))\r
+\r
+\r
+class TestPyPass1(TestPass1, PyTest): pass\r
+class TestCPass1(TestPass1, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass2.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass2.py
new file mode 100644 (file)
index 0000000..4972490
--- /dev/null
@@ -0,0 +1,18 @@
+from json.tests import PyTest, CTest\r
+\r
+\r
+# from http://json.org/JSON_checker/test/pass2.json\r
+JSON = r'''\r
+[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]\r
+'''\r
+\r
+class TestPass2(object):\r
+    def test_parse(self):\r
+        # test in/out equivalence and parsing\r
+        res = self.loads(JSON)\r
+        out = self.dumps(res)\r
+        self.assertEqual(res, self.loads(out))\r
+\r
+\r
+class TestPyPass2(TestPass2, PyTest): pass\r
+class TestCPass2(TestPass2, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass3.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass3.py
new file mode 100644 (file)
index 0000000..8dc6d76
--- /dev/null
@@ -0,0 +1,24 @@
+from json.tests import PyTest, CTest\r
+\r
+\r
+# from http://json.org/JSON_checker/test/pass3.json\r
+JSON = r'''\r
+{\r
+    "JSON Test Pattern pass3": {\r
+        "The outermost value": "must be an object or array.",\r
+        "In this test": "It is an object."\r
+    }\r
+}\r
+'''\r
+\r
+\r
+class TestPass3(object):\r
+    def test_parse(self):\r
+        # test in/out equivalence and parsing\r
+        res = self.loads(JSON)\r
+        out = self.dumps(res)\r
+        self.assertEqual(res, self.loads(out))\r
+\r
+\r
+class TestPyPass3(TestPass3, PyTest): pass\r
+class TestCPass3(TestPass3, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_recursion.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_recursion.py
new file mode 100644 (file)
index 0000000..016cd81
--- /dev/null
@@ -0,0 +1,108 @@
+from json.tests import PyTest, CTest\r
+\r
+\r
+class JSONTestObject:\r
+    pass\r
+\r
+\r
+class TestRecursion(object):\r
+    def test_listrecursion(self):\r
+        x = []\r
+        x.append(x)\r
+        try:\r
+            self.dumps(x)\r
+        except ValueError:\r
+            pass\r
+        else:\r
+            self.fail("didn't raise ValueError on list recursion")\r
+        x = []\r
+        y = [x]\r
+        x.append(y)\r
+        try:\r
+            self.dumps(x)\r
+        except ValueError:\r
+            pass\r
+        else:\r
+            self.fail("didn't raise ValueError on alternating list recursion")\r
+        y = []\r
+        x = [y, y]\r
+        # ensure that the marker is cleared\r
+        self.dumps(x)\r
+\r
+    def test_dictrecursion(self):\r
+        x = {}\r
+        x["test"] = x\r
+        try:\r
+            self.dumps(x)\r
+        except ValueError:\r
+            pass\r
+        else:\r
+            self.fail("didn't raise ValueError on dict recursion")\r
+        x = {}\r
+        y = {"a": x, "b": x}\r
+        # ensure that the marker is cleared\r
+        self.dumps(x)\r
+\r
+    def test_defaultrecursion(self):\r
+        class RecursiveJSONEncoder(self.json.JSONEncoder):\r
+            recurse = False\r
+            def default(self, o):\r
+                if o is JSONTestObject:\r
+                    if self.recurse:\r
+                        return [JSONTestObject]\r
+                    else:\r
+                        return 'JSONTestObject'\r
+                return pyjson.JSONEncoder.default(o)\r
+\r
+        enc = RecursiveJSONEncoder()\r
+        self.assertEqual(enc.encode(JSONTestObject), '"JSONTestObject"')\r
+        enc.recurse = True\r
+        try:\r
+            enc.encode(JSONTestObject)\r
+        except ValueError:\r
+            pass\r
+        else:\r
+            self.fail("didn't raise ValueError on default recursion")\r
+\r
+\r
+    def test_highly_nested_objects_decoding(self):\r
+        # test that loading highly-nested objects doesn't segfault when C\r
+        # accelerations are used. See #12017\r
+        # str\r
+        with self.assertRaises(RuntimeError):\r
+            self.loads('{"a":' * 100000 + '1' + '}' * 100000)\r
+        with self.assertRaises(RuntimeError):\r
+            self.loads('{"a":' * 100000 + '[1]' + '}' * 100000)\r
+        with self.assertRaises(RuntimeError):\r
+            self.loads('[' * 100000 + '1' + ']' * 100000)\r
+        # unicode\r
+        with self.assertRaises(RuntimeError):\r
+            self.loads(u'{"a":' * 100000 + u'1' + u'}' * 100000)\r
+        with self.assertRaises(RuntimeError):\r
+            self.loads(u'{"a":' * 100000 + u'[1]' + u'}' * 100000)\r
+        with self.assertRaises(RuntimeError):\r
+            self.loads(u'[' * 100000 + u'1' + u']' * 100000)\r
+\r
+    def test_highly_nested_objects_encoding(self):\r
+        # See #12051\r
+        l, d = [], {}\r
+        for x in xrange(100000):\r
+            l, d = [l], {'k':d}\r
+        with self.assertRaises(RuntimeError):\r
+            self.dumps(l)\r
+        with self.assertRaises(RuntimeError):\r
+            self.dumps(d)\r
+\r
+    def test_endless_recursion(self):\r
+        # See #12051\r
+        class EndlessJSONEncoder(self.json.JSONEncoder):\r
+            def default(self, o):\r
+                """If check_circular is False, this will keep adding another list."""\r
+                return [o]\r
+\r
+        with self.assertRaises(RuntimeError):\r
+            EndlessJSONEncoder(check_circular=False).encode(5j)\r
+\r
+\r
+class TestPyRecursion(TestRecursion, PyTest): pass\r
+class TestCRecursion(TestRecursion, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_scanstring.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_scanstring.py
new file mode 100644 (file)
index 0000000..f4f7b00
--- /dev/null
@@ -0,0 +1,157 @@
+import sys\r
+from json.tests import PyTest, CTest\r
+\r
+\r
+class TestScanstring(object):\r
+    def test_scanstring(self):\r
+        scanstring = self.json.decoder.scanstring\r
+        if sys.maxunicode == 65535:\r
+            self.assertEqual(\r
+                scanstring(u'"z\U0001d120x"', 1, None, True),\r
+                (u'z\U0001d120x', 6))\r
+        else:\r
+            self.assertEqual(\r
+                scanstring(u'"z\U0001d120x"', 1, None, True),\r
+                (u'z\U0001d120x', 5))\r
+\r
+        self.assertEqual(\r
+            scanstring('"\\u007b"', 1, None, True),\r
+            (u'{', 8))\r
+\r
+        self.assertEqual(\r
+            scanstring('"A JSON payload should be an object or array, not a string."', 1, None, True),\r
+            (u'A JSON payload should be an object or array, not a string.', 60))\r
+\r
+        self.assertEqual(\r
+            scanstring('["Unclosed array"', 2, None, True),\r
+            (u'Unclosed array', 17))\r
+\r
+        self.assertEqual(\r
+            scanstring('["extra comma",]', 2, None, True),\r
+            (u'extra comma', 14))\r
+\r
+        self.assertEqual(\r
+            scanstring('["double extra comma",,]', 2, None, True),\r
+            (u'double extra comma', 21))\r
+\r
+        self.assertEqual(\r
+            scanstring('["Comma after the close"],', 2, None, True),\r
+            (u'Comma after the close', 24))\r
+\r
+        self.assertEqual(\r
+            scanstring('["Extra close"]]', 2, None, True),\r
+            (u'Extra close', 14))\r
+\r
+        self.assertEqual(\r
+            scanstring('{"Extra comma": true,}', 2, None, True),\r
+            (u'Extra comma', 14))\r
+\r
+        self.assertEqual(\r
+            scanstring('{"Extra value after close": true} "misplaced quoted value"', 2, None, True),\r
+            (u'Extra value after close', 26))\r
+\r
+        self.assertEqual(\r
+            scanstring('{"Illegal expression": 1 + 2}', 2, None, True),\r
+            (u'Illegal expression', 21))\r
+\r
+        self.assertEqual(\r
+            scanstring('{"Illegal invocation": alert()}', 2, None, True),\r
+            (u'Illegal invocation', 21))\r
+\r
+        self.assertEqual(\r
+            scanstring('{"Numbers cannot have leading zeroes": 013}', 2, None, True),\r
+            (u'Numbers cannot have leading zeroes', 37))\r
+\r
+        self.assertEqual(\r
+            scanstring('{"Numbers cannot be hex": 0x14}', 2, None, True),\r
+            (u'Numbers cannot be hex', 24))\r
+\r
+        self.assertEqual(\r
+            scanstring('[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]', 21, None, True),\r
+            (u'Too deep', 30))\r
+\r
+        self.assertEqual(\r
+            scanstring('{"Missing colon" null}', 2, None, True),\r
+            (u'Missing colon', 16))\r
+\r
+        self.assertEqual(\r
+            scanstring('{"Double colon":: null}', 2, None, True),\r
+            (u'Double colon', 15))\r
+\r
+        self.assertEqual(\r
+            scanstring('{"Comma instead of colon", null}', 2, None, True),\r
+            (u'Comma instead of colon', 25))\r
+\r
+        self.assertEqual(\r
+            scanstring('["Colon instead of comma": false]', 2, None, True),\r
+            (u'Colon instead of comma', 25))\r
+\r
+        self.assertEqual(\r
+            scanstring('["Bad value", truth]', 2, None, True),\r
+            (u'Bad value', 12))\r
+\r
+    def test_surrogates(self):\r
+        scanstring = self.json.decoder.scanstring\r
+        def assertScan(given, expect):\r
+            self.assertEqual(scanstring(given, 1, None, True),\r
+                             (expect, len(given)))\r
+            if not isinstance(given, unicode):\r
+                given = unicode(given)\r
+                self.assertEqual(scanstring(given, 1, None, True),\r
+                                 (expect, len(given)))\r
+\r
+        surrogates = unichr(0xd834) + unichr(0xdd20)\r
+        assertScan('"z\\ud834\\u0079x"', u'z\ud834yx')\r
+        assertScan('"z\\ud834\\udd20x"', u'z\U0001d120x')\r
+        assertScan('"z\\ud834\\ud834\\udd20x"', u'z\ud834\U0001d120x')\r
+        assertScan('"z\\ud834x"', u'z\ud834x')\r
+        assertScan(u'"z\\ud834\udd20x12345"', u'z%sx12345' % surrogates)\r
+        assertScan('"z\\udd20x"', u'z\udd20x')\r
+        assertScan(u'"z\ud834\udd20x"', u'z\ud834\udd20x')\r
+        assertScan(u'"z\ud834\\udd20x"', u'z%sx' % surrogates)\r
+        assertScan(u'"z\ud834x"', u'z\ud834x')\r
+\r
+    def test_bad_escapes(self):\r
+        scanstring = self.json.decoder.scanstring\r
+        bad_escapes = [\r
+            '"\\"',\r
+            '"\\x"',\r
+            '"\\u"',\r
+            '"\\u0"',\r
+            '"\\u01"',\r
+            '"\\u012"',\r
+            '"\\uz012"',\r
+            '"\\u0z12"',\r
+            '"\\u01z2"',\r
+            '"\\u012z"',\r
+            '"\\u0x12"',\r
+            '"\\u0X12"',\r
+            '"\\ud834\\"',\r
+            '"\\ud834\\u"',\r
+            '"\\ud834\\ud"',\r
+            '"\\ud834\\udd"',\r
+            '"\\ud834\\udd2"',\r
+            '"\\ud834\\uzdd2"',\r
+            '"\\ud834\\udzd2"',\r
+            '"\\ud834\\uddz2"',\r
+            '"\\ud834\\udd2z"',\r
+            '"\\ud834\\u0x20"',\r
+            '"\\ud834\\u0X20"',\r
+        ]\r
+        for s in bad_escapes:\r
+            with self.assertRaises(ValueError):\r
+                scanstring(s, 1, None, True)\r
+\r
+    def test_issue3623(self):\r
+        self.assertRaises(ValueError, self.json.decoder.scanstring, b"xxx", 1,\r
+                          "xxx")\r
+        self.assertRaises(UnicodeDecodeError,\r
+                          self.json.encoder.encode_basestring_ascii, b"xx\xff")\r
+\r
+    def test_overflow(self):\r
+        with self.assertRaises(OverflowError):\r
+            self.json.decoder.scanstring(b"xxx", sys.maxsize+1)\r
+\r
+\r
+class TestPyScanstring(TestScanstring, PyTest): pass\r
+class TestCScanstring(TestScanstring, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_separators.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_separators.py
new file mode 100644 (file)
index 0000000..b468c3b
--- /dev/null
@@ -0,0 +1,44 @@
+import textwrap\r
+from json.tests import PyTest, CTest\r
+\r
+\r
+class TestSeparators(object):\r
+    def test_separators(self):\r
+        h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth',\r
+             {'nifty': 87}, {'field': 'yes', 'morefield': False} ]\r
+\r
+        expect = textwrap.dedent("""\\r
+        [\r
+          [\r
+            "blorpie"\r
+          ] ,\r
+          [\r
+            "whoops"\r
+          ] ,\r
+          [] ,\r
+          "d-shtaeou" ,\r
+          "d-nthiouh" ,\r
+          "i-vhbjkhnth" ,\r
+          {\r
+            "nifty" : 87\r
+          } ,\r
+          {\r
+            "field" : "yes" ,\r
+            "morefield" : false\r
+          }\r
+        ]""")\r
+\r
+\r
+        d1 = self.dumps(h)\r
+        d2 = self.dumps(h, indent=2, sort_keys=True, separators=(' ,', ' : '))\r
+\r
+        h1 = self.loads(d1)\r
+        h2 = self.loads(d2)\r
+\r
+        self.assertEqual(h1, h)\r
+        self.assertEqual(h2, h)\r
+        self.assertEqual(d2, expect)\r
+\r
+\r
+class TestPySeparators(TestSeparators, PyTest): pass\r
+class TestCSeparators(TestSeparators, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_speedups.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_speedups.py
new file mode 100644 (file)
index 0000000..bc0e00d
--- /dev/null
@@ -0,0 +1,23 @@
+from json.tests import CTest\r
+\r
+\r
+class TestSpeedups(CTest):\r
+    def test_scanstring(self):\r
+        self.assertEqual(self.json.decoder.scanstring.__module__, "_json")\r
+        self.assertIs(self.json.decoder.scanstring, self.json.decoder.c_scanstring)\r
+\r
+    def test_encode_basestring_ascii(self):\r
+        self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__,\r
+                         "_json")\r
+        self.assertIs(self.json.encoder.encode_basestring_ascii,\r
+                      self.json.encoder.c_encode_basestring_ascii)\r
+\r
+class TestDecode(CTest):\r
+    def test_make_scanner(self):\r
+        self.assertRaises(AttributeError, self.json.scanner.c_make_scanner, 1)\r
+\r
+    def test_make_encoder(self):\r
+        self.assertRaises(TypeError, self.json.encoder.c_make_encoder,\r
+            None,\r
+            "\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75",\r
+            None)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py
new file mode 100644 (file)
index 0000000..b45c1e2
--- /dev/null
@@ -0,0 +1,69 @@
+import os\r
+import sys\r
+import textwrap\r
+import unittest\r
+import subprocess\r
+from test import test_support\r
+from test.script_helper import assert_python_ok\r
+\r
+class TestTool(unittest.TestCase):\r
+    data = """\r
+\r
+        [["blorpie"],[ "whoops" ] , [\r
+                                 ],\t"d-shtaeou",\r"d-nthiouh",\r
+        "i-vhbjkhnth", {"nifty":87}, {"morefield" :\tfalse,"field"\r
+            :"yes"}  ]\r
+           """\r
+\r
+    expect = textwrap.dedent("""\\r
+    [\r
+        [\r
+            "blorpie"\r
+        ],\r
+        [\r
+            "whoops"\r
+        ],\r
+        [],\r
+        "d-shtaeou",\r
+        "d-nthiouh",\r
+        "i-vhbjkhnth",\r
+        {\r
+            "nifty": 87\r
+        },\r
+        {\r
+            "field": "yes",\r
+            "morefield": false\r
+        }\r
+    ]\r
+    """)\r
+\r
+    def test_stdin_stdout(self):\r
+        proc = subprocess.Popen(\r
+                (sys.executable, '-m', 'json.tool'),\r
+                stdin=subprocess.PIPE, stdout=subprocess.PIPE)\r
+        out, err = proc.communicate(self.data.encode())\r
+        self.assertEqual(out.splitlines(), self.expect.encode().splitlines())\r
+        self.assertEqual(err, None)\r
+\r
+    def _create_infile(self):\r
+        infile = test_support.TESTFN\r
+        with open(infile, "w") as fp:\r
+            self.addCleanup(os.remove, infile)\r
+            fp.write(self.data)\r
+        return infile\r
+\r
+    def test_infile_stdout(self):\r
+        infile = self._create_infile()\r
+        rc, out, err = assert_python_ok('-m', 'json.tool', infile)\r
+        self.assertEqual(out.splitlines(), self.expect.encode().splitlines())\r
+        self.assertEqual(err, b'')\r
+\r
+    def test_infile_outfile(self):\r
+        infile = self._create_infile()\r
+        outfile = test_support.TESTFN + '.out'\r
+        rc, out, err = assert_python_ok('-m', 'json.tool', infile, outfile)\r
+        self.addCleanup(os.remove, outfile)\r
+        with open(outfile, "r") as fp:\r
+            self.assertEqual(fp.read(), self.expect)\r
+        self.assertEqual(out, b'')\r
+        self.assertEqual(err, b'')\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_unicode.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_unicode.py
new file mode 100644 (file)
index 0000000..4edc69a
--- /dev/null
@@ -0,0 +1,89 @@
+from collections import OrderedDict\r
+from json.tests import PyTest, CTest\r
+\r
+\r
+class TestUnicode(object):\r
+    def test_encoding1(self):\r
+        encoder = self.json.JSONEncoder(encoding='utf-8')\r
+        u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'\r
+        s = u.encode('utf-8')\r
+        ju = encoder.encode(u)\r
+        js = encoder.encode(s)\r
+        self.assertEqual(ju, js)\r
+\r
+    def test_encoding2(self):\r
+        u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'\r
+        s = u.encode('utf-8')\r
+        ju = self.dumps(u, encoding='utf-8')\r
+        js = self.dumps(s, encoding='utf-8')\r
+        self.assertEqual(ju, js)\r
+\r
+    def test_encoding3(self):\r
+        u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'\r
+        j = self.dumps(u)\r
+        self.assertEqual(j, '"\\u03b1\\u03a9"')\r
+\r
+    def test_encoding4(self):\r
+        u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'\r
+        j = self.dumps([u])\r
+        self.assertEqual(j, '["\\u03b1\\u03a9"]')\r
+\r
+    def test_encoding5(self):\r
+        u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'\r
+        j = self.dumps(u, ensure_ascii=False)\r
+        self.assertEqual(j, u'"{0}"'.format(u))\r
+\r
+    def test_encoding6(self):\r
+        u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'\r
+        j = self.dumps([u], ensure_ascii=False)\r
+        self.assertEqual(j, u'["{0}"]'.format(u))\r
+\r
+    def test_big_unicode_encode(self):\r
+        u = u'\U0001d120'\r
+        self.assertEqual(self.dumps(u), '"\\ud834\\udd20"')\r
+        self.assertEqual(self.dumps(u, ensure_ascii=False), u'"\U0001d120"')\r
+\r
+    def test_big_unicode_decode(self):\r
+        u = u'z\U0001d120x'\r
+        self.assertEqual(self.loads('"' + u + '"'), u)\r
+        self.assertEqual(self.loads('"z\\ud834\\udd20x"'), u)\r
+\r
+    def test_unicode_decode(self):\r
+        for i in range(0, 0xd7ff):\r
+            u = unichr(i)\r
+            s = '"\\u{0:04x}"'.format(i)\r
+            self.assertEqual(self.loads(s), u)\r
+\r
+    def test_object_pairs_hook_with_unicode(self):\r
+        s = u'{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'\r
+        p = [(u"xkd", 1), (u"kcw", 2), (u"art", 3), (u"hxm", 4),\r
+             (u"qrt", 5), (u"pad", 6), (u"hoy", 7)]\r
+        self.assertEqual(self.loads(s), eval(s))\r
+        self.assertEqual(self.loads(s, object_pairs_hook = lambda x: x), p)\r
+        od = self.loads(s, object_pairs_hook = OrderedDict)\r
+        self.assertEqual(od, OrderedDict(p))\r
+        self.assertEqual(type(od), OrderedDict)\r
+        # the object_pairs_hook takes priority over the object_hook\r
+        self.assertEqual(self.loads(s,\r
+                                    object_pairs_hook = OrderedDict,\r
+                                    object_hook = lambda x: None),\r
+                         OrderedDict(p))\r
+\r
+    def test_default_encoding(self):\r
+        self.assertEqual(self.loads(u'{"a": "\xe9"}'.encode('utf-8')),\r
+            {'a': u'\xe9'})\r
+\r
+    def test_unicode_preservation(self):\r
+        self.assertEqual(type(self.loads(u'""')), unicode)\r
+        self.assertEqual(type(self.loads(u'"a"')), unicode)\r
+        self.assertEqual(type(self.loads(u'["a"]')[0]), unicode)\r
+        # Issue 10038.\r
+        self.assertEqual(type(self.loads('"foo"')), unicode)\r
+\r
+    def test_bad_encoding(self):\r
+        self.assertRaises(UnicodeEncodeError, self.loads, '"a"', u"rat\xe9")\r
+        self.assertRaises(TypeError, self.loads, '"a"', 1)\r
+\r
+\r
+class TestPyUnicode(TestUnicode, PyTest): pass\r
+class TestCUnicode(TestUnicode, CTest): pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tool.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tool.py
new file mode 100644 (file)
index 0000000..ea96f6b
--- /dev/null
@@ -0,0 +1,40 @@
+r"""Command-line tool to validate and pretty-print JSON\r
+\r
+Usage::\r
+\r
+    $ echo '{"json":"obj"}' | python -m json.tool\r
+    {\r
+        "json": "obj"\r
+    }\r
+    $ echo '{ 1.2:3.4}' | python -m json.tool\r
+    Expecting property name enclosed in double quotes: line 1 column 3 (char 2)\r
+\r
+"""\r
+import sys\r
+import json\r
+\r
+def main():\r
+    if len(sys.argv) == 1:\r
+        infile = sys.stdin\r
+        outfile = sys.stdout\r
+    elif len(sys.argv) == 2:\r
+        infile = open(sys.argv[1], 'rb')\r
+        outfile = sys.stdout\r
+    elif len(sys.argv) == 3:\r
+        infile = open(sys.argv[1], 'rb')\r
+        outfile = open(sys.argv[2], 'wb')\r
+    else:\r
+        raise SystemExit(sys.argv[0] + " [infile [outfile]]")\r
+    with infile:\r
+        try:\r
+            obj = json.load(infile)\r
+        except ValueError, e:\r
+            raise SystemExit(e)\r
+    with outfile:\r
+        json.dump(obj, outfile, sort_keys=True,\r
+                  indent=4, separators=(',', ': '))\r
+        outfile.write('\n')\r
+\r
+\r
+if __name__ == '__main__':\r
+    main()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/keyword.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/keyword.py
new file mode 100644 (file)
index 0000000..d8a0746
--- /dev/null
@@ -0,0 +1,93 @@
+#! /usr/bin/env python\r
+\r
+"""Keywords (from "graminit.c")\r
+\r
+This file is automatically generated; please don't muck it up!\r
+\r
+To update the symbols in this file, 'cd' to the top directory of\r
+the python source tree after building the interpreter and run:\r
+\r
+    ./python Lib/keyword.py\r
+"""\r
+\r
+__all__ = ["iskeyword", "kwlist"]\r
+\r
+kwlist = [\r
+#--start keywords--\r
+        'and',\r
+        'as',\r
+        'assert',\r
+        'break',\r
+        'class',\r
+        'continue',\r
+        'def',\r
+        'del',\r
+        'elif',\r
+        'else',\r
+        'except',\r
+        'exec',\r
+        'finally',\r
+        'for',\r
+        'from',\r
+        'global',\r
+        'if',\r
+        'import',\r
+        'in',\r
+        'is',\r
+        'lambda',\r
+        'not',\r
+        'or',\r
+        'pass',\r
+        'print',\r
+        'raise',\r
+        'return',\r
+        'try',\r
+        'while',\r
+        'with',\r
+        'yield',\r
+#--end keywords--\r
+        ]\r
+\r
+iskeyword = frozenset(kwlist).__contains__\r
+\r
+def main():\r
+    import sys, re\r
+\r
+    args = sys.argv[1:]\r
+    iptfile = args and args[0] or "Python/graminit.c"\r
+    if len(args) > 1: optfile = args[1]\r
+    else: optfile = "Lib/keyword.py"\r
+\r
+    # scan the source file for keywords\r
+    fp = open(iptfile)\r
+    strprog = re.compile('"([^"]+)"')\r
+    lines = []\r
+    for line in fp:\r
+        if '{1, "' in line:\r
+            match = strprog.search(line)\r
+            if match:\r
+                lines.append("        '" + match.group(1) + "',\n")\r
+    fp.close()\r
+    lines.sort()\r
+\r
+    # load the output skeleton from the target\r
+    fp = open(optfile)\r
+    format = fp.readlines()\r
+    fp.close()\r
+\r
+    # insert the lines of keywords\r
+    try:\r
+        start = format.index("#--start keywords--\n") + 1\r
+        end = format.index("#--end keywords--\n")\r
+        format[start:end] = lines\r
+    except ValueError:\r
+        sys.stderr.write("target does not contain format markers\n")\r
+        sys.exit(1)\r
+\r
+    # write the output file\r
+    fp = open(optfile, 'w')\r
+    fp.write(''.join(format))\r
+    fp.close()\r
+\r
+if __name__ == "__main__":\r
+    main()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/linecache.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/linecache.py
new file mode 100644 (file)
index 0000000..1495348
--- /dev/null
@@ -0,0 +1,139 @@
+"""Cache lines from files.\r
+\r
+This is intended to read lines from modules imported -- hence if a filename\r
+is not found, it will look down the module search path for a file by\r
+that name.\r
+"""\r
+\r
+import sys\r
+import os\r
+\r
+__all__ = ["getline", "clearcache", "checkcache"]\r
+\r
+def getline(filename, lineno, module_globals=None):\r
+    lines = getlines(filename, module_globals)\r
+    if 1 <= lineno <= len(lines):\r
+        return lines[lineno-1]\r
+    else:\r
+        return ''\r
+\r
+\r
+# The cache\r
+\r
+cache = {} # The cache\r
+\r
+\r
+def clearcache():\r
+    """Clear the cache entirely."""\r
+\r
+    global cache\r
+    cache = {}\r
+\r
+\r
+def getlines(filename, module_globals=None):\r
+    """Get the lines for a file from the cache.\r
+    Update the cache if it doesn't contain an entry for this file already."""\r
+\r
+    if filename in cache:\r
+        return cache[filename][2]\r
+\r
+    try:\r
+        return updatecache(filename, module_globals)\r
+    except MemoryError:\r
+        clearcache()\r
+        return []\r
+\r
+\r
+def checkcache(filename=None):\r
+    """Discard cache entries that are out of date.\r
+    (This is not checked upon each call!)"""\r
+\r
+    if filename is None:\r
+        filenames = cache.keys()\r
+    else:\r
+        if filename in cache:\r
+            filenames = [filename]\r
+        else:\r
+            return\r
+\r
+    for filename in filenames:\r
+        size, mtime, lines, fullname = cache[filename]\r
+        if mtime is None:\r
+            continue   # no-op for files loaded via a __loader__\r
+        try:\r
+            stat = os.stat(fullname)\r
+        except os.error:\r
+            del cache[filename]\r
+            continue\r
+        if size != stat.st_size or mtime != stat.st_mtime:\r
+            del cache[filename]\r
+\r
+\r
+def updatecache(filename, module_globals=None):\r
+    """Update a cache entry and return its list of lines.\r
+    If something's wrong, print a message, discard the cache entry,\r
+    and return an empty list."""\r
+\r
+    if filename in cache:\r
+        del cache[filename]\r
+    if not filename or (filename.startswith('<') and filename.endswith('>')):\r
+        return []\r
+\r
+    fullname = filename\r
+    try:\r
+        stat = os.stat(fullname)\r
+    except OSError:\r
+        basename = filename\r
+\r
+        # Try for a __loader__, if available\r
+        if module_globals and '__loader__' in module_globals:\r
+            name = module_globals.get('__name__')\r
+            loader = module_globals['__loader__']\r
+            get_source = getattr(loader, 'get_source', None)\r
+\r
+            if name and get_source:\r
+                try:\r
+                    data = get_source(name)\r
+                except (ImportError, IOError):\r
+                    pass\r
+                else:\r
+                    if data is None:\r
+                        # No luck, the PEP302 loader cannot find the source\r
+                        # for this module.\r
+                        return []\r
+                    cache[filename] = (\r
+                        len(data), None,\r
+                        [line+'\n' for line in data.splitlines()], fullname\r
+                    )\r
+                    return cache[filename][2]\r
+\r
+        # Try looking through the module search path, which is only useful\r
+        # when handling a relative filename.\r
+        if os.path.isabs(filename):\r
+            return []\r
+\r
+        for dirname in sys.path:\r
+            # When using imputil, sys.path may contain things other than\r
+            # strings; ignore them when it happens.\r
+            try:\r
+                fullname = os.path.join(dirname, basename)\r
+            except (TypeError, AttributeError):\r
+                # Not sufficiently string-like to do anything useful with.\r
+                continue\r
+            try:\r
+                stat = os.stat(fullname)\r
+                break\r
+            except os.error:\r
+                pass\r
+        else:\r
+            return []\r
+    try:\r
+        with open(fullname, 'rU') as fp:\r
+            lines = fp.readlines()\r
+    except IOError:\r
+        return []\r
+    if lines and not lines[-1].endswith('\n'):\r
+        lines[-1] += '\n'\r
+    size, mtime = stat.st_size, stat.st_mtime\r
+    cache[filename] = size, mtime, lines, fullname\r
+    return lines\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py
new file mode 100644 (file)
index 0000000..7d466bf
--- /dev/null
@@ -0,0 +1,2062 @@
+""" Locale support.\r
+\r
+    The module provides low-level access to the C lib's locale APIs\r
+    and adds high level number formatting APIs as well as a locale\r
+    aliasing engine to complement these.\r
+\r
+    The aliasing engine includes support for many commonly used locale\r
+    names and maps them to values suitable for passing to the C lib's\r
+    setlocale() function. It also includes default encodings for all\r
+    supported locale names.\r
+\r
+"""\r
+\r
+import sys\r
+import encodings\r
+import encodings.aliases\r
+import re\r
+import operator\r
+import functools\r
+\r
+try:\r
+    _unicode = unicode\r
+except NameError:\r
+    # If Python is built without Unicode support, the unicode type\r
+    # will not exist. Fake one.\r
+    class _unicode(object):\r
+        pass\r
+\r
+# Try importing the _locale module.\r
+#\r
+# If this fails, fall back on a basic 'C' locale emulation.\r
+\r
+# Yuck:  LC_MESSAGES is non-standard:  can't tell whether it exists before\r
+# trying the import.  So __all__ is also fiddled at the end of the file.\r
+__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",\r
+           "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",\r
+           "str", "atof", "atoi", "format", "format_string", "currency",\r
+           "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",\r
+           "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]\r
+\r
+try:\r
+\r
+    from _locale import *\r
+\r
+except ImportError:\r
+\r
+    # Locale emulation\r
+\r
+    CHAR_MAX = 127\r
+    LC_ALL = 6\r
+    LC_COLLATE = 3\r
+    LC_CTYPE = 0\r
+    LC_MESSAGES = 5\r
+    LC_MONETARY = 4\r
+    LC_NUMERIC = 1\r
+    LC_TIME = 2\r
+    Error = ValueError\r
+\r
+    def localeconv():\r
+        """ localeconv() -> dict.\r
+            Returns numeric and monetary locale-specific parameters.\r
+        """\r
+        # 'C' locale default values\r
+        return {'grouping': [127],\r
+                'currency_symbol': '',\r
+                'n_sign_posn': 127,\r
+                'p_cs_precedes': 127,\r
+                'n_cs_precedes': 127,\r
+                'mon_grouping': [],\r
+                'n_sep_by_space': 127,\r
+                'decimal_point': '.',\r
+                'negative_sign': '',\r
+                'positive_sign': '',\r
+                'p_sep_by_space': 127,\r
+                'int_curr_symbol': '',\r
+                'p_sign_posn': 127,\r
+                'thousands_sep': '',\r
+                'mon_thousands_sep': '',\r
+                'frac_digits': 127,\r
+                'mon_decimal_point': '',\r
+                'int_frac_digits': 127}\r
+\r
+    def setlocale(category, value=None):\r
+        """ setlocale(integer,string=None) -> string.\r
+            Activates/queries locale processing.\r
+        """\r
+        if value not in (None, '', 'C'):\r
+            raise Error, '_locale emulation only supports "C" locale'\r
+        return 'C'\r
+\r
+    def strcoll(a,b):\r
+        """ strcoll(string,string) -> int.\r
+            Compares two strings according to the locale.\r
+        """\r
+        return cmp(a,b)\r
+\r
+    def strxfrm(s):\r
+        """ strxfrm(string) -> string.\r
+            Returns a string that behaves for cmp locale-aware.\r
+        """\r
+        return s\r
+\r
+\r
+_localeconv = localeconv\r
+\r
+# With this dict, you can override some items of localeconv's return value.\r
+# This is useful for testing purposes.\r
+_override_localeconv = {}\r
+\r
+@functools.wraps(_localeconv)\r
+def localeconv():\r
+    d = _localeconv()\r
+    if _override_localeconv:\r
+        d.update(_override_localeconv)\r
+    return d\r
+\r
+\r
+### Number formatting APIs\r
+\r
+# Author: Martin von Loewis\r
+# improved by Georg Brandl\r
+\r
+# Iterate over grouping intervals\r
+def _grouping_intervals(grouping):\r
+    last_interval = None\r
+    for interval in grouping:\r
+        # if grouping is -1, we are done\r
+        if interval == CHAR_MAX:\r
+            return\r
+        # 0: re-use last group ad infinitum\r
+        if interval == 0:\r
+            if last_interval is None:\r
+                raise ValueError("invalid grouping")\r
+            while True:\r
+                yield last_interval\r
+        yield interval\r
+        last_interval = interval\r
+\r
+#perform the grouping from right to left\r
+def _group(s, monetary=False):\r
+    conv = localeconv()\r
+    thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']\r
+    grouping = conv[monetary and 'mon_grouping' or 'grouping']\r
+    if not grouping:\r
+        return (s, 0)\r
+    if s[-1] == ' ':\r
+        stripped = s.rstrip()\r
+        right_spaces = s[len(stripped):]\r
+        s = stripped\r
+    else:\r
+        right_spaces = ''\r
+    left_spaces = ''\r
+    groups = []\r
+    for interval in _grouping_intervals(grouping):\r
+        if not s or s[-1] not in "0123456789":\r
+            # only non-digit characters remain (sign, spaces)\r
+            left_spaces = s\r
+            s = ''\r
+            break\r
+        groups.append(s[-interval:])\r
+        s = s[:-interval]\r
+    if s:\r
+        groups.append(s)\r
+    groups.reverse()\r
+    return (\r
+        left_spaces + thousands_sep.join(groups) + right_spaces,\r
+        len(thousands_sep) * (len(groups) - 1)\r
+    )\r
+\r
+# Strip a given amount of excess padding from the given string\r
+def _strip_padding(s, amount):\r
+    lpos = 0\r
+    while amount and s[lpos] == ' ':\r
+        lpos += 1\r
+        amount -= 1\r
+    rpos = len(s) - 1\r
+    while amount and s[rpos] == ' ':\r
+        rpos -= 1\r
+        amount -= 1\r
+    return s[lpos:rpos+1]\r
+\r
+_percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?'\r
+                         r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')\r
+\r
+def format(percent, value, grouping=False, monetary=False, *additional):\r
+    """Returns the locale-aware substitution of a %? specifier\r
+    (percent).\r
+\r
+    additional is for format strings which contain one or more\r
+    '*' modifiers."""\r
+    # this is only for one-percent-specifier strings and this should be checked\r
+    match = _percent_re.match(percent)\r
+    if not match or len(match.group())!= len(percent):\r
+        raise ValueError(("format() must be given exactly one %%char "\r
+                         "format specifier, %s not valid") % repr(percent))\r
+    return _format(percent, value, grouping, monetary, *additional)\r
+\r
+def _format(percent, value, grouping=False, monetary=False, *additional):\r
+    if additional:\r
+        formatted = percent % ((value,) + additional)\r
+    else:\r
+        formatted = percent % value\r
+    # floats and decimal ints need special action!\r
+    if percent[-1] in 'eEfFgG':\r
+        seps = 0\r
+        parts = formatted.split('.')\r
+        if grouping:\r
+            parts[0], seps = _group(parts[0], monetary=monetary)\r
+        decimal_point = localeconv()[monetary and 'mon_decimal_point'\r
+                                              or 'decimal_point']\r
+        formatted = decimal_point.join(parts)\r
+        if seps:\r
+            formatted = _strip_padding(formatted, seps)\r
+    elif percent[-1] in 'diu':\r
+        seps = 0\r
+        if grouping:\r
+            formatted, seps = _group(formatted, monetary=monetary)\r
+        if seps:\r
+            formatted = _strip_padding(formatted, seps)\r
+    return formatted\r
+\r
+def format_string(f, val, grouping=False):\r
+    """Formats a string in the same way that the % formatting would use,\r
+    but takes the current locale into account.\r
+    Grouping is applied if the third parameter is true."""\r
+    percents = list(_percent_re.finditer(f))\r
+    new_f = _percent_re.sub('%s', f)\r
+\r
+    if operator.isMappingType(val):\r
+        new_val = []\r
+        for perc in percents:\r
+            if perc.group()[-1]=='%':\r
+                new_val.append('%')\r
+            else:\r
+                new_val.append(format(perc.group(), val, grouping))\r
+    else:\r
+        if not isinstance(val, tuple):\r
+            val = (val,)\r
+        new_val = []\r
+        i = 0\r
+        for perc in percents:\r
+            if perc.group()[-1]=='%':\r
+                new_val.append('%')\r
+            else:\r
+                starcount = perc.group('modifiers').count('*')\r
+                new_val.append(_format(perc.group(),\r
+                                      val[i],\r
+                                      grouping,\r
+                                      False,\r
+                                      *val[i+1:i+1+starcount]))\r
+                i += (1 + starcount)\r
+    val = tuple(new_val)\r
+\r
+    return new_f % val\r
+\r
+def currency(val, symbol=True, grouping=False, international=False):\r
+    """Formats val according to the currency settings\r
+    in the current locale."""\r
+    conv = localeconv()\r
+\r
+    # check for illegal values\r
+    digits = conv[international and 'int_frac_digits' or 'frac_digits']\r
+    if digits == 127:\r
+        raise ValueError("Currency formatting is not possible using "\r
+                         "the 'C' locale.")\r
+\r
+    s = format('%%.%if' % digits, abs(val), grouping, monetary=True)\r
+    # '<' and '>' are markers if the sign must be inserted between symbol and value\r
+    s = '<' + s + '>'\r
+\r
+    if symbol:\r
+        smb = conv[international and 'int_curr_symbol' or 'currency_symbol']\r
+        precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']\r
+        separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']\r
+\r
+        if precedes:\r
+            s = smb + (separated and ' ' or '') + s\r
+        else:\r
+            s = s + (separated and ' ' or '') + smb\r
+\r
+    sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']\r
+    sign = conv[val<0 and 'negative_sign' or 'positive_sign']\r
+\r
+    if sign_pos == 0:\r
+        s = '(' + s + ')'\r
+    elif sign_pos == 1:\r
+        s = sign + s\r
+    elif sign_pos == 2:\r
+        s = s + sign\r
+    elif sign_pos == 3:\r
+        s = s.replace('<', sign)\r
+    elif sign_pos == 4:\r
+        s = s.replace('>', sign)\r
+    else:\r
+        # the default if nothing specified;\r
+        # this should be the most fitting sign position\r
+        s = sign + s\r
+\r
+    return s.replace('<', '').replace('>', '')\r
+\r
+def str(val):\r
+    """Convert float to integer, taking the locale into account."""\r
+    return format("%.12g", val)\r
+\r
+def atof(string, func=float):\r
+    "Parses a string as a float according to the locale settings."\r
+    #First, get rid of the grouping\r
+    ts = localeconv()['thousands_sep']\r
+    if ts:\r
+        string = string.replace(ts, '')\r
+    #next, replace the decimal point with a dot\r
+    dd = localeconv()['decimal_point']\r
+    if dd:\r
+        string = string.replace(dd, '.')\r
+    #finally, parse the string\r
+    return func(string)\r
+\r
+def atoi(str):\r
+    "Converts a string to an integer according to the locale settings."\r
+    return atof(str, int)\r
+\r
+def _test():\r
+    setlocale(LC_ALL, "")\r
+    #do grouping\r
+    s1 = format("%d", 123456789,1)\r
+    print s1, "is", atoi(s1)\r
+    #standard formatting\r
+    s1 = str(3.14)\r
+    print s1, "is", atof(s1)\r
+\r
+### Locale name aliasing engine\r
+\r
+# Author: Marc-Andre Lemburg, mal@lemburg.com\r
+# Various tweaks by Fredrik Lundh <fredrik@pythonware.com>\r
+\r
+# store away the low-level version of setlocale (it's\r
+# overridden below)\r
+_setlocale = setlocale\r
+\r
+# Avoid relying on the locale-dependent .lower() method\r
+# (see issue #1813).\r
+_ascii_lower_map = ''.join(\r
+    chr(x + 32 if x >= ord('A') and x <= ord('Z') else x)\r
+    for x in range(256)\r
+)\r
+\r
+def _replace_encoding(code, encoding):\r
+    if '.' in code:\r
+        langname = code[:code.index('.')]\r
+    else:\r
+        langname = code\r
+    # Convert the encoding to a C lib compatible encoding string\r
+    norm_encoding = encodings.normalize_encoding(encoding)\r
+    #print('norm encoding: %r' % norm_encoding)\r
+    norm_encoding = encodings.aliases.aliases.get(norm_encoding,\r
+                                                  norm_encoding)\r
+    #print('aliased encoding: %r' % norm_encoding)\r
+    encoding = locale_encoding_alias.get(norm_encoding,\r
+                                         norm_encoding)\r
+    #print('found encoding %r' % encoding)\r
+    return langname + '.' + encoding\r
+\r
+def normalize(localename):\r
+\r
+    """ Returns a normalized locale code for the given locale\r
+        name.\r
+\r
+        The returned locale code is formatted for use with\r
+        setlocale().\r
+\r
+        If normalization fails, the original name is returned\r
+        unchanged.\r
+\r
+        If the given encoding is not known, the function defaults to\r
+        the default encoding for the locale code just like setlocale()\r
+        does.\r
+\r
+    """\r
+    # Normalize the locale name and extract the encoding and modifier\r
+    if isinstance(localename, _unicode):\r
+        localename = localename.encode('ascii')\r
+    code = localename.translate(_ascii_lower_map)\r
+    if ':' in code:\r
+        # ':' is sometimes used as encoding delimiter.\r
+        code = code.replace(':', '.')\r
+    if '@' in code:\r
+        code, modifier = code.split('@', 1)\r
+    else:\r
+        modifier = ''\r
+    if '.' in code:\r
+        langname, encoding = code.split('.')[:2]\r
+    else:\r
+        langname = code\r
+        encoding = ''\r
+\r
+    # First lookup: fullname (possibly with encoding and modifier)\r
+    lang_enc = langname\r
+    if encoding:\r
+        norm_encoding = encoding.replace('-', '')\r
+        norm_encoding = norm_encoding.replace('_', '')\r
+        lang_enc += '.' + norm_encoding\r
+    lookup_name = lang_enc\r
+    if modifier:\r
+        lookup_name += '@' + modifier\r
+    code = locale_alias.get(lookup_name, None)\r
+    if code is not None:\r
+        return code\r
+    #print('first lookup failed')\r
+\r
+    if modifier:\r
+        # Second try: fullname without modifier (possibly with encoding)\r
+        code = locale_alias.get(lang_enc, None)\r
+        if code is not None:\r
+            #print('lookup without modifier succeeded')\r
+            if '@' not in code:\r
+                return code + '@' + modifier\r
+            if code.split('@', 1)[1].translate(_ascii_lower_map) == modifier:\r
+                return code\r
+        #print('second lookup failed')\r
+\r
+    if encoding:\r
+        # Third try: langname (without encoding, possibly with modifier)\r
+        lookup_name = langname\r
+        if modifier:\r
+            lookup_name += '@' + modifier\r
+        code = locale_alias.get(lookup_name, None)\r
+        if code is not None:\r
+            #print('lookup without encoding succeeded')\r
+            if '@' not in code:\r
+                return _replace_encoding(code, encoding)\r
+            code, modifier = code.split('@', 1)\r
+            return _replace_encoding(code, encoding) + '@' + modifier\r
+\r
+        if modifier:\r
+            # Fourth try: langname (without encoding and modifier)\r
+            code = locale_alias.get(langname, None)\r
+            if code is not None:\r
+                #print('lookup without modifier and encoding succeeded')\r
+                if '@' not in code:\r
+                    return _replace_encoding(code, encoding) + '@' + modifier\r
+                code, defmod = code.split('@', 1)\r
+                if defmod.translate(_ascii_lower_map) == modifier:\r
+                    return _replace_encoding(code, encoding) + '@' + defmod\r
+\r
+    return localename\r
+\r
+def _parse_localename(localename):\r
+\r
+    """ Parses the locale code for localename and returns the\r
+        result as tuple (language code, encoding).\r
+\r
+        The localename is normalized and passed through the locale\r
+        alias engine. A ValueError is raised in case the locale name\r
+        cannot be parsed.\r
+\r
+        The language code corresponds to RFC 1766.  code and encoding\r
+        can be None in case the values cannot be determined or are\r
+        unknown to this implementation.\r
+\r
+    """\r
+    code = normalize(localename)\r
+    if '@' in code:\r
+        # Deal with locale modifiers\r
+        code, modifier = code.split('@', 1)\r
+        if modifier == 'euro' and '.' not in code:\r
+            # Assume Latin-9 for @euro locales. This is bogus,\r
+            # since some systems may use other encodings for these\r
+            # locales. Also, we ignore other modifiers.\r
+            return code, 'iso-8859-15'\r
+\r
+    if '.' in code:\r
+        return tuple(code.split('.')[:2])\r
+    elif code == 'C':\r
+        return None, None\r
+    raise ValueError, 'unknown locale: %s' % localename\r
+\r
+def _build_localename(localetuple):\r
+\r
+    """ Builds a locale code from the given tuple (language code,\r
+        encoding).\r
+\r
+        No aliasing or normalizing takes place.\r
+\r
+    """\r
+    language, encoding = localetuple\r
+    if language is None:\r
+        language = 'C'\r
+    if encoding is None:\r
+        return language\r
+    else:\r
+        return language + '.' + encoding\r
+\r
+def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):\r
+\r
+    """ Tries to determine the default locale settings and returns\r
+        them as tuple (language code, encoding).\r
+\r
+        According to POSIX, a program which has not called\r
+        setlocale(LC_ALL, "") runs using the portable 'C' locale.\r
+        Calling setlocale(LC_ALL, "") lets it use the default locale as\r
+        defined by the LANG variable. Since we don't want to interfere\r
+        with the current locale setting we thus emulate the behavior\r
+        in the way described above.\r
+\r
+        To maintain compatibility with other platforms, not only the\r
+        LANG variable is tested, but a list of variables given as\r
+        envvars parameter. The first found to be defined will be\r
+        used. envvars defaults to the search path used in GNU gettext;\r
+        it must always contain the variable name 'LANG'.\r
+\r
+        Except for the code 'C', the language code corresponds to RFC\r
+        1766.  code and encoding can be None in case the values cannot\r
+        be determined.\r
+\r
+    """\r
+\r
+    try:\r
+        # check if it's supported by the _locale module\r
+        import _locale\r
+        code, encoding = _locale._getdefaultlocale()\r
+    except (ImportError, AttributeError):\r
+        pass\r
+    else:\r
+        # make sure the code/encoding values are valid\r
+        if sys.platform == "win32" and code and code[:2] == "0x":\r
+            # map windows language identifier to language name\r
+            code = windows_locale.get(int(code, 0))\r
+        # ...add other platform-specific processing here, if\r
+        # necessary...\r
+        return code, encoding\r
+\r
+    # fall back on POSIX behaviour\r
+    import os\r
+    lookup = os.environ.get\r
+    for variable in envvars:\r
+        localename = lookup(variable,None)\r
+        if localename:\r
+            if variable == 'LANGUAGE':\r
+                localename = localename.split(':')[0]\r
+            break\r
+    else:\r
+        localename = 'C'\r
+    return _parse_localename(localename)\r
+\r
+\r
+def getlocale(category=LC_CTYPE):\r
+\r
+    """ Returns the current setting for the given locale category as\r
+        tuple (language code, encoding).\r
+\r
+        category may be one of the LC_* value except LC_ALL. It\r
+        defaults to LC_CTYPE.\r
+\r
+        Except for the code 'C', the language code corresponds to RFC\r
+        1766.  code and encoding can be None in case the values cannot\r
+        be determined.\r
+\r
+    """\r
+    localename = _setlocale(category)\r
+    if category == LC_ALL and ';' in localename:\r
+        raise TypeError, 'category LC_ALL is not supported'\r
+    return _parse_localename(localename)\r
+\r
+def setlocale(category, locale=None):\r
+\r
+    """ Set the locale for the given category.  The locale can be\r
+        a string, an iterable of two strings (language code and encoding),\r
+        or None.\r
+\r
+        Iterables are converted to strings using the locale aliasing\r
+        engine.  Locale strings are passed directly to the C lib.\r
+\r
+        category may be given as one of the LC_* values.\r
+\r
+    """\r
+    if locale and type(locale) is not type(""):\r
+        # convert to string\r
+        locale = normalize(_build_localename(locale))\r
+    return _setlocale(category, locale)\r
+\r
+def resetlocale(category=LC_ALL):\r
+\r
+    """ Sets the locale for category to the default setting.\r
+\r
+        The default setting is determined by calling\r
+        getdefaultlocale(). category defaults to LC_ALL.\r
+\r
+    """\r
+    _setlocale(category, _build_localename(getdefaultlocale()))\r
+\r
+if sys.platform.startswith("win"):\r
+    # On Win32, this will return the ANSI code page\r
+    def getpreferredencoding(do_setlocale = True):\r
+        """Return the charset that the user is likely using."""\r
+        import _locale\r
+        return _locale._getdefaultlocale()[1]\r
+else:\r
+    # On Unix, if CODESET is available, use that.\r
+    try:\r
+        CODESET\r
+    except NameError:\r
+        # Fall back to parsing environment variables :-(\r
+        def getpreferredencoding(do_setlocale = True):\r
+            """Return the charset that the user is likely using,\r
+            by looking at environment variables."""\r
+            return getdefaultlocale()[1]\r
+    else:\r
+        def getpreferredencoding(do_setlocale = True):\r
+            """Return the charset that the user is likely using,\r
+            according to the system configuration."""\r
+            if do_setlocale:\r
+                oldloc = setlocale(LC_CTYPE)\r
+                try:\r
+                    setlocale(LC_CTYPE, "")\r
+                except Error:\r
+                    pass\r
+                result = nl_langinfo(CODESET)\r
+                setlocale(LC_CTYPE, oldloc)\r
+                return result\r
+            else:\r
+                return nl_langinfo(CODESET)\r
+\r
+\r
+### Database\r
+#\r
+# The following data was extracted from the locale.alias file which\r
+# comes with X11 and then hand edited removing the explicit encoding\r
+# definitions and adding some more aliases. The file is usually\r
+# available as /usr/lib/X11/locale/locale.alias.\r
+#\r
+\r
+#\r
+# The local_encoding_alias table maps lowercase encoding alias names\r
+# to C locale encoding names (case-sensitive). Note that normalize()\r
+# first looks up the encoding in the encodings.aliases dictionary and\r
+# then applies this mapping to find the correct C lib name for the\r
+# encoding.\r
+#\r
+locale_encoding_alias = {\r
+\r
+    # Mappings for non-standard encoding names used in locale names\r
+    '437':                          'C',\r
+    'c':                            'C',\r
+    'en':                           'ISO8859-1',\r
+    'jis':                          'JIS7',\r
+    'jis7':                         'JIS7',\r
+    'ajec':                         'eucJP',\r
+\r
+    # Mappings from Python codec names to C lib encoding names\r
+    'ascii':                        'ISO8859-1',\r
+    'latin_1':                      'ISO8859-1',\r
+    'iso8859_1':                    'ISO8859-1',\r
+    'iso8859_10':                   'ISO8859-10',\r
+    'iso8859_11':                   'ISO8859-11',\r
+    'iso8859_13':                   'ISO8859-13',\r
+    'iso8859_14':                   'ISO8859-14',\r
+    'iso8859_15':                   'ISO8859-15',\r
+    'iso8859_16':                   'ISO8859-16',\r
+    'iso8859_2':                    'ISO8859-2',\r
+    'iso8859_3':                    'ISO8859-3',\r
+    'iso8859_4':                    'ISO8859-4',\r
+    'iso8859_5':                    'ISO8859-5',\r
+    'iso8859_6':                    'ISO8859-6',\r
+    'iso8859_7':                    'ISO8859-7',\r
+    'iso8859_8':                    'ISO8859-8',\r
+    'iso8859_9':                    'ISO8859-9',\r
+    'iso2022_jp':                   'JIS7',\r
+    'shift_jis':                    'SJIS',\r
+    'tactis':                       'TACTIS',\r
+    'euc_jp':                       'eucJP',\r
+    'euc_kr':                       'eucKR',\r
+    'utf_8':                        'UTF-8',\r
+    'koi8_r':                       'KOI8-R',\r
+    'koi8_u':                       'KOI8-U',\r
+    # XXX This list is still incomplete. If you know more\r
+    # mappings, please file a bug report. Thanks.\r
+}\r
+\r
+#\r
+# The locale_alias table maps lowercase alias names to C locale names\r
+# (case-sensitive). Encodings are always separated from the locale\r
+# name using a dot ('.'); they should only be given in case the\r
+# language name is needed to interpret the given encoding alias\r
+# correctly (CJK codes often have this need).\r
+#\r
+# Note that the normalize() function which uses this tables\r
+# removes '_' and '-' characters from the encoding part of the\r
+# locale name before doing the lookup. This saves a lot of\r
+# space in the table.\r
+#\r
+# MAL 2004-12-10:\r
+# Updated alias mapping to most recent locale.alias file\r
+# from X.org distribution using makelocalealias.py.\r
+#\r
+# These are the differences compared to the old mapping (Python 2.4\r
+# and older):\r
+#\r
+#    updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'\r
+#    updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'\r
+#    updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'\r
+#    updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'\r
+#    updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'\r
+#    updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'\r
+#    updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1'\r
+#    updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'\r
+#    updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'\r
+#    updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'\r
+#    updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'\r
+#    updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'\r
+#    updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'\r
+#    updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP'\r
+#    updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13'\r
+#    updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13'\r
+#    updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'\r
+#    updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'\r
+#    updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11'\r
+#    updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312'\r
+#    updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5'\r
+#    updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5'\r
+#\r
+# MAL 2008-05-30:\r
+# Updated alias mapping to most recent locale.alias file\r
+# from X.org distribution using makelocalealias.py.\r
+#\r
+# These are the differences compared to the old mapping (Python 2.5\r
+# and older):\r
+#\r
+#    updated 'cs_cs.iso88592' -> 'cs_CZ.ISO8859-2' to 'cs_CS.ISO8859-2'\r
+#    updated 'serbocroatian' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sh' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sh_hr.iso88592' -> 'sh_HR.ISO8859-2' to 'hr_HR.ISO8859-2'\r
+#    updated 'sh_sp' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sh_yu' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sp' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sp_yu' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr_sp' -> 'sr_SP.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sr_yu' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr_yu.cp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'\r
+#    updated 'sr_yu.iso88592' -> 'sr_YU.ISO8859-2' to 'sr_CS.ISO8859-2'\r
+#    updated 'sr_yu.iso88595' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr_yu.iso88595@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#    updated 'sr_yu.microsoftcp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'\r
+#    updated 'sr_yu.utf8@cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8'\r
+#    updated 'sr_yu@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'\r
+#\r
+# AP 2010-04-12:\r
+# Updated alias mapping to most recent locale.alias file\r
+# from X.org distribution using makelocalealias.py.\r
+#\r
+# These are the differences compared to the old mapping (Python 2.6.5\r
+# and older):\r
+#\r
+#    updated 'ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'\r
+#    updated 'ru_ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'\r
+#    updated 'serbocroatian' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sh' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sh_yu' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sr' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'\r
+#    updated 'sr@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'\r
+#    updated 'sr@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sr_cs.utf8@latn' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sr_cs@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sr_yu' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8@latin'\r
+#    updated 'sr_yu.utf8@cyrillic' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8'\r
+#    updated 'sr_yu@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'\r
+#\r
+# SS 2013-12-20:\r
+# Updated alias mapping to most recent locale.alias file\r
+# from X.org distribution using makelocalealias.py.\r
+#\r
+# These are the differences compared to the old mapping (Python 2.7.6\r
+# and older):\r
+#\r
+#    updated 'a3' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'\r
+#    updated 'a3_az' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'\r
+#    updated 'a3_az.koi8c' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'\r
+#    updated 'cs_cs.iso88592' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'\r
+#    updated 'hebrew' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'\r
+#    updated 'hebrew.iso88598' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'\r
+#    updated 'sd' -> 'sd_IN@devanagari.UTF-8' to 'sd_IN.UTF-8'\r
+#    updated 'sr@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'\r
+#    updated 'sr_cs' -> 'sr_RS.UTF-8' to 'sr_CS.UTF-8'\r
+#    updated 'sr_cs.utf8@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'\r
+#    updated 'sr_cs@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'\r
+#\r
+# SS 2014-10-01:\r
+# Updated alias mapping with glibc 2.19 supported locales.\r
+\r
+locale_alias = {\r
+    'a3':                                   'az_AZ.KOI8-C',\r
+    'a3_az':                                'az_AZ.KOI8-C',\r
+    'a3_az.koi8c':                          'az_AZ.KOI8-C',\r
+    'a3_az.koic':                           'az_AZ.KOI8-C',\r
+    'aa_dj':                                'aa_DJ.ISO8859-1',\r
+    'aa_er':                                'aa_ER.UTF-8',\r
+    'aa_et':                                'aa_ET.UTF-8',\r
+    'af':                                   'af_ZA.ISO8859-1',\r
+    'af_za':                                'af_ZA.ISO8859-1',\r
+    'af_za.iso88591':                       'af_ZA.ISO8859-1',\r
+    'am':                                   'am_ET.UTF-8',\r
+    'am_et':                                'am_ET.UTF-8',\r
+    'american':                             'en_US.ISO8859-1',\r
+    'american.iso88591':                    'en_US.ISO8859-1',\r
+    'an_es':                                'an_ES.ISO8859-15',\r
+    'ar':                                   'ar_AA.ISO8859-6',\r
+    'ar_aa':                                'ar_AA.ISO8859-6',\r
+    'ar_aa.iso88596':                       'ar_AA.ISO8859-6',\r
+    'ar_ae':                                'ar_AE.ISO8859-6',\r
+    'ar_ae.iso88596':                       'ar_AE.ISO8859-6',\r
+    'ar_bh':                                'ar_BH.ISO8859-6',\r
+    'ar_bh.iso88596':                       'ar_BH.ISO8859-6',\r
+    'ar_dz':                                'ar_DZ.ISO8859-6',\r
+    'ar_dz.iso88596':                       'ar_DZ.ISO8859-6',\r
+    'ar_eg':                                'ar_EG.ISO8859-6',\r
+    'ar_eg.iso88596':                       'ar_EG.ISO8859-6',\r
+    'ar_in':                                'ar_IN.UTF-8',\r
+    'ar_iq':                                'ar_IQ.ISO8859-6',\r
+    'ar_iq.iso88596':                       'ar_IQ.ISO8859-6',\r
+    'ar_jo':                                'ar_JO.ISO8859-6',\r
+    'ar_jo.iso88596':                       'ar_JO.ISO8859-6',\r
+    'ar_kw':                                'ar_KW.ISO8859-6',\r
+    'ar_kw.iso88596':                       'ar_KW.ISO8859-6',\r
+    'ar_lb':                                'ar_LB.ISO8859-6',\r
+    'ar_lb.iso88596':                       'ar_LB.ISO8859-6',\r
+    'ar_ly':                                'ar_LY.ISO8859-6',\r
+    'ar_ly.iso88596':                       'ar_LY.ISO8859-6',\r
+    'ar_ma':                                'ar_MA.ISO8859-6',\r
+    'ar_ma.iso88596':                       'ar_MA.ISO8859-6',\r
+    'ar_om':                                'ar_OM.ISO8859-6',\r
+    'ar_om.iso88596':                       'ar_OM.ISO8859-6',\r
+    'ar_qa':                                'ar_QA.ISO8859-6',\r
+    'ar_qa.iso88596':                       'ar_QA.ISO8859-6',\r
+    'ar_sa':                                'ar_SA.ISO8859-6',\r
+    'ar_sa.iso88596':                       'ar_SA.ISO8859-6',\r
+    'ar_sd':                                'ar_SD.ISO8859-6',\r
+    'ar_sd.iso88596':                       'ar_SD.ISO8859-6',\r
+    'ar_sy':                                'ar_SY.ISO8859-6',\r
+    'ar_sy.iso88596':                       'ar_SY.ISO8859-6',\r
+    'ar_tn':                                'ar_TN.ISO8859-6',\r
+    'ar_tn.iso88596':                       'ar_TN.ISO8859-6',\r
+    'ar_ye':                                'ar_YE.ISO8859-6',\r
+    'ar_ye.iso88596':                       'ar_YE.ISO8859-6',\r
+    'arabic':                               'ar_AA.ISO8859-6',\r
+    'arabic.iso88596':                      'ar_AA.ISO8859-6',\r
+    'as':                                   'as_IN.UTF-8',\r
+    'as_in':                                'as_IN.UTF-8',\r
+    'ast_es':                               'ast_ES.ISO8859-15',\r
+    'ayc_pe':                               'ayc_PE.UTF-8',\r
+    'az':                                   'az_AZ.ISO8859-9E',\r
+    'az_az':                                'az_AZ.ISO8859-9E',\r
+    'az_az.iso88599e':                      'az_AZ.ISO8859-9E',\r
+    'be':                                   'be_BY.CP1251',\r
+    'be@latin':                             'be_BY.UTF-8@latin',\r
+    'be_bg.utf8':                           'bg_BG.UTF-8',\r
+    'be_by':                                'be_BY.CP1251',\r
+    'be_by.cp1251':                         'be_BY.CP1251',\r
+    'be_by.microsoftcp1251':                'be_BY.CP1251',\r
+    'be_by.utf8@latin':                     'be_BY.UTF-8@latin',\r
+    'be_by@latin':                          'be_BY.UTF-8@latin',\r
+    'bem_zm':                               'bem_ZM.UTF-8',\r
+    'ber_dz':                               'ber_DZ.UTF-8',\r
+    'ber_ma':                               'ber_MA.UTF-8',\r
+    'bg':                                   'bg_BG.CP1251',\r
+    'bg_bg':                                'bg_BG.CP1251',\r
+    'bg_bg.cp1251':                         'bg_BG.CP1251',\r
+    'bg_bg.iso88595':                       'bg_BG.ISO8859-5',\r
+    'bg_bg.koi8r':                          'bg_BG.KOI8-R',\r
+    'bg_bg.microsoftcp1251':                'bg_BG.CP1251',\r
+    'bho_in':                               'bho_IN.UTF-8',\r
+    'bn_bd':                                'bn_BD.UTF-8',\r
+    'bn_in':                                'bn_IN.UTF-8',\r
+    'bo_cn':                                'bo_CN.UTF-8',\r
+    'bo_in':                                'bo_IN.UTF-8',\r
+    'bokmal':                               'nb_NO.ISO8859-1',\r
+    'bokm\xe5l':                            'nb_NO.ISO8859-1',\r
+    'br':                                   'br_FR.ISO8859-1',\r
+    'br_fr':                                'br_FR.ISO8859-1',\r
+    'br_fr.iso88591':                       'br_FR.ISO8859-1',\r
+    'br_fr.iso885914':                      'br_FR.ISO8859-14',\r
+    'br_fr.iso885915':                      'br_FR.ISO8859-15',\r
+    'br_fr.iso885915@euro':                 'br_FR.ISO8859-15',\r
+    'br_fr.utf8@euro':                      'br_FR.UTF-8',\r
+    'br_fr@euro':                           'br_FR.ISO8859-15',\r
+    'brx_in':                               'brx_IN.UTF-8',\r
+    'bs':                                   'bs_BA.ISO8859-2',\r
+    'bs_ba':                                'bs_BA.ISO8859-2',\r
+    'bs_ba.iso88592':                       'bs_BA.ISO8859-2',\r
+    'bulgarian':                            'bg_BG.CP1251',\r
+    'byn_er':                               'byn_ER.UTF-8',\r
+    'c':                                    'C',\r
+    'c-french':                             'fr_CA.ISO8859-1',\r
+    'c-french.iso88591':                    'fr_CA.ISO8859-1',\r
+    'c.ascii':                              'C',\r
+    'c.en':                                 'C',\r
+    'c.iso88591':                           'en_US.ISO8859-1',\r
+    'c.utf8':                               'en_US.UTF-8',\r
+    'c_c':                                  'C',\r
+    'c_c.c':                                'C',\r
+    'ca':                                   'ca_ES.ISO8859-1',\r
+    'ca_ad':                                'ca_AD.ISO8859-1',\r
+    'ca_ad.iso88591':                       'ca_AD.ISO8859-1',\r
+    'ca_ad.iso885915':                      'ca_AD.ISO8859-15',\r
+    'ca_ad.iso885915@euro':                 'ca_AD.ISO8859-15',\r
+    'ca_ad.utf8@euro':                      'ca_AD.UTF-8',\r
+    'ca_ad@euro':                           'ca_AD.ISO8859-15',\r
+    'ca_es':                                'ca_ES.ISO8859-1',\r
+    'ca_es.iso88591':                       'ca_ES.ISO8859-1',\r
+    'ca_es.iso885915':                      'ca_ES.ISO8859-15',\r
+    'ca_es.iso885915@euro':                 'ca_ES.ISO8859-15',\r
+    'ca_es.utf8@euro':                      'ca_ES.UTF-8',\r
+    'ca_es@valencia':                       'ca_ES.ISO8859-15@valencia',\r
+    'ca_es@euro':                           'ca_ES.ISO8859-15',\r
+    'ca_fr':                                'ca_FR.ISO8859-1',\r
+    'ca_fr.iso88591':                       'ca_FR.ISO8859-1',\r
+    'ca_fr.iso885915':                      'ca_FR.ISO8859-15',\r
+    'ca_fr.iso885915@euro':                 'ca_FR.ISO8859-15',\r
+    'ca_fr.utf8@euro':                      'ca_FR.UTF-8',\r
+    'ca_fr@euro':                           'ca_FR.ISO8859-15',\r
+    'ca_it':                                'ca_IT.ISO8859-1',\r
+    'ca_it.iso88591':                       'ca_IT.ISO8859-1',\r
+    'ca_it.iso885915':                      'ca_IT.ISO8859-15',\r
+    'ca_it.iso885915@euro':                 'ca_IT.ISO8859-15',\r
+    'ca_it.utf8@euro':                      'ca_IT.UTF-8',\r
+    'ca_it@euro':                           'ca_IT.ISO8859-15',\r
+    'catalan':                              'ca_ES.ISO8859-1',\r
+    'cextend':                              'en_US.ISO8859-1',\r
+    'cextend.en':                           'en_US.ISO8859-1',\r
+    'chinese-s':                            'zh_CN.eucCN',\r
+    'chinese-t':                            'zh_TW.eucTW',\r
+    'crh_ua':                               'crh_UA.UTF-8',\r
+    'croatian':                             'hr_HR.ISO8859-2',\r
+    'cs':                                   'cs_CZ.ISO8859-2',\r
+    'cs_cs':                                'cs_CZ.ISO8859-2',\r
+    'cs_cs.iso88592':                       'cs_CZ.ISO8859-2',\r
+    'cs_cz':                                'cs_CZ.ISO8859-2',\r
+    'cs_cz.iso88592':                       'cs_CZ.ISO8859-2',\r
+    'csb_pl':                               'csb_PL.UTF-8',\r
+    'cv_ru':                                'cv_RU.UTF-8',\r
+    'cy':                                   'cy_GB.ISO8859-1',\r
+    'cy_gb':                                'cy_GB.ISO8859-1',\r
+    'cy_gb.iso88591':                       'cy_GB.ISO8859-1',\r
+    'cy_gb.iso885914':                      'cy_GB.ISO8859-14',\r
+    'cy_gb.iso885915':                      'cy_GB.ISO8859-15',\r
+    'cy_gb@euro':                           'cy_GB.ISO8859-15',\r
+    'cz':                                   'cs_CZ.ISO8859-2',\r
+    'cz_cz':                                'cs_CZ.ISO8859-2',\r
+    'czech':                                'cs_CZ.ISO8859-2',\r
+    'da':                                   'da_DK.ISO8859-1',\r
+    'da.iso885915':                         'da_DK.ISO8859-15',\r
+    'da_dk':                                'da_DK.ISO8859-1',\r
+    'da_dk.88591':                          'da_DK.ISO8859-1',\r
+    'da_dk.885915':                         'da_DK.ISO8859-15',\r
+    'da_dk.iso88591':                       'da_DK.ISO8859-1',\r
+    'da_dk.iso885915':                      'da_DK.ISO8859-15',\r
+    'da_dk@euro':                           'da_DK.ISO8859-15',\r
+    'danish':                               'da_DK.ISO8859-1',\r
+    'danish.iso88591':                      'da_DK.ISO8859-1',\r
+    'dansk':                                'da_DK.ISO8859-1',\r
+    'de':                                   'de_DE.ISO8859-1',\r
+    'de.iso885915':                         'de_DE.ISO8859-15',\r
+    'de_at':                                'de_AT.ISO8859-1',\r
+    'de_at.iso88591':                       'de_AT.ISO8859-1',\r
+    'de_at.iso885915':                      'de_AT.ISO8859-15',\r
+    'de_at.iso885915@euro':                 'de_AT.ISO8859-15',\r
+    'de_at.utf8@euro':                      'de_AT.UTF-8',\r
+    'de_at@euro':                           'de_AT.ISO8859-15',\r
+    'de_be':                                'de_BE.ISO8859-1',\r
+    'de_be.iso88591':                       'de_BE.ISO8859-1',\r
+    'de_be.iso885915':                      'de_BE.ISO8859-15',\r
+    'de_be.iso885915@euro':                 'de_BE.ISO8859-15',\r
+    'de_be.utf8@euro':                      'de_BE.UTF-8',\r
+    'de_be@euro':                           'de_BE.ISO8859-15',\r
+    'de_ch':                                'de_CH.ISO8859-1',\r
+    'de_ch.iso88591':                       'de_CH.ISO8859-1',\r
+    'de_ch.iso885915':                      'de_CH.ISO8859-15',\r
+    'de_ch@euro':                           'de_CH.ISO8859-15',\r
+    'de_de':                                'de_DE.ISO8859-1',\r
+    'de_de.88591':                          'de_DE.ISO8859-1',\r
+    'de_de.885915':                         'de_DE.ISO8859-15',\r
+    'de_de.885915@euro':                    'de_DE.ISO8859-15',\r
+    'de_de.iso88591':                       'de_DE.ISO8859-1',\r
+    'de_de.iso885915':                      'de_DE.ISO8859-15',\r
+    'de_de.iso885915@euro':                 'de_DE.ISO8859-15',\r
+    'de_de.utf8@euro':                      'de_DE.UTF-8',\r
+    'de_de@euro':                           'de_DE.ISO8859-15',\r
+    'de_li.utf8':                           'de_LI.UTF-8',\r
+    'de_lu':                                'de_LU.ISO8859-1',\r
+    'de_lu.iso88591':                       'de_LU.ISO8859-1',\r
+    'de_lu.iso885915':                      'de_LU.ISO8859-15',\r
+    'de_lu.iso885915@euro':                 'de_LU.ISO8859-15',\r
+    'de_lu.utf8@euro':                      'de_LU.UTF-8',\r
+    'de_lu@euro':                           'de_LU.ISO8859-15',\r
+    'deutsch':                              'de_DE.ISO8859-1',\r
+    'doi_in':                               'doi_IN.UTF-8',\r
+    'dutch':                                'nl_NL.ISO8859-1',\r
+    'dutch.iso88591':                       'nl_BE.ISO8859-1',\r
+    'dv_mv':                                'dv_MV.UTF-8',\r
+    'dz_bt':                                'dz_BT.UTF-8',\r
+    'ee':                                   'ee_EE.ISO8859-4',\r
+    'ee_ee':                                'ee_EE.ISO8859-4',\r
+    'ee_ee.iso88594':                       'ee_EE.ISO8859-4',\r
+    'eesti':                                'et_EE.ISO8859-1',\r
+    'el':                                   'el_GR.ISO8859-7',\r
+    'el_cy':                                'el_CY.ISO8859-7',\r
+    'el_gr':                                'el_GR.ISO8859-7',\r
+    'el_gr.iso88597':                       'el_GR.ISO8859-7',\r
+    'el_gr@euro':                           'el_GR.ISO8859-15',\r
+    'en':                                   'en_US.ISO8859-1',\r
+    'en.iso88591':                          'en_US.ISO8859-1',\r
+    'en_ag':                                'en_AG.UTF-8',\r
+    'en_au':                                'en_AU.ISO8859-1',\r
+    'en_au.iso88591':                       'en_AU.ISO8859-1',\r
+    'en_be':                                'en_BE.ISO8859-1',\r
+    'en_be@euro':                           'en_BE.ISO8859-15',\r
+    'en_bw':                                'en_BW.ISO8859-1',\r
+    'en_bw.iso88591':                       'en_BW.ISO8859-1',\r
+    'en_ca':                                'en_CA.ISO8859-1',\r
+    'en_ca.iso88591':                       'en_CA.ISO8859-1',\r
+    'en_dk':                                'en_DK.ISO8859-1',\r
+    'en_dl.utf8':                           'en_DL.UTF-8',\r
+    'en_gb':                                'en_GB.ISO8859-1',\r
+    'en_gb.88591':                          'en_GB.ISO8859-1',\r
+    'en_gb.iso88591':                       'en_GB.ISO8859-1',\r
+    'en_gb.iso885915':                      'en_GB.ISO8859-15',\r
+    'en_gb@euro':                           'en_GB.ISO8859-15',\r
+    'en_hk':                                'en_HK.ISO8859-1',\r
+    'en_hk.iso88591':                       'en_HK.ISO8859-1',\r
+    'en_ie':                                'en_IE.ISO8859-1',\r
+    'en_ie.iso88591':                       'en_IE.ISO8859-1',\r
+    'en_ie.iso885915':                      'en_IE.ISO8859-15',\r
+    'en_ie.iso885915@euro':                 'en_IE.ISO8859-15',\r
+    'en_ie.utf8@euro':                      'en_IE.UTF-8',\r
+    'en_ie@euro':                           'en_IE.ISO8859-15',\r
+    'en_in':                                'en_IN.ISO8859-1',\r
+    'en_ng':                                'en_NG.UTF-8',\r
+    'en_nz':                                'en_NZ.ISO8859-1',\r
+    'en_nz.iso88591':                       'en_NZ.ISO8859-1',\r
+    'en_ph':                                'en_PH.ISO8859-1',\r
+    'en_ph.iso88591':                       'en_PH.ISO8859-1',\r
+    'en_sg':                                'en_SG.ISO8859-1',\r
+    'en_sg.iso88591':                       'en_SG.ISO8859-1',\r
+    'en_uk':                                'en_GB.ISO8859-1',\r
+    'en_us':                                'en_US.ISO8859-1',\r
+    'en_us.88591':                          'en_US.ISO8859-1',\r
+    'en_us.885915':                         'en_US.ISO8859-15',\r
+    'en_us.iso88591':                       'en_US.ISO8859-1',\r
+    'en_us.iso885915':                      'en_US.ISO8859-15',\r
+    'en_us.iso885915@euro':                 'en_US.ISO8859-15',\r
+    'en_us@euro':                           'en_US.ISO8859-15',\r
+    'en_us@euro@euro':                      'en_US.ISO8859-15',\r
+    'en_za':                                'en_ZA.ISO8859-1',\r
+    'en_za.88591':                          'en_ZA.ISO8859-1',\r
+    'en_za.iso88591':                       'en_ZA.ISO8859-1',\r
+    'en_za.iso885915':                      'en_ZA.ISO8859-15',\r
+    'en_za@euro':                           'en_ZA.ISO8859-15',\r
+    'en_zm':                                'en_ZM.UTF-8',\r
+    'en_zw':                                'en_ZW.ISO8859-1',\r
+    'en_zw.iso88591':                       'en_ZW.ISO8859-1',\r
+    'en_zw.utf8':                           'en_ZS.UTF-8',\r
+    'eng_gb':                               'en_GB.ISO8859-1',\r
+    'eng_gb.8859':                          'en_GB.ISO8859-1',\r
+    'english':                              'en_EN.ISO8859-1',\r
+    'english.iso88591':                     'en_EN.ISO8859-1',\r
+    'english_uk':                           'en_GB.ISO8859-1',\r
+    'english_uk.8859':                      'en_GB.ISO8859-1',\r
+    'english_united-states':                'en_US.ISO8859-1',\r
+    'english_united-states.437':            'C',\r
+    'english_us':                           'en_US.ISO8859-1',\r
+    'english_us.8859':                      'en_US.ISO8859-1',\r
+    'english_us.ascii':                     'en_US.ISO8859-1',\r
+    'eo':                                   'eo_XX.ISO8859-3',\r
+    'eo.utf8':                              'eo.UTF-8',\r
+    'eo_eo':                                'eo_EO.ISO8859-3',\r
+    'eo_eo.iso88593':                       'eo_EO.ISO8859-3',\r
+    'eo_us.utf8':                           'eo_US.UTF-8',\r
+    'eo_xx':                                'eo_XX.ISO8859-3',\r
+    'eo_xx.iso88593':                       'eo_XX.ISO8859-3',\r
+    'es':                                   'es_ES.ISO8859-1',\r
+    'es_ar':                                'es_AR.ISO8859-1',\r
+    'es_ar.iso88591':                       'es_AR.ISO8859-1',\r
+    'es_bo':                                'es_BO.ISO8859-1',\r
+    'es_bo.iso88591':                       'es_BO.ISO8859-1',\r
+    'es_cl':                                'es_CL.ISO8859-1',\r
+    'es_cl.iso88591':                       'es_CL.ISO8859-1',\r
+    'es_co':                                'es_CO.ISO8859-1',\r
+    'es_co.iso88591':                       'es_CO.ISO8859-1',\r
+    'es_cr':                                'es_CR.ISO8859-1',\r
+    'es_cr.iso88591':                       'es_CR.ISO8859-1',\r
+    'es_cu':                                'es_CU.UTF-8',\r
+    'es_do':                                'es_DO.ISO8859-1',\r
+    'es_do.iso88591':                       'es_DO.ISO8859-1',\r
+    'es_ec':                                'es_EC.ISO8859-1',\r
+    'es_ec.iso88591':                       'es_EC.ISO8859-1',\r
+    'es_es':                                'es_ES.ISO8859-1',\r
+    'es_es.88591':                          'es_ES.ISO8859-1',\r
+    'es_es.iso88591':                       'es_ES.ISO8859-1',\r
+    'es_es.iso885915':                      'es_ES.ISO8859-15',\r
+    'es_es.iso885915@euro':                 'es_ES.ISO8859-15',\r
+    'es_es.utf8@euro':                      'es_ES.UTF-8',\r
+    'es_es@euro':                           'es_ES.ISO8859-15',\r
+    'es_gt':                                'es_GT.ISO8859-1',\r
+    'es_gt.iso88591':                       'es_GT.ISO8859-1',\r
+    'es_hn':                                'es_HN.ISO8859-1',\r
+    'es_hn.iso88591':                       'es_HN.ISO8859-1',\r
+    'es_mx':                                'es_MX.ISO8859-1',\r
+    'es_mx.iso88591':                       'es_MX.ISO8859-1',\r
+    'es_ni':                                'es_NI.ISO8859-1',\r
+    'es_ni.iso88591':                       'es_NI.ISO8859-1',\r
+    'es_pa':                                'es_PA.ISO8859-1',\r
+    'es_pa.iso88591':                       'es_PA.ISO8859-1',\r
+    'es_pa.iso885915':                      'es_PA.ISO8859-15',\r
+    'es_pa@euro':                           'es_PA.ISO8859-15',\r
+    'es_pe':                                'es_PE.ISO8859-1',\r
+    'es_pe.iso88591':                       'es_PE.ISO8859-1',\r
+    'es_pe.iso885915':                      'es_PE.ISO8859-15',\r
+    'es_pe@euro':                           'es_PE.ISO8859-15',\r
+    'es_pr':                                'es_PR.ISO8859-1',\r
+    'es_pr.iso88591':                       'es_PR.ISO8859-1',\r
+    'es_py':                                'es_PY.ISO8859-1',\r
+    'es_py.iso88591':                       'es_PY.ISO8859-1',\r
+    'es_py.iso885915':                      'es_PY.ISO8859-15',\r
+    'es_py@euro':                           'es_PY.ISO8859-15',\r
+    'es_sv':                                'es_SV.ISO8859-1',\r
+    'es_sv.iso88591':                       'es_SV.ISO8859-1',\r
+    'es_sv.iso885915':                      'es_SV.ISO8859-15',\r
+    'es_sv@euro':                           'es_SV.ISO8859-15',\r
+    'es_us':                                'es_US.ISO8859-1',\r
+    'es_us.iso88591':                       'es_US.ISO8859-1',\r
+    'es_uy':                                'es_UY.ISO8859-1',\r
+    'es_uy.iso88591':                       'es_UY.ISO8859-1',\r
+    'es_uy.iso885915':                      'es_UY.ISO8859-15',\r
+    'es_uy@euro':                           'es_UY.ISO8859-15',\r
+    'es_ve':                                'es_VE.ISO8859-1',\r
+    'es_ve.iso88591':                       'es_VE.ISO8859-1',\r
+    'es_ve.iso885915':                      'es_VE.ISO8859-15',\r
+    'es_ve@euro':                           'es_VE.ISO8859-15',\r
+    'estonian':                             'et_EE.ISO8859-1',\r
+    'et':                                   'et_EE.ISO8859-15',\r
+    'et_ee':                                'et_EE.ISO8859-15',\r
+    'et_ee.iso88591':                       'et_EE.ISO8859-1',\r
+    'et_ee.iso885913':                      'et_EE.ISO8859-13',\r
+    'et_ee.iso885915':                      'et_EE.ISO8859-15',\r
+    'et_ee.iso88594':                       'et_EE.ISO8859-4',\r
+    'et_ee@euro':                           'et_EE.ISO8859-15',\r
+    'eu':                                   'eu_ES.ISO8859-1',\r
+    'eu_es':                                'eu_ES.ISO8859-1',\r
+    'eu_es.iso88591':                       'eu_ES.ISO8859-1',\r
+    'eu_es.iso885915':                      'eu_ES.ISO8859-15',\r
+    'eu_es.iso885915@euro':                 'eu_ES.ISO8859-15',\r
+    'eu_es.utf8@euro':                      'eu_ES.UTF-8',\r
+    'eu_es@euro':                           'eu_ES.ISO8859-15',\r
+    'eu_fr':                                'eu_FR.ISO8859-1',\r
+    'fa':                                   'fa_IR.UTF-8',\r
+    'fa_ir':                                'fa_IR.UTF-8',\r
+    'fa_ir.isiri3342':                      'fa_IR.ISIRI-3342',\r
+    'ff_sn':                                'ff_SN.UTF-8',\r
+    'fi':                                   'fi_FI.ISO8859-15',\r
+    'fi.iso885915':                         'fi_FI.ISO8859-15',\r
+    'fi_fi':                                'fi_FI.ISO8859-15',\r
+    'fi_fi.88591':                          'fi_FI.ISO8859-1',\r
+    'fi_fi.iso88591':                       'fi_FI.ISO8859-1',\r
+    'fi_fi.iso885915':                      'fi_FI.ISO8859-15',\r
+    'fi_fi.iso885915@euro':                 'fi_FI.ISO8859-15',\r
+    'fi_fi.utf8@euro':                      'fi_FI.UTF-8',\r
+    'fi_fi@euro':                           'fi_FI.ISO8859-15',\r
+    'fil_ph':                               'fil_PH.UTF-8',\r
+    'finnish':                              'fi_FI.ISO8859-1',\r
+    'finnish.iso88591':                     'fi_FI.ISO8859-1',\r
+    'fo':                                   'fo_FO.ISO8859-1',\r
+    'fo_fo':                                'fo_FO.ISO8859-1',\r
+    'fo_fo.iso88591':                       'fo_FO.ISO8859-1',\r
+    'fo_fo.iso885915':                      'fo_FO.ISO8859-15',\r
+    'fo_fo@euro':                           'fo_FO.ISO8859-15',\r
+    'fr':                                   'fr_FR.ISO8859-1',\r
+    'fr.iso885915':                         'fr_FR.ISO8859-15',\r
+    'fr_be':                                'fr_BE.ISO8859-1',\r
+    'fr_be.88591':                          'fr_BE.ISO8859-1',\r
+    'fr_be.iso88591':                       'fr_BE.ISO8859-1',\r
+    'fr_be.iso885915':                      'fr_BE.ISO8859-15',\r
+    'fr_be.iso885915@euro':                 'fr_BE.ISO8859-15',\r
+    'fr_be.utf8@euro':                      'fr_BE.UTF-8',\r
+    'fr_be@euro':                           'fr_BE.ISO8859-15',\r
+    'fr_ca':                                'fr_CA.ISO8859-1',\r
+    'fr_ca.88591':                          'fr_CA.ISO8859-1',\r
+    'fr_ca.iso88591':                       'fr_CA.ISO8859-1',\r
+    'fr_ca.iso885915':                      'fr_CA.ISO8859-15',\r
+    'fr_ca@euro':                           'fr_CA.ISO8859-15',\r
+    'fr_ch':                                'fr_CH.ISO8859-1',\r
+    'fr_ch.88591':                          'fr_CH.ISO8859-1',\r
+    'fr_ch.iso88591':                       'fr_CH.ISO8859-1',\r
+    'fr_ch.iso885915':                      'fr_CH.ISO8859-15',\r
+    'fr_ch@euro':                           'fr_CH.ISO8859-15',\r
+    'fr_fr':                                'fr_FR.ISO8859-1',\r
+    'fr_fr.88591':                          'fr_FR.ISO8859-1',\r
+    'fr_fr.iso88591':                       'fr_FR.ISO8859-1',\r
+    'fr_fr.iso885915':                      'fr_FR.ISO8859-15',\r
+    'fr_fr.iso885915@euro':                 'fr_FR.ISO8859-15',\r
+    'fr_fr.utf8@euro':                      'fr_FR.UTF-8',\r
+    'fr_fr@euro':                           'fr_FR.ISO8859-15',\r
+    'fr_lu':                                'fr_LU.ISO8859-1',\r
+    'fr_lu.88591':                          'fr_LU.ISO8859-1',\r
+    'fr_lu.iso88591':                       'fr_LU.ISO8859-1',\r
+    'fr_lu.iso885915':                      'fr_LU.ISO8859-15',\r
+    'fr_lu.iso885915@euro':                 'fr_LU.ISO8859-15',\r
+    'fr_lu.utf8@euro':                      'fr_LU.UTF-8',\r
+    'fr_lu@euro':                           'fr_LU.ISO8859-15',\r
+    'fran\xe7ais':                          'fr_FR.ISO8859-1',\r
+    'fre_fr':                               'fr_FR.ISO8859-1',\r
+    'fre_fr.8859':                          'fr_FR.ISO8859-1',\r
+    'french':                               'fr_FR.ISO8859-1',\r
+    'french.iso88591':                      'fr_CH.ISO8859-1',\r
+    'french_france':                        'fr_FR.ISO8859-1',\r
+    'french_france.8859':                   'fr_FR.ISO8859-1',\r
+    'fur_it':                               'fur_IT.UTF-8',\r
+    'fy_de':                                'fy_DE.UTF-8',\r
+    'fy_nl':                                'fy_NL.UTF-8',\r
+    'ga':                                   'ga_IE.ISO8859-1',\r
+    'ga_ie':                                'ga_IE.ISO8859-1',\r
+    'ga_ie.iso88591':                       'ga_IE.ISO8859-1',\r
+    'ga_ie.iso885914':                      'ga_IE.ISO8859-14',\r
+    'ga_ie.iso885915':                      'ga_IE.ISO8859-15',\r
+    'ga_ie.iso885915@euro':                 'ga_IE.ISO8859-15',\r
+    'ga_ie.utf8@euro':                      'ga_IE.UTF-8',\r
+    'ga_ie@euro':                           'ga_IE.ISO8859-15',\r
+    'galego':                               'gl_ES.ISO8859-1',\r
+    'galician':                             'gl_ES.ISO8859-1',\r
+    'gd':                                   'gd_GB.ISO8859-1',\r
+    'gd_gb':                                'gd_GB.ISO8859-1',\r
+    'gd_gb.iso88591':                       'gd_GB.ISO8859-1',\r
+    'gd_gb.iso885914':                      'gd_GB.ISO8859-14',\r
+    'gd_gb.iso885915':                      'gd_GB.ISO8859-15',\r
+    'gd_gb@euro':                           'gd_GB.ISO8859-15',\r
+    'ger_de':                               'de_DE.ISO8859-1',\r
+    'ger_de.8859':                          'de_DE.ISO8859-1',\r
+    'german':                               'de_DE.ISO8859-1',\r
+    'german.iso88591':                      'de_CH.ISO8859-1',\r
+    'german_germany':                       'de_DE.ISO8859-1',\r
+    'german_germany.8859':                  'de_DE.ISO8859-1',\r
+    'gez_er':                               'gez_ER.UTF-8',\r
+    'gez_et':                               'gez_ET.UTF-8',\r
+    'gl':                                   'gl_ES.ISO8859-1',\r
+    'gl_es':                                'gl_ES.ISO8859-1',\r
+    'gl_es.iso88591':                       'gl_ES.ISO8859-1',\r
+    'gl_es.iso885915':                      'gl_ES.ISO8859-15',\r
+    'gl_es.iso885915@euro':                 'gl_ES.ISO8859-15',\r
+    'gl_es.utf8@euro':                      'gl_ES.UTF-8',\r
+    'gl_es@euro':                           'gl_ES.ISO8859-15',\r
+    'greek':                                'el_GR.ISO8859-7',\r
+    'greek.iso88597':                       'el_GR.ISO8859-7',\r
+    'gu_in':                                'gu_IN.UTF-8',\r
+    'gv':                                   'gv_GB.ISO8859-1',\r
+    'gv_gb':                                'gv_GB.ISO8859-1',\r
+    'gv_gb.iso88591':                       'gv_GB.ISO8859-1',\r
+    'gv_gb.iso885914':                      'gv_GB.ISO8859-14',\r
+    'gv_gb.iso885915':                      'gv_GB.ISO8859-15',\r
+    'gv_gb@euro':                           'gv_GB.ISO8859-15',\r
+    'ha_ng':                                'ha_NG.UTF-8',\r
+    'he':                                   'he_IL.ISO8859-8',\r
+    'he_il':                                'he_IL.ISO8859-8',\r
+    'he_il.cp1255':                         'he_IL.CP1255',\r
+    'he_il.iso88598':                       'he_IL.ISO8859-8',\r
+    'he_il.microsoftcp1255':                'he_IL.CP1255',\r
+    'hebrew':                               'he_IL.ISO8859-8',\r
+    'hebrew.iso88598':                      'he_IL.ISO8859-8',\r
+    'hi':                                   'hi_IN.ISCII-DEV',\r
+    'hi_in':                                'hi_IN.ISCII-DEV',\r
+    'hi_in.isciidev':                       'hi_IN.ISCII-DEV',\r
+    'hne':                                  'hne_IN.UTF-8',\r
+    'hne_in':                               'hne_IN.UTF-8',\r
+    'hr':                                   'hr_HR.ISO8859-2',\r
+    'hr_hr':                                'hr_HR.ISO8859-2',\r
+    'hr_hr.iso88592':                       'hr_HR.ISO8859-2',\r
+    'hrvatski':                             'hr_HR.ISO8859-2',\r
+    'hsb_de':                               'hsb_DE.ISO8859-2',\r
+    'ht_ht':                                'ht_HT.UTF-8',\r
+    'hu':                                   'hu_HU.ISO8859-2',\r
+    'hu_hu':                                'hu_HU.ISO8859-2',\r
+    'hu_hu.iso88592':                       'hu_HU.ISO8859-2',\r
+    'hungarian':                            'hu_HU.ISO8859-2',\r
+    'hy_am':                                'hy_AM.UTF-8',\r
+    'hy_am.armscii8':                       'hy_AM.ARMSCII_8',\r
+    'ia':                                   'ia.UTF-8',\r
+    'ia_fr':                                'ia_FR.UTF-8',\r
+    'icelandic':                            'is_IS.ISO8859-1',\r
+    'icelandic.iso88591':                   'is_IS.ISO8859-1',\r
+    'id':                                   'id_ID.ISO8859-1',\r
+    'id_id':                                'id_ID.ISO8859-1',\r
+    'ig_ng':                                'ig_NG.UTF-8',\r
+    'ik_ca':                                'ik_CA.UTF-8',\r
+    'in':                                   'id_ID.ISO8859-1',\r
+    'in_id':                                'id_ID.ISO8859-1',\r
+    'is':                                   'is_IS.ISO8859-1',\r
+    'is_is':                                'is_IS.ISO8859-1',\r
+    'is_is.iso88591':                       'is_IS.ISO8859-1',\r
+    'is_is.iso885915':                      'is_IS.ISO8859-15',\r
+    'is_is@euro':                           'is_IS.ISO8859-15',\r
+    'iso-8859-1':                           'en_US.ISO8859-1',\r
+    'iso-8859-15':                          'en_US.ISO8859-15',\r
+    'iso8859-1':                            'en_US.ISO8859-1',\r
+    'iso8859-15':                           'en_US.ISO8859-15',\r
+    'iso_8859_1':                           'en_US.ISO8859-1',\r
+    'iso_8859_15':                          'en_US.ISO8859-15',\r
+    'it':                                   'it_IT.ISO8859-1',\r
+    'it.iso885915':                         'it_IT.ISO8859-15',\r
+    'it_ch':                                'it_CH.ISO8859-1',\r
+    'it_ch.iso88591':                       'it_CH.ISO8859-1',\r
+    'it_ch.iso885915':                      'it_CH.ISO8859-15',\r
+    'it_ch@euro':                           'it_CH.ISO8859-15',\r
+    'it_it':                                'it_IT.ISO8859-1',\r
+    'it_it.88591':                          'it_IT.ISO8859-1',\r
+    'it_it.iso88591':                       'it_IT.ISO8859-1',\r
+    'it_it.iso885915':                      'it_IT.ISO8859-15',\r
+    'it_it.iso885915@euro':                 'it_IT.ISO8859-15',\r
+    'it_it.utf8@euro':                      'it_IT.UTF-8',\r
+    'it_it@euro':                           'it_IT.ISO8859-15',\r
+    'italian':                              'it_IT.ISO8859-1',\r
+    'italian.iso88591':                     'it_IT.ISO8859-1',\r
+    'iu':                                   'iu_CA.NUNACOM-8',\r
+    'iu_ca':                                'iu_CA.NUNACOM-8',\r
+    'iu_ca.nunacom8':                       'iu_CA.NUNACOM-8',\r
+    'iw':                                   'he_IL.ISO8859-8',\r
+    'iw_il':                                'he_IL.ISO8859-8',\r
+    'iw_il.iso88598':                       'he_IL.ISO8859-8',\r
+    'iw_il.utf8':                           'iw_IL.UTF-8',\r
+    'ja':                                   'ja_JP.eucJP',\r
+    'ja.jis':                               'ja_JP.JIS7',\r
+    'ja.sjis':                              'ja_JP.SJIS',\r
+    'ja_jp':                                'ja_JP.eucJP',\r
+    'ja_jp.ajec':                           'ja_JP.eucJP',\r
+    'ja_jp.euc':                            'ja_JP.eucJP',\r
+    'ja_jp.eucjp':                          'ja_JP.eucJP',\r
+    'ja_jp.iso-2022-jp':                    'ja_JP.JIS7',\r
+    'ja_jp.iso2022jp':                      'ja_JP.JIS7',\r
+    'ja_jp.jis':                            'ja_JP.JIS7',\r
+    'ja_jp.jis7':                           'ja_JP.JIS7',\r
+    'ja_jp.mscode':                         'ja_JP.SJIS',\r
+    'ja_jp.pck':                            'ja_JP.SJIS',\r
+    'ja_jp.sjis':                           'ja_JP.SJIS',\r
+    'ja_jp.ujis':                           'ja_JP.eucJP',\r
+    'japan':                                'ja_JP.eucJP',\r
+    'japanese':                             'ja_JP.eucJP',\r
+    'japanese-euc':                         'ja_JP.eucJP',\r
+    'japanese.euc':                         'ja_JP.eucJP',\r
+    'japanese.sjis':                        'ja_JP.SJIS',\r
+    'jp_jp':                                'ja_JP.eucJP',\r
+    'ka':                                   'ka_GE.GEORGIAN-ACADEMY',\r
+    'ka_ge':                                'ka_GE.GEORGIAN-ACADEMY',\r
+    'ka_ge.georgianacademy':                'ka_GE.GEORGIAN-ACADEMY',\r
+    'ka_ge.georgianps':                     'ka_GE.GEORGIAN-PS',\r
+    'ka_ge.georgianrs':                     'ka_GE.GEORGIAN-ACADEMY',\r
+    'kk_kz':                                'kk_KZ.RK1048',\r
+    'kl':                                   'kl_GL.ISO8859-1',\r
+    'kl_gl':                                'kl_GL.ISO8859-1',\r
+    'kl_gl.iso88591':                       'kl_GL.ISO8859-1',\r
+    'kl_gl.iso885915':                      'kl_GL.ISO8859-15',\r
+    'kl_gl@euro':                           'kl_GL.ISO8859-15',\r
+    'km_kh':                                'km_KH.UTF-8',\r
+    'kn':                                   'kn_IN.UTF-8',\r
+    'kn_in':                                'kn_IN.UTF-8',\r
+    'ko':                                   'ko_KR.eucKR',\r
+    'ko_kr':                                'ko_KR.eucKR',\r
+    'ko_kr.euc':                            'ko_KR.eucKR',\r
+    'ko_kr.euckr':                          'ko_KR.eucKR',\r
+    'kok_in':                               'kok_IN.UTF-8',\r
+    'korean':                               'ko_KR.eucKR',\r
+    'korean.euc':                           'ko_KR.eucKR',\r
+    'ks':                                   'ks_IN.UTF-8',\r
+    'ks_in':                                'ks_IN.UTF-8',\r
+    'ks_in@devanagari':                     'ks_IN.UTF-8@devanagari',\r
+    'ks_in@devanagari.utf8':                'ks_IN.UTF-8@devanagari',\r
+    'ku_tr':                                'ku_TR.ISO8859-9',\r
+    'kw':                                   'kw_GB.ISO8859-1',\r
+    'kw_gb':                                'kw_GB.ISO8859-1',\r
+    'kw_gb.iso88591':                       'kw_GB.ISO8859-1',\r
+    'kw_gb.iso885914':                      'kw_GB.ISO8859-14',\r
+    'kw_gb.iso885915':                      'kw_GB.ISO8859-15',\r
+    'kw_gb@euro':                           'kw_GB.ISO8859-15',\r
+    'ky':                                   'ky_KG.UTF-8',\r
+    'ky_kg':                                'ky_KG.UTF-8',\r
+    'lb_lu':                                'lb_LU.UTF-8',\r
+    'lg_ug':                                'lg_UG.ISO8859-10',\r
+    'li_be':                                'li_BE.UTF-8',\r
+    'li_nl':                                'li_NL.UTF-8',\r
+    'lij_it':                               'lij_IT.UTF-8',\r
+    'lithuanian':                           'lt_LT.ISO8859-13',\r
+    'lo':                                   'lo_LA.MULELAO-1',\r
+    'lo_la':                                'lo_LA.MULELAO-1',\r
+    'lo_la.cp1133':                         'lo_LA.IBM-CP1133',\r
+    'lo_la.ibmcp1133':                      'lo_LA.IBM-CP1133',\r
+    'lo_la.mulelao1':                       'lo_LA.MULELAO-1',\r
+    'lt':                                   'lt_LT.ISO8859-13',\r
+    'lt_lt':                                'lt_LT.ISO8859-13',\r
+    'lt_lt.iso885913':                      'lt_LT.ISO8859-13',\r
+    'lt_lt.iso88594':                       'lt_LT.ISO8859-4',\r
+    'lv':                                   'lv_LV.ISO8859-13',\r
+    'lv_lv':                                'lv_LV.ISO8859-13',\r
+    'lv_lv.iso885913':                      'lv_LV.ISO8859-13',\r
+    'lv_lv.iso88594':                       'lv_LV.ISO8859-4',\r
+    'mag_in':                               'mag_IN.UTF-8',\r
+    'mai':                                  'mai_IN.UTF-8',\r
+    'mai_in':                               'mai_IN.UTF-8',\r
+    'mg_mg':                                'mg_MG.ISO8859-15',\r
+    'mhr_ru':                               'mhr_RU.UTF-8',\r
+    'mi':                                   'mi_NZ.ISO8859-1',\r
+    'mi_nz':                                'mi_NZ.ISO8859-1',\r
+    'mi_nz.iso88591':                       'mi_NZ.ISO8859-1',\r
+    'mk':                                   'mk_MK.ISO8859-5',\r
+    'mk_mk':                                'mk_MK.ISO8859-5',\r
+    'mk_mk.cp1251':                         'mk_MK.CP1251',\r
+    'mk_mk.iso88595':                       'mk_MK.ISO8859-5',\r
+    'mk_mk.microsoftcp1251':                'mk_MK.CP1251',\r
+    'ml':                                   'ml_IN.UTF-8',\r
+    'ml_in':                                'ml_IN.UTF-8',\r
+    'mn_mn':                                'mn_MN.UTF-8',\r
+    'mni_in':                               'mni_IN.UTF-8',\r
+    'mr':                                   'mr_IN.UTF-8',\r
+    'mr_in':                                'mr_IN.UTF-8',\r
+    'ms':                                   'ms_MY.ISO8859-1',\r
+    'ms_my':                                'ms_MY.ISO8859-1',\r
+    'ms_my.iso88591':                       'ms_MY.ISO8859-1',\r
+    'mt':                                   'mt_MT.ISO8859-3',\r
+    'mt_mt':                                'mt_MT.ISO8859-3',\r
+    'mt_mt.iso88593':                       'mt_MT.ISO8859-3',\r
+    'my_mm':                                'my_MM.UTF-8',\r
+    'nan_tw@latin':                         'nan_TW.UTF-8@latin',\r
+    'nb':                                   'nb_NO.ISO8859-1',\r
+    'nb_no':                                'nb_NO.ISO8859-1',\r
+    'nb_no.88591':                          'nb_NO.ISO8859-1',\r
+    'nb_no.iso88591':                       'nb_NO.ISO8859-1',\r
+    'nb_no.iso885915':                      'nb_NO.ISO8859-15',\r
+    'nb_no@euro':                           'nb_NO.ISO8859-15',\r
+    'nds_de':                               'nds_DE.UTF-8',\r
+    'nds_nl':                               'nds_NL.UTF-8',\r
+    'ne_np':                                'ne_NP.UTF-8',\r
+    'nhn_mx':                               'nhn_MX.UTF-8',\r
+    'niu_nu':                               'niu_NU.UTF-8',\r
+    'niu_nz':                               'niu_NZ.UTF-8',\r
+    'nl':                                   'nl_NL.ISO8859-1',\r
+    'nl.iso885915':                         'nl_NL.ISO8859-15',\r
+    'nl_aw':                                'nl_AW.UTF-8',\r
+    'nl_be':                                'nl_BE.ISO8859-1',\r
+    'nl_be.88591':                          'nl_BE.ISO8859-1',\r
+    'nl_be.iso88591':                       'nl_BE.ISO8859-1',\r
+    'nl_be.iso885915':                      'nl_BE.ISO8859-15',\r
+    'nl_be.iso885915@euro':                 'nl_BE.ISO8859-15',\r
+    'nl_be.utf8@euro':                      'nl_BE.UTF-8',\r
+    'nl_be@euro':                           'nl_BE.ISO8859-15',\r
+    'nl_nl':                                'nl_NL.ISO8859-1',\r
+    'nl_nl.88591':                          'nl_NL.ISO8859-1',\r
+    'nl_nl.iso88591':                       'nl_NL.ISO8859-1',\r
+    'nl_nl.iso885915':                      'nl_NL.ISO8859-15',\r
+    'nl_nl.iso885915@euro':                 'nl_NL.ISO8859-15',\r
+    'nl_nl.utf8@euro':                      'nl_NL.UTF-8',\r
+    'nl_nl@euro':                           'nl_NL.ISO8859-15',\r
+    'nn':                                   'nn_NO.ISO8859-1',\r
+    'nn_no':                                'nn_NO.ISO8859-1',\r
+    'nn_no.88591':                          'nn_NO.ISO8859-1',\r
+    'nn_no.iso88591':                       'nn_NO.ISO8859-1',\r
+    'nn_no.iso885915':                      'nn_NO.ISO8859-15',\r
+    'nn_no@euro':                           'nn_NO.ISO8859-15',\r
+    'no':                                   'no_NO.ISO8859-1',\r
+    'no@nynorsk':                           'ny_NO.ISO8859-1',\r
+    'no_no':                                'no_NO.ISO8859-1',\r
+    'no_no.88591':                          'no_NO.ISO8859-1',\r
+    'no_no.iso88591':                       'no_NO.ISO8859-1',\r
+    'no_no.iso885915':                      'no_NO.ISO8859-15',\r
+    'no_no.iso88591@bokmal':                'no_NO.ISO8859-1',\r
+    'no_no.iso88591@nynorsk':               'no_NO.ISO8859-1',\r
+    'no_no@euro':                           'no_NO.ISO8859-15',\r
+    'norwegian':                            'no_NO.ISO8859-1',\r
+    'norwegian.iso88591':                   'no_NO.ISO8859-1',\r
+    'nr':                                   'nr_ZA.ISO8859-1',\r
+    'nr_za':                                'nr_ZA.ISO8859-1',\r
+    'nr_za.iso88591':                       'nr_ZA.ISO8859-1',\r
+    'nso':                                  'nso_ZA.ISO8859-15',\r
+    'nso_za':                               'nso_ZA.ISO8859-15',\r
+    'nso_za.iso885915':                     'nso_ZA.ISO8859-15',\r
+    'ny':                                   'ny_NO.ISO8859-1',\r
+    'ny_no':                                'ny_NO.ISO8859-1',\r
+    'ny_no.88591':                          'ny_NO.ISO8859-1',\r
+    'ny_no.iso88591':                       'ny_NO.ISO8859-1',\r
+    'ny_no.iso885915':                      'ny_NO.ISO8859-15',\r
+    'ny_no@euro':                           'ny_NO.ISO8859-15',\r
+    'nynorsk':                              'nn_NO.ISO8859-1',\r
+    'oc':                                   'oc_FR.ISO8859-1',\r
+    'oc_fr':                                'oc_FR.ISO8859-1',\r
+    'oc_fr.iso88591':                       'oc_FR.ISO8859-1',\r
+    'oc_fr.iso885915':                      'oc_FR.ISO8859-15',\r
+    'oc_fr@euro':                           'oc_FR.ISO8859-15',\r
+    'om_et':                                'om_ET.UTF-8',\r
+    'om_ke':                                'om_KE.ISO8859-1',\r
+    'or':                                   'or_IN.UTF-8',\r
+    'or_in':                                'or_IN.UTF-8',\r
+    'os_ru':                                'os_RU.UTF-8',\r
+    'pa':                                   'pa_IN.UTF-8',\r
+    'pa_in':                                'pa_IN.UTF-8',\r
+    'pa_pk':                                'pa_PK.UTF-8',\r
+    'pap_an':                               'pap_AN.UTF-8',\r
+    'pd':                                   'pd_US.ISO8859-1',\r
+    'pd_de':                                'pd_DE.ISO8859-1',\r
+    'pd_de.iso88591':                       'pd_DE.ISO8859-1',\r
+    'pd_de.iso885915':                      'pd_DE.ISO8859-15',\r
+    'pd_de@euro':                           'pd_DE.ISO8859-15',\r
+    'pd_us':                                'pd_US.ISO8859-1',\r
+    'pd_us.iso88591':                       'pd_US.ISO8859-1',\r
+    'pd_us.iso885915':                      'pd_US.ISO8859-15',\r
+    'pd_us@euro':                           'pd_US.ISO8859-15',\r
+    'ph':                                   'ph_PH.ISO8859-1',\r
+    'ph_ph':                                'ph_PH.ISO8859-1',\r
+    'ph_ph.iso88591':                       'ph_PH.ISO8859-1',\r
+    'pl':                                   'pl_PL.ISO8859-2',\r
+    'pl_pl':                                'pl_PL.ISO8859-2',\r
+    'pl_pl.iso88592':                       'pl_PL.ISO8859-2',\r
+    'polish':                               'pl_PL.ISO8859-2',\r
+    'portuguese':                           'pt_PT.ISO8859-1',\r
+    'portuguese.iso88591':                  'pt_PT.ISO8859-1',\r
+    'portuguese_brazil':                    'pt_BR.ISO8859-1',\r
+    'portuguese_brazil.8859':               'pt_BR.ISO8859-1',\r
+    'posix':                                'C',\r
+    'posix-utf2':                           'C',\r
+    'pp':                                   'pp_AN.ISO8859-1',\r
+    'pp_an':                                'pp_AN.ISO8859-1',\r
+    'pp_an.iso88591':                       'pp_AN.ISO8859-1',\r
+    'ps_af':                                'ps_AF.UTF-8',\r
+    'pt':                                   'pt_PT.ISO8859-1',\r
+    'pt.iso885915':                         'pt_PT.ISO8859-15',\r
+    'pt_br':                                'pt_BR.ISO8859-1',\r
+    'pt_br.88591':                          'pt_BR.ISO8859-1',\r
+    'pt_br.iso88591':                       'pt_BR.ISO8859-1',\r
+    'pt_br.iso885915':                      'pt_BR.ISO8859-15',\r
+    'pt_br@euro':                           'pt_BR.ISO8859-15',\r
+    'pt_pt':                                'pt_PT.ISO8859-1',\r
+    'pt_pt.88591':                          'pt_PT.ISO8859-1',\r
+    'pt_pt.iso88591':                       'pt_PT.ISO8859-1',\r
+    'pt_pt.iso885915':                      'pt_PT.ISO8859-15',\r
+    'pt_pt.iso885915@euro':                 'pt_PT.ISO8859-15',\r
+    'pt_pt.utf8@euro':                      'pt_PT.UTF-8',\r
+    'pt_pt@euro':                           'pt_PT.ISO8859-15',\r
+    'ro':                                   'ro_RO.ISO8859-2',\r
+    'ro_ro':                                'ro_RO.ISO8859-2',\r
+    'ro_ro.iso88592':                       'ro_RO.ISO8859-2',\r
+    'romanian':                             'ro_RO.ISO8859-2',\r
+    'ru':                                   'ru_RU.UTF-8',\r
+    'ru.koi8r':                             'ru_RU.KOI8-R',\r
+    'ru_ru':                                'ru_RU.UTF-8',\r
+    'ru_ru.cp1251':                         'ru_RU.CP1251',\r
+    'ru_ru.iso88595':                       'ru_RU.ISO8859-5',\r
+    'ru_ru.koi8r':                          'ru_RU.KOI8-R',\r
+    'ru_ru.microsoftcp1251':                'ru_RU.CP1251',\r
+    'ru_ua':                                'ru_UA.KOI8-U',\r
+    'ru_ua.cp1251':                         'ru_UA.CP1251',\r
+    'ru_ua.koi8u':                          'ru_UA.KOI8-U',\r
+    'ru_ua.microsoftcp1251':                'ru_UA.CP1251',\r
+    'rumanian':                             'ro_RO.ISO8859-2',\r
+    'russian':                              'ru_RU.ISO8859-5',\r
+    'rw':                                   'rw_RW.ISO8859-1',\r
+    'rw_rw':                                'rw_RW.ISO8859-1',\r
+    'rw_rw.iso88591':                       'rw_RW.ISO8859-1',\r
+    'sa_in':                                'sa_IN.UTF-8',\r
+    'sat_in':                               'sat_IN.UTF-8',\r
+    'sc_it':                                'sc_IT.UTF-8',\r
+    'sd':                                   'sd_IN.UTF-8',\r
+    'sd@devanagari':                        'sd_IN.UTF-8@devanagari',\r
+    'sd_in':                                'sd_IN.UTF-8',\r
+    'sd_in@devanagari':                     'sd_IN.UTF-8@devanagari',\r
+    'sd_in@devanagari.utf8':                'sd_IN.UTF-8@devanagari',\r
+    'sd_pk':                                'sd_PK.UTF-8',\r
+    'se_no':                                'se_NO.UTF-8',\r
+    'serbocroatian':                        'sr_RS.UTF-8@latin',\r
+    'sh':                                   'sr_RS.UTF-8@latin',\r
+    'sh_ba.iso88592@bosnia':                'sr_CS.ISO8859-2',\r
+    'sh_hr':                                'sh_HR.ISO8859-2',\r
+    'sh_hr.iso88592':                       'hr_HR.ISO8859-2',\r
+    'sh_sp':                                'sr_CS.ISO8859-2',\r
+    'sh_yu':                                'sr_RS.UTF-8@latin',\r
+    'shs_ca':                               'shs_CA.UTF-8',\r
+    'si':                                   'si_LK.UTF-8',\r
+    'si_lk':                                'si_LK.UTF-8',\r
+    'sid_et':                               'sid_ET.UTF-8',\r
+    'sinhala':                              'si_LK.UTF-8',\r
+    'sk':                                   'sk_SK.ISO8859-2',\r
+    'sk_sk':                                'sk_SK.ISO8859-2',\r
+    'sk_sk.iso88592':                       'sk_SK.ISO8859-2',\r
+    'sl':                                   'sl_SI.ISO8859-2',\r
+    'sl_cs':                                'sl_CS.ISO8859-2',\r
+    'sl_si':                                'sl_SI.ISO8859-2',\r
+    'sl_si.iso88592':                       'sl_SI.ISO8859-2',\r
+    'slovak':                               'sk_SK.ISO8859-2',\r
+    'slovene':                              'sl_SI.ISO8859-2',\r
+    'slovenian':                            'sl_SI.ISO8859-2',\r
+    'so_dj':                                'so_DJ.ISO8859-1',\r
+    'so_et':                                'so_ET.UTF-8',\r
+    'so_ke':                                'so_KE.ISO8859-1',\r
+    'so_so':                                'so_SO.ISO8859-1',\r
+    'sp':                                   'sr_CS.ISO8859-5',\r
+    'sp_yu':                                'sr_CS.ISO8859-5',\r
+    'spanish':                              'es_ES.ISO8859-1',\r
+    'spanish.iso88591':                     'es_ES.ISO8859-1',\r
+    'spanish_spain':                        'es_ES.ISO8859-1',\r
+    'spanish_spain.8859':                   'es_ES.ISO8859-1',\r
+    'sq':                                   'sq_AL.ISO8859-2',\r
+    'sq_al':                                'sq_AL.ISO8859-2',\r
+    'sq_al.iso88592':                       'sq_AL.ISO8859-2',\r
+    'sq_mk':                                'sq_MK.UTF-8',\r
+    'sr':                                   'sr_RS.UTF-8',\r
+    'sr@cyrillic':                          'sr_RS.UTF-8',\r
+    'sr@latin':                             'sr_RS.UTF-8@latin',\r
+    'sr@latn':                              'sr_CS.UTF-8@latin',\r
+    'sr_cs':                                'sr_CS.UTF-8',\r
+    'sr_cs.iso88592':                       'sr_CS.ISO8859-2',\r
+    'sr_cs.iso88592@latn':                  'sr_CS.ISO8859-2',\r
+    'sr_cs.iso88595':                       'sr_CS.ISO8859-5',\r
+    'sr_cs.utf8@latn':                      'sr_CS.UTF-8@latin',\r
+    'sr_cs@latn':                           'sr_CS.UTF-8@latin',\r
+    'sr_me':                                'sr_ME.UTF-8',\r
+    'sr_rs':                                'sr_RS.UTF-8',\r
+    'sr_rs@latin':                          'sr_RS.UTF-8@latin',\r
+    'sr_rs@latn':                           'sr_RS.UTF-8@latin',\r
+    'sr_sp':                                'sr_CS.ISO8859-2',\r
+    'sr_yu':                                'sr_RS.UTF-8@latin',\r
+    'sr_yu.cp1251@cyrillic':                'sr_CS.CP1251',\r
+    'sr_yu.iso88592':                       'sr_CS.ISO8859-2',\r
+    'sr_yu.iso88595':                       'sr_CS.ISO8859-5',\r
+    'sr_yu.iso88595@cyrillic':              'sr_CS.ISO8859-5',\r
+    'sr_yu.microsoftcp1251@cyrillic':       'sr_CS.CP1251',\r
+    'sr_yu.utf8':                           'sr_RS.UTF-8',\r
+    'sr_yu.utf8@cyrillic':                  'sr_RS.UTF-8',\r
+    'sr_yu@cyrillic':                       'sr_RS.UTF-8',\r
+    'ss':                                   'ss_ZA.ISO8859-1',\r
+    'ss_za':                                'ss_ZA.ISO8859-1',\r
+    'ss_za.iso88591':                       'ss_ZA.ISO8859-1',\r
+    'st':                                   'st_ZA.ISO8859-1',\r
+    'st_za':                                'st_ZA.ISO8859-1',\r
+    'st_za.iso88591':                       'st_ZA.ISO8859-1',\r
+    'sv':                                   'sv_SE.ISO8859-1',\r
+    'sv.iso885915':                         'sv_SE.ISO8859-15',\r
+    'sv_fi':                                'sv_FI.ISO8859-1',\r
+    'sv_fi.iso88591':                       'sv_FI.ISO8859-1',\r
+    'sv_fi.iso885915':                      'sv_FI.ISO8859-15',\r
+    'sv_fi.iso885915@euro':                 'sv_FI.ISO8859-15',\r
+    'sv_fi.utf8@euro':                      'sv_FI.UTF-8',\r
+    'sv_fi@euro':                           'sv_FI.ISO8859-15',\r
+    'sv_se':                                'sv_SE.ISO8859-1',\r
+    'sv_se.88591':                          'sv_SE.ISO8859-1',\r
+    'sv_se.iso88591':                       'sv_SE.ISO8859-1',\r
+    'sv_se.iso885915':                      'sv_SE.ISO8859-15',\r
+    'sv_se@euro':                           'sv_SE.ISO8859-15',\r
+    'sw_ke':                                'sw_KE.UTF-8',\r
+    'sw_tz':                                'sw_TZ.UTF-8',\r
+    'swedish':                              'sv_SE.ISO8859-1',\r
+    'swedish.iso88591':                     'sv_SE.ISO8859-1',\r
+    'szl_pl':                               'szl_PL.UTF-8',\r
+    'ta':                                   'ta_IN.TSCII-0',\r
+    'ta_in':                                'ta_IN.TSCII-0',\r
+    'ta_in.tscii':                          'ta_IN.TSCII-0',\r
+    'ta_in.tscii0':                         'ta_IN.TSCII-0',\r
+    'ta_lk':                                'ta_LK.UTF-8',\r
+    'te':                                   'te_IN.UTF-8',\r
+    'te_in':                                'te_IN.UTF-8',\r
+    'tg':                                   'tg_TJ.KOI8-C',\r
+    'tg_tj':                                'tg_TJ.KOI8-C',\r
+    'tg_tj.koi8c':                          'tg_TJ.KOI8-C',\r
+    'th':                                   'th_TH.ISO8859-11',\r
+    'th_th':                                'th_TH.ISO8859-11',\r
+    'th_th.iso885911':                      'th_TH.ISO8859-11',\r
+    'th_th.tactis':                         'th_TH.TIS620',\r
+    'th_th.tis620':                         'th_TH.TIS620',\r
+    'thai':                                 'th_TH.ISO8859-11',\r
+    'ti_er':                                'ti_ER.UTF-8',\r
+    'ti_et':                                'ti_ET.UTF-8',\r
+    'tig_er':                               'tig_ER.UTF-8',\r
+    'tk_tm':                                'tk_TM.UTF-8',\r
+    'tl':                                   'tl_PH.ISO8859-1',\r
+    'tl_ph':                                'tl_PH.ISO8859-1',\r
+    'tl_ph.iso88591':                       'tl_PH.ISO8859-1',\r
+    'tn':                                   'tn_ZA.ISO8859-15',\r
+    'tn_za':                                'tn_ZA.ISO8859-15',\r
+    'tn_za.iso885915':                      'tn_ZA.ISO8859-15',\r
+    'tr':                                   'tr_TR.ISO8859-9',\r
+    'tr_cy':                                'tr_CY.ISO8859-9',\r
+    'tr_tr':                                'tr_TR.ISO8859-9',\r
+    'tr_tr.iso88599':                       'tr_TR.ISO8859-9',\r
+    'ts':                                   'ts_ZA.ISO8859-1',\r
+    'ts_za':                                'ts_ZA.ISO8859-1',\r
+    'ts_za.iso88591':                       'ts_ZA.ISO8859-1',\r
+    'tt':                                   'tt_RU.TATAR-CYR',\r
+    'tt_ru':                                'tt_RU.TATAR-CYR',\r
+    'tt_ru.koi8c':                          'tt_RU.KOI8-C',\r
+    'tt_ru.tatarcyr':                       'tt_RU.TATAR-CYR',\r
+    'tt_ru@iqtelif':                        'tt_RU.UTF-8@iqtelif',\r
+    'turkish':                              'tr_TR.ISO8859-9',\r
+    'turkish.iso88599':                     'tr_TR.ISO8859-9',\r
+    'ug_cn':                                'ug_CN.UTF-8',\r
+    'uk':                                   'uk_UA.KOI8-U',\r
+    'uk_ua':                                'uk_UA.KOI8-U',\r
+    'uk_ua.cp1251':                         'uk_UA.CP1251',\r
+    'uk_ua.iso88595':                       'uk_UA.ISO8859-5',\r
+    'uk_ua.koi8u':                          'uk_UA.KOI8-U',\r
+    'uk_ua.microsoftcp1251':                'uk_UA.CP1251',\r
+    'univ':                                 'en_US.utf',\r
+    'universal':                            'en_US.utf',\r
+    'universal.utf8@ucs4':                  'en_US.UTF-8',\r
+    'unm_us':                               'unm_US.UTF-8',\r
+    'ur':                                   'ur_PK.CP1256',\r
+    'ur_in':                                'ur_IN.UTF-8',\r
+    'ur_pk':                                'ur_PK.CP1256',\r
+    'ur_pk.cp1256':                         'ur_PK.CP1256',\r
+    'ur_pk.microsoftcp1256':                'ur_PK.CP1256',\r
+    'uz':                                   'uz_UZ.UTF-8',\r
+    'uz_uz':                                'uz_UZ.UTF-8',\r
+    'uz_uz.iso88591':                       'uz_UZ.ISO8859-1',\r
+    'uz_uz.utf8@cyrillic':                  'uz_UZ.UTF-8',\r
+    'uz_uz@cyrillic':                       'uz_UZ.UTF-8',\r
+    've':                                   've_ZA.UTF-8',\r
+    've_za':                                've_ZA.UTF-8',\r
+    'vi':                                   'vi_VN.TCVN',\r
+    'vi_vn':                                'vi_VN.TCVN',\r
+    'vi_vn.tcvn':                           'vi_VN.TCVN',\r
+    'vi_vn.tcvn5712':                       'vi_VN.TCVN',\r
+    'vi_vn.viscii':                         'vi_VN.VISCII',\r
+    'vi_vn.viscii111':                      'vi_VN.VISCII',\r
+    'wa':                                   'wa_BE.ISO8859-1',\r
+    'wa_be':                                'wa_BE.ISO8859-1',\r
+    'wa_be.iso88591':                       'wa_BE.ISO8859-1',\r
+    'wa_be.iso885915':                      'wa_BE.ISO8859-15',\r
+    'wa_be.iso885915@euro':                 'wa_BE.ISO8859-15',\r
+    'wa_be@euro':                           'wa_BE.ISO8859-15',\r
+    'wae_ch':                               'wae_CH.UTF-8',\r
+    'wal_et':                               'wal_ET.UTF-8',\r
+    'wo_sn':                                'wo_SN.UTF-8',\r
+    'xh':                                   'xh_ZA.ISO8859-1',\r
+    'xh_za':                                'xh_ZA.ISO8859-1',\r
+    'xh_za.iso88591':                       'xh_ZA.ISO8859-1',\r
+    'yi':                                   'yi_US.CP1255',\r
+    'yi_us':                                'yi_US.CP1255',\r
+    'yi_us.cp1255':                         'yi_US.CP1255',\r
+    'yi_us.microsoftcp1255':                'yi_US.CP1255',\r
+    'yo_ng':                                'yo_NG.UTF-8',\r
+    'yue_hk':                               'yue_HK.UTF-8',\r
+    'zh':                                   'zh_CN.eucCN',\r
+    'zh_cn':                                'zh_CN.gb2312',\r
+    'zh_cn.big5':                           'zh_TW.big5',\r
+    'zh_cn.euc':                            'zh_CN.eucCN',\r
+    'zh_cn.gb18030':                        'zh_CN.gb18030',\r
+    'zh_cn.gb2312':                         'zh_CN.gb2312',\r
+    'zh_cn.gbk':                            'zh_CN.gbk',\r
+    'zh_hk':                                'zh_HK.big5hkscs',\r
+    'zh_hk.big5':                           'zh_HK.big5',\r
+    'zh_hk.big5hk':                         'zh_HK.big5hkscs',\r
+    'zh_hk.big5hkscs':                      'zh_HK.big5hkscs',\r
+    'zh_sg':                                'zh_SG.GB2312',\r
+    'zh_sg.gbk':                            'zh_SG.GBK',\r
+    'zh_tw':                                'zh_TW.big5',\r
+    'zh_tw.big5':                           'zh_TW.big5',\r
+    'zh_tw.euc':                            'zh_TW.eucTW',\r
+    'zh_tw.euctw':                          'zh_TW.eucTW',\r
+    'zu':                                   'zu_ZA.ISO8859-1',\r
+    'zu_za':                                'zu_ZA.ISO8859-1',\r
+    'zu_za.iso88591':                       'zu_ZA.ISO8859-1',\r
+}\r
+\r
+#\r
+# This maps Windows language identifiers to locale strings.\r
+#\r
+# This list has been updated from\r
+# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp\r
+# to include every locale up to Windows Vista.\r
+#\r
+# NOTE: this mapping is incomplete.  If your language is missing, please\r
+# submit a bug report to the Python bug tracker at http://bugs.python.org/\r
+# Make sure you include the missing language identifier and the suggested\r
+# locale code.\r
+#\r
+\r
+windows_locale = {\r
+    0x0436: "af_ZA", # Afrikaans\r
+    0x041c: "sq_AL", # Albanian\r
+    0x0484: "gsw_FR",# Alsatian - France\r
+    0x045e: "am_ET", # Amharic - Ethiopia\r
+    0x0401: "ar_SA", # Arabic - Saudi Arabia\r
+    0x0801: "ar_IQ", # Arabic - Iraq\r
+    0x0c01: "ar_EG", # Arabic - Egypt\r
+    0x1001: "ar_LY", # Arabic - Libya\r
+    0x1401: "ar_DZ", # Arabic - Algeria\r
+    0x1801: "ar_MA", # Arabic - Morocco\r
+    0x1c01: "ar_TN", # Arabic - Tunisia\r
+    0x2001: "ar_OM", # Arabic - Oman\r
+    0x2401: "ar_YE", # Arabic - Yemen\r
+    0x2801: "ar_SY", # Arabic - Syria\r
+    0x2c01: "ar_JO", # Arabic - Jordan\r
+    0x3001: "ar_LB", # Arabic - Lebanon\r
+    0x3401: "ar_KW", # Arabic - Kuwait\r
+    0x3801: "ar_AE", # Arabic - United Arab Emirates\r
+    0x3c01: "ar_BH", # Arabic - Bahrain\r
+    0x4001: "ar_QA", # Arabic - Qatar\r
+    0x042b: "hy_AM", # Armenian\r
+    0x044d: "as_IN", # Assamese - India\r
+    0x042c: "az_AZ", # Azeri - Latin\r
+    0x082c: "az_AZ", # Azeri - Cyrillic\r
+    0x046d: "ba_RU", # Bashkir\r
+    0x042d: "eu_ES", # Basque - Russia\r
+    0x0423: "be_BY", # Belarusian\r
+    0x0445: "bn_IN", # Begali\r
+    0x201a: "bs_BA", # Bosnian - Cyrillic\r
+    0x141a: "bs_BA", # Bosnian - Latin\r
+    0x047e: "br_FR", # Breton - France\r
+    0x0402: "bg_BG", # Bulgarian\r
+#    0x0455: "my_MM", # Burmese - Not supported\r
+    0x0403: "ca_ES", # Catalan\r
+    0x0004: "zh_CHS",# Chinese - Simplified\r
+    0x0404: "zh_TW", # Chinese - Taiwan\r
+    0x0804: "zh_CN", # Chinese - PRC\r
+    0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R.\r
+    0x1004: "zh_SG", # Chinese - Singapore\r
+    0x1404: "zh_MO", # Chinese - Macao S.A.R.\r
+    0x7c04: "zh_CHT",# Chinese - Traditional\r
+    0x0483: "co_FR", # Corsican - France\r
+    0x041a: "hr_HR", # Croatian\r
+    0x101a: "hr_BA", # Croatian - Bosnia\r
+    0x0405: "cs_CZ", # Czech\r
+    0x0406: "da_DK", # Danish\r
+    0x048c: "gbz_AF",# Dari - Afghanistan\r
+    0x0465: "div_MV",# Divehi - Maldives\r
+    0x0413: "nl_NL", # Dutch - The Netherlands\r
+    0x0813: "nl_BE", # Dutch - Belgium\r
+    0x0409: "en_US", # English - United States\r
+    0x0809: "en_GB", # English - United Kingdom\r
+    0x0c09: "en_AU", # English - Australia\r
+    0x1009: "en_CA", # English - Canada\r
+    0x1409: "en_NZ", # English - New Zealand\r
+    0x1809: "en_IE", # English - Ireland\r
+    0x1c09: "en_ZA", # English - South Africa\r
+    0x2009: "en_JA", # English - Jamaica\r
+    0x2409: "en_CB", # English - Carribbean\r
+    0x2809: "en_BZ", # English - Belize\r
+    0x2c09: "en_TT", # English - Trinidad\r
+    0x3009: "en_ZW", # English - Zimbabwe\r
+    0x3409: "en_PH", # English - Philippines\r
+    0x4009: "en_IN", # English - India\r
+    0x4409: "en_MY", # English - Malaysia\r
+    0x4809: "en_IN", # English - Singapore\r
+    0x0425: "et_EE", # Estonian\r
+    0x0438: "fo_FO", # Faroese\r
+    0x0464: "fil_PH",# Filipino\r
+    0x040b: "fi_FI", # Finnish\r
+    0x040c: "fr_FR", # French - France\r
+    0x080c: "fr_BE", # French - Belgium\r
+    0x0c0c: "fr_CA", # French - Canada\r
+    0x100c: "fr_CH", # French - Switzerland\r
+    0x140c: "fr_LU", # French - Luxembourg\r
+    0x180c: "fr_MC", # French - Monaco\r
+    0x0462: "fy_NL", # Frisian - Netherlands\r
+    0x0456: "gl_ES", # Galician\r
+    0x0437: "ka_GE", # Georgian\r
+    0x0407: "de_DE", # German - Germany\r
+    0x0807: "de_CH", # German - Switzerland\r
+    0x0c07: "de_AT", # German - Austria\r
+    0x1007: "de_LU", # German - Luxembourg\r
+    0x1407: "de_LI", # German - Liechtenstein\r
+    0x0408: "el_GR", # Greek\r
+    0x046f: "kl_GL", # Greenlandic - Greenland\r
+    0x0447: "gu_IN", # Gujarati\r
+    0x0468: "ha_NG", # Hausa - Latin\r
+    0x040d: "he_IL", # Hebrew\r
+    0x0439: "hi_IN", # Hindi\r
+    0x040e: "hu_HU", # Hungarian\r
+    0x040f: "is_IS", # Icelandic\r
+    0x0421: "id_ID", # Indonesian\r
+    0x045d: "iu_CA", # Inuktitut - Syllabics\r
+    0x085d: "iu_CA", # Inuktitut - Latin\r
+    0x083c: "ga_IE", # Irish - Ireland\r
+    0x0410: "it_IT", # Italian - Italy\r
+    0x0810: "it_CH", # Italian - Switzerland\r
+    0x0411: "ja_JP", # Japanese\r
+    0x044b: "kn_IN", # Kannada - India\r
+    0x043f: "kk_KZ", # Kazakh\r
+    0x0453: "kh_KH", # Khmer - Cambodia\r
+    0x0486: "qut_GT",# K'iche - Guatemala\r
+    0x0487: "rw_RW", # Kinyarwanda - Rwanda\r
+    0x0457: "kok_IN",# Konkani\r
+    0x0412: "ko_KR", # Korean\r
+    0x0440: "ky_KG", # Kyrgyz\r
+    0x0454: "lo_LA", # Lao - Lao PDR\r
+    0x0426: "lv_LV", # Latvian\r
+    0x0427: "lt_LT", # Lithuanian\r
+    0x082e: "dsb_DE",# Lower Sorbian - Germany\r
+    0x046e: "lb_LU", # Luxembourgish\r
+    0x042f: "mk_MK", # FYROM Macedonian\r
+    0x043e: "ms_MY", # Malay - Malaysia\r
+    0x083e: "ms_BN", # Malay - Brunei Darussalam\r
+    0x044c: "ml_IN", # Malayalam - India\r
+    0x043a: "mt_MT", # Maltese\r
+    0x0481: "mi_NZ", # Maori\r
+    0x047a: "arn_CL",# Mapudungun\r
+    0x044e: "mr_IN", # Marathi\r
+    0x047c: "moh_CA",# Mohawk - Canada\r
+    0x0450: "mn_MN", # Mongolian - Cyrillic\r
+    0x0850: "mn_CN", # Mongolian - PRC\r
+    0x0461: "ne_NP", # Nepali\r
+    0x0414: "nb_NO", # Norwegian - Bokmal\r
+    0x0814: "nn_NO", # Norwegian - Nynorsk\r
+    0x0482: "oc_FR", # Occitan - France\r
+    0x0448: "or_IN", # Oriya - India\r
+    0x0463: "ps_AF", # Pashto - Afghanistan\r
+    0x0429: "fa_IR", # Persian\r
+    0x0415: "pl_PL", # Polish\r
+    0x0416: "pt_BR", # Portuguese - Brazil\r
+    0x0816: "pt_PT", # Portuguese - Portugal\r
+    0x0446: "pa_IN", # Punjabi\r
+    0x046b: "quz_BO",# Quechua (Bolivia)\r
+    0x086b: "quz_EC",# Quechua (Ecuador)\r
+    0x0c6b: "quz_PE",# Quechua (Peru)\r
+    0x0418: "ro_RO", # Romanian - Romania\r
+    0x0417: "rm_CH", # Romansh\r
+    0x0419: "ru_RU", # Russian\r
+    0x243b: "smn_FI",# Sami Finland\r
+    0x103b: "smj_NO",# Sami Norway\r
+    0x143b: "smj_SE",# Sami Sweden\r
+    0x043b: "se_NO", # Sami Northern Norway\r
+    0x083b: "se_SE", # Sami Northern Sweden\r
+    0x0c3b: "se_FI", # Sami Northern Finland\r
+    0x203b: "sms_FI",# Sami Skolt\r
+    0x183b: "sma_NO",# Sami Southern Norway\r
+    0x1c3b: "sma_SE",# Sami Southern Sweden\r
+    0x044f: "sa_IN", # Sanskrit\r
+    0x0c1a: "sr_SP", # Serbian - Cyrillic\r
+    0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic\r
+    0x081a: "sr_SP", # Serbian - Latin\r
+    0x181a: "sr_BA", # Serbian - Bosnia Latin\r
+    0x045b: "si_LK", # Sinhala - Sri Lanka\r
+    0x046c: "ns_ZA", # Northern Sotho\r
+    0x0432: "tn_ZA", # Setswana - Southern Africa\r
+    0x041b: "sk_SK", # Slovak\r
+    0x0424: "sl_SI", # Slovenian\r
+    0x040a: "es_ES", # Spanish - Spain\r
+    0x080a: "es_MX", # Spanish - Mexico\r
+    0x0c0a: "es_ES", # Spanish - Spain (Modern)\r
+    0x100a: "es_GT", # Spanish - Guatemala\r
+    0x140a: "es_CR", # Spanish - Costa Rica\r
+    0x180a: "es_PA", # Spanish - Panama\r
+    0x1c0a: "es_DO", # Spanish - Dominican Republic\r
+    0x200a: "es_VE", # Spanish - Venezuela\r
+    0x240a: "es_CO", # Spanish - Colombia\r
+    0x280a: "es_PE", # Spanish - Peru\r
+    0x2c0a: "es_AR", # Spanish - Argentina\r
+    0x300a: "es_EC", # Spanish - Ecuador\r
+    0x340a: "es_CL", # Spanish - Chile\r
+    0x380a: "es_UR", # Spanish - Uruguay\r
+    0x3c0a: "es_PY", # Spanish - Paraguay\r
+    0x400a: "es_BO", # Spanish - Bolivia\r
+    0x440a: "es_SV", # Spanish - El Salvador\r
+    0x480a: "es_HN", # Spanish - Honduras\r
+    0x4c0a: "es_NI", # Spanish - Nicaragua\r
+    0x500a: "es_PR", # Spanish - Puerto Rico\r
+    0x540a: "es_US", # Spanish - United States\r
+#    0x0430: "", # Sutu - Not supported\r
+    0x0441: "sw_KE", # Swahili\r
+    0x041d: "sv_SE", # Swedish - Sweden\r
+    0x081d: "sv_FI", # Swedish - Finland\r
+    0x045a: "syr_SY",# Syriac\r
+    0x0428: "tg_TJ", # Tajik - Cyrillic\r
+    0x085f: "tmz_DZ",# Tamazight - Latin\r
+    0x0449: "ta_IN", # Tamil\r
+    0x0444: "tt_RU", # Tatar\r
+    0x044a: "te_IN", # Telugu\r
+    0x041e: "th_TH", # Thai\r
+    0x0851: "bo_BT", # Tibetan - Bhutan\r
+    0x0451: "bo_CN", # Tibetan - PRC\r
+    0x041f: "tr_TR", # Turkish\r
+    0x0442: "tk_TM", # Turkmen - Cyrillic\r
+    0x0480: "ug_CN", # Uighur - Arabic\r
+    0x0422: "uk_UA", # Ukrainian\r
+    0x042e: "wen_DE",# Upper Sorbian - Germany\r
+    0x0420: "ur_PK", # Urdu\r
+    0x0820: "ur_IN", # Urdu - India\r
+    0x0443: "uz_UZ", # Uzbek - Latin\r
+    0x0843: "uz_UZ", # Uzbek - Cyrillic\r
+    0x042a: "vi_VN", # Vietnamese\r
+    0x0452: "cy_GB", # Welsh\r
+    0x0488: "wo_SN", # Wolof - Senegal\r
+    0x0434: "xh_ZA", # Xhosa - South Africa\r
+    0x0485: "sah_RU",# Yakut - Cyrillic\r
+    0x0478: "ii_CN", # Yi - PRC\r
+    0x046a: "yo_NG", # Yoruba - Nigeria\r
+    0x0435: "zu_ZA", # Zulu\r
+}\r
+\r
+def _print_locale():\r
+\r
+    """ Test function.\r
+    """\r
+    categories = {}\r
+    def _init_categories(categories=categories):\r
+        for k,v in globals().items():\r
+            if k[:3] == 'LC_':\r
+                categories[k] = v\r
+    _init_categories()\r
+    del categories['LC_ALL']\r
+\r
+    print 'Locale defaults as determined by getdefaultlocale():'\r
+    print '-'*72\r
+    lang, enc = getdefaultlocale()\r
+    print 'Language: ', lang or '(undefined)'\r
+    print 'Encoding: ', enc or '(undefined)'\r
+    print\r
+\r
+    print 'Locale settings on startup:'\r
+    print '-'*72\r
+    for name,category in categories.items():\r
+        print name, '...'\r
+        lang, enc = getlocale(category)\r
+        print '   Language: ', lang or '(undefined)'\r
+        print '   Encoding: ', enc or '(undefined)'\r
+        print\r
+\r
+    print\r
+    print 'Locale settings after calling resetlocale():'\r
+    print '-'*72\r
+    resetlocale()\r
+    for name,category in categories.items():\r
+        print name, '...'\r
+        lang, enc = getlocale(category)\r
+        print '   Language: ', lang or '(undefined)'\r
+        print '   Encoding: ', enc or '(undefined)'\r
+        print\r
+\r
+    try:\r
+        setlocale(LC_ALL, "")\r
+    except:\r
+        print 'NOTE:'\r
+        print 'setlocale(LC_ALL, "") does not support the default locale'\r
+        print 'given in the OS environment variables.'\r
+    else:\r
+        print\r
+        print 'Locale settings after calling setlocale(LC_ALL, ""):'\r
+        print '-'*72\r
+        for name,category in categories.items():\r
+            print name, '...'\r
+            lang, enc = getlocale(category)\r
+            print '   Language: ', lang or '(undefined)'\r
+            print '   Encoding: ', enc or '(undefined)'\r
+            print\r
+\r
+###\r
+\r
+try:\r
+    LC_MESSAGES\r
+except NameError:\r
+    pass\r
+else:\r
+    __all__.append("LC_MESSAGES")\r
+\r
+if __name__=='__main__':\r
+    print 'Locale aliasing:'\r
+    print\r
+    _print_locale()\r
+    print\r
+    print 'Number formatting:'\r
+    print\r
+    _test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/md5.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/md5.py
new file mode 100644 (file)
index 0000000..10d0b05
--- /dev/null
@@ -0,0 +1,14 @@
+# $Id$\r
+#\r
+#  Copyright (C) 2005   Gregory P. Smith (greg@krypto.org)\r
+#  Licensed to PSF under a Contributor Agreement.\r
+\r
+import warnings\r
+warnings.warn("the md5 module is deprecated; use hashlib instead",\r
+                DeprecationWarning, 2)\r
+\r
+from hashlib import md5\r
+new = md5\r
+\r
+blocksize = 1        # legacy value (wrong in any useful sense)\r
+digest_size = 16\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/modulefinder.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/modulefinder.py
new file mode 100644 (file)
index 0000000..3091fdc
--- /dev/null
@@ -0,0 +1,673 @@
+"""Find modules used by a script, using introspection."""\r
+# This module should be kept compatible with Python 2.2, see PEP 291.\r
+\r
+from __future__ import generators\r
+import dis\r
+import imp\r
+import marshal\r
+import os\r
+import sys\r
+import types\r
+import struct\r
+\r
+if hasattr(sys.__stdout__, "newlines"):\r
+    READ_MODE = "U"  # universal line endings\r
+else:\r
+    # remain compatible with Python  < 2.3\r
+    READ_MODE = "r"\r
+\r
+LOAD_CONST = chr(dis.opname.index('LOAD_CONST'))\r
+IMPORT_NAME = chr(dis.opname.index('IMPORT_NAME'))\r
+STORE_NAME = chr(dis.opname.index('STORE_NAME'))\r
+STORE_GLOBAL = chr(dis.opname.index('STORE_GLOBAL'))\r
+STORE_OPS = [STORE_NAME, STORE_GLOBAL]\r
+HAVE_ARGUMENT = chr(dis.HAVE_ARGUMENT)\r
+\r
+# Modulefinder does a good job at simulating Python's, but it can not\r
+# handle __path__ modifications packages make at runtime.  Therefore there\r
+# is a mechanism whereby you can register extra paths in this map for a\r
+# package, and it will be honored.\r
+\r
+# Note this is a mapping is lists of paths.\r
+packagePathMap = {}\r
+\r
+# A Public interface\r
+def AddPackagePath(packagename, path):\r
+    paths = packagePathMap.get(packagename, [])\r
+    paths.append(path)\r
+    packagePathMap[packagename] = paths\r
+\r
+replacePackageMap = {}\r
+\r
+# This ReplacePackage mechanism allows modulefinder to work around the\r
+# way the _xmlplus package injects itself under the name "xml" into\r
+# sys.modules at runtime by calling ReplacePackage("_xmlplus", "xml")\r
+# before running ModuleFinder.\r
+\r
+def ReplacePackage(oldname, newname):\r
+    replacePackageMap[oldname] = newname\r
+\r
+\r
+class Module:\r
+\r
+    def __init__(self, name, file=None, path=None):\r
+        self.__name__ = name\r
+        self.__file__ = file\r
+        self.__path__ = path\r
+        self.__code__ = None\r
+        # The set of global names that are assigned to in the module.\r
+        # This includes those names imported through starimports of\r
+        # Python modules.\r
+        self.globalnames = {}\r
+        # The set of starimports this module did that could not be\r
+        # resolved, ie. a starimport from a non-Python module.\r
+        self.starimports = {}\r
+\r
+    def __repr__(self):\r
+        s = "Module(%r" % (self.__name__,)\r
+        if self.__file__ is not None:\r
+            s = s + ", %r" % (self.__file__,)\r
+        if self.__path__ is not None:\r
+            s = s + ", %r" % (self.__path__,)\r
+        s = s + ")"\r
+        return s\r
+\r
+class ModuleFinder:\r
+\r
+    def __init__(self, path=None, debug=0, excludes=[], replace_paths=[]):\r
+        if path is None:\r
+            path = sys.path\r
+        self.path = path\r
+        self.modules = {}\r
+        self.badmodules = {}\r
+        self.debug = debug\r
+        self.indent = 0\r
+        self.excludes = excludes\r
+        self.replace_paths = replace_paths\r
+        self.processed_paths = []   # Used in debugging only\r
+\r
+    def msg(self, level, str, *args):\r
+        if level <= self.debug:\r
+            for i in range(self.indent):\r
+                print "   ",\r
+            print str,\r
+            for arg in args:\r
+                print repr(arg),\r
+            print\r
+\r
+    def msgin(self, *args):\r
+        level = args[0]\r
+        if level <= self.debug:\r
+            self.indent = self.indent + 1\r
+            self.msg(*args)\r
+\r
+    def msgout(self, *args):\r
+        level = args[0]\r
+        if level <= self.debug:\r
+            self.indent = self.indent - 1\r
+            self.msg(*args)\r
+\r
+    def run_script(self, pathname):\r
+        self.msg(2, "run_script", pathname)\r
+        with open(pathname, READ_MODE) as fp:\r
+            stuff = ("", "r", imp.PY_SOURCE)\r
+            self.load_module('__main__', fp, pathname, stuff)\r
+\r
+    def load_file(self, pathname):\r
+        dir, name = os.path.split(pathname)\r
+        name, ext = os.path.splitext(name)\r
+        with open(pathname, READ_MODE) as fp:\r
+            stuff = (ext, "r", imp.PY_SOURCE)\r
+            self.load_module(name, fp, pathname, stuff)\r
+\r
+    def import_hook(self, name, caller=None, fromlist=None, level=-1):\r
+        self.msg(3, "import_hook", name, caller, fromlist, level)\r
+        parent = self.determine_parent(caller, level=level)\r
+        q, tail = self.find_head_package(parent, name)\r
+        m = self.load_tail(q, tail)\r
+        if not fromlist:\r
+            return q\r
+        if m.__path__:\r
+            self.ensure_fromlist(m, fromlist)\r
+        return None\r
+\r
+    def determine_parent(self, caller, level=-1):\r
+        self.msgin(4, "determine_parent", caller, level)\r
+        if not caller or level == 0:\r
+            self.msgout(4, "determine_parent -> None")\r
+            return None\r
+        pname = caller.__name__\r
+        if level >= 1: # relative import\r
+            if caller.__path__:\r
+                level -= 1\r
+            if level == 0:\r
+                parent = self.modules[pname]\r
+                assert parent is caller\r
+                self.msgout(4, "determine_parent ->", parent)\r
+                return parent\r
+            if pname.count(".") < level:\r
+                raise ImportError, "relative importpath too deep"\r
+            pname = ".".join(pname.split(".")[:-level])\r
+            parent = self.modules[pname]\r
+            self.msgout(4, "determine_parent ->", parent)\r
+            return parent\r
+        if caller.__path__:\r
+            parent = self.modules[pname]\r
+            assert caller is parent\r
+            self.msgout(4, "determine_parent ->", parent)\r
+            return parent\r
+        if '.' in pname:\r
+            i = pname.rfind('.')\r
+            pname = pname[:i]\r
+            parent = self.modules[pname]\r
+            assert parent.__name__ == pname\r
+            self.msgout(4, "determine_parent ->", parent)\r
+            return parent\r
+        self.msgout(4, "determine_parent -> None")\r
+        return None\r
+\r
+    def find_head_package(self, parent, name):\r
+        self.msgin(4, "find_head_package", parent, name)\r
+        if '.' in name:\r
+            i = name.find('.')\r
+            head = name[:i]\r
+            tail = name[i+1:]\r
+        else:\r
+            head = name\r
+            tail = ""\r
+        if parent:\r
+            qname = "%s.%s" % (parent.__name__, head)\r
+        else:\r
+            qname = head\r
+        q = self.import_module(head, qname, parent)\r
+        if q:\r
+            self.msgout(4, "find_head_package ->", (q, tail))\r
+            return q, tail\r
+        if parent:\r
+            qname = head\r
+            parent = None\r
+            q = self.import_module(head, qname, parent)\r
+            if q:\r
+                self.msgout(4, "find_head_package ->", (q, tail))\r
+                return q, tail\r
+        self.msgout(4, "raise ImportError: No module named", qname)\r
+        raise ImportError, "No module named " + qname\r
+\r
+    def load_tail(self, q, tail):\r
+        self.msgin(4, "load_tail", q, tail)\r
+        m = q\r
+        while tail:\r
+            i = tail.find('.')\r
+            if i < 0: i = len(tail)\r
+            head, tail = tail[:i], tail[i+1:]\r
+            mname = "%s.%s" % (m.__name__, head)\r
+            m = self.import_module(head, mname, m)\r
+            if not m:\r
+                self.msgout(4, "raise ImportError: No module named", mname)\r
+                raise ImportError, "No module named " + mname\r
+        self.msgout(4, "load_tail ->", m)\r
+        return m\r
+\r
+    def ensure_fromlist(self, m, fromlist, recursive=0):\r
+        self.msg(4, "ensure_fromlist", m, fromlist, recursive)\r
+        for sub in fromlist:\r
+            if sub == "*":\r
+                if not recursive:\r
+                    all = self.find_all_submodules(m)\r
+                    if all:\r
+                        self.ensure_fromlist(m, all, 1)\r
+            elif not hasattr(m, sub):\r
+                subname = "%s.%s" % (m.__name__, sub)\r
+                submod = self.import_module(sub, subname, m)\r
+                if not submod:\r
+                    raise ImportError, "No module named " + subname\r
+\r
+    def find_all_submodules(self, m):\r
+        if not m.__path__:\r
+            return\r
+        modules = {}\r
+        # 'suffixes' used to be a list hardcoded to [".py", ".pyc", ".pyo"].\r
+        # But we must also collect Python extension modules - although\r
+        # we cannot separate normal dlls from Python extensions.\r
+        suffixes = []\r
+        for triple in imp.get_suffixes():\r
+            suffixes.append(triple[0])\r
+        for dir in m.__path__:\r
+            try:\r
+                names = os.listdir(dir)\r
+            except os.error:\r
+                self.msg(2, "can't list directory", dir)\r
+                continue\r
+            for name in names:\r
+                mod = None\r
+                for suff in suffixes:\r
+                    n = len(suff)\r
+                    if name[-n:] == suff:\r
+                        mod = name[:-n]\r
+                        break\r
+                if mod and mod != "__init__":\r
+                    modules[mod] = mod\r
+        return modules.keys()\r
+\r
+    def import_module(self, partname, fqname, parent):\r
+        self.msgin(3, "import_module", partname, fqname, parent)\r
+        try:\r
+            m = self.modules[fqname]\r
+        except KeyError:\r
+            pass\r
+        else:\r
+            self.msgout(3, "import_module ->", m)\r
+            return m\r
+        if fqname in self.badmodules:\r
+            self.msgout(3, "import_module -> None")\r
+            return None\r
+        if parent and parent.__path__ is None:\r
+            self.msgout(3, "import_module -> None")\r
+            return None\r
+        try:\r
+            fp, pathname, stuff = self.find_module(partname,\r
+                                                   parent and parent.__path__, parent)\r
+        except ImportError:\r
+            self.msgout(3, "import_module ->", None)\r
+            return None\r
+        try:\r
+            m = self.load_module(fqname, fp, pathname, stuff)\r
+        finally:\r
+            if fp: fp.close()\r
+        if parent:\r
+            setattr(parent, partname, m)\r
+        self.msgout(3, "import_module ->", m)\r
+        return m\r
+\r
+    def load_module(self, fqname, fp, pathname, file_info):\r
+        suffix, mode, type = file_info\r
+        self.msgin(2, "load_module", fqname, fp and "fp", pathname)\r
+        if type == imp.PKG_DIRECTORY:\r
+            m = self.load_package(fqname, pathname)\r
+            self.msgout(2, "load_module ->", m)\r
+            return m\r
+        if type == imp.PY_SOURCE:\r
+            co = compile(fp.read()+'\n', pathname, 'exec')\r
+        elif type == imp.PY_COMPILED:\r
+            if fp.read(4) != imp.get_magic():\r
+                self.msgout(2, "raise ImportError: Bad magic number", pathname)\r
+                raise ImportError, "Bad magic number in %s" % pathname\r
+            fp.read(4)\r
+            co = marshal.load(fp)\r
+        else:\r
+            co = None\r
+        m = self.add_module(fqname)\r
+        m.__file__ = pathname\r
+        if co:\r
+            if self.replace_paths:\r
+                co = self.replace_paths_in_code(co)\r
+            m.__code__ = co\r
+            self.scan_code(co, m)\r
+        self.msgout(2, "load_module ->", m)\r
+        return m\r
+\r
+    def _add_badmodule(self, name, caller):\r
+        if name not in self.badmodules:\r
+            self.badmodules[name] = {}\r
+        if caller:\r
+            self.badmodules[name][caller.__name__] = 1\r
+        else:\r
+            self.badmodules[name]["-"] = 1\r
+\r
+    def _safe_import_hook(self, name, caller, fromlist, level=-1):\r
+        # wrapper for self.import_hook() that won't raise ImportError\r
+        if name in self.badmodules:\r
+            self._add_badmodule(name, caller)\r
+            return\r
+        try:\r
+            self.import_hook(name, caller, level=level)\r
+        except ImportError, msg:\r
+            self.msg(2, "ImportError:", str(msg))\r
+            self._add_badmodule(name, caller)\r
+        else:\r
+            if fromlist:\r
+                for sub in fromlist:\r
+                    if sub in self.badmodules:\r
+                        self._add_badmodule(sub, caller)\r
+                        continue\r
+                    try:\r
+                        self.import_hook(name, caller, [sub], level=level)\r
+                    except ImportError, msg:\r
+                        self.msg(2, "ImportError:", str(msg))\r
+                        fullname = name + "." + sub\r
+                        self._add_badmodule(fullname, caller)\r
+\r
+    def scan_opcodes(self, co,\r
+                     unpack = struct.unpack):\r
+        # Scan the code, and yield 'interesting' opcode combinations\r
+        # Version for Python 2.4 and older\r
+        code = co.co_code\r
+        names = co.co_names\r
+        consts = co.co_consts\r
+        while code:\r
+            c = code[0]\r
+            if c in STORE_OPS:\r
+                oparg, = unpack('<H', code[1:3])\r
+                yield "store", (names[oparg],)\r
+                code = code[3:]\r
+                continue\r
+            if c == LOAD_CONST and code[3] == IMPORT_NAME:\r
+                oparg_1, oparg_2 = unpack('<xHxH', code[:6])\r
+                yield "import", (consts[oparg_1], names[oparg_2])\r
+                code = code[6:]\r
+                continue\r
+            if c >= HAVE_ARGUMENT:\r
+                code = code[3:]\r
+            else:\r
+                code = code[1:]\r
+\r
+    def scan_opcodes_25(self, co,\r
+                     unpack = struct.unpack):\r
+        # Scan the code, and yield 'interesting' opcode combinations\r
+        # Python 2.5 version (has absolute and relative imports)\r
+        code = co.co_code\r
+        names = co.co_names\r
+        consts = co.co_consts\r
+        LOAD_LOAD_AND_IMPORT = LOAD_CONST + LOAD_CONST + IMPORT_NAME\r
+        while code:\r
+            c = code[0]\r
+            if c in STORE_OPS:\r
+                oparg, = unpack('<H', code[1:3])\r
+                yield "store", (names[oparg],)\r
+                code = code[3:]\r
+                continue\r
+            if code[:9:3] == LOAD_LOAD_AND_IMPORT:\r
+                oparg_1, oparg_2, oparg_3 = unpack('<xHxHxH', code[:9])\r
+                level = consts[oparg_1]\r
+                if level == -1: # normal import\r
+                    yield "import", (consts[oparg_2], names[oparg_3])\r
+                elif level == 0: # absolute import\r
+                    yield "absolute_import", (consts[oparg_2], names[oparg_3])\r
+                else: # relative import\r
+                    yield "relative_import", (level, consts[oparg_2], names[oparg_3])\r
+                code = code[9:]\r
+                continue\r
+            if c >= HAVE_ARGUMENT:\r
+                code = code[3:]\r
+            else:\r
+                code = code[1:]\r
+\r
+    def scan_code(self, co, m):\r
+        code = co.co_code\r
+        if sys.version_info >= (2, 5):\r
+            scanner = self.scan_opcodes_25\r
+        else:\r
+            scanner = self.scan_opcodes\r
+        for what, args in scanner(co):\r
+            if what == "store":\r
+                name, = args\r
+                m.globalnames[name] = 1\r
+            elif what in ("import", "absolute_import"):\r
+                fromlist, name = args\r
+                have_star = 0\r
+                if fromlist is not None:\r
+                    if "*" in fromlist:\r
+                        have_star = 1\r
+                    fromlist = [f for f in fromlist if f != "*"]\r
+                if what == "absolute_import": level = 0\r
+                else: level = -1\r
+                self._safe_import_hook(name, m, fromlist, level=level)\r
+                if have_star:\r
+                    # We've encountered an "import *". If it is a Python module,\r
+                    # the code has already been parsed and we can suck out the\r
+                    # global names.\r
+                    mm = None\r
+                    if m.__path__:\r
+                        # At this point we don't know whether 'name' is a\r
+                        # submodule of 'm' or a global module. Let's just try\r
+                        # the full name first.\r
+                        mm = self.modules.get(m.__name__ + "." + name)\r
+                    if mm is None:\r
+                        mm = self.modules.get(name)\r
+                    if mm is not None:\r
+                        m.globalnames.update(mm.globalnames)\r
+                        m.starimports.update(mm.starimports)\r
+                        if mm.__code__ is None:\r
+                            m.starimports[name] = 1\r
+                    else:\r
+                        m.starimports[name] = 1\r
+            elif what == "relative_import":\r
+                level, fromlist, name = args\r
+                if name:\r
+                    self._safe_import_hook(name, m, fromlist, level=level)\r
+                else:\r
+                    parent = self.determine_parent(m, level=level)\r
+                    self._safe_import_hook(parent.__name__, None, fromlist, level=0)\r
+            else:\r
+                # We don't expect anything else from the generator.\r
+                raise RuntimeError(what)\r
+\r
+        for c in co.co_consts:\r
+            if isinstance(c, type(co)):\r
+                self.scan_code(c, m)\r
+\r
+    def load_package(self, fqname, pathname):\r
+        self.msgin(2, "load_package", fqname, pathname)\r
+        newname = replacePackageMap.get(fqname)\r
+        if newname:\r
+            fqname = newname\r
+        m = self.add_module(fqname)\r
+        m.__file__ = pathname\r
+        m.__path__ = [pathname]\r
+\r
+        # As per comment at top of file, simulate runtime __path__ additions.\r
+        m.__path__ = m.__path__ + packagePathMap.get(fqname, [])\r
+\r
+        fp, buf, stuff = self.find_module("__init__", m.__path__)\r
+        self.load_module(fqname, fp, buf, stuff)\r
+        self.msgout(2, "load_package ->", m)\r
+        if fp:\r
+            fp.close()\r
+        return m\r
+\r
+    def add_module(self, fqname):\r
+        if fqname in self.modules:\r
+            return self.modules[fqname]\r
+        self.modules[fqname] = m = Module(fqname)\r
+        return m\r
+\r
+    def find_module(self, name, path, parent=None):\r
+        if parent is not None:\r
+            # assert path is not None\r
+            fullname = parent.__name__+'.'+name\r
+        else:\r
+            fullname = name\r
+        if fullname in self.excludes:\r
+            self.msgout(3, "find_module -> Excluded", fullname)\r
+            raise ImportError, name\r
+\r
+        if path is None:\r
+            if name in sys.builtin_module_names:\r
+                return (None, None, ("", "", imp.C_BUILTIN))\r
+\r
+            path = self.path\r
+        return imp.find_module(name, path)\r
+\r
+    def report(self):\r
+        """Print a report to stdout, listing the found modules with their\r
+        paths, as well as modules that are missing, or seem to be missing.\r
+        """\r
+        print\r
+        print "  %-25s %s" % ("Name", "File")\r
+        print "  %-25s %s" % ("----", "----")\r
+        # Print modules found\r
+        keys = self.modules.keys()\r
+        keys.sort()\r
+        for key in keys:\r
+            m = self.modules[key]\r
+            if m.__path__:\r
+                print "P",\r
+            else:\r
+                print "m",\r
+            print "%-25s" % key, m.__file__ or ""\r
+\r
+        # Print missing modules\r
+        missing, maybe = self.any_missing_maybe()\r
+        if missing:\r
+            print\r
+            print "Missing modules:"\r
+            for name in missing:\r
+                mods = self.badmodules[name].keys()\r
+                mods.sort()\r
+                print "?", name, "imported from", ', '.join(mods)\r
+        # Print modules that may be missing, but then again, maybe not...\r
+        if maybe:\r
+            print\r
+            print "Submodules that appear to be missing, but could also be",\r
+            print "global names in the parent package:"\r
+            for name in maybe:\r
+                mods = self.badmodules[name].keys()\r
+                mods.sort()\r
+                print "?", name, "imported from", ', '.join(mods)\r
+\r
+    def any_missing(self):\r
+        """Return a list of modules that appear to be missing. Use\r
+        any_missing_maybe() if you want to know which modules are\r
+        certain to be missing, and which *may* be missing.\r
+        """\r
+        missing, maybe = self.any_missing_maybe()\r
+        return missing + maybe\r
+\r
+    def any_missing_maybe(self):\r
+        """Return two lists, one with modules that are certainly missing\r
+        and one with modules that *may* be missing. The latter names could\r
+        either be submodules *or* just global names in the package.\r
+\r
+        The reason it can't always be determined is that it's impossible to\r
+        tell which names are imported when "from module import *" is done\r
+        with an extension module, short of actually importing it.\r
+        """\r
+        missing = []\r
+        maybe = []\r
+        for name in self.badmodules:\r
+            if name in self.excludes:\r
+                continue\r
+            i = name.rfind(".")\r
+            if i < 0:\r
+                missing.append(name)\r
+                continue\r
+            subname = name[i+1:]\r
+            pkgname = name[:i]\r
+            pkg = self.modules.get(pkgname)\r
+            if pkg is not None:\r
+                if pkgname in self.badmodules[name]:\r
+                    # The package tried to import this module itself and\r
+                    # failed. It's definitely missing.\r
+                    missing.append(name)\r
+                elif subname in pkg.globalnames:\r
+                    # It's a global in the package: definitely not missing.\r
+                    pass\r
+                elif pkg.starimports:\r
+                    # It could be missing, but the package did an "import *"\r
+                    # from a non-Python module, so we simply can't be sure.\r
+                    maybe.append(name)\r
+                else:\r
+                    # It's not a global in the package, the package didn't\r
+                    # do funny star imports, it's very likely to be missing.\r
+                    # The symbol could be inserted into the package from the\r
+                    # outside, but since that's not good style we simply list\r
+                    # it missing.\r
+                    missing.append(name)\r
+            else:\r
+                missing.append(name)\r
+        missing.sort()\r
+        maybe.sort()\r
+        return missing, maybe\r
+\r
+    def replace_paths_in_code(self, co):\r
+        new_filename = original_filename = os.path.normpath(co.co_filename)\r
+        for f, r in self.replace_paths:\r
+            if original_filename.startswith(f):\r
+                new_filename = r + original_filename[len(f):]\r
+                break\r
+\r
+        if self.debug and original_filename not in self.processed_paths:\r
+            if new_filename != original_filename:\r
+                self.msgout(2, "co_filename %r changed to %r" \\r
+                                    % (original_filename,new_filename,))\r
+            else:\r
+                self.msgout(2, "co_filename %r remains unchanged" \\r
+                                    % (original_filename,))\r
+            self.processed_paths.append(original_filename)\r
+\r
+        consts = list(co.co_consts)\r
+        for i in range(len(consts)):\r
+            if isinstance(consts[i], type(co)):\r
+                consts[i] = self.replace_paths_in_code(consts[i])\r
+\r
+        return types.CodeType(co.co_argcount, co.co_nlocals, co.co_stacksize,\r
+                         co.co_flags, co.co_code, tuple(consts), co.co_names,\r
+                         co.co_varnames, new_filename, co.co_name,\r
+                         co.co_firstlineno, co.co_lnotab,\r
+                         co.co_freevars, co.co_cellvars)\r
+\r
+\r
+def test():\r
+    # Parse command line\r
+    import getopt\r
+    try:\r
+        opts, args = getopt.getopt(sys.argv[1:], "dmp:qx:")\r
+    except getopt.error, msg:\r
+        print msg\r
+        return\r
+\r
+    # Process options\r
+    debug = 1\r
+    domods = 0\r
+    addpath = []\r
+    exclude = []\r
+    for o, a in opts:\r
+        if o == '-d':\r
+            debug = debug + 1\r
+        if o == '-m':\r
+            domods = 1\r
+        if o == '-p':\r
+            addpath = addpath + a.split(os.pathsep)\r
+        if o == '-q':\r
+            debug = 0\r
+        if o == '-x':\r
+            exclude.append(a)\r
+\r
+    # Provide default arguments\r
+    if not args:\r
+        script = "hello.py"\r
+    else:\r
+        script = args[0]\r
+\r
+    # Set the path based on sys.path and the script directory\r
+    path = sys.path[:]\r
+    path[0] = os.path.dirname(script)\r
+    path = addpath + path\r
+    if debug > 1:\r
+        print "path:"\r
+        for item in path:\r
+            print "   ", repr(item)\r
+\r
+    # Create the module finder and turn its crank\r
+    mf = ModuleFinder(path, debug, exclude)\r
+    for arg in args[1:]:\r
+        if arg == '-m':\r
+            domods = 1\r
+            continue\r
+        if domods:\r
+            if arg[-2:] == '.*':\r
+                mf.import_hook(arg[:-2], None, ["*"])\r
+            else:\r
+                mf.import_hook(arg)\r
+        else:\r
+            mf.load_file(arg)\r
+    mf.run_script(script)\r
+    mf.report()\r
+    return mf  # for -i debugging\r
+\r
+\r
+if __name__ == '__main__':\r
+    try:\r
+        mf = test()\r
+    except KeyboardInterrupt:\r
+        print "\n[interrupt]"\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/numbers.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/numbers.py
new file mode 100644 (file)
index 0000000..f41775a
--- /dev/null
@@ -0,0 +1,391 @@
+# Copyright 2007 Google, Inc. All Rights Reserved.\r
+# Licensed to PSF under a Contributor Agreement.\r
+\r
+"""Abstract Base Classes (ABCs) for numbers, according to PEP 3141.\r
+\r
+TODO: Fill out more detailed documentation on the operators."""\r
+\r
+from __future__ import division\r
+from abc import ABCMeta, abstractmethod, abstractproperty\r
+\r
+__all__ = ["Number", "Complex", "Real", "Rational", "Integral"]\r
+\r
+class Number(object):\r
+    """All numbers inherit from this class.\r
+\r
+    If you just want to check if an argument x is a number, without\r
+    caring what kind, use isinstance(x, Number).\r
+    """\r
+    __metaclass__ = ABCMeta\r
+    __slots__ = ()\r
+\r
+    # Concrete numeric types must provide their own hash implementation\r
+    __hash__ = None\r
+\r
+\r
+## Notes on Decimal\r
+## ----------------\r
+## Decimal has all of the methods specified by the Real abc, but it should\r
+## not be registered as a Real because decimals do not interoperate with\r
+## binary floats (i.e.  Decimal('3.14') + 2.71828 is undefined).  But,\r
+## abstract reals are expected to interoperate (i.e. R1 + R2 should be\r
+## expected to work if R1 and R2 are both Reals).\r
+\r
+class Complex(Number):\r
+    """Complex defines the operations that work on the builtin complex type.\r
+\r
+    In short, those are: a conversion to complex, .real, .imag, +, -,\r
+    *, /, abs(), .conjugate, ==, and !=.\r
+\r
+    If it is given heterogenous arguments, and doesn't have special\r
+    knowledge about them, it should fall back to the builtin complex\r
+    type as described below.\r
+    """\r
+\r
+    __slots__ = ()\r
+\r
+    @abstractmethod\r
+    def __complex__(self):\r
+        """Return a builtin complex instance. Called for complex(self)."""\r
+\r
+    # Will be __bool__ in 3.0.\r
+    def __nonzero__(self):\r
+        """True if self != 0. Called for bool(self)."""\r
+        return self != 0\r
+\r
+    @abstractproperty\r
+    def real(self):\r
+        """Retrieve the real component of this number.\r
+\r
+        This should subclass Real.\r
+        """\r
+        raise NotImplementedError\r
+\r
+    @abstractproperty\r
+    def imag(self):\r
+        """Retrieve the imaginary component of this number.\r
+\r
+        This should subclass Real.\r
+        """\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __add__(self, other):\r
+        """self + other"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __radd__(self, other):\r
+        """other + self"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __neg__(self):\r
+        """-self"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __pos__(self):\r
+        """+self"""\r
+        raise NotImplementedError\r
+\r
+    def __sub__(self, other):\r
+        """self - other"""\r
+        return self + -other\r
+\r
+    def __rsub__(self, other):\r
+        """other - self"""\r
+        return -self + other\r
+\r
+    @abstractmethod\r
+    def __mul__(self, other):\r
+        """self * other"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rmul__(self, other):\r
+        """other * self"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __div__(self, other):\r
+        """self / other without __future__ division\r
+\r
+        May promote to float.\r
+        """\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rdiv__(self, other):\r
+        """other / self without __future__ division"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __truediv__(self, other):\r
+        """self / other with __future__ division.\r
+\r
+        Should promote to float when necessary.\r
+        """\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rtruediv__(self, other):\r
+        """other / self with __future__ division"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __pow__(self, exponent):\r
+        """self**exponent; should promote to float or complex when necessary."""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rpow__(self, base):\r
+        """base ** self"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __abs__(self):\r
+        """Returns the Real distance from 0. Called for abs(self)."""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def conjugate(self):\r
+        """(x+y*i).conjugate() returns (x-y*i)."""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __eq__(self, other):\r
+        """self == other"""\r
+        raise NotImplementedError\r
+\r
+    def __ne__(self, other):\r
+        """self != other"""\r
+        # The default __ne__ doesn't negate __eq__ until 3.0.\r
+        return not (self == other)\r
+\r
+Complex.register(complex)\r
+\r
+\r
+class Real(Complex):\r
+    """To Complex, Real adds the operations that work on real numbers.\r
+\r
+    In short, those are: a conversion to float, trunc(), divmod,\r
+    %, <, <=, >, and >=.\r
+\r
+    Real also provides defaults for the derived operations.\r
+    """\r
+\r
+    __slots__ = ()\r
+\r
+    @abstractmethod\r
+    def __float__(self):\r
+        """Any Real can be converted to a native float object.\r
+\r
+        Called for float(self)."""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __trunc__(self):\r
+        """trunc(self): Truncates self to an Integral.\r
+\r
+        Returns an Integral i such that:\r
+          * i>0 iff self>0;\r
+          * abs(i) <= abs(self);\r
+          * for any Integral j satisfying the first two conditions,\r
+            abs(i) >= abs(j) [i.e. i has "maximal" abs among those].\r
+        i.e. "truncate towards 0".\r
+        """\r
+        raise NotImplementedError\r
+\r
+    def __divmod__(self, other):\r
+        """divmod(self, other): The pair (self // other, self % other).\r
+\r
+        Sometimes this can be computed faster than the pair of\r
+        operations.\r
+        """\r
+        return (self // other, self % other)\r
+\r
+    def __rdivmod__(self, other):\r
+        """divmod(other, self): The pair (self // other, self % other).\r
+\r
+        Sometimes this can be computed faster than the pair of\r
+        operations.\r
+        """\r
+        return (other // self, other % self)\r
+\r
+    @abstractmethod\r
+    def __floordiv__(self, other):\r
+        """self // other: The floor() of self/other."""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rfloordiv__(self, other):\r
+        """other // self: The floor() of other/self."""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __mod__(self, other):\r
+        """self % other"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rmod__(self, other):\r
+        """other % self"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __lt__(self, other):\r
+        """self < other\r
+\r
+        < on Reals defines a total ordering, except perhaps for NaN."""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __le__(self, other):\r
+        """self <= other"""\r
+        raise NotImplementedError\r
+\r
+    # Concrete implementations of Complex abstract methods.\r
+    def __complex__(self):\r
+        """complex(self) == complex(float(self), 0)"""\r
+        return complex(float(self))\r
+\r
+    @property\r
+    def real(self):\r
+        """Real numbers are their real component."""\r
+        return +self\r
+\r
+    @property\r
+    def imag(self):\r
+        """Real numbers have no imaginary component."""\r
+        return 0\r
+\r
+    def conjugate(self):\r
+        """Conjugate is a no-op for Reals."""\r
+        return +self\r
+\r
+Real.register(float)\r
+\r
+\r
+class Rational(Real):\r
+    """.numerator and .denominator should be in lowest terms."""\r
+\r
+    __slots__ = ()\r
+\r
+    @abstractproperty\r
+    def numerator(self):\r
+        raise NotImplementedError\r
+\r
+    @abstractproperty\r
+    def denominator(self):\r
+        raise NotImplementedError\r
+\r
+    # Concrete implementation of Real's conversion to float.\r
+    def __float__(self):\r
+        """float(self) = self.numerator / self.denominator\r
+\r
+        It's important that this conversion use the integer's "true"\r
+        division rather than casting one side to float before dividing\r
+        so that ratios of huge integers convert without overflowing.\r
+\r
+        """\r
+        return self.numerator / self.denominator\r
+\r
+\r
+class Integral(Rational):\r
+    """Integral adds a conversion to long and the bit-string operations."""\r
+\r
+    __slots__ = ()\r
+\r
+    @abstractmethod\r
+    def __long__(self):\r
+        """long(self)"""\r
+        raise NotImplementedError\r
+\r
+    def __index__(self):\r
+        """Called whenever an index is needed, such as in slicing"""\r
+        return long(self)\r
+\r
+    @abstractmethod\r
+    def __pow__(self, exponent, modulus=None):\r
+        """self ** exponent % modulus, but maybe faster.\r
+\r
+        Accept the modulus argument if you want to support the\r
+        3-argument version of pow(). Raise a TypeError if exponent < 0\r
+        or any argument isn't Integral. Otherwise, just implement the\r
+        2-argument version described in Complex.\r
+        """\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __lshift__(self, other):\r
+        """self << other"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rlshift__(self, other):\r
+        """other << self"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rshift__(self, other):\r
+        """self >> other"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rrshift__(self, other):\r
+        """other >> self"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __and__(self, other):\r
+        """self & other"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rand__(self, other):\r
+        """other & self"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __xor__(self, other):\r
+        """self ^ other"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __rxor__(self, other):\r
+        """other ^ self"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __or__(self, other):\r
+        """self | other"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __ror__(self, other):\r
+        """other | self"""\r
+        raise NotImplementedError\r
+\r
+    @abstractmethod\r
+    def __invert__(self):\r
+        """~self"""\r
+        raise NotImplementedError\r
+\r
+    # Concrete implementations of Rational and Real abstract methods.\r
+    def __float__(self):\r
+        """float(self) == float(long(self))"""\r
+        return float(long(self))\r
+\r
+    @property\r
+    def numerator(self):\r
+        """Integers are their own numerators."""\r
+        return +self\r
+\r
+    @property\r
+    def denominator(self):\r
+        """Integers have a denominator of 1."""\r
+        return 1\r
+\r
+Integral.register(int)\r
+Integral.register(long)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/opcode.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/opcode.py
new file mode 100644 (file)
index 0000000..14e8d5c
--- /dev/null
@@ -0,0 +1,192 @@
+\r
+"""\r
+opcode module - potentially shared between dis and other modules which\r
+operate on bytecodes (e.g. peephole optimizers).\r
+"""\r
+\r
+__all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs",\r
+           "haslocal", "hascompare", "hasfree", "opname", "opmap",\r
+           "HAVE_ARGUMENT", "EXTENDED_ARG"]\r
+\r
+cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is',\r
+        'is not', 'exception match', 'BAD')\r
+\r
+hasconst = []\r
+hasname = []\r
+hasjrel = []\r
+hasjabs = []\r
+haslocal = []\r
+hascompare = []\r
+hasfree = []\r
+\r
+opmap = {}\r
+opname = [''] * 256\r
+for op in range(256): opname[op] = '<%r>' % (op,)\r
+del op\r
+\r
+def def_op(name, op):\r
+    opname[op] = name\r
+    opmap[name] = op\r
+\r
+def name_op(name, op):\r
+    def_op(name, op)\r
+    hasname.append(op)\r
+\r
+def jrel_op(name, op):\r
+    def_op(name, op)\r
+    hasjrel.append(op)\r
+\r
+def jabs_op(name, op):\r
+    def_op(name, op)\r
+    hasjabs.append(op)\r
+\r
+# Instruction opcodes for compiled code\r
+# Blank lines correspond to available opcodes\r
+\r
+def_op('STOP_CODE', 0)\r
+def_op('POP_TOP', 1)\r
+def_op('ROT_TWO', 2)\r
+def_op('ROT_THREE', 3)\r
+def_op('DUP_TOP', 4)\r
+def_op('ROT_FOUR', 5)\r
+\r
+def_op('NOP', 9)\r
+def_op('UNARY_POSITIVE', 10)\r
+def_op('UNARY_NEGATIVE', 11)\r
+def_op('UNARY_NOT', 12)\r
+def_op('UNARY_CONVERT', 13)\r
+\r
+def_op('UNARY_INVERT', 15)\r
+\r
+def_op('BINARY_POWER', 19)\r
+def_op('BINARY_MULTIPLY', 20)\r
+def_op('BINARY_DIVIDE', 21)\r
+def_op('BINARY_MODULO', 22)\r
+def_op('BINARY_ADD', 23)\r
+def_op('BINARY_SUBTRACT', 24)\r
+def_op('BINARY_SUBSCR', 25)\r
+def_op('BINARY_FLOOR_DIVIDE', 26)\r
+def_op('BINARY_TRUE_DIVIDE', 27)\r
+def_op('INPLACE_FLOOR_DIVIDE', 28)\r
+def_op('INPLACE_TRUE_DIVIDE', 29)\r
+def_op('SLICE+0', 30)\r
+def_op('SLICE+1', 31)\r
+def_op('SLICE+2', 32)\r
+def_op('SLICE+3', 33)\r
+\r
+def_op('STORE_SLICE+0', 40)\r
+def_op('STORE_SLICE+1', 41)\r
+def_op('STORE_SLICE+2', 42)\r
+def_op('STORE_SLICE+3', 43)\r
+\r
+def_op('DELETE_SLICE+0', 50)\r
+def_op('DELETE_SLICE+1', 51)\r
+def_op('DELETE_SLICE+2', 52)\r
+def_op('DELETE_SLICE+3', 53)\r
+\r
+def_op('STORE_MAP', 54)\r
+def_op('INPLACE_ADD', 55)\r
+def_op('INPLACE_SUBTRACT', 56)\r
+def_op('INPLACE_MULTIPLY', 57)\r
+def_op('INPLACE_DIVIDE', 58)\r
+def_op('INPLACE_MODULO', 59)\r
+def_op('STORE_SUBSCR', 60)\r
+def_op('DELETE_SUBSCR', 61)\r
+def_op('BINARY_LSHIFT', 62)\r
+def_op('BINARY_RSHIFT', 63)\r
+def_op('BINARY_AND', 64)\r
+def_op('BINARY_XOR', 65)\r
+def_op('BINARY_OR', 66)\r
+def_op('INPLACE_POWER', 67)\r
+def_op('GET_ITER', 68)\r
+\r
+def_op('PRINT_EXPR', 70)\r
+def_op('PRINT_ITEM', 71)\r
+def_op('PRINT_NEWLINE', 72)\r
+def_op('PRINT_ITEM_TO', 73)\r
+def_op('PRINT_NEWLINE_TO', 74)\r
+def_op('INPLACE_LSHIFT', 75)\r
+def_op('INPLACE_RSHIFT', 76)\r
+def_op('INPLACE_AND', 77)\r
+def_op('INPLACE_XOR', 78)\r
+def_op('INPLACE_OR', 79)\r
+def_op('BREAK_LOOP', 80)\r
+def_op('WITH_CLEANUP', 81)\r
+def_op('LOAD_LOCALS', 82)\r
+def_op('RETURN_VALUE', 83)\r
+def_op('IMPORT_STAR', 84)\r
+def_op('EXEC_STMT', 85)\r
+def_op('YIELD_VALUE', 86)\r
+def_op('POP_BLOCK', 87)\r
+def_op('END_FINALLY', 88)\r
+def_op('BUILD_CLASS', 89)\r
+\r
+HAVE_ARGUMENT = 90              # Opcodes from here have an argument:\r
+\r
+name_op('STORE_NAME', 90)       # Index in name list\r
+name_op('DELETE_NAME', 91)      # ""\r
+def_op('UNPACK_SEQUENCE', 92)   # Number of tuple items\r
+jrel_op('FOR_ITER', 93)\r
+def_op('LIST_APPEND', 94)\r
+name_op('STORE_ATTR', 95)       # Index in name list\r
+name_op('DELETE_ATTR', 96)      # ""\r
+name_op('STORE_GLOBAL', 97)     # ""\r
+name_op('DELETE_GLOBAL', 98)    # ""\r
+def_op('DUP_TOPX', 99)          # number of items to duplicate\r
+def_op('LOAD_CONST', 100)       # Index in const list\r
+hasconst.append(100)\r
+name_op('LOAD_NAME', 101)       # Index in name list\r
+def_op('BUILD_TUPLE', 102)      # Number of tuple items\r
+def_op('BUILD_LIST', 103)       # Number of list items\r
+def_op('BUILD_SET', 104)        # Number of set items\r
+def_op('BUILD_MAP', 105)        # Number of dict entries (upto 255)\r
+name_op('LOAD_ATTR', 106)       # Index in name list\r
+def_op('COMPARE_OP', 107)       # Comparison operator\r
+hascompare.append(107)\r
+name_op('IMPORT_NAME', 108)     # Index in name list\r
+name_op('IMPORT_FROM', 109)     # Index in name list\r
+jrel_op('JUMP_FORWARD', 110)    # Number of bytes to skip\r
+jabs_op('JUMP_IF_FALSE_OR_POP', 111) # Target byte offset from beginning of code\r
+jabs_op('JUMP_IF_TRUE_OR_POP', 112)  # ""\r
+jabs_op('JUMP_ABSOLUTE', 113)        # ""\r
+jabs_op('POP_JUMP_IF_FALSE', 114)    # ""\r
+jabs_op('POP_JUMP_IF_TRUE', 115)     # ""\r
+\r
+name_op('LOAD_GLOBAL', 116)     # Index in name list\r
+\r
+jabs_op('CONTINUE_LOOP', 119)   # Target address\r
+jrel_op('SETUP_LOOP', 120)      # Distance to target address\r
+jrel_op('SETUP_EXCEPT', 121)    # ""\r
+jrel_op('SETUP_FINALLY', 122)   # ""\r
+\r
+def_op('LOAD_FAST', 124)        # Local variable number\r
+haslocal.append(124)\r
+def_op('STORE_FAST', 125)       # Local variable number\r
+haslocal.append(125)\r
+def_op('DELETE_FAST', 126)      # Local variable number\r
+haslocal.append(126)\r
+\r
+def_op('RAISE_VARARGS', 130)    # Number of raise arguments (1, 2, or 3)\r
+def_op('CALL_FUNCTION', 131)    # #args + (#kwargs << 8)\r
+def_op('MAKE_FUNCTION', 132)    # Number of args with default values\r
+def_op('BUILD_SLICE', 133)      # Number of items\r
+def_op('MAKE_CLOSURE', 134)\r
+def_op('LOAD_CLOSURE', 135)\r
+hasfree.append(135)\r
+def_op('LOAD_DEREF', 136)\r
+hasfree.append(136)\r
+def_op('STORE_DEREF', 137)\r
+hasfree.append(137)\r
+\r
+def_op('CALL_FUNCTION_VAR', 140)     # #args + (#kwargs << 8)\r
+def_op('CALL_FUNCTION_KW', 141)      # #args + (#kwargs << 8)\r
+def_op('CALL_FUNCTION_VAR_KW', 142)  # #args + (#kwargs << 8)\r
+\r
+jrel_op('SETUP_WITH', 143)\r
+\r
+def_op('EXTENDED_ARG', 145)\r
+EXTENDED_ARG = 145\r
+def_op('SET_ADD', 146)\r
+def_op('MAP_ADD', 147)\r
+\r
+del def_op, name_op, jrel_op, jabs_op\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/optparse.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/optparse.py
new file mode 100644 (file)
index 0000000..fee5fae
--- /dev/null
@@ -0,0 +1,1704 @@
+"""A powerful, extensible, and easy-to-use option parser.\r
+\r
+By Greg Ward <gward@python.net>\r
+\r
+Originally distributed as Optik.\r
+\r
+For support, use the optik-users@lists.sourceforge.net mailing list\r
+(http://lists.sourceforge.net/lists/listinfo/optik-users).\r
+\r
+Simple usage example:\r
+\r
+   from optparse import OptionParser\r
+\r
+   parser = OptionParser()\r
+   parser.add_option("-f", "--file", dest="filename",\r
+                     help="write report to FILE", metavar="FILE")\r
+   parser.add_option("-q", "--quiet",\r
+                     action="store_false", dest="verbose", default=True,\r
+                     help="don't print status messages to stdout")\r
+\r
+   (options, args) = parser.parse_args()\r
+"""\r
+\r
+__version__ = "1.5.3"\r
+\r
+__all__ = ['Option',\r
+           'make_option',\r
+           'SUPPRESS_HELP',\r
+           'SUPPRESS_USAGE',\r
+           'Values',\r
+           'OptionContainer',\r
+           'OptionGroup',\r
+           'OptionParser',\r
+           'HelpFormatter',\r
+           'IndentedHelpFormatter',\r
+           'TitledHelpFormatter',\r
+           'OptParseError',\r
+           'OptionError',\r
+           'OptionConflictError',\r
+           'OptionValueError',\r
+           'BadOptionError']\r
+\r
+__copyright__ = """\r
+Copyright (c) 2001-2006 Gregory P. Ward.  All rights reserved.\r
+Copyright (c) 2002-2006 Python Software Foundation.  All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or without\r
+modification, are permitted provided that the following conditions are\r
+met:\r
+\r
+  * Redistributions of source code must retain the above copyright\r
+    notice, this list of conditions and the following disclaimer.\r
+\r
+  * Redistributions in binary form must reproduce the above copyright\r
+    notice, this list of conditions and the following disclaimer in the\r
+    documentation and/or other materials provided with the distribution.\r
+\r
+  * Neither the name of the author nor the names of its\r
+    contributors may be used to endorse or promote products derived from\r
+    this software without specific prior written permission.\r
+\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS\r
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\r
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\r
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR\r
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+"""\r
+\r
+import sys, os\r
+import types\r
+import textwrap\r
+\r
+def _repr(self):\r
+    return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self)\r
+\r
+\r
+# This file was generated from:\r
+#   Id: option_parser.py 527 2006-07-23 15:21:30Z greg\r
+#   Id: option.py 522 2006-06-11 16:22:03Z gward\r
+#   Id: help.py 527 2006-07-23 15:21:30Z greg\r
+#   Id: errors.py 509 2006-04-20 00:58:24Z gward\r
+\r
+try:\r
+    from gettext import gettext\r
+except ImportError:\r
+    def gettext(message):\r
+        return message\r
+_ = gettext\r
+\r
+\r
+class OptParseError (Exception):\r
+    def __init__(self, msg):\r
+        self.msg = msg\r
+\r
+    def __str__(self):\r
+        return self.msg\r
+\r
+\r
+class OptionError (OptParseError):\r
+    """\r
+    Raised if an Option instance is created with invalid or\r
+    inconsistent arguments.\r
+    """\r
+\r
+    def __init__(self, msg, option):\r
+        self.msg = msg\r
+        self.option_id = str(option)\r
+\r
+    def __str__(self):\r
+        if self.option_id:\r
+            return "option %s: %s" % (self.option_id, self.msg)\r
+        else:\r
+            return self.msg\r
+\r
+class OptionConflictError (OptionError):\r
+    """\r
+    Raised if conflicting options are added to an OptionParser.\r
+    """\r
+\r
+class OptionValueError (OptParseError):\r
+    """\r
+    Raised if an invalid option value is encountered on the command\r
+    line.\r
+    """\r
+\r
+class BadOptionError (OptParseError):\r
+    """\r
+    Raised if an invalid option is seen on the command line.\r
+    """\r
+    def __init__(self, opt_str):\r
+        self.opt_str = opt_str\r
+\r
+    def __str__(self):\r
+        return _("no such option: %s") % self.opt_str\r
+\r
+class AmbiguousOptionError (BadOptionError):\r
+    """\r
+    Raised if an ambiguous option is seen on the command line.\r
+    """\r
+    def __init__(self, opt_str, possibilities):\r
+        BadOptionError.__init__(self, opt_str)\r
+        self.possibilities = possibilities\r
+\r
+    def __str__(self):\r
+        return (_("ambiguous option: %s (%s?)")\r
+                % (self.opt_str, ", ".join(self.possibilities)))\r
+\r
+\r
+class HelpFormatter:\r
+\r
+    """\r
+    Abstract base class for formatting option help.  OptionParser\r
+    instances should use one of the HelpFormatter subclasses for\r
+    formatting help; by default IndentedHelpFormatter is used.\r
+\r
+    Instance attributes:\r
+      parser : OptionParser\r
+        the controlling OptionParser instance\r
+      indent_increment : int\r
+        the number of columns to indent per nesting level\r
+      max_help_position : int\r
+        the maximum starting column for option help text\r
+      help_position : int\r
+        the calculated starting column for option help text;\r
+        initially the same as the maximum\r
+      width : int\r
+        total number of columns for output (pass None to constructor for\r
+        this value to be taken from the $COLUMNS environment variable)\r
+      level : int\r
+        current indentation level\r
+      current_indent : int\r
+        current indentation level (in columns)\r
+      help_width : int\r
+        number of columns available for option help text (calculated)\r
+      default_tag : str\r
+        text to replace with each option's default value, "%default"\r
+        by default.  Set to false value to disable default value expansion.\r
+      option_strings : { Option : str }\r
+        maps Option instances to the snippet of help text explaining\r
+        the syntax of that option, e.g. "-h, --help" or\r
+        "-fFILE, --file=FILE"\r
+      _short_opt_fmt : str\r
+        format string controlling how short options with values are\r
+        printed in help text.  Must be either "%s%s" ("-fFILE") or\r
+        "%s %s" ("-f FILE"), because those are the two syntaxes that\r
+        Optik supports.\r
+      _long_opt_fmt : str\r
+        similar but for long options; must be either "%s %s" ("--file FILE")\r
+        or "%s=%s" ("--file=FILE").\r
+    """\r
+\r
+    NO_DEFAULT_VALUE = "none"\r
+\r
+    def __init__(self,\r
+                 indent_increment,\r
+                 max_help_position,\r
+                 width,\r
+                 short_first):\r
+        self.parser = None\r
+        self.indent_increment = indent_increment\r
+        if width is None:\r
+            try:\r
+                width = int(os.environ['COLUMNS'])\r
+            except (KeyError, ValueError):\r
+                width = 80\r
+            width -= 2\r
+        self.width = width\r
+        self.help_position = self.max_help_position = \\r
+                min(max_help_position, max(width - 20, indent_increment * 2))\r
+        self.current_indent = 0\r
+        self.level = 0\r
+        self.help_width = None          # computed later\r
+        self.short_first = short_first\r
+        self.default_tag = "%default"\r
+        self.option_strings = {}\r
+        self._short_opt_fmt = "%s %s"\r
+        self._long_opt_fmt = "%s=%s"\r
+\r
+    def set_parser(self, parser):\r
+        self.parser = parser\r
+\r
+    def set_short_opt_delimiter(self, delim):\r
+        if delim not in ("", " "):\r
+            raise ValueError(\r
+                "invalid metavar delimiter for short options: %r" % delim)\r
+        self._short_opt_fmt = "%s" + delim + "%s"\r
+\r
+    def set_long_opt_delimiter(self, delim):\r
+        if delim not in ("=", " "):\r
+            raise ValueError(\r
+                "invalid metavar delimiter for long options: %r" % delim)\r
+        self._long_opt_fmt = "%s" + delim + "%s"\r
+\r
+    def indent(self):\r
+        self.current_indent += self.indent_increment\r
+        self.level += 1\r
+\r
+    def dedent(self):\r
+        self.current_indent -= self.indent_increment\r
+        assert self.current_indent >= 0, "Indent decreased below 0."\r
+        self.level -= 1\r
+\r
+    def format_usage(self, usage):\r
+        raise NotImplementedError, "subclasses must implement"\r
+\r
+    def format_heading(self, heading):\r
+        raise NotImplementedError, "subclasses must implement"\r
+\r
+    def _format_text(self, text):\r
+        """\r
+        Format a paragraph of free-form text for inclusion in the\r
+        help output at the current indentation level.\r
+        """\r
+        text_width = max(self.width - self.current_indent, 11)\r
+        indent = " "*self.current_indent\r
+        return textwrap.fill(text,\r
+                             text_width,\r
+                             initial_indent=indent,\r
+                             subsequent_indent=indent)\r
+\r
+    def format_description(self, description):\r
+        if description:\r
+            return self._format_text(description) + "\n"\r
+        else:\r
+            return ""\r
+\r
+    def format_epilog(self, epilog):\r
+        if epilog:\r
+            return "\n" + self._format_text(epilog) + "\n"\r
+        else:\r
+            return ""\r
+\r
+\r
+    def expand_default(self, option):\r
+        if self.parser is None or not self.default_tag:\r
+            return option.help\r
+\r
+        default_value = self.parser.defaults.get(option.dest)\r
+        if default_value is NO_DEFAULT or default_value is None:\r
+            default_value = self.NO_DEFAULT_VALUE\r
+\r
+        return option.help.replace(self.default_tag, str(default_value))\r
+\r
+    def format_option(self, option):\r
+        # The help for each option consists of two parts:\r
+        #   * the opt strings and metavars\r
+        #     eg. ("-x", or "-fFILENAME, --file=FILENAME")\r
+        #   * the user-supplied help string\r
+        #     eg. ("turn on expert mode", "read data from FILENAME")\r
+        #\r
+        # If possible, we write both of these on the same line:\r
+        #   -x      turn on expert mode\r
+        #\r
+        # But if the opt string list is too long, we put the help\r
+        # string on a second line, indented to the same column it would\r
+        # start in if it fit on the first line.\r
+        #   -fFILENAME, --file=FILENAME\r
+        #           read data from FILENAME\r
+        result = []\r
+        opts = self.option_strings[option]\r
+        opt_width = self.help_position - self.current_indent - 2\r
+        if len(opts) > opt_width:\r
+            opts = "%*s%s\n" % (self.current_indent, "", opts)\r
+            indent_first = self.help_position\r
+        else:                       # start help on same line as opts\r
+            opts = "%*s%-*s  " % (self.current_indent, "", opt_width, opts)\r
+            indent_first = 0\r
+        result.append(opts)\r
+        if option.help:\r
+            help_text = self.expand_default(option)\r
+            help_lines = textwrap.wrap(help_text, self.help_width)\r
+            result.append("%*s%s\n" % (indent_first, "", help_lines[0]))\r
+            result.extend(["%*s%s\n" % (self.help_position, "", line)\r
+                           for line in help_lines[1:]])\r
+        elif opts[-1] != "\n":\r
+            result.append("\n")\r
+        return "".join(result)\r
+\r
+    def store_option_strings(self, parser):\r
+        self.indent()\r
+        max_len = 0\r
+        for opt in parser.option_list:\r
+            strings = self.format_option_strings(opt)\r
+            self.option_strings[opt] = strings\r
+            max_len = max(max_len, len(strings) + self.current_indent)\r
+        self.indent()\r
+        for group in parser.option_groups:\r
+            for opt in group.option_list:\r
+                strings = self.format_option_strings(opt)\r
+                self.option_strings[opt] = strings\r
+                max_len = max(max_len, len(strings) + self.current_indent)\r
+        self.dedent()\r
+        self.dedent()\r
+        self.help_position = min(max_len + 2, self.max_help_position)\r
+        self.help_width = max(self.width - self.help_position, 11)\r
+\r
+    def format_option_strings(self, option):\r
+        """Return a comma-separated list of option strings & metavariables."""\r
+        if option.takes_value():\r
+            metavar = option.metavar or option.dest.upper()\r
+            short_opts = [self._short_opt_fmt % (sopt, metavar)\r
+                          for sopt in option._short_opts]\r
+            long_opts = [self._long_opt_fmt % (lopt, metavar)\r
+                         for lopt in option._long_opts]\r
+        else:\r
+            short_opts = option._short_opts\r
+            long_opts = option._long_opts\r
+\r
+        if self.short_first:\r
+            opts = short_opts + long_opts\r
+        else:\r
+            opts = long_opts + short_opts\r
+\r
+        return ", ".join(opts)\r
+\r
+class IndentedHelpFormatter (HelpFormatter):\r
+    """Format help with indented section bodies.\r
+    """\r
+\r
+    def __init__(self,\r
+                 indent_increment=2,\r
+                 max_help_position=24,\r
+                 width=None,\r
+                 short_first=1):\r
+        HelpFormatter.__init__(\r
+            self, indent_increment, max_help_position, width, short_first)\r
+\r
+    def format_usage(self, usage):\r
+        return _("Usage: %s\n") % usage\r
+\r
+    def format_heading(self, heading):\r
+        return "%*s%s:\n" % (self.current_indent, "", heading)\r
+\r
+\r
+class TitledHelpFormatter (HelpFormatter):\r
+    """Format help with underlined section headers.\r
+    """\r
+\r
+    def __init__(self,\r
+                 indent_increment=0,\r
+                 max_help_position=24,\r
+                 width=None,\r
+                 short_first=0):\r
+        HelpFormatter.__init__ (\r
+            self, indent_increment, max_help_position, width, short_first)\r
+\r
+    def format_usage(self, usage):\r
+        return "%s  %s\n" % (self.format_heading(_("Usage")), usage)\r
+\r
+    def format_heading(self, heading):\r
+        return "%s\n%s\n" % (heading, "=-"[self.level] * len(heading))\r
+\r
+\r
+def _parse_num(val, type):\r
+    if val[:2].lower() == "0x":         # hexadecimal\r
+        radix = 16\r
+    elif val[:2].lower() == "0b":       # binary\r
+        radix = 2\r
+        val = val[2:] or "0"            # have to remove "0b" prefix\r
+    elif val[:1] == "0":                # octal\r
+        radix = 8\r
+    else:                               # decimal\r
+        radix = 10\r
+\r
+    return type(val, radix)\r
+\r
+def _parse_int(val):\r
+    return _parse_num(val, int)\r
+\r
+def _parse_long(val):\r
+    return _parse_num(val, long)\r
+\r
+_builtin_cvt = { "int" : (_parse_int, _("integer")),\r
+                 "long" : (_parse_long, _("long integer")),\r
+                 "float" : (float, _("floating-point")),\r
+                 "complex" : (complex, _("complex")) }\r
+\r
+def check_builtin(option, opt, value):\r
+    (cvt, what) = _builtin_cvt[option.type]\r
+    try:\r
+        return cvt(value)\r
+    except ValueError:\r
+        raise OptionValueError(\r
+            _("option %s: invalid %s value: %r") % (opt, what, value))\r
+\r
+def check_choice(option, opt, value):\r
+    if value in option.choices:\r
+        return value\r
+    else:\r
+        choices = ", ".join(map(repr, option.choices))\r
+        raise OptionValueError(\r
+            _("option %s: invalid choice: %r (choose from %s)")\r
+            % (opt, value, choices))\r
+\r
+# Not supplying a default is different from a default of None,\r
+# so we need an explicit "not supplied" value.\r
+NO_DEFAULT = ("NO", "DEFAULT")\r
+\r
+\r
+class Option:\r
+    """\r
+    Instance attributes:\r
+      _short_opts : [string]\r
+      _long_opts : [string]\r
+\r
+      action : string\r
+      type : string\r
+      dest : string\r
+      default : any\r
+      nargs : int\r
+      const : any\r
+      choices : [string]\r
+      callback : function\r
+      callback_args : (any*)\r
+      callback_kwargs : { string : any }\r
+      help : string\r
+      metavar : string\r
+    """\r
+\r
+    # The list of instance attributes that may be set through\r
+    # keyword args to the constructor.\r
+    ATTRS = ['action',\r
+             'type',\r
+             'dest',\r
+             'default',\r
+             'nargs',\r
+             'const',\r
+             'choices',\r
+             'callback',\r
+             'callback_args',\r
+             'callback_kwargs',\r
+             'help',\r
+             'metavar']\r
+\r
+    # The set of actions allowed by option parsers.  Explicitly listed\r
+    # here so the constructor can validate its arguments.\r
+    ACTIONS = ("store",\r
+               "store_const",\r
+               "store_true",\r
+               "store_false",\r
+               "append",\r
+               "append_const",\r
+               "count",\r
+               "callback",\r
+               "help",\r
+               "version")\r
+\r
+    # The set of actions that involve storing a value somewhere;\r
+    # also listed just for constructor argument validation.  (If\r
+    # the action is one of these, there must be a destination.)\r
+    STORE_ACTIONS = ("store",\r
+                     "store_const",\r
+                     "store_true",\r
+                     "store_false",\r
+                     "append",\r
+                     "append_const",\r
+                     "count")\r
+\r
+    # The set of actions for which it makes sense to supply a value\r
+    # type, ie. which may consume an argument from the command line.\r
+    TYPED_ACTIONS = ("store",\r
+                     "append",\r
+                     "callback")\r
+\r
+    # The set of actions which *require* a value type, ie. that\r
+    # always consume an argument from the command line.\r
+    ALWAYS_TYPED_ACTIONS = ("store",\r
+                            "append")\r
+\r
+    # The set of actions which take a 'const' attribute.\r
+    CONST_ACTIONS = ("store_const",\r
+                     "append_const")\r
+\r
+    # The set of known types for option parsers.  Again, listed here for\r
+    # constructor argument validation.\r
+    TYPES = ("string", "int", "long", "float", "complex", "choice")\r
+\r
+    # Dictionary of argument checking functions, which convert and\r
+    # validate option arguments according to the option type.\r
+    #\r
+    # Signature of checking functions is:\r
+    #   check(option : Option, opt : string, value : string) -> any\r
+    # where\r
+    #   option is the Option instance calling the checker\r
+    #   opt is the actual option seen on the command-line\r
+    #     (eg. "-a", "--file")\r
+    #   value is the option argument seen on the command-line\r
+    #\r
+    # The return value should be in the appropriate Python type\r
+    # for option.type -- eg. an integer if option.type == "int".\r
+    #\r
+    # If no checker is defined for a type, arguments will be\r
+    # unchecked and remain strings.\r
+    TYPE_CHECKER = { "int"    : check_builtin,\r
+                     "long"   : check_builtin,\r
+                     "float"  : check_builtin,\r
+                     "complex": check_builtin,\r
+                     "choice" : check_choice,\r
+                   }\r
+\r
+\r
+    # CHECK_METHODS is a list of unbound method objects; they are called\r
+    # by the constructor, in order, after all attributes are\r
+    # initialized.  The list is created and filled in later, after all\r
+    # the methods are actually defined.  (I just put it here because I\r
+    # like to define and document all class attributes in the same\r
+    # place.)  Subclasses that add another _check_*() method should\r
+    # define their own CHECK_METHODS list that adds their check method\r
+    # to those from this class.\r
+    CHECK_METHODS = None\r
+\r
+\r
+    # -- Constructor/initialization methods ----------------------------\r
+\r
+    def __init__(self, *opts, **attrs):\r
+        # Set _short_opts, _long_opts attrs from 'opts' tuple.\r
+        # Have to be set now, in case no option strings are supplied.\r
+        self._short_opts = []\r
+        self._long_opts = []\r
+        opts = self._check_opt_strings(opts)\r
+        self._set_opt_strings(opts)\r
+\r
+        # Set all other attrs (action, type, etc.) from 'attrs' dict\r
+        self._set_attrs(attrs)\r
+\r
+        # Check all the attributes we just set.  There are lots of\r
+        # complicated interdependencies, but luckily they can be farmed\r
+        # out to the _check_*() methods listed in CHECK_METHODS -- which\r
+        # could be handy for subclasses!  The one thing these all share\r
+        # is that they raise OptionError if they discover a problem.\r
+        for checker in self.CHECK_METHODS:\r
+            checker(self)\r
+\r
+    def _check_opt_strings(self, opts):\r
+        # Filter out None because early versions of Optik had exactly\r
+        # one short option and one long option, either of which\r
+        # could be None.\r
+        opts = filter(None, opts)\r
+        if not opts:\r
+            raise TypeError("at least one option string must be supplied")\r
+        return opts\r
+\r
+    def _set_opt_strings(self, opts):\r
+        for opt in opts:\r
+            if len(opt) < 2:\r
+                raise OptionError(\r
+                    "invalid option string %r: "\r
+                    "must be at least two characters long" % opt, self)\r
+            elif len(opt) == 2:\r
+                if not (opt[0] == "-" and opt[1] != "-"):\r
+                    raise OptionError(\r
+                        "invalid short option string %r: "\r
+                        "must be of the form -x, (x any non-dash char)" % opt,\r
+                        self)\r
+                self._short_opts.append(opt)\r
+            else:\r
+                if not (opt[0:2] == "--" and opt[2] != "-"):\r
+                    raise OptionError(\r
+                        "invalid long option string %r: "\r
+                        "must start with --, followed by non-dash" % opt,\r
+                        self)\r
+                self._long_opts.append(opt)\r
+\r
+    def _set_attrs(self, attrs):\r
+        for attr in self.ATTRS:\r
+            if attr in attrs:\r
+                setattr(self, attr, attrs[attr])\r
+                del attrs[attr]\r
+            else:\r
+                if attr == 'default':\r
+                    setattr(self, attr, NO_DEFAULT)\r
+                else:\r
+                    setattr(self, attr, None)\r
+        if attrs:\r
+            attrs = attrs.keys()\r
+            attrs.sort()\r
+            raise OptionError(\r
+                "invalid keyword arguments: %s" % ", ".join(attrs),\r
+                self)\r
+\r
+\r
+    # -- Constructor validation methods --------------------------------\r
+\r
+    def _check_action(self):\r
+        if self.action is None:\r
+            self.action = "store"\r
+        elif self.action not in self.ACTIONS:\r
+            raise OptionError("invalid action: %r" % self.action, self)\r
+\r
+    def _check_type(self):\r
+        if self.type is None:\r
+            if self.action in self.ALWAYS_TYPED_ACTIONS:\r
+                if self.choices is not None:\r
+                    # The "choices" attribute implies "choice" type.\r
+                    self.type = "choice"\r
+                else:\r
+                    # No type given?  "string" is the most sensible default.\r
+                    self.type = "string"\r
+        else:\r
+            # Allow type objects or builtin type conversion functions\r
+            # (int, str, etc.) as an alternative to their names.  (The\r
+            # complicated check of __builtin__ is only necessary for\r
+            # Python 2.1 and earlier, and is short-circuited by the\r
+            # first check on modern Pythons.)\r
+            import __builtin__\r
+            if ( type(self.type) is types.TypeType or\r
+                 (hasattr(self.type, "__name__") and\r
+                  getattr(__builtin__, self.type.__name__, None) is self.type) ):\r
+                self.type = self.type.__name__\r
+\r
+            if self.type == "str":\r
+                self.type = "string"\r
+\r
+            if self.type not in self.TYPES:\r
+                raise OptionError("invalid option type: %r" % self.type, self)\r
+            if self.action not in self.TYPED_ACTIONS:\r
+                raise OptionError(\r
+                    "must not supply a type for action %r" % self.action, self)\r
+\r
+    def _check_choice(self):\r
+        if self.type == "choice":\r
+            if self.choices is None:\r
+                raise OptionError(\r
+                    "must supply a list of choices for type 'choice'", self)\r
+            elif type(self.choices) not in (types.TupleType, types.ListType):\r
+                raise OptionError(\r
+                    "choices must be a list of strings ('%s' supplied)"\r
+                    % str(type(self.choices)).split("'")[1], self)\r
+        elif self.choices is not None:\r
+            raise OptionError(\r
+                "must not supply choices for type %r" % self.type, self)\r
+\r
+    def _check_dest(self):\r
+        # No destination given, and we need one for this action.  The\r
+        # self.type check is for callbacks that take a value.\r
+        takes_value = (self.action in self.STORE_ACTIONS or\r
+                       self.type is not None)\r
+        if self.dest is None and takes_value:\r
+\r
+            # Glean a destination from the first long option string,\r
+            # or from the first short option string if no long options.\r
+            if self._long_opts:\r
+                # eg. "--foo-bar" -> "foo_bar"\r
+                self.dest = self._long_opts[0][2:].replace('-', '_')\r
+            else:\r
+                self.dest = self._short_opts[0][1]\r
+\r
+    def _check_const(self):\r
+        if self.action not in self.CONST_ACTIONS and self.const is not None:\r
+            raise OptionError(\r
+                "'const' must not be supplied for action %r" % self.action,\r
+                self)\r
+\r
+    def _check_nargs(self):\r
+        if self.action in self.TYPED_ACTIONS:\r
+            if self.nargs is None:\r
+                self.nargs = 1\r
+        elif self.nargs is not None:\r
+            raise OptionError(\r
+                "'nargs' must not be supplied for action %r" % self.action,\r
+                self)\r
+\r
+    def _check_callback(self):\r
+        if self.action == "callback":\r
+            if not hasattr(self.callback, '__call__'):\r
+                raise OptionError(\r
+                    "callback not callable: %r" % self.callback, self)\r
+            if (self.callback_args is not None and\r
+                type(self.callback_args) is not types.TupleType):\r
+                raise OptionError(\r
+                    "callback_args, if supplied, must be a tuple: not %r"\r
+                    % self.callback_args, self)\r
+            if (self.callback_kwargs is not None and\r
+                type(self.callback_kwargs) is not types.DictType):\r
+                raise OptionError(\r
+                    "callback_kwargs, if supplied, must be a dict: not %r"\r
+                    % self.callback_kwargs, self)\r
+        else:\r
+            if self.callback is not None:\r
+                raise OptionError(\r
+                    "callback supplied (%r) for non-callback option"\r
+                    % self.callback, self)\r
+            if self.callback_args is not None:\r
+                raise OptionError(\r
+                    "callback_args supplied for non-callback option", self)\r
+            if self.callback_kwargs is not None:\r
+                raise OptionError(\r
+                    "callback_kwargs supplied for non-callback option", self)\r
+\r
+\r
+    CHECK_METHODS = [_check_action,\r
+                     _check_type,\r
+                     _check_choice,\r
+                     _check_dest,\r
+                     _check_const,\r
+                     _check_nargs,\r
+                     _check_callback]\r
+\r
+\r
+    # -- Miscellaneous methods -----------------------------------------\r
+\r
+    def __str__(self):\r
+        return "/".join(self._short_opts + self._long_opts)\r
+\r
+    __repr__ = _repr\r
+\r
+    def takes_value(self):\r
+        return self.type is not None\r
+\r
+    def get_opt_string(self):\r
+        if self._long_opts:\r
+            return self._long_opts[0]\r
+        else:\r
+            return self._short_opts[0]\r
+\r
+\r
+    # -- Processing methods --------------------------------------------\r
+\r
+    def check_value(self, opt, value):\r
+        checker = self.TYPE_CHECKER.get(self.type)\r
+        if checker is None:\r
+            return value\r
+        else:\r
+            return checker(self, opt, value)\r
+\r
+    def convert_value(self, opt, value):\r
+        if value is not None:\r
+            if self.nargs == 1:\r
+                return self.check_value(opt, value)\r
+            else:\r
+                return tuple([self.check_value(opt, v) for v in value])\r
+\r
+    def process(self, opt, value, values, parser):\r
+\r
+        # First, convert the value(s) to the right type.  Howl if any\r
+        # value(s) are bogus.\r
+        value = self.convert_value(opt, value)\r
+\r
+        # And then take whatever action is expected of us.\r
+        # This is a separate method to make life easier for\r
+        # subclasses to add new actions.\r
+        return self.take_action(\r
+            self.action, self.dest, opt, value, values, parser)\r
+\r
+    def take_action(self, action, dest, opt, value, values, parser):\r
+        if action == "store":\r
+            setattr(values, dest, value)\r
+        elif action == "store_const":\r
+            setattr(values, dest, self.const)\r
+        elif action == "store_true":\r
+            setattr(values, dest, True)\r
+        elif action == "store_false":\r
+            setattr(values, dest, False)\r
+        elif action == "append":\r
+            values.ensure_value(dest, []).append(value)\r
+        elif action == "append_const":\r
+            values.ensure_value(dest, []).append(self.const)\r
+        elif action == "count":\r
+            setattr(values, dest, values.ensure_value(dest, 0) + 1)\r
+        elif action == "callback":\r
+            args = self.callback_args or ()\r
+            kwargs = self.callback_kwargs or {}\r
+            self.callback(self, opt, value, parser, *args, **kwargs)\r
+        elif action == "help":\r
+            parser.print_help()\r
+            parser.exit()\r
+        elif action == "version":\r
+            parser.print_version()\r
+            parser.exit()\r
+        else:\r
+            raise ValueError("unknown action %r" % self.action)\r
+\r
+        return 1\r
+\r
+# class Option\r
+\r
+\r
+SUPPRESS_HELP = "SUPPRESS"+"HELP"\r
+SUPPRESS_USAGE = "SUPPRESS"+"USAGE"\r
+\r
+try:\r
+    basestring\r
+except NameError:\r
+    def isbasestring(x):\r
+        return isinstance(x, (types.StringType, types.UnicodeType))\r
+else:\r
+    def isbasestring(x):\r
+        return isinstance(x, basestring)\r
+\r
+class Values:\r
+\r
+    def __init__(self, defaults=None):\r
+        if defaults:\r
+            for (attr, val) in defaults.items():\r
+                setattr(self, attr, val)\r
+\r
+    def __str__(self):\r
+        return str(self.__dict__)\r
+\r
+    __repr__ = _repr\r
+\r
+    def __cmp__(self, other):\r
+        if isinstance(other, Values):\r
+            return cmp(self.__dict__, other.__dict__)\r
+        elif isinstance(other, types.DictType):\r
+            return cmp(self.__dict__, other)\r
+        else:\r
+            return -1\r
+\r
+    def _update_careful(self, dict):\r
+        """\r
+        Update the option values from an arbitrary dictionary, but only\r
+        use keys from dict that already have a corresponding attribute\r
+        in self.  Any keys in dict without a corresponding attribute\r
+        are silently ignored.\r
+        """\r
+        for attr in dir(self):\r
+            if attr in dict:\r
+                dval = dict[attr]\r
+                if dval is not None:\r
+                    setattr(self, attr, dval)\r
+\r
+    def _update_loose(self, dict):\r
+        """\r
+        Update the option values from an arbitrary dictionary,\r
+        using all keys from the dictionary regardless of whether\r
+        they have a corresponding attribute in self or not.\r
+        """\r
+        self.__dict__.update(dict)\r
+\r
+    def _update(self, dict, mode):\r
+        if mode == "careful":\r
+            self._update_careful(dict)\r
+        elif mode == "loose":\r
+            self._update_loose(dict)\r
+        else:\r
+            raise ValueError, "invalid update mode: %r" % mode\r
+\r
+    def read_module(self, modname, mode="careful"):\r
+        __import__(modname)\r
+        mod = sys.modules[modname]\r
+        self._update(vars(mod), mode)\r
+\r
+    def read_file(self, filename, mode="careful"):\r
+        vars = {}\r
+        execfile(filename, vars)\r
+        self._update(vars, mode)\r
+\r
+    def ensure_value(self, attr, value):\r
+        if not hasattr(self, attr) or getattr(self, attr) is None:\r
+            setattr(self, attr, value)\r
+        return getattr(self, attr)\r
+\r
+\r
+class OptionContainer:\r
+\r
+    """\r
+    Abstract base class.\r
+\r
+    Class attributes:\r
+      standard_option_list : [Option]\r
+        list of standard options that will be accepted by all instances\r
+        of this parser class (intended to be overridden by subclasses).\r
+\r
+    Instance attributes:\r
+      option_list : [Option]\r
+        the list of Option objects contained by this OptionContainer\r
+      _short_opt : { string : Option }\r
+        dictionary mapping short option strings, eg. "-f" or "-X",\r
+        to the Option instances that implement them.  If an Option\r
+        has multiple short option strings, it will appears in this\r
+        dictionary multiple times. [1]\r
+      _long_opt : { string : Option }\r
+        dictionary mapping long option strings, eg. "--file" or\r
+        "--exclude", to the Option instances that implement them.\r
+        Again, a given Option can occur multiple times in this\r
+        dictionary. [1]\r
+      defaults : { string : any }\r
+        dictionary mapping option destination names to default\r
+        values for each destination [1]\r
+\r
+    [1] These mappings are common to (shared by) all components of the\r
+        controlling OptionParser, where they are initially created.\r
+\r
+    """\r
+\r
+    def __init__(self, option_class, conflict_handler, description):\r
+        # Initialize the option list and related data structures.\r
+        # This method must be provided by subclasses, and it must\r
+        # initialize at least the following instance attributes:\r
+        # option_list, _short_opt, _long_opt, defaults.\r
+        self._create_option_list()\r
+\r
+        self.option_class = option_class\r
+        self.set_conflict_handler(conflict_handler)\r
+        self.set_description(description)\r
+\r
+    def _create_option_mappings(self):\r
+        # For use by OptionParser constructor -- create the master\r
+        # option mappings used by this OptionParser and all\r
+        # OptionGroups that it owns.\r
+        self._short_opt = {}            # single letter -> Option instance\r
+        self._long_opt = {}             # long option -> Option instance\r
+        self.defaults = {}              # maps option dest -> default value\r
+\r
+\r
+    def _share_option_mappings(self, parser):\r
+        # For use by OptionGroup constructor -- use shared option\r
+        # mappings from the OptionParser that owns this OptionGroup.\r
+        self._short_opt = parser._short_opt\r
+        self._long_opt = parser._long_opt\r
+        self.defaults = parser.defaults\r
+\r
+    def set_conflict_handler(self, handler):\r
+        if handler not in ("error", "resolve"):\r
+            raise ValueError, "invalid conflict_resolution value %r" % handler\r
+        self.conflict_handler = handler\r
+\r
+    def set_description(self, description):\r
+        self.description = description\r
+\r
+    def get_description(self):\r
+        return self.description\r
+\r
+\r
+    def destroy(self):\r
+        """see OptionParser.destroy()."""\r
+        del self._short_opt\r
+        del self._long_opt\r
+        del self.defaults\r
+\r
+\r
+    # -- Option-adding methods -----------------------------------------\r
+\r
+    def _check_conflict(self, option):\r
+        conflict_opts = []\r
+        for opt in option._short_opts:\r
+            if opt in self._short_opt:\r
+                conflict_opts.append((opt, self._short_opt[opt]))\r
+        for opt in option._long_opts:\r
+            if opt in self._long_opt:\r
+                conflict_opts.append((opt, self._long_opt[opt]))\r
+\r
+        if conflict_opts:\r
+            handler = self.conflict_handler\r
+            if handler == "error":\r
+                raise OptionConflictError(\r
+                    "conflicting option string(s): %s"\r
+                    % ", ".join([co[0] for co in conflict_opts]),\r
+                    option)\r
+            elif handler == "resolve":\r
+                for (opt, c_option) in conflict_opts:\r
+                    if opt.startswith("--"):\r
+                        c_option._long_opts.remove(opt)\r
+                        del self._long_opt[opt]\r
+                    else:\r
+                        c_option._short_opts.remove(opt)\r
+                        del self._short_opt[opt]\r
+                    if not (c_option._short_opts or c_option._long_opts):\r
+                        c_option.container.option_list.remove(c_option)\r
+\r
+    def add_option(self, *args, **kwargs):\r
+        """add_option(Option)\r
+           add_option(opt_str, ..., kwarg=val, ...)\r
+        """\r
+        if type(args[0]) in types.StringTypes:\r
+            option = self.option_class(*args, **kwargs)\r
+        elif len(args) == 1 and not kwargs:\r
+            option = args[0]\r
+            if not isinstance(option, Option):\r
+                raise TypeError, "not an Option instance: %r" % option\r
+        else:\r
+            raise TypeError, "invalid arguments"\r
+\r
+        self._check_conflict(option)\r
+\r
+        self.option_list.append(option)\r
+        option.container = self\r
+        for opt in option._short_opts:\r
+            self._short_opt[opt] = option\r
+        for opt in option._long_opts:\r
+            self._long_opt[opt] = option\r
+\r
+        if option.dest is not None:     # option has a dest, we need a default\r
+            if option.default is not NO_DEFAULT:\r
+                self.defaults[option.dest] = option.default\r
+            elif option.dest not in self.defaults:\r
+                self.defaults[option.dest] = None\r
+\r
+        return option\r
+\r
+    def add_options(self, option_list):\r
+        for option in option_list:\r
+            self.add_option(option)\r
+\r
+    # -- Option query/removal methods ----------------------------------\r
+\r
+    def get_option(self, opt_str):\r
+        return (self._short_opt.get(opt_str) or\r
+                self._long_opt.get(opt_str))\r
+\r
+    def has_option(self, opt_str):\r
+        return (opt_str in self._short_opt or\r
+                opt_str in self._long_opt)\r
+\r
+    def remove_option(self, opt_str):\r
+        option = self._short_opt.get(opt_str)\r
+        if option is None:\r
+            option = self._long_opt.get(opt_str)\r
+        if option is None:\r
+            raise ValueError("no such option %r" % opt_str)\r
+\r
+        for opt in option._short_opts:\r
+            del self._short_opt[opt]\r
+        for opt in option._long_opts:\r
+            del self._long_opt[opt]\r
+        option.container.option_list.remove(option)\r
+\r
+\r
+    # -- Help-formatting methods ---------------------------------------\r
+\r
+    def format_option_help(self, formatter):\r
+        if not self.option_list:\r
+            return ""\r
+        result = []\r
+        for option in self.option_list:\r
+            if not option.help is SUPPRESS_HELP:\r
+                result.append(formatter.format_option(option))\r
+        return "".join(result)\r
+\r
+    def format_description(self, formatter):\r
+        return formatter.format_description(self.get_description())\r
+\r
+    def format_help(self, formatter):\r
+        result = []\r
+        if self.description:\r
+            result.append(self.format_description(formatter))\r
+        if self.option_list:\r
+            result.append(self.format_option_help(formatter))\r
+        return "\n".join(result)\r
+\r
+\r
+class OptionGroup (OptionContainer):\r
+\r
+    def __init__(self, parser, title, description=None):\r
+        self.parser = parser\r
+        OptionContainer.__init__(\r
+            self, parser.option_class, parser.conflict_handler, description)\r
+        self.title = title\r
+\r
+    def _create_option_list(self):\r
+        self.option_list = []\r
+        self._share_option_mappings(self.parser)\r
+\r
+    def set_title(self, title):\r
+        self.title = title\r
+\r
+    def destroy(self):\r
+        """see OptionParser.destroy()."""\r
+        OptionContainer.destroy(self)\r
+        del self.option_list\r
+\r
+    # -- Help-formatting methods ---------------------------------------\r
+\r
+    def format_help(self, formatter):\r
+        result = formatter.format_heading(self.title)\r
+        formatter.indent()\r
+        result += OptionContainer.format_help(self, formatter)\r
+        formatter.dedent()\r
+        return result\r
+\r
+\r
+class OptionParser (OptionContainer):\r
+\r
+    """\r
+    Class attributes:\r
+      standard_option_list : [Option]\r
+        list of standard options that will be accepted by all instances\r
+        of this parser class (intended to be overridden by subclasses).\r
+\r
+    Instance attributes:\r
+      usage : string\r
+        a usage string for your program.  Before it is displayed\r
+        to the user, "%prog" will be expanded to the name of\r
+        your program (self.prog or os.path.basename(sys.argv[0])).\r
+      prog : string\r
+        the name of the current program (to override\r
+        os.path.basename(sys.argv[0])).\r
+      description : string\r
+        A paragraph of text giving a brief overview of your program.\r
+        optparse reformats this paragraph to fit the current terminal\r
+        width and prints it when the user requests help (after usage,\r
+        but before the list of options).\r
+      epilog : string\r
+        paragraph of help text to print after option help\r
+\r
+      option_groups : [OptionGroup]\r
+        list of option groups in this parser (option groups are\r
+        irrelevant for parsing the command-line, but very useful\r
+        for generating help)\r
+\r
+      allow_interspersed_args : bool = true\r
+        if true, positional arguments may be interspersed with options.\r
+        Assuming -a and -b each take a single argument, the command-line\r
+          -ablah foo bar -bboo baz\r
+        will be interpreted the same as\r
+          -ablah -bboo -- foo bar baz\r
+        If this flag were false, that command line would be interpreted as\r
+          -ablah -- foo bar -bboo baz\r
+        -- ie. we stop processing options as soon as we see the first\r
+        non-option argument.  (This is the tradition followed by\r
+        Python's getopt module, Perl's Getopt::Std, and other argument-\r
+        parsing libraries, but it is generally annoying to users.)\r
+\r
+      process_default_values : bool = true\r
+        if true, option default values are processed similarly to option\r
+        values from the command line: that is, they are passed to the\r
+        type-checking function for the option's type (as long as the\r
+        default value is a string).  (This really only matters if you\r
+        have defined custom types; see SF bug #955889.)  Set it to false\r
+        to restore the behaviour of Optik 1.4.1 and earlier.\r
+\r
+      rargs : [string]\r
+        the argument list currently being parsed.  Only set when\r
+        parse_args() is active, and continually trimmed down as\r
+        we consume arguments.  Mainly there for the benefit of\r
+        callback options.\r
+      largs : [string]\r
+        the list of leftover arguments that we have skipped while\r
+        parsing options.  If allow_interspersed_args is false, this\r
+        list is always empty.\r
+      values : Values\r
+        the set of option values currently being accumulated.  Only\r
+        set when parse_args() is active.  Also mainly for callbacks.\r
+\r
+    Because of the 'rargs', 'largs', and 'values' attributes,\r
+    OptionParser is not thread-safe.  If, for some perverse reason, you\r
+    need to parse command-line arguments simultaneously in different\r
+    threads, use different OptionParser instances.\r
+\r
+    """\r
+\r
+    standard_option_list = []\r
+\r
+    def __init__(self,\r
+                 usage=None,\r
+                 option_list=None,\r
+                 option_class=Option,\r
+                 version=None,\r
+                 conflict_handler="error",\r
+                 description=None,\r
+                 formatter=None,\r
+                 add_help_option=True,\r
+                 prog=None,\r
+                 epilog=None):\r
+        OptionContainer.__init__(\r
+            self, option_class, conflict_handler, description)\r
+        self.set_usage(usage)\r
+        self.prog = prog\r
+        self.version = version\r
+        self.allow_interspersed_args = True\r
+        self.process_default_values = True\r
+        if formatter is None:\r
+            formatter = IndentedHelpFormatter()\r
+        self.formatter = formatter\r
+        self.formatter.set_parser(self)\r
+        self.epilog = epilog\r
+\r
+        # Populate the option list; initial sources are the\r
+        # standard_option_list class attribute, the 'option_list'\r
+        # argument, and (if applicable) the _add_version_option() and\r
+        # _add_help_option() methods.\r
+        self._populate_option_list(option_list,\r
+                                   add_help=add_help_option)\r
+\r
+        self._init_parsing_state()\r
+\r
+\r
+    def destroy(self):\r
+        """\r
+        Declare that you are done with this OptionParser.  This cleans up\r
+        reference cycles so the OptionParser (and all objects referenced by\r
+        it) can be garbage-collected promptly.  After calling destroy(), the\r
+        OptionParser is unusable.\r
+        """\r
+        OptionContainer.destroy(self)\r
+        for group in self.option_groups:\r
+            group.destroy()\r
+        del self.option_list\r
+        del self.option_groups\r
+        del self.formatter\r
+\r
+\r
+    # -- Private methods -----------------------------------------------\r
+    # (used by our or OptionContainer's constructor)\r
+\r
+    def _create_option_list(self):\r
+        self.option_list = []\r
+        self.option_groups = []\r
+        self._create_option_mappings()\r
+\r
+    def _add_help_option(self):\r
+        self.add_option("-h", "--help",\r
+                        action="help",\r
+                        help=_("show this help message and exit"))\r
+\r
+    def _add_version_option(self):\r
+        self.add_option("--version",\r
+                        action="version",\r
+                        help=_("show program's version number and exit"))\r
+\r
+    def _populate_option_list(self, option_list, add_help=True):\r
+        if self.standard_option_list:\r
+            self.add_options(self.standard_option_list)\r
+        if option_list:\r
+            self.add_options(option_list)\r
+        if self.version:\r
+            self._add_version_option()\r
+        if add_help:\r
+            self._add_help_option()\r
+\r
+    def _init_parsing_state(self):\r
+        # These are set in parse_args() for the convenience of callbacks.\r
+        self.rargs = None\r
+        self.largs = None\r
+        self.values = None\r
+\r
+\r
+    # -- Simple modifier methods ---------------------------------------\r
+\r
+    def set_usage(self, usage):\r
+        if usage is None:\r
+            self.usage = _("%prog [options]")\r
+        elif usage is SUPPRESS_USAGE:\r
+            self.usage = None\r
+        # For backwards compatibility with Optik 1.3 and earlier.\r
+        elif usage.lower().startswith("usage: "):\r
+            self.usage = usage[7:]\r
+        else:\r
+            self.usage = usage\r
+\r
+    def enable_interspersed_args(self):\r
+        """Set parsing to not stop on the first non-option, allowing\r
+        interspersing switches with command arguments. This is the\r
+        default behavior. See also disable_interspersed_args() and the\r
+        class documentation description of the attribute\r
+        allow_interspersed_args."""\r
+        self.allow_interspersed_args = True\r
+\r
+    def disable_interspersed_args(self):\r
+        """Set parsing to stop on the first non-option. Use this if\r
+        you have a command processor which runs another command that\r
+        has options of its own and you want to make sure these options\r
+        don't get confused.\r
+        """\r
+        self.allow_interspersed_args = False\r
+\r
+    def set_process_default_values(self, process):\r
+        self.process_default_values = process\r
+\r
+    def set_default(self, dest, value):\r
+        self.defaults[dest] = value\r
+\r
+    def set_defaults(self, **kwargs):\r
+        self.defaults.update(kwargs)\r
+\r
+    def _get_all_options(self):\r
+        options = self.option_list[:]\r
+        for group in self.option_groups:\r
+            options.extend(group.option_list)\r
+        return options\r
+\r
+    def get_default_values(self):\r
+        if not self.process_default_values:\r
+            # Old, pre-Optik 1.5 behaviour.\r
+            return Values(self.defaults)\r
+\r
+        defaults = self.defaults.copy()\r
+        for option in self._get_all_options():\r
+            default = defaults.get(option.dest)\r
+            if isbasestring(default):\r
+                opt_str = option.get_opt_string()\r
+                defaults[option.dest] = option.check_value(opt_str, default)\r
+\r
+        return Values(defaults)\r
+\r
+\r
+    # -- OptionGroup methods -------------------------------------------\r
+\r
+    def add_option_group(self, *args, **kwargs):\r
+        # XXX lots of overlap with OptionContainer.add_option()\r
+        if type(args[0]) is types.StringType:\r
+            group = OptionGroup(self, *args, **kwargs)\r
+        elif len(args) == 1 and not kwargs:\r
+            group = args[0]\r
+            if not isinstance(group, OptionGroup):\r
+                raise TypeError, "not an OptionGroup instance: %r" % group\r
+            if group.parser is not self:\r
+                raise ValueError, "invalid OptionGroup (wrong parser)"\r
+        else:\r
+            raise TypeError, "invalid arguments"\r
+\r
+        self.option_groups.append(group)\r
+        return group\r
+\r
+    def get_option_group(self, opt_str):\r
+        option = (self._short_opt.get(opt_str) or\r
+                  self._long_opt.get(opt_str))\r
+        if option and option.container is not self:\r
+            return option.container\r
+        return None\r
+\r
+\r
+    # -- Option-parsing methods ----------------------------------------\r
+\r
+    def _get_args(self, args):\r
+        if args is None:\r
+            return sys.argv[1:]\r
+        else:\r
+            return args[:]              # don't modify caller's list\r
+\r
+    def parse_args(self, args=None, values=None):\r
+        """\r
+        parse_args(args : [string] = sys.argv[1:],\r
+                   values : Values = None)\r
+        -> (values : Values, args : [string])\r
+\r
+        Parse the command-line options found in 'args' (default:\r
+        sys.argv[1:]).  Any errors result in a call to 'error()', which\r
+        by default prints the usage message to stderr and calls\r
+        sys.exit() with an error message.  On success returns a pair\r
+        (values, args) where 'values' is an Values instance (with all\r
+        your option values) and 'args' is the list of arguments left\r
+        over after parsing options.\r
+        """\r
+        rargs = self._get_args(args)\r
+        if values is None:\r
+            values = self.get_default_values()\r
+\r
+        # Store the halves of the argument list as attributes for the\r
+        # convenience of callbacks:\r
+        #   rargs\r
+        #     the rest of the command-line (the "r" stands for\r
+        #     "remaining" or "right-hand")\r
+        #   largs\r
+        #     the leftover arguments -- ie. what's left after removing\r
+        #     options and their arguments (the "l" stands for "leftover"\r
+        #     or "left-hand")\r
+        self.rargs = rargs\r
+        self.largs = largs = []\r
+        self.values = values\r
+\r
+        try:\r
+            stop = self._process_args(largs, rargs, values)\r
+        except (BadOptionError, OptionValueError), err:\r
+            self.error(str(err))\r
+\r
+        args = largs + rargs\r
+        return self.check_values(values, args)\r
+\r
+    def check_values(self, values, args):\r
+        """\r
+        check_values(values : Values, args : [string])\r
+        -> (values : Values, args : [string])\r
+\r
+        Check that the supplied option values and leftover arguments are\r
+        valid.  Returns the option values and leftover arguments\r
+        (possibly adjusted, possibly completely new -- whatever you\r
+        like).  Default implementation just returns the passed-in\r
+        values; subclasses may override as desired.\r
+        """\r
+        return (values, args)\r
+\r
+    def _process_args(self, largs, rargs, values):\r
+        """_process_args(largs : [string],\r
+                         rargs : [string],\r
+                         values : Values)\r
+\r
+        Process command-line arguments and populate 'values', consuming\r
+        options and arguments from 'rargs'.  If 'allow_interspersed_args' is\r
+        false, stop at the first non-option argument.  If true, accumulate any\r
+        interspersed non-option arguments in 'largs'.\r
+        """\r
+        while rargs:\r
+            arg = rargs[0]\r
+            # We handle bare "--" explicitly, and bare "-" is handled by the\r
+            # standard arg handler since the short arg case ensures that the\r
+            # len of the opt string is greater than 1.\r
+            if arg == "--":\r
+                del rargs[0]\r
+                return\r
+            elif arg[0:2] == "--":\r
+                # process a single long option (possibly with value(s))\r
+                self._process_long_opt(rargs, values)\r
+            elif arg[:1] == "-" and len(arg) > 1:\r
+                # process a cluster of short options (possibly with\r
+                # value(s) for the last one only)\r
+                self._process_short_opts(rargs, values)\r
+            elif self.allow_interspersed_args:\r
+                largs.append(arg)\r
+                del rargs[0]\r
+            else:\r
+                return                  # stop now, leave this arg in rargs\r
+\r
+        # Say this is the original argument list:\r
+        # [arg0, arg1, ..., arg(i-1), arg(i), arg(i+1), ..., arg(N-1)]\r
+        #                            ^\r
+        # (we are about to process arg(i)).\r
+        #\r
+        # Then rargs is [arg(i), ..., arg(N-1)] and largs is a *subset* of\r
+        # [arg0, ..., arg(i-1)] (any options and their arguments will have\r
+        # been removed from largs).\r
+        #\r
+        # The while loop will usually consume 1 or more arguments per pass.\r
+        # If it consumes 1 (eg. arg is an option that takes no arguments),\r
+        # then after _process_arg() is done the situation is:\r
+        #\r
+        #   largs = subset of [arg0, ..., arg(i)]\r
+        #   rargs = [arg(i+1), ..., arg(N-1)]\r
+        #\r
+        # If allow_interspersed_args is false, largs will always be\r
+        # *empty* -- still a subset of [arg0, ..., arg(i-1)], but\r
+        # not a very interesting subset!\r
+\r
+    def _match_long_opt(self, opt):\r
+        """_match_long_opt(opt : string) -> string\r
+\r
+        Determine which long option string 'opt' matches, ie. which one\r
+        it is an unambiguous abbreviation for.  Raises BadOptionError if\r
+        'opt' doesn't unambiguously match any long option string.\r
+        """\r
+        return _match_abbrev(opt, self._long_opt)\r
+\r
+    def _process_long_opt(self, rargs, values):\r
+        arg = rargs.pop(0)\r
+\r
+        # Value explicitly attached to arg?  Pretend it's the next\r
+        # argument.\r
+        if "=" in arg:\r
+            (opt, next_arg) = arg.split("=", 1)\r
+            rargs.insert(0, next_arg)\r
+            had_explicit_value = True\r
+        else:\r
+            opt = arg\r
+            had_explicit_value = False\r
+\r
+        opt = self._match_long_opt(opt)\r
+        option = self._long_opt[opt]\r
+        if option.takes_value():\r
+            nargs = option.nargs\r
+            if len(rargs) < nargs:\r
+                if nargs == 1:\r
+                    self.error(_("%s option requires an argument") % opt)\r
+                else:\r
+                    self.error(_("%s option requires %d arguments")\r
+                               % (opt, nargs))\r
+            elif nargs == 1:\r
+                value = rargs.pop(0)\r
+            else:\r
+                value = tuple(rargs[0:nargs])\r
+                del rargs[0:nargs]\r
+\r
+        elif had_explicit_value:\r
+            self.error(_("%s option does not take a value") % opt)\r
+\r
+        else:\r
+            value = None\r
+\r
+        option.process(opt, value, values, self)\r
+\r
+    def _process_short_opts(self, rargs, values):\r
+        arg = rargs.pop(0)\r
+        stop = False\r
+        i = 1\r
+        for ch in arg[1:]:\r
+            opt = "-" + ch\r
+            option = self._short_opt.get(opt)\r
+            i += 1                      # we have consumed a character\r
+\r
+            if not option:\r
+                raise BadOptionError(opt)\r
+            if option.takes_value():\r
+                # Any characters left in arg?  Pretend they're the\r
+                # next arg, and stop consuming characters of arg.\r
+                if i < len(arg):\r
+                    rargs.insert(0, arg[i:])\r
+                    stop = True\r
+\r
+                nargs = option.nargs\r
+                if len(rargs) < nargs:\r
+                    if nargs == 1:\r
+                        self.error(_("%s option requires an argument") % opt)\r
+                    else:\r
+                        self.error(_("%s option requires %d arguments")\r
+                                   % (opt, nargs))\r
+                elif nargs == 1:\r
+                    value = rargs.pop(0)\r
+                else:\r
+                    value = tuple(rargs[0:nargs])\r
+                    del rargs[0:nargs]\r
+\r
+            else:                       # option doesn't take a value\r
+                value = None\r
+\r
+            option.process(opt, value, values, self)\r
+\r
+            if stop:\r
+                break\r
+\r
+\r
+    # -- Feedback methods ----------------------------------------------\r
+\r
+    def get_prog_name(self):\r
+        if self.prog is None:\r
+            return os.path.basename(sys.argv[0])\r
+        else:\r
+            return self.prog\r
+\r
+    def expand_prog_name(self, s):\r
+        return s.replace("%prog", self.get_prog_name())\r
+\r
+    def get_description(self):\r
+        return self.expand_prog_name(self.description)\r
+\r
+    def exit(self, status=0, msg=None):\r
+        if msg:\r
+            sys.stderr.write(msg)\r
+        sys.exit(status)\r
+\r
+    def error(self, msg):\r
+        """error(msg : string)\r
+\r
+        Print a usage message incorporating 'msg' to stderr and exit.\r
+        If you override this in a subclass, it should not return -- it\r
+        should either exit or raise an exception.\r
+        """\r
+        self.print_usage(sys.stderr)\r
+        self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg))\r
+\r
+    def get_usage(self):\r
+        if self.usage:\r
+            return self.formatter.format_usage(\r
+                self.expand_prog_name(self.usage))\r
+        else:\r
+            return ""\r
+\r
+    def print_usage(self, file=None):\r
+        """print_usage(file : file = stdout)\r
+\r
+        Print the usage message for the current program (self.usage) to\r
+        'file' (default stdout).  Any occurrence of the string "%prog" in\r
+        self.usage is replaced with the name of the current program\r
+        (basename of sys.argv[0]).  Does nothing if self.usage is empty\r
+        or not defined.\r
+        """\r
+        if self.usage:\r
+            print >>file, self.get_usage()\r
+\r
+    def get_version(self):\r
+        if self.version:\r
+            return self.expand_prog_name(self.version)\r
+        else:\r
+            return ""\r
+\r
+    def print_version(self, file=None):\r
+        """print_version(file : file = stdout)\r
+\r
+        Print the version message for this program (self.version) to\r
+        'file' (default stdout).  As with print_usage(), any occurrence\r
+        of "%prog" in self.version is replaced by the current program's\r
+        name.  Does nothing if self.version is empty or undefined.\r
+        """\r
+        if self.version:\r
+            print >>file, self.get_version()\r
+\r
+    def format_option_help(self, formatter=None):\r
+        if formatter is None:\r
+            formatter = self.formatter\r
+        formatter.store_option_strings(self)\r
+        result = []\r
+        result.append(formatter.format_heading(_("Options")))\r
+        formatter.indent()\r
+        if self.option_list:\r
+            result.append(OptionContainer.format_option_help(self, formatter))\r
+            result.append("\n")\r
+        for group in self.option_groups:\r
+            result.append(group.format_help(formatter))\r
+            result.append("\n")\r
+        formatter.dedent()\r
+        # Drop the last "\n", or the header if no options or option groups:\r
+        return "".join(result[:-1])\r
+\r
+    def format_epilog(self, formatter):\r
+        return formatter.format_epilog(self.epilog)\r
+\r
+    def format_help(self, formatter=None):\r
+        if formatter is None:\r
+            formatter = self.formatter\r
+        result = []\r
+        if self.usage:\r
+            result.append(self.get_usage() + "\n")\r
+        if self.description:\r
+            result.append(self.format_description(formatter) + "\n")\r
+        result.append(self.format_option_help(formatter))\r
+        result.append(self.format_epilog(formatter))\r
+        return "".join(result)\r
+\r
+    # used by test suite\r
+    def _get_encoding(self, file):\r
+        encoding = getattr(file, "encoding", None)\r
+        if not encoding:\r
+            encoding = sys.getdefaultencoding()\r
+        return encoding\r
+\r
+    def print_help(self, file=None):\r
+        """print_help(file : file = stdout)\r
+\r
+        Print an extended help message, listing all options and any\r
+        help text provided with them, to 'file' (default stdout).\r
+        """\r
+        if file is None:\r
+            file = sys.stdout\r
+        encoding = self._get_encoding(file)\r
+        file.write(self.format_help().encode(encoding, "replace"))\r
+\r
+# class OptionParser\r
+\r
+\r
+def _match_abbrev(s, wordmap):\r
+    """_match_abbrev(s : string, wordmap : {string : Option}) -> string\r
+\r
+    Return the string key in 'wordmap' for which 's' is an unambiguous\r
+    abbreviation.  If 's' is found to be ambiguous or doesn't match any of\r
+    'words', raise BadOptionError.\r
+    """\r
+    # Is there an exact match?\r
+    if s in wordmap:\r
+        return s\r
+    else:\r
+        # Isolate all words with s as a prefix.\r
+        possibilities = [word for word in wordmap.keys()\r
+                         if word.startswith(s)]\r
+        # No exact match, so there had better be just one possibility.\r
+        if len(possibilities) == 1:\r
+            return possibilities[0]\r
+        elif not possibilities:\r
+            raise BadOptionError(s)\r
+        else:\r
+            # More than one possible completion: ambiguous prefix.\r
+            possibilities.sort()\r
+            raise AmbiguousOptionError(s, possibilities)\r
+\r
+\r
+# Some day, there might be many Option classes.  As of Optik 1.3, the\r
+# preferred way to instantiate Options is indirectly, via make_option(),\r
+# which will become a factory function when there are many Option\r
+# classes.\r
+make_option = Option\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/pkgutil.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/pkgutil.py
new file mode 100644 (file)
index 0000000..3a58242
--- /dev/null
@@ -0,0 +1,591 @@
+"""Utilities to support packages."""\r
+\r
+# NOTE: This module must remain compatible with Python 2.3, as it is shared\r
+# by setuptools for distribution with Python 2.3 and up.\r
+\r
+import os\r
+import sys\r
+import imp\r
+import os.path\r
+from types import ModuleType\r
+\r
+__all__ = [\r
+    'get_importer', 'iter_importers', 'get_loader', 'find_loader',\r
+    'walk_packages', 'iter_modules', 'get_data',\r
+    'ImpImporter', 'ImpLoader', 'read_code', 'extend_path',\r
+]\r
+\r
+def read_code(stream):\r
+    # This helper is needed in order for the PEP 302 emulation to\r
+    # correctly handle compiled files\r
+    import marshal\r
+\r
+    magic = stream.read(4)\r
+    if magic != imp.get_magic():\r
+        return None\r
+\r
+    stream.read(4) # Skip timestamp\r
+    return marshal.load(stream)\r
+\r
+\r
+def simplegeneric(func):\r
+    """Make a trivial single-dispatch generic function"""\r
+    registry = {}\r
+    def wrapper(*args, **kw):\r
+        ob = args[0]\r
+        try:\r
+            cls = ob.__class__\r
+        except AttributeError:\r
+            cls = type(ob)\r
+        try:\r
+            mro = cls.__mro__\r
+        except AttributeError:\r
+            try:\r
+                class cls(cls, object):\r
+                    pass\r
+                mro = cls.__mro__[1:]\r
+            except TypeError:\r
+                mro = object,   # must be an ExtensionClass or some such  :(\r
+        for t in mro:\r
+            if t in registry:\r
+                return registry[t](*args, **kw)\r
+        else:\r
+            return func(*args, **kw)\r
+    try:\r
+        wrapper.__name__ = func.__name__\r
+    except (TypeError, AttributeError):\r
+        pass    # Python 2.3 doesn't allow functions to be renamed\r
+\r
+    def register(typ, func=None):\r
+        if func is None:\r
+            return lambda f: register(typ, f)\r
+        registry[typ] = func\r
+        return func\r
+\r
+    wrapper.__dict__ = func.__dict__\r
+    wrapper.__doc__ = func.__doc__\r
+    wrapper.register = register\r
+    return wrapper\r
+\r
+\r
+def walk_packages(path=None, prefix='', onerror=None):\r
+    """Yields (module_loader, name, ispkg) for all modules recursively\r
+    on path, or, if path is None, all accessible modules.\r
+\r
+    'path' should be either None or a list of paths to look for\r
+    modules in.\r
+\r
+    'prefix' is a string to output on the front of every module name\r
+    on output.\r
+\r
+    Note that this function must import all *packages* (NOT all\r
+    modules!) on the given path, in order to access the __path__\r
+    attribute to find submodules.\r
+\r
+    'onerror' is a function which gets called with one argument (the\r
+    name of the package which was being imported) if any exception\r
+    occurs while trying to import a package.  If no onerror function is\r
+    supplied, ImportErrors are caught and ignored, while all other\r
+    exceptions are propagated, terminating the search.\r
+\r
+    Examples:\r
+\r
+    # list all modules python can access\r
+    walk_packages()\r
+\r
+    # list all submodules of ctypes\r
+    walk_packages(ctypes.__path__, ctypes.__name__+'.')\r
+    """\r
+\r
+    def seen(p, m={}):\r
+        if p in m:\r
+            return True\r
+        m[p] = True\r
+\r
+    for importer, name, ispkg in iter_modules(path, prefix):\r
+        yield importer, name, ispkg\r
+\r
+        if ispkg:\r
+            try:\r
+                __import__(name)\r
+            except ImportError:\r
+                if onerror is not None:\r
+                    onerror(name)\r
+            except Exception:\r
+                if onerror is not None:\r
+                    onerror(name)\r
+                else:\r
+                    raise\r
+            else:\r
+                path = getattr(sys.modules[name], '__path__', None) or []\r
+\r
+                # don't traverse path items we've seen before\r
+                path = [p for p in path if not seen(p)]\r
+\r
+                for item in walk_packages(path, name+'.', onerror):\r
+                    yield item\r
+\r
+\r
+def iter_modules(path=None, prefix=''):\r
+    """Yields (module_loader, name, ispkg) for all submodules on path,\r
+    or, if path is None, all top-level modules on sys.path.\r
+\r
+    'path' should be either None or a list of paths to look for\r
+    modules in.\r
+\r
+    'prefix' is a string to output on the front of every module name\r
+    on output.\r
+    """\r
+\r
+    if path is None:\r
+        importers = iter_importers()\r
+    else:\r
+        importers = map(get_importer, path)\r
+\r
+    yielded = {}\r
+    for i in importers:\r
+        for name, ispkg in iter_importer_modules(i, prefix):\r
+            if name not in yielded:\r
+                yielded[name] = 1\r
+                yield i, name, ispkg\r
+\r
+\r
+#@simplegeneric\r
+def iter_importer_modules(importer, prefix=''):\r
+    if not hasattr(importer, 'iter_modules'):\r
+        return []\r
+    return importer.iter_modules(prefix)\r
+\r
+iter_importer_modules = simplegeneric(iter_importer_modules)\r
+\r
+\r
+class ImpImporter:\r
+    """PEP 302 Importer that wraps Python's "classic" import algorithm\r
+\r
+    ImpImporter(dirname) produces a PEP 302 importer that searches that\r
+    directory.  ImpImporter(None) produces a PEP 302 importer that searches\r
+    the current sys.path, plus any modules that are frozen or built-in.\r
+\r
+    Note that ImpImporter does not currently support being used by placement\r
+    on sys.meta_path.\r
+    """\r
+\r
+    def __init__(self, path=None):\r
+        self.path = path\r
+\r
+    def find_module(self, fullname, path=None):\r
+        # Note: we ignore 'path' argument since it is only used via meta_path\r
+        subname = fullname.split(".")[-1]\r
+        if subname != fullname and self.path is None:\r
+            return None\r
+        if self.path is None:\r
+            path = None\r
+        else:\r
+            path = [os.path.realpath(self.path)]\r
+        try:\r
+            file, filename, etc = imp.find_module(subname, path)\r
+        except ImportError:\r
+            return None\r
+        return ImpLoader(fullname, file, filename, etc)\r
+\r
+    def iter_modules(self, prefix=''):\r
+        if self.path is None or not os.path.isdir(self.path):\r
+            return\r
+\r
+        yielded = {}\r
+        import inspect\r
+        try:\r
+            filenames = os.listdir(self.path)\r
+        except OSError:\r
+            # ignore unreadable directories like import does\r
+            filenames = []\r
+        filenames.sort()  # handle packages before same-named modules\r
+\r
+        for fn in filenames:\r
+            modname = inspect.getmodulename(fn)\r
+            if modname=='__init__' or modname in yielded:\r
+                continue\r
+\r
+            path = os.path.join(self.path, fn)\r
+            ispkg = False\r
+\r
+            if not modname and os.path.isdir(path) and '.' not in fn:\r
+                modname = fn\r
+                try:\r
+                    dircontents = os.listdir(path)\r
+                except OSError:\r
+                    # ignore unreadable directories like import does\r
+                    dircontents = []\r
+                for fn in dircontents:\r
+                    subname = inspect.getmodulename(fn)\r
+                    if subname=='__init__':\r
+                        ispkg = True\r
+                        break\r
+                else:\r
+                    continue    # not a package\r
+\r
+            if modname and '.' not in modname:\r
+                yielded[modname] = 1\r
+                yield prefix + modname, ispkg\r
+\r
+\r
+class ImpLoader:\r
+    """PEP 302 Loader that wraps Python's "classic" import algorithm\r
+    """\r
+    code = source = None\r
+\r
+    def __init__(self, fullname, file, filename, etc):\r
+        self.file = file\r
+        self.filename = filename\r
+        self.fullname = fullname\r
+        self.etc = etc\r
+\r
+    def load_module(self, fullname):\r
+        self._reopen()\r
+        try:\r
+            mod = imp.load_module(fullname, self.file, self.filename, self.etc)\r
+        finally:\r
+            if self.file:\r
+                self.file.close()\r
+        # Note: we don't set __loader__ because we want the module to look\r
+        # normal; i.e. this is just a wrapper for standard import machinery\r
+        return mod\r
+\r
+    def get_data(self, pathname):\r
+        return open(pathname, "rb").read()\r
+\r
+    def _reopen(self):\r
+        if self.file and self.file.closed:\r
+            mod_type = self.etc[2]\r
+            if mod_type==imp.PY_SOURCE:\r
+                self.file = open(self.filename, 'rU')\r
+            elif mod_type in (imp.PY_COMPILED, imp.C_EXTENSION):\r
+                self.file = open(self.filename, 'rb')\r
+\r
+    def _fix_name(self, fullname):\r
+        if fullname is None:\r
+            fullname = self.fullname\r
+        elif fullname != self.fullname:\r
+            raise ImportError("Loader for module %s cannot handle "\r
+                              "module %s" % (self.fullname, fullname))\r
+        return fullname\r
+\r
+    def is_package(self, fullname):\r
+        fullname = self._fix_name(fullname)\r
+        return self.etc[2]==imp.PKG_DIRECTORY\r
+\r
+    def get_code(self, fullname=None):\r
+        fullname = self._fix_name(fullname)\r
+        if self.code is None:\r
+            mod_type = self.etc[2]\r
+            if mod_type==imp.PY_SOURCE:\r
+                source = self.get_source(fullname)\r
+                self.code = compile(source, self.filename, 'exec')\r
+            elif mod_type==imp.PY_COMPILED:\r
+                self._reopen()\r
+                try:\r
+                    self.code = read_code(self.file)\r
+                finally:\r
+                    self.file.close()\r
+            elif mod_type==imp.PKG_DIRECTORY:\r
+                self.code = self._get_delegate().get_code()\r
+        return self.code\r
+\r
+    def get_source(self, fullname=None):\r
+        fullname = self._fix_name(fullname)\r
+        if self.source is None:\r
+            mod_type = self.etc[2]\r
+            if mod_type==imp.PY_SOURCE:\r
+                self._reopen()\r
+                try:\r
+                    self.source = self.file.read()\r
+                finally:\r
+                    self.file.close()\r
+            elif mod_type==imp.PY_COMPILED:\r
+                if os.path.exists(self.filename[:-1]):\r
+                    f = open(self.filename[:-1], 'rU')\r
+                    self.source = f.read()\r
+                    f.close()\r
+            elif mod_type==imp.PKG_DIRECTORY:\r
+                self.source = self._get_delegate().get_source()\r
+        return self.source\r
+\r
+\r
+    def _get_delegate(self):\r
+        return ImpImporter(self.filename).find_module('__init__')\r
+\r
+    def get_filename(self, fullname=None):\r
+        fullname = self._fix_name(fullname)\r
+        mod_type = self.etc[2]\r
+        if self.etc[2]==imp.PKG_DIRECTORY:\r
+            return self._get_delegate().get_filename()\r
+        elif self.etc[2] in (imp.PY_SOURCE, imp.PY_COMPILED, imp.C_EXTENSION):\r
+            return self.filename\r
+        return None\r
+\r
+\r
+try:\r
+    import zipimport\r
+    from zipimport import zipimporter\r
+\r
+    def iter_zipimport_modules(importer, prefix=''):\r
+        dirlist = zipimport._zip_directory_cache[importer.archive].keys()\r
+        dirlist.sort()\r
+        _prefix = importer.prefix\r
+        plen = len(_prefix)\r
+        yielded = {}\r
+        import inspect\r
+        for fn in dirlist:\r
+            if not fn.startswith(_prefix):\r
+                continue\r
+\r
+            fn = fn[plen:].split(os.sep)\r
+\r
+            if len(fn)==2 and fn[1].startswith('__init__.py'):\r
+                if fn[0] not in yielded:\r
+                    yielded[fn[0]] = 1\r
+                    yield fn[0], True\r
+\r
+            if len(fn)!=1:\r
+                continue\r
+\r
+            modname = inspect.getmodulename(fn[0])\r
+            if modname=='__init__':\r
+                continue\r
+\r
+            if modname and '.' not in modname and modname not in yielded:\r
+                yielded[modname] = 1\r
+                yield prefix + modname, False\r
+\r
+    iter_importer_modules.register(zipimporter, iter_zipimport_modules)\r
+\r
+except ImportError:\r
+    pass\r
+\r
+\r
+def get_importer(path_item):\r
+    """Retrieve a PEP 302 importer for the given path item\r
+\r
+    The returned importer is cached in sys.path_importer_cache\r
+    if it was newly created by a path hook.\r
+\r
+    If there is no importer, a wrapper around the basic import\r
+    machinery is returned. This wrapper is never inserted into\r
+    the importer cache (None is inserted instead).\r
+\r
+    The cache (or part of it) can be cleared manually if a\r
+    rescan of sys.path_hooks is necessary.\r
+    """\r
+    try:\r
+        importer = sys.path_importer_cache[path_item]\r
+    except KeyError:\r
+        for path_hook in sys.path_hooks:\r
+            try:\r
+                importer = path_hook(path_item)\r
+                break\r
+            except ImportError:\r
+                pass\r
+        else:\r
+            importer = None\r
+        sys.path_importer_cache.setdefault(path_item, importer)\r
+\r
+    if importer is None:\r
+        try:\r
+            importer = ImpImporter(path_item)\r
+        except ImportError:\r
+            importer = None\r
+    return importer\r
+\r
+\r
+def iter_importers(fullname=""):\r
+    """Yield PEP 302 importers for the given module name\r
+\r
+    If fullname contains a '.', the importers will be for the package\r
+    containing fullname, otherwise they will be importers for sys.meta_path,\r
+    sys.path, and Python's "classic" import machinery, in that order.  If\r
+    the named module is in a package, that package is imported as a side\r
+    effect of invoking this function.\r
+\r
+    Non PEP 302 mechanisms (e.g. the Windows registry) used by the\r
+    standard import machinery to find files in alternative locations\r
+    are partially supported, but are searched AFTER sys.path. Normally,\r
+    these locations are searched BEFORE sys.path, preventing sys.path\r
+    entries from shadowing them.\r
+\r
+    For this to cause a visible difference in behaviour, there must\r
+    be a module or package name that is accessible via both sys.path\r
+    and one of the non PEP 302 file system mechanisms. In this case,\r
+    the emulation will find the former version, while the builtin\r
+    import mechanism will find the latter.\r
+\r
+    Items of the following types can be affected by this discrepancy:\r
+        imp.C_EXTENSION, imp.PY_SOURCE, imp.PY_COMPILED, imp.PKG_DIRECTORY\r
+    """\r
+    if fullname.startswith('.'):\r
+        raise ImportError("Relative module names not supported")\r
+    if '.' in fullname:\r
+        # Get the containing package's __path__\r
+        pkg = '.'.join(fullname.split('.')[:-1])\r
+        if pkg not in sys.modules:\r
+            __import__(pkg)\r
+        path = getattr(sys.modules[pkg], '__path__', None) or []\r
+    else:\r
+        for importer in sys.meta_path:\r
+            yield importer\r
+        path = sys.path\r
+    for item in path:\r
+        yield get_importer(item)\r
+    if '.' not in fullname:\r
+        yield ImpImporter()\r
+\r
+def get_loader(module_or_name):\r
+    """Get a PEP 302 "loader" object for module_or_name\r
+\r
+    If the module or package is accessible via the normal import\r
+    mechanism, a wrapper around the relevant part of that machinery\r
+    is returned.  Returns None if the module cannot be found or imported.\r
+    If the named module is not already imported, its containing package\r
+    (if any) is imported, in order to establish the package __path__.\r
+\r
+    This function uses iter_importers(), and is thus subject to the same\r
+    limitations regarding platform-specific special import locations such\r
+    as the Windows registry.\r
+    """\r
+    if module_or_name in sys.modules:\r
+        module_or_name = sys.modules[module_or_name]\r
+    if isinstance(module_or_name, ModuleType):\r
+        module = module_or_name\r
+        loader = getattr(module, '__loader__', None)\r
+        if loader is not None:\r
+            return loader\r
+        fullname = module.__name__\r
+    else:\r
+        fullname = module_or_name\r
+    return find_loader(fullname)\r
+\r
+def find_loader(fullname):\r
+    """Find a PEP 302 "loader" object for fullname\r
+\r
+    If fullname contains dots, path must be the containing package's __path__.\r
+    Returns None if the module cannot be found or imported. This function uses\r
+    iter_importers(), and is thus subject to the same limitations regarding\r
+    platform-specific special import locations such as the Windows registry.\r
+    """\r
+    for importer in iter_importers(fullname):\r
+        loader = importer.find_module(fullname)\r
+        if loader is not None:\r
+            return loader\r
+\r
+    return None\r
+\r
+\r
+def extend_path(path, name):\r
+    """Extend a package's path.\r
+\r
+    Intended use is to place the following code in a package's __init__.py:\r
+\r
+        from pkgutil import extend_path\r
+        __path__ = extend_path(__path__, __name__)\r
+\r
+    This will add to the package's __path__ all subdirectories of\r
+    directories on sys.path named after the package.  This is useful\r
+    if one wants to distribute different parts of a single logical\r
+    package as multiple directories.\r
+\r
+    It also looks for *.pkg files beginning where * matches the name\r
+    argument.  This feature is similar to *.pth files (see site.py),\r
+    except that it doesn't special-case lines starting with 'import'.\r
+    A *.pkg file is trusted at face value: apart from checking for\r
+    duplicates, all entries found in a *.pkg file are added to the\r
+    path, regardless of whether they are exist the filesystem.  (This\r
+    is a feature.)\r
+\r
+    If the input path is not a list (as is the case for frozen\r
+    packages) it is returned unchanged.  The input path is not\r
+    modified; an extended copy is returned.  Items are only appended\r
+    to the copy at the end.\r
+\r
+    It is assumed that sys.path is a sequence.  Items of sys.path that\r
+    are not (unicode or 8-bit) strings referring to existing\r
+    directories are ignored.  Unicode items of sys.path that cause\r
+    errors when used as filenames may cause this function to raise an\r
+    exception (in line with os.path.isdir() behavior).\r
+    """\r
+\r
+    if not isinstance(path, list):\r
+        # This could happen e.g. when this is called from inside a\r
+        # frozen package.  Return the path unchanged in that case.\r
+        return path\r
+\r
+    pname = os.path.join(*name.split('.')) # Reconstitute as relative path\r
+    # Just in case os.extsep != '.'\r
+    sname = os.extsep.join(name.split('.'))\r
+    sname_pkg = sname + os.extsep + "pkg"\r
+    init_py = "__init__" + os.extsep + "py"\r
+\r
+    path = path[:] # Start with a copy of the existing path\r
+\r
+    for dir in sys.path:\r
+        if not isinstance(dir, basestring) or not os.path.isdir(dir):\r
+            continue\r
+        subdir = os.path.join(dir, pname)\r
+        # XXX This may still add duplicate entries to path on\r
+        # case-insensitive filesystems\r
+        initfile = os.path.join(subdir, init_py)\r
+        if subdir not in path and os.path.isfile(initfile):\r
+            path.append(subdir)\r
+        # XXX Is this the right thing for subpackages like zope.app?\r
+        # It looks for a file named "zope.app.pkg"\r
+        pkgfile = os.path.join(dir, sname_pkg)\r
+        if os.path.isfile(pkgfile):\r
+            try:\r
+                f = open(pkgfile)\r
+            except IOError, msg:\r
+                sys.stderr.write("Can't open %s: %s\n" %\r
+                                 (pkgfile, msg))\r
+            else:\r
+                for line in f:\r
+                    line = line.rstrip('\n')\r
+                    if not line or line.startswith('#'):\r
+                        continue\r
+                    path.append(line) # Don't check for existence!\r
+                f.close()\r
+\r
+    return path\r
+\r
+def get_data(package, resource):\r
+    """Get a resource from a package.\r
+\r
+    This is a wrapper round the PEP 302 loader get_data API. The package\r
+    argument should be the name of a package, in standard module format\r
+    (foo.bar). The resource argument should be in the form of a relative\r
+    filename, using '/' as the path separator. The parent directory name '..'\r
+    is not allowed, and nor is a rooted name (starting with a '/').\r
+\r
+    The function returns a binary string, which is the contents of the\r
+    specified resource.\r
+\r
+    For packages located in the filesystem, which have already been imported,\r
+    this is the rough equivalent of\r
+\r
+        d = os.path.dirname(sys.modules[package].__file__)\r
+        data = open(os.path.join(d, resource), 'rb').read()\r
+\r
+    If the package cannot be located or loaded, or it uses a PEP 302 loader\r
+    which does not support get_data(), then None is returned.\r
+    """\r
+\r
+    loader = get_loader(package)\r
+    if loader is None or not hasattr(loader, 'get_data'):\r
+        return None\r
+    mod = sys.modules.get(package) or loader.load_module(package)\r
+    if mod is None or not hasattr(mod, '__file__'):\r
+        return None\r
+\r
+    # Modify the resource name to be compatible with the loader.get_data\r
+    # signature - an os.path format "filename" starting with the dirname of\r
+    # the package's __file__\r
+    parts = resource.split('/')\r
+    parts.insert(0, os.path.dirname(mod.__file__))\r
+    resource_name = os.path.join(*parts)\r
+    return loader.get_data(resource_name)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/platform.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/platform.py
new file mode 100644 (file)
index 0000000..8d7f1e7
--- /dev/null
@@ -0,0 +1,1655 @@
+#!/usr/bin/env python\r
+\r
+""" This module tries to retrieve as much platform-identifying data as\r
+    possible. It makes this information available via function APIs.\r
+\r
+    If called from the command line, it prints the platform\r
+    information concatenated as single string to stdout. The output\r
+    format is useable as part of a filename.\r
+\r
+"""\r
+#    This module is maintained by Marc-Andre Lemburg <mal@egenix.com>.\r
+#    If you find problems, please submit bug reports/patches via the\r
+#    Python bug tracker (http://bugs.python.org) and assign them to "lemburg".\r
+#\r
+#    Note: Please keep this module compatible to Python 1.5.2.\r
+#\r
+#    Still needed:\r
+#    * more support for WinCE\r
+#    * support for MS-DOS (PythonDX ?)\r
+#    * support for Amiga and other still unsupported platforms running Python\r
+#    * support for additional Linux distributions\r
+#\r
+#    Many thanks to all those who helped adding platform-specific\r
+#    checks (in no particular order):\r
+#\r
+#      Charles G Waldman, David Arnold, Gordon McMillan, Ben Darnell,\r
+#      Jeff Bauer, Cliff Crawford, Ivan Van Laningham, Josef\r
+#      Betancourt, Randall Hopper, Karl Putland, John Farrell, Greg\r
+#      Andruk, Just van Rossum, Thomas Heller, Mark R. Levinson, Mark\r
+#      Hammond, Bill Tutt, Hans Nowak, Uwe Zessin (OpenVMS support),\r
+#      Colin Kong, Trent Mick, Guido van Rossum, Anthony Baxter\r
+#\r
+#    History:\r
+#\r
+#    <see CVS and SVN checkin messages for history>\r
+#\r
+#    1.0.7 - added DEV_NULL\r
+#    1.0.6 - added linux_distribution()\r
+#    1.0.5 - fixed Java support to allow running the module on Jython\r
+#    1.0.4 - added IronPython support\r
+#    1.0.3 - added normalization of Windows system name\r
+#    1.0.2 - added more Windows support\r
+#    1.0.1 - reformatted to make doc.py happy\r
+#    1.0.0 - reformatted a bit and checked into Python CVS\r
+#    0.8.0 - added sys.version parser and various new access\r
+#            APIs (python_version(), python_compiler(), etc.)\r
+#    0.7.2 - fixed architecture() to use sizeof(pointer) where available\r
+#    0.7.1 - added support for Caldera OpenLinux\r
+#    0.7.0 - some fixes for WinCE; untabified the source file\r
+#    0.6.2 - support for OpenVMS - requires version 1.5.2-V006 or higher and\r
+#            vms_lib.getsyi() configured\r
+#    0.6.1 - added code to prevent 'uname -p' on platforms which are\r
+#            known not to support it\r
+#    0.6.0 - fixed win32_ver() to hopefully work on Win95,98,NT and Win2k;\r
+#            did some cleanup of the interfaces - some APIs have changed\r
+#    0.5.5 - fixed another type in the MacOS code... should have\r
+#            used more coffee today ;-)\r
+#    0.5.4 - fixed a few typos in the MacOS code\r
+#    0.5.3 - added experimental MacOS support; added better popen()\r
+#            workarounds in _syscmd_ver() -- still not 100% elegant\r
+#            though\r
+#    0.5.2 - fixed uname() to return '' instead of 'unknown' in all\r
+#            return values (the system uname command tends to return\r
+#            'unknown' instead of just leaving the field emtpy)\r
+#    0.5.1 - included code for slackware dist; added exception handlers\r
+#            to cover up situations where platforms don't have os.popen\r
+#            (e.g. Mac) or fail on socket.gethostname(); fixed libc\r
+#            detection RE\r
+#    0.5.0 - changed the API names referring to system commands to *syscmd*;\r
+#            added java_ver(); made syscmd_ver() a private\r
+#            API (was system_ver() in previous versions) -- use uname()\r
+#            instead; extended the win32_ver() to also return processor\r
+#            type information\r
+#    0.4.0 - added win32_ver() and modified the platform() output for WinXX\r
+#    0.3.4 - fixed a bug in _follow_symlinks()\r
+#    0.3.3 - fixed popen() and "file" command invokation bugs\r
+#    0.3.2 - added architecture() API and support for it in platform()\r
+#    0.3.1 - fixed syscmd_ver() RE to support Windows NT\r
+#    0.3.0 - added system alias support\r
+#    0.2.3 - removed 'wince' again... oh well.\r
+#    0.2.2 - added 'wince' to syscmd_ver() supported platforms\r
+#    0.2.1 - added cache logic and changed the platform string format\r
+#    0.2.0 - changed the API to use functions instead of module globals\r
+#            since some action take too long to be run on module import\r
+#    0.1.0 - first release\r
+#\r
+#    You can always get the latest version of this module at:\r
+#\r
+#             http://www.egenix.com/files/python/platform.py\r
+#\r
+#    If that URL should fail, try contacting the author.\r
+\r
+__copyright__ = """\r
+    Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com\r
+    Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com\r
+\r
+    Permission to use, copy, modify, and distribute this software and its\r
+    documentation for any purpose and without fee or royalty is hereby granted,\r
+    provided that the above copyright notice appear in all copies and that\r
+    both that copyright notice and this permission notice appear in\r
+    supporting documentation or portions thereof, including modifications,\r
+    that you make.\r
+\r
+    EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO\r
+    THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\r
+    FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,\r
+    INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING\r
+    FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,\r
+    NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION\r
+    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !\r
+\r
+"""\r
+\r
+__version__ = '1.0.7'\r
+\r
+import sys,string,os,re\r
+\r
+### Globals & Constants\r
+\r
+# Determine the platform's /dev/null device\r
+try:\r
+    DEV_NULL = os.devnull\r
+except AttributeError:\r
+    # os.devnull was added in Python 2.4, so emulate it for earlier\r
+    # Python versions\r
+    if sys.platform in ('dos','win32','win16','os2'):\r
+        # Use the old CP/M NUL as device name\r
+        DEV_NULL = 'NUL'\r
+    else:\r
+        # Standard Unix uses /dev/null\r
+        DEV_NULL = '/dev/null'\r
+\r
+### Platform specific APIs\r
+\r
+_libc_search = re.compile(r'(__libc_init)'\r
+                          '|'\r
+                          '(GLIBC_([0-9.]+))'\r
+                          '|'\r
+                          '(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)')\r
+\r
+def libc_ver(executable=sys.executable,lib='',version='',\r
+\r
+             chunksize=2048):\r
+\r
+    """ Tries to determine the libc version that the file executable\r
+        (which defaults to the Python interpreter) is linked against.\r
+\r
+        Returns a tuple of strings (lib,version) which default to the\r
+        given parameters in case the lookup fails.\r
+\r
+        Note that the function has intimate knowledge of how different\r
+        libc versions add symbols to the executable and thus is probably\r
+        only useable for executables compiled using gcc.\r
+\r
+        The file is read and scanned in chunks of chunksize bytes.\r
+\r
+    """\r
+    if hasattr(os.path, 'realpath'):\r
+        # Python 2.2 introduced os.path.realpath(); it is used\r
+        # here to work around problems with Cygwin not being\r
+        # able to open symlinks for reading\r
+        executable = os.path.realpath(executable)\r
+    f = open(executable,'rb')\r
+    binary = f.read(chunksize)\r
+    pos = 0\r
+    while 1:\r
+        m = _libc_search.search(binary,pos)\r
+        if not m:\r
+            binary = f.read(chunksize)\r
+            if not binary:\r
+                break\r
+            pos = 0\r
+            continue\r
+        libcinit,glibc,glibcversion,so,threads,soversion = m.groups()\r
+        if libcinit and not lib:\r
+            lib = 'libc'\r
+        elif glibc:\r
+            if lib != 'glibc':\r
+                lib = 'glibc'\r
+                version = glibcversion\r
+            elif glibcversion > version:\r
+                version = glibcversion\r
+        elif so:\r
+            if lib != 'glibc':\r
+                lib = 'libc'\r
+                if soversion and soversion > version:\r
+                    version = soversion\r
+                if threads and version[-len(threads):] != threads:\r
+                    version = version + threads\r
+        pos = m.end()\r
+    f.close()\r
+    return lib,version\r
+\r
+def _dist_try_harder(distname,version,id):\r
+\r
+    """ Tries some special tricks to get the distribution\r
+        information in case the default method fails.\r
+\r
+        Currently supports older SuSE Linux, Caldera OpenLinux and\r
+        Slackware Linux distributions.\r
+\r
+    """\r
+    if os.path.exists('/var/adm/inst-log/info'):\r
+        # SuSE Linux stores distribution information in that file\r
+        info = open('/var/adm/inst-log/info').readlines()\r
+        distname = 'SuSE'\r
+        for line in info:\r
+            tv = string.split(line)\r
+            if len(tv) == 2:\r
+                tag,value = tv\r
+            else:\r
+                continue\r
+            if tag == 'MIN_DIST_VERSION':\r
+                version = string.strip(value)\r
+            elif tag == 'DIST_IDENT':\r
+                values = string.split(value,'-')\r
+                id = values[2]\r
+        return distname,version,id\r
+\r
+    if os.path.exists('/etc/.installed'):\r
+        # Caldera OpenLinux has some infos in that file (thanks to Colin Kong)\r
+        info = open('/etc/.installed').readlines()\r
+        for line in info:\r
+            pkg = string.split(line,'-')\r
+            if len(pkg) >= 2 and pkg[0] == 'OpenLinux':\r
+                # XXX does Caldera support non Intel platforms ? If yes,\r
+                #     where can we find the needed id ?\r
+                return 'OpenLinux',pkg[1],id\r
+\r
+    if os.path.isdir('/usr/lib/setup'):\r
+        # Check for slackware version tag file (thanks to Greg Andruk)\r
+        verfiles = os.listdir('/usr/lib/setup')\r
+        for n in range(len(verfiles)-1, -1, -1):\r
+            if verfiles[n][:14] != 'slack-version-':\r
+                del verfiles[n]\r
+        if verfiles:\r
+            verfiles.sort()\r
+            distname = 'slackware'\r
+            version = verfiles[-1][14:]\r
+            return distname,version,id\r
+\r
+    return distname,version,id\r
+\r
+_release_filename = re.compile(r'(\w+)[-_](release|version)')\r
+_lsb_release_version = re.compile(r'(.+)'\r
+                                   ' release '\r
+                                   '([\d.]+)'\r
+                                   '[^(]*(?:\((.+)\))?')\r
+_release_version = re.compile(r'([^0-9]+)'\r
+                               '(?: release )?'\r
+                               '([\d.]+)'\r
+                               '[^(]*(?:\((.+)\))?')\r
+\r
+# See also http://www.novell.com/coolsolutions/feature/11251.html\r
+# and http://linuxmafia.com/faq/Admin/release-files.html\r
+# and http://data.linux-ntfs.org/rpm/whichrpm\r
+# and http://www.die.net/doc/linux/man/man1/lsb_release.1.html\r
+\r
+_supported_dists = (\r
+    'SuSE', 'debian', 'fedora', 'redhat', 'centos',\r
+    'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo',\r
+    'UnitedLinux', 'turbolinux')\r
+\r
+def _parse_release_file(firstline):\r
+\r
+    # Default to empty 'version' and 'id' strings.  Both defaults are used\r
+    # when 'firstline' is empty.  'id' defaults to empty when an id can not\r
+    # be deduced.\r
+    version = ''\r
+    id = ''\r
+\r
+    # Parse the first line\r
+    m = _lsb_release_version.match(firstline)\r
+    if m is not None:\r
+        # LSB format: "distro release x.x (codename)"\r
+        return tuple(m.groups())\r
+\r
+    # Pre-LSB format: "distro x.x (codename)"\r
+    m = _release_version.match(firstline)\r
+    if m is not None:\r
+        return tuple(m.groups())\r
+\r
+    # Unknown format... take the first two words\r
+    l = string.split(string.strip(firstline))\r
+    if l:\r
+        version = l[0]\r
+        if len(l) > 1:\r
+            id = l[1]\r
+    return '', version, id\r
+\r
+def linux_distribution(distname='', version='', id='',\r
+\r
+                       supported_dists=_supported_dists,\r
+                       full_distribution_name=1):\r
+\r
+    """ Tries to determine the name of the Linux OS distribution name.\r
+\r
+        The function first looks for a distribution release file in\r
+        /etc and then reverts to _dist_try_harder() in case no\r
+        suitable files are found.\r
+\r
+        supported_dists may be given to define the set of Linux\r
+        distributions to look for. It defaults to a list of currently\r
+        supported Linux distributions identified by their release file\r
+        name.\r
+\r
+        If full_distribution_name is true (default), the full\r
+        distribution read from the OS is returned. Otherwise the short\r
+        name taken from supported_dists is used.\r
+\r
+        Returns a tuple (distname,version,id) which default to the\r
+        args given as parameters.\r
+\r
+    """\r
+    try:\r
+        etc = os.listdir('/etc')\r
+    except os.error:\r
+        # Probably not a Unix system\r
+        return distname,version,id\r
+    etc.sort()\r
+    for file in etc:\r
+        m = _release_filename.match(file)\r
+        if m is not None:\r
+            _distname,dummy = m.groups()\r
+            if _distname in supported_dists:\r
+                distname = _distname\r
+                break\r
+    else:\r
+        return _dist_try_harder(distname,version,id)\r
+\r
+    # Read the first line\r
+    f = open('/etc/'+file, 'r')\r
+    firstline = f.readline()\r
+    f.close()\r
+    _distname, _version, _id = _parse_release_file(firstline)\r
+\r
+    if _distname and full_distribution_name:\r
+        distname = _distname\r
+    if _version:\r
+        version = _version\r
+    if _id:\r
+        id = _id\r
+    return distname, version, id\r
+\r
+# To maintain backwards compatibility:\r
+\r
+def dist(distname='',version='',id='',\r
+\r
+         supported_dists=_supported_dists):\r
+\r
+    """ Tries to determine the name of the Linux OS distribution name.\r
+\r
+        The function first looks for a distribution release file in\r
+        /etc and then reverts to _dist_try_harder() in case no\r
+        suitable files are found.\r
+\r
+        Returns a tuple (distname,version,id) which default to the\r
+        args given as parameters.\r
+\r
+    """\r
+    return linux_distribution(distname, version, id,\r
+                              supported_dists=supported_dists,\r
+                              full_distribution_name=0)\r
+\r
+class _popen:\r
+\r
+    """ Fairly portable (alternative) popen implementation.\r
+\r
+        This is mostly needed in case os.popen() is not available, or\r
+        doesn't work as advertised, e.g. in Win9X GUI programs like\r
+        PythonWin or IDLE.\r
+\r
+        Writing to the pipe is currently not supported.\r
+\r
+    """\r
+    tmpfile = ''\r
+    pipe = None\r
+    bufsize = None\r
+    mode = 'r'\r
+\r
+    def __init__(self,cmd,mode='r',bufsize=None):\r
+\r
+        if mode != 'r':\r
+            raise ValueError,'popen()-emulation only supports read mode'\r
+        import tempfile\r
+        self.tmpfile = tmpfile = tempfile.mktemp()\r
+        os.system(cmd + ' > %s' % tmpfile)\r
+        self.pipe = open(tmpfile,'rb')\r
+        self.bufsize = bufsize\r
+        self.mode = mode\r
+\r
+    def read(self):\r
+\r
+        return self.pipe.read()\r
+\r
+    def readlines(self):\r
+\r
+        if self.bufsize is not None:\r
+            return self.pipe.readlines()\r
+\r
+    def close(self,\r
+\r
+              remove=os.unlink,error=os.error):\r
+\r
+        if self.pipe:\r
+            rc = self.pipe.close()\r
+        else:\r
+            rc = 255\r
+        if self.tmpfile:\r
+            try:\r
+                remove(self.tmpfile)\r
+            except error:\r
+                pass\r
+        return rc\r
+\r
+    # Alias\r
+    __del__ = close\r
+\r
+def popen(cmd, mode='r', bufsize=None):\r
+\r
+    """ Portable popen() interface.\r
+    """\r
+    # Find a working popen implementation preferring win32pipe.popen\r
+    # over os.popen over _popen\r
+    popen = None\r
+    if os.environ.get('OS','') == 'Windows_NT':\r
+        # On NT win32pipe should work; on Win9x it hangs due to bugs\r
+        # in the MS C lib (see MS KnowledgeBase article Q150956)\r
+        try:\r
+            import win32pipe\r
+        except ImportError:\r
+            pass\r
+        else:\r
+            popen = win32pipe.popen\r
+    if popen is None:\r
+        if hasattr(os,'popen'):\r
+            popen = os.popen\r
+            # Check whether it works... it doesn't in GUI programs\r
+            # on Windows platforms\r
+            if sys.platform == 'win32': # XXX Others too ?\r
+                try:\r
+                    popen('')\r
+                except os.error:\r
+                    popen = _popen\r
+        else:\r
+            popen = _popen\r
+    if bufsize is None:\r
+        return popen(cmd,mode)\r
+    else:\r
+        return popen(cmd,mode,bufsize)\r
+\r
+def _norm_version(version, build=''):\r
+\r
+    """ Normalize the version and build strings and return a single\r
+        version string using the format major.minor.build (or patchlevel).\r
+    """\r
+    l = string.split(version,'.')\r
+    if build:\r
+        l.append(build)\r
+    try:\r
+        ints = map(int,l)\r
+    except ValueError:\r
+        strings = l\r
+    else:\r
+        strings = map(str,ints)\r
+    version = string.join(strings[:3],'.')\r
+    return version\r
+\r
+_ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) '\r
+                         '.*'\r
+                         '\[.* ([\d.]+)\])')\r
+\r
+# Examples of VER command output:\r
+#\r
+#   Windows 2000:  Microsoft Windows 2000 [Version 5.00.2195]\r
+#   Windows XP:    Microsoft Windows XP [Version 5.1.2600]\r
+#   Windows Vista: Microsoft Windows [Version 6.0.6002]\r
+#\r
+# Note that the "Version" string gets localized on different\r
+# Windows versions.\r
+\r
+def _syscmd_ver(system='', release='', version='',\r
+\r
+               supported_platforms=('win32','win16','dos','os2')):\r
+\r
+    """ Tries to figure out the OS version used and returns\r
+        a tuple (system,release,version).\r
+\r
+        It uses the "ver" shell command for this which is known\r
+        to exists on Windows, DOS and OS/2. XXX Others too ?\r
+\r
+        In case this fails, the given parameters are used as\r
+        defaults.\r
+\r
+    """\r
+    if sys.platform not in supported_platforms:\r
+        return system,release,version\r
+\r
+    # Try some common cmd strings\r
+    for cmd in ('ver','command /c ver','cmd /c ver'):\r
+        try:\r
+            pipe = popen(cmd)\r
+            info = pipe.read()\r
+            if pipe.close():\r
+                raise os.error,'command failed'\r
+            # XXX How can I suppress shell errors from being written\r
+            #     to stderr ?\r
+        except os.error,why:\r
+            #print 'Command %s failed: %s' % (cmd,why)\r
+            continue\r
+        except IOError,why:\r
+            #print 'Command %s failed: %s' % (cmd,why)\r
+            continue\r
+        else:\r
+            break\r
+    else:\r
+        return system,release,version\r
+\r
+    # Parse the output\r
+    info = string.strip(info)\r
+    m = _ver_output.match(info)\r
+    if m is not None:\r
+        system,release,version = m.groups()\r
+        # Strip trailing dots from version and release\r
+        if release[-1] == '.':\r
+            release = release[:-1]\r
+        if version[-1] == '.':\r
+            version = version[:-1]\r
+        # Normalize the version and build strings (eliminating additional\r
+        # zeros)\r
+        version = _norm_version(version)\r
+    return system,release,version\r
+\r
+def _win32_getvalue(key,name,default=''):\r
+\r
+    """ Read a value for name from the registry key.\r
+\r
+        In case this fails, default is returned.\r
+\r
+    """\r
+    try:\r
+        # Use win32api if available\r
+        from win32api import RegQueryValueEx\r
+    except ImportError:\r
+        # On Python 2.0 and later, emulate using _winreg\r
+        import _winreg\r
+        RegQueryValueEx = _winreg.QueryValueEx\r
+    try:\r
+        return RegQueryValueEx(key,name)\r
+    except:\r
+        return default\r
+\r
+def win32_ver(release='',version='',csd='',ptype=''):\r
+\r
+    """ Get additional version information from the Windows Registry\r
+        and return a tuple (version,csd,ptype) referring to version\r
+        number, CSD level (service pack), and OS type (multi/single\r
+        processor).\r
+\r
+        As a hint: ptype returns 'Uniprocessor Free' on single\r
+        processor NT machines and 'Multiprocessor Free' on multi\r
+        processor machines. The 'Free' refers to the OS version being\r
+        free of debugging code. It could also state 'Checked' which\r
+        means the OS version uses debugging code, i.e. code that\r
+        checks arguments, ranges, etc. (Thomas Heller).\r
+\r
+        Note: this function works best with Mark Hammond's win32\r
+        package installed, but also on Python 2.3 and later. It\r
+        obviously only runs on Win32 compatible platforms.\r
+\r
+    """\r
+    # XXX Is there any way to find out the processor type on WinXX ?\r
+    # XXX Is win32 available on Windows CE ?\r
+    #\r
+    # Adapted from code posted by Karl Putland to comp.lang.python.\r
+    #\r
+    # The mappings between reg. values and release names can be found\r
+    # here: http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfo_str.asp\r
+\r
+    # Import the needed APIs\r
+    try:\r
+        import win32api\r
+        from win32api import RegQueryValueEx, RegOpenKeyEx, \\r
+             RegCloseKey, GetVersionEx\r
+        from win32con import HKEY_LOCAL_MACHINE, VER_PLATFORM_WIN32_NT, \\r
+             VER_PLATFORM_WIN32_WINDOWS, VER_NT_WORKSTATION\r
+    except ImportError:\r
+        # Emulate the win32api module using Python APIs\r
+        try:\r
+            sys.getwindowsversion\r
+        except AttributeError:\r
+            # No emulation possible, so return the defaults...\r
+            return release,version,csd,ptype\r
+        else:\r
+            # Emulation using _winreg (added in Python 2.0) and\r
+            # sys.getwindowsversion() (added in Python 2.3)\r
+            import _winreg\r
+            GetVersionEx = sys.getwindowsversion\r
+            RegQueryValueEx = _winreg.QueryValueEx\r
+            RegOpenKeyEx = _winreg.OpenKeyEx\r
+            RegCloseKey = _winreg.CloseKey\r
+            HKEY_LOCAL_MACHINE = _winreg.HKEY_LOCAL_MACHINE\r
+            VER_PLATFORM_WIN32_WINDOWS = 1\r
+            VER_PLATFORM_WIN32_NT = 2\r
+            VER_NT_WORKSTATION = 1\r
+            VER_NT_SERVER = 3\r
+            REG_SZ = 1\r
+\r
+    # Find out the registry key and some general version infos\r
+    winver = GetVersionEx()\r
+    maj,min,buildno,plat,csd = winver\r
+    version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF)\r
+    if hasattr(winver, "service_pack"):\r
+        if winver.service_pack != "":\r
+            csd = 'SP%s' % winver.service_pack_major\r
+    else:\r
+        if csd[:13] == 'Service Pack ':\r
+            csd = 'SP' + csd[13:]\r
+\r
+    if plat == VER_PLATFORM_WIN32_WINDOWS:\r
+        regkey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion'\r
+        # Try to guess the release name\r
+        if maj == 4:\r
+            if min == 0:\r
+                release = '95'\r
+            elif min == 10:\r
+                release = '98'\r
+            elif min == 90:\r
+                release = 'Me'\r
+            else:\r
+                release = 'postMe'\r
+        elif maj == 5:\r
+            release = '2000'\r
+\r
+    elif plat == VER_PLATFORM_WIN32_NT:\r
+        regkey = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion'\r
+        if maj <= 4:\r
+            release = 'NT'\r
+        elif maj == 5:\r
+            if min == 0:\r
+                release = '2000'\r
+            elif min == 1:\r
+                release = 'XP'\r
+            elif min == 2:\r
+                release = '2003Server'\r
+            else:\r
+                release = 'post2003'\r
+        elif maj == 6:\r
+            if hasattr(winver, "product_type"):\r
+                product_type = winver.product_type\r
+            else:\r
+                product_type = VER_NT_WORKSTATION\r
+                # Without an OSVERSIONINFOEX capable sys.getwindowsversion(),\r
+                # or help from the registry, we cannot properly identify\r
+                # non-workstation versions.\r
+                try:\r
+                    key = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey)\r
+                    name, type = RegQueryValueEx(key, "ProductName")\r
+                    # Discard any type that isn't REG_SZ\r
+                    if type == REG_SZ and name.find("Server") != -1:\r
+                        product_type = VER_NT_SERVER\r
+                except WindowsError:\r
+                    # Use default of VER_NT_WORKSTATION\r
+                    pass\r
+\r
+            if min == 0:\r
+                if product_type == VER_NT_WORKSTATION:\r
+                    release = 'Vista'\r
+                else:\r
+                    release = '2008Server'\r
+            elif min == 1:\r
+                if product_type == VER_NT_WORKSTATION:\r
+                    release = '7'\r
+                else:\r
+                    release = '2008ServerR2'\r
+            elif min == 2:\r
+                if product_type == VER_NT_WORKSTATION:\r
+                    release = '8'\r
+                else:\r
+                    release = '2012Server'\r
+            else:\r
+                release = 'post2012Server'\r
+\r
+    else:\r
+        if not release:\r
+            # E.g. Win3.1 with win32s\r
+            release = '%i.%i' % (maj,min)\r
+        return release,version,csd,ptype\r
+\r
+    # Open the registry key\r
+    try:\r
+        keyCurVer = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey)\r
+        # Get a value to make sure the key exists...\r
+        RegQueryValueEx(keyCurVer, 'SystemRoot')\r
+    except:\r
+        return release,version,csd,ptype\r
+\r
+    # Parse values\r
+    #subversion = _win32_getvalue(keyCurVer,\r
+    #                            'SubVersionNumber',\r
+    #                            ('',1))[0]\r
+    #if subversion:\r
+    #   release = release + subversion # 95a, 95b, etc.\r
+    build = _win32_getvalue(keyCurVer,\r
+                            'CurrentBuildNumber',\r
+                            ('',1))[0]\r
+    ptype = _win32_getvalue(keyCurVer,\r
+                           'CurrentType',\r
+                           (ptype,1))[0]\r
+\r
+    # Normalize version\r
+    version = _norm_version(version,build)\r
+\r
+    # Close key\r
+    RegCloseKey(keyCurVer)\r
+    return release,version,csd,ptype\r
+\r
+def _mac_ver_lookup(selectors,default=None):\r
+\r
+    from gestalt import gestalt\r
+    import MacOS\r
+    l = []\r
+    append = l.append\r
+    for selector in selectors:\r
+        try:\r
+            append(gestalt(selector))\r
+        except (RuntimeError, MacOS.Error):\r
+            append(default)\r
+    return l\r
+\r
+def _bcd2str(bcd):\r
+\r
+    return hex(bcd)[2:]\r
+\r
+def _mac_ver_gestalt():\r
+    """\r
+        Thanks to Mark R. Levinson for mailing documentation links and\r
+        code examples for this function. Documentation for the\r
+        gestalt() API is available online at:\r
+\r
+           http://www.rgaros.nl/gestalt/\r
+    """\r
+    # Check whether the version info module is available\r
+    try:\r
+        import gestalt\r
+        import MacOS\r
+    except ImportError:\r
+        return None\r
+    # Get the infos\r
+    sysv,sysa = _mac_ver_lookup(('sysv','sysa'))\r
+    # Decode the infos\r
+    if sysv:\r
+        major = (sysv & 0xFF00) >> 8\r
+        minor = (sysv & 0x00F0) >> 4\r
+        patch = (sysv & 0x000F)\r
+\r
+        if (major, minor) >= (10, 4):\r
+            # the 'sysv' gestald cannot return patchlevels\r
+            # higher than 9. Apple introduced 3 new\r
+            # gestalt codes in 10.4 to deal with this\r
+            # issue (needed because patch levels can\r
+            # run higher than 9, such as 10.4.11)\r
+            major,minor,patch = _mac_ver_lookup(('sys1','sys2','sys3'))\r
+            release = '%i.%i.%i' %(major, minor, patch)\r
+        else:\r
+            release = '%s.%i.%i' % (_bcd2str(major),minor,patch)\r
+\r
+    if sysa:\r
+        machine = {0x1: '68k',\r
+                   0x2: 'PowerPC',\r
+                   0xa: 'i386'}.get(sysa,'')\r
+\r
+    versioninfo=('', '', '')\r
+    return release,versioninfo,machine\r
+\r
+def _mac_ver_xml():\r
+    fn = '/System/Library/CoreServices/SystemVersion.plist'\r
+    if not os.path.exists(fn):\r
+        return None\r
+\r
+    try:\r
+        import plistlib\r
+    except ImportError:\r
+        return None\r
+\r
+    pl = plistlib.readPlist(fn)\r
+    release = pl['ProductVersion']\r
+    versioninfo=('', '', '')\r
+    machine = os.uname()[4]\r
+    if machine in ('ppc', 'Power Macintosh'):\r
+        # for compatibility with the gestalt based code\r
+        machine = 'PowerPC'\r
+\r
+    return release,versioninfo,machine\r
+\r
+\r
+def mac_ver(release='',versioninfo=('','',''),machine=''):\r
+\r
+    """ Get MacOS version information and return it as tuple (release,\r
+        versioninfo, machine) with versioninfo being a tuple (version,\r
+        dev_stage, non_release_version).\r
+\r
+        Entries which cannot be determined are set to the parameter values\r
+        which default to ''. All tuple entries are strings.\r
+    """\r
+\r
+    # First try reading the information from an XML file which should\r
+    # always be present\r
+    info = _mac_ver_xml()\r
+    if info is not None:\r
+        return info\r
+\r
+    # If that doesn't work for some reason fall back to reading the\r
+    # information using gestalt calls.\r
+    info = _mac_ver_gestalt()\r
+    if info is not None:\r
+        return info\r
+\r
+    # If that also doesn't work return the default values\r
+    return release,versioninfo,machine\r
+\r
+def _java_getprop(name,default):\r
+\r
+    from java.lang import System\r
+    try:\r
+        value = System.getProperty(name)\r
+        if value is None:\r
+            return default\r
+        return value\r
+    except AttributeError:\r
+        return default\r
+\r
+def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')):\r
+\r
+    """ Version interface for Jython.\r
+\r
+        Returns a tuple (release,vendor,vminfo,osinfo) with vminfo being\r
+        a tuple (vm_name,vm_release,vm_vendor) and osinfo being a\r
+        tuple (os_name,os_version,os_arch).\r
+\r
+        Values which cannot be determined are set to the defaults\r
+        given as parameters (which all default to '').\r
+\r
+    """\r
+    # Import the needed APIs\r
+    try:\r
+        import java.lang\r
+    except ImportError:\r
+        return release,vendor,vminfo,osinfo\r
+\r
+    vendor = _java_getprop('java.vendor', vendor)\r
+    release = _java_getprop('java.version', release)\r
+    vm_name, vm_release, vm_vendor = vminfo\r
+    vm_name = _java_getprop('java.vm.name', vm_name)\r
+    vm_vendor = _java_getprop('java.vm.vendor', vm_vendor)\r
+    vm_release = _java_getprop('java.vm.version', vm_release)\r
+    vminfo = vm_name, vm_release, vm_vendor\r
+    os_name, os_version, os_arch = osinfo\r
+    os_arch = _java_getprop('java.os.arch', os_arch)\r
+    os_name = _java_getprop('java.os.name', os_name)\r
+    os_version = _java_getprop('java.os.version', os_version)\r
+    osinfo = os_name, os_version, os_arch\r
+\r
+    return release, vendor, vminfo, osinfo\r
+\r
+### System name aliasing\r
+\r
+def system_alias(system,release,version):\r
+\r
+    """ Returns (system,release,version) aliased to common\r
+        marketing names used for some systems.\r
+\r
+        It also does some reordering of the information in some cases\r
+        where it would otherwise cause confusion.\r
+\r
+    """\r
+    if system == 'Rhapsody':\r
+        # Apple's BSD derivative\r
+        # XXX How can we determine the marketing release number ?\r
+        return 'MacOS X Server',system+release,version\r
+\r
+    elif system == 'SunOS':\r
+        # Sun's OS\r
+        if release < '5':\r
+            # These releases use the old name SunOS\r
+            return system,release,version\r
+        # Modify release (marketing release = SunOS release - 3)\r
+        l = string.split(release,'.')\r
+        if l:\r
+            try:\r
+                major = int(l[0])\r
+            except ValueError:\r
+                pass\r
+            else:\r
+                major = major - 3\r
+                l[0] = str(major)\r
+                release = string.join(l,'.')\r
+        if release < '6':\r
+            system = 'Solaris'\r
+        else:\r
+            # XXX Whatever the new SunOS marketing name is...\r
+            system = 'Solaris'\r
+\r
+    elif system == 'IRIX64':\r
+        # IRIX reports IRIX64 on platforms with 64-bit support; yet it\r
+        # is really a version and not a different platform, since 32-bit\r
+        # apps are also supported..\r
+        system = 'IRIX'\r
+        if version:\r
+            version = version + ' (64bit)'\r
+        else:\r
+            version = '64bit'\r
+\r
+    elif system in ('win32','win16'):\r
+        # In case one of the other tricks\r
+        system = 'Windows'\r
+\r
+    return system,release,version\r
+\r
+### Various internal helpers\r
+\r
+def _platform(*args):\r
+\r
+    """ Helper to format the platform string in a filename\r
+        compatible format e.g. "system-version-machine".\r
+    """\r
+    # Format the platform string\r
+    platform = string.join(\r
+        map(string.strip,\r
+            filter(len, args)),\r
+        '-')\r
+\r
+    # Cleanup some possible filename obstacles...\r
+    replace = string.replace\r
+    platform = replace(platform,' ','_')\r
+    platform = replace(platform,'/','-')\r
+    platform = replace(platform,'\\','-')\r
+    platform = replace(platform,':','-')\r
+    platform = replace(platform,';','-')\r
+    platform = replace(platform,'"','-')\r
+    platform = replace(platform,'(','-')\r
+    platform = replace(platform,')','-')\r
+\r
+    # No need to report 'unknown' information...\r
+    platform = replace(platform,'unknown','')\r
+\r
+    # Fold '--'s and remove trailing '-'\r
+    while 1:\r
+        cleaned = replace(platform,'--','-')\r
+        if cleaned == platform:\r
+            break\r
+        platform = cleaned\r
+    while platform[-1] == '-':\r
+        platform = platform[:-1]\r
+\r
+    return platform\r
+\r
+def _node(default=''):\r
+\r
+    """ Helper to determine the node name of this machine.\r
+    """\r
+    try:\r
+        import socket\r
+    except ImportError:\r
+        # No sockets...\r
+        return default\r
+    try:\r
+        return socket.gethostname()\r
+    except socket.error:\r
+        # Still not working...\r
+        return default\r
+\r
+# os.path.abspath is new in Python 1.5.2:\r
+if not hasattr(os.path,'abspath'):\r
+\r
+    def _abspath(path,\r
+\r
+                 isabs=os.path.isabs,join=os.path.join,getcwd=os.getcwd,\r
+                 normpath=os.path.normpath):\r
+\r
+        if not isabs(path):\r
+            path = join(getcwd(), path)\r
+        return normpath(path)\r
+\r
+else:\r
+\r
+    _abspath = os.path.abspath\r
+\r
+def _follow_symlinks(filepath):\r
+\r
+    """ In case filepath is a symlink, follow it until a\r
+        real file is reached.\r
+    """\r
+    filepath = _abspath(filepath)\r
+    while os.path.islink(filepath):\r
+        filepath = os.path.normpath(\r
+            os.path.join(os.path.dirname(filepath),os.readlink(filepath)))\r
+    return filepath\r
+\r
+def _syscmd_uname(option,default=''):\r
+\r
+    """ Interface to the system's uname command.\r
+    """\r
+    if sys.platform in ('dos','win32','win16','os2'):\r
+        # XXX Others too ?\r
+        return default\r
+    try:\r
+        f = os.popen('uname %s 2> %s' % (option, DEV_NULL))\r
+    except (AttributeError,os.error):\r
+        return default\r
+    output = string.strip(f.read())\r
+    rc = f.close()\r
+    if not output or rc:\r
+        return default\r
+    else:\r
+        return output\r
+\r
+def _syscmd_file(target,default=''):\r
+\r
+    """ Interface to the system's file command.\r
+\r
+        The function uses the -b option of the file command to have it\r
+        ommit the filename in its output and if possible the -L option\r
+        to have the command follow symlinks. It returns default in\r
+        case the command should fail.\r
+\r
+    """\r
+\r
+    # We do the import here to avoid a bootstrap issue.\r
+    # See c73b90b6dadd changeset.\r
+    #\r
+    # [..]\r
+    # ranlib libpython2.7.a\r
+    # gcc   -o python \\r
+    #        Modules/python.o \\r
+    #        libpython2.7.a -lsocket -lnsl -ldl    -lm\r
+    # Traceback (most recent call last):\r
+    #  File "./setup.py", line 8, in <module>\r
+    #    from platform import machine as platform_machine\r
+    #  File "[..]/build/Lib/platform.py", line 116, in <module>\r
+    #    import sys,string,os,re,subprocess\r
+    #  File "[..]/build/Lib/subprocess.py", line 429, in <module>\r
+    #    import select\r
+    # ImportError: No module named select\r
+\r
+    import subprocess\r
+\r
+    if sys.platform in ('dos','win32','win16','os2'):\r
+        # XXX Others too ?\r
+        return default\r
+    target = _follow_symlinks(target)\r
+    try:\r
+        proc = subprocess.Popen(['file', target],\r
+                stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\r
+\r
+    except (AttributeError,os.error):\r
+        return default\r
+    output = proc.communicate()[0]\r
+    rc = proc.wait()\r
+    if not output or rc:\r
+        return default\r
+    else:\r
+        return output\r
+\r
+### Information about the used architecture\r
+\r
+# Default values for architecture; non-empty strings override the\r
+# defaults given as parameters\r
+_default_architecture = {\r
+    'win32': ('','WindowsPE'),\r
+    'win16': ('','Windows'),\r
+    'dos': ('','MSDOS'),\r
+}\r
+\r
+_architecture_split = re.compile(r'[\s,]').split\r
+\r
+def architecture(executable=sys.executable,bits='',linkage=''):\r
+\r
+    """ Queries the given executable (defaults to the Python interpreter\r
+        binary) for various architecture information.\r
+\r
+        Returns a tuple (bits,linkage) which contains information about\r
+        the bit architecture and the linkage format used for the\r
+        executable. Both values are returned as strings.\r
+\r
+        Values that cannot be determined are returned as given by the\r
+        parameter presets. If bits is given as '', the sizeof(pointer)\r
+        (or sizeof(long) on Python version < 1.5.2) is used as\r
+        indicator for the supported pointer size.\r
+\r
+        The function relies on the system's "file" command to do the\r
+        actual work. This is available on most if not all Unix\r
+        platforms. On some non-Unix platforms where the "file" command\r
+        does not exist and the executable is set to the Python interpreter\r
+        binary defaults from _default_architecture are used.\r
+\r
+    """\r
+    # Use the sizeof(pointer) as default number of bits if nothing\r
+    # else is given as default.\r
+    if not bits:\r
+        import struct\r
+        try:\r
+            size = struct.calcsize('P')\r
+        except struct.error:\r
+            # Older installations can only query longs\r
+            size = struct.calcsize('l')\r
+        bits = str(size*8) + 'bit'\r
+\r
+    # Get data from the 'file' system command\r
+    if executable:\r
+        output = _syscmd_file(executable, '')\r
+    else:\r
+        output = ''\r
+\r
+    if not output and \\r
+       executable == sys.executable:\r
+        # "file" command did not return anything; we'll try to provide\r
+        # some sensible defaults then...\r
+        if sys.platform in _default_architecture:\r
+            b, l = _default_architecture[sys.platform]\r
+            if b:\r
+                bits = b\r
+            if l:\r
+                linkage = l\r
+        return bits, linkage\r
+\r
+    # Split the output into a list of strings omitting the filename\r
+    fileout = _architecture_split(output)[1:]\r
+\r
+    if 'executable' not in fileout:\r
+        # Format not supported\r
+        return bits,linkage\r
+\r
+    # Bits\r
+    if '32-bit' in fileout:\r
+        bits = '32bit'\r
+    elif 'N32' in fileout:\r
+        # On Irix only\r
+        bits = 'n32bit'\r
+    elif '64-bit' in fileout:\r
+        bits = '64bit'\r
+\r
+    # Linkage\r
+    if 'ELF' in fileout:\r
+        linkage = 'ELF'\r
+    elif 'PE' in fileout:\r
+        # E.g. Windows uses this format\r
+        if 'Windows' in fileout:\r
+            linkage = 'WindowsPE'\r
+        else:\r
+            linkage = 'PE'\r
+    elif 'COFF' in fileout:\r
+        linkage = 'COFF'\r
+    elif 'MS-DOS' in fileout:\r
+        linkage = 'MSDOS'\r
+    else:\r
+        # XXX the A.OUT format also falls under this class...\r
+        pass\r
+\r
+    return bits,linkage\r
+\r
+### Portable uname() interface\r
+\r
+_uname_cache = None\r
+\r
+def uname():\r
+\r
+    """ Fairly portable uname interface. Returns a tuple\r
+        of strings (system,node,release,version,machine,processor)\r
+        identifying the underlying platform.\r
+\r
+        Note that unlike the os.uname function this also returns\r
+        possible processor information as an additional tuple entry.\r
+\r
+        Entries which cannot be determined are set to ''.\r
+\r
+    """\r
+    global _uname_cache\r
+    no_os_uname = 0\r
+\r
+    if _uname_cache is not None:\r
+        return _uname_cache\r
+\r
+    processor = ''\r
+\r
+    # Get some infos from the builtin os.uname API...\r
+    try:\r
+        system,node,release,version,machine = os.uname()\r
+    except AttributeError:\r
+        no_os_uname = 1\r
+\r
+    if no_os_uname or not filter(None, (system, node, release, version, machine)):\r
+        # Hmm, no there is either no uname or uname has returned\r
+        #'unknowns'... we'll have to poke around the system then.\r
+        if no_os_uname:\r
+            system = sys.platform\r
+            release = ''\r
+            version = ''\r
+            node = _node()\r
+            machine = ''\r
+\r
+        use_syscmd_ver = 1\r
+\r
+        # Try win32_ver() on win32 platforms\r
+        if system == 'win32':\r
+            release,version,csd,ptype = win32_ver()\r
+            if release and version:\r
+                use_syscmd_ver = 0\r
+            # Try to use the PROCESSOR_* environment variables\r
+            # available on Win XP and later; see\r
+            # http://support.microsoft.com/kb/888731 and\r
+            # http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM\r
+            if not machine:\r
+                # WOW64 processes mask the native architecture\r
+                if "PROCESSOR_ARCHITEW6432" in os.environ:\r
+                    machine = os.environ.get("PROCESSOR_ARCHITEW6432", '')\r
+                else:\r
+                    machine = os.environ.get('PROCESSOR_ARCHITECTURE', '')\r
+            if not processor:\r
+                processor = os.environ.get('PROCESSOR_IDENTIFIER', machine)\r
+\r
+        # Try the 'ver' system command available on some\r
+        # platforms\r
+        if use_syscmd_ver:\r
+            system,release,version = _syscmd_ver(system)\r
+            # Normalize system to what win32_ver() normally returns\r
+            # (_syscmd_ver() tends to return the vendor name as well)\r
+            if system == 'Microsoft Windows':\r
+                system = 'Windows'\r
+            elif system == 'Microsoft' and release == 'Windows':\r
+                # Under Windows Vista and Windows Server 2008,\r
+                # Microsoft changed the output of the ver command. The\r
+                # release is no longer printed.  This causes the\r
+                # system and release to be misidentified.\r
+                system = 'Windows'\r
+                if '6.0' == version[:3]:\r
+                    release = 'Vista'\r
+                else:\r
+                    release = ''\r
+\r
+        # In case we still don't know anything useful, we'll try to\r
+        # help ourselves\r
+        if system in ('win32','win16'):\r
+            if not version:\r
+                if system == 'win32':\r
+                    version = '32bit'\r
+                else:\r
+                    version = '16bit'\r
+            system = 'Windows'\r
+\r
+        elif system[:4] == 'java':\r
+            release,vendor,vminfo,osinfo = java_ver()\r
+            system = 'Java'\r
+            version = string.join(vminfo,', ')\r
+            if not version:\r
+                version = vendor\r
+\r
+    # System specific extensions\r
+    if system == 'OpenVMS':\r
+        # OpenVMS seems to have release and version mixed up\r
+        if not release or release == '0':\r
+            release = version\r
+            version = ''\r
+        # Get processor information\r
+        try:\r
+            import vms_lib\r
+        except ImportError:\r
+            pass\r
+        else:\r
+            csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0)\r
+            if (cpu_number >= 128):\r
+                processor = 'Alpha'\r
+            else:\r
+                processor = 'VAX'\r
+    if not processor:\r
+        # Get processor information from the uname system command\r
+        processor = _syscmd_uname('-p','')\r
+\r
+    #If any unknowns still exist, replace them with ''s, which are more portable\r
+    if system == 'unknown':\r
+        system = ''\r
+    if node == 'unknown':\r
+        node = ''\r
+    if release == 'unknown':\r
+        release = ''\r
+    if version == 'unknown':\r
+        version = ''\r
+    if machine == 'unknown':\r
+        machine = ''\r
+    if processor == 'unknown':\r
+        processor = ''\r
+\r
+    #  normalize name\r
+    if system == 'Microsoft' and release == 'Windows':\r
+        system = 'Windows'\r
+        release = 'Vista'\r
+\r
+    _uname_cache = system,node,release,version,machine,processor\r
+    return _uname_cache\r
+\r
+### Direct interfaces to some of the uname() return values\r
+\r
+def system():\r
+\r
+    """ Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.\r
+\r
+        An empty string is returned if the value cannot be determined.\r
+\r
+    """\r
+    return uname()[0]\r
+\r
+def node():\r
+\r
+    """ Returns the computer's network name (which may not be fully\r
+        qualified)\r
+\r
+        An empty string is returned if the value cannot be determined.\r
+\r
+    """\r
+    return uname()[1]\r
+\r
+def release():\r
+\r
+    """ Returns the system's release, e.g. '2.2.0' or 'NT'\r
+\r
+        An empty string is returned if the value cannot be determined.\r
+\r
+    """\r
+    return uname()[2]\r
+\r
+def version():\r
+\r
+    """ Returns the system's release version, e.g. '#3 on degas'\r
+\r
+        An empty string is returned if the value cannot be determined.\r
+\r
+    """\r
+    return uname()[3]\r
+\r
+def machine():\r
+\r
+    """ Returns the machine type, e.g. 'i386'\r
+\r
+        An empty string is returned if the value cannot be determined.\r
+\r
+    """\r
+    return uname()[4]\r
+\r
+def processor():\r
+\r
+    """ Returns the (true) processor name, e.g. 'amdk6'\r
+\r
+        An empty string is returned if the value cannot be\r
+        determined. Note that many platforms do not provide this\r
+        information or simply return the same value as for machine(),\r
+        e.g.  NetBSD does this.\r
+\r
+    """\r
+    return uname()[5]\r
+\r
+### Various APIs for extracting information from sys.version\r
+\r
+_sys_version_parser = re.compile(\r
+    r'([\w.+]+)\s*'\r
+    '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'\r
+    '\[([^\]]+)\]?')\r
+\r
+_ironpython_sys_version_parser = re.compile(\r
+    r'IronPython\s*'\r
+    '([\d\.]+)'\r
+    '(?: \(([\d\.]+)\))?'\r
+    ' on (.NET [\d\.]+)')\r
+\r
+# IronPython covering 2.6 and 2.7\r
+_ironpython26_sys_version_parser = re.compile(\r
+    r'([\d.]+)\s*'\r
+    '\(IronPython\s*'\r
+    '[\d.]+\s*'\r
+    '\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)'\r
+)\r
+\r
+_pypy_sys_version_parser = re.compile(\r
+    r'([\w.+]+)\s*'\r
+    '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'\r
+    '\[PyPy [^\]]+\]?')\r
+\r
+_sys_version_cache = {}\r
+\r
+def _sys_version(sys_version=None):\r
+\r
+    """ Returns a parsed version of Python's sys.version as tuple\r
+        (name, version, branch, revision, buildno, builddate, compiler)\r
+        referring to the Python implementation name, version, branch,\r
+        revision, build number, build date/time as string and the compiler\r
+        identification string.\r
+\r
+        Note that unlike the Python sys.version, the returned value\r
+        for the Python version will always include the patchlevel (it\r
+        defaults to '.0').\r
+\r
+        The function returns empty strings for tuple entries that\r
+        cannot be determined.\r
+\r
+        sys_version may be given to parse an alternative version\r
+        string, e.g. if the version was read from a different Python\r
+        interpreter.\r
+\r
+    """\r
+    # Get the Python version\r
+    if sys_version is None:\r
+        sys_version = sys.version\r
+\r
+    # Try the cache first\r
+    result = _sys_version_cache.get(sys_version, None)\r
+    if result is not None:\r
+        return result\r
+\r
+    # Parse it\r
+    if 'IronPython' in sys_version:\r
+        # IronPython\r
+        name = 'IronPython'\r
+        if sys_version.startswith('IronPython'):\r
+            match = _ironpython_sys_version_parser.match(sys_version)\r
+        else:\r
+            match = _ironpython26_sys_version_parser.match(sys_version)\r
+\r
+        if match is None:\r
+            raise ValueError(\r
+                'failed to parse IronPython sys.version: %s' %\r
+                repr(sys_version))\r
+\r
+        version, alt_version, compiler = match.groups()\r
+        buildno = ''\r
+        builddate = ''\r
+\r
+    elif sys.platform.startswith('java'):\r
+        # Jython\r
+        name = 'Jython'\r
+        match = _sys_version_parser.match(sys_version)\r
+        if match is None:\r
+            raise ValueError(\r
+                'failed to parse Jython sys.version: %s' %\r
+                repr(sys_version))\r
+        version, buildno, builddate, buildtime, _ = match.groups()\r
+        compiler = sys.platform\r
+\r
+    elif "PyPy" in sys_version:\r
+        # PyPy\r
+        name = "PyPy"\r
+        match = _pypy_sys_version_parser.match(sys_version)\r
+        if match is None:\r
+            raise ValueError("failed to parse PyPy sys.version: %s" %\r
+                             repr(sys_version))\r
+        version, buildno, builddate, buildtime = match.groups()\r
+        compiler = ""\r
+\r
+    else:\r
+        # CPython\r
+        match = _sys_version_parser.match(sys_version)\r
+        if match is None:\r
+            raise ValueError(\r
+                'failed to parse CPython sys.version: %s' %\r
+                repr(sys_version))\r
+        version, buildno, builddate, buildtime, compiler = \\r
+              match.groups()\r
+        name = 'CPython'\r
+        builddate = builddate + ' ' + buildtime\r
+\r
+    if hasattr(sys, 'subversion'):\r
+        # sys.subversion was added in Python 2.5\r
+        _, branch, revision = sys.subversion\r
+    else:\r
+        branch = ''\r
+        revision = ''\r
+\r
+    # Add the patchlevel version if missing\r
+    l = string.split(version, '.')\r
+    if len(l) == 2:\r
+        l.append('0')\r
+        version = string.join(l, '.')\r
+\r
+    # Build and cache the result\r
+    result = (name, version, branch, revision, buildno, builddate, compiler)\r
+    _sys_version_cache[sys_version] = result\r
+    return result\r
+\r
+def python_implementation():\r
+\r
+    """ Returns a string identifying the Python implementation.\r
+\r
+        Currently, the following implementations are identified:\r
+          'CPython' (C implementation of Python),\r
+          'IronPython' (.NET implementation of Python),\r
+          'Jython' (Java implementation of Python),\r
+          'PyPy' (Python implementation of Python).\r
+\r
+    """\r
+    return _sys_version()[0]\r
+\r
+def python_version():\r
+\r
+    """ Returns the Python version as string 'major.minor.patchlevel'\r
+\r
+        Note that unlike the Python sys.version, the returned value\r
+        will always include the patchlevel (it defaults to 0).\r
+\r
+    """\r
+    return _sys_version()[1]\r
+\r
+def python_version_tuple():\r
+\r
+    """ Returns the Python version as tuple (major, minor, patchlevel)\r
+        of strings.\r
+\r
+        Note that unlike the Python sys.version, the returned value\r
+        will always include the patchlevel (it defaults to 0).\r
+\r
+    """\r
+    return tuple(string.split(_sys_version()[1], '.'))\r
+\r
+def python_branch():\r
+\r
+    """ Returns a string identifying the Python implementation\r
+        branch.\r
+\r
+        For CPython this is the Subversion branch from which the\r
+        Python binary was built.\r
+\r
+        If not available, an empty string is returned.\r
+\r
+    """\r
+\r
+    return _sys_version()[2]\r
+\r
+def python_revision():\r
+\r
+    """ Returns a string identifying the Python implementation\r
+        revision.\r
+\r
+        For CPython this is the Subversion revision from which the\r
+        Python binary was built.\r
+\r
+        If not available, an empty string is returned.\r
+\r
+    """\r
+    return _sys_version()[3]\r
+\r
+def python_build():\r
+\r
+    """ Returns a tuple (buildno, builddate) stating the Python\r
+        build number and date as strings.\r
+\r
+    """\r
+    return _sys_version()[4:6]\r
+\r
+def python_compiler():\r
+\r
+    """ Returns a string identifying the compiler used for compiling\r
+        Python.\r
+\r
+    """\r
+    return _sys_version()[6]\r
+\r
+### The Opus Magnum of platform strings :-)\r
+\r
+_platform_cache = {}\r
+\r
+def platform(aliased=0, terse=0):\r
+\r
+    """ Returns a single string identifying the underlying platform\r
+        with as much useful information as possible (but no more :).\r
+\r
+        The output is intended to be human readable rather than\r
+        machine parseable. It may look different on different\r
+        platforms and this is intended.\r
+\r
+        If "aliased" is true, the function will use aliases for\r
+        various platforms that report system names which differ from\r
+        their common names, e.g. SunOS will be reported as\r
+        Solaris. The system_alias() function is used to implement\r
+        this.\r
+\r
+        Setting terse to true causes the function to return only the\r
+        absolute minimum information needed to identify the platform.\r
+\r
+    """\r
+    result = _platform_cache.get((aliased, terse), None)\r
+    if result is not None:\r
+        return result\r
+\r
+    # Get uname information and then apply platform specific cosmetics\r
+    # to it...\r
+    system,node,release,version,machine,processor = uname()\r
+    if machine == processor:\r
+        processor = ''\r
+    if aliased:\r
+        system,release,version = system_alias(system,release,version)\r
+\r
+    if system == 'Windows':\r
+        # MS platforms\r
+        rel,vers,csd,ptype = win32_ver(version)\r
+        if terse:\r
+            platform = _platform(system,release)\r
+        else:\r
+            platform = _platform(system,release,version,csd)\r
+\r
+    elif system in ('Linux',):\r
+        # Linux based systems\r
+        distname,distversion,distid = dist('')\r
+        if distname and not terse:\r
+            platform = _platform(system,release,machine,processor,\r
+                                 'with',\r
+                                 distname,distversion,distid)\r
+        else:\r
+            # If the distribution name is unknown check for libc vs. glibc\r
+            libcname,libcversion = libc_ver(sys.executable)\r
+            platform = _platform(system,release,machine,processor,\r
+                                 'with',\r
+                                 libcname+libcversion)\r
+    elif system == 'Java':\r
+        # Java platforms\r
+        r,v,vminfo,(os_name,os_version,os_arch) = java_ver()\r
+        if terse or not os_name:\r
+            platform = _platform(system,release,version)\r
+        else:\r
+            platform = _platform(system,release,version,\r
+                                 'on',\r
+                                 os_name,os_version,os_arch)\r
+\r
+    elif system == 'MacOS':\r
+        # MacOS platforms\r
+        if terse:\r
+            platform = _platform(system,release)\r
+        else:\r
+            platform = _platform(system,release,machine)\r
+\r
+    else:\r
+        # Generic handler\r
+        if terse:\r
+            platform = _platform(system,release)\r
+        else:\r
+            bits,linkage = architecture(sys.executable)\r
+            platform = _platform(system,release,machine,processor,bits,linkage)\r
+\r
+    _platform_cache[(aliased, terse)] = platform\r
+    return platform\r
+\r
+### Command line interface\r
+\r
+if __name__ == '__main__':\r
+    # Default is to print the aliased verbose platform string\r
+    terse = ('terse' in sys.argv or '--terse' in sys.argv)\r
+    aliased = (not 'nonaliased' in sys.argv and not '--nonaliased' in sys.argv)\r
+    print platform(aliased,terse)\r
+    sys.exit(0)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/topics.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/topics.py
new file mode 100644 (file)
index 0000000..b6744d8
--- /dev/null
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-\r
+# Autogenerated by Sphinx on Sun May 10 13:12:18 2015\r
+topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n   assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n   if __debug__:\n      if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n   if __debug__:\n      if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names.  In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O).  The current code generator emits no code for an\nassert statement when optimization is requested at compile time.  Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal.  The value for the built-in\nvariable is determined when the interpreter starts.\n',\r
+ 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n   assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n   target_list     ::= target ("," target)* [","]\n   target          ::= identifier\n              | "(" target_list ")"\n              | "[" target_list "]"\n              | attributeref\n              | subscription\n              | slicing\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable.  The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section The standard type\nhierarchy).\n\nAssignment of an object to a target list is recursively defined as\nfollows.\n\n* If the target list is a single target: The object is assigned to\n  that target.\n\n* If the target list is a comma-separated list of targets: The\n  object must be an iterable with the same number of items as there\n  are targets in the target list, and the items are assigned, from\n  left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n  * If the name does not occur in a "global" statement in the\n    current code block: the name is bound to the object in the current\n    local namespace.\n\n  * Otherwise: the name is bound to the object in the current global\n    namespace.\n\n  The name is rebound if it was already bound.  This may cause the\n  reference count for the object previously bound to the name to reach\n  zero, causing the object to be deallocated and its destructor (if it\n  has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in\n  square brackets: The object must be an iterable with the same number\n  of items as there are targets in the target list, and its items are\n  assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n  the reference is evaluated.  It should yield an object with\n  assignable attributes; if this is not the case, "TypeError" is\n  raised.  That object is then asked to assign the assigned object to\n  the given attribute; if it cannot perform the assignment, it raises\n  an exception (usually but not necessarily "AttributeError").\n\n  Note: If the object is a class instance and the attribute reference\n  occurs on both sides of the assignment operator, the RHS expression,\n  "a.x" can access either an instance attribute or (if no instance\n  attribute exists) a class attribute.  The LHS target "a.x" is always\n  set as an instance attribute, creating it if necessary.  Thus, the\n  two occurrences of "a.x" do not necessarily refer to the same\n  attribute: if the RHS expression refers to a class attribute, the\n  LHS creates a new instance attribute as the target of the\n  assignment:\n\n     class Cls:\n         x = 3             # class variable\n     inst = Cls()\n     inst.x = inst.x + 1   # writes inst.x as 4 leaving Cls.x as 3\n\n  This description does not necessarily apply to descriptor\n  attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n  reference is evaluated.  It should yield either a mutable sequence\n  object (such as a list) or a mapping object (such as a dictionary).\n  Next, the subscript expression is evaluated.\n\n  If the primary is a mutable sequence object (such as a list), the\n  subscript must yield a plain integer.  If it is negative, the\n  sequence\'s length is added to it. The resulting value must be a\n  nonnegative integer less than the sequence\'s length, and the\n  sequence is asked to assign the assigned object to its item with\n  that index.  If the index is out of range, "IndexError" is raised\n  (assignment to a subscripted sequence cannot add new items to a\n  list).\n\n  If the primary is a mapping object (such as a dictionary), the\n  subscript must have a type compatible with the mapping\'s key type,\n  and the mapping is then asked to create a key/datum pair which maps\n  the subscript to the assigned object.  This can either replace an\n  existing key/value pair with the same key value, or insert a new\n  key/value pair (if no key with the same value existed).\n\n* If the target is a slicing: The primary expression in the\n  reference is evaluated.  It should yield a mutable sequence object\n  (such as a list).  The assigned object should be a sequence object\n  of the same type.  Next, the lower and upper bound expressions are\n  evaluated, insofar they are present; defaults are zero and the\n  sequence\'s length.  The bounds should evaluate to (small) integers.\n  If either bound is negative, the sequence\'s length is added to it.\n  The resulting bounds are clipped to lie between zero and the\n  sequence\'s length, inclusive.  Finally, the sequence object is asked\n  to replace the slice with the items of the assigned sequence.  The\n  length of the slice may be different from the length of the assigned\n  sequence, thus changing the length of the target sequence, if the\n  object allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are \'safe\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe!  For instance, the\nfollowing program prints "[0, 2]":\n\n   x = [0, 1]\n   i = 0\n   i, x[i] = 1, 2\n   print x\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n   augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n   augtarget                 ::= identifier | attributeref | subscription | slicing\n   augop                     ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n             | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same caveat about\nclass and instance attributes applies as for regular assignments.\n',\r
+ 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name.  See section Identifiers\nand keywords for lexical definition and section Naming and binding for\ndocumentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them.  The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name.  For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used.  If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n',\r
+ 'atom-literals': u"\nLiterals\n********\n\nPython supports string literals and various numeric literals:\n\n   literal ::= stringliteral | integer | longinteger\n               | floatnumber | imagnumber\n\nEvaluation of a literal yields an object of the given type (string,\ninteger, long integer, floating point number, complex number) with the\ngiven value.  The value may be approximated in the case of floating\npoint and imaginary (complex) literals.  See section Literals for\ndetails.\n\nAll literals correspond to immutable data types, and hence the\nobject's identity is less important than its value.  Multiple\nevaluations of literals with the same value (either the same\noccurrence in the program text or a different occurrence) may obtain\nthe same object or a different object with the same value.\n",\r
+ 'attribute-access': u'\nCustomizing attribute access\n****************************\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n   Called when an attribute lookup has not found the attribute in the\n   usual places (i.e. it is not an instance attribute nor is it found\n   in the class tree for "self").  "name" is the attribute name. This\n   method should return the (computed) attribute value or raise an\n   "AttributeError" exception.\n\n   Note that if the attribute is found through the normal mechanism,\n   "__getattr__()" is not called.  (This is an intentional asymmetry\n   between "__getattr__()" and "__setattr__()".) This is done both for\n   efficiency reasons and because otherwise "__getattr__()" would have\n   no way to access other attributes of the instance.  Note that at\n   least for instance variables, you can fake total control by not\n   inserting any values in the instance attribute dictionary (but\n   instead inserting them in another object).  See the\n   "__getattribute__()" method below for a way to actually get total\n   control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n   Called when an attribute assignment is attempted.  This is called\n   instead of the normal mechanism (i.e. store the value in the\n   instance dictionary).  *name* is the attribute name, *value* is the\n   value to be assigned to it.\n\n   If "__setattr__()" wants to assign to an instance attribute, it\n   should not simply execute "self.name = value" --- this would cause\n   a recursive call to itself.  Instead, it should insert the value in\n   the dictionary of instance attributes, e.g., "self.__dict__[name] =\n   value".  For new-style classes, rather than accessing the instance\n   dictionary, it should call the base class method with the same\n   name, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n   Like "__setattr__()" but for attribute deletion instead of\n   assignment.  This should only be implemented if "del obj.name" is\n   meaningful for the object.\n\n\nMore attribute access for new-style classes\n===========================================\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n   Called unconditionally to implement attribute accesses for\n   instances of the class. If the class also defines "__getattr__()",\n   the latter will not be called unless "__getattribute__()" either\n   calls it explicitly or raises an "AttributeError". This method\n   should return the (computed) attribute value or raise an\n   "AttributeError" exception. In order to avoid infinite recursion in\n   this method, its implementation should always call the base class\n   method with the same name to access any attributes it needs, for\n   example, "object.__getattribute__(self, name)".\n\n   Note: This method may still be bypassed when looking up special\n     methods as the result of implicit invocation via language syntax\n     or built-in functions. See Special method lookup for new-style\n     classes.\n\n\nImplementing Descriptors\n========================\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents).  In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n   Called to get the attribute of the owner class (class attribute\n   access) or of an instance of that class (instance attribute\n   access). *owner* is always the owner class, while *instance* is the\n   instance that the attribute was accessed through, or "None" when\n   the attribute is accessed through the *owner*.  This method should\n   return the (computed) attribute value or raise an "AttributeError"\n   exception.\n\nobject.__set__(self, instance, value)\n\n   Called to set the attribute on an instance *instance* of the owner\n   class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n   Called to delete the attribute on an instance *instance* of the\n   owner class.\n\n\nInvoking Descriptors\n====================\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol:  "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead.  Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.  Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass "object()" or "type()").\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n   The simplest and least common call is when user code directly\n   invokes a descriptor method:    "x.__get__(a)".\n\nInstance Binding\n   If binding to a new-style object instance, "a.x" is transformed\n   into the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n   If binding to a new-style class, "A.x" is transformed into the\n   call: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n   If "a" is an instance of "super", then the binding "super(B,\n   obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n   immediately preceding "B" and then invokes the descriptor with the\n   call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined.  A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()".  If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary.  If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor.  Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method.  Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary.  In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors.  Accordingly, instances can\nredefine and override methods.  This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n=========\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage.  This wastes space for objects\nhaving very few instance variables.  The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition.  The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable.  Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n   This class variable can be assigned a string, iterable, or sequence\n   of strings with variable names used by instances.  If defined in a\n   new-style class, *__slots__* reserves space for the declared\n   variables and prevents the automatic creation of *__dict__* and\n   *__weakref__* for each instance.\n\n   New in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n  attribute of that class will always be accessible, so a *__slots__*\n  definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n  variables not listed in the *__slots__* definition.  Attempts to\n  assign to an unlisted variable name raises "AttributeError". If\n  dynamic assignment of new variables is desired, then add\n  "\'__dict__\'" to the sequence of strings in the *__slots__*\n  declaration.\n\n  Changed in version 2.3: Previously, adding "\'__dict__\'" to the\n  *__slots__* declaration would not enable the assignment of new\n  attributes not specifically listed in the sequence of instance\n  variable names.\n\n* Without a *__weakref__* variable for each instance, classes\n  defining *__slots__* do not support weak references to its\n  instances. If weak reference support is needed, then add\n  "\'__weakref__\'" to the sequence of strings in the *__slots__*\n  declaration.\n\n  Changed in version 2.3: Previously, adding "\'__weakref__\'" to the\n  *__slots__* declaration would not enable support for weak\n  references.\n\n* *__slots__* are implemented at the class level by creating\n  descriptors (Implementing Descriptors) for each variable name.  As a\n  result, class attributes cannot be used to set default values for\n  instance variables defined by *__slots__*; otherwise, the class\n  attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n  where it is defined.  As a result, subclasses will have a *__dict__*\n  unless they also define *__slots__* (which must only contain names\n  of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n  instance variable defined by the base class slot is inaccessible\n  (except by retrieving its descriptor directly from the base class).\n  This renders the meaning of the program undefined.  In the future, a\n  check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n  "variable-length" built-in types such as "long", "str" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n  may also be used; however, in the future, special meaning may be\n  assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n  *__slots__*.\n\n  Changed in version 2.6: Previously, *__class__* assignment raised an\n  error if either new or old class had *__slots__*.\n',\r
+ 'attribute-references': u'\nAttribute references\n********************\n\nAn attribute reference is a primary followed by a period and a name:\n\n   attributeref ::= primary "." identifier\n\nThe primary must evaluate to an object of a type that supports\nattribute references, e.g., a module, list, or an instance.  This\nobject is then asked to produce the attribute whose name is the\nidentifier.  If this attribute is not available, the exception\n"AttributeError" is raised. Otherwise, the type and value of the\nobject produced is determined by the object.  Multiple evaluations of\nthe same attribute reference may yield different objects.\n',\r
+ 'augassign': u'\nAugmented assignment statements\n*******************************\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n   augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n   augtarget                 ::= identifier | attributeref | subscription | slicing\n   augop                     ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n             | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same caveat about\nclass and instance attributes applies as for regular assignments.\n',\r
+ 'binary': u'\nBinary arithmetic operations\n****************************\n\nThe binary arithmetic operations have the conventional priority\nlevels.  Note that some of these operations also apply to certain non-\nnumeric types.  Apart from the power operator, there are only two\nlevels, one for multiplicative operators and one for additive\noperators:\n\n   m_expr ::= u_expr | m_expr "*" u_expr | m_expr "//" u_expr | m_expr "/" u_expr\n              | m_expr "%" u_expr\n   a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n\nThe "*" (multiplication) operator yields the product of its arguments.\nThe arguments must either both be numbers, or one argument must be an\ninteger (plain or long) and the other must be a sequence. In the\nformer case, the numbers are converted to a common type and then\nmultiplied together.  In the latter case, sequence repetition is\nperformed; a negative repetition factor yields an empty sequence.\n\nThe "/" (division) and "//" (floor division) operators yield the\nquotient of their arguments.  The numeric arguments are first\nconverted to a common type. Plain or long integer division yields an\ninteger of the same type; the result is that of mathematical division\nwith the \'floor\' function applied to the result. Division by zero\nraises the "ZeroDivisionError" exception.\n\nThe "%" (modulo) operator yields the remainder from the division of\nthe first argument by the second.  The numeric arguments are first\nconverted to a common type.  A zero right argument raises the\n"ZeroDivisionError" exception.  The arguments may be floating point\nnumbers, e.g., "3.14%0.7" equals "0.34" (since "3.14" equals "4*0.7 +\n0.34".)  The modulo operator always yields a result with the same sign\nas its second operand (or zero); the absolute value of the result is\nstrictly smaller than the absolute value of the second operand [2].\n\nThe integer division and modulo operators are connected by the\nfollowing identity: "x == (x/y)*y + (x%y)".  Integer division and\nmodulo are also connected with the built-in function "divmod()":\n"divmod(x, y) == (x/y, x%y)".  These identities don\'t hold for\nfloating point numbers; there similar identities hold approximately\nwhere "x/y" is replaced by "floor(x/y)" or "floor(x/y) - 1" [3].\n\nIn addition to performing the modulo operation on numbers, the "%"\noperator is also overloaded by string and unicode objects to perform\nstring formatting (also known as interpolation). The syntax for string\nformatting is described in the Python Library Reference, section\nString Formatting Operations.\n\nDeprecated since version 2.3: The floor division operator, the modulo\noperator, and the "divmod()" function are no longer defined for\ncomplex numbers.  Instead, convert to a floating point number using\nthe "abs()" function if appropriate.\n\nThe "+" (addition) operator yields the sum of its arguments. The\narguments must either both be numbers or both sequences of the same\ntype.  In the former case, the numbers are converted to a common type\nand then added together.  In the latter case, the sequences are\nconcatenated.\n\nThe "-" (subtraction) operator yields the difference of its arguments.\nThe numeric arguments are first converted to a common type.\n',\r
+ 'bitwise': u'\nBinary bitwise operations\n*************************\n\nEach of the three bitwise operations has a different priority level:\n\n   and_expr ::= shift_expr | and_expr "&" shift_expr\n   xor_expr ::= and_expr | xor_expr "^" and_expr\n   or_expr  ::= xor_expr | or_expr "|" xor_expr\n\nThe "&" operator yields the bitwise AND of its arguments, which must\nbe plain or long integers.  The arguments are converted to a common\ntype.\n\nThe "^" operator yields the bitwise XOR (exclusive OR) of its\narguments, which must be plain or long integers.  The arguments are\nconverted to a common type.\n\nThe "|" operator yields the bitwise (inclusive) OR of its arguments,\nwhich must be plain or long integers.  The arguments are converted to\na common type.\n',\r
+ 'bltin-code-objects': u'\nCode Objects\n************\n\nCode objects are used by the implementation to represent "pseudo-\ncompiled" executable Python code such as a function body. They differ\nfrom function objects because they don\'t contain a reference to their\nglobal execution environment.  Code objects are returned by the built-\nin "compile()" function and can be extracted from function objects\nthrough their "func_code" attribute. See also the "code" module.\n\nA code object can be executed or evaluated by passing it (instead of a\nsource string) to the "exec" statement or the built-in "eval()"\nfunction.\n\nSee The standard type hierarchy for more information.\n',\r
+ 'bltin-ellipsis-object': u'\nThe Ellipsis Object\n*******************\n\nThis object is used by extended slice notation (see Slicings).  It\nsupports no special operations.  There is exactly one ellipsis object,\nnamed "Ellipsis" (a built-in name).\n\nIt is written as "Ellipsis".  When in a subscript, it can also be\nwritten as "...", for example "seq[...]".\n',\r
+ 'bltin-null-object': u'\nThe Null Object\n***************\n\nThis object is returned by functions that don\'t explicitly return a\nvalue.  It supports no special operations.  There is exactly one null\nobject, named "None" (a built-in name).\n\nIt is written as "None".\n',\r
+ 'bltin-type-objects': u'\nType Objects\n************\n\nType objects represent the various object types.  An object\'s type is\naccessed by the built-in function "type()".  There are no special\noperations on types.  The standard module "types" defines names for\nall standard built-in types.\n\nTypes are written like this: "<type \'int\'>".\n',\r
+ 'booleans': u'\nBoolean operations\n******************\n\n   or_test  ::= and_test | or_test "or" and_test\n   and_test ::= not_test | and_test "and" not_test\n   not_test ::= comparison | "not" not_test\n\nIn the context of Boolean operations, and also when expressions are\nused by control flow statements, the following values are interpreted\nas false: "False", "None", numeric zero of all types, and empty\nstrings and containers (including strings, tuples, lists,\ndictionaries, sets and frozensets).  All other values are interpreted\nas true.  (See the "__nonzero__()" special method for a way to change\nthis.)\n\nThe operator "not" yields "True" if its argument is false, "False"\notherwise.\n\nThe expression "x and y" first evaluates *x*; if *x* is false, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\nThe expression "x or y" first evaluates *x*; if *x* is true, its value\nis returned; otherwise, *y* is evaluated and the resulting value is\nreturned.\n\n(Note that neither "and" nor "or" restrict the value and type they\nreturn to "False" and "True", but rather return the last evaluated\nargument. This is sometimes useful, e.g., if "s" is a string that\nshould be replaced by a default value if it is empty, the expression\n"s or \'foo\'" yields the desired value.  Because "not" has to invent a\nvalue anyway, it does not bother to return a value of the same type as\nits argument, so e.g., "not \'foo\'" yields "False", not "\'\'".)\n',\r
+ 'break': u'\nThe "break" statement\n*********************\n\n   break_stmt ::= "break"\n\n"break" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition within that\nloop.\n\nIt terminates the nearest enclosing loop, skipping the optional "else"\nclause if the loop has one.\n\nIf a "for" loop is terminated by "break", the loop control target\nkeeps its current value.\n\nWhen "break" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nloop.\n',\r
+ 'callable-types': u'\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n   Called when the instance is "called" as a function; if this method\n   is defined, "x(arg1, arg2, ...)" is a shorthand for\n   "x.__call__(arg1, arg2, ...)".\n',\r
+ 'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\n   call                 ::= primary "(" [argument_list [","]\n            | expression genexpr_for] ")"\n   argument_list        ::= positional_arguments ["," keyword_arguments]\n                       ["," "*" expression] ["," keyword_arguments]\n                       ["," "**" expression]\n                     | keyword_arguments ["," "*" expression]\n                       ["," "**" expression]\n                     | "*" expression ["," keyword_arguments] ["," "**" expression]\n                     | "**" expression\n   positional_arguments ::= expression ("," expression)*\n   keyword_arguments    ::= keyword_item ("," keyword_item)*\n   keyword_item         ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and certain class instances\nthemselves are callable; extensions may define additional callable\nobject types).  All argument expressions are evaluated before the call\nis attempted.  Please refer to section Function definitions for the\nsyntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows.  First, a list of unfilled slots is\ncreated for the formal parameters.  If there are N positional\narguments, they are placed in the first N slots.  Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on).  If the slot is\nalready filled, a "TypeError" exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is "None", it fills the slot).  When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition.  (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.)  If there are any\nunfilled slots for which no default value is specified, a "TypeError"\nexception is raised.  Otherwise, the list of filled slots is used as\nthe argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword.  In CPython, this is the case\nfor functions implemented in C that use "PyArg_ParseTuple()" to parse\ntheir arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "*identifier" is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "**identifier" is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax "*expression" appears in the function call, "expression"\nmust evaluate to an iterable.  Elements from this iterable are treated\nas if they were additional positional arguments; if there are\npositional arguments *x1*, ..., *xN*, and "expression" evaluates to a\nsequence *y1*, ..., *yM*, this is equivalent to a call with M+N\npositional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the "*expression" syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the "**expression" argument, if any -- see\nbelow).  So:\n\n   >>> def f(a, b):\n   ...  print a, b\n   ...\n   >>> f(b=1, *(2,))\n   2 1\n   >>> f(a=1, *(2,))\n   Traceback (most recent call last):\n     File "<stdin>", line 1, in ?\n   TypeError: f() got multiple values for keyword argument \'a\'\n   >>> f(1, *(2,))\n   1 2\n\nIt is unusual for both keyword arguments and the "*expression" syntax\nto be used in the same call, so in practice this confusion does not\narise.\n\nIf the syntax "**expression" appears in the function call,\n"expression" must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments.  In the case of a keyword\nappearing in both "expression" and as an explicit keyword argument, a\n"TypeError" exception is raised.\n\nFormal parameters using the syntax "*identifier" or "**identifier"\ncannot be used as positional argument slots or as keyword argument\nnames.  Formal parameters using the syntax "(sublist)" cannot be used\nas keyword argument names; the outermost sublist corresponds to a\nsingle unnamed argument slot, and the argument value is assigned to\nthe sublist using the usual tuple assignment rules after all other\nparameter processing is done.\n\nA call always returns some value, possibly "None", unless it raises an\nexception.  How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n   The code block for the function is executed, passing it the\n   argument list.  The first thing the code block will do is bind the\n   formal parameters to the arguments; this is described in section\n   Function definitions.  When the code block executes a "return"\n   statement, this specifies the return value of the function call.\n\na built-in function or method:\n   The result is up to the interpreter; see Built-in Functions for the\n   descriptions of built-in functions and methods.\n\na class object:\n   A new instance of that class is returned.\n\na class instance method:\n   The corresponding user-defined function is called, with an argument\n   list that is one longer than the argument list of the call: the\n   instance becomes the first argument.\n\na class instance:\n   The class must define a "__call__()" method; the effect is then the\n   same as if that method was called.\n',\r
+ 'class': u'\nClass definitions\n*****************\n\nA class definition defines a class object (see section The standard\ntype hierarchy):\n\n   classdef    ::= "class" classname [inheritance] ":" suite\n   inheritance ::= "(" [expression_list] ")"\n   classname   ::= identifier\n\nA class definition is an executable statement.  It first evaluates the\ninheritance list, if present.  Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing.  The class\'s suite is then executed in a new execution\nframe (see section Naming and binding), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.)  When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary.  The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances.  To create instance\nvariables, they can be set in a method with "self.name = value".  Both\nclass and instance variables are accessible through the notation\n""self.name"", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results.  For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions.  The evaluation rules for the decorator\nexpressions are the same as for functions.  The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n    there is a "finally" clause which happens to raise another\n    exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n    an exception or the execution of a "return", "continue", or\n    "break" statement.\n\n[3] A string literal appearing as the first statement in the\n    function body is transformed into the function\'s "__doc__"\n    attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n    body is transformed into the namespace\'s "__doc__" item and\n    therefore the class\'s *docstring*.\n',\r
+ 'comparisons': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation.  Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n   comparison    ::= or_expr ( comp_operator or_expr )*\n   comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n                     | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe forms "<>" and "!=" are equivalent; for consistency with C, "!="\nis preferred; where "!=" is mentioned below "<>" is also accepted.\nThe "<>" spelling is considered obsolescent.\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects.  The objects need not have the same type. If both are\nnumbers, they are converted to a common type.  Otherwise, objects of\ndifferent types *always* compare unequal, and are ordered consistently\nbut arbitrarily. You can control comparison behavior of objects of\nnon-built-in types by defining a "__cmp__" method or rich comparison\nmethods like "__gt__", described in section Special method names.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the "in" and "not in"\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric\n  equivalents (the result of the built-in function "ord()") of their\n  characters. Unicode and 8-bit strings are fully interoperable in\n  this behavior. [4]\n\n* Tuples and lists are compared lexicographically using comparison\n  of corresponding elements.  This means that to compare equal, each\n  element must compare equal and the two sequences must be of the same\n  type and have the same length.\n\n  If not equal, the sequences are ordered the same as their first\n  differing elements.  For example, "cmp([1,2,x], [1,2,y])" returns\n  the same as "cmp(x,y)".  If the corresponding element does not\n  exist, the shorter sequence is ordered first (for example, "[1,2] <\n  [1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n  (key, value) lists compare equal. [5] Outcomes other than equality\n  are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they\n  are the same object; the choice whether one object is considered\n  smaller or larger than another one is made arbitrarily but\n  consistently within one execution of a program.\n\nThe operators "in" and "not in" test for collection membership.  "x in\ns" evaluates to true if *x* is a member of the collection *s*, and\nfalse otherwise.  "x not in s" returns the negation of "x in s". The\ncollection membership test has traditionally been bound to sequences;\nan object is a member of a collection if the collection is a sequence\nand contains an element equal to that object.  However, it make sense\nfor many other object types to support membership tests without being\na sequence.  In particular, dictionaries (for keys) and sets support\nmembership testing.\n\nFor the list and tuple types, "x in y" is true if and only if there\nexists an index *i* such that "x == y[i]" is true.\n\nFor the Unicode and string types, "x in y" is true if and only if *x*\nis a substring of *y*.  An equivalent test is "y.find(x) != -1".\nNote, *x* and *y* need not be the same type; consequently, "u\'ab\' in\n\'abc\'" will return "True". Empty strings are always considered to be a\nsubstring of any other string, so """ in "abc"" will return "True".\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength "1".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y".  If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object.  "x is not y"\nyields the inverse truth value. [7]\n',\r
+ 'compound': u'\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way.  In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe "if", "while" and "for" statements implement traditional control\nflow constructs.  "try" specifies exception handlers and/or cleanup\ncode for a group of statements.  Function and class definitions are\nalso syntactically compound statements.\n\nCompound statements consist of one or more \'clauses.\'  A clause\nconsists of a header and a \'suite.\'  The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon.  A suite is a group of statements controlled by a\nclause.  A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines.  Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which "if" clause a following "else" clause would belong:\n\n   if test1: if test2: print x\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n"print" statements are executed:\n\n   if x < y < z: print x; print y; print z\n\nSummarizing:\n\n   compound_stmt ::= if_stmt\n                     | while_stmt\n                     | for_stmt\n                     | try_stmt\n                     | with_stmt\n                     | funcdef\n                     | classdef\n                     | decorated\n   suite         ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n   statement     ::= stmt_list NEWLINE | compound_stmt\n   stmt_list     ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a "NEWLINE" possibly followed by a\n"DEDENT". Also note that optional continuation clauses always begin\nwith a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling "else"\' problem is solved in Python by\nrequiring nested "if" statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe "if" statement\n==================\n\nThe "if" statement is used for conditional execution:\n\n   if_stmt ::= "if" expression ":" suite\n               ( "elif" expression ":" suite )*\n               ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n\n\nThe "while" statement\n=====================\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n   while_stmt ::= "while" expression ":" suite\n                  ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite.  A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n\n\nThe "for" statement\n===================\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n   for_stmt ::= "for" target_list "in" expression_list ":" suite\n                ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject.  An iterator is created for the result of the\n"expression_list".  The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices.  Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed.  When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite.  A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there was no next\nitem.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop.  Hint: the built-in function "range()" returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s "for i := a to b\ndo"; e.g., "range(3)" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n  loop (this can only occur for mutable sequences, i.e. lists). An\n  internal counter is used to keep track of which item is used next,\n  and this is incremented on each iteration.  When this counter has\n  reached the length of the sequence the loop terminates.  This means\n  that if the suite deletes the current (or a previous) item from the\n  sequence, the next item will be skipped (since it gets the index of\n  the current item which has already been treated).  Likewise, if the\n  suite inserts an item in the sequence before the current item, the\n  current item will be treated again the next time through the loop.\n  This can lead to nasty bugs that can be avoided by making a\n  temporary copy using a slice of the whole sequence, e.g.,\n\n     for x in a[:]:\n         if x < 0: a.remove(x)\n\n\nThe "try" statement\n===================\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n   try_stmt  ::= try1_stmt | try2_stmt\n   try1_stmt ::= "try" ":" suite\n                 ("except" [expression [("as" | ",") identifier]] ":" suite)+\n                 ["else" ":" suite]\n                 ["finally" ":" suite]\n   try2_stmt ::= "try" ":" suite\n                 "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n"try"..."except"..."finally" did not work. "try"..."except" had to be\nnested in "try"..."finally".\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started.  This search inspects the except clauses\nin turn until one is found that matches the exception.  An expression-\nless except clause, if present, must be last; it matches any\nexception.  For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception.  An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject, or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed.  All except clauses must have an\nexecutable block.  When the end of this block is reached, execution\ncontinues normally after the entire try statement.  (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the "sys" module:\n"sys.exc_type" receives the object identifying the exception;\n"sys.exc_value" receives the exception\'s parameter;\n"sys.exc_traceback" receives a traceback object (see section The\nstandard type hierarchy) identifying the point in the program where\nthe exception occurred. These details are also available through the\n"sys.exc_info()" function, which returns a tuple "(exc_type,\nexc_value, exc_traceback)".  Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program.  As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler.  The "try"\nclause is executed, including any "except" and "else" clauses.  If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed.  If\nthere is a saved exception, it is re-raised at the end of the\n"finally" clause. If the "finally" clause raises another exception or\nexecutes a "return" or "break" statement, the saved exception is\ndiscarded:\n\n   >>> def f():\n   ...     try:\n   ...         1/0\n   ...     finally:\n   ...         return 42\n   ...\n   >>> f()\n   42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed.  Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n   >>> def foo():\n   ...     try:\n   ...         return \'try\'\n   ...     finally:\n   ...         return \'finally\'\n   ...\n   >>> foo()\n   \'finally\'\n\nAdditional information on exceptions can be found in section\nExceptions, and information on using the "raise" statement to generate\nexceptions may be found in section The raise statement.\n\n\nThe "with" statement\n====================\n\nNew in version 2.5.\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section With Statement\nContext Managers). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n   with_stmt ::= "with" with_item ("," with_item)* ":" suite\n   with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n   is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n   value from "__enter__()" is assigned to it.\n\n   Note: The "with" statement guarantees that if the "__enter__()"\n     method returns without an error, then "__exit__()" will always be\n     called. Thus, if an error occurs during the assignment to the\n     target list, it will be treated the same as an error occurring\n     within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n   exception caused the suite to be exited, its type, value, and\n   traceback are passed as arguments to "__exit__()". Otherwise, three\n   "None" arguments are supplied.\n\n   If the suite was exited due to an exception, and the return value\n   from the "__exit__()" method was false, the exception is reraised.\n   If the return value was true, the exception is suppressed, and\n   execution continues with the statement following the "with"\n   statement.\n\n   If the suite was exited for any reason other than an exception, the\n   return value from "__exit__()" is ignored, and execution proceeds\n   at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n   with A() as a, B() as b:\n       suite\n\nis equivalent to\n\n   with A() as a:\n       with B() as b:\n           suite\n\nNote: In Python 2.5, the "with" statement is only allowed when the\n  "with_statement" feature has been enabled.  It is always enabled in\n  Python 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also: **PEP 0343** - The "with" statement\n\n     The specification, background, and examples for the Python "with"\n     statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection The standard type hierarchy):\n\n   decorated      ::= decorators (classdef | funcdef)\n   decorators     ::= decorator+\n   decorator      ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n   funcdef        ::= "def" funcname "(" [parameter_list] ")" ":" suite\n   dotted_name    ::= identifier ("." identifier)*\n   parameter_list ::= (defparameter ",")*\n                      (  "*" identifier ["," "**" identifier]\n                      | "**" identifier\n                      | defparameter [","] )\n   defparameter   ::= parameter ["=" expression]\n   sublist        ::= parameter ("," parameter)* [","]\n   parameter      ::= identifier | "(" sublist ")"\n   funcname       ::= identifier\n\nA function definition is an executable statement.  Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function).  This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition.  The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object.  Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n   @f1(arg)\n   @f2\n   def func(): pass\n\nis equivalent to:\n\n   def func(): pass\n   func = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted.  If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.**  This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call.  This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended.  A way around this  is to use "None" as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n   def whats_on_the_telly(penguin=None):\n       if penguin is None:\n           penguin = []\n       penguin.append("property of the zoo")\n       return penguin\n\nFunction call semantics are described in more detail in section Calls.\nA function call always assigns values to all parameters mentioned in\nthe parameter list, either from position arguments, from keyword\narguments, or from default values.  If the form ""*identifier"" is\npresent, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple.  If the form\n""**identifier"" is present, it is initialized to a new dictionary\nreceiving any excess keyword arguments, defaulting to a new empty\ndictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions.  This uses lambda\nexpressions, described in section Lambdas.  Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression.  The ""def"" form is actually more powerful since it\nallows the execution of multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects.  A ""def""\nform executed inside a function definition defines a local function\nthat can be returned or passed around.  Free variables used in the\nnested function can access the local variables of the function\ncontaining the def.  See section Naming and binding for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section The standard\ntype hierarchy):\n\n   classdef    ::= "class" classname [inheritance] ":" suite\n   inheritance ::= "(" [expression_list] ")"\n   classname   ::= identifier\n\nA class definition is an executable statement.  It first evaluates the\ninheritance list, if present.  Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing.  The class\'s suite is then executed in a new execution\nframe (see section Naming and binding), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.)  When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary.  The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances.  To create instance\nvariables, they can be set in a method with "self.name = value".  Both\nclass and instance variables are accessible through the notation\n""self.name"", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results.  For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions.  The evaluation rules for the decorator\nexpressions are the same as for functions.  The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n    there is a "finally" clause which happens to raise another\n    exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n    an exception or the execution of a "return", "continue", or\n    "break" statement.\n\n[3] A string literal appearing as the first statement in the\n    function body is transformed into the function\'s "__doc__"\n    attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n    body is transformed into the namespace\'s "__doc__" item and\n    therefore the class\'s *docstring*.\n',\r
+ 'context-managers': u'\nWith Statement Context Managers\n*******************************\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code.  Context managers are normally\ninvoked using the "with" statement (described in section The with\nstatement), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see Context Manager Types.\n\nobject.__enter__(self)\n\n   Enter the runtime context related to this object. The "with"\n   statement will bind this method\'s return value to the target(s)\n   specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n   Exit the runtime context related to this object. The parameters\n   describe the exception that caused the context to be exited. If the\n   context was exited without an exception, all three arguments will\n   be "None".\n\n   If an exception is supplied, and the method wishes to suppress the\n   exception (i.e., prevent it from being propagated), it should\n   return a true value. Otherwise, the exception will be processed\n   normally upon exit from this method.\n\n   Note that "__exit__()" methods should not reraise the passed-in\n   exception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\n     The specification, background, and examples for the Python "with"\n     statement.\n',\r
+ 'continue': u'\nThe "continue" statement\n************************\n\n   continue_stmt ::= "continue"\n\n"continue" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition or "finally"\nclause within that loop.  It continues with the next cycle of the\nnearest enclosing loop.\n\nWhen "continue" passes control out of a "try" statement with a\n"finally" clause, that "finally" clause is executed before really\nstarting the next loop cycle.\n',\r
+ 'conversions': u'\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," the arguments\nare coerced using the coercion rules listed at  Coercion rules.  If\nboth arguments are standard numeric types, the following coercions are\napplied:\n\n* If either argument is a complex number, the other is converted to\n  complex;\n\n* otherwise, if either argument is a floating point number, the\n  other is converted to floating point;\n\n* otherwise, if either argument is a long integer, the other is\n  converted to long integer;\n\n* otherwise, both must be plain integers and no conversion is\n  necessary.\n\nSome additional rules apply for certain operators (e.g., a string left\nargument to the \'%\' operator). Extensions can define their own\ncoercions.\n',\r
+ 'customization': u'\nBasic customization\n*******************\n\nobject.__new__(cls[, ...])\n\n   Called to create a new instance of class *cls*.  "__new__()" is a\n   static method (special-cased so you need not declare it as such)\n   that takes the class of which an instance was requested as its\n   first argument.  The remaining arguments are those passed to the\n   object constructor expression (the call to the class).  The return\n   value of "__new__()" should be the new object instance (usually an\n   instance of *cls*).\n\n   Typical implementations create a new instance of the class by\n   invoking the superclass\'s "__new__()" method using\n   "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n   arguments and then modifying the newly-created instance as\n   necessary before returning it.\n\n   If "__new__()" returns an instance of *cls*, then the new\n   instance\'s "__init__()" method will be invoked like\n   "__init__(self[, ...])", where *self* is the new instance and the\n   remaining arguments are the same as were passed to "__new__()".\n\n   If "__new__()" does not return an instance of *cls*, then the new\n   instance\'s "__init__()" method will not be invoked.\n\n   "__new__()" is intended mainly to allow subclasses of immutable\n   types (like int, str, or tuple) to customize instance creation.  It\n   is also commonly overridden in custom metaclasses in order to\n   customize class creation.\n\nobject.__init__(self[, ...])\n\n   Called after the instance has been created (by "__new__()"), but\n   before it is returned to the caller.  The arguments are those\n   passed to the class constructor expression.  If a base class has an\n   "__init__()" method, the derived class\'s "__init__()" method, if\n   any, must explicitly call it to ensure proper initialization of the\n   base class part of the instance; for example:\n   "BaseClass.__init__(self, [args...])".\n\n   Because "__new__()" and "__init__()" work together in constructing\n   objects ("__new__()" to create it, and "__init__()" to customise\n   it), no non-"None" value may be returned by "__init__()"; doing so\n   will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n   Called when the instance is about to be destroyed.  This is also\n   called a destructor.  If a base class has a "__del__()" method, the\n   derived class\'s "__del__()" method, if any, must explicitly call it\n   to ensure proper deletion of the base class part of the instance.\n   Note that it is possible (though not recommended!) for the\n   "__del__()" method to postpone destruction of the instance by\n   creating a new reference to it.  It may then be called at a later\n   time when this new reference is deleted.  It is not guaranteed that\n   "__del__()" methods are called for objects that still exist when\n   the interpreter exits.\n\n   Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n     decrements the reference count for "x" by one, and the latter is\n     only called when "x"\'s reference count reaches zero.  Some common\n     situations that may prevent the reference count of an object from\n     going to zero include: circular references between objects (e.g.,\n     a doubly-linked list or a tree data structure with parent and\n     child pointers); a reference to the object on the stack frame of\n     a function that caught an exception (the traceback stored in\n     "sys.exc_traceback" keeps the stack frame alive); or a reference\n     to the object on the stack frame that raised an unhandled\n     exception in interactive mode (the traceback stored in\n     "sys.last_traceback" keeps the stack frame alive).  The first\n     situation can only be remedied by explicitly breaking the cycles;\n     the latter two situations can be resolved by storing "None" in\n     "sys.exc_traceback" or "sys.last_traceback".  Circular references\n     which are garbage are detected when the option cycle detector is\n     enabled (it\'s on by default), but can only be cleaned up if there\n     are no Python-level "__del__()" methods involved. Refer to the\n     documentation for the "gc" module for more information about how\n     "__del__()" methods are handled by the cycle detector,\n     particularly the description of the "garbage" value.\n\n   Warning: Due to the precarious circumstances under which\n     "__del__()" methods are invoked, exceptions that occur during\n     their execution are ignored, and a warning is printed to\n     "sys.stderr" instead. Also, when "__del__()" is invoked in\n     response to a module being deleted (e.g., when execution of the\n     program is done), other globals referenced by the "__del__()"\n     method may already have been deleted or in the process of being\n     torn down (e.g. the import machinery shutting down).  For this\n     reason, "__del__()" methods should do the absolute minimum needed\n     to maintain external invariants.  Starting with version 1.5,\n     Python guarantees that globals whose name begins with a single\n     underscore are deleted from their module before other globals are\n     deleted; if no other references to such globals exist, this may\n     help in assuring that imported modules are still available at the\n     time when the "__del__()" method is called.\n\n   See also the "-R" command-line option.\n\nobject.__repr__(self)\n\n   Called by the "repr()" built-in function and by string conversions\n   (reverse quotes) to compute the "official" string representation of\n   an object.  If at all possible, this should look like a valid\n   Python expression that could be used to recreate an object with the\n   same value (given an appropriate environment).  If this is not\n   possible, a string of the form "<...some useful description...>"\n   should be returned.  The return value must be a string object. If a\n   class defines "__repr__()" but not "__str__()", then "__repr__()"\n   is also used when an "informal" string representation of instances\n   of that class is required.\n\n   This is typically used for debugging, so it is important that the\n   representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n   Called by the "str()" built-in function and by the "print"\n   statement to compute the "informal" string representation of an\n   object.  This differs from "__repr__()" in that it does not have to\n   be a valid Python expression: a more convenient or concise\n   representation may be used instead. The return value must be a\n   string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n   New in version 2.1.\n\n   These are the so-called "rich comparison" methods, and are called\n   for comparison operators in preference to "__cmp__()" below. The\n   correspondence between operator symbols and method names is as\n   follows: "x<y" calls "x.__lt__(y)", "x<=y" calls "x.__le__(y)",\n   "x==y" calls "x.__eq__(y)", "x!=y" and "x<>y" call "x.__ne__(y)",\n   "x>y" calls "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n   A rich comparison method may return the singleton "NotImplemented"\n   if it does not implement the operation for a given pair of\n   arguments. By convention, "False" and "True" are returned for a\n   successful comparison. However, these methods can return any value,\n   so if the comparison operator is used in a Boolean context (e.g.,\n   in the condition of an "if" statement), Python will call "bool()"\n   on the value to determine if the result is true or false.\n\n   There are no implied relationships among the comparison operators.\n   The truth of "x==y" does not imply that "x!=y" is false.\n   Accordingly, when defining "__eq__()", one should also define\n   "__ne__()" so that the operators will behave as expected.  See the\n   paragraph on "__hash__()" for some important notes on creating\n   *hashable* objects which support custom comparison operations and\n   are usable as dictionary keys.\n\n   There are no swapped-argument versions of these methods (to be used\n   when the left argument does not support the operation but the right\n   argument does); rather, "__lt__()" and "__gt__()" are each other\'s\n   reflection, "__le__()" and "__ge__()" are each other\'s reflection,\n   and "__eq__()" and "__ne__()" are their own reflection.\n\n   Arguments to rich comparison methods are never coerced.\n\n   To automatically generate ordering operations from a single root\n   operation, see "functools.total_ordering()".\n\nobject.__cmp__(self, other)\n\n   Called by comparison operations if rich comparison (see above) is\n   not defined.  Should return a negative integer if "self < other",\n   zero if "self == other", a positive integer if "self > other".  If\n   no "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\n   class instances are compared by object identity ("address").  See\n   also the description of "__hash__()" for some important notes on\n   creating *hashable* objects which support custom comparison\n   operations and are usable as dictionary keys. (Note: the\n   restriction that exceptions are not propagated by "__cmp__()" has\n   been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n   Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n   Called by built-in function "hash()" and for operations on members\n   of hashed collections including "set", "frozenset", and "dict".\n   "__hash__()" should return an integer.  The only required property\n   is that objects which compare equal have the same hash value; it is\n   advised to somehow mix together (e.g. using exclusive or) the hash\n   values for the components of the object that also play a part in\n   comparison of objects.\n\n   If a class does not define a "__cmp__()" or "__eq__()" method it\n   should not define a "__hash__()" operation either; if it defines\n   "__cmp__()" or "__eq__()" but not "__hash__()", its instances will\n   not be usable in hashed collections.  If a class defines mutable\n   objects and implements a "__cmp__()" or "__eq__()" method, it\n   should not implement "__hash__()", since hashable collection\n   implementations require that a object\'s hash value is immutable (if\n   the object\'s hash value changes, it will be in the wrong hash\n   bucket).\n\n   User-defined classes have "__cmp__()" and "__hash__()" methods by\n   default; with them, all objects compare unequal (except with\n   themselves) and "x.__hash__()" returns a result derived from\n   "id(x)".\n\n   Classes which inherit a "__hash__()" method from a parent class but\n   change the meaning of "__cmp__()" or "__eq__()" such that the hash\n   value returned is no longer appropriate (e.g. by switching to a\n   value-based concept of equality instead of the default identity\n   based equality) can explicitly flag themselves as being unhashable\n   by setting "__hash__ = None" in the class definition. Doing so\n   means that not only will instances of the class raise an\n   appropriate "TypeError" when a program attempts to retrieve their\n   hash value, but they will also be correctly identified as\n   unhashable when checking "isinstance(obj, collections.Hashable)"\n   (unlike classes which define their own "__hash__()" to explicitly\n   raise "TypeError").\n\n   Changed in version 2.5: "__hash__()" may now also return a long\n   integer object; the 32-bit integer is then derived from the hash of\n   that object.\n\n   Changed in version 2.6: "__hash__" may now be set to "None" to\n   explicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\n   Called to implement truth value testing and the built-in operation\n   "bool()"; should return "False" or "True", or their integer\n   equivalents "0" or "1".  When this method is not defined,\n   "__len__()" is called, if it is defined, and the object is\n   considered true if its result is nonzero. If a class defines\n   neither "__len__()" nor "__nonzero__()", all its instances are\n   considered true.\n\nobject.__unicode__(self)\n\n   Called to implement "unicode()" built-in; should return a Unicode\n   object. When this method is not defined, string conversion is\n   attempted, and the result of string conversion is converted to\n   Unicode using the system default encoding.\n',\r
+ 'debugger': u'\n"pdb" --- The Python Debugger\n*****************************\n\n**Source code:** Lib/pdb.py\n\n======================================================================\n\nThe module "pdb" defines an interactive source code debugger for\nPython programs.  It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame.  It also supports post-mortem debugging\nand can be called under program control.\n\nThe debugger is extensible --- it is actually defined as the class\n"Pdb". This is currently undocumented but easily understood by reading\nthe source.  The extension interface uses the modules "bdb" and "cmd".\n\nThe debugger\'s prompt is "(Pdb)". Typical usage to run a program under\ncontrol of the debugger is:\n\n   >>> import pdb\n   >>> import mymodule\n   >>> pdb.run(\'mymodule.test()\')\n   > <string>(0)?()\n   (Pdb) continue\n   > <string>(1)?()\n   (Pdb) continue\n   NameError: \'spam\'\n   > <string>(1)?()\n   (Pdb)\n\n"pdb.py" can also be invoked as a script to debug other scripts.  For\nexample:\n\n   python -m pdb myscript.py\n\nWhen invoked as a script, pdb will automatically enter post-mortem\ndebugging if the program being debugged exits abnormally. After post-\nmortem debugging (or after normal exit of the program), pdb will\nrestart the program. Automatic restarting preserves pdb\'s state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program\'s exit.\n\nNew in version 2.4: Restarting post-mortem behavior added.\n\nThe typical usage to break into the debugger from a running program is\nto insert\n\n   import pdb; pdb.set_trace()\n\nat the location you want to break into the debugger.  You can then\nstep through the code following this statement, and continue running\nwithout the debugger using the "c" command.\n\nThe typical usage to inspect a crashed program is:\n\n   >>> import pdb\n   >>> import mymodule\n   >>> mymodule.test()\n   Traceback (most recent call last):\n     File "<stdin>", line 1, in ?\n     File "./mymodule.py", line 4, in test\n       test2()\n     File "./mymodule.py", line 3, in test2\n       print spam\n   NameError: spam\n   >>> pdb.pm()\n   > ./mymodule.py(3)test2()\n   -> print spam\n   (Pdb)\n\nThe module defines the following functions; each enters the debugger\nin a slightly different way:\n\npdb.run(statement[, globals[, locals]])\n\n   Execute the *statement* (given as a string) under debugger control.\n   The debugger prompt appears before any code is executed; you can\n   set breakpoints and type "continue", or you can step through the\n   statement using "step" or "next" (all these commands are explained\n   below).  The optional *globals* and *locals* arguments specify the\n   environment in which the code is executed; by default the\n   dictionary of the module "__main__" is used.  (See the explanation\n   of the "exec" statement or the "eval()" built-in function.)\n\npdb.runeval(expression[, globals[, locals]])\n\n   Evaluate the *expression* (given as a string) under debugger\n   control.  When "runeval()" returns, it returns the value of the\n   expression.  Otherwise this function is similar to "run()".\n\npdb.runcall(function[, argument, ...])\n\n   Call the *function* (a function or method object, not a string)\n   with the given arguments.  When "runcall()" returns, it returns\n   whatever the function call returned.  The debugger prompt appears\n   as soon as the function is entered.\n\npdb.set_trace()\n\n   Enter the debugger at the calling stack frame.  This is useful to\n   hard-code a breakpoint at a given point in a program, even if the\n   code is not otherwise being debugged (e.g. when an assertion\n   fails).\n\npdb.post_mortem([traceback])\n\n   Enter post-mortem debugging of the given *traceback* object.  If no\n   *traceback* is given, it uses the one of the exception that is\n   currently being handled (an exception must be being handled if the\n   default is to be used).\n\npdb.pm()\n\n   Enter post-mortem debugging of the traceback found in\n   "sys.last_traceback".\n\nThe "run*" functions and "set_trace()" are aliases for instantiating\nthe "Pdb" class and calling the method of the same name.  If you want\nto access further features, you have to do this yourself:\n\nclass class pdb.Pdb(completekey=\'tab\', stdin=None, stdout=None, skip=None)\n\n   "Pdb" is the debugger class.\n\n   The *completekey*, *stdin* and *stdout* arguments are passed to the\n   underlying "cmd.Cmd" class; see the description there.\n\n   The *skip* argument, if given, must be an iterable of glob-style\n   module name patterns.  The debugger will not step into frames that\n   originate in a module that matches one of these patterns. [1]\n\n   Example call to enable tracing with *skip*:\n\n      import pdb; pdb.Pdb(skip=[\'django.*\']).set_trace()\n\n   New in version 2.7: The *skip* argument.\n\n   run(statement[, globals[, locals]])\n   runeval(expression[, globals[, locals]])\n   runcall(function[, argument, ...])\n   set_trace()\n\n      See the documentation for the functions explained above.\n',\r
+ 'del': u'\nThe "del" statement\n*******************\n\n   del_stmt ::= "del" target_list\n\nDeletion is recursively defined very similar to the way assignment is\ndefined. Rather than spelling it out in full details, here are some\nhints.\n\nDeletion of a target list recursively deletes each target, from left\nto right.\n\nDeletion of a name removes the binding of that name  from the local or\nglobal namespace, depending on whether the name occurs in a "global"\nstatement in the same code block.  If the name is unbound, a\n"NameError" exception will be raised.\n\nIt is illegal to delete a name from the local namespace if it occurs\nas a free variable in a nested block.\n\nDeletion of attribute references, subscriptions and slicings is passed\nto the primary object involved; deletion of a slicing is in general\nequivalent to assignment of an empty slice of the right type (but even\nthis is determined by the sliced object).\n',\r
+ 'dict': u'\nDictionary displays\n*******************\n\nA dictionary display is a possibly empty series of key/datum pairs\nenclosed in curly braces:\n\n   dict_display       ::= "{" [key_datum_list | dict_comprehension] "}"\n   key_datum_list     ::= key_datum ("," key_datum)* [","]\n   key_datum          ::= expression ":" expression\n   dict_comprehension ::= expression ":" expression comp_for\n\nA dictionary display yields a new dictionary object.\n\nIf a comma-separated sequence of key/datum pairs is given, they are\nevaluated from left to right to define the entries of the dictionary:\neach key object is used as a key into the dictionary to store the\ncorresponding datum.  This means that you can specify the same key\nmultiple times in the key/datum list, and the final dictionary\'s value\nfor that key will be the last one given.\n\nA dict comprehension, in contrast to list and set comprehensions,\nneeds two expressions separated with a colon followed by the usual\n"for" and "if" clauses. When the comprehension is run, the resulting\nkey and value elements are inserted in the new dictionary in the order\nthey are produced.\n\nRestrictions on the types of the key values are listed earlier in\nsection The standard type hierarchy.  (To summarize, the key type\nshould be *hashable*, which excludes all mutable objects.)  Clashes\nbetween duplicate keys are not detected; the last datum (textually\nrightmost in the display) stored for a given key value prevails.\n',\r
+ 'dynamic-features': u'\nInteraction with dynamic features\n*********************************\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name.  An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec".  (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames.  Names may be resolved in the local and global namespaces of\nthe caller.  Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace.  If only one namespace is\nspecified, it is used for both.\n',\r
+ 'else': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n   if_stmt ::= "if" expression ":" suite\n               ( "elif" expression ":" suite )*\n               ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n',\r
+ 'exceptions': u'\nExceptions\n**********\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions.  An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero).  A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement.  The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop.  In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances.  The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof.  The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nExceptions can also be identified by strings, in which case the\n"except" clause is selected by object identity.  An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nNote: Messages to exceptions are not part of the Python API.  Their\n  contents may change from one version of Python to the next without\n  warning and should not be relied on by code which will run under\n  multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section The try\nstatement and "raise" statement in section The raise statement.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n    these operations is not available at the time the module is\n    compiled.\n',\r
+ 'exec': u'\nThe "exec" statement\n********************\n\n   exec_stmt ::= "exec" or_expr ["in" expression ["," expression]]\n\nThis statement supports dynamic execution of Python code.  The first\nexpression should evaluate to either a Unicode string, a *Latin-1*\nencoded string, an open file object, a code object, or a tuple.  If it\nis a string, the string is parsed as a suite of Python statements\nwhich is then executed (unless a syntax error occurs). [1] If it is an\nopen file, the file is parsed until EOF and executed. If it is a code\nobject, it is simply executed.  For the interpretation of a tuple, see\nbelow.  In all cases, the code that\'s executed is expected to be valid\nas file input (see section File input).  Be aware that the "return"\nand "yield" statements may not be used outside of function definitions\neven within the context of code passed to the "exec" statement.\n\nIn all cases, if the optional parts are omitted, the code is executed\nin the current scope.  If only the first expression after "in" is\nspecified, it should be a dictionary, which will be used for both the\nglobal and the local variables.  If two expressions are given, they\nare used for the global and local variables, respectively. If\nprovided, *locals* can be any mapping object. Remember that at module\nlevel, globals and locals are the same dictionary. If two separate\nobjects are given as *globals* and *locals*, the code will be executed\nas if it were embedded in a class definition.\n\nThe first expression may also be a tuple of length 2 or 3.  In this\ncase, the optional parts must be omitted.  The form "exec(expr,\nglobals)" is equivalent to "exec expr in globals", while the form\n"exec(expr, globals, locals)" is equivalent to "exec expr in globals,\nlocals".  The tuple form of "exec" provides compatibility with Python\n3, where "exec" is a function rather than a statement.\n\nChanged in version 2.4: Formerly, *locals* was required to be a\ndictionary.\n\nAs a side effect, an implementation may insert additional keys into\nthe dictionaries given besides those corresponding to variable names\nset by the executed code.  For example, the current implementation may\nadd a reference to the dictionary of the built-in module "__builtin__"\nunder the key "__builtins__" (!).\n\n**Programmer\'s hints:** dynamic evaluation of expressions is supported\nby the built-in function "eval()".  The built-in functions "globals()"\nand "locals()" return the current global and local dictionary,\nrespectively, which may be useful to pass around for use by "exec".\n\n-[ Footnotes ]-\n\n[1] Note that the parser only accepts the Unix-style end of line\n    convention. If you are reading the code from a file, make sure to\n    use *universal newlines* mode to convert Windows or Mac-style\n    newlines.\n',\r
+ 'execmodel': u'\nExecution model\n***************\n\n\nNaming and binding\n==================\n\n*Names* refer to objects.  Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block.  A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block.  The file read by the\nbuilt-in function "execfile()" is a code block.  The string argument\npassed to the built-in function "eval()" and to the "exec" statement\nis a code block. The expression read and evaluated by the built-in\nfunction "input()" is a code block.\n\nA code block is executed in an *execution frame*.  A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block.  If a local\nvariable is defined in a block, its scope includes that block.  If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name.  The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope.  This means that the\nfollowing will fail:\n\n   class A:\n       a = 42\n       b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope.  The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable.  (The\nvariables of the module code block are local and global.)  If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, a\n"UnboundLocalError" exception is raised.  "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, in the\nsecond position of an "except" clause header or after "as" in a "with"\nstatement.  The "import" statement of the form "from ... import *"\nbinds all names defined in the imported module, except those beginning\nwith an underscore.  This form may only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name).  It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a "SyntaxError".\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block.  This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle.  Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block.  The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "__builtin__".  The global namespace is searched first.\nIf the name is not found there, the builtins namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used).  By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "__builtin__" (note: no\n\'s\'); when in any other module, "__builtins__" is an alias for the\ndictionary of the "__builtin__" module itself.  "__builtins__" can be\nset to a user-created dictionary to create a weak form of restricted\nexecution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail.  Users\nwanting to override values in the builtins namespace should "import"\nthe "__builtin__" (no \'s\') module and modify its attributes\nappropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported.  The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block.  If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class.  Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n---------------------------------\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name.  An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec".  (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames.  Names may be resolved in the local and global namespaces of\nthe caller.  Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace.  If only one namespace is\nspecified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions.  An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero).  A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement.  The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop.  In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances.  The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof.  The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nExceptions can also be identified by strings, in which case the\n"except" clause is selected by object identity.  An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nNote: Messages to exceptions are not part of the Python API.  Their\n  contents may change from one version of Python to the next without\n  warning and should not be relied on by code which will run under\n  multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section The try\nstatement and "raise" statement in section The raise statement.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n    these operations is not available at the time the module is\n    compiled.\n',\r
+ 'exprlists': u'\nExpression lists\n****************\n\n   expression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple.  The\nlength of the tuple is the number of expressions in the list.  The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases.  A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: "()".)\n',\r
+ 'floating': u'\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\n   floatnumber   ::= pointfloat | exponentfloat\n   pointfloat    ::= [intpart] fraction | intpart "."\n   exponentfloat ::= (intpart | pointfloat) exponent\n   intpart       ::= digit+\n   fraction      ::= "." digit+\n   exponent      ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts of floating point numbers can\nlook like octal integers, but are interpreted using radix 10.  For\nexample, "077e010" is legal, and denotes the same number as "77e10".\nThe allowed range of floating point literals is implementation-\ndependent. Some examples of floating point literals:\n\n   3.14    10.    .001    1e100    3.14e-10    0e0\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator "-" and the\nliteral "1".\n',\r
+ 'for': u'\nThe "for" statement\n*******************\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n   for_stmt ::= "for" target_list "in" expression_list ":" suite\n                ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject.  An iterator is created for the result of the\n"expression_list".  The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices.  Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed.  When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite.  A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there was no next\nitem.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop.  Hint: the built-in function "range()" returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s "for i := a to b\ndo"; e.g., "range(3)" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n  loop (this can only occur for mutable sequences, i.e. lists). An\n  internal counter is used to keep track of which item is used next,\n  and this is incremented on each iteration.  When this counter has\n  reached the length of the sequence the loop terminates.  This means\n  that if the suite deletes the current (or a previous) item from the\n  sequence, the next item will be skipped (since it gets the index of\n  the current item which has already been treated).  Likewise, if the\n  suite inserts an item in the sequence before the current item, the\n  current item will be treated again the next time through the loop.\n  This can lead to nasty bugs that can be avoided by making a\n  temporary copy using a slice of the whole sequence, e.g.,\n\n     for x in a[:]:\n         if x < 0: a.remove(x)\n',\r
+ 'formatstrings': u'\nFormat String Syntax\n********************\n\nThe "str.format()" method and the "Formatter" class share the same\nsyntax for format strings (although in the case of "Formatter",\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n"{}". Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output.  If you need to include\na brace character in the literal text, it can be escaped by doubling:\n"{{" and "}}".\n\nThe grammar for a replacement field is as follows:\n\n      replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\n      field_name        ::= arg_name ("." attribute_name | "[" element_index "]")*\n      arg_name          ::= [identifier | integer]\n      attribute_name    ::= identifier\n      element_index     ::= integer | index_string\n      index_string      ::= <any source character except "]"> +\n      conversion        ::= "r" | "s"\n      format_spec       ::= <described in the next section>\n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a  *conversion* field, which is\npreceded by an exclamation point "\'!\'", and a *format_spec*, which is\npreceded by a colon "\':\'".  These specify a non-default format for the\nreplacement value.\n\nSee also the Format Specification Mini-Language section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword.  If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument.  If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings "\'10\'" or\n"\':-]\'") within a format string. The *arg_name* can be followed by any\nnumber of index or attribute expressions. An expression of the form\n"\'.name\'" selects the named attribute using "getattr()", while an\nexpression of the form "\'[index]\'" does an index lookup using\n"__getitem__()".\n\nChanged in version 2.7: The positional argument specifiers can be\nomitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n\nSome simple format string examples:\n\n   "First, thou shalt count to {0}" # References first positional argument\n   "Bring me a {}"                  # Implicitly references the first positional argument\n   "From {} to {}"                  # Same as "From {0} to {1}"\n   "My quest is {name}"             # References keyword argument \'name\'\n   "Weight in tons {0.weight}"      # \'weight\' attribute of first positional arg\n   "Units destroyed: {players[0]}"  # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the "__format__()"\nmethod of the value itself.  However, in some cases it is desirable to\nforce a type to be formatted as a string, overriding its own\ndefinition of formatting.  By converting the value to a string before\ncalling "__format__()", the normal formatting logic is bypassed.\n\nTwo conversion flags are currently supported: "\'!s\'" which calls\n"str()" on the value, and "\'!r\'" which calls "repr()".\n\nSome examples:\n\n   "Harold\'s a clever {0!s}"        # Calls str() on the argument first\n   "Bring out the holy {name!r}"    # Calls repr() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on.  Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields can contain only a field\nname; conversion flags and format specifications are not allowed.  The\nreplacement fields within the format_spec are substituted before the\n*format_spec* string is interpreted. This allows the formatting of a\nvalue to be dynamically specified.\n\nSee the Format examples section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see Format String Syntax).  They can also be passed directly to the\nbuilt-in "format()" function.  Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string ("""") produces\nthe same result as if you had called "str()" on the value. A non-empty\nformat string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\n   format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\n   fill        ::= <any character>\n   align       ::= "<" | ">" | "=" | "^"\n   sign        ::= "+" | "-" | " "\n   width       ::= integer\n   precision   ::= integer\n   type        ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nIf a valid *align* value is specified, it can be preceded by a *fill*\ncharacter that can be any character and defaults to a space if\nomitted. Note that it is not possible to use "{" and "}" as *fill*\nchar while using the "str.format()" method; this limitation however\ndoesn\'t affect the "format()" function.\n\nThe meaning of the various alignment options is as follows:\n\n   +-----------+------------------------------------------------------------+\n   | Option    | Meaning                                                    |\n   +===========+============================================================+\n   | "\'<\'"     | Forces the field to be left-aligned within the available   |\n   |           | space (this is the default for most objects).              |\n   +-----------+------------------------------------------------------------+\n   | "\'>\'"     | Forces the field to be right-aligned within the available  |\n   |           | space (this is the default for numbers).                   |\n   +-----------+------------------------------------------------------------+\n   | "\'=\'"     | Forces the padding to be placed after the sign (if any)    |\n   |           | but before the digits.  This is used for printing fields   |\n   |           | in the form \'+000000120\'. This alignment option is only    |\n   |           | valid for numeric types.                                   |\n   +-----------+------------------------------------------------------------+\n   | "\'^\'"     | Forces the field to be centered within the available       |\n   |           | space.                                                     |\n   +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n   +-----------+------------------------------------------------------------+\n   | Option    | Meaning                                                    |\n   +===========+============================================================+\n   | "\'+\'"     | indicates that a sign should be used for both positive as  |\n   |           | well as negative numbers.                                  |\n   +-----------+------------------------------------------------------------+\n   | "\'-\'"     | indicates that a sign should be used only for negative     |\n   |           | numbers (this is the default behavior).                    |\n   +-----------+------------------------------------------------------------+\n   | space     | indicates that a leading space should be used on positive  |\n   |           | numbers, and a minus sign on negative numbers.             |\n   +-----------+------------------------------------------------------------+\n\nThe "\'#\'" option is only valid for integers, and only for binary,\noctal, or hexadecimal output.  If present, it specifies that the\noutput will be prefixed by "\'0b\'", "\'0o\'", or "\'0x\'", respectively.\n\nThe "\',\'" option signals the use of a comma for a thousands separator.\nFor a locale aware separator, use the "\'n\'" integer presentation type\ninstead.\n\nChanged in version 2.7: Added the "\',\'" option (see also **PEP 378**).\n\n*width* is a decimal integer defining the minimum field width.  If not\nspecified, then the field width will be determined by the content.\n\nPreceding the *width* field by a zero ("\'0\'") character enables sign-\naware zero-padding for numeric types.  This is equivalent to a *fill*\ncharacter of "\'0\'" with an *alignment* type of "\'=\'".\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with "\'f\'" and "\'F\'", or before and after the decimal point\nfor a floating point value formatted with "\'g\'" or "\'G\'".  For non-\nnumber types the field indicates the maximum field size - in other\nwords, how many characters will be used from the field content. The\n*precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n   +-----------+------------------------------------------------------------+\n   | Type      | Meaning                                                    |\n   +===========+============================================================+\n   | "\'s\'"     | String format. This is the default type for strings and    |\n   |           | may be omitted.                                            |\n   +-----------+------------------------------------------------------------+\n   | None      | The same as "\'s\'".                                         |\n   +-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n   +-----------+------------------------------------------------------------+\n   | Type      | Meaning                                                    |\n   +===========+============================================================+\n   | "\'b\'"     | Binary format. Outputs the number in base 2.               |\n   +-----------+------------------------------------------------------------+\n   | "\'c\'"     | Character. Converts the integer to the corresponding       |\n   |           | unicode character before printing.                         |\n   +-----------+------------------------------------------------------------+\n   | "\'d\'"     | Decimal Integer. Outputs the number in base 10.            |\n   +-----------+------------------------------------------------------------+\n   | "\'o\'"     | Octal format. Outputs the number in base 8.                |\n   +-----------+------------------------------------------------------------+\n   | "\'x\'"     | Hex format. Outputs the number in base 16, using lower-    |\n   |           | case letters for the digits above 9.                       |\n   +-----------+------------------------------------------------------------+\n   | "\'X\'"     | Hex format. Outputs the number in base 16, using upper-    |\n   |           | case letters for the digits above 9.                       |\n   +-----------+------------------------------------------------------------+\n   | "\'n\'"     | Number. This is the same as "\'d\'", except that it uses the |\n   |           | current locale setting to insert the appropriate number    |\n   |           | separator characters.                                      |\n   +-----------+------------------------------------------------------------+\n   | None      | The same as "\'d\'".                                         |\n   +-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except "\'n\'"\nand None). When doing so, "float()" is used to convert the integer to\na floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n   +-----------+------------------------------------------------------------+\n   | Type      | Meaning                                                    |\n   +===========+============================================================+\n   | "\'e\'"     | Exponent notation. Prints the number in scientific         |\n   |           | notation using the letter \'e\' to indicate the exponent.    |\n   |           | The default precision is "6".                              |\n   +-----------+------------------------------------------------------------+\n   | "\'E\'"     | Exponent notation. Same as "\'e\'" except it uses an upper   |\n   |           | case \'E\' as the separator character.                       |\n   +-----------+------------------------------------------------------------+\n   | "\'f\'"     | Fixed point. Displays the number as a fixed-point number.  |\n   |           | The default precision is "6".                              |\n   +-----------+------------------------------------------------------------+\n   | "\'F\'"     | Fixed point. Same as "\'f\'".                                |\n   +-----------+------------------------------------------------------------+\n   | "\'g\'"     | General format.  For a given precision "p >= 1", this      |\n   |           | rounds the number to "p" significant digits and then       |\n   |           | formats the result in either fixed-point format or in      |\n   |           | scientific notation, depending on its magnitude.  The      |\n   |           | precise rules are as follows: suppose that the result      |\n   |           | formatted with presentation type "\'e\'" and precision "p-1" |\n   |           | would have exponent "exp".  Then if "-4 <= exp < p", the   |\n   |           | number is formatted with presentation type "\'f\'" and       |\n   |           | precision "p-1-exp".  Otherwise, the number is formatted   |\n   |           | with presentation type "\'e\'" and precision "p-1". In both  |\n   |           | cases insignificant trailing zeros are removed from the    |\n   |           | significand, and the decimal point is also removed if      |\n   |           | there are no remaining digits following it.  Positive and  |\n   |           | negative infinity, positive and negative zero, and nans,   |\n   |           | are formatted as "inf", "-inf", "0", "-0" and "nan"        |\n   |           | respectively, regardless of the precision.  A precision of |\n   |           | "0" is treated as equivalent to a precision of "1". The    |\n   |           | default precision is "6".                                  |\n   +-----------+------------------------------------------------------------+\n   | "\'G\'"     | General format. Same as "\'g\'" except switches to "\'E\'" if  |\n   |           | the number gets too large. The representations of infinity |\n   |           | and NaN are uppercased, too.                               |\n   +-----------+------------------------------------------------------------+\n   | "\'n\'"     | Number. This is the same as "\'g\'", except that it uses the |\n   |           | current locale setting to insert the appropriate number    |\n   |           | separator characters.                                      |\n   +-----------+------------------------------------------------------------+\n   | "\'%\'"     | Percentage. Multiplies the number by 100 and displays in   |\n   |           | fixed ("\'f\'") format, followed by a percent sign.          |\n   +-----------+------------------------------------------------------------+\n   | None      | The same as "\'g\'".                                         |\n   +-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the new format syntax and comparison\nwith the old "%"-formatting.\n\nIn most of the cases the syntax is similar to the old "%"-formatting,\nwith the addition of the "{}" and with ":" used instead of "%". For\nexample, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n   >>> \'{0}, {1}, {2}\'.format(\'a\', \'b\', \'c\')\n   \'a, b, c\'\n   >>> \'{}, {}, {}\'.format(\'a\', \'b\', \'c\')  # 2.7+ only\n   \'a, b, c\'\n   >>> \'{2}, {1}, {0}\'.format(\'a\', \'b\', \'c\')\n   \'c, b, a\'\n   >>> \'{2}, {1}, {0}\'.format(*\'abc\')      # unpacking argument sequence\n   \'c, b, a\'\n   >>> \'{0}{1}{0}\'.format(\'abra\', \'cad\')   # arguments\' indices can be repeated\n   \'abracadabra\'\n\nAccessing arguments by name:\n\n   >>> \'Coordinates: {latitude}, {longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n   \'Coordinates: 37.24N, -115.81W\'\n   >>> coord = {\'latitude\': \'37.24N\', \'longitude\': \'-115.81W\'}\n   >>> \'Coordinates: {latitude}, {longitude}\'.format(**coord)\n   \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\' attributes:\n\n   >>> c = 3-5j\n   >>> (\'The complex number {0} is formed from the real part {0.real} \'\n   ...  \'and the imaginary part {0.imag}.\').format(c)\n   \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n   >>> class Point(object):\n   ...     def __init__(self, x, y):\n   ...         self.x, self.y = x, y\n   ...     def __str__(self):\n   ...         return \'Point({self.x}, {self.y})\'.format(self=self)\n   ...\n   >>> str(Point(4, 2))\n   \'Point(4, 2)\'\n\nAccessing arguments\' items:\n\n   >>> coord = (3, 5)\n   >>> \'X: {0[0]};  Y: {0[1]}\'.format(coord)\n   \'X: 3;  Y: 5\'\n\nReplacing "%s" and "%r":\n\n   >>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\', \'test2\')\n   "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n   >>> \'{:<30}\'.format(\'left aligned\')\n   \'left aligned                  \'\n   >>> \'{:>30}\'.format(\'right aligned\')\n   \'                 right aligned\'\n   >>> \'{:^30}\'.format(\'centered\')\n   \'           centered           \'\n   >>> \'{:*^30}\'.format(\'centered\')  # use \'*\' as a fill char\n   \'***********centered***********\'\n\nReplacing "%+f", "%-f", and "% f" and specifying a sign:\n\n   >>> \'{:+f}; {:+f}\'.format(3.14, -3.14)  # show it always\n   \'+3.140000; -3.140000\'\n   >>> \'{: f}; {: f}\'.format(3.14, -3.14)  # show a space for positive numbers\n   \' 3.140000; -3.140000\'\n   >>> \'{:-f}; {:-f}\'.format(3.14, -3.14)  # show only the minus -- same as \'{:f}; {:f}\'\n   \'3.140000; -3.140000\'\n\nReplacing "%x" and "%o" and converting the value to different bases:\n\n   >>> # format also supports binary numbers\n   >>> "int: {0:d};  hex: {0:x};  oct: {0:o};  bin: {0:b}".format(42)\n   \'int: 42;  hex: 2a;  oct: 52;  bin: 101010\'\n   >>> # with 0x, 0o, or 0b as prefix:\n   >>> "int: {0:d};  hex: {0:#x};  oct: {0:#o};  bin: {0:#b}".format(42)\n   \'int: 42;  hex: 0x2a;  oct: 0o52;  bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n   >>> \'{:,}\'.format(1234567890)\n   \'1,234,567,890\'\n\nExpressing a percentage:\n\n   >>> points = 19.5\n   >>> total = 22\n   >>> \'Correct answers: {:.2%}\'.format(points/total)\n   \'Correct answers: 88.64%\'\n\nUsing type-specific formatting:\n\n   >>> import datetime\n   >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n   >>> \'{:%Y-%m-%d %H:%M:%S}\'.format(d)\n   \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n   >>> for align, text in zip(\'<^>\', [\'left\', \'center\', \'right\']):\n   ...     \'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n   ...\n   \'left<<<<<<<<<<<<\'\n   \'^^^^^center^^^^^\'\n   \'>>>>>>>>>>>right\'\n   >>>\n   >>> octets = [192, 168, 0, 1]\n   >>> \'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n   \'C0A80001\'\n   >>> int(_, 16)\n   3232235521\n   >>>\n   >>> width = 5\n   >>> for num in range(5,12):\n   ...     for base in \'dXob\':\n   ...         print \'{0:{width}{base}}\'.format(num, base=base, width=width),\n   ...     print\n   ...\n       5     5     5   101\n       6     6     6   110\n       7     7     7   111\n       8     8    10  1000\n       9     9    11  1001\n      10     A    12  1010\n      11     B    13  1011\n',\r
+ 'function': u'\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection The standard type hierarchy):\n\n   decorated      ::= decorators (classdef | funcdef)\n   decorators     ::= decorator+\n   decorator      ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n   funcdef        ::= "def" funcname "(" [parameter_list] ")" ":" suite\n   dotted_name    ::= identifier ("." identifier)*\n   parameter_list ::= (defparameter ",")*\n                      (  "*" identifier ["," "**" identifier]\n                      | "**" identifier\n                      | defparameter [","] )\n   defparameter   ::= parameter ["=" expression]\n   sublist        ::= parameter ("," parameter)* [","]\n   parameter      ::= identifier | "(" sublist ")"\n   funcname       ::= identifier\n\nA function definition is an executable statement.  Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function).  This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition.  The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object.  Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n   @f1(arg)\n   @f2\n   def func(): pass\n\nis equivalent to:\n\n   def func(): pass\n   func = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted.  If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.**  This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call.  This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended.  A way around this  is to use "None" as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n   def whats_on_the_telly(penguin=None):\n       if penguin is None:\n           penguin = []\n       penguin.append("property of the zoo")\n       return penguin\n\nFunction call semantics are described in more detail in section Calls.\nA function call always assigns values to all parameters mentioned in\nthe parameter list, either from position arguments, from keyword\narguments, or from default values.  If the form ""*identifier"" is\npresent, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple.  If the form\n""**identifier"" is present, it is initialized to a new dictionary\nreceiving any excess keyword arguments, defaulting to a new empty\ndictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions.  This uses lambda\nexpressions, described in section Lambdas.  Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression.  The ""def"" form is actually more powerful since it\nallows the execution of multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects.  A ""def""\nform executed inside a function definition defines a local function\nthat can be returned or passed around.  Free variables used in the\nnested function can access the local variables of the function\ncontaining the def.  See section Naming and binding for details.\n',\r
+ 'global': u'\nThe "global" statement\n**********************\n\n   global_stmt ::= "global" identifier ("," identifier)*\n\nThe "global" statement is a declaration which holds for the entire\ncurrent code block.  It means that the listed identifiers are to be\ninterpreted as globals.  It would be impossible to assign to a global\nvariable without "global", although free variables may refer to\nglobals without being declared global.\n\nNames listed in a "global" statement must not be used in the same code\nblock textually preceding that "global" statement.\n\nNames listed in a "global" statement must not be defined as formal\nparameters or in a "for" loop control target, "class" definition,\nfunction definition, or "import" statement.\n\n**CPython implementation detail:** The current implementation does not\nenforce the latter two restrictions, but programs should not abuse\nthis freedom, as future implementations may enforce them or silently\nchange the meaning of the program.\n\n**Programmer\'s note:** the "global" is a directive to the parser.  It\napplies only to code parsed at the same time as the "global"\nstatement. In particular, a "global" statement contained in an "exec"\nstatement does not affect the code block *containing* the "exec"\nstatement, and code contained in an "exec" statement is unaffected by\n"global" statements in the code containing the "exec" statement.  The\nsame applies to the "eval()", "execfile()" and "compile()" functions.\n',\r
+ 'id-classes': u'\nReserved classes of identifiers\n*******************************\n\nCertain classes of identifiers (besides keywords) have special\nmeanings.  These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n   Not imported by "from module import *".  The special identifier "_"\n   is used in the interactive interpreter to store the result of the\n   last evaluation; it is stored in the "__builtin__" module.  When\n   not in interactive mode, "_" has no special meaning and is not\n   defined. See section The import statement.\n\n   Note: The name "_" is often used in conjunction with\n     internationalization; refer to the documentation for the\n     "gettext" module for more information on this convention.\n\n"__*__"\n   System-defined names. These names are defined by the interpreter\n   and its implementation (including the standard library).  Current\n   system names are discussed in the Special method names section and\n   elsewhere.  More will likely be defined in future versions of\n   Python.  *Any* use of "__*__" names, in any context, that does not\n   follow explicitly documented use, is subject to breakage without\n   warning.\n\n"__*"\n   Class-private names.  Names in this category, when used within the\n   context of a class definition, are re-written to use a mangled form\n   to help avoid name clashes between "private" attributes of base and\n   derived classes. See section Identifiers (Names).\n',\r
+ 'identifiers': u'\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions:\n\n   identifier ::= (letter|"_") (letter | digit | "_")*\n   letter     ::= lowercase | uppercase\n   lowercase  ::= "a"..."z"\n   uppercase  ::= "A"..."Z"\n   digit      ::= "0"..."9"\n\nIdentifiers are unlimited in length.  Case is significant.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers.  They must\nbe spelled exactly as written here:\n\n   and       del       from      not       while\n   as        elif      global    or        with\n   assert    else      if        pass      yield\n   break     except    import    print\n   class     exec      in        raise\n   continue  finally   is        return\n   def       for       lambda    try\n\nChanged in version 2.4: "None" became a constant and is now recognized\nby the compiler as a name for the built-in object "None".  Although it\nis not a keyword, you cannot assign a different object to it.\n\nChanged in version 2.5: Using "as" and "with" as identifiers triggers\na warning.  To use them as keywords, enable the "with_statement"\nfuture feature .\n\nChanged in version 2.6: "as" and "with" are full keywords.\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings.  These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n   Not imported by "from module import *".  The special identifier "_"\n   is used in the interactive interpreter to store the result of the\n   last evaluation; it is stored in the "__builtin__" module.  When\n   not in interactive mode, "_" has no special meaning and is not\n   defined. See section The import statement.\n\n   Note: The name "_" is often used in conjunction with\n     internationalization; refer to the documentation for the\n     "gettext" module for more information on this convention.\n\n"__*__"\n   System-defined names. These names are defined by the interpreter\n   and its implementation (including the standard library).  Current\n   system names are discussed in the Special method names section and\n   elsewhere.  More will likely be defined in future versions of\n   Python.  *Any* use of "__*__" names, in any context, that does not\n   follow explicitly documented use, is subject to breakage without\n   warning.\n\n"__*"\n   Class-private names.  Names in this category, when used within the\n   context of a class definition, are re-written to use a mangled form\n   to help avoid name clashes between "private" attributes of base and\n   derived classes. See section Identifiers (Names).\n',\r
+ 'if': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n   if_stmt ::= "if" expression ":" suite\n               ( "elif" expression ":" suite )*\n               ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n',\r
+ 'imaginary': u'\nImaginary literals\n******************\n\nImaginary literals are described by the following lexical definitions:\n\n   imagnumber ::= (floatnumber | intpart) ("j" | "J")\n\nAn imaginary literal yields a complex number with a real part of 0.0.\nComplex numbers are represented as a pair of floating point numbers\nand have the same restrictions on their range.  To create a complex\nnumber with a nonzero real part, add a floating point number to it,\ne.g., "(3+4j)".  Some examples of imaginary literals:\n\n   3.14j   10.j    10j     .001j   1e100j  3.14e-10j\n',\r
+ 'import': u'\nThe "import" statement\n**********************\n\n   import_stmt     ::= "import" module ["as" name] ( "," module ["as" name] )*\n                   | "from" relative_module "import" identifier ["as" name]\n                   ( "," identifier ["as" name] )*\n                   | "from" relative_module "import" "(" identifier ["as" name]\n                   ( "," identifier ["as" name] )* [","] ")"\n                   | "from" module "import" "*"\n   module          ::= (identifier ".")* identifier\n   relative_module ::= "."* module | "."+\n   name            ::= identifier\n\nImport statements are executed in two steps: (1) find a module, and\ninitialize it if necessary; (2) define a name or names in the local\nnamespace (of the scope where the "import" statement occurs). The\nstatement comes in two forms differing on whether it uses the "from"\nkeyword. The first form (without "from") repeats these steps for each\nidentifier in the list. The form with "from" performs step (1) once,\nand then performs step (2) repeatedly.\n\nTo understand how step (1) occurs, one must first understand how\nPython handles hierarchical naming of modules. To help organize\nmodules and provide a hierarchy in naming, Python has a concept of\npackages. A package can contain other packages and modules while\nmodules cannot contain other modules or packages. From a file system\nperspective, packages are directories and modules are files.\n\nOnce the name of the module is known (unless otherwise specified, the\nterm "module" will refer to both packages and modules), searching for\nthe module or package can begin. The first place checked is\n"sys.modules", the cache of all modules that have been imported\npreviously. If the module is found there then it is used in step (2)\nof import.\n\nIf the module is not found in the cache, then "sys.meta_path" is\nsearched (the specification for "sys.meta_path" can be found in **PEP\n302**). The object is a list of *finder* objects which are queried in\norder as to whether they know how to load the module by calling their\n"find_module()" method with the name of the module. If the module\nhappens to be contained within a package (as denoted by the existence\nof a dot in the name), then a second argument to "find_module()" is\ngiven as the value of the "__path__" attribute from the parent package\n(everything up to the last dot in the name of the module being\nimported). If a finder can find the module it returns a *loader*\n(discussed later) or returns "None".\n\nIf none of the finders on "sys.meta_path" are able to find the module\nthen some implicitly defined finders are queried. Implementations of\nPython vary in what implicit meta path finders are defined. The one\nthey all do define, though, is one that handles "sys.path_hooks",\n"sys.path_importer_cache", and "sys.path".\n\nThe implicit finder searches for the requested module in the "paths"\nspecified in one of two places ("paths" do not have to be file system\npaths). If the module being imported is supposed to be contained\nwithin a package then the second argument passed to "find_module()",\n"__path__" on the parent package, is used as the source of paths. If\nthe module is not contained in a package then "sys.path" is used as\nthe source of paths.\n\nOnce the source of paths is chosen it is iterated over to find a\nfinder that can handle that path. The dict at\n"sys.path_importer_cache" caches finders for paths and is checked for\na finder. If the path does not have a finder cached then\n"sys.path_hooks" is searched by calling each object in the list with a\nsingle argument of the path, returning a finder or raises\n"ImportError". If a finder is returned then it is cached in\n"sys.path_importer_cache" and then used for that path entry. If no\nfinder can be found but the path exists then a value of "None" is\nstored in "sys.path_importer_cache" to signify that an implicit, file-\nbased finder that handles modules stored as individual files should be\nused for that path. If the path does not exist then a finder which\nalways returns "None" is placed in the cache for the path.\n\nIf no finder can find the module then "ImportError" is raised.\nOtherwise some finder returned a loader whose "load_module()" method\nis called with the name of the module to load (see **PEP 302** for the\noriginal definition of loaders). A loader has several responsibilities\nto perform on a module it loads. First, if the module already exists\nin "sys.modules" (a possibility if the loader is called outside of the\nimport machinery) then it is to use that module for initialization and\nnot a new module. But if the module does not exist in "sys.modules"\nthen it is to be added to that dict before initialization begins. If\nan error occurs during loading of the module and it was added to\n"sys.modules" it is to be removed from the dict. If an error occurs\nbut the module was already in "sys.modules" it is left in the dict.\n\nThe loader must set several attributes on the module. "__name__" is to\nbe set to the name of the module. "__file__" is to be the "path" to\nthe file unless the module is built-in (and thus listed in\n"sys.builtin_module_names") in which case the attribute is not set. If\nwhat is being imported is a package then "__path__" is to be set to a\nlist of paths to be searched when looking for modules and packages\ncontained within the package being imported. "__package__" is optional\nbut should be set to the name of package that contains the module or\npackage (the empty string is used for module not contained in a\npackage). "__loader__" is also optional but should be set to the\nloader object that is loading the module.\n\nIf an error occurs during loading then the loader raises "ImportError"\nif some other exception is not already being propagated. Otherwise the\nloader returns the module that was loaded and initialized.\n\nWhen step (1) finishes without raising an exception, step (2) can\nbegin.\n\nThe first form of "import" statement binds the module name in the\nlocal namespace to the module object, and then goes on to import the\nnext identifier, if any.  If the module name is followed by "as", the\nname following "as" is used as the local name for the module.\n\nThe "from" form does not bind the module name: it goes through the\nlist of identifiers, looks each one of them up in the module found in\nstep (1), and binds the name in the local namespace to the object thus\nfound.  As with the first form of "import", an alternate local name\ncan be supplied by specifying ""as" localname".  If a name is not\nfound, "ImportError" is raised.  If the list of identifiers is\nreplaced by a star ("\'*\'"), all public names defined in the module are\nbound in the local namespace of the "import" statement..\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named "__all__"; if defined, it must\nbe a sequence of strings which are names defined or imported by that\nmodule.  The names given in "__all__" are all considered public and\nare required to exist.  If "__all__" is not defined, the set of public\nnames includes all names found in the module\'s namespace which do not\nbegin with an underscore character ("\'_\'"). "__all__" should contain\nthe entire public API. It is intended to avoid accidentally exporting\nitems that are not part of the API (such as library modules which were\nimported and used within the module).\n\nThe "from" form with "*" may only occur in a module scope.  If the\nwild card form of import --- "import *" --- is used in a function and\nthe function contains or is a nested block with free variables, the\ncompiler will raise a "SyntaxError".\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after "from" you\ncan specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n"from . import mod" from a module in the "pkg" package then you will\nend up importing "pkg.mod". If you execute "from ..subpkg2 import mod"\nfrom within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\nspecification for relative imports is contained within **PEP 328**.\n\n"importlib.import_module()" is provided to support applications that\ndetermine which modules need to be loaded dynamically.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python.  The future\nstatement is intended to ease migration to future versions of Python\nthat introduce incompatible changes to the language.  It allows use of\nthe new features on a per-module basis before the release in which the\nfeature becomes standard.\n\n   future_statement ::= "from" "__future__" "import" feature ["as" name]\n                        ("," feature ["as" name])*\n                        | "from" "__future__" "import" "(" feature ["as" name]\n                        ("," feature ["as" name])* [","] ")"\n   feature          ::= identifier\n   name             ::= identifier\n\nA future statement must appear near the top of the module.  The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 2.6 are "unicode_literals",\n"print_function", "absolute_import", "division", "generators",\n"nested_scopes" and "with_statement".  "generators", "with_statement",\n"nested_scopes" are redundant in Python version 2.6 and above because\nthey are always enabled.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code.  It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently.  Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module "__future__", described later, and it will\nbe imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n   import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by an "exec" statement or calls to the built-in\nfunctions "compile()" and "execfile()" that occur in a module "M"\ncontaining a future statement will, by default, use the new  syntax or\nsemantics associated with the future statement.  This can, starting\nwith Python 2.2 be controlled by optional arguments to "compile()" ---\nsee the documentation of that function for details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session.  If an\ninterpreter is started with the "-i" option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also: **PEP 236** - Back to the __future__\n\n     The original proposal for the __future__ mechanism.\n',\r
+ 'in': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation.  Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n   comparison    ::= or_expr ( comp_operator or_expr )*\n   comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n                     | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe forms "<>" and "!=" are equivalent; for consistency with C, "!="\nis preferred; where "!=" is mentioned below "<>" is also accepted.\nThe "<>" spelling is considered obsolescent.\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects.  The objects need not have the same type. If both are\nnumbers, they are converted to a common type.  Otherwise, objects of\ndifferent types *always* compare unequal, and are ordered consistently\nbut arbitrarily. You can control comparison behavior of objects of\nnon-built-in types by defining a "__cmp__" method or rich comparison\nmethods like "__gt__", described in section Special method names.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the "in" and "not in"\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric\n  equivalents (the result of the built-in function "ord()") of their\n  characters. Unicode and 8-bit strings are fully interoperable in\n  this behavior. [4]\n\n* Tuples and lists are compared lexicographically using comparison\n  of corresponding elements.  This means that to compare equal, each\n  element must compare equal and the two sequences must be of the same\n  type and have the same length.\n\n  If not equal, the sequences are ordered the same as their first\n  differing elements.  For example, "cmp([1,2,x], [1,2,y])" returns\n  the same as "cmp(x,y)".  If the corresponding element does not\n  exist, the shorter sequence is ordered first (for example, "[1,2] <\n  [1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n  (key, value) lists compare equal. [5] Outcomes other than equality\n  are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they\n  are the same object; the choice whether one object is considered\n  smaller or larger than another one is made arbitrarily but\n  consistently within one execution of a program.\n\nThe operators "in" and "not in" test for collection membership.  "x in\ns" evaluates to true if *x* is a member of the collection *s*, and\nfalse otherwise.  "x not in s" returns the negation of "x in s". The\ncollection membership test has traditionally been bound to sequences;\nan object is a member of a collection if the collection is a sequence\nand contains an element equal to that object.  However, it make sense\nfor many other object types to support membership tests without being\na sequence.  In particular, dictionaries (for keys) and sets support\nmembership testing.\n\nFor the list and tuple types, "x in y" is true if and only if there\nexists an index *i* such that "x == y[i]" is true.\n\nFor the Unicode and string types, "x in y" is true if and only if *x*\nis a substring of *y*.  An equivalent test is "y.find(x) != -1".\nNote, *x* and *y* need not be the same type; consequently, "u\'ab\' in\n\'abc\'" will return "True". Empty strings are always considered to be a\nsubstring of any other string, so """ in "abc"" will return "True".\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength "1".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y".  If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object.  "x is not y"\nyields the inverse truth value. [7]\n',\r
+ 'integers': u'\nInteger and long integer literals\n*********************************\n\nInteger and long integer literals are described by the following\nlexical definitions:\n\n   longinteger    ::= integer ("l" | "L")\n   integer        ::= decimalinteger | octinteger | hexinteger | bininteger\n   decimalinteger ::= nonzerodigit digit* | "0"\n   octinteger     ::= "0" ("o" | "O") octdigit+ | "0" octdigit+\n   hexinteger     ::= "0" ("x" | "X") hexdigit+\n   bininteger     ::= "0" ("b" | "B") bindigit+\n   nonzerodigit   ::= "1"..."9"\n   octdigit       ::= "0"..."7"\n   bindigit       ::= "0" | "1"\n   hexdigit       ::= digit | "a"..."f" | "A"..."F"\n\nAlthough both lower case "\'l\'" and upper case "\'L\'" are allowed as\nsuffix for long integers, it is strongly recommended to always use\n"\'L\'", since the letter "\'l\'" looks too much like the digit "\'1\'".\n\nPlain integer literals that are above the largest representable plain\ninteger (e.g., 2147483647 when using 32-bit arithmetic) are accepted\nas if they were long integers instead. [1]  There is no limit for long\ninteger literals apart from what can be stored in available memory.\n\nSome examples of plain integer literals (first row) and long integer\nliterals (second and third rows):\n\n   7     2147483647                        0177\n   3L    79228162514264337593543950336L    0377L   0x100000000L\n         79228162514264337593543950336             0xdeadbeef\n',\r
+ 'lambda': u'\nLambdas\n*******\n\n   lambda_expr     ::= "lambda" [parameter_list]: expression\n   old_lambda_expr ::= "lambda" [parameter_list]: old_expression\n\nLambda expressions (sometimes called lambda forms) have the same\nsyntactic position as expressions.  They are a shorthand to create\nanonymous functions; the expression "lambda arguments: expression"\nyields a function object.  The unnamed object behaves like a function\nobject defined with\n\n   def name(arguments):\n       return expression\n\nSee section Function definitions for the syntax of parameter lists.\nNote that functions created with lambda expressions cannot contain\nstatements.\n',\r
+ 'lists': u'\nList displays\n*************\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\n   list_display        ::= "[" [expression_list | list_comprehension] "]"\n   list_comprehension  ::= expression list_for\n   list_for            ::= "for" target_list "in" old_expression_list [list_iter]\n   old_expression_list ::= old_expression [("," old_expression)+ [","]]\n   old_expression      ::= or_test | old_lambda_expr\n   list_iter           ::= list_for | list_if\n   list_if             ::= "if" old_expression [list_iter]\n\nA list display yields a new list object.  Its contents are specified\nby providing either a list of expressions or a list comprehension.\nWhen a comma-separated list of expressions is supplied, its elements\nare evaluated from left to right and placed into the list object in\nthat order.  When a list comprehension is supplied, it consists of a\nsingle expression followed by at least one "for" clause and zero or\nmore "for" or "if" clauses.  In this case, the elements of the new\nlist are those that would be produced by considering each of the "for"\nor "if" clauses a block, nesting from left to right, and evaluating\nthe expression to produce a list element each time the innermost block\nis reached [1].\n',\r
+ 'naming': u'\nNaming and binding\n******************\n\n*Names* refer to objects.  Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block.  A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block.  The file read by the\nbuilt-in function "execfile()" is a code block.  The string argument\npassed to the built-in function "eval()" and to the "exec" statement\nis a code block. The expression read and evaluated by the built-in\nfunction "input()" is a code block.\n\nA code block is executed in an *execution frame*.  A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block.  If a local\nvariable is defined in a block, its scope includes that block.  If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name.  The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope.  This means that the\nfollowing will fail:\n\n   class A:\n       a = 42\n       b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope.  The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable.  (The\nvariables of the module code block are local and global.)  If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, a\n"UnboundLocalError" exception is raised.  "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, in the\nsecond position of an "except" clause header or after "as" in a "with"\nstatement.  The "import" statement of the form "from ... import *"\nbinds all names defined in the imported module, except those beginning\nwith an underscore.  This form may only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name).  It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a "SyntaxError".\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block.  This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle.  Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block.  The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "__builtin__".  The global namespace is searched first.\nIf the name is not found there, the builtins namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used).  By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "__builtin__" (note: no\n\'s\'); when in any other module, "__builtins__" is an alias for the\ndictionary of the "__builtin__" module itself.  "__builtins__" can be\nset to a user-created dictionary to create a weak form of restricted\nexecution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail.  Users\nwanting to override values in the builtins namespace should "import"\nthe "__builtin__" (no \'s\') module and modify its attributes\nappropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported.  The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block.  If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class.  Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n=================================\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name.  An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec".  (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames.  Names may be resolved in the local and global namespaces of\nthe caller.  Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace.  If only one namespace is\nspecified, it is used for both.\n',\r
+ 'numbers': u'\nNumeric literals\n****************\n\nThere are four types of numeric literals: plain integers, long\nintegers, floating point numbers, and imaginary numbers.  There are no\ncomplex literals (complex numbers can be formed by adding a real\nnumber and an imaginary number).\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator \'"-"\' and the\nliteral "1".\n',\r
+ 'numeric-types': u'\nEmulating numeric types\n***********************\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n   These methods are called to implement the binary arithmetic\n   operations ("+", "-", "*", "//", "%", "divmod()", "pow()", "**",\n   "<<", ">>", "&", "^", "|").  For instance, to evaluate the\n   expression "x + y", where *x* is an instance of a class that has an\n   "__add__()" method, "x.__add__(y)" is called.  The "__divmod__()"\n   method should be the equivalent to using "__floordiv__()" and\n   "__mod__()"; it should not be related to "__truediv__()" (described\n   below).  Note that "__pow__()" should be defined to accept an\n   optional third argument if the ternary version of the built-in\n   "pow()" function is to be supported.\n\n   If one of those methods does not support the operation with the\n   supplied arguments, it should return "NotImplemented".\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n   The division operator ("/") is implemented by these methods.  The\n   "__truediv__()" method is used when "__future__.division" is in\n   effect, otherwise "__div__()" is used.  If only one of these two\n   methods is defined, the object will not support division in the\n   alternate context; "TypeError" will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n   These methods are called to implement the binary arithmetic\n   operations ("+", "-", "*", "/", "%", "divmod()", "pow()", "**",\n   "<<", ">>", "&", "^", "|") with reflected (swapped) operands.\n   These functions are only called if the left operand does not\n   support the corresponding operation and the operands are of\n   different types. [2] For instance, to evaluate the expression "x -\n   y", where *y* is an instance of a class that has an "__rsub__()"\n   method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n   *NotImplemented*.\n\n   Note that ternary "pow()" will not try calling "__rpow__()" (the\n   coercion rules would become too complicated).\n\n   Note: If the right operand\'s type is a subclass of the left\n     operand\'s type and that subclass provides the reflected method\n     for the operation, this method will be called before the left\n     operand\'s non-reflected method.  This behavior allows subclasses\n     to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n   These methods are called to implement the augmented arithmetic\n   assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n   ">>=", "&=", "^=", "|=").  These methods should attempt to do the\n   operation in-place (modifying *self*) and return the result (which\n   could be, but does not have to be, *self*).  If a specific method\n   is not defined, the augmented assignment falls back to the normal\n   methods.  For instance, to execute the statement "x += y", where\n   *x* is an instance of a class that has an "__iadd__()" method,\n   "x.__iadd__(y)" is called.  If *x* is an instance of a class that\n   does not define a "__iadd__()" method, "x.__add__(y)" and\n   "y.__radd__(x)" are considered, as with the evaluation of "x + y".\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n   Called to implement the unary arithmetic operations ("-", "+",\n   "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n   Called to implement the built-in functions "complex()", "int()",\n   "long()", and "float()".  Should return a value of the appropriate\n   type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n   Called to implement the built-in functions "oct()" and "hex()".\n   Should return a string value.\n\nobject.__index__(self)\n\n   Called to implement "operator.index()".  Also called whenever\n   Python needs an integer object (such as in slicing).  Must return\n   an integer (int or long).\n\n   New in version 2.5.\n\nobject.__coerce__(self, other)\n\n   Called to implement "mixed-mode" numeric arithmetic.  Should either\n   return a 2-tuple containing *self* and *other* converted to a\n   common numeric type, or "None" if conversion is impossible.  When\n   the common type would be the type of "other", it is sufficient to\n   return "None", since the interpreter will also ask the other object\n   to attempt a coercion (but sometimes, if the implementation of the\n   other type cannot be changed, it is useful to do the conversion to\n   the other type here).  A return value of "NotImplemented" is\n   equivalent to returning "None".\n',\r
+ 'objects': u'\nObjects, values and types\n*************************\n\n*Objects* are Python\'s abstraction for data.  All data in a Python\nprogram is represented by objects or by relations between objects. (In\na sense, and in conformance to Von Neumann\'s model of a "stored\nprogram computer," code is also represented by objects.)\n\nEvery object has an identity, a type and a value.  An object\'s\n*identity* never changes once it has been created; you may think of it\nas the object\'s address in memory.  The \'"is"\' operator compares the\nidentity of two objects; the "id()" function returns an integer\nrepresenting its identity (currently implemented as its address). An\nobject\'s *type* is also unchangeable. [1] An object\'s type determines\nthe operations that the object supports (e.g., "does it have a\nlength?") and also defines the possible values for objects of that\ntype.  The "type()" function returns an object\'s type (which is an\nobject itself).  The *value* of some objects can change.  Objects\nwhose value can change are said to be *mutable*; objects whose value\nis unchangeable once they are created are called *immutable*. (The\nvalue of an immutable container object that contains a reference to a\nmutable object can change when the latter\'s value is changed; however\nthe container is still considered immutable, because the collection of\nobjects it contains cannot be changed.  So, immutability is not\nstrictly the same as having an unchangeable value, it is more subtle.)\nAn object\'s mutability is determined by its type; for instance,\nnumbers, strings and tuples are immutable, while dictionaries and\nlists are mutable.\n\nObjects are never explicitly destroyed; however, when they become\nunreachable they may be garbage-collected.  An implementation is\nallowed to postpone garbage collection or omit it altogether --- it is\na matter of implementation quality how garbage collection is\nimplemented, as long as no objects are collected that are still\nreachable.\n\n**CPython implementation detail:** CPython currently uses a reference-\ncounting scheme with (optional) delayed detection of cyclically linked\ngarbage, which collects most objects as soon as they become\nunreachable, but is not guaranteed to collect garbage containing\ncircular references.  See the documentation of the "gc" module for\ninformation on controlling the collection of cyclic garbage. Other\nimplementations act differently and CPython may change. Do not depend\non immediate finalization of objects when they become unreachable (ex:\nalways close files).\n\nNote that the use of the implementation\'s tracing or debugging\nfacilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a \'"try"..."except"\'\nstatement may keep objects alive.\n\nSome objects contain references to "external" resources such as open\nfiles or windows.  It is understood that these resources are freed\nwhen the object is garbage-collected, but since garbage collection is\nnot guaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a "close()" method. Programs\nare strongly recommended to explicitly close such objects.  The\n\'"try"..."finally"\' statement provides a convenient way to do this.\n\nSome objects contain references to other objects; these are called\n*containers*. Examples of containers are tuples, lists and\ndictionaries.  The references are part of a container\'s value.  In\nmost cases, when we talk about the value of a container, we imply the\nvalues, not the identities of the contained objects; however, when we\ntalk about the mutability of a container, only the identities of the\nimmediately contained objects are implied.  So, if an immutable\ncontainer (like a tuple) contains a reference to a mutable object, its\nvalue changes if that mutable object is changed.\n\nTypes affect almost all aspects of object behavior.  Even the\nimportance of object identity is affected in some sense: for immutable\ntypes, operations that compute new values may actually return a\nreference to any existing object with the same type and value, while\nfor mutable objects this is not allowed.  E.g., after "a = 1; b = 1",\n"a" and "b" may or may not refer to the same object with the value\none, depending on the implementation, but after "c = []; d = []", "c"\nand "d" are guaranteed to refer to two different, unique, newly\ncreated empty lists. (Note that "c = d = []" assigns the same object\nto both "c" and "d".)\n',\r
+ 'operator-summary': u'\nOperator precedence\n*******************\n\nThe following table summarizes the operator precedences in Python,\nfrom lowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence.  Unless\nthe syntax is explicitly given, operators are binary.  Operators in\nthe same box group left to right (except for comparisons, including\ntests, which all have the same precedence and chain from left to right\n--- see section Comparisons --- and exponentiation, which groups from\nright to left).\n\n+-------------------------------------------------+---------------------------------------+\n| Operator                                        | Description                           |\n+=================================================+=======================================+\n| "lambda"                                        | Lambda expression                     |\n+-------------------------------------------------+---------------------------------------+\n| "if" -- "else"                                  | Conditional expression                |\n+-------------------------------------------------+---------------------------------------+\n| "or"                                            | Boolean OR                            |\n+-------------------------------------------------+---------------------------------------+\n| "and"                                           | Boolean AND                           |\n+-------------------------------------------------+---------------------------------------+\n| "not" "x"                                       | Boolean NOT                           |\n+-------------------------------------------------+---------------------------------------+\n| "in", "not in", "is", "is not", "<", "<=", ">", | Comparisons, including membership     |\n| ">=", "<>", "!=", "=="                          | tests and identity tests              |\n+-------------------------------------------------+---------------------------------------+\n| "|"                                             | Bitwise OR                            |\n+-------------------------------------------------+---------------------------------------+\n| "^"                                             | Bitwise XOR                           |\n+-------------------------------------------------+---------------------------------------+\n| "&"                                             | Bitwise AND                           |\n+-------------------------------------------------+---------------------------------------+\n| "<<", ">>"                                      | Shifts                                |\n+-------------------------------------------------+---------------------------------------+\n| "+", "-"                                        | Addition and subtraction              |\n+-------------------------------------------------+---------------------------------------+\n| "*", "/", "//", "%"                             | Multiplication, division, remainder   |\n|                                                 | [8]                                   |\n+-------------------------------------------------+---------------------------------------+\n| "+x", "-x", "~x"                                | Positive, negative, bitwise NOT       |\n+-------------------------------------------------+---------------------------------------+\n| "**"                                            | Exponentiation [9]                    |\n+-------------------------------------------------+---------------------------------------+\n| "x[index]", "x[index:index]",                   | Subscription, slicing, call,          |\n| "x(arguments...)", "x.attribute"                | attribute reference                   |\n+-------------------------------------------------+---------------------------------------+\n| "(expressions...)", "[expressions...]", "{key:  | Binding or tuple display, list        |\n| value...}", "`expressions...`"                  | display, dictionary display, string   |\n|                                                 | conversion                            |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] In Python 2.3 and later releases, a list comprehension "leaks"\n    the control variables of each "for" it contains into the\n    containing scope.  However, this behavior is deprecated, and\n    relying on it will not work in Python 3.\n\n[2] While "abs(x%y) < abs(y)" is true mathematically, for floats\n    it may not be true numerically due to roundoff.  For example, and\n    assuming a platform on which a Python float is an IEEE 754 double-\n    precision number, in order that "-1e-100 % 1e100" have the same\n    sign as "1e100", the computed result is "-1e-100 + 1e100", which\n    is numerically exactly equal to "1e100".  The function\n    "math.fmod()" returns a result whose sign matches the sign of the\n    first argument instead, and so returns "-1e-100" in this case.\n    Which approach is more appropriate depends on the application.\n\n[3] If x is very close to an exact integer multiple of y, it\'s\n    possible for "floor(x/y)" to be one larger than "(x-x%y)/y" due to\n    rounding.  In such cases, Python returns the latter result, in\n    order to preserve that "divmod(x,y)[0] * y + x % y" be very close\n    to "x".\n\n[4] While comparisons between unicode strings make sense at the\n    byte level, they may be counter-intuitive to users. For example,\n    the strings "u"\\u00C7"" and "u"\\u0043\\u0327"" compare differently,\n    even though they both represent the same unicode character (LATIN\n    CAPITAL LETTER C WITH CEDILLA). To compare strings in a human\n    recognizable way, compare using "unicodedata.normalize()".\n\n[5] The implementation computes this efficiently, without\n    constructing lists or sorting.\n\n[6] Earlier versions of Python used lexicographic comparison of\n    the sorted (key, value) lists, but this was very expensive for the\n    common case of comparing for equality.  An even earlier version of\n    Python compared dictionaries by identity only, but this caused\n    surprises because people expected to be able to test a dictionary\n    for emptiness by comparing it to "{}".\n\n[7] Due to automatic garbage-collection, free lists, and the\n    dynamic nature of descriptors, you may notice seemingly unusual\n    behaviour in certain uses of the "is" operator, like those\n    involving comparisons between instance methods, or constants.\n    Check their documentation for more info.\n\n[8] The "%" operator is also used for string formatting; the same\n    precedence applies.\n\n[9] The power operator "**" binds less tightly than an arithmetic\n    or bitwise unary operator on its right, that is, "2**-1" is "0.5".\n',\r
+ 'pass': u'\nThe "pass" statement\n********************\n\n   pass_stmt ::= "pass"\n\n"pass" is a null operation --- when it is executed, nothing happens.\nIt is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\n   def f(arg): pass    # a function that does nothing (yet)\n\n   class C: pass       # a class with no methods (yet)\n',\r
+ 'power': u'\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right.  The\nsyntax is:\n\n   power ::= primary ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): "-1**2" results in "-1".\n\nThe power operator has the same semantics as the built-in "pow()"\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument.  The numeric arguments are\nfirst converted to a common type.  The result type is that of the\narguments after coercion.\n\nWith mixed operand types, the coercion rules for binary arithmetic\noperators apply. For int and long int operands, the result has the\nsame type as the operands (after coercion) unless the second argument\nis negative; in that case, all arguments are converted to float and a\nfloat result is delivered. For example, "10**2" returns "100", but\n"10**-2" returns "0.01". (This last feature was added in Python 2.2.\nIn Python 2.1 and before, if both arguments were of integer types and\nthe second argument was negative, an exception was raised).\n\nRaising "0.0" to a negative power results in a "ZeroDivisionError".\nRaising a negative number to a fractional power results in a\n"ValueError".\n',\r
+ 'print': u'\nThe "print" statement\n*********************\n\n   print_stmt ::= "print" ([expression ("," expression)* [","]]\n                  | ">>" expression [("," expression)+ [","]])\n\n"print" evaluates each expression in turn and writes the resulting\nobject to standard output (see below).  If an object is not a string,\nit is first converted to a string using the rules for string\nconversions.  The (resulting or original) string is then written.  A\nspace is written before each object is (converted and) written, unless\nthe output system believes it is positioned at the beginning of a\nline.  This is the case (1) when no characters have yet been written\nto standard output, (2) when the last character written to standard\noutput is a whitespace character except "\' \'", or (3) when the last\nwrite operation on standard output was not a "print" statement. (In\nsome cases it may be functional to write an empty string to standard\noutput for this reason.)\n\nNote: Objects which act like file objects but which are not the\n  built-in file objects often do not properly emulate this aspect of\n  the file object\'s behavior, so it is best not to rely on this.\n\nA "\'\\n\'" character is written at the end, unless the "print" statement\nends with a comma.  This is the only action if the statement contains\njust the keyword "print".\n\nStandard output is defined as the file object named "stdout" in the\nbuilt-in module "sys".  If no such object exists, or if it does not\nhave a "write()" method, a "RuntimeError" exception is raised.\n\n"print" also has an extended form, defined by the second portion of\nthe syntax described above. This form is sometimes referred to as\n""print" chevron." In this form, the first expression after the ">>"\nmust evaluate to a "file-like" object, specifically an object that has\na "write()" method as described above.  With this extended form, the\nsubsequent expressions are printed to this file object.  If the first\nexpression evaluates to "None", then "sys.stdout" is used as the file\nfor output.\n',\r
+ 'raise': u'\nThe "raise" statement\n*********************\n\n   raise_stmt ::= "raise" [expression ["," expression ["," expression]]]\n\nIf no expressions are present, "raise" re-raises the last exception\nthat was active in the current scope.  If no exception is active in\nthe current scope, a "TypeError" exception is raised indicating that\nthis is an error (if running under IDLE, a "Queue.Empty" exception is\nraised instead).\n\nOtherwise, "raise" evaluates the expressions to get three objects,\nusing "None" as the value of omitted expressions.  The first two\nobjects are used to determine the *type* and *value* of the exception.\n\nIf the first object is an instance, the type of the exception is the\nclass of the instance, the instance itself is the value, and the\nsecond object must be "None".\n\nIf the first object is a class, it becomes the type of the exception.\nThe second object is used to determine the exception value: If it is\nan instance of the class, the instance becomes the exception value. If\nthe second object is a tuple, it is used as the argument list for the\nclass constructor; if it is "None", an empty argument list is used,\nand any other object is treated as a single argument to the\nconstructor.  The instance so created by calling the constructor is\nused as the exception value.\n\nIf a third object is present and not "None", it must be a traceback\nobject (see section The standard type hierarchy), and it is\nsubstituted instead of the current location as the place where the\nexception occurred.  If the third object is present and not a\ntraceback object or "None", a "TypeError" exception is raised.  The\nthree-expression form of "raise" is useful to re-raise an exception\ntransparently in an except clause, but "raise" with no expressions\nshould be preferred if the exception to be re-raised was the most\nrecently active exception in the current scope.\n\nAdditional information on exceptions can be found in section\nExceptions, and information about handling exceptions is in section\nThe try statement.\n',\r
+ 'return': u'\nThe "return" statement\n**********************\n\n   return_stmt ::= "return" [expression_list]\n\n"return" may only occur syntactically nested in a function definition,\nnot within a nested class definition.\n\nIf an expression list is present, it is evaluated, else "None" is\nsubstituted.\n\n"return" leaves the current function call with the expression list (or\n"None") as return value.\n\nWhen "return" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nfunction.\n\nIn a generator function, the "return" statement is not allowed to\ninclude an "expression_list".  In that context, a bare "return"\nindicates that the generator is done and will cause "StopIteration" to\nbe raised.\n',\r
+ 'sequence-types': u'\nEmulating container types\n*************************\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well.  The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. (For backwards compatibility, the method\n"__getslice__()" (see below) can also be defined to handle simple, but\nnot extended slices.) It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "has_key()", "get()",\n"clear()", "setdefault()", "iterkeys()", "itervalues()",\n"iteritems()", "pop()", "popitem()", "copy()", and "update()" behaving\nsimilar to those for Python\'s standard dictionary objects.  The\n"UserDict" module provides a "DictMixin" class to help create those\nmethods from a base set of "__getitem__()", "__setitem__()",\n"__delitem__()", and "keys()". Mutable sequences should provide\nmethods "append()", "count()", "index()", "extend()", "insert()",\n"pop()", "remove()", "reverse()" and "sort()", like Python standard\nlist objects.  Finally, sequence types should implement addition\n(meaning concatenation) and multiplication (meaning repetition) by\ndefining the methods "__add__()", "__radd__()", "__iadd__()",\n"__mul__()", "__rmul__()" and "__imul__()" described below; they\nshould not define "__coerce__()" or other numerical operators.  It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should be equivalent of "has_key()"; for sequences,\nit should search through the values.  It is further recommended that\nboth mappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "iterkeys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n   Called to implement the built-in function "len()".  Should return\n   the length of the object, an integer ">=" 0.  Also, an object that\n   doesn\'t define a "__nonzero__()" method and whose "__len__()"\n   method returns zero is considered to be false in a Boolean context.\n\nobject.__getitem__(self, key)\n\n   Called to implement evaluation of "self[key]". For sequence types,\n   the accepted keys should be integers and slice objects.  Note that\n   the special interpretation of negative indexes (if the class wishes\n   to emulate a sequence type) is up to the "__getitem__()" method. If\n   *key* is of an inappropriate type, "TypeError" may be raised; if of\n   a value outside the set of indexes for the sequence (after any\n   special interpretation of negative values), "IndexError" should be\n   raised. For mapping types, if *key* is missing (not in the\n   container), "KeyError" should be raised.\n\n   Note: "for" loops expect that an "IndexError" will be raised for\n     illegal indexes to allow proper detection of the end of the\n     sequence.\n\nobject.__missing__(self, key)\n\n   Called by "dict"."__getitem__()" to implement "self[key]" for dict\n   subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n   Called to implement assignment to "self[key]".  Same note as for\n   "__getitem__()".  This should only be implemented for mappings if\n   the objects support changes to the values for keys, or if new keys\n   can be added, or for sequences if elements can be replaced.  The\n   same exceptions should be raised for improper *key* values as for\n   the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n   Called to implement deletion of "self[key]".  Same note as for\n   "__getitem__()".  This should only be implemented for mappings if\n   the objects support removal of keys, or for sequences if elements\n   can be removed from the sequence.  The same exceptions should be\n   raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n   This method is called when an iterator is required for a container.\n   This method should return a new iterator object that can iterate\n   over all the objects in the container.  For mappings, it should\n   iterate over the keys of the container, and should also be made\n   available as the method "iterkeys()".\n\n   Iterator objects also need to implement this method; they are\n   required to return themselves.  For more information on iterator\n   objects, see Iterator Types.\n\nobject.__reversed__(self)\n\n   Called (if present) by the "reversed()" built-in to implement\n   reverse iteration.  It should return a new iterator object that\n   iterates over all the objects in the container in reverse order.\n\n   If the "__reversed__()" method is not provided, the "reversed()"\n   built-in will fall back to using the sequence protocol ("__len__()"\n   and "__getitem__()").  Objects that support the sequence protocol\n   should only provide "__reversed__()" if they can provide an\n   implementation that is more efficient than the one provided by\n   "reversed()".\n\n   New in version 2.6.\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence.  However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n   Called to implement membership test operators.  Should return true\n   if *item* is in *self*, false otherwise.  For mapping objects, this\n   should consider the keys of the mapping rather than the values or\n   the key-item pairs.\n\n   For objects that don\'t define "__contains__()", the membership test\n   first tries iteration via "__iter__()", then the old sequence\n   iteration protocol via "__getitem__()", see this section in the\n   language reference.\n',\r
+ 'shifting': u'\nShifting operations\n*******************\n\nThe shifting operations have lower priority than the arithmetic\noperations:\n\n   shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n\nThese operators accept plain or long integers as arguments.  The\narguments are converted to a common type.  They shift the first\nargument to the left or right by the number of bits given by the\nsecond argument.\n\nA right shift by *n* bits is defined as division by "pow(2, n)".  A\nleft shift by *n* bits is defined as multiplication with "pow(2, n)".\nNegative shift counts raise a "ValueError" exception.\n\nNote: In the current implementation, the right-hand operand is\n  required to be at most "sys.maxsize".  If the right-hand operand is\n  larger than "sys.maxsize" an "OverflowError" exception is raised.\n',\r
+ 'slicings': u'\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list).  Slicings may be used as expressions or as\ntargets in assignment or "del" statements.  The syntax for a slicing:\n\n   slicing          ::= simple_slicing | extended_slicing\n   simple_slicing   ::= primary "[" short_slice "]"\n   extended_slicing ::= primary "[" slice_list "]"\n   slice_list       ::= slice_item ("," slice_item)* [","]\n   slice_item       ::= expression | proper_slice | ellipsis\n   proper_slice     ::= short_slice | long_slice\n   short_slice      ::= [lower_bound] ":" [upper_bound]\n   long_slice       ::= short_slice ":" [stride]\n   lower_bound      ::= expression\n   upper_bound      ::= expression\n   stride           ::= expression\n   ellipsis         ::= "..."\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing.  Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice nor ellipses).  Similarly, when the slice\nlist has exactly one short slice and no trailing comma, the\ninterpretation as a simple slicing takes priority over that as an\nextended slicing.\n\nThe semantics for a simple slicing are as follows.  The primary must\nevaluate to a sequence object.  The lower and upper bound expressions,\nif present, must evaluate to plain integers; defaults are zero and the\n"sys.maxint", respectively.  If either bound is negative, the\nsequence\'s length is added to it.  The slicing now selects all items\nwith index *k* such that "i <= k < j" where *i* and *j* are the\nspecified lower and upper bounds.  This may be an empty sequence.  It\nis not an error if *i* or *j* lie outside the range of valid indexes\n(such items don\'t exist so they aren\'t selected).\n\nThe semantics for an extended slicing are as follows.  The primary\nmust evaluate to a mapping object, and it is indexed with a key that\nis constructed from the slice list, as follows.  If the slice list\ncontains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key.  The conversion of a slice item that is an\nexpression is that expression.  The conversion of an ellipsis slice\nitem is the built-in "Ellipsis" object.  The conversion of a proper\nslice is a slice object (see section The standard type hierarchy)\nwhose "start", "stop" and "step" attributes are the values of the\nexpressions given as lower bound, upper bound and stride,\nrespectively, substituting "None" for missing expressions.\n',\r
+ 'specialattrs': u'\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant.  Some of these are not reported\nby the "dir()" built-in function.\n\nobject.__dict__\n\n   A dictionary or other mapping object used to store an object\'s\n   (writable) attributes.\n\nobject.__methods__\n\n   Deprecated since version 2.2: Use the built-in function "dir()" to\n   get a list of an object\'s attributes. This attribute is no longer\n   available.\n\nobject.__members__\n\n   Deprecated since version 2.2: Use the built-in function "dir()" to\n   get a list of an object\'s attributes. This attribute is no longer\n   available.\n\ninstance.__class__\n\n   The class to which a class instance belongs.\n\nclass.__bases__\n\n   The tuple of base classes of a class object.\n\nclass.__name__\n\n   The name of the class or type.\n\nThe following attributes are only supported by *new-style class*es.\n\nclass.__mro__\n\n   This attribute is a tuple of classes that are considered when\n   looking for base classes during method resolution.\n\nclass.mro()\n\n   This method can be overridden by a metaclass to customize the\n   method resolution order for its instances.  It is called at class\n   instantiation, and its result is stored in "__mro__".\n\nclass.__subclasses__()\n\n   Each new-style class keeps a list of weak references to its\n   immediate subclasses.  This method returns a list of all those\n   references still alive. Example:\n\n      >>> int.__subclasses__()\n      [<type \'bool\'>]\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found\n    in the Python Reference Manual (Basic customization).\n\n[2] As a consequence, the list "[1, 2]" is considered equal to\n    "[1.0, 2.0]", and similarly for tuples.\n\n[3] They must have since the parser can\'t tell the type of the\n    operands.\n\n[4] Cased characters are those with general category property\n    being one of "Lu" (Letter, uppercase), "Ll" (Letter, lowercase),\n    or "Lt" (Letter, titlecase).\n\n[5] To format only a tuple you should therefore provide a\n    singleton tuple whose only element is the tuple to be formatted.\n\n[6] The advantage of leaving the newline on is that returning an\n    empty string is then an unambiguous EOF indication.  It is also\n    possible (in cases where it might matter, for example, if you want\n    to make an exact copy of a file while scanning its lines) to tell\n    whether the last line of a file ended in a newline or not (yes\n    this happens!).\n',\r
+ 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators.  For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "x.__getitem__(i)" for old-style\nclasses and "type(x).__getitem__(x, i)" for new-style classes.  Except\nwhere mentioned, attempts to execute an operation raise an exception\nwhen no appropriate method is defined (typically "AttributeError" or\n"TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled.  For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense.  (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n   Called to create a new instance of class *cls*.  "__new__()" is a\n   static method (special-cased so you need not declare it as such)\n   that takes the class of which an instance was requested as its\n   first argument.  The remaining arguments are those passed to the\n   object constructor expression (the call to the class).  The return\n   value of "__new__()" should be the new object instance (usually an\n   instance of *cls*).\n\n   Typical implementations create a new instance of the class by\n   invoking the superclass\'s "__new__()" method using\n   "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n   arguments and then modifying the newly-created instance as\n   necessary before returning it.\n\n   If "__new__()" returns an instance of *cls*, then the new\n   instance\'s "__init__()" method will be invoked like\n   "__init__(self[, ...])", where *self* is the new instance and the\n   remaining arguments are the same as were passed to "__new__()".\n\n   If "__new__()" does not return an instance of *cls*, then the new\n   instance\'s "__init__()" method will not be invoked.\n\n   "__new__()" is intended mainly to allow subclasses of immutable\n   types (like int, str, or tuple) to customize instance creation.  It\n   is also commonly overridden in custom metaclasses in order to\n   customize class creation.\n\nobject.__init__(self[, ...])\n\n   Called after the instance has been created (by "__new__()"), but\n   before it is returned to the caller.  The arguments are those\n   passed to the class constructor expression.  If a base class has an\n   "__init__()" method, the derived class\'s "__init__()" method, if\n   any, must explicitly call it to ensure proper initialization of the\n   base class part of the instance; for example:\n   "BaseClass.__init__(self, [args...])".\n\n   Because "__new__()" and "__init__()" work together in constructing\n   objects ("__new__()" to create it, and "__init__()" to customise\n   it), no non-"None" value may be returned by "__init__()"; doing so\n   will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n   Called when the instance is about to be destroyed.  This is also\n   called a destructor.  If a base class has a "__del__()" method, the\n   derived class\'s "__del__()" method, if any, must explicitly call it\n   to ensure proper deletion of the base class part of the instance.\n   Note that it is possible (though not recommended!) for the\n   "__del__()" method to postpone destruction of the instance by\n   creating a new reference to it.  It may then be called at a later\n   time when this new reference is deleted.  It is not guaranteed that\n   "__del__()" methods are called for objects that still exist when\n   the interpreter exits.\n\n   Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n     decrements the reference count for "x" by one, and the latter is\n     only called when "x"\'s reference count reaches zero.  Some common\n     situations that may prevent the reference count of an object from\n     going to zero include: circular references between objects (e.g.,\n     a doubly-linked list or a tree data structure with parent and\n     child pointers); a reference to the object on the stack frame of\n     a function that caught an exception (the traceback stored in\n     "sys.exc_traceback" keeps the stack frame alive); or a reference\n     to the object on the stack frame that raised an unhandled\n     exception in interactive mode (the traceback stored in\n     "sys.last_traceback" keeps the stack frame alive).  The first\n     situation can only be remedied by explicitly breaking the cycles;\n     the latter two situations can be resolved by storing "None" in\n     "sys.exc_traceback" or "sys.last_traceback".  Circular references\n     which are garbage are detected when the option cycle detector is\n     enabled (it\'s on by default), but can only be cleaned up if there\n     are no Python-level "__del__()" methods involved. Refer to the\n     documentation for the "gc" module for more information about how\n     "__del__()" methods are handled by the cycle detector,\n     particularly the description of the "garbage" value.\n\n   Warning: Due to the precarious circumstances under which\n     "__del__()" methods are invoked, exceptions that occur during\n     their execution are ignored, and a warning is printed to\n     "sys.stderr" instead. Also, when "__del__()" is invoked in\n     response to a module being deleted (e.g., when execution of the\n     program is done), other globals referenced by the "__del__()"\n     method may already have been deleted or in the process of being\n     torn down (e.g. the import machinery shutting down).  For this\n     reason, "__del__()" methods should do the absolute minimum needed\n     to maintain external invariants.  Starting with version 1.5,\n     Python guarantees that globals whose name begins with a single\n     underscore are deleted from their module before other globals are\n     deleted; if no other references to such globals exist, this may\n     help in assuring that imported modules are still available at the\n     time when the "__del__()" method is called.\n\n   See also the "-R" command-line option.\n\nobject.__repr__(self)\n\n   Called by the "repr()" built-in function and by string conversions\n   (reverse quotes) to compute the "official" string representation of\n   an object.  If at all possible, this should look like a valid\n   Python expression that could be used to recreate an object with the\n   same value (given an appropriate environment).  If this is not\n   possible, a string of the form "<...some useful description...>"\n   should be returned.  The return value must be a string object. If a\n   class defines "__repr__()" but not "__str__()", then "__repr__()"\n   is also used when an "informal" string representation of instances\n   of that class is required.\n\n   This is typically used for debugging, so it is important that the\n   representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n   Called by the "str()" built-in function and by the "print"\n   statement to compute the "informal" string representation of an\n   object.  This differs from "__repr__()" in that it does not have to\n   be a valid Python expression: a more convenient or concise\n   representation may be used instead. The return value must be a\n   string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n   New in version 2.1.\n\n   These are the so-called "rich comparison" methods, and are called\n   for comparison operators in preference to "__cmp__()" below. The\n   correspondence between operator symbols and method names is as\n   follows: "x<y" calls "x.__lt__(y)", "x<=y" calls "x.__le__(y)",\n   "x==y" calls "x.__eq__(y)", "x!=y" and "x<>y" call "x.__ne__(y)",\n   "x>y" calls "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n   A rich comparison method may return the singleton "NotImplemented"\n   if it does not implement the operation for a given pair of\n   arguments. By convention, "False" and "True" are returned for a\n   successful comparison. However, these methods can return any value,\n   so if the comparison operator is used in a Boolean context (e.g.,\n   in the condition of an "if" statement), Python will call "bool()"\n   on the value to determine if the result is true or false.\n\n   There are no implied relationships among the comparison operators.\n   The truth of "x==y" does not imply that "x!=y" is false.\n   Accordingly, when defining "__eq__()", one should also define\n   "__ne__()" so that the operators will behave as expected.  See the\n   paragraph on "__hash__()" for some important notes on creating\n   *hashable* objects which support custom comparison operations and\n   are usable as dictionary keys.\n\n   There are no swapped-argument versions of these methods (to be used\n   when the left argument does not support the operation but the right\n   argument does); rather, "__lt__()" and "__gt__()" are each other\'s\n   reflection, "__le__()" and "__ge__()" are each other\'s reflection,\n   and "__eq__()" and "__ne__()" are their own reflection.\n\n   Arguments to rich comparison methods are never coerced.\n\n   To automatically generate ordering operations from a single root\n   operation, see "functools.total_ordering()".\n\nobject.__cmp__(self, other)\n\n   Called by comparison operations if rich comparison (see above) is\n   not defined.  Should return a negative integer if "self < other",\n   zero if "self == other", a positive integer if "self > other".  If\n   no "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\n   class instances are compared by object identity ("address").  See\n   also the description of "__hash__()" for some important notes on\n   creating *hashable* objects which support custom comparison\n   operations and are usable as dictionary keys. (Note: the\n   restriction that exceptions are not propagated by "__cmp__()" has\n   been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n   Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n   Called by built-in function "hash()" and for operations on members\n   of hashed collections including "set", "frozenset", and "dict".\n   "__hash__()" should return an integer.  The only required property\n   is that objects which compare equal have the same hash value; it is\n   advised to somehow mix together (e.g. using exclusive or) the hash\n   values for the components of the object that also play a part in\n   comparison of objects.\n\n   If a class does not define a "__cmp__()" or "__eq__()" method it\n   should not define a "__hash__()" operation either; if it defines\n   "__cmp__()" or "__eq__()" but not "__hash__()", its instances will\n   not be usable in hashed collections.  If a class defines mutable\n   objects and implements a "__cmp__()" or "__eq__()" method, it\n   should not implement "__hash__()", since hashable collection\n   implementations require that a object\'s hash value is immutable (if\n   the object\'s hash value changes, it will be in the wrong hash\n   bucket).\n\n   User-defined classes have "__cmp__()" and "__hash__()" methods by\n   default; with them, all objects compare unequal (except with\n   themselves) and "x.__hash__()" returns a result derived from\n   "id(x)".\n\n   Classes which inherit a "__hash__()" method from a parent class but\n   change the meaning of "__cmp__()" or "__eq__()" such that the hash\n   value returned is no longer appropriate (e.g. by switching to a\n   value-based concept of equality instead of the default identity\n   based equality) can explicitly flag themselves as being unhashable\n   by setting "__hash__ = None" in the class definition. Doing so\n   means that not only will instances of the class raise an\n   appropriate "TypeError" when a program attempts to retrieve their\n   hash value, but they will also be correctly identified as\n   unhashable when checking "isinstance(obj, collections.Hashable)"\n   (unlike classes which define their own "__hash__()" to explicitly\n   raise "TypeError").\n\n   Changed in version 2.5: "__hash__()" may now also return a long\n   integer object; the 32-bit integer is then derived from the hash of\n   that object.\n\n   Changed in version 2.6: "__hash__" may now be set to "None" to\n   explicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\n   Called to implement truth value testing and the built-in operation\n   "bool()"; should return "False" or "True", or their integer\n   equivalents "0" or "1".  When this method is not defined,\n   "__len__()" is called, if it is defined, and the object is\n   considered true if its result is nonzero. If a class defines\n   neither "__len__()" nor "__nonzero__()", all its instances are\n   considered true.\n\nobject.__unicode__(self)\n\n   Called to implement "unicode()" built-in; should return a Unicode\n   object. When this method is not defined, string conversion is\n   attempted, and the result of string conversion is converted to\n   Unicode using the system default encoding.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n   Called when an attribute lookup has not found the attribute in the\n   usual places (i.e. it is not an instance attribute nor is it found\n   in the class tree for "self").  "name" is the attribute name. This\n   method should return the (computed) attribute value or raise an\n   "AttributeError" exception.\n\n   Note that if the attribute is found through the normal mechanism,\n   "__getattr__()" is not called.  (This is an intentional asymmetry\n   between "__getattr__()" and "__setattr__()".) This is done both for\n   efficiency reasons and because otherwise "__getattr__()" would have\n   no way to access other attributes of the instance.  Note that at\n   least for instance variables, you can fake total control by not\n   inserting any values in the instance attribute dictionary (but\n   instead inserting them in another object).  See the\n   "__getattribute__()" method below for a way to actually get total\n   control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n   Called when an attribute assignment is attempted.  This is called\n   instead of the normal mechanism (i.e. store the value in the\n   instance dictionary).  *name* is the attribute name, *value* is the\n   value to be assigned to it.\n\n   If "__setattr__()" wants to assign to an instance attribute, it\n   should not simply execute "self.name = value" --- this would cause\n   a recursive call to itself.  Instead, it should insert the value in\n   the dictionary of instance attributes, e.g., "self.__dict__[name] =\n   value".  For new-style classes, rather than accessing the instance\n   dictionary, it should call the base class method with the same\n   name, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n   Like "__setattr__()" but for attribute deletion instead of\n   assignment.  This should only be implemented if "del obj.name" is\n   meaningful for the object.\n\n\nMore attribute access for new-style classes\n-------------------------------------------\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n   Called unconditionally to implement attribute accesses for\n   instances of the class. If the class also defines "__getattr__()",\n   the latter will not be called unless "__getattribute__()" either\n   calls it explicitly or raises an "AttributeError". This method\n   should return the (computed) attribute value or raise an\n   "AttributeError" exception. In order to avoid infinite recursion in\n   this method, its implementation should always call the base class\n   method with the same name to access any attributes it needs, for\n   example, "object.__getattribute__(self, name)".\n\n   Note: This method may still be bypassed when looking up special\n     methods as the result of implicit invocation via language syntax\n     or built-in functions. See Special method lookup for new-style\n     classes.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents).  In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n   Called to get the attribute of the owner class (class attribute\n   access) or of an instance of that class (instance attribute\n   access). *owner* is always the owner class, while *instance* is the\n   instance that the attribute was accessed through, or "None" when\n   the attribute is accessed through the *owner*.  This method should\n   return the (computed) attribute value or raise an "AttributeError"\n   exception.\n\nobject.__set__(self, instance, value)\n\n   Called to set the attribute on an instance *instance* of the owner\n   class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n   Called to delete the attribute on an instance *instance* of the\n   owner class.\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol:  "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead.  Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.  Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass "object()" or "type()").\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n   The simplest and least common call is when user code directly\n   invokes a descriptor method:    "x.__get__(a)".\n\nInstance Binding\n   If binding to a new-style object instance, "a.x" is transformed\n   into the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n   If binding to a new-style class, "A.x" is transformed into the\n   call: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n   If "a" is an instance of "super", then the binding "super(B,\n   obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n   immediately preceding "B" and then invokes the descriptor with the\n   call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined.  A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()".  If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary.  If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor.  Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method.  Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary.  In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors.  Accordingly, instances can\nredefine and override methods.  This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage.  This wastes space for objects\nhaving very few instance variables.  The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition.  The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable.  Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n   This class variable can be assigned a string, iterable, or sequence\n   of strings with variable names used by instances.  If defined in a\n   new-style class, *__slots__* reserves space for the declared\n   variables and prevents the automatic creation of *__dict__* and\n   *__weakref__* for each instance.\n\n   New in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n  attribute of that class will always be accessible, so a *__slots__*\n  definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n  variables not listed in the *__slots__* definition.  Attempts to\n  assign to an unlisted variable name raises "AttributeError". If\n  dynamic assignment of new variables is desired, then add\n  "\'__dict__\'" to the sequence of strings in the *__slots__*\n  declaration.\n\n  Changed in version 2.3: Previously, adding "\'__dict__\'" to the\n  *__slots__* declaration would not enable the assignment of new\n  attributes not specifically listed in the sequence of instance\n  variable names.\n\n* Without a *__weakref__* variable for each instance, classes\n  defining *__slots__* do not support weak references to its\n  instances. If weak reference support is needed, then add\n  "\'__weakref__\'" to the sequence of strings in the *__slots__*\n  declaration.\n\n  Changed in version 2.3: Previously, adding "\'__weakref__\'" to the\n  *__slots__* declaration would not enable support for weak\n  references.\n\n* *__slots__* are implemented at the class level by creating\n  descriptors (Implementing Descriptors) for each variable name.  As a\n  result, class attributes cannot be used to set default values for\n  instance variables defined by *__slots__*; otherwise, the class\n  attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n  where it is defined.  As a result, subclasses will have a *__dict__*\n  unless they also define *__slots__* (which must only contain names\n  of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n  instance variable defined by the base class slot is inaccessible\n  (except by retrieving its descriptor directly from the base class).\n  This renders the meaning of the program undefined.  In the future, a\n  check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n  "variable-length" built-in types such as "long", "str" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n  may also be used; however, in the future, special meaning may be\n  assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n  *__slots__*.\n\n  Changed in version 2.6: Previously, *__class__* assignment raised an\n  error if either new or old class had *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, new-style classes are constructed using "type()". A class\ndefinition is read into a separate namespace and the value of class\nname is bound to the result of "type(name, bases, dict)".\n\nWhen the class definition is read, if *__metaclass__* is defined then\nthe callable assigned to it will be called instead of "type()". This\nallows classes or functions to be written which monitor or alter the\nclass creation process:\n\n* Modifying the class dictionary prior to the class being created.\n\n* Returning an instance of another class -- essentially performing\n  the role of a factory function.\n\nThese steps will have to be performed in the metaclass\'s "__new__()"\nmethod -- "type.__new__()" can then be called from this method to\ncreate a class with different properties.  This example adds a new\nelement to the class dictionary before creating the class:\n\n   class metacls(type):\n       def __new__(mcs, name, bases, dict):\n           dict[\'foo\'] = \'metacls was here\'\n           return type.__new__(mcs, name, bases, dict)\n\nYou can of course also override other class methods (or add new\nmethods); for example defining a custom "__call__()" method in the\nmetaclass allows custom behavior when the class is called, e.g. not\nalways creating a new instance.\n\n__metaclass__\n\n   This variable can be any callable accepting arguments for "name",\n   "bases", and "dict".  Upon class creation, the callable is used\n   instead of the built-in "type()".\n\n   New in version 2.2.\n\nThe appropriate metaclass is determined by the following precedence\nrules:\n\n* If "dict[\'__metaclass__\']" exists, it is used.\n\n* Otherwise, if there is at least one base class, its metaclass is\n  used (this looks for a *__class__* attribute first and if not found,\n  uses its type).\n\n* Otherwise, if a global variable named __metaclass__ exists, it is\n  used.\n\n* Otherwise, the old-style, classic metaclass (types.ClassType) is\n  used.\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored including logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\n\nCustomizing instance and subclass checks\n========================================\n\nNew in version 2.6.\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n   Return true if *instance* should be considered a (direct or\n   indirect) instance of *class*. If defined, called to implement\n   "isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\n   Return true if *subclass* should be considered a (direct or\n   indirect) subclass of *class*.  If defined, called to implement\n   "issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass.  They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also: **PEP 3119** - Introducing Abstract Base Classes\n\n     Includes the specification for customizing "isinstance()" and\n     "issubclass()" behavior through "__instancecheck__()" and\n     "__subclasscheck__()", with motivation for this functionality in\n     the context of adding Abstract Base Classes (see the "abc"\n     module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n   Called when the instance is "called" as a function; if this method\n   is defined, "x(arg1, arg2, ...)" is a shorthand for\n   "x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well.  The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. (For backwards compatibility, the method\n"__getslice__()" (see below) can also be defined to handle simple, but\nnot extended slices.) It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "has_key()", "get()",\n"clear()", "setdefault()", "iterkeys()", "itervalues()",\n"iteritems()", "pop()", "popitem()", "copy()", and "update()" behaving\nsimilar to those for Python\'s standard dictionary objects.  The\n"UserDict" module provides a "DictMixin" class to help create those\nmethods from a base set of "__getitem__()", "__setitem__()",\n"__delitem__()", and "keys()". Mutable sequences should provide\nmethods "append()", "count()", "index()", "extend()", "insert()",\n"pop()", "remove()", "reverse()" and "sort()", like Python standard\nlist objects.  Finally, sequence types should implement addition\n(meaning concatenation) and multiplication (meaning repetition) by\ndefining the methods "__add__()", "__radd__()", "__iadd__()",\n"__mul__()", "__rmul__()" and "__imul__()" described below; they\nshould not define "__coerce__()" or other numerical operators.  It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should be equivalent of "has_key()"; for sequences,\nit should search through the values.  It is further recommended that\nboth mappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "iterkeys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n   Called to implement the built-in function "len()".  Should return\n   the length of the object, an integer ">=" 0.  Also, an object that\n   doesn\'t define a "__nonzero__()" method and whose "__len__()"\n   method returns zero is considered to be false in a Boolean context.\n\nobject.__getitem__(self, key)\n\n   Called to implement evaluation of "self[key]". For sequence types,\n   the accepted keys should be integers and slice objects.  Note that\n   the special interpretation of negative indexes (if the class wishes\n   to emulate a sequence type) is up to the "__getitem__()" method. If\n   *key* is of an inappropriate type, "TypeError" may be raised; if of\n   a value outside the set of indexes for the sequence (after any\n   special interpretation of negative values), "IndexError" should be\n   raised. For mapping types, if *key* is missing (not in the\n   container), "KeyError" should be raised.\n\n   Note: "for" loops expect that an "IndexError" will be raised for\n     illegal indexes to allow proper detection of the end of the\n     sequence.\n\nobject.__missing__(self, key)\n\n   Called by "dict"."__getitem__()" to implement "self[key]" for dict\n   subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n   Called to implement assignment to "self[key]".  Same note as for\n   "__getitem__()".  This should only be implemented for mappings if\n   the objects support changes to the values for keys, or if new keys\n   can be added, or for sequences if elements can be replaced.  The\n   same exceptions should be raised for improper *key* values as for\n   the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n   Called to implement deletion of "self[key]".  Same note as for\n   "__getitem__()".  This should only be implemented for mappings if\n   the objects support removal of keys, or for sequences if elements\n   can be removed from the sequence.  The same exceptions should be\n   raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n   This method is called when an iterator is required for a container.\n   This method should return a new iterator object that can iterate\n   over all the objects in the container.  For mappings, it should\n   iterate over the keys of the container, and should also be made\n   available as the method "iterkeys()".\n\n   Iterator objects also need to implement this method; they are\n   required to return themselves.  For more information on iterator\n   objects, see Iterator Types.\n\nobject.__reversed__(self)\n\n   Called (if present) by the "reversed()" built-in to implement\n   reverse iteration.  It should return a new iterator object that\n   iterates over all the objects in the container in reverse order.\n\n   If the "__reversed__()" method is not provided, the "reversed()"\n   built-in will fall back to using the sequence protocol ("__len__()"\n   and "__getitem__()").  Objects that support the sequence protocol\n   should only provide "__reversed__()" if they can provide an\n   implementation that is more efficient than the one provided by\n   "reversed()".\n\n   New in version 2.6.\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence.  However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n   Called to implement membership test operators.  Should return true\n   if *item* is in *self*, false otherwise.  For mapping objects, this\n   should consider the keys of the mapping rather than the values or\n   the key-item pairs.\n\n   For objects that don\'t define "__contains__()", the membership test\n   first tries iteration via "__iter__()", then the old sequence\n   iteration protocol via "__getitem__()", see this section in the\n   language reference.\n\n\nAdditional methods for emulation of sequence types\n==================================================\n\nThe following optional methods can be defined to further emulate\nsequence objects.  Immutable sequences methods should at most only\ndefine "__getslice__()"; mutable sequences might define all three\nmethods.\n\nobject.__getslice__(self, i, j)\n\n   Deprecated since version 2.0: Support slice objects as parameters\n   to the "__getitem__()" method. (However, built-in types in CPython\n   currently still implement "__getslice__()".  Therefore, you have to\n   override it in derived classes when implementing slicing.)\n\n   Called to implement evaluation of "self[i:j]". The returned object\n   should be of the same type as *self*.  Note that missing *i* or *j*\n   in the slice expression are replaced by zero or "sys.maxsize",\n   respectively.  If negative indexes are used in the slice, the\n   length of the sequence is added to that index. If the instance does\n   not implement the "__len__()" method, an "AttributeError" is\n   raised. No guarantee is made that indexes adjusted this way are not\n   still negative.  Indexes which are greater than the length of the\n   sequence are not modified. If no "__getslice__()" is found, a slice\n   object is created instead, and passed to "__getitem__()" instead.\n\nobject.__setslice__(self, i, j, sequence)\n\n   Called to implement assignment to "self[i:j]". Same notes for *i*\n   and *j* as for "__getslice__()".\n\n   This method is deprecated. If no "__setslice__()" is found, or for\n   extended slicing of the form "self[i:j:k]", a slice object is\n   created, and passed to "__setitem__()", instead of "__setslice__()"\n   being called.\n\nobject.__delslice__(self, i, j)\n\n   Called to implement deletion of "self[i:j]". Same notes for *i* and\n   *j* as for "__getslice__()". This method is deprecated. If no\n   "__delslice__()" is found, or for extended slicing of the form\n   "self[i:j:k]", a slice object is created, and passed to\n   "__delitem__()", instead of "__delslice__()" being called.\n\nNotice that these methods are only invoked when a single slice with a\nsingle colon is used, and the slice method is available.  For slice\noperations involving extended slice notation, or in absence of the\nslice methods, "__getitem__()", "__setitem__()" or "__delitem__()" is\ncalled with a slice object as argument.\n\nThe following example demonstrate how to make your program or module\ncompatible with earlier versions of Python (assuming that methods\n"__getitem__()", "__setitem__()" and "__delitem__()" support slice\nobjects as arguments):\n\n   class MyClass:\n       ...\n       def __getitem__(self, index):\n           ...\n       def __setitem__(self, index, value):\n           ...\n       def __delitem__(self, index):\n           ...\n\n       if sys.version_info < (2, 0):\n           # They won\'t be defined if version is at least 2.0 final\n\n           def __getslice__(self, i, j):\n               return self[max(0, i):max(0, j):]\n           def __setslice__(self, i, j, seq):\n               self[max(0, i):max(0, j):] = seq\n           def __delslice__(self, i, j):\n               del self[max(0, i):max(0, j):]\n       ...\n\nNote the calls to "max()"; these are necessary because of the handling\nof negative indices before the "__*slice__()" methods are called.\nWhen negative indexes are used, the "__*item__()" methods receive them\nas provided, but the "__*slice__()" methods get a "cooked" form of the\nindex values.  For each negative index value, the length of the\nsequence is added to the index before calling the method (which may\nstill result in a negative index); this is the customary handling of\nnegative indexes by the built-in sequence types, and the "__*item__()"\nmethods are expected to do this as well.  However, since they should\nalready be doing that, negative indexes cannot be passed in; they must\nbe constrained to the bounds of the sequence before being passed to\nthe "__*item__()" methods. Calling "max(0, i)" conveniently returns\nthe proper value.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n   These methods are called to implement the binary arithmetic\n   operations ("+", "-", "*", "//", "%", "divmod()", "pow()", "**",\n   "<<", ">>", "&", "^", "|").  For instance, to evaluate the\n   expression "x + y", where *x* is an instance of a class that has an\n   "__add__()" method, "x.__add__(y)" is called.  The "__divmod__()"\n   method should be the equivalent to using "__floordiv__()" and\n   "__mod__()"; it should not be related to "__truediv__()" (described\n   below).  Note that "__pow__()" should be defined to accept an\n   optional third argument if the ternary version of the built-in\n   "pow()" function is to be supported.\n\n   If one of those methods does not support the operation with the\n   supplied arguments, it should return "NotImplemented".\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n   The division operator ("/") is implemented by these methods.  The\n   "__truediv__()" method is used when "__future__.division" is in\n   effect, otherwise "__div__()" is used.  If only one of these two\n   methods is defined, the object will not support division in the\n   alternate context; "TypeError" will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n   These methods are called to implement the binary arithmetic\n   operations ("+", "-", "*", "/", "%", "divmod()", "pow()", "**",\n   "<<", ">>", "&", "^", "|") with reflected (swapped) operands.\n   These functions are only called if the left operand does not\n   support the corresponding operation and the operands are of\n   different types. [2] For instance, to evaluate the expression "x -\n   y", where *y* is an instance of a class that has an "__rsub__()"\n   method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n   *NotImplemented*.\n\n   Note that ternary "pow()" will not try calling "__rpow__()" (the\n   coercion rules would become too complicated).\n\n   Note: If the right operand\'s type is a subclass of the left\n     operand\'s type and that subclass provides the reflected method\n     for the operation, this method will be called before the left\n     operand\'s non-reflected method.  This behavior allows subclasses\n     to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n   These methods are called to implement the augmented arithmetic\n   assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n   ">>=", "&=", "^=", "|=").  These methods should attempt to do the\n   operation in-place (modifying *self*) and return the result (which\n   could be, but does not have to be, *self*).  If a specific method\n   is not defined, the augmented assignment falls back to the normal\n   methods.  For instance, to execute the statement "x += y", where\n   *x* is an instance of a class that has an "__iadd__()" method,\n   "x.__iadd__(y)" is called.  If *x* is an instance of a class that\n   does not define a "__iadd__()" method, "x.__add__(y)" and\n   "y.__radd__(x)" are considered, as with the evaluation of "x + y".\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n   Called to implement the unary arithmetic operations ("-", "+",\n   "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n   Called to implement the built-in functions "complex()", "int()",\n   "long()", and "float()".  Should return a value of the appropriate\n   type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n   Called to implement the built-in functions "oct()" and "hex()".\n   Should return a string value.\n\nobject.__index__(self)\n\n   Called to implement "operator.index()".  Also called whenever\n   Python needs an integer object (such as in slicing).  Must return\n   an integer (int or long).\n\n   New in version 2.5.\n\nobject.__coerce__(self, other)\n\n   Called to implement "mixed-mode" numeric arithmetic.  Should either\n   return a 2-tuple containing *self* and *other* converted to a\n   common numeric type, or "None" if conversion is impossible.  When\n   the common type would be the type of "other", it is sufficient to\n   return "None", since the interpreter will also ask the other object\n   to attempt a coercion (but sometimes, if the implementation of the\n   other type cannot be changed, it is useful to do the conversion to\n   the other type here).  A return value of "NotImplemented" is\n   equivalent to returning "None".\n\n\nCoercion rules\n==============\n\nThis section used to document the rules for coercion.  As the language\nhas evolved, the coercion rules have become hard to document\nprecisely; documenting what one version of one particular\nimplementation does is undesirable.  Instead, here are some informal\nguidelines regarding coercion.  In Python 3, coercion will not be\nsupported.\n\n* If the left operand of a % operator is a string or Unicode object,\n  no coercion takes place and the string formatting operation is\n  invoked instead.\n\n* It is no longer recommended to define a coercion operation. Mixed-\n  mode operations on types that don\'t define coercion pass the\n  original arguments to the operation.\n\n* New-style classes (those derived from "object") never invoke the\n  "__coerce__()" method in response to a binary operator; the only\n  time "__coerce__()" is invoked is when the built-in function\n  "coerce()" is called.\n\n* For most intents and purposes, an operator that returns\n  "NotImplemented" is treated the same as one that is not implemented\n  at all.\n\n* Below, "__op__()" and "__rop__()" are used to signify the generic\n  method names corresponding to an operator; "__iop__()" is used for\n  the corresponding in-place operator.  For example, for the operator\n  \'"+"\', "__add__()" and "__radd__()" are used for the left and right\n  variant of the binary operator, and "__iadd__()" for the in-place\n  variant.\n\n* For objects *x* and *y*, first "x.__op__(y)" is tried.  If this is\n  not implemented or returns "NotImplemented", "y.__rop__(x)" is\n  tried.  If this is also not implemented or returns "NotImplemented",\n  a "TypeError" exception is raised.  But see the following exception:\n\n* Exception to the previous item: if the left operand is an instance\n  of a built-in type or a new-style class, and the right operand is an\n  instance of a proper subclass of that type or class and overrides\n  the base\'s "__rop__()" method, the right operand\'s "__rop__()"\n  method is tried *before* the left operand\'s "__op__()" method.\n\n  This is done so that a subclass can completely override binary\n  operators. Otherwise, the left operand\'s "__op__()" method would\n  always accept the right operand: when an instance of a given class\n  is expected, an instance of a subclass of that class is always\n  acceptable.\n\n* When either operand type defines a coercion, this coercion is\n  called before that type\'s "__op__()" or "__rop__()" method is\n  called, but no sooner.  If the coercion returns an object of a\n  different type for the operand whose coercion is invoked, part of\n  the process is redone using the new object.\n\n* When an in-place operator (like \'"+="\') is used, if the left\n  operand implements "__iop__()", it is invoked without any coercion.\n  When the operation falls back to "__op__()" and/or "__rop__()", the\n  normal coercion rules apply.\n\n* In "x + y", if *x* is a sequence that implements sequence\n  concatenation, sequence concatenation is invoked.\n\n* In "x * y", if one operand is a sequence that implements sequence\n  repetition, and the other is an integer ("int" or "long"), sequence\n  repetition is invoked.\n\n* Rich comparisons (implemented by methods "__eq__()" and so on)\n  never use coercion.  Three-way comparison (implemented by\n  "__cmp__()") does use coercion under the same conditions as other\n  binary operations use it.\n\n* In the current implementation, the built-in numeric types "int",\n  "long", "float", and "complex" do not use coercion. All these types\n  implement a "__coerce__()" method, for use by the built-in\n  "coerce()" function.\n\n  Changed in version 2.7: The complex type no longer makes implicit\n  calls to the "__coerce__()" method for mixed-type binary arithmetic\n  operations.\n\n\nWith Statement Context Managers\n===============================\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code.  Context managers are normally\ninvoked using the "with" statement (described in section The with\nstatement), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see Context Manager Types.\n\nobject.__enter__(self)\n\n   Enter the runtime context related to this object. The "with"\n   statement will bind this method\'s return value to the target(s)\n   specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n   Exit the runtime context related to this object. The parameters\n   describe the exception that caused the context to be exited. If the\n   context was exited without an exception, all three arguments will\n   be "None".\n\n   If an exception is supplied, and the method wishes to suppress the\n   exception (i.e., prevent it from being propagated), it should\n   return a true value. Otherwise, the exception will be processed\n   normally upon exit from this method.\n\n   Note that "__exit__()" methods should not reraise the passed-in\n   exception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\n     The specification, background, and examples for the Python "with"\n     statement.\n\n\nSpecial method lookup for old-style classes\n===========================================\n\nFor old-style classes, special methods are always looked up in exactly\nthe same way as any other method or attribute. This is the case\nregardless of whether the method is being looked up explicitly as in\n"x.__getitem__(i)" or implicitly as in "x[i]".\n\nThis behaviour means that special methods may exhibit different\nbehaviour for different instances of a single old-style class if the\nappropriate special attributes are set differently:\n\n   >>> class C:\n   ...     pass\n   ...\n   >>> c1 = C()\n   >>> c2 = C()\n   >>> c1.__len__ = lambda: 5\n   >>> c2.__len__ = lambda: 9\n   >>> len(c1)\n   5\n   >>> len(c2)\n   9\n\n\nSpecial method lookup for new-style classes\n===========================================\n\nFor new-style classes, implicit invocations of special methods are\nonly guaranteed to work correctly if defined on an object\'s type, not\nin the object\'s instance dictionary.  That behaviour is the reason why\nthe following code raises an exception (unlike the equivalent example\nwith old-style classes):\n\n   >>> class C(object):\n   ...     pass\n   ...\n   >>> c = C()\n   >>> c.__len__ = lambda: 5\n   >>> len(c)\n   Traceback (most recent call last):\n     File "<stdin>", line 1, in <module>\n   TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n   >>> 1 .__hash__() == hash(1)\n   True\n   >>> int.__hash__() == hash(int)\n   Traceback (most recent call last):\n     File "<stdin>", line 1, in <module>\n   TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n   >>> type(1).__hash__(1) == hash(1)\n   True\n   >>> type(int).__hash__(int) == hash(int)\n   True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n   >>> class Meta(type):\n   ...    def __getattribute__(*args):\n   ...       print "Metaclass getattribute invoked"\n   ...       return type.__getattribute__(*args)\n   ...\n   >>> class C(object):\n   ...     __metaclass__ = Meta\n   ...     def __len__(self):\n   ...         return 10\n   ...     def __getattribute__(*args):\n   ...         print "Class getattribute invoked"\n   ...         return object.__getattribute__(*args)\n   ...\n   >>> c = C()\n   >>> c.__len__()                 # Explicit lookup via instance\n   Class getattribute invoked\n   10\n   >>> type(c).__len__(c)          # Explicit lookup via type\n   Metaclass getattribute invoked\n   10\n   >>> len(c)                      # Implicit lookup\n   10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n\n-[ Footnotes ]-\n\n[1] It *is* possible in some cases to change an object\'s type,\n    under certain controlled conditions. It generally isn\'t a good\n    idea though, since it can lead to some very strange behaviour if\n    it is handled incorrectly.\n\n[2] For operands of the same type, it is assumed that if the non-\n    reflected method (such as "__add__()") fails the operation is not\n    supported, which is why the reflected method is not called.\n',\r
+ 'string-methods': u'\nString Methods\n**************\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support.  Some of them are also available on\n"bytearray" objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange section. To output formatted strings use\ntemplate strings or the "%" operator described in the String\nFormatting Operations section. Also, see the "re" module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n   Return a copy of the string with its first character capitalized\n   and the rest lowercased.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n   Return centered in a string of length *width*. Padding is done\n   using the specified *fillchar* (default is a space).\n\n   Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n   Return the number of non-overlapping occurrences of substring *sub*\n   in the range [*start*, *end*].  Optional arguments *start* and\n   *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n   Decodes the string using the codec registered for *encoding*.\n   *encoding* defaults to the default string encoding.  *errors* may\n   be given to set a different error handling scheme.  The default is\n   "\'strict\'", meaning that encoding errors raise "UnicodeError".\n   Other possible values are "\'ignore\'", "\'replace\'" and any other\n   name registered via "codecs.register_error()", see section Codec\n   Base Classes.\n\n   New in version 2.2.\n\n   Changed in version 2.3: Support for other error handling schemes\n   added.\n\n   Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n   Return an encoded version of the string.  Default encoding is the\n   current default string encoding.  *errors* may be given to set a\n   different error handling scheme.  The default for *errors* is\n   "\'strict\'", meaning that encoding errors raise a "UnicodeError".\n   Other possible values are "\'ignore\'", "\'replace\'",\n   "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other name\n   registered via "codecs.register_error()", see section Codec Base\n   Classes. For a list of possible encodings, see section Standard\n   Encodings.\n\n   New in version 2.0.\n\n   Changed in version 2.3: Support for "\'xmlcharrefreplace\'" and\n   "\'backslashreplace\'" and other error handling schemes added.\n\n   Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n   Return "True" if the string ends with the specified *suffix*,\n   otherwise return "False".  *suffix* can also be a tuple of suffixes\n   to look for.  With optional *start*, test beginning at that\n   position.  With optional *end*, stop comparing at that position.\n\n   Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n   Return a copy of the string where all tab characters are replaced\n   by one or more spaces, depending on the current column and the\n   given tab size.  Tab positions occur every *tabsize* characters\n   (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n   To expand the string, the current column is set to zero and the\n   string is examined character by character.  If the character is a\n   tab ("\\t"), one or more space characters are inserted in the result\n   until the current column is equal to the next tab position. (The\n   tab character itself is not copied.)  If the character is a newline\n   ("\\n") or return ("\\r"), it is copied and the current column is\n   reset to zero.  Any other character is copied unchanged and the\n   current column is incremented by one regardless of how the\n   character is represented when printed.\n\n   >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n   \'01      012     0123    01234\'\n   >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n   \'01  012 0123    01234\'\n\nstr.find(sub[, start[, end]])\n\n   Return the lowest index in the string where substring *sub* is\n   found, such that *sub* is contained in the slice "s[start:end]".\n   Optional arguments *start* and *end* are interpreted as in slice\n   notation.  Return "-1" if *sub* is not found.\n\n   Note: The "find()" method should be used only if you need to know\n     the position of *sub*.  To check if *sub* is a substring or not,\n     use the "in" operator:\n\n        >>> \'Py\' in \'Python\'\n        True\n\nstr.format(*args, **kwargs)\n\n   Perform a string formatting operation.  The string on which this\n   method is called can contain literal text or replacement fields\n   delimited by braces "{}".  Each replacement field contains either\n   the numeric index of a positional argument, or the name of a\n   keyword argument.  Returns a copy of the string where each\n   replacement field is replaced with the string value of the\n   corresponding argument.\n\n   >>> "The sum of 1 + 2 is {0}".format(1+2)\n   \'The sum of 1 + 2 is 3\'\n\n   See Format String Syntax for a description of the various\n   formatting options that can be specified in format strings.\n\n   This method of string formatting is the new standard in Python 3,\n   and should be preferred to the "%" formatting described in String\n   Formatting Operations in new code.\n\n   New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n   Like "find()", but raise "ValueError" when the substring is not\n   found.\n\nstr.isalnum()\n\n   Return true if all characters in the string are alphanumeric and\n   there is at least one character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n   Return true if all characters in the string are alphabetic and\n   there is at least one character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n   Return true if all characters in the string are digits and there is\n   at least one character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n   Return true if all cased characters [4] in the string are lowercase\n   and there is at least one cased character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n   Return true if there are only whitespace characters in the string\n   and there is at least one character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n   Return true if the string is a titlecased string and there is at\n   least one character, for example uppercase characters may only\n   follow uncased characters and lowercase characters only cased ones.\n   Return false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n   Return true if all cased characters [4] in the string are uppercase\n   and there is at least one cased character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n   Return a string which is the concatenation of the strings in the\n   *iterable* *iterable*.  The separator between elements is the\n   string providing this method.\n\nstr.ljust(width[, fillchar])\n\n   Return the string left justified in a string of length *width*.\n   Padding is done using the specified *fillchar* (default is a\n   space).  The original string is returned if *width* is less than or\n   equal to "len(s)".\n\n   Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n   Return a copy of the string with all the cased characters [4]\n   converted to lowercase.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n   Return a copy of the string with leading characters removed.  The\n   *chars* argument is a string specifying the set of characters to be\n   removed.  If omitted or "None", the *chars* argument defaults to\n   removing whitespace.  The *chars* argument is not a prefix; rather,\n   all combinations of its values are stripped:\n\n   >>> \'   spacious   \'.lstrip()\n   \'spacious   \'\n   >>> \'www.example.com\'.lstrip(\'cmowz.\')\n   \'example.com\'\n\n   Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n   Split the string at the first occurrence of *sep*, and return a\n   3-tuple containing the part before the separator, the separator\n   itself, and the part after the separator.  If the separator is not\n   found, return a 3-tuple containing the string itself, followed by\n   two empty strings.\n\n   New in version 2.5.\n\nstr.replace(old, new[, count])\n\n   Return a copy of the string with all occurrences of substring *old*\n   replaced by *new*.  If the optional argument *count* is given, only\n   the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n   Return the highest index in the string where substring *sub* is\n   found, such that *sub* is contained within "s[start:end]".\n   Optional arguments *start* and *end* are interpreted as in slice\n   notation.  Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n   Like "rfind()" but raises "ValueError" when the substring *sub* is\n   not found.\n\nstr.rjust(width[, fillchar])\n\n   Return the string right justified in a string of length *width*.\n   Padding is done using the specified *fillchar* (default is a\n   space). The original string is returned if *width* is less than or\n   equal to "len(s)".\n\n   Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n   Split the string at the last occurrence of *sep*, and return a\n   3-tuple containing the part before the separator, the separator\n   itself, and the part after the separator.  If the separator is not\n   found, return a 3-tuple containing two empty strings, followed by\n   the string itself.\n\n   New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n   Return a list of the words in the string, using *sep* as the\n   delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n   are done, the *rightmost* ones.  If *sep* is not specified or\n   "None", any whitespace string is a separator.  Except for splitting\n   from the right, "rsplit()" behaves like "split()" which is\n   described in detail below.\n\n   New in version 2.4.\n\nstr.rstrip([chars])\n\n   Return a copy of the string with trailing characters removed.  The\n   *chars* argument is a string specifying the set of characters to be\n   removed.  If omitted or "None", the *chars* argument defaults to\n   removing whitespace.  The *chars* argument is not a suffix; rather,\n   all combinations of its values are stripped:\n\n   >>> \'   spacious   \'.rstrip()\n   \'   spacious\'\n   >>> \'mississippi\'.rstrip(\'ipz\')\n   \'mississ\'\n\n   Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n   Return a list of the words in the string, using *sep* as the\n   delimiter string.  If *maxsplit* is given, at most *maxsplit*\n   splits are done (thus, the list will have at most "maxsplit+1"\n   elements).  If *maxsplit* is not specified or "-1", then there is\n   no limit on the number of splits (all possible splits are made).\n\n   If *sep* is given, consecutive delimiters are not grouped together\n   and are deemed to delimit empty strings (for example,\n   "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']").  The *sep* argument\n   may consist of multiple characters (for example,\n   "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n   empty string with a specified separator returns "[\'\']".\n\n   If *sep* is not specified or is "None", a different splitting\n   algorithm is applied: runs of consecutive whitespace are regarded\n   as a single separator, and the result will contain no empty strings\n   at the start or end if the string has leading or trailing\n   whitespace.  Consequently, splitting an empty string or a string\n   consisting of just whitespace with a "None" separator returns "[]".\n\n   For example, "\' 1  2   3  \'.split()" returns "[\'1\', \'2\', \'3\']", and\n   "\'  1  2   3  \'.split(None, 1)" returns "[\'1\', \'2   3  \']".\n\nstr.splitlines([keepends])\n\n   Return a list of the lines in the string, breaking at line\n   boundaries. This method uses the *universal newlines* approach to\n   splitting lines. Line breaks are not included in the resulting list\n   unless *keepends* is given and true.\n\n   For example, "\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()" returns "[\'ab\n   c\', \'\', \'de fg\', \'kl\']", while the same call with\n   "splitlines(True)" returns "[\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']".\n\n   Unlike "split()" when a delimiter string *sep* is given, this\n   method returns an empty list for the empty string, and a terminal\n   line break does not result in an extra line.\n\nstr.startswith(prefix[, start[, end]])\n\n   Return "True" if string starts with the *prefix*, otherwise return\n   "False". *prefix* can also be a tuple of prefixes to look for.\n   With optional *start*, test string beginning at that position.\n   With optional *end*, stop comparing string at that position.\n\n   Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n   Return a copy of the string with the leading and trailing\n   characters removed. The *chars* argument is a string specifying the\n   set of characters to be removed. If omitted or "None", the *chars*\n   argument defaults to removing whitespace. The *chars* argument is\n   not a prefix or suffix; rather, all combinations of its values are\n   stripped:\n\n   >>> \'   spacious   \'.strip()\n   \'spacious\'\n   >>> \'www.example.com\'.strip(\'cmowz.\')\n   \'example\'\n\n   Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n   Return a copy of the string with uppercase characters converted to\n   lowercase and vice versa.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n   Return a titlecased version of the string where words start with an\n   uppercase character and the remaining characters are lowercase.\n\n   The algorithm uses a simple language-independent definition of a\n   word as groups of consecutive letters.  The definition works in\n   many contexts but it means that apostrophes in contractions and\n   possessives form word boundaries, which may not be the desired\n   result:\n\n      >>> "they\'re bill\'s friends from the UK".title()\n      "They\'Re Bill\'S Friends From The Uk"\n\n   A workaround for apostrophes can be constructed using regular\n   expressions:\n\n      >>> import re\n      >>> def titlecase(s):\n      ...     return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n      ...                   lambda mo: mo.group(0)[0].upper() +\n      ...                              mo.group(0)[1:].lower(),\n      ...                   s)\n      ...\n      >>> titlecase("they\'re bill\'s friends.")\n      "They\'re Bill\'s Friends."\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n   Return a copy of the string where all characters occurring in the\n   optional argument *deletechars* are removed, and the remaining\n   characters have been mapped through the given translation table,\n   which must be a string of length 256.\n\n   You can use the "maketrans()" helper function in the "string"\n   module to create a translation table. For string objects, set the\n   *table* argument to "None" for translations that only delete\n   characters:\n\n   >>> \'read this short text\'.translate(None, \'aeiou\')\n   \'rd ths shrt txt\'\n\n   New in version 2.6: Support for a "None" *table* argument.\n\n   For Unicode objects, the "translate()" method does not accept the\n   optional *deletechars* argument.  Instead, it returns a copy of the\n   *s* where all characters have been mapped through the given\n   translation table which must be a mapping of Unicode ordinals to\n   Unicode ordinals, Unicode strings or "None". Unmapped characters\n   are left untouched. Characters mapped to "None" are deleted.  Note,\n   a more flexible approach is to create a custom character mapping\n   codec using the "codecs" module (see "encodings.cp1251" for an\n   example).\n\nstr.upper()\n\n   Return a copy of the string with all the cased characters [4]\n   converted to uppercase.  Note that "str.upper().isupper()" might be\n   "False" if "s" contains uncased characters or if the Unicode\n   category of the resulting character(s) is not "Lu" (Letter,\n   uppercase), but e.g. "Lt" (Letter, titlecase).\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n   Return the numeric string left filled with zeros in a string of\n   length *width*.  A sign prefix is handled correctly.  The original\n   string is returned if *width* is less than or equal to "len(s)".\n\n   New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n   Return "True" if there are only numeric characters in S, "False"\n   otherwise. Numeric characters include digit characters, and all\n   characters that have the Unicode numeric value property, e.g.\n   U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n   Return "True" if there are only decimal characters in S, "False"\n   otherwise. Decimal characters include digit characters, and all\n   characters that can be used to form decimal-radix numbers, e.g.\n   U+0660, ARABIC-INDIC DIGIT ZERO.\n',\r
+ 'strings': u'\nString literals\n***************\n\nString literals are described by the following lexical definitions:\n\n   stringliteral   ::= [stringprefix](shortstring | longstring)\n   stringprefix    ::= "r" | "u" | "ur" | "R" | "U" | "UR" | "Ur" | "uR"\n                    | "b" | "B" | "br" | "Br" | "bR" | "BR"\n   shortstring     ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n   longstring      ::= "\'\'\'" longstringitem* "\'\'\'"\n                  | \'"""\' longstringitem* \'"""\'\n   shortstringitem ::= shortstringchar | escapeseq\n   longstringitem  ::= longstringchar | escapeseq\n   shortstringchar ::= <any source character except "\\" or newline or the quote>\n   longstringchar  ::= <any source character except "\\">\n   escapeseq       ::= "\\" <any ASCII character>\n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the "stringprefix" and the rest of\nthe string literal. The source character set is defined by the\nencoding declaration; it is ASCII if no encoding declaration is given\nin the source file; see section Encoding declarations.\n\nIn plain English: String literals can be enclosed in matching single\nquotes ("\'") or double quotes (""").  They can also be enclosed in\nmatching groups of three single or double quotes (these are generally\nreferred to as *triple-quoted strings*).  The backslash ("\\")\ncharacter is used to escape characters that otherwise have a special\nmeaning, such as newline, backslash itself, or the quote character.\nString literals may optionally be prefixed with a letter "\'r\'" or\n"\'R\'"; such strings are called *raw strings* and use different rules\nfor interpreting backslash escape sequences.  A prefix of "\'u\'" or\n"\'U\'" makes the string a Unicode string.  Unicode strings use the\nUnicode character set as defined by the Unicode Consortium and ISO\n10646.  Some additional escape sequences, described below, are\navailable in Unicode strings. A prefix of "\'b\'" or "\'B\'" is ignored in\nPython 2; it indicates that the literal should become a bytes literal\nin Python 3 (e.g. when code is automatically converted with 2to3).  A\n"\'u\'" or "\'b\'" prefix may be followed by an "\'r\'" prefix.\n\nIn triple-quoted strings, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the string.  (A "quote" is the character used to open the\nstring, i.e. either "\'" or """.)\n\nUnless an "\'r\'" or "\'R\'" prefix is present, escape sequences in\nstrings are interpreted according to rules similar to those used by\nStandard C.  The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence   | Meaning                           | Notes   |\n+===================+===================================+=========+\n| "\\newline"        | Ignored                           |         |\n+-------------------+-----------------------------------+---------+\n| "\\\\"              | Backslash ("\\")                   |         |\n+-------------------+-----------------------------------+---------+\n| "\\\'"              | Single quote ("\'")                |         |\n+-------------------+-----------------------------------+---------+\n| "\\""              | Double quote (""")                |         |\n+-------------------+-----------------------------------+---------+\n| "\\a"              | ASCII Bell (BEL)                  |         |\n+-------------------+-----------------------------------+---------+\n| "\\b"              | ASCII Backspace (BS)              |         |\n+-------------------+-----------------------------------+---------+\n| "\\f"              | ASCII Formfeed (FF)               |         |\n+-------------------+-----------------------------------+---------+\n| "\\n"              | ASCII Linefeed (LF)               |         |\n+-------------------+-----------------------------------+---------+\n| "\\N{name}"        | Character named *name* in the     |         |\n|                   | Unicode database (Unicode only)   |         |\n+-------------------+-----------------------------------+---------+\n| "\\r"              | ASCII Carriage Return (CR)        |         |\n+-------------------+-----------------------------------+---------+\n| "\\t"              | ASCII Horizontal Tab (TAB)        |         |\n+-------------------+-----------------------------------+---------+\n| "\\uxxxx"          | Character with 16-bit hex value   | (1)     |\n|                   | *xxxx* (Unicode only)             |         |\n+-------------------+-----------------------------------+---------+\n| "\\Uxxxxxxxx"      | Character with 32-bit hex value   | (2)     |\n|                   | *xxxxxxxx* (Unicode only)         |         |\n+-------------------+-----------------------------------+---------+\n| "\\v"              | ASCII Vertical Tab (VT)           |         |\n+-------------------+-----------------------------------+---------+\n| "\\ooo"            | Character with octal value *ooo*  | (3,5)   |\n+-------------------+-----------------------------------+---------+\n| "\\xhh"            | Character with hex value *hh*     | (4,5)   |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. Individual code units which form parts of a surrogate pair can\n   be encoded using this escape sequence.\n\n2. Any Unicode character can be encoded this way, but characters\n   outside the Basic Multilingual Plane (BMP) will be encoded using a\n   surrogate pair if Python is compiled to use 16-bit code units (the\n   default).\n\n3. As in Standard C, up to three octal digits are accepted.\n\n4. Unlike in Standard C, exactly two hex digits are required.\n\n5. In a string literal, hexadecimal and octal escapes denote the\n   byte with the given value; it is not necessary that the byte\n   encodes a character in the source character set. In a Unicode\n   literal, these escapes denote a Unicode character with the given\n   value.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the string*.  (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.)  It is also\nimportant to note that the escape sequences marked as "(Unicode only)"\nin the table above fall into the category of unrecognized escapes for\nnon-Unicode string literals.\n\nWhen an "\'r\'" or "\'R\'" prefix is present, a character following a\nbackslash is included in the string without change, and *all\nbackslashes are left in the string*.  For example, the string literal\n"r"\\n"" consists of two characters: a backslash and a lowercase "\'n\'".\nString quotes can be escaped with a backslash, but the backslash\nremains in the string; for example, "r"\\""" is a valid string literal\nconsisting of two characters: a backslash and a double quote; "r"\\""\nis not a valid string literal (even a raw string cannot end in an odd\nnumber of backslashes).  Specifically, *a raw string cannot end in a\nsingle backslash* (since the backslash would escape the following\nquote character).  Note also that a single backslash followed by a\nnewline is interpreted as those two characters as part of the string,\n*not* as a line continuation.\n\nWhen an "\'r\'" or "\'R\'" prefix is used in conjunction with a "\'u\'" or\n"\'U\'" prefix, then the "\\uXXXX" and "\\UXXXXXXXX" escape sequences are\nprocessed while  *all other backslashes are left in the string*. For\nexample, the string literal "ur"\\u0062\\n"" consists of three Unicode\ncharacters: \'LATIN SMALL LETTER B\', \'REVERSE SOLIDUS\', and \'LATIN\nSMALL LETTER N\'. Backslashes can be escaped with a preceding\nbackslash; however, both remain in the string.  As a result, "\\uXXXX"\nescape sequences are only recognized when there are an odd number of\nbackslashes.\n',\r
+ 'subscriptions': u'\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\n   subscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object of a sequence or mapping type.\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey.  (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to a\nplain integer.  If this value is negative, the length of the sequence\nis added to it (so that, e.g., "x[-1]" selects the last item of "x".)\nThe resulting value must be a nonnegative integer less than the number\nof items in the sequence, and the subscription selects the item whose\nindex is that value (counting from zero).\n\nA string\'s items are characters.  A character is not a separate data\ntype but a string of exactly one character.\n',\r
+ 'truth': u'\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an "if" or\n"while" condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* "None"\n\n* "False"\n\n* zero of any numeric type, for example, "0", "0L", "0.0", "0j".\n\n* any empty sequence, for example, "\'\'", "()", "[]".\n\n* any empty mapping, for example, "{}".\n\n* instances of user-defined classes, if the class defines a\n  "__nonzero__()" or "__len__()" method, when that method returns the\n  integer zero or "bool" value "False". [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn "0" or "False" for false and "1" or "True" for true, unless\notherwise stated. (Important exception: the Boolean operations "or"\nand "and" always return one of their operands.)\n',\r
+ 'try': u'\nThe "try" statement\n*******************\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n   try_stmt  ::= try1_stmt | try2_stmt\n   try1_stmt ::= "try" ":" suite\n                 ("except" [expression [("as" | ",") identifier]] ":" suite)+\n                 ["else" ":" suite]\n                 ["finally" ":" suite]\n   try2_stmt ::= "try" ":" suite\n                 "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n"try"..."except"..."finally" did not work. "try"..."except" had to be\nnested in "try"..."finally".\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started.  This search inspects the except clauses\nin turn until one is found that matches the exception.  An expression-\nless except clause, if present, must be last; it matches any\nexception.  For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception.  An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject, or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed.  All except clauses must have an\nexecutable block.  When the end of this block is reached, execution\ncontinues normally after the entire try statement.  (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the "sys" module:\n"sys.exc_type" receives the object identifying the exception;\n"sys.exc_value" receives the exception\'s parameter;\n"sys.exc_traceback" receives a traceback object (see section The\nstandard type hierarchy) identifying the point in the program where\nthe exception occurred. These details are also available through the\n"sys.exc_info()" function, which returns a tuple "(exc_type,\nexc_value, exc_traceback)".  Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program.  As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler.  The "try"\nclause is executed, including any "except" and "else" clauses.  If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed.  If\nthere is a saved exception, it is re-raised at the end of the\n"finally" clause. If the "finally" clause raises another exception or\nexecutes a "return" or "break" statement, the saved exception is\ndiscarded:\n\n   >>> def f():\n   ...     try:\n   ...         1/0\n   ...     finally:\n   ...         return 42\n   ...\n   >>> f()\n   42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed.  Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n   >>> def foo():\n   ...     try:\n   ...         return \'try\'\n   ...     finally:\n   ...         return \'finally\'\n   ...\n   >>> foo()\n   \'finally\'\n\nAdditional information on exceptions can be found in section\nExceptions, and information on using the "raise" statement to generate\nexceptions may be found in section The raise statement.\n',\r
+ 'types': u'\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python.  Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types.  Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.).\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\'  These are attributes that provide access to the\nimplementation and are not intended for general use.  Their definition\nmay change in the future.\n\nNone\n   This type has a single value.  There is a single object with this\n   value. This object is accessed through the built-in name "None". It\n   is used to signify the absence of a value in many situations, e.g.,\n   it is returned from functions that don\'t explicitly return\n   anything. Its truth value is false.\n\nNotImplemented\n   This type has a single value.  There is a single object with this\n   value. This object is accessed through the built-in name\n   "NotImplemented". Numeric methods and rich comparison methods may\n   return this value if they do not implement the operation for the\n   operands provided.  (The interpreter will then try the reflected\n   operation, or some other fallback, depending on the operator.)  Its\n   truth value is true.\n\nEllipsis\n   This type has a single value.  There is a single object with this\n   value. This object is accessed through the built-in name\n   "Ellipsis". It is used to indicate the presence of the "..." syntax\n   in a slice.  Its truth value is true.\n\n"numbers.Number"\n   These are created by numeric literals and returned as results by\n   arithmetic operators and arithmetic built-in functions.  Numeric\n   objects are immutable; once created their value never changes.\n   Python numbers are of course strongly related to mathematical\n   numbers, but subject to the limitations of numerical representation\n   in computers.\n\n   Python distinguishes between integers, floating point numbers, and\n   complex numbers:\n\n   "numbers.Integral"\n      These represent elements from the mathematical set of integers\n      (positive and negative).\n\n      There are three types of integers:\n\n      Plain integers\n         These represent numbers in the range -2147483648 through\n         2147483647. (The range may be larger on machines with a\n         larger natural word size, but not smaller.)  When the result\n         of an operation would fall outside this range, the result is\n         normally returned as a long integer (in some cases, the\n         exception "OverflowError" is raised instead).  For the\n         purpose of shift and mask operations, integers are assumed to\n         have a binary, 2\'s complement notation using 32 or more bits,\n         and hiding no bits from the user (i.e., all 4294967296\n         different bit patterns correspond to different values).\n\n      Long integers\n         These represent numbers in an unlimited range, subject to\n         available (virtual) memory only.  For the purpose of shift\n         and mask operations, a binary representation is assumed, and\n         negative numbers are represented in a variant of 2\'s\n         complement which gives the illusion of an infinite string of\n         sign bits extending to the left.\n\n      Booleans\n         These represent the truth values False and True.  The two\n         objects representing the values "False" and "True" are the\n         only Boolean objects. The Boolean type is a subtype of plain\n         integers, and Boolean values behave like the values 0 and 1,\n         respectively, in almost all contexts, the exception being\n         that when converted to a string, the strings ""False"" or\n         ""True"" are returned, respectively.\n\n      The rules for integer representation are intended to give the\n      most meaningful interpretation of shift and mask operations\n      involving negative integers and the least surprises when\n      switching between the plain and long integer domains.  Any\n      operation, if it yields a result in the plain integer domain,\n      will yield the same result in the long integer domain or when\n      using mixed operands.  The switch between domains is transparent\n      to the programmer.\n\n   "numbers.Real" ("float")\n      These represent machine-level double precision floating point\n      numbers. You are at the mercy of the underlying machine\n      architecture (and C or Java implementation) for the accepted\n      range and handling of overflow. Python does not support single-\n      precision floating point numbers; the savings in processor and\n      memory usage that are usually the reason for using these are\n      dwarfed by the overhead of using objects in Python, so there is\n      no reason to complicate the language with two kinds of floating\n      point numbers.\n\n   "numbers.Complex"\n      These represent complex numbers as a pair of machine-level\n      double precision floating point numbers.  The same caveats apply\n      as for floating point numbers. The real and imaginary parts of a\n      complex number "z" can be retrieved through the read-only\n      attributes "z.real" and "z.imag".\n\nSequences\n   These represent finite ordered sets indexed by non-negative\n   numbers. The built-in function "len()" returns the number of items\n   of a sequence. When the length of a sequence is *n*, the index set\n   contains the numbers 0, 1, ..., *n*-1.  Item *i* of sequence *a* is\n   selected by "a[i]".\n\n   Sequences also support slicing: "a[i:j]" selects all items with\n   index *k* such that *i* "<=" *k* "<" *j*.  When used as an\n   expression, a slice is a sequence of the same type.  This implies\n   that the index set is renumbered so that it starts at 0.\n\n   Some sequences also support "extended slicing" with a third "step"\n   parameter: "a[i:j:k]" selects all items of *a* with index *x* where\n   "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n\n   Sequences are distinguished according to their mutability:\n\n   Immutable sequences\n      An object of an immutable sequence type cannot change once it is\n      created.  (If the object contains references to other objects,\n      these other objects may be mutable and may be changed; however,\n      the collection of objects directly referenced by an immutable\n      object cannot change.)\n\n      The following types are immutable sequences:\n\n      Strings\n         The items of a string are characters.  There is no separate\n         character type; a character is represented by a string of one\n         item. Characters represent (at least) 8-bit bytes.  The\n         built-in functions "chr()" and "ord()" convert between\n         characters and nonnegative integers representing the byte\n         values.  Bytes with the values 0-127 usually represent the\n         corresponding ASCII values, but the interpretation of values\n         is up to the program.  The string data type is also used to\n         represent arrays of bytes, e.g., to hold data read from a\n         file.\n\n         (On systems whose native character set is not ASCII, strings\n         may use EBCDIC in their internal representation, provided the\n         functions "chr()" and "ord()" implement a mapping between\n         ASCII and EBCDIC, and string comparison preserves the ASCII\n         order. Or perhaps someone can propose a better rule?)\n\n      Unicode\n         The items of a Unicode object are Unicode code units.  A\n         Unicode code unit is represented by a Unicode object of one\n         item and can hold either a 16-bit or 32-bit value\n         representing a Unicode ordinal (the maximum value for the\n         ordinal is given in "sys.maxunicode", and depends on how\n         Python is configured at compile time).  Surrogate pairs may\n         be present in the Unicode object, and will be reported as two\n         separate items.  The built-in functions "unichr()" and\n         "ord()" convert between code units and nonnegative integers\n         representing the Unicode ordinals as defined in the Unicode\n         Standard 3.0. Conversion from and to other encodings are\n         possible through the Unicode method "encode()" and the built-\n         in function "unicode()".\n\n      Tuples\n         The items of a tuple are arbitrary Python objects. Tuples of\n         two or more items are formed by comma-separated lists of\n         expressions.  A tuple of one item (a \'singleton\') can be\n         formed by affixing a comma to an expression (an expression by\n         itself does not create a tuple, since parentheses must be\n         usable for grouping of expressions).  An empty tuple can be\n         formed by an empty pair of parentheses.\n\n   Mutable sequences\n      Mutable sequences can be changed after they are created.  The\n      subscription and slicing notations can be used as the target of\n      assignment and "del" (delete) statements.\n\n      There are currently two intrinsic mutable sequence types:\n\n      Lists\n         The items of a list are arbitrary Python objects.  Lists are\n         formed by placing a comma-separated list of expressions in\n         square brackets. (Note that there are no special cases needed\n         to form lists of length 0 or 1.)\n\n      Byte Arrays\n         A bytearray object is a mutable array. They are created by\n         the built-in "bytearray()" constructor.  Aside from being\n         mutable (and hence unhashable), byte arrays otherwise provide\n         the same interface and functionality as immutable bytes\n         objects.\n\n      The extension module "array" provides an additional example of a\n      mutable sequence type.\n\nSet types\n   These represent unordered, finite sets of unique, immutable\n   objects. As such, they cannot be indexed by any subscript. However,\n   they can be iterated over, and the built-in function "len()"\n   returns the number of items in a set. Common uses for sets are fast\n   membership testing, removing duplicates from a sequence, and\n   computing mathematical operations such as intersection, union,\n   difference, and symmetric difference.\n\n   For set elements, the same immutability rules apply as for\n   dictionary keys. Note that numeric types obey the normal rules for\n   numeric comparison: if two numbers compare equal (e.g., "1" and\n   "1.0"), only one of them can be contained in a set.\n\n   There are currently two intrinsic set types:\n\n   Sets\n      These represent a mutable set. They are created by the built-in\n      "set()" constructor and can be modified afterwards by several\n      methods, such as "add()".\n\n   Frozen sets\n      These represent an immutable set.  They are created by the\n      built-in "frozenset()" constructor.  As a frozenset is immutable\n      and *hashable*, it can be used again as an element of another\n      set, or as a dictionary key.\n\nMappings\n   These represent finite sets of objects indexed by arbitrary index\n   sets. The subscript notation "a[k]" selects the item indexed by "k"\n   from the mapping "a"; this can be used in expressions and as the\n   target of assignments or "del" statements. The built-in function\n   "len()" returns the number of items in a mapping.\n\n   There is currently a single intrinsic mapping type:\n\n   Dictionaries\n      These represent finite sets of objects indexed by nearly\n      arbitrary values.  The only types of values not acceptable as\n      keys are values containing lists or dictionaries or other\n      mutable types that are compared by value rather than by object\n      identity, the reason being that the efficient implementation of\n      dictionaries requires a key\'s hash value to remain constant.\n      Numeric types used for keys obey the normal rules for numeric\n      comparison: if two numbers compare equal (e.g., "1" and "1.0")\n      then they can be used interchangeably to index the same\n      dictionary entry.\n\n      Dictionaries are mutable; they can be created by the "{...}"\n      notation (see section Dictionary displays).\n\n      The extension modules "dbm", "gdbm", and "bsddb" provide\n      additional examples of mapping types.\n\nCallable types\n   These are the types to which the function call operation (see\n   section Calls) can be applied:\n\n   User-defined functions\n      A user-defined function object is created by a function\n      definition (see section Function definitions).  It should be\n      called with an argument list containing the same number of items\n      as the function\'s formal parameter list.\n\n      Special attributes:\n\n      +-------------------------+---------------------------------+-------------+\n      | Attribute               | Meaning                         |             |\n      +=========================+=================================+=============+\n      | "__doc__" "func_doc"    | The function\'s documentation    | Writable    |\n      |                         | string, or "None" if            |             |\n      |                         | unavailable.                    |             |\n      +-------------------------+---------------------------------+-------------+\n      | "__name__" "func_name"  | The function\'s name.            | Writable    |\n      +-------------------------+---------------------------------+-------------+\n      | "__module__"            | The name of the module the      | Writable    |\n      |                         | function was defined in, or     |             |\n      |                         | "None" if unavailable.          |             |\n      +-------------------------+---------------------------------+-------------+\n      | "__defaults__"          | A tuple containing default      | Writable    |\n      | "func_defaults"         | argument values for those       |             |\n      |                         | arguments that have defaults,   |             |\n      |                         | or "None" if no arguments have  |             |\n      |                         | a default value.                |             |\n      +-------------------------+---------------------------------+-------------+\n      | "__code__" "func_code"  | The code object representing    | Writable    |\n      |                         | the compiled function body.     |             |\n      +-------------------------+---------------------------------+-------------+\n      | "__globals__"           | A reference to the dictionary   | Read-only   |\n      | "func_globals"          | that holds the function\'s       |             |\n      |                         | global variables --- the global |             |\n      |                         | namespace of the module in      |             |\n      |                         | which the function was defined. |             |\n      +-------------------------+---------------------------------+-------------+\n      | "__dict__" "func_dict"  | The namespace supporting        | Writable    |\n      |                         | arbitrary function attributes.  |             |\n      +-------------------------+---------------------------------+-------------+\n      | "__closure__"           | "None" or a tuple of cells that | Read-only   |\n      | "func_closure"          | contain bindings for the        |             |\n      |                         | function\'s free variables.      |             |\n      +-------------------------+---------------------------------+-------------+\n\n      Most of the attributes labelled "Writable" check the type of the\n      assigned value.\n\n      Changed in version 2.4: "func_name" is now writable.\n\n      Changed in version 2.6: The double-underscore attributes\n      "__closure__", "__code__", "__defaults__", and "__globals__"\n      were introduced as aliases for the corresponding "func_*"\n      attributes for forwards compatibility with Python 3.\n\n      Function objects also support getting and setting arbitrary\n      attributes, which can be used, for example, to attach metadata\n      to functions.  Regular attribute dot-notation is used to get and\n      set such attributes. *Note that the current implementation only\n      supports function attributes on user-defined functions. Function\n      attributes on built-in functions may be supported in the\n      future.*\n\n      Additional information about a function\'s definition can be\n      retrieved from its code object; see the description of internal\n      types below.\n\n   User-defined methods\n      A user-defined method object combines a class, a class instance\n      (or "None") and any callable object (normally a user-defined\n      function).\n\n      Special read-only attributes: "im_self" is the class instance\n      object, "im_func" is the function object; "im_class" is the\n      class of "im_self" for bound methods or the class that asked for\n      the method for unbound methods; "__doc__" is the method\'s\n      documentation (same as "im_func.__doc__"); "__name__" is the\n      method name (same as "im_func.__name__"); "__module__" is the\n      name of the module the method was defined in, or "None" if\n      unavailable.\n\n      Changed in version 2.2: "im_self" used to refer to the class\n      that defined the method.\n\n      Changed in version 2.6: For Python 3 forward-compatibility,\n      "im_func" is also available as "__func__", and "im_self" as\n      "__self__".\n\n      Methods also support accessing (but not setting) the arbitrary\n      function attributes on the underlying function object.\n\n      User-defined method objects may be created when getting an\n      attribute of a class (perhaps via an instance of that class), if\n      that attribute is a user-defined function object, an unbound\n      user-defined method object, or a class method object. When the\n      attribute is a user-defined method object, a new method object\n      is only created if the class from which it is being retrieved is\n      the same as, or a derived class of, the class stored in the\n      original method object; otherwise, the original method object is\n      used as it is.\n\n      When a user-defined method object is created by retrieving a\n      user-defined function object from a class, its "im_self"\n      attribute is "None" and the method object is said to be unbound.\n      When one is created by retrieving a user-defined function object\n      from a class via one of its instances, its "im_self" attribute\n      is the instance, and the method object is said to be bound. In\n      either case, the new method\'s "im_class" attribute is the class\n      from which the retrieval takes place, and its "im_func"\n      attribute is the original function object.\n\n      When a user-defined method object is created by retrieving\n      another method object from a class or instance, the behaviour is\n      the same as for a function object, except that the "im_func"\n      attribute of the new instance is not the original method object\n      but its "im_func" attribute.\n\n      When a user-defined method object is created by retrieving a\n      class method object from a class or instance, its "im_self"\n      attribute is the class itself, and its "im_func" attribute is\n      the function object underlying the class method.\n\n      When an unbound user-defined method object is called, the\n      underlying function ("im_func") is called, with the restriction\n      that the first argument must be an instance of the proper class\n      ("im_class") or of a derived class thereof.\n\n      When a bound user-defined method object is called, the\n      underlying function ("im_func") is called, inserting the class\n      instance ("im_self") in front of the argument list.  For\n      instance, when "C" is a class which contains a definition for a\n      function "f()", and "x" is an instance of "C", calling "x.f(1)"\n      is equivalent to calling "C.f(x, 1)".\n\n      When a user-defined method object is derived from a class method\n      object, the "class instance" stored in "im_self" will actually\n      be the class itself, so that calling either "x.f(1)" or "C.f(1)"\n      is equivalent to calling "f(C,1)" where "f" is the underlying\n      function.\n\n      Note that the transformation from function object to (unbound or\n      bound) method object happens each time the attribute is\n      retrieved from the class or instance. In some cases, a fruitful\n      optimization is to assign the attribute to a local variable and\n      call that local variable. Also notice that this transformation\n      only happens for user-defined functions; other callable objects\n      (and all non-callable objects) are retrieved without\n      transformation.  It is also important to note that user-defined\n      functions which are attributes of a class instance are not\n      converted to bound methods; this *only* happens when the\n      function is an attribute of the class.\n\n   Generator functions\n      A function or method which uses the "yield" statement (see\n      section The yield statement) is called a *generator function*.\n      Such a function, when called, always returns an iterator object\n      which can be used to execute the body of the function:  calling\n      the iterator\'s "next()" method will cause the function to\n      execute until it provides a value using the "yield" statement.\n      When the function executes a "return" statement or falls off the\n      end, a "StopIteration" exception is raised and the iterator will\n      have reached the end of the set of values to be returned.\n\n   Built-in functions\n      A built-in function object is a wrapper around a C function.\n      Examples of built-in functions are "len()" and "math.sin()"\n      ("math" is a standard built-in module). The number and type of\n      the arguments are determined by the C function. Special read-\n      only attributes: "__doc__" is the function\'s documentation\n      string, or "None" if unavailable; "__name__" is the function\'s\n      name; "__self__" is set to "None" (but see the next item);\n      "__module__" is the name of the module the function was defined\n      in or "None" if unavailable.\n\n   Built-in methods\n      This is really a different disguise of a built-in function, this\n      time containing an object passed to the C function as an\n      implicit extra argument.  An example of a built-in method is\n      "alist.append()", assuming *alist* is a list object. In this\n      case, the special read-only attribute "__self__" is set to the\n      object denoted by *alist*.\n\n   Class Types\n      Class types, or "new-style classes," are callable.  These\n      objects normally act as factories for new instances of\n      themselves, but variations are possible for class types that\n      override "__new__()".  The arguments of the call are passed to\n      "__new__()" and, in the typical case, to "__init__()" to\n      initialize the new instance.\n\n   Classic Classes\n      Class objects are described below.  When a class object is\n      called, a new class instance (also described below) is created\n      and returned.  This implies a call to the class\'s "__init__()"\n      method if it has one.  Any arguments are passed on to the\n      "__init__()" method.  If there is no "__init__()" method, the\n      class must be called without arguments.\n\n   Class instances\n      Class instances are described below.  Class instances are\n      callable only when the class has a "__call__()" method;\n      "x(arguments)" is a shorthand for "x.__call__(arguments)".\n\nModules\n   Modules are imported by the "import" statement (see section The\n   import statement). A module object has a namespace implemented by a\n   dictionary object (this is the dictionary referenced by the\n   func_globals attribute of functions defined in the module).\n   Attribute references are translated to lookups in this dictionary,\n   e.g., "m.x" is equivalent to "m.__dict__["x"]". A module object\n   does not contain the code object used to initialize the module\n   (since it isn\'t needed once the initialization is done).\n\n   Attribute assignment updates the module\'s namespace dictionary,\n   e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n\n   Special read-only attribute: "__dict__" is the module\'s namespace\n   as a dictionary object.\n\n   **CPython implementation detail:** Because of the way CPython\n   clears module dictionaries, the module dictionary will be cleared\n   when the module falls out of scope even if the dictionary still has\n   live references.  To avoid this, copy the dictionary or keep the\n   module around while using its dictionary directly.\n\n   Predefined (writable) attributes: "__name__" is the module\'s name;\n   "__doc__" is the module\'s documentation string, or "None" if\n   unavailable; "__file__" is the pathname of the file from which the\n   module was loaded, if it was loaded from a file. The "__file__"\n   attribute is not present for C modules that are statically linked\n   into the interpreter; for extension modules loaded dynamically from\n   a shared library, it is the pathname of the shared library file.\n\nClasses\n   Both class types (new-style classes) and class objects (old-\n   style/classic classes) are typically created by class definitions\n   (see section Class definitions).  A class has a namespace\n   implemented by a dictionary object. Class attribute references are\n   translated to lookups in this dictionary, e.g., "C.x" is translated\n   to "C.__dict__["x"]" (although for new-style classes in particular\n   there are a number of hooks which allow for other means of locating\n   attributes). When the attribute name is not found there, the\n   attribute search continues in the base classes.  For old-style\n   classes, the search is depth-first, left-to-right in the order of\n   occurrence in the base class list. New-style classes use the more\n   complex C3 method resolution order which behaves correctly even in\n   the presence of \'diamond\' inheritance structures where there are\n   multiple inheritance paths leading back to a common ancestor.\n   Additional details on the C3 MRO used by new-style classes can be\n   found in the documentation accompanying the 2.3 release at\n   https://www.python.org/download/releases/2.3/mro/.\n\n   When a class attribute reference (for class "C", say) would yield a\n   user-defined function object or an unbound user-defined method\n   object whose associated class is either "C" or one of its base\n   classes, it is transformed into an unbound user-defined method\n   object whose "im_class" attribute is "C". When it would yield a\n   class method object, it is transformed into a bound user-defined\n   method object whose "im_self" attribute is "C".  When it would\n   yield a static method object, it is transformed into the object\n   wrapped by the static method object. See section Implementing\n   Descriptors for another way in which attributes retrieved from a\n   class may differ from those actually contained in its "__dict__"\n   (note that only new-style classes support descriptors).\n\n   Class attribute assignments update the class\'s dictionary, never\n   the dictionary of a base class.\n\n   A class object can be called (see above) to yield a class instance\n   (see below).\n\n   Special attributes: "__name__" is the class name; "__module__" is\n   the module name in which the class was defined; "__dict__" is the\n   dictionary containing the class\'s namespace; "__bases__" is a tuple\n   (possibly empty or a singleton) containing the base classes, in the\n   order of their occurrence in the base class list; "__doc__" is the\n   class\'s documentation string, or None if undefined.\n\nClass instances\n   A class instance is created by calling a class object (see above).\n   A class instance has a namespace implemented as a dictionary which\n   is the first place in which attribute references are searched.\n   When an attribute is not found there, and the instance\'s class has\n   an attribute by that name, the search continues with the class\n   attributes.  If a class attribute is found that is a user-defined\n   function object or an unbound user-defined method object whose\n   associated class is the class (call it "C") of the instance for\n   which the attribute reference was initiated or one of its bases, it\n   is transformed into a bound user-defined method object whose\n   "im_class" attribute is "C" and whose "im_self" attribute is the\n   instance. Static method and class method objects are also\n   transformed, as if they had been retrieved from class "C"; see\n   above under "Classes". See section Implementing Descriptors for\n   another way in which attributes of a class retrieved via its\n   instances may differ from the objects actually stored in the\n   class\'s "__dict__". If no class attribute is found, and the\n   object\'s class has a "__getattr__()" method, that is called to\n   satisfy the lookup.\n\n   Attribute assignments and deletions update the instance\'s\n   dictionary, never a class\'s dictionary.  If the class has a\n   "__setattr__()" or "__delattr__()" method, this is called instead\n   of updating the instance dictionary directly.\n\n   Class instances can pretend to be numbers, sequences, or mappings\n   if they have methods with certain special names.  See section\n   Special method names.\n\n   Special attributes: "__dict__" is the attribute dictionary;\n   "__class__" is the instance\'s class.\n\nFiles\n   A file object represents an open file.  File objects are created by\n   the "open()" built-in function, and also by "os.popen()",\n   "os.fdopen()", and the "makefile()" method of socket objects (and\n   perhaps by other functions or methods provided by extension\n   modules).  The objects "sys.stdin", "sys.stdout" and "sys.stderr"\n   are initialized to file objects corresponding to the interpreter\'s\n   standard input, output and error streams.  See File Objects for\n   complete documentation of file objects.\n\nInternal types\n   A few types used internally by the interpreter are exposed to the\n   user. Their definitions may change with future versions of the\n   interpreter, but they are mentioned here for completeness.\n\n   Code objects\n      Code objects represent *byte-compiled* executable Python code,\n      or *bytecode*. The difference between a code object and a\n      function object is that the function object contains an explicit\n      reference to the function\'s globals (the module in which it was\n      defined), while a code object contains no context; also the\n      default argument values are stored in the function object, not\n      in the code object (because they represent values calculated at\n      run-time).  Unlike function objects, code objects are immutable\n      and contain no references (directly or indirectly) to mutable\n      objects.\n\n      Special read-only attributes: "co_name" gives the function name;\n      "co_argcount" is the number of positional arguments (including\n      arguments with default values); "co_nlocals" is the number of\n      local variables used by the function (including arguments);\n      "co_varnames" is a tuple containing the names of the local\n      variables (starting with the argument names); "co_cellvars" is a\n      tuple containing the names of local variables that are\n      referenced by nested functions; "co_freevars" is a tuple\n      containing the names of free variables; "co_code" is a string\n      representing the sequence of bytecode instructions; "co_consts"\n      is a tuple containing the literals used by the bytecode;\n      "co_names" is a tuple containing the names used by the bytecode;\n      "co_filename" is the filename from which the code was compiled;\n      "co_firstlineno" is the first line number of the function;\n      "co_lnotab" is a string encoding the mapping from bytecode\n      offsets to line numbers (for details see the source code of the\n      interpreter); "co_stacksize" is the required stack size\n      (including local variables); "co_flags" is an integer encoding a\n      number of flags for the interpreter.\n\n      The following flag bits are defined for "co_flags": bit "0x04"\n      is set if the function uses the "*arguments" syntax to accept an\n      arbitrary number of positional arguments; bit "0x08" is set if\n      the function uses the "**keywords" syntax to accept arbitrary\n      keyword arguments; bit "0x20" is set if the function is a\n      generator.\n\n      Future feature declarations ("from __future__ import division")\n      also use bits in "co_flags" to indicate whether a code object\n      was compiled with a particular feature enabled: bit "0x2000" is\n      set if the function was compiled with future division enabled;\n      bits "0x10" and "0x1000" were used in earlier versions of\n      Python.\n\n      Other bits in "co_flags" are reserved for internal use.\n\n      If a code object represents a function, the first item in\n      "co_consts" is the documentation string of the function, or\n      "None" if undefined.\n\n   Frame objects\n      Frame objects represent execution frames.  They may occur in\n      traceback objects (see below).\n\n      Special read-only attributes: "f_back" is to the previous stack\n      frame (towards the caller), or "None" if this is the bottom\n      stack frame; "f_code" is the code object being executed in this\n      frame; "f_locals" is the dictionary used to look up local\n      variables; "f_globals" is used for global variables;\n      "f_builtins" is used for built-in (intrinsic) names;\n      "f_restricted" is a flag indicating whether the function is\n      executing in restricted execution mode; "f_lasti" gives the\n      precise instruction (this is an index into the bytecode string\n      of the code object).\n\n      Special writable attributes: "f_trace", if not "None", is a\n      function called at the start of each source code line (this is\n      used by the debugger); "f_exc_type", "f_exc_value",\n      "f_exc_traceback" represent the last exception raised in the\n      parent frame provided another exception was ever raised in the\n      current frame (in all other cases they are None); "f_lineno" is\n      the current line number of the frame --- writing to this from\n      within a trace function jumps to the given line (only for the\n      bottom-most frame).  A debugger can implement a Jump command\n      (aka Set Next Statement) by writing to f_lineno.\n\n   Traceback objects\n      Traceback objects represent a stack trace of an exception.  A\n      traceback object is created when an exception occurs.  When the\n      search for an exception handler unwinds the execution stack, at\n      each unwound level a traceback object is inserted in front of\n      the current traceback.  When an exception handler is entered,\n      the stack trace is made available to the program. (See section\n      The try statement.) It is accessible as "sys.exc_traceback", and\n      also as the third item of the tuple returned by\n      "sys.exc_info()".  The latter is the preferred interface, since\n      it works correctly when the program is using multiple threads.\n      When the program contains no suitable handler, the stack trace\n      is written (nicely formatted) to the standard error stream; if\n      the interpreter is interactive, it is also made available to the\n      user as "sys.last_traceback".\n\n      Special read-only attributes: "tb_next" is the next level in the\n      stack trace (towards the frame where the exception occurred), or\n      "None" if there is no next level; "tb_frame" points to the\n      execution frame of the current level; "tb_lineno" gives the line\n      number where the exception occurred; "tb_lasti" indicates the\n      precise instruction.  The line number and last instruction in\n      the traceback may differ from the line number of its frame\n      object if the exception occurred in a "try" statement with no\n      matching except clause or with a finally clause.\n\n   Slice objects\n      Slice objects are used to represent slices when *extended slice\n      syntax* is used. This is a slice using two colons, or multiple\n      slices or ellipses separated by commas, e.g., "a[i:j:step]",\n      "a[i:j, k:l]", or "a[..., i:j]".  They are also created by the\n      built-in "slice()" function.\n\n      Special read-only attributes: "start" is the lower bound; "stop"\n      is the upper bound; "step" is the step value; each is "None" if\n      omitted.  These attributes can have any type.\n\n      Slice objects support one method:\n\n      slice.indices(self, length)\n\n         This method takes a single integer argument *length* and\n         computes information about the extended slice that the slice\n         object would describe if applied to a sequence of *length*\n         items.  It returns a tuple of three integers; respectively\n         these are the *start* and *stop* indices and the *step* or\n         stride length of the slice. Missing or out-of-bounds indices\n         are handled in a manner consistent with regular slices.\n\n         New in version 2.3.\n\n   Static method objects\n      Static method objects provide a way of defeating the\n      transformation of function objects to method objects described\n      above. A static method object is a wrapper around any other\n      object, usually a user-defined method object. When a static\n      method object is retrieved from a class or a class instance, the\n      object actually returned is the wrapped object, which is not\n      subject to any further transformation. Static method objects are\n      not themselves callable, although the objects they wrap usually\n      are. Static method objects are created by the built-in\n      "staticmethod()" constructor.\n\n   Class method objects\n      A class method object, like a static method object, is a wrapper\n      around another object that alters the way in which that object\n      is retrieved from classes and class instances. The behaviour of\n      class method objects upon such retrieval is described above,\n      under "User-defined methods". Class method objects are created\n      by the built-in "classmethod()" constructor.\n',\r
+ 'typesfunctions': u'\nFunctions\n*********\n\nFunction objects are created by function definitions.  The only\noperation on a function object is to call it: "func(argument-list)".\n\nThere are really two flavors of function objects: built-in functions\nand user-defined functions.  Both support the same operation (to call\nthe function), but the implementation is different, hence the\ndifferent object types.\n\nSee Function definitions for more information.\n',\r
+ 'typesmapping': u'\nMapping Types --- "dict"\n************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects.  There is currently only one standard\nmapping type, the *dictionary*.  (For other containers see the built\nin "list", "set", and "tuple" classes, and the "collections" module.)\n\nA dictionary\'s keys are *almost* arbitrary values.  Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys.  Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as "1" and "1.0") then they can be used interchangeably to index\nthe same dictionary entry.  (Note however, that since computers store\nfloating-point numbers as approximations it is usually unwise to use\nthem as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of "key:\nvalue" pairs within braces, for example: "{\'jack\': 4098, \'sjoerd\':\n4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the "dict"\nconstructor.\n\nclass class dict(**kwarg)\nclass class dict(mapping, **kwarg)\nclass class dict(iterable, **kwarg)\n\n   Return a new dictionary initialized from an optional positional\n   argument and a possibly empty set of keyword arguments.\n\n   If no positional argument is given, an empty dictionary is created.\n   If a positional argument is given and it is a mapping object, a\n   dictionary is created with the same key-value pairs as the mapping\n   object.  Otherwise, the positional argument must be an *iterable*\n   object.  Each item in the iterable must itself be an iterable with\n   exactly two objects.  The first object of each item becomes a key\n   in the new dictionary, and the second object the corresponding\n   value.  If a key occurs more than once, the last value for that key\n   becomes the corresponding value in the new dictionary.\n\n   If keyword arguments are given, the keyword arguments and their\n   values are added to the dictionary created from the positional\n   argument.  If a key being added is already present, the value from\n   the keyword argument replaces the value from the positional\n   argument.\n\n   To illustrate, the following examples all return a dictionary equal\n   to "{"one": 1, "two": 2, "three": 3}":\n\n      >>> a = dict(one=1, two=2, three=3)\n      >>> b = {\'one\': 1, \'two\': 2, \'three\': 3}\n      >>> c = dict(zip([\'one\', \'two\', \'three\'], [1, 2, 3]))\n      >>> d = dict([(\'two\', 2), (\'one\', 1), (\'three\', 3)])\n      >>> e = dict({\'three\': 3, \'one\': 1, \'two\': 2})\n      >>> a == b == c == d == e\n      True\n\n   Providing keyword arguments as in the first example only works for\n   keys that are valid Python identifiers.  Otherwise, any valid keys\n   can be used.\n\n   New in version 2.2.\n\n   Changed in version 2.3: Support for building a dictionary from\n   keyword arguments added.\n\n   These are the operations that dictionaries support (and therefore,\n   custom mapping types should support too):\n\n   len(d)\n\n      Return the number of items in the dictionary *d*.\n\n   d[key]\n\n      Return the item of *d* with key *key*.  Raises a "KeyError" if\n      *key* is not in the map.\n\n      If a subclass of dict defines a method "__missing__()" and *key*\n      is not present, the "d[key]" operation calls that method with\n      the key *key* as argument.  The "d[key]" operation then returns\n      or raises whatever is returned or raised by the\n      "__missing__(key)" call. No other operations or methods invoke\n      "__missing__()". If "__missing__()" is not defined, "KeyError"\n      is raised. "__missing__()" must be a method; it cannot be an\n      instance variable:\n\n         >>> class Counter(dict):\n         ...     def __missing__(self, key):\n         ...         return 0\n         >>> c = Counter()\n         >>> c[\'red\']\n         0\n         >>> c[\'red\'] += 1\n         >>> c[\'red\']\n         1\n\n      The example above shows part of the implementation of\n      "collections.Counter".  A different "__missing__" method is used\n      by "collections.defaultdict".\n\n      New in version 2.5: Recognition of __missing__ methods of dict\n      subclasses.\n\n   d[key] = value\n\n      Set "d[key]" to *value*.\n\n   del d[key]\n\n      Remove "d[key]" from *d*.  Raises a "KeyError" if *key* is not\n      in the map.\n\n   key in d\n\n      Return "True" if *d* has a key *key*, else "False".\n\n      New in version 2.2.\n\n   key not in d\n\n      Equivalent to "not key in d".\n\n      New in version 2.2.\n\n   iter(d)\n\n      Return an iterator over the keys of the dictionary.  This is a\n      shortcut for "iterkeys()".\n\n   clear()\n\n      Remove all items from the dictionary.\n\n   copy()\n\n      Return a shallow copy of the dictionary.\n\n   fromkeys(seq[, value])\n\n      Create a new dictionary with keys from *seq* and values set to\n      *value*.\n\n      "fromkeys()" is a class method that returns a new dictionary.\n      *value* defaults to "None".\n\n      New in version 2.3.\n\n   get(key[, default])\n\n      Return the value for *key* if *key* is in the dictionary, else\n      *default*. If *default* is not given, it defaults to "None", so\n      that this method never raises a "KeyError".\n\n   has_key(key)\n\n      Test for the presence of *key* in the dictionary.  "has_key()"\n      is deprecated in favor of "key in d".\n\n   items()\n\n      Return a copy of the dictionary\'s list of "(key, value)" pairs.\n\n      **CPython implementation detail:** Keys and values are listed in\n      an arbitrary order which is non-random, varies across Python\n      implementations, and depends on the dictionary\'s history of\n      insertions and deletions.\n\n      If "items()", "keys()", "values()", "iteritems()", "iterkeys()",\n      and "itervalues()" are called with no intervening modifications\n      to the dictionary, the lists will directly correspond.  This\n      allows the creation of "(value, key)" pairs using "zip()":\n      "pairs = zip(d.values(), d.keys())".  The same relationship\n      holds for the "iterkeys()" and "itervalues()" methods: "pairs =\n      zip(d.itervalues(), d.iterkeys())" provides the same value for\n      "pairs". Another way to create the same list is "pairs = [(v, k)\n      for (k, v) in d.iteritems()]".\n\n   iteritems()\n\n      Return an iterator over the dictionary\'s "(key, value)" pairs.\n      See the note for "dict.items()".\n\n      Using "iteritems()" while adding or deleting entries in the\n      dictionary may raise a "RuntimeError" or fail to iterate over\n      all entries.\n\n      New in version 2.2.\n\n   iterkeys()\n\n      Return an iterator over the dictionary\'s keys.  See the note for\n      "dict.items()".\n\n      Using "iterkeys()" while adding or deleting entries in the\n      dictionary may raise a "RuntimeError" or fail to iterate over\n      all entries.\n\n      New in version 2.2.\n\n   itervalues()\n\n      Return an iterator over the dictionary\'s values.  See the note\n      for "dict.items()".\n\n      Using "itervalues()" while adding or deleting entries in the\n      dictionary may raise a "RuntimeError" or fail to iterate over\n      all entries.\n\n      New in version 2.2.\n\n   keys()\n\n      Return a copy of the dictionary\'s list of keys.  See the note\n      for "dict.items()".\n\n   pop(key[, default])\n\n      If *key* is in the dictionary, remove it and return its value,\n      else return *default*.  If *default* is not given and *key* is\n      not in the dictionary, a "KeyError" is raised.\n\n      New in version 2.3.\n\n   popitem()\n\n      Remove and return an arbitrary "(key, value)" pair from the\n      dictionary.\n\n      "popitem()" is useful to destructively iterate over a\n      dictionary, as often used in set algorithms.  If the dictionary\n      is empty, calling "popitem()" raises a "KeyError".\n\n   setdefault(key[, default])\n\n      If *key* is in the dictionary, return its value.  If not, insert\n      *key* with a value of *default* and return *default*.  *default*\n      defaults to "None".\n\n   update([other])\n\n      Update the dictionary with the key/value pairs from *other*,\n      overwriting existing keys.  Return "None".\n\n      "update()" accepts either another dictionary object or an\n      iterable of key/value pairs (as tuples or other iterables of\n      length two).  If keyword arguments are specified, the dictionary\n      is then updated with those key/value pairs: "d.update(red=1,\n      blue=2)".\n\n      Changed in version 2.4: Allowed the argument to be an iterable\n      of key/value pairs and allowed keyword arguments.\n\n   values()\n\n      Return a copy of the dictionary\'s list of values.  See the note\n      for "dict.items()".\n\n   viewitems()\n\n      Return a new view of the dictionary\'s items ("(key, value)"\n      pairs).  See below for documentation of view objects.\n\n      New in version 2.7.\n\n   viewkeys()\n\n      Return a new view of the dictionary\'s keys.  See below for\n      documentation of view objects.\n\n      New in version 2.7.\n\n   viewvalues()\n\n      Return a new view of the dictionary\'s values.  See below for\n      documentation of view objects.\n\n      New in version 2.7.\n\n\nDictionary view objects\n=======================\n\nThe objects returned by "dict.viewkeys()", "dict.viewvalues()" and\n"dict.viewitems()" are *view objects*.  They provide a dynamic view on\nthe dictionary\'s entries, which means that when the dictionary\nchanges, the view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\n   Return the number of entries in the dictionary.\n\niter(dictview)\n\n   Return an iterator over the keys, values or items (represented as\n   tuples of "(key, value)") in the dictionary.\n\n   Keys and values are iterated over in an arbitrary order which is\n   non-random, varies across Python implementations, and depends on\n   the dictionary\'s history of insertions and deletions. If keys,\n   values and items views are iterated over with no intervening\n   modifications to the dictionary, the order of items will directly\n   correspond.  This allows the creation of "(value, key)" pairs using\n   "zip()": "pairs = zip(d.values(), d.keys())".  Another way to\n   create the same list is "pairs = [(v, k) for (k, v) in d.items()]".\n\n   Iterating views while adding or deleting entries in the dictionary\n   may raise a "RuntimeError" or fail to iterate over all entries.\n\nx in dictview\n\n   Return "True" if *x* is in the underlying dictionary\'s keys, values\n   or items (in the latter case, *x* should be a "(key, value)"\n   tuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that (key, value) pairs are unique and\nhashable, then the items view is also set-like.  (Values views are not\ntreated as set-like since the entries are generally not unique.)  Then\nthese set operations are available ("other" refers either to another\nview or a set):\n\ndictview & other\n\n   Return the intersection of the dictview and the other object as a\n   new set.\n\ndictview | other\n\n   Return the union of the dictview and the other object as a new set.\n\ndictview - other\n\n   Return the difference between the dictview and the other object\n   (all elements in *dictview* that aren\'t in *other*) as a new set.\n\ndictview ^ other\n\n   Return the symmetric difference (all elements either in *dictview*\n   or *other*, but not in both) of the dictview and the other object\n   as a new set.\n\nAn example of dictionary view usage:\n\n   >>> dishes = {\'eggs\': 2, \'sausage\': 1, \'bacon\': 1, \'spam\': 500}\n   >>> keys = dishes.viewkeys()\n   >>> values = dishes.viewvalues()\n\n   >>> # iteration\n   >>> n = 0\n   >>> for val in values:\n   ...     n += val\n   >>> print(n)\n   504\n\n   >>> # keys and values are iterated over in the same order\n   >>> list(keys)\n   [\'eggs\', \'bacon\', \'sausage\', \'spam\']\n   >>> list(values)\n   [2, 1, 1, 500]\n\n   >>> # view objects are dynamic and reflect dict changes\n   >>> del dishes[\'eggs\']\n   >>> del dishes[\'sausage\']\n   >>> list(keys)\n   [\'spam\', \'bacon\']\n\n   >>> # set operations\n   >>> keys & {\'eggs\', \'bacon\', \'salad\'}\n   {\'bacon\'}\n',\r
+ 'typesmethods': u'\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as "append()" on lists)\nand class instance methods.  Built-in methods are described with the\ntypes that support them.\n\nThe implementation adds two special read-only attributes to class\ninstance methods: "m.im_self" is the object on which the method\noperates, and "m.im_func" is the function implementing the method.\nCalling "m(arg-1, arg-2, ..., arg-n)" is completely equivalent to\ncalling "m.im_func(m.im_self, arg-1, arg-2, ..., arg-n)".\n\nClass instance methods are either *bound* or *unbound*, referring to\nwhether the method was accessed through an instance or a class,\nrespectively.  When a method is unbound, its "im_self" attribute will\nbe "None" and if called, an explicit "self" object must be passed as\nthe first argument.  In this case, "self" must be an instance of the\nunbound method\'s class (or a subclass of that class), otherwise a\n"TypeError" is raised.\n\nLike function objects, methods objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object ("meth.im_func"), setting method\nattributes on either bound or unbound methods is disallowed.\nAttempting to set an attribute on a method results in an\n"AttributeError" being raised.  In order to set a method attribute,\nyou need to explicitly set it on the underlying function object:\n\n   >>> class C:\n   ...     def method(self):\n   ...         pass\n   ...\n   >>> c = C()\n   >>> c.method.whoami = \'my name is method\'  # can\'t set on the method\n   Traceback (most recent call last):\n     File "<stdin>", line 1, in <module>\n   AttributeError: \'instancemethod\' object has no attribute \'whoami\'\n   >>> c.method.im_func.whoami = \'my name is method\'\n   >>> c.method.whoami\n   \'my name is method\'\n\nSee The standard type hierarchy for more information.\n',\r
+ 'typesmodules': u'\nModules\n*******\n\nThe only special operation on a module is attribute access: "m.name",\nwhere *m* is a module and *name* accesses a name defined in *m*\'s\nsymbol table. Module attributes can be assigned to.  (Note that the\n"import" statement is not, strictly speaking, an operation on a module\nobject; "import foo" does not require a module object named *foo* to\nexist, rather it requires an (external) *definition* for a module\nnamed *foo* somewhere.)\n\nA special attribute of every module is "__dict__". This is the\ndictionary containing the module\'s symbol table. Modifying this\ndictionary will actually change the module\'s symbol table, but direct\nassignment to the "__dict__" attribute is not possible (you can write\n"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but you can\'t\nwrite "m.__dict__ = {}").  Modifying "__dict__" directly is not\nrecommended.\n\nModules built into the interpreter are written like this: "<module\n\'sys\' (built-in)>".  If loaded from a file, they are written as\n"<module \'os\' from \'/usr/local/lib/pythonX.Y/os.pyc\'>".\n',\r
+ 'typesseq': u'\nSequence Types --- "str", "unicode", "list", "tuple", "bytearray", "buffer", "xrange"\n*************************************************************************************\n\nThere are seven sequence types: strings, Unicode strings, lists,\ntuples, bytearrays, buffers, and xrange objects.\n\nFor other containers see the built in "dict" and "set" classes, and\nthe "collections" module.\n\nString literals are written in single or double quotes: "\'xyzzy\'",\n""frobozz"".  See String literals for more about string literals.\nUnicode strings are much like strings, but are specified in the syntax\nusing a preceding "\'u\'" character: "u\'abc\'", "u"def"". In addition to\nthe functionality described here, there are also string-specific\nmethods described in the String Methods section. Lists are constructed\nwith square brackets, separating items with commas: "[a, b, c]".\nTuples are constructed by the comma operator (not within square\nbrackets), with or without enclosing parentheses, but an empty tuple\nmust have the enclosing parentheses, such as "a, b, c" or "()".  A\nsingle item tuple must have a trailing comma, such as "(d,)".\n\nBytearray objects are created with the built-in function\n"bytearray()".\n\nBuffer objects are not directly supported by Python syntax, but can be\ncreated by calling the built-in function "buffer()".  They don\'t\nsupport concatenation or repetition.\n\nObjects of type xrange are similar to buffers in that there is no\nspecific syntax to create them, but they are created using the\n"xrange()" function.  They don\'t support slicing, concatenation or\nrepetition, and using "in", "not in", "min()" or "max()" on them is\ninefficient.\n\nMost sequence types support the following operations.  The "in" and\n"not in" operations have the same priorities as the comparison\noperations.  The "+" and "*" operations have the same priority as the\ncorresponding numeric operations. [3] Additional methods are provided\nfor Mutable Sequence Types.\n\nThis table lists the sequence operations sorted in ascending priority.\nIn the table, *s* and *t* are sequences of the same type; *n*, *i* and\n*j* are integers:\n\n+--------------------+----------------------------------+------------+\n| Operation          | Result                           | Notes      |\n+====================+==================================+============+\n| "x in s"           | "True" if an item of *s* is      | (1)        |\n|                    | equal to *x*, else "False"       |            |\n+--------------------+----------------------------------+------------+\n| "x not in s"       | "False" if an item of *s* is     | (1)        |\n|                    | equal to *x*, else "True"        |            |\n+--------------------+----------------------------------+------------+\n| "s + t"            | the concatenation of *s* and *t* | (6)        |\n+--------------------+----------------------------------+------------+\n| "s * n, n * s"     | *n* shallow copies of *s*        | (2)        |\n|                    | concatenated                     |            |\n+--------------------+----------------------------------+------------+\n| "s[i]"             | *i*th item of *s*, origin 0      | (3)        |\n+--------------------+----------------------------------+------------+\n| "s[i:j]"           | slice of *s* from *i* to *j*     | (3)(4)     |\n+--------------------+----------------------------------+------------+\n| "s[i:j:k]"         | slice of *s* from *i* to *j*     | (3)(5)     |\n|                    | with step *k*                    |            |\n+--------------------+----------------------------------+------------+\n| "len(s)"           | length of *s*                    |            |\n+--------------------+----------------------------------+------------+\n| "min(s)"           | smallest item of *s*             |            |\n+--------------------+----------------------------------+------------+\n| "max(s)"           | largest item of *s*              |            |\n+--------------------+----------------------------------+------------+\n| "s.index(x)"       | index of the first occurrence of |            |\n|                    | *x* in *s*                       |            |\n+--------------------+----------------------------------+------------+\n| "s.count(x)"       | total number of occurrences of   |            |\n|                    | *x* in *s*                       |            |\n+--------------------+----------------------------------+------------+\n\nSequence types also support comparisons. In particular, tuples and\nlists are compared lexicographically by comparing corresponding\nelements. This means that to compare equal, every element must compare\nequal and the two sequences must be of the same type and have the same\nlength. (For full details see Comparisons in the language reference.)\n\nNotes:\n\n1. When *s* is a string or Unicode string object the "in" and "not\n   in" operations act like a substring test.  In Python versions\n   before 2.3, *x* had to be a string of length 1. In Python 2.3 and\n   beyond, *x* may be a string of any length.\n\n2. Values of *n* less than "0" are treated as "0" (which yields an\n   empty sequence of the same type as *s*).  Note also that the copies\n   are shallow; nested structures are not copied.  This often haunts\n   new Python programmers; consider:\n\n   >>> lists = [[]] * 3\n   >>> lists\n   [[], [], []]\n   >>> lists[0].append(3)\n   >>> lists\n   [[3], [3], [3]]\n\n   What has happened is that "[[]]" is a one-element list containing\n   an empty list, so all three elements of "[[]] * 3" are (pointers\n   to) this single empty list.  Modifying any of the elements of\n   "lists" modifies this single list. You can create a list of\n   different lists this way:\n\n   >>> lists = [[] for i in range(3)]\n   >>> lists[0].append(3)\n   >>> lists[1].append(5)\n   >>> lists[2].append(7)\n   >>> lists\n   [[3], [5], [7]]\n\n3. If *i* or *j* is negative, the index is relative to the end of\n   the string: "len(s) + i" or "len(s) + j" is substituted.  But note\n   that "-0" is still "0".\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n   items with index *k* such that "i <= k < j".  If *i* or *j* is\n   greater than "len(s)", use "len(s)".  If *i* is omitted or "None",\n   use "0".  If *j* is omitted or "None", use "len(s)".  If *i* is\n   greater than or equal to *j*, the slice is empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n   sequence of items with index  "x = i + n*k" such that "0 <= n <\n   (j-i)/k".  In other words, the indices are "i", "i+k", "i+2*k",\n   "i+3*k" and so on, stopping when *j* is reached (but never\n   including *j*).  If *i* or *j* is greater than "len(s)", use\n   "len(s)".  If *i* or *j* are omitted or "None", they become "end"\n   values (which end depends on the sign of *k*).  Note, *k* cannot be\n   zero. If *k* is "None", it is treated like "1".\n\n6. **CPython implementation detail:** If *s* and *t* are both\n   strings, some Python implementations such as CPython can usually\n   perform an in-place optimization for assignments of the form "s = s\n   + t" or "s += t".  When applicable, this optimization makes\n   quadratic run-time much less likely.  This optimization is both\n   version and implementation dependent.  For performance sensitive\n   code, it is preferable to use the "str.join()" method which assures\n   consistent linear concatenation performance across versions and\n   implementations.\n\n   Changed in version 2.4: Formerly, string concatenation never\n   occurred in-place.\n\n\nString Methods\n==============\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support.  Some of them are also available on\n"bytearray" objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange section. To output formatted strings use\ntemplate strings or the "%" operator described in the String\nFormatting Operations section. Also, see the "re" module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n   Return a copy of the string with its first character capitalized\n   and the rest lowercased.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n   Return centered in a string of length *width*. Padding is done\n   using the specified *fillchar* (default is a space).\n\n   Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n   Return the number of non-overlapping occurrences of substring *sub*\n   in the range [*start*, *end*].  Optional arguments *start* and\n   *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n   Decodes the string using the codec registered for *encoding*.\n   *encoding* defaults to the default string encoding.  *errors* may\n   be given to set a different error handling scheme.  The default is\n   "\'strict\'", meaning that encoding errors raise "UnicodeError".\n   Other possible values are "\'ignore\'", "\'replace\'" and any other\n   name registered via "codecs.register_error()", see section Codec\n   Base Classes.\n\n   New in version 2.2.\n\n   Changed in version 2.3: Support for other error handling schemes\n   added.\n\n   Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n   Return an encoded version of the string.  Default encoding is the\n   current default string encoding.  *errors* may be given to set a\n   different error handling scheme.  The default for *errors* is\n   "\'strict\'", meaning that encoding errors raise a "UnicodeError".\n   Other possible values are "\'ignore\'", "\'replace\'",\n   "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other name\n   registered via "codecs.register_error()", see section Codec Base\n   Classes. For a list of possible encodings, see section Standard\n   Encodings.\n\n   New in version 2.0.\n\n   Changed in version 2.3: Support for "\'xmlcharrefreplace\'" and\n   "\'backslashreplace\'" and other error handling schemes added.\n\n   Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n   Return "True" if the string ends with the specified *suffix*,\n   otherwise return "False".  *suffix* can also be a tuple of suffixes\n   to look for.  With optional *start*, test beginning at that\n   position.  With optional *end*, stop comparing at that position.\n\n   Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n   Return a copy of the string where all tab characters are replaced\n   by one or more spaces, depending on the current column and the\n   given tab size.  Tab positions occur every *tabsize* characters\n   (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n   To expand the string, the current column is set to zero and the\n   string is examined character by character.  If the character is a\n   tab ("\\t"), one or more space characters are inserted in the result\n   until the current column is equal to the next tab position. (The\n   tab character itself is not copied.)  If the character is a newline\n   ("\\n") or return ("\\r"), it is copied and the current column is\n   reset to zero.  Any other character is copied unchanged and the\n   current column is incremented by one regardless of how the\n   character is represented when printed.\n\n   >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n   \'01      012     0123    01234\'\n   >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n   \'01  012 0123    01234\'\n\nstr.find(sub[, start[, end]])\n\n   Return the lowest index in the string where substring *sub* is\n   found, such that *sub* is contained in the slice "s[start:end]".\n   Optional arguments *start* and *end* are interpreted as in slice\n   notation.  Return "-1" if *sub* is not found.\n\n   Note: The "find()" method should be used only if you need to know\n     the position of *sub*.  To check if *sub* is a substring or not,\n     use the "in" operator:\n\n        >>> \'Py\' in \'Python\'\n        True\n\nstr.format(*args, **kwargs)\n\n   Perform a string formatting operation.  The string on which this\n   method is called can contain literal text or replacement fields\n   delimited by braces "{}".  Each replacement field contains either\n   the numeric index of a positional argument, or the name of a\n   keyword argument.  Returns a copy of the string where each\n   replacement field is replaced with the string value of the\n   corresponding argument.\n\n   >>> "The sum of 1 + 2 is {0}".format(1+2)\n   \'The sum of 1 + 2 is 3\'\n\n   See Format String Syntax for a description of the various\n   formatting options that can be specified in format strings.\n\n   This method of string formatting is the new standard in Python 3,\n   and should be preferred to the "%" formatting described in String\n   Formatting Operations in new code.\n\n   New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n   Like "find()", but raise "ValueError" when the substring is not\n   found.\n\nstr.isalnum()\n\n   Return true if all characters in the string are alphanumeric and\n   there is at least one character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n   Return true if all characters in the string are alphabetic and\n   there is at least one character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n   Return true if all characters in the string are digits and there is\n   at least one character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n   Return true if all cased characters [4] in the string are lowercase\n   and there is at least one cased character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n   Return true if there are only whitespace characters in the string\n   and there is at least one character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n   Return true if the string is a titlecased string and there is at\n   least one character, for example uppercase characters may only\n   follow uncased characters and lowercase characters only cased ones.\n   Return false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n   Return true if all cased characters [4] in the string are uppercase\n   and there is at least one cased character, false otherwise.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n   Return a string which is the concatenation of the strings in the\n   *iterable* *iterable*.  The separator between elements is the\n   string providing this method.\n\nstr.ljust(width[, fillchar])\n\n   Return the string left justified in a string of length *width*.\n   Padding is done using the specified *fillchar* (default is a\n   space).  The original string is returned if *width* is less than or\n   equal to "len(s)".\n\n   Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n   Return a copy of the string with all the cased characters [4]\n   converted to lowercase.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n   Return a copy of the string with leading characters removed.  The\n   *chars* argument is a string specifying the set of characters to be\n   removed.  If omitted or "None", the *chars* argument defaults to\n   removing whitespace.  The *chars* argument is not a prefix; rather,\n   all combinations of its values are stripped:\n\n   >>> \'   spacious   \'.lstrip()\n   \'spacious   \'\n   >>> \'www.example.com\'.lstrip(\'cmowz.\')\n   \'example.com\'\n\n   Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n   Split the string at the first occurrence of *sep*, and return a\n   3-tuple containing the part before the separator, the separator\n   itself, and the part after the separator.  If the separator is not\n   found, return a 3-tuple containing the string itself, followed by\n   two empty strings.\n\n   New in version 2.5.\n\nstr.replace(old, new[, count])\n\n   Return a copy of the string with all occurrences of substring *old*\n   replaced by *new*.  If the optional argument *count* is given, only\n   the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n   Return the highest index in the string where substring *sub* is\n   found, such that *sub* is contained within "s[start:end]".\n   Optional arguments *start* and *end* are interpreted as in slice\n   notation.  Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n   Like "rfind()" but raises "ValueError" when the substring *sub* is\n   not found.\n\nstr.rjust(width[, fillchar])\n\n   Return the string right justified in a string of length *width*.\n   Padding is done using the specified *fillchar* (default is a\n   space). The original string is returned if *width* is less than or\n   equal to "len(s)".\n\n   Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n   Split the string at the last occurrence of *sep*, and return a\n   3-tuple containing the part before the separator, the separator\n   itself, and the part after the separator.  If the separator is not\n   found, return a 3-tuple containing two empty strings, followed by\n   the string itself.\n\n   New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n   Return a list of the words in the string, using *sep* as the\n   delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n   are done, the *rightmost* ones.  If *sep* is not specified or\n   "None", any whitespace string is a separator.  Except for splitting\n   from the right, "rsplit()" behaves like "split()" which is\n   described in detail below.\n\n   New in version 2.4.\n\nstr.rstrip([chars])\n\n   Return a copy of the string with trailing characters removed.  The\n   *chars* argument is a string specifying the set of characters to be\n   removed.  If omitted or "None", the *chars* argument defaults to\n   removing whitespace.  The *chars* argument is not a suffix; rather,\n   all combinations of its values are stripped:\n\n   >>> \'   spacious   \'.rstrip()\n   \'   spacious\'\n   >>> \'mississippi\'.rstrip(\'ipz\')\n   \'mississ\'\n\n   Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n   Return a list of the words in the string, using *sep* as the\n   delimiter string.  If *maxsplit* is given, at most *maxsplit*\n   splits are done (thus, the list will have at most "maxsplit+1"\n   elements).  If *maxsplit* is not specified or "-1", then there is\n   no limit on the number of splits (all possible splits are made).\n\n   If *sep* is given, consecutive delimiters are not grouped together\n   and are deemed to delimit empty strings (for example,\n   "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']").  The *sep* argument\n   may consist of multiple characters (for example,\n   "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n   empty string with a specified separator returns "[\'\']".\n\n   If *sep* is not specified or is "None", a different splitting\n   algorithm is applied: runs of consecutive whitespace are regarded\n   as a single separator, and the result will contain no empty strings\n   at the start or end if the string has leading or trailing\n   whitespace.  Consequently, splitting an empty string or a string\n   consisting of just whitespace with a "None" separator returns "[]".\n\n   For example, "\' 1  2   3  \'.split()" returns "[\'1\', \'2\', \'3\']", and\n   "\'  1  2   3  \'.split(None, 1)" returns "[\'1\', \'2   3  \']".\n\nstr.splitlines([keepends])\n\n   Return a list of the lines in the string, breaking at line\n   boundaries. This method uses the *universal newlines* approach to\n   splitting lines. Line breaks are not included in the resulting list\n   unless *keepends* is given and true.\n\n   For example, "\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()" returns "[\'ab\n   c\', \'\', \'de fg\', \'kl\']", while the same call with\n   "splitlines(True)" returns "[\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']".\n\n   Unlike "split()" when a delimiter string *sep* is given, this\n   method returns an empty list for the empty string, and a terminal\n   line break does not result in an extra line.\n\nstr.startswith(prefix[, start[, end]])\n\n   Return "True" if string starts with the *prefix*, otherwise return\n   "False". *prefix* can also be a tuple of prefixes to look for.\n   With optional *start*, test string beginning at that position.\n   With optional *end*, stop comparing string at that position.\n\n   Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n   Return a copy of the string with the leading and trailing\n   characters removed. The *chars* argument is a string specifying the\n   set of characters to be removed. If omitted or "None", the *chars*\n   argument defaults to removing whitespace. The *chars* argument is\n   not a prefix or suffix; rather, all combinations of its values are\n   stripped:\n\n   >>> \'   spacious   \'.strip()\n   \'spacious\'\n   >>> \'www.example.com\'.strip(\'cmowz.\')\n   \'example\'\n\n   Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n   Return a copy of the string with uppercase characters converted to\n   lowercase and vice versa.\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n   Return a titlecased version of the string where words start with an\n   uppercase character and the remaining characters are lowercase.\n\n   The algorithm uses a simple language-independent definition of a\n   word as groups of consecutive letters.  The definition works in\n   many contexts but it means that apostrophes in contractions and\n   possessives form word boundaries, which may not be the desired\n   result:\n\n      >>> "they\'re bill\'s friends from the UK".title()\n      "They\'Re Bill\'S Friends From The Uk"\n\n   A workaround for apostrophes can be constructed using regular\n   expressions:\n\n      >>> import re\n      >>> def titlecase(s):\n      ...     return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n      ...                   lambda mo: mo.group(0)[0].upper() +\n      ...                              mo.group(0)[1:].lower(),\n      ...                   s)\n      ...\n      >>> titlecase("they\'re bill\'s friends.")\n      "They\'re Bill\'s Friends."\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n   Return a copy of the string where all characters occurring in the\n   optional argument *deletechars* are removed, and the remaining\n   characters have been mapped through the given translation table,\n   which must be a string of length 256.\n\n   You can use the "maketrans()" helper function in the "string"\n   module to create a translation table. For string objects, set the\n   *table* argument to "None" for translations that only delete\n   characters:\n\n   >>> \'read this short text\'.translate(None, \'aeiou\')\n   \'rd ths shrt txt\'\n\n   New in version 2.6: Support for a "None" *table* argument.\n\n   For Unicode objects, the "translate()" method does not accept the\n   optional *deletechars* argument.  Instead, it returns a copy of the\n   *s* where all characters have been mapped through the given\n   translation table which must be a mapping of Unicode ordinals to\n   Unicode ordinals, Unicode strings or "None". Unmapped characters\n   are left untouched. Characters mapped to "None" are deleted.  Note,\n   a more flexible approach is to create a custom character mapping\n   codec using the "codecs" module (see "encodings.cp1251" for an\n   example).\n\nstr.upper()\n\n   Return a copy of the string with all the cased characters [4]\n   converted to uppercase.  Note that "str.upper().isupper()" might be\n   "False" if "s" contains uncased characters or if the Unicode\n   category of the resulting character(s) is not "Lu" (Letter,\n   uppercase), but e.g. "Lt" (Letter, titlecase).\n\n   For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n   Return the numeric string left filled with zeros in a string of\n   length *width*.  A sign prefix is handled correctly.  The original\n   string is returned if *width* is less than or equal to "len(s)".\n\n   New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n   Return "True" if there are only numeric characters in S, "False"\n   otherwise. Numeric characters include digit characters, and all\n   characters that have the Unicode numeric value property, e.g.\n   U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n   Return "True" if there are only decimal characters in S, "False"\n   otherwise. Decimal characters include digit characters, and all\n   characters that can be used to form decimal-radix numbers, e.g.\n   U+0660, ARABIC-INDIC DIGIT ZERO.\n\n\nString Formatting Operations\n============================\n\nString and Unicode objects have one unique built-in operation: the "%"\noperator (modulo).  This is also known as the string *formatting* or\n*interpolation* operator.  Given "format % values" (where *format* is\na string or Unicode object), "%" conversion specifications in *format*\nare replaced with zero or more elements of *values*.  The effect is\nsimilar to the using "sprintf()" in the C language.  If *format* is a\nUnicode object, or if any of the objects being converted using the\n"%s" conversion are Unicode objects, the result will also be a Unicode\nobject.\n\nIf *format* requires a single argument, *values* may be a single non-\ntuple object. [5]  Otherwise, *values* must be a tuple with exactly\nthe number of items specified by the format string, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The "\'%\'" character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence\n   of characters (for example, "(somename)").\n\n3. Conversion flags (optional), which affect the result of some\n   conversion types.\n\n4. Minimum field width (optional).  If specified as an "\'*\'"\n   (asterisk), the actual width is read from the next element of the\n   tuple in *values*, and the object to convert comes after the\n   minimum field width and optional precision.\n\n5. Precision (optional), given as a "\'.\'" (dot) followed by the\n   precision.  If specified as "\'*\'" (an asterisk), the actual width\n   is read from the next element of the tuple in *values*, and the\n   value to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n\nWhen the right argument is a dictionary (or other mapping type), then\nthe formats in the string *must* include a parenthesised mapping key\ninto that dictionary inserted immediately after the "\'%\'" character.\nThe mapping key selects the value to be formatted from the mapping.\nFor example:\n\n>>> print \'%(language)s has %(number)03d quote types.\' % \\\n...       {"language": "Python", "number": 2}\nPython has 002 quote types.\n\nIn this case no "*" specifiers may occur in a format (since they\nrequire a sequential parameter list).\n\nThe conversion flag characters are:\n\n+-----------+-----------------------------------------------------------------------+\n| Flag      | Meaning                                                               |\n+===========+=======================================================================+\n| "\'#\'"     | The value conversion will use the "alternate form" (where defined     |\n|           | below).                                                               |\n+-----------+-----------------------------------------------------------------------+\n| "\'0\'"     | The conversion will be zero padded for numeric values.                |\n+-----------+-----------------------------------------------------------------------+\n| "\'-\'"     | The converted value is left adjusted (overrides the "\'0\'" conversion  |\n|           | if both are given).                                                   |\n+-----------+-----------------------------------------------------------------------+\n| "\' \'"     | (a space) A blank should be left before a positive number (or empty   |\n|           | string) produced by a signed conversion.                              |\n+-----------+-----------------------------------------------------------------------+\n| "\'+\'"     | A sign character ("\'+\'" or "\'-\'") will precede the conversion         |\n|           | (overrides a "space" flag).                                           |\n+-----------+-----------------------------------------------------------------------+\n\nA length modifier ("h", "l", or "L") may be present, but is ignored as\nit is not necessary for Python -- so e.g. "%ld" is identical to "%d".\n\nThe conversion types are:\n\n+--------------+-------------------------------------------------------+---------+\n| Conversion   | Meaning                                               | Notes   |\n+==============+=======================================================+=========+\n| "\'d\'"        | Signed integer decimal.                               |         |\n+--------------+-------------------------------------------------------+---------+\n| "\'i\'"        | Signed integer decimal.                               |         |\n+--------------+-------------------------------------------------------+---------+\n| "\'o\'"        | Signed octal value.                                   | (1)     |\n+--------------+-------------------------------------------------------+---------+\n| "\'u\'"        | Obsolete type -- it is identical to "\'d\'".            | (7)     |\n+--------------+-------------------------------------------------------+---------+\n| "\'x\'"        | Signed hexadecimal (lowercase).                       | (2)     |\n+--------------+-------------------------------------------------------+---------+\n| "\'X\'"        | Signed hexadecimal (uppercase).                       | (2)     |\n+--------------+-------------------------------------------------------+---------+\n| "\'e\'"        | Floating point exponential format (lowercase).        | (3)     |\n+--------------+-------------------------------------------------------+---------+\n| "\'E\'"        | Floating point exponential format (uppercase).        | (3)     |\n+--------------+-------------------------------------------------------+---------+\n| "\'f\'"        | Floating point decimal format.                        | (3)     |\n+--------------+-------------------------------------------------------+---------+\n| "\'F\'"        | Floating point decimal format.                        | (3)     |\n+--------------+-------------------------------------------------------+---------+\n| "\'g\'"        | Floating point format. Uses lowercase exponential     | (4)     |\n|              | format if exponent is less than -4 or not less than   |         |\n|              | precision, decimal format otherwise.                  |         |\n+--------------+-------------------------------------------------------+---------+\n| "\'G\'"        | Floating point format. Uses uppercase exponential     | (4)     |\n|              | format if exponent is less than -4 or not less than   |         |\n|              | precision, decimal format otherwise.                  |         |\n+--------------+-------------------------------------------------------+---------+\n| "\'c\'"        | Single character (accepts integer or single character |         |\n|              | string).                                              |         |\n+--------------+-------------------------------------------------------+---------+\n| "\'r\'"        | String (converts any Python object using repr()).     | (5)     |\n+--------------+-------------------------------------------------------+---------+\n| "\'s\'"        | String (converts any Python object using "str()").    | (6)     |\n+--------------+-------------------------------------------------------+---------+\n| "\'%\'"        | No argument is converted, results in a "\'%\'"          |         |\n|              | character in the result.                              |         |\n+--------------+-------------------------------------------------------+---------+\n\nNotes:\n\n1. The alternate form causes a leading zero ("\'0\'") to be inserted\n   between left-hand padding and the formatting of the number if the\n   leading character of the result is not already a zero.\n\n2. The alternate form causes a leading "\'0x\'" or "\'0X\'" (depending\n   on whether the "\'x\'" or "\'X\'" format was used) to be inserted\n   between left-hand padding and the formatting of the number if the\n   leading character of the result is not already a zero.\n\n3. The alternate form causes the result to always contain a decimal\n   point, even if no digits follow it.\n\n   The precision determines the number of digits after the decimal\n   point and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\n   point, and trailing zeroes are not removed as they would otherwise\n   be.\n\n   The precision determines the number of significant digits before\n   and after the decimal point and defaults to 6.\n\n5. The "%r" conversion was added in Python 2.0.\n\n   The precision determines the maximal number of characters used.\n\n6. If the object or format provided is a "unicode" string, the\n   resulting string will also be "unicode".\n\n   The precision determines the maximal number of characters used.\n\n7. See **PEP 237**.\n\nSince Python strings have an explicit length, "%s" conversions do not\nassume that "\'\\0\'" is the end of the string.\n\nChanged in version 2.7: "%f" conversions for numbers whose absolute\nvalue is over 1e50 are no longer replaced by "%g" conversions.\n\nAdditional string operations are defined in standard modules "string"\nand "re".\n\n\nXRange Type\n===========\n\nThe "xrange" type is an immutable sequence which is commonly used for\nlooping.  The advantage of the "xrange" type is that an "xrange"\nobject will always take the same amount of memory, no matter the size\nof the range it represents.  There are no consistent performance\nadvantages.\n\nXRange objects have very little behavior: they only support indexing,\niteration, and the "len()" function.\n\n\nMutable Sequence Types\n======================\n\nList and "bytearray" objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation                      | Result                           | Notes                 |\n+================================+==================================+=======================+\n| "s[i] = x"                     | item *i* of *s* is replaced by   |                       |\n|                                | *x*                              |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t"                   | slice of *s* from *i* to *j* is  |                       |\n|                                | replaced by the contents of the  |                       |\n|                                | iterable *t*                     |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]"                   | same as "s[i:j] = []"            |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t"                 | the elements of "s[i:j:k]" are   | (1)                   |\n|                                | replaced by those of *t*         |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]"                 | removes the elements of          |                       |\n|                                | "s[i:j:k]" from the list         |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)"                  | same as "s[len(s):len(s)] = [x]" | (2)                   |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(x)"                  | same as "s[len(s):len(s)] = x"   | (3)                   |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.count(x)"                   | return number of *i*\'s for which |                       |\n|                                | "s[i] == x"                      |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.index(x[, i[, j]])"         | return smallest *k* such that    | (4)                   |\n|                                | "s[k] == x" and "i <= k < j"     |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)"               | same as "s[i:i] = [x]"           | (5)                   |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])"                   | same as "x = s[i]; del s[i];     | (6)                   |\n|                                | return x"                        |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)"                  | same as "del s[s.index(x)]"      | (4)                   |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()"                  | reverses the items of *s* in     | (7)                   |\n|                                | place                            |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.sort([cmp[, key[,           | sort the items of *s* in place   | (7)(8)(9)(10)         |\n| reverse]]])"                   |                                  |                       |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is  replacing.\n\n2. The C implementation of Python has historically accepted\n   multiple parameters and implicitly joined them into a tuple; this\n   no longer works in Python 2.0.  Use of this misfeature has been\n   deprecated since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises "ValueError" when *x* is not found in *s*. When a\n   negative index is passed as the second or third parameter to the\n   "index()" method, the list length is added, as for slice indices.\n   If it is still negative, it is truncated to zero, as for slice\n   indices.\n\n   Changed in version 2.3: Previously, "index()" didn\'t have arguments\n   for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n   "insert()" method, the list length is added, as for slice indices.\n   If it is still negative, it is truncated to zero, as for slice\n   indices.\n\n   Changed in version 2.3: Previously, all negative indices were\n   truncated to zero.\n\n6. The "pop()" method\'s optional argument *i* defaults to "-1", so\n   that by default the last item is removed and returned.\n\n7. The "sort()" and "reverse()" methods modify the list in place\n   for economy of space when sorting or reversing a large list.  To\n   remind you that they operate by side effect, they don\'t return the\n   sorted or reversed list.\n\n8. The "sort()" method takes optional arguments for controlling the\n   comparisons.\n\n   *cmp* specifies a custom comparison function of two arguments (list\n   items) which should return a negative, zero or positive number\n   depending on whether the first argument is considered smaller than,\n   equal to, or larger than the second argument: "cmp=lambda x,y:\n   cmp(x.lower(), y.lower())".  The default value is "None".\n\n   *key* specifies a function of one argument that is used to extract\n   a comparison key from each list element: "key=str.lower".  The\n   default value is "None".\n\n   *reverse* is a boolean value.  If set to "True", then the list\n   elements are sorted as if each comparison were reversed.\n\n   In general, the *key* and *reverse* conversion processes are much\n   faster than specifying an equivalent *cmp* function.  This is\n   because *cmp* is called multiple times for each list element while\n   *key* and *reverse* touch each element only once.  Use\n   "functools.cmp_to_key()" to convert an old-style *cmp* function to\n   a *key* function.\n\n   Changed in version 2.3: Support for "None" as an equivalent to\n   omitting *cmp* was added.\n\n   Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the "sort()" method is guaranteed to\n   be stable.  A sort is stable if it guarantees not to change the\n   relative order of elements that compare equal --- this is helpful\n   for sorting in multiple passes (for example, sort by department,\n   then by salary grade).\n\n10. **CPython implementation detail:** While a list is being\n    sorted, the effect of attempting to mutate, or even inspect, the\n    list is undefined.  The C implementation of Python 2.3 and newer\n    makes the list appear empty for the duration, and raises\n    "ValueError" if it can detect that the list has been mutated\n    during a sort.\n',\r
+ 'typesseq-mutable': u'\nMutable Sequence Types\n**********************\n\nList and "bytearray" objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation                      | Result                           | Notes                 |\n+================================+==================================+=======================+\n| "s[i] = x"                     | item *i* of *s* is replaced by   |                       |\n|                                | *x*                              |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t"                   | slice of *s* from *i* to *j* is  |                       |\n|                                | replaced by the contents of the  |                       |\n|                                | iterable *t*                     |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]"                   | same as "s[i:j] = []"            |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t"                 | the elements of "s[i:j:k]" are   | (1)                   |\n|                                | replaced by those of *t*         |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]"                 | removes the elements of          |                       |\n|                                | "s[i:j:k]" from the list         |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)"                  | same as "s[len(s):len(s)] = [x]" | (2)                   |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(x)"                  | same as "s[len(s):len(s)] = x"   | (3)                   |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.count(x)"                   | return number of *i*\'s for which |                       |\n|                                | "s[i] == x"                      |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.index(x[, i[, j]])"         | return smallest *k* such that    | (4)                   |\n|                                | "s[k] == x" and "i <= k < j"     |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)"               | same as "s[i:i] = [x]"           | (5)                   |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])"                   | same as "x = s[i]; del s[i];     | (6)                   |\n|                                | return x"                        |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)"                  | same as "del s[s.index(x)]"      | (4)                   |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()"                  | reverses the items of *s* in     | (7)                   |\n|                                | place                            |                       |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.sort([cmp[, key[,           | sort the items of *s* in place   | (7)(8)(9)(10)         |\n| reverse]]])"                   |                                  |                       |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is  replacing.\n\n2. The C implementation of Python has historically accepted\n   multiple parameters and implicitly joined them into a tuple; this\n   no longer works in Python 2.0.  Use of this misfeature has been\n   deprecated since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises "ValueError" when *x* is not found in *s*. When a\n   negative index is passed as the second or third parameter to the\n   "index()" method, the list length is added, as for slice indices.\n   If it is still negative, it is truncated to zero, as for slice\n   indices.\n\n   Changed in version 2.3: Previously, "index()" didn\'t have arguments\n   for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n   "insert()" method, the list length is added, as for slice indices.\n   If it is still negative, it is truncated to zero, as for slice\n   indices.\n\n   Changed in version 2.3: Previously, all negative indices were\n   truncated to zero.\n\n6. The "pop()" method\'s optional argument *i* defaults to "-1", so\n   that by default the last item is removed and returned.\n\n7. The "sort()" and "reverse()" methods modify the list in place\n   for economy of space when sorting or reversing a large list.  To\n   remind you that they operate by side effect, they don\'t return the\n   sorted or reversed list.\n\n8. The "sort()" method takes optional arguments for controlling the\n   comparisons.\n\n   *cmp* specifies a custom comparison function of two arguments (list\n   items) which should return a negative, zero or positive number\n   depending on whether the first argument is considered smaller than,\n   equal to, or larger than the second argument: "cmp=lambda x,y:\n   cmp(x.lower(), y.lower())".  The default value is "None".\n\n   *key* specifies a function of one argument that is used to extract\n   a comparison key from each list element: "key=str.lower".  The\n   default value is "None".\n\n   *reverse* is a boolean value.  If set to "True", then the list\n   elements are sorted as if each comparison were reversed.\n\n   In general, the *key* and *reverse* conversion processes are much\n   faster than specifying an equivalent *cmp* function.  This is\n   because *cmp* is called multiple times for each list element while\n   *key* and *reverse* touch each element only once.  Use\n   "functools.cmp_to_key()" to convert an old-style *cmp* function to\n   a *key* function.\n\n   Changed in version 2.3: Support for "None" as an equivalent to\n   omitting *cmp* was added.\n\n   Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the "sort()" method is guaranteed to\n   be stable.  A sort is stable if it guarantees not to change the\n   relative order of elements that compare equal --- this is helpful\n   for sorting in multiple passes (for example, sort by department,\n   then by salary grade).\n\n10. **CPython implementation detail:** While a list is being\n    sorted, the effect of attempting to mutate, or even inspect, the\n    list is undefined.  The C implementation of Python 2.3 and newer\n    makes the list appear empty for the duration, and raises\n    "ValueError" if it can detect that the list has been mutated\n    during a sort.\n',\r
+ 'unary': u'\nUnary arithmetic and bitwise operations\n***************************************\n\nAll unary arithmetic and bitwise operations have the same priority:\n\n   u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary "-" (minus) operator yields the negation of its numeric\nargument.\n\nThe unary "+" (plus) operator yields its numeric argument unchanged.\n\nThe unary "~" (invert) operator yields the bitwise inversion of its\nplain or long integer argument.  The bitwise inversion of "x" is\ndefined as "-(x+1)".  It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n"TypeError" exception is raised.\n',\r
+ 'while': u'\nThe "while" statement\n*********************\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n   while_stmt ::= "while" expression ":" suite\n                  ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite.  A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n',\r
+ 'with': u'\nThe "with" statement\n********************\n\nNew in version 2.5.\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section With Statement\nContext Managers). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n   with_stmt ::= "with" with_item ("," with_item)* ":" suite\n   with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n   is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n   value from "__enter__()" is assigned to it.\n\n   Note: The "with" statement guarantees that if the "__enter__()"\n     method returns without an error, then "__exit__()" will always be\n     called. Thus, if an error occurs during the assignment to the\n     target list, it will be treated the same as an error occurring\n     within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n   exception caused the suite to be exited, its type, value, and\n   traceback are passed as arguments to "__exit__()". Otherwise, three\n   "None" arguments are supplied.\n\n   If the suite was exited due to an exception, and the return value\n   from the "__exit__()" method was false, the exception is reraised.\n   If the return value was true, the exception is suppressed, and\n   execution continues with the statement following the "with"\n   statement.\n\n   If the suite was exited for any reason other than an exception, the\n   return value from "__exit__()" is ignored, and execution proceeds\n   at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n   with A() as a, B() as b:\n       suite\n\nis equivalent to\n\n   with A() as a:\n       with B() as b:\n           suite\n\nNote: In Python 2.5, the "with" statement is only allowed when the\n  "with_statement" feature has been enabled.  It is always enabled in\n  Python 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also: **PEP 0343** - The "with" statement\n\n     The specification, background, and examples for the Python "with"\n     statement.\n',\r
+ 'yield': u'\nThe "yield" statement\n*********************\n\n   yield_stmt ::= yield_expression\n\nThe "yield" statement is only used when defining a generator function,\nand is only used in the body of the generator function. Using a\n"yield" statement in a function definition is sufficient to cause that\ndefinition to create a generator function instead of a normal\nfunction.\n\nWhen a generator function is called, it returns an iterator known as a\ngenerator iterator, or more commonly, a generator.  The body of the\ngenerator function is executed by calling the generator\'s "next()"\nmethod repeatedly until it raises an exception.\n\nWhen a "yield" statement is executed, the state of the generator is\nfrozen and the value of "expression_list" is returned to "next()"\'s\ncaller.  By "frozen" we mean that all local state is retained,\nincluding the current bindings of local variables, the instruction\npointer, and the internal evaluation stack: enough information is\nsaved so that the next time "next()" is invoked, the function can\nproceed exactly as if the "yield" statement were just another external\ncall.\n\nAs of Python version 2.5, the "yield" statement is now allowed in the\n"try" clause of a "try" ...  "finally" construct.  If the generator is\nnot resumed before it is finalized (by reaching a zero reference count\nor by being garbage collected), the generator-iterator\'s "close()"\nmethod will be called, allowing any pending "finally" clauses to\nexecute.\n\nFor full details of "yield" semantics, refer to the Yield expressions\nsection.\n\nNote: In Python 2.2, the "yield" statement was only allowed when the\n  "generators" feature has been enabled.  This "__future__" import\n  statement was used to enable the feature:\n\n     from __future__ import generators\n\nSee also: **PEP 0255** - Simple Generators\n\n     The proposal for adding generators and the "yield" statement to\n     Python.\n\n  **PEP 0342** - Coroutines via Enhanced Generators\n     The proposal that, among other generator enhancements, proposed\n     allowing "yield" to appear inside a "try" ... "finally" block.\n'}\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/random.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/random.py
new file mode 100644 (file)
index 0000000..f234c85
--- /dev/null
@@ -0,0 +1,910 @@
+"""Random variable generators.\r
+\r
+    integers\r
+    --------\r
+           uniform within range\r
+\r
+    sequences\r
+    ---------\r
+           pick random element\r
+           pick random sample\r
+           generate random permutation\r
+\r
+    distributions on the real line:\r
+    ------------------------------\r
+           uniform\r
+           triangular\r
+           normal (Gaussian)\r
+           lognormal\r
+           negative exponential\r
+           gamma\r
+           beta\r
+           pareto\r
+           Weibull\r
+\r
+    distributions on the circle (angles 0 to 2pi)\r
+    ---------------------------------------------\r
+           circular uniform\r
+           von Mises\r
+\r
+General notes on the underlying Mersenne Twister core generator:\r
+\r
+* The period is 2**19937-1.\r
+* It is one of the most extensively tested generators in existence.\r
+* Without a direct way to compute N steps forward, the semantics of\r
+  jumpahead(n) are weakened to simply jump to another distant state and rely\r
+  on the large period to avoid overlapping sequences.\r
+* The random() method is implemented in C, executes in a single Python step,\r
+  and is, therefore, threadsafe.\r
+\r
+"""\r
+\r
+from __future__ import division\r
+from warnings import warn as _warn\r
+from types import MethodType as _MethodType, BuiltinMethodType as _BuiltinMethodType\r
+from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil\r
+from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin\r
+from os import urandom as _urandom\r
+from binascii import hexlify as _hexlify\r
+import hashlib as _hashlib\r
+\r
+__all__ = ["Random","seed","random","uniform","randint","choice","sample",\r
+           "randrange","shuffle","normalvariate","lognormvariate",\r
+           "expovariate","vonmisesvariate","gammavariate","triangular",\r
+           "gauss","betavariate","paretovariate","weibullvariate",\r
+           "getstate","setstate","jumpahead", "WichmannHill", "getrandbits",\r
+           "SystemRandom"]\r
+\r
+NV_MAGICCONST = 4 * _exp(-0.5)/_sqrt(2.0)\r
+TWOPI = 2.0*_pi\r
+LOG4 = _log(4.0)\r
+SG_MAGICCONST = 1.0 + _log(4.5)\r
+BPF = 53        # Number of bits in a float\r
+RECIP_BPF = 2**-BPF\r
+\r
+\r
+# Translated by Guido van Rossum from C source provided by\r
+# Adrian Baddeley.  Adapted by Raymond Hettinger for use with\r
+# the Mersenne Twister  and os.urandom() core generators.\r
+\r
+import _random\r
+\r
+class Random(_random.Random):\r
+    """Random number generator base class used by bound module functions.\r
+\r
+    Used to instantiate instances of Random to get generators that don't\r
+    share state.  Especially useful for multi-threaded programs, creating\r
+    a different instance of Random for each thread, and using the jumpahead()\r
+    method to ensure that the generated sequences seen by each thread don't\r
+    overlap.\r
+\r
+    Class Random can also be subclassed if you want to use a different basic\r
+    generator of your own devising: in that case, override the following\r
+    methods: random(), seed(), getstate(), setstate() and jumpahead().\r
+    Optionally, implement a getrandbits() method so that randrange() can cover\r
+    arbitrarily large ranges.\r
+\r
+    """\r
+\r
+    VERSION = 3     # used by getstate/setstate\r
+\r
+    def __init__(self, x=None):\r
+        """Initialize an instance.\r
+\r
+        Optional argument x controls seeding, as for Random.seed().\r
+        """\r
+\r
+        self.seed(x)\r
+        self.gauss_next = None\r
+\r
+    def seed(self, a=None):\r
+        """Initialize internal state from hashable object.\r
+\r
+        None or no argument seeds from current time or from an operating\r
+        system specific randomness source if available.\r
+\r
+        If a is not None or an int or long, hash(a) is used instead.\r
+        """\r
+\r
+        if a is None:\r
+            try:\r
+                # Seed with enough bytes to span the 19937 bit\r
+                # state space for the Mersenne Twister\r
+                a = long(_hexlify(_urandom(2500)), 16)\r
+            except NotImplementedError:\r
+                import time\r
+                a = long(time.time() * 256) # use fractional seconds\r
+\r
+        super(Random, self).seed(a)\r
+        self.gauss_next = None\r
+\r
+    def getstate(self):\r
+        """Return internal state; can be passed to setstate() later."""\r
+        return self.VERSION, super(Random, self).getstate(), self.gauss_next\r
+\r
+    def setstate(self, state):\r
+        """Restore internal state from object returned by getstate()."""\r
+        version = state[0]\r
+        if version == 3:\r
+            version, internalstate, self.gauss_next = state\r
+            super(Random, self).setstate(internalstate)\r
+        elif version == 2:\r
+            version, internalstate, self.gauss_next = state\r
+            # In version 2, the state was saved as signed ints, which causes\r
+            #   inconsistencies between 32/64-bit systems. The state is\r
+            #   really unsigned 32-bit ints, so we convert negative ints from\r
+            #   version 2 to positive longs for version 3.\r
+            try:\r
+                internalstate = tuple( long(x) % (2**32) for x in internalstate )\r
+            except ValueError, e:\r
+                raise TypeError, e\r
+            super(Random, self).setstate(internalstate)\r
+        else:\r
+            raise ValueError("state with version %s passed to "\r
+                             "Random.setstate() of version %s" %\r
+                             (version, self.VERSION))\r
+\r
+    def jumpahead(self, n):\r
+        """Change the internal state to one that is likely far away\r
+        from the current state.  This method will not be in Py3.x,\r
+        so it is better to simply reseed.\r
+        """\r
+        # The super.jumpahead() method uses shuffling to change state,\r
+        # so it needs a large and "interesting" n to work with.  Here,\r
+        # we use hashing to create a large n for the shuffle.\r
+        s = repr(n) + repr(self.getstate())\r
+        n = int(_hashlib.new('sha512', s).hexdigest(), 16)\r
+        super(Random, self).jumpahead(n)\r
+\r
+## ---- Methods below this point do not need to be overridden when\r
+## ---- subclassing for the purpose of using a different core generator.\r
+\r
+## -------------------- pickle support  -------------------\r
+\r
+    def __getstate__(self): # for pickle\r
+        return self.getstate()\r
+\r
+    def __setstate__(self, state):  # for pickle\r
+        self.setstate(state)\r
+\r
+    def __reduce__(self):\r
+        return self.__class__, (), self.getstate()\r
+\r
+## -------------------- integer methods  -------------------\r
+\r
+    def randrange(self, start, stop=None, step=1, _int=int, _maxwidth=1L<<BPF):\r
+        """Choose a random item from range(start, stop[, step]).\r
+\r
+        This fixes the problem with randint() which includes the\r
+        endpoint; in Python this is usually not what you want.\r
+\r
+        """\r
+\r
+        # This code is a bit messy to make it fast for the\r
+        # common case while still doing adequate error checking.\r
+        istart = _int(start)\r
+        if istart != start:\r
+            raise ValueError, "non-integer arg 1 for randrange()"\r
+        if stop is None:\r
+            if istart > 0:\r
+                if istart >= _maxwidth:\r
+                    return self._randbelow(istart)\r
+                return _int(self.random() * istart)\r
+            raise ValueError, "empty range for randrange()"\r
+\r
+        # stop argument supplied.\r
+        istop = _int(stop)\r
+        if istop != stop:\r
+            raise ValueError, "non-integer stop for randrange()"\r
+        width = istop - istart\r
+        if step == 1 and width > 0:\r
+            # Note that\r
+            #     int(istart + self.random()*width)\r
+            # instead would be incorrect.  For example, consider istart\r
+            # = -2 and istop = 0.  Then the guts would be in\r
+            # -2.0 to 0.0 exclusive on both ends (ignoring that random()\r
+            # might return 0.0), and because int() truncates toward 0, the\r
+            # final result would be -1 or 0 (instead of -2 or -1).\r
+            #     istart + int(self.random()*width)\r
+            # would also be incorrect, for a subtler reason:  the RHS\r
+            # can return a long, and then randrange() would also return\r
+            # a long, but we're supposed to return an int (for backward\r
+            # compatibility).\r
+\r
+            if width >= _maxwidth:\r
+                return _int(istart + self._randbelow(width))\r
+            return _int(istart + _int(self.random()*width))\r
+        if step == 1:\r
+            raise ValueError, "empty range for randrange() (%d,%d, %d)" % (istart, istop, width)\r
+\r
+        # Non-unit step argument supplied.\r
+        istep = _int(step)\r
+        if istep != step:\r
+            raise ValueError, "non-integer step for randrange()"\r
+        if istep > 0:\r
+            n = (width + istep - 1) // istep\r
+        elif istep < 0:\r
+            n = (width + istep + 1) // istep\r
+        else:\r
+            raise ValueError, "zero step for randrange()"\r
+\r
+        if n <= 0:\r
+            raise ValueError, "empty range for randrange()"\r
+\r
+        if n >= _maxwidth:\r
+            return istart + istep*self._randbelow(n)\r
+        return istart + istep*_int(self.random() * n)\r
+\r
+    def randint(self, a, b):\r
+        """Return random integer in range [a, b], including both end points.\r
+        """\r
+\r
+        return self.randrange(a, b+1)\r
+\r
+    def _randbelow(self, n, _log=_log, _int=int, _maxwidth=1L<<BPF,\r
+                   _Method=_MethodType, _BuiltinMethod=_BuiltinMethodType):\r
+        """Return a random int in the range [0,n)\r
+\r
+        Handles the case where n has more bits than returned\r
+        by a single call to the underlying generator.\r
+        """\r
+\r
+        try:\r
+            getrandbits = self.getrandbits\r
+        except AttributeError:\r
+            pass\r
+        else:\r
+            # Only call self.getrandbits if the original random() builtin method\r
+            # has not been overridden or if a new getrandbits() was supplied.\r
+            # This assures that the two methods correspond.\r
+            if type(self.random) is _BuiltinMethod or type(getrandbits) is _Method:\r
+                k = _int(1.00001 + _log(n-1, 2.0))   # 2**k > n-1 > 2**(k-2)\r
+                r = getrandbits(k)\r
+                while r >= n:\r
+                    r = getrandbits(k)\r
+                return r\r
+        if n >= _maxwidth:\r
+            _warn("Underlying random() generator does not supply \n"\r
+                "enough bits to choose from a population range this large")\r
+        return _int(self.random() * n)\r
+\r
+## -------------------- sequence methods  -------------------\r
+\r
+    def choice(self, seq):\r
+        """Choose a random element from a non-empty sequence."""\r
+        return seq[int(self.random() * len(seq))]  # raises IndexError if seq is empty\r
+\r
+    def shuffle(self, x, random=None):\r
+        """x, random=random.random -> shuffle list x in place; return None.\r
+\r
+        Optional arg random is a 0-argument function returning a random\r
+        float in [0.0, 1.0); by default, the standard random.random.\r
+\r
+        """\r
+\r
+        if random is None:\r
+            random = self.random\r
+        _int = int\r
+        for i in reversed(xrange(1, len(x))):\r
+            # pick an element in x[:i+1] with which to exchange x[i]\r
+            j = _int(random() * (i+1))\r
+            x[i], x[j] = x[j], x[i]\r
+\r
+    def sample(self, population, k):\r
+        """Chooses k unique random elements from a population sequence.\r
+\r
+        Returns a new list containing elements from the population while\r
+        leaving the original population unchanged.  The resulting list is\r
+        in selection order so that all sub-slices will also be valid random\r
+        samples.  This allows raffle winners (the sample) to be partitioned\r
+        into grand prize and second place winners (the subslices).\r
+\r
+        Members of the population need not be hashable or unique.  If the\r
+        population contains repeats, then each occurrence is a possible\r
+        selection in the sample.\r
+\r
+        To choose a sample in a range of integers, use xrange as an argument.\r
+        This is especially fast and space efficient for sampling from a\r
+        large population:   sample(xrange(10000000), 60)\r
+        """\r
+\r
+        # Sampling without replacement entails tracking either potential\r
+        # selections (the pool) in a list or previous selections in a set.\r
+\r
+        # When the number of selections is small compared to the\r
+        # population, then tracking selections is efficient, requiring\r
+        # only a small set and an occasional reselection.  For\r
+        # a larger number of selections, the pool tracking method is\r
+        # preferred since the list takes less space than the\r
+        # set and it doesn't suffer from frequent reselections.\r
+\r
+        n = len(population)\r
+        if not 0 <= k <= n:\r
+            raise ValueError("sample larger than population")\r
+        random = self.random\r
+        _int = int\r
+        result = [None] * k\r
+        setsize = 21        # size of a small set minus size of an empty list\r
+        if k > 5:\r
+            setsize += 4 ** _ceil(_log(k * 3, 4)) # table size for big sets\r
+        if n <= setsize or hasattr(population, "keys"):\r
+            # An n-length list is smaller than a k-length set, or this is a\r
+            # mapping type so the other algorithm wouldn't work.\r
+            pool = list(population)\r
+            for i in xrange(k):         # invariant:  non-selected at [0,n-i)\r
+                j = _int(random() * (n-i))\r
+                result[i] = pool[j]\r
+                pool[j] = pool[n-i-1]   # move non-selected item into vacancy\r
+        else:\r
+            try:\r
+                selected = set()\r
+                selected_add = selected.add\r
+                for i in xrange(k):\r
+                    j = _int(random() * n)\r
+                    while j in selected:\r
+                        j = _int(random() * n)\r
+                    selected_add(j)\r
+                    result[i] = population[j]\r
+            except (TypeError, KeyError):   # handle (at least) sets\r
+                if isinstance(population, list):\r
+                    raise\r
+                return self.sample(tuple(population), k)\r
+        return result\r
+\r
+## -------------------- real-valued distributions  -------------------\r
+\r
+## -------------------- uniform distribution -------------------\r
+\r
+    def uniform(self, a, b):\r
+        "Get a random number in the range [a, b) or [a, b] depending on rounding."\r
+        return a + (b-a) * self.random()\r
+\r
+## -------------------- triangular --------------------\r
+\r
+    def triangular(self, low=0.0, high=1.0, mode=None):\r
+        """Triangular distribution.\r
+\r
+        Continuous distribution bounded by given lower and upper limits,\r
+        and having a given mode value in-between.\r
+\r
+        http://en.wikipedia.org/wiki/Triangular_distribution\r
+\r
+        """\r
+        u = self.random()\r
+        try:\r
+            c = 0.5 if mode is None else (mode - low) / (high - low)\r
+        except ZeroDivisionError:\r
+            return low\r
+        if u > c:\r
+            u = 1.0 - u\r
+            c = 1.0 - c\r
+            low, high = high, low\r
+        return low + (high - low) * (u * c) ** 0.5\r
+\r
+## -------------------- normal distribution --------------------\r
+\r
+    def normalvariate(self, mu, sigma):\r
+        """Normal distribution.\r
+\r
+        mu is the mean, and sigma is the standard deviation.\r
+\r
+        """\r
+        # mu = mean, sigma = standard deviation\r
+\r
+        # Uses Kinderman and Monahan method. Reference: Kinderman,\r
+        # A.J. and Monahan, J.F., "Computer generation of random\r
+        # variables using the ratio of uniform deviates", ACM Trans\r
+        # Math Software, 3, (1977), pp257-260.\r
+\r
+        random = self.random\r
+        while 1:\r
+            u1 = random()\r
+            u2 = 1.0 - random()\r
+            z = NV_MAGICCONST*(u1-0.5)/u2\r
+            zz = z*z/4.0\r
+            if zz <= -_log(u2):\r
+                break\r
+        return mu + z*sigma\r
+\r
+## -------------------- lognormal distribution --------------------\r
+\r
+    def lognormvariate(self, mu, sigma):\r
+        """Log normal distribution.\r
+\r
+        If you take the natural logarithm of this distribution, you'll get a\r
+        normal distribution with mean mu and standard deviation sigma.\r
+        mu can have any value, and sigma must be greater than zero.\r
+\r
+        """\r
+        return _exp(self.normalvariate(mu, sigma))\r
+\r
+## -------------------- exponential distribution --------------------\r
+\r
+    def expovariate(self, lambd):\r
+        """Exponential distribution.\r
+\r
+        lambd is 1.0 divided by the desired mean.  It should be\r
+        nonzero.  (The parameter would be called "lambda", but that is\r
+        a reserved word in Python.)  Returned values range from 0 to\r
+        positive infinity if lambd is positive, and from negative\r
+        infinity to 0 if lambd is negative.\r
+\r
+        """\r
+        # lambd: rate lambd = 1/mean\r
+        # ('lambda' is a Python reserved word)\r
+\r
+        # we use 1-random() instead of random() to preclude the\r
+        # possibility of taking the log of zero.\r
+        return -_log(1.0 - self.random())/lambd\r
+\r
+## -------------------- von Mises distribution --------------------\r
+\r
+    def vonmisesvariate(self, mu, kappa):\r
+        """Circular data distribution.\r
+\r
+        mu is the mean angle, expressed in radians between 0 and 2*pi, and\r
+        kappa is the concentration parameter, which must be greater than or\r
+        equal to zero.  If kappa is equal to zero, this distribution reduces\r
+        to a uniform random angle over the range 0 to 2*pi.\r
+\r
+        """\r
+        # mu:    mean angle (in radians between 0 and 2*pi)\r
+        # kappa: concentration parameter kappa (>= 0)\r
+        # if kappa = 0 generate uniform random angle\r
+\r
+        # Based upon an algorithm published in: Fisher, N.I.,\r
+        # "Statistical Analysis of Circular Data", Cambridge\r
+        # University Press, 1993.\r
+\r
+        # Thanks to Magnus Kessler for a correction to the\r
+        # implementation of step 4.\r
+\r
+        random = self.random\r
+        if kappa <= 1e-6:\r
+            return TWOPI * random()\r
+\r
+        s = 0.5 / kappa\r
+        r = s + _sqrt(1.0 + s * s)\r
+\r
+        while 1:\r
+            u1 = random()\r
+            z = _cos(_pi * u1)\r
+\r
+            d = z / (r + z)\r
+            u2 = random()\r
+            if u2 < 1.0 - d * d or u2 <= (1.0 - d) * _exp(d):\r
+                break\r
+\r
+        q = 1.0 / r\r
+        f = (q + z) / (1.0 + q * z)\r
+        u3 = random()\r
+        if u3 > 0.5:\r
+            theta = (mu + _acos(f)) % TWOPI\r
+        else:\r
+            theta = (mu - _acos(f)) % TWOPI\r
+\r
+        return theta\r
+\r
+## -------------------- gamma distribution --------------------\r
+\r
+    def gammavariate(self, alpha, beta):\r
+        """Gamma distribution.  Not the gamma function!\r
+\r
+        Conditions on the parameters are alpha > 0 and beta > 0.\r
+\r
+        The probability distribution function is:\r
+\r
+                    x ** (alpha - 1) * math.exp(-x / beta)\r
+          pdf(x) =  --------------------------------------\r
+                      math.gamma(alpha) * beta ** alpha\r
+\r
+        """\r
+\r
+        # alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2\r
+\r
+        # Warning: a few older sources define the gamma distribution in terms\r
+        # of alpha > -1.0\r
+        if alpha <= 0.0 or beta <= 0.0:\r
+            raise ValueError, 'gammavariate: alpha and beta must be > 0.0'\r
+\r
+        random = self.random\r
+        if alpha > 1.0:\r
+\r
+            # Uses R.C.H. Cheng, "The generation of Gamma\r
+            # variables with non-integral shape parameters",\r
+            # Applied Statistics, (1977), 26, No. 1, p71-74\r
+\r
+            ainv = _sqrt(2.0 * alpha - 1.0)\r
+            bbb = alpha - LOG4\r
+            ccc = alpha + ainv\r
+\r
+            while 1:\r
+                u1 = random()\r
+                if not 1e-7 < u1 < .9999999:\r
+                    continue\r
+                u2 = 1.0 - random()\r
+                v = _log(u1/(1.0-u1))/ainv\r
+                x = alpha*_exp(v)\r
+                z = u1*u1*u2\r
+                r = bbb+ccc*v-x\r
+                if r + SG_MAGICCONST - 4.5*z >= 0.0 or r >= _log(z):\r
+                    return x * beta\r
+\r
+        elif alpha == 1.0:\r
+            # expovariate(1)\r
+            u = random()\r
+            while u <= 1e-7:\r
+                u = random()\r
+            return -_log(u) * beta\r
+\r
+        else:   # alpha is between 0 and 1 (exclusive)\r
+\r
+            # Uses ALGORITHM GS of Statistical Computing - Kennedy & Gentle\r
+\r
+            while 1:\r
+                u = random()\r
+                b = (_e + alpha)/_e\r
+                p = b*u\r
+                if p <= 1.0:\r
+                    x = p ** (1.0/alpha)\r
+                else:\r
+                    x = -_log((b-p)/alpha)\r
+                u1 = random()\r
+                if p > 1.0:\r
+                    if u1 <= x ** (alpha - 1.0):\r
+                        break\r
+                elif u1 <= _exp(-x):\r
+                    break\r
+            return x * beta\r
+\r
+## -------------------- Gauss (faster alternative) --------------------\r
+\r
+    def gauss(self, mu, sigma):\r
+        """Gaussian distribution.\r
+\r
+        mu is the mean, and sigma is the standard deviation.  This is\r
+        slightly faster than the normalvariate() function.\r
+\r
+        Not thread-safe without a lock around calls.\r
+\r
+        """\r
+\r
+        # When x and y are two variables from [0, 1), uniformly\r
+        # distributed, then\r
+        #\r
+        #    cos(2*pi*x)*sqrt(-2*log(1-y))\r
+        #    sin(2*pi*x)*sqrt(-2*log(1-y))\r
+        #\r
+        # are two *independent* variables with normal distribution\r
+        # (mu = 0, sigma = 1).\r
+        # (Lambert Meertens)\r
+        # (corrected version; bug discovered by Mike Miller, fixed by LM)\r
+\r
+        # Multithreading note: When two threads call this function\r
+        # simultaneously, it is possible that they will receive the\r
+        # same return value.  The window is very small though.  To\r
+        # avoid this, you have to use a lock around all calls.  (I\r
+        # didn't want to slow this down in the serial case by using a\r
+        # lock here.)\r
+\r
+        random = self.random\r
+        z = self.gauss_next\r
+        self.gauss_next = None\r
+        if z is None:\r
+            x2pi = random() * TWOPI\r
+            g2rad = _sqrt(-2.0 * _log(1.0 - random()))\r
+            z = _cos(x2pi) * g2rad\r
+            self.gauss_next = _sin(x2pi) * g2rad\r
+\r
+        return mu + z*sigma\r
+\r
+## -------------------- beta --------------------\r
+## See\r
+## http://mail.python.org/pipermail/python-bugs-list/2001-January/003752.html\r
+## for Ivan Frohne's insightful analysis of why the original implementation:\r
+##\r
+##    def betavariate(self, alpha, beta):\r
+##        # Discrete Event Simulation in C, pp 87-88.\r
+##\r
+##        y = self.expovariate(alpha)\r
+##        z = self.expovariate(1.0/beta)\r
+##        return z/(y+z)\r
+##\r
+## was dead wrong, and how it probably got that way.\r
+\r
+    def betavariate(self, alpha, beta):\r
+        """Beta distribution.\r
+\r
+        Conditions on the parameters are alpha > 0 and beta > 0.\r
+        Returned values range between 0 and 1.\r
+\r
+        """\r
+\r
+        # This version due to Janne Sinkkonen, and matches all the std\r
+        # texts (e.g., Knuth Vol 2 Ed 3 pg 134 "the beta distribution").\r
+        y = self.gammavariate(alpha, 1.)\r
+        if y == 0:\r
+            return 0.0\r
+        else:\r
+            return y / (y + self.gammavariate(beta, 1.))\r
+\r
+## -------------------- Pareto --------------------\r
+\r
+    def paretovariate(self, alpha):\r
+        """Pareto distribution.  alpha is the shape parameter."""\r
+        # Jain, pg. 495\r
+\r
+        u = 1.0 - self.random()\r
+        return 1.0 / pow(u, 1.0/alpha)\r
+\r
+## -------------------- Weibull --------------------\r
+\r
+    def weibullvariate(self, alpha, beta):\r
+        """Weibull distribution.\r
+\r
+        alpha is the scale parameter and beta is the shape parameter.\r
+\r
+        """\r
+        # Jain, pg. 499; bug fix courtesy Bill Arms\r
+\r
+        u = 1.0 - self.random()\r
+        return alpha * pow(-_log(u), 1.0/beta)\r
+\r
+## -------------------- Wichmann-Hill -------------------\r
+\r
+class WichmannHill(Random):\r
+\r
+    VERSION = 1     # used by getstate/setstate\r
+\r
+    def seed(self, a=None):\r
+        """Initialize internal state from hashable object.\r
+\r
+        None or no argument seeds from current time or from an operating\r
+        system specific randomness source if available.\r
+\r
+        If a is not None or an int or long, hash(a) is used instead.\r
+\r
+        If a is an int or long, a is used directly.  Distinct values between\r
+        0 and 27814431486575L inclusive are guaranteed to yield distinct\r
+        internal states (this guarantee is specific to the default\r
+        Wichmann-Hill generator).\r
+        """\r
+\r
+        if a is None:\r
+            try:\r
+                a = long(_hexlify(_urandom(16)), 16)\r
+            except NotImplementedError:\r
+                import time\r
+                a = long(time.time() * 256) # use fractional seconds\r
+\r
+        if not isinstance(a, (int, long)):\r
+            a = hash(a)\r
+\r
+        a, x = divmod(a, 30268)\r
+        a, y = divmod(a, 30306)\r
+        a, z = divmod(a, 30322)\r
+        self._seed = int(x)+1, int(y)+1, int(z)+1\r
+\r
+        self.gauss_next = None\r
+\r
+    def random(self):\r
+        """Get the next random number in the range [0.0, 1.0)."""\r
+\r
+        # Wichman-Hill random number generator.\r
+        #\r
+        # Wichmann, B. A. & Hill, I. D. (1982)\r
+        # Algorithm AS 183:\r
+        # An efficient and portable pseudo-random number generator\r
+        # Applied Statistics 31 (1982) 188-190\r
+        #\r
+        # see also:\r
+        #        Correction to Algorithm AS 183\r
+        #        Applied Statistics 33 (1984) 123\r
+        #\r
+        #        McLeod, A. I. (1985)\r
+        #        A remark on Algorithm AS 183\r
+        #        Applied Statistics 34 (1985),198-200\r
+\r
+        # This part is thread-unsafe:\r
+        # BEGIN CRITICAL SECTION\r
+        x, y, z = self._seed\r
+        x = (171 * x) % 30269\r
+        y = (172 * y) % 30307\r
+        z = (170 * z) % 30323\r
+        self._seed = x, y, z\r
+        # END CRITICAL SECTION\r
+\r
+        # Note:  on a platform using IEEE-754 double arithmetic, this can\r
+        # never return 0.0 (asserted by Tim; proof too long for a comment).\r
+        return (x/30269.0 + y/30307.0 + z/30323.0) % 1.0\r
+\r
+    def getstate(self):\r
+        """Return internal state; can be passed to setstate() later."""\r
+        return self.VERSION, self._seed, self.gauss_next\r
+\r
+    def setstate(self, state):\r
+        """Restore internal state from object returned by getstate()."""\r
+        version = state[0]\r
+        if version == 1:\r
+            version, self._seed, self.gauss_next = state\r
+        else:\r
+            raise ValueError("state with version %s passed to "\r
+                             "Random.setstate() of version %s" %\r
+                             (version, self.VERSION))\r
+\r
+    def jumpahead(self, n):\r
+        """Act as if n calls to random() were made, but quickly.\r
+\r
+        n is an int, greater than or equal to 0.\r
+\r
+        Example use:  If you have 2 threads and know that each will\r
+        consume no more than a million random numbers, create two Random\r
+        objects r1 and r2, then do\r
+            r2.setstate(r1.getstate())\r
+            r2.jumpahead(1000000)\r
+        Then r1 and r2 will use guaranteed-disjoint segments of the full\r
+        period.\r
+        """\r
+\r
+        if not n >= 0:\r
+            raise ValueError("n must be >= 0")\r
+        x, y, z = self._seed\r
+        x = int(x * pow(171, n, 30269)) % 30269\r
+        y = int(y * pow(172, n, 30307)) % 30307\r
+        z = int(z * pow(170, n, 30323)) % 30323\r
+        self._seed = x, y, z\r
+\r
+    def __whseed(self, x=0, y=0, z=0):\r
+        """Set the Wichmann-Hill seed from (x, y, z).\r
+\r
+        These must be integers in the range [0, 256).\r
+        """\r
+\r
+        if not type(x) == type(y) == type(z) == int:\r
+            raise TypeError('seeds must be integers')\r
+        if not (0 <= x < 256 and 0 <= y < 256 and 0 <= z < 256):\r
+            raise ValueError('seeds must be in range(0, 256)')\r
+        if 0 == x == y == z:\r
+            # Initialize from current time\r
+            import time\r
+            t = long(time.time() * 256)\r
+            t = int((t&0xffffff) ^ (t>>24))\r
+            t, x = divmod(t, 256)\r
+            t, y = divmod(t, 256)\r
+            t, z = divmod(t, 256)\r
+        # Zero is a poor seed, so substitute 1\r
+        self._seed = (x or 1, y or 1, z or 1)\r
+\r
+        self.gauss_next = None\r
+\r
+    def whseed(self, a=None):\r
+        """Seed from hashable object's hash code.\r
+\r
+        None or no argument seeds from current time.  It is not guaranteed\r
+        that objects with distinct hash codes lead to distinct internal\r
+        states.\r
+\r
+        This is obsolete, provided for compatibility with the seed routine\r
+        used prior to Python 2.1.  Use the .seed() method instead.\r
+        """\r
+\r
+        if a is None:\r
+            self.__whseed()\r
+            return\r
+        a = hash(a)\r
+        a, x = divmod(a, 256)\r
+        a, y = divmod(a, 256)\r
+        a, z = divmod(a, 256)\r
+        x = (x + a) % 256 or 1\r
+        y = (y + a) % 256 or 1\r
+        z = (z + a) % 256 or 1\r
+        self.__whseed(x, y, z)\r
+\r
+## --------------- Operating System Random Source  ------------------\r
+\r
+class SystemRandom(Random):\r
+    """Alternate random number generator using sources provided\r
+    by the operating system (such as /dev/urandom on Unix or\r
+    CryptGenRandom on Windows).\r
+\r
+     Not available on all systems (see os.urandom() for details).\r
+    """\r
+\r
+    def random(self):\r
+        """Get the next random number in the range [0.0, 1.0)."""\r
+        return (long(_hexlify(_urandom(7)), 16) >> 3) * RECIP_BPF\r
+\r
+    def getrandbits(self, k):\r
+        """getrandbits(k) -> x.  Generates a long int with k random bits."""\r
+        if k <= 0:\r
+            raise ValueError('number of bits must be greater than zero')\r
+        if k != int(k):\r
+            raise TypeError('number of bits should be an integer')\r
+        bytes = (k + 7) // 8                    # bits / 8 and rounded up\r
+        x = long(_hexlify(_urandom(bytes)), 16)\r
+        return x >> (bytes * 8 - k)             # trim excess bits\r
+\r
+    def _stub(self, *args, **kwds):\r
+        "Stub method.  Not used for a system random number generator."\r
+        return None\r
+    seed = jumpahead = _stub\r
+\r
+    def _notimplemented(self, *args, **kwds):\r
+        "Method should not be called for a system random number generator."\r
+        raise NotImplementedError('System entropy source does not have state.')\r
+    getstate = setstate = _notimplemented\r
+\r
+## -------------------- test program --------------------\r
+\r
+def _test_generator(n, func, args):\r
+    import time\r
+    print n, 'times', func.__name__\r
+    total = 0.0\r
+    sqsum = 0.0\r
+    smallest = 1e10\r
+    largest = -1e10\r
+    t0 = time.time()\r
+    for i in range(n):\r
+        x = func(*args)\r
+        total += x\r
+        sqsum = sqsum + x*x\r
+        smallest = min(x, smallest)\r
+        largest = max(x, largest)\r
+    t1 = time.time()\r
+    print round(t1-t0, 3), 'sec,',\r
+    avg = total/n\r
+    stddev = _sqrt(sqsum/n - avg*avg)\r
+    print 'avg %g, stddev %g, min %g, max %g' % \\r
+              (avg, stddev, smallest, largest)\r
+\r
+\r
+def _test(N=2000):\r
+    _test_generator(N, random, ())\r
+    _test_generator(N, normalvariate, (0.0, 1.0))\r
+    _test_generator(N, lognormvariate, (0.0, 1.0))\r
+    _test_generator(N, vonmisesvariate, (0.0, 1.0))\r
+    _test_generator(N, gammavariate, (0.01, 1.0))\r
+    _test_generator(N, gammavariate, (0.1, 1.0))\r
+    _test_generator(N, gammavariate, (0.1, 2.0))\r
+    _test_generator(N, gammavariate, (0.5, 1.0))\r
+    _test_generator(N, gammavariate, (0.9, 1.0))\r
+    _test_generator(N, gammavariate, (1.0, 1.0))\r
+    _test_generator(N, gammavariate, (2.0, 1.0))\r
+    _test_generator(N, gammavariate, (20.0, 1.0))\r
+    _test_generator(N, gammavariate, (200.0, 1.0))\r
+    _test_generator(N, gauss, (0.0, 1.0))\r
+    _test_generator(N, betavariate, (3.0, 3.0))\r
+    _test_generator(N, triangular, (0.0, 1.0, 1.0/3.0))\r
+\r
+# Create one instance, seeded from current time, and export its methods\r
+# as module-level functions.  The functions share state across all uses\r
+#(both in the user's code and in the Python libraries), but that's fine\r
+# for most programs and is easier for the casual user than making them\r
+# instantiate their own Random() instance.\r
+\r
+_inst = Random()\r
+seed = _inst.seed\r
+random = _inst.random\r
+uniform = _inst.uniform\r
+triangular = _inst.triangular\r
+randint = _inst.randint\r
+choice = _inst.choice\r
+randrange = _inst.randrange\r
+sample = _inst.sample\r
+shuffle = _inst.shuffle\r
+normalvariate = _inst.normalvariate\r
+lognormvariate = _inst.lognormvariate\r
+expovariate = _inst.expovariate\r
+vonmisesvariate = _inst.vonmisesvariate\r
+gammavariate = _inst.gammavariate\r
+gauss = _inst.gauss\r
+betavariate = _inst.betavariate\r
+paretovariate = _inst.paretovariate\r
+weibullvariate = _inst.weibullvariate\r
+getstate = _inst.getstate\r
+setstate = _inst.setstate\r
+jumpahead = _inst.jumpahead\r
+getrandbits = _inst.getrandbits\r
+\r
+if __name__ == '__main__':\r
+    _test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/re.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/re.py
new file mode 100644 (file)
index 0000000..6620d33
--- /dev/null
@@ -0,0 +1,340 @@
+#\r
+# Secret Labs' Regular Expression Engine\r
+#\r
+# re-compatible interface for the sre matching engine\r
+#\r
+# Copyright (c) 1998-2001 by Secret Labs AB.  All rights reserved.\r
+#\r
+# This version of the SRE library can be redistributed under CNRI's\r
+# Python 1.6 license.  For any other use, please contact Secret Labs\r
+# AB (info@pythonware.com).\r
+#\r
+# Portions of this engine have been developed in cooperation with\r
+# CNRI.  Hewlett-Packard provided funding for 1.6 integration and\r
+# other compatibility work.\r
+#\r
+\r
+r"""Support for regular expressions (RE).\r
+\r
+This module provides regular expression matching operations similar to\r
+those found in Perl.  It supports both 8-bit and Unicode strings; both\r
+the pattern and the strings being processed can contain null bytes and\r
+characters outside the US ASCII range.\r
+\r
+Regular expressions can contain both special and ordinary characters.\r
+Most ordinary characters, like "A", "a", or "0", are the simplest\r
+regular expressions; they simply match themselves.  You can\r
+concatenate ordinary characters, so last matches the string 'last'.\r
+\r
+The special characters are:\r
+    "."      Matches any character except a newline.\r
+    "^"      Matches the start of the string.\r
+    "$"      Matches the end of the string or just before the newline at\r
+             the end of the string.\r
+    "*"      Matches 0 or more (greedy) repetitions of the preceding RE.\r
+             Greedy means that it will match as many repetitions as possible.\r
+    "+"      Matches 1 or more (greedy) repetitions of the preceding RE.\r
+    "?"      Matches 0 or 1 (greedy) of the preceding RE.\r
+    *?,+?,?? Non-greedy versions of the previous three special characters.\r
+    {m,n}    Matches from m to n repetitions of the preceding RE.\r
+    {m,n}?   Non-greedy version of the above.\r
+    "\\"     Either escapes special characters or signals a special sequence.\r
+    []       Indicates a set of characters.\r
+             A "^" as the first character indicates a complementing set.\r
+    "|"      A|B, creates an RE that will match either A or B.\r
+    (...)    Matches the RE inside the parentheses.\r
+             The contents can be retrieved or matched later in the string.\r
+    (?iLmsux) Set the I, L, M, S, U, or X flag for the RE (see below).\r
+    (?:...)  Non-grouping version of regular parentheses.\r
+    (?P<name>...) The substring matched by the group is accessible by name.\r
+    (?P=name)     Matches the text matched earlier by the group named name.\r
+    (?#...)  A comment; ignored.\r
+    (?=...)  Matches if ... matches next, but doesn't consume the string.\r
+    (?!...)  Matches if ... doesn't match next.\r
+    (?<=...) Matches if preceded by ... (must be fixed length).\r
+    (?<!...) Matches if not preceded by ... (must be fixed length).\r
+    (?(id/name)yes|no) Matches yes pattern if the group with id/name matched,\r
+                       the (optional) no pattern otherwise.\r
+\r
+The special sequences consist of "\\" and a character from the list\r
+below.  If the ordinary character is not on the list, then the\r
+resulting RE will match the second character.\r
+    \number  Matches the contents of the group of the same number.\r
+    \A       Matches only at the start of the string.\r
+    \Z       Matches only at the end of the string.\r
+    \b       Matches the empty string, but only at the start or end of a word.\r
+    \B       Matches the empty string, but not at the start or end of a word.\r
+    \d       Matches any decimal digit; equivalent to the set [0-9].\r
+    \D       Matches any non-digit character; equivalent to the set [^0-9].\r
+    \s       Matches any whitespace character; equivalent to [ \t\n\r\f\v].\r
+    \S       Matches any non-whitespace character; equiv. to [^ \t\n\r\f\v].\r
+    \w       Matches any alphanumeric character; equivalent to [a-zA-Z0-9_].\r
+             With LOCALE, it will match the set [0-9_] plus characters defined\r
+             as letters for the current locale.\r
+    \W       Matches the complement of \w.\r
+    \\       Matches a literal backslash.\r
+\r
+This module exports the following functions:\r
+    match    Match a regular expression pattern to the beginning of a string.\r
+    search   Search a string for the presence of a pattern.\r
+    sub      Substitute occurrences of a pattern found in a string.\r
+    subn     Same as sub, but also return the number of substitutions made.\r
+    split    Split a string by the occurrences of a pattern.\r
+    findall  Find all occurrences of a pattern in a string.\r
+    finditer Return an iterator yielding a match object for each match.\r
+    compile  Compile a pattern into a RegexObject.\r
+    purge    Clear the regular expression cache.\r
+    escape   Backslash all non-alphanumerics in a string.\r
+\r
+Some of the functions in this module takes flags as optional parameters:\r
+    I  IGNORECASE  Perform case-insensitive matching.\r
+    L  LOCALE      Make \w, \W, \b, \B, dependent on the current locale.\r
+    M  MULTILINE   "^" matches the beginning of lines (after a newline)\r
+                   as well as the string.\r
+                   "$" matches the end of lines (before a newline) as well\r
+                   as the end of the string.\r
+    S  DOTALL      "." matches any character at all, including the newline.\r
+    X  VERBOSE     Ignore whitespace and comments for nicer looking RE's.\r
+    U  UNICODE     Make \w, \W, \b, \B, dependent on the Unicode locale.\r
+\r
+This module also defines an exception 'error'.\r
+\r
+"""\r
+\r
+import sys\r
+import sre_compile\r
+import sre_parse\r
+try:\r
+    import _locale\r
+except ImportError:\r
+    _locale = None\r
+\r
+# public symbols\r
+__all__ = [ "match", "search", "sub", "subn", "split", "findall",\r
+    "compile", "purge", "template", "escape", "I", "L", "M", "S", "X",\r
+    "U", "IGNORECASE", "LOCALE", "MULTILINE", "DOTALL", "VERBOSE",\r
+    "UNICODE", "error" ]\r
+\r
+__version__ = "2.2.1"\r
+\r
+# flags\r
+I = IGNORECASE = sre_compile.SRE_FLAG_IGNORECASE # ignore case\r
+L = LOCALE = sre_compile.SRE_FLAG_LOCALE # assume current 8-bit locale\r
+U = UNICODE = sre_compile.SRE_FLAG_UNICODE # assume unicode locale\r
+M = MULTILINE = sre_compile.SRE_FLAG_MULTILINE # make anchors look for newline\r
+S = DOTALL = sre_compile.SRE_FLAG_DOTALL # make dot match newline\r
+X = VERBOSE = sre_compile.SRE_FLAG_VERBOSE # ignore whitespace and comments\r
+\r
+# sre extensions (experimental, don't rely on these)\r
+T = TEMPLATE = sre_compile.SRE_FLAG_TEMPLATE # disable backtracking\r
+DEBUG = sre_compile.SRE_FLAG_DEBUG # dump pattern after compilation\r
+\r
+# sre exception\r
+error = sre_compile.error\r
+\r
+# --------------------------------------------------------------------\r
+# public interface\r
+\r
+def match(pattern, string, flags=0):\r
+    """Try to apply the pattern at the start of the string, returning\r
+    a match object, or None if no match was found."""\r
+    return _compile(pattern, flags).match(string)\r
+\r
+def search(pattern, string, flags=0):\r
+    """Scan through string looking for a match to the pattern, returning\r
+    a match object, or None if no match was found."""\r
+    return _compile(pattern, flags).search(string)\r
+\r
+def sub(pattern, repl, string, count=0, flags=0):\r
+    """Return the string obtained by replacing the leftmost\r
+    non-overlapping occurrences of the pattern in string by the\r
+    replacement repl.  repl can be either a string or a callable;\r
+    if a string, backslash escapes in it are processed.  If it is\r
+    a callable, it's passed the match object and must return\r
+    a replacement string to be used."""\r
+    return _compile(pattern, flags).sub(repl, string, count)\r
+\r
+def subn(pattern, repl, string, count=0, flags=0):\r
+    """Return a 2-tuple containing (new_string, number).\r
+    new_string is the string obtained by replacing the leftmost\r
+    non-overlapping occurrences of the pattern in the source\r
+    string by the replacement repl.  number is the number of\r
+    substitutions that were made. repl can be either a string or a\r
+    callable; if a string, backslash escapes in it are processed.\r
+    If it is a callable, it's passed the match object and must\r
+    return a replacement string to be used."""\r
+    return _compile(pattern, flags).subn(repl, string, count)\r
+\r
+def split(pattern, string, maxsplit=0, flags=0):\r
+    """Split the source string by the occurrences of the pattern,\r
+    returning a list containing the resulting substrings."""\r
+    return _compile(pattern, flags).split(string, maxsplit)\r
+\r
+def findall(pattern, string, flags=0):\r
+    """Return a list of all non-overlapping matches in the string.\r
+\r
+    If one or more groups are present in the pattern, return a\r
+    list of groups; this will be a list of tuples if the pattern\r
+    has more than one group.\r
+\r
+    Empty matches are included in the result."""\r
+    return _compile(pattern, flags).findall(string)\r
+\r
+if sys.hexversion >= 0x02020000:\r
+    __all__.append("finditer")\r
+    def finditer(pattern, string, flags=0):\r
+        """Return an iterator over all non-overlapping matches in the\r
+        string.  For each match, the iterator returns a match object.\r
+\r
+        Empty matches are included in the result."""\r
+        return _compile(pattern, flags).finditer(string)\r
+\r
+def compile(pattern, flags=0):\r
+    "Compile a regular expression pattern, returning a pattern object."\r
+    return _compile(pattern, flags)\r
+\r
+def purge():\r
+    "Clear the regular expression cache"\r
+    _cache.clear()\r
+    _cache_repl.clear()\r
+\r
+def template(pattern, flags=0):\r
+    "Compile a template pattern, returning a pattern object"\r
+    return _compile(pattern, flags|T)\r
+\r
+_alphanum = frozenset(\r
+    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")\r
+\r
+def escape(pattern):\r
+    "Escape all non-alphanumeric characters in pattern."\r
+    s = list(pattern)\r
+    alphanum = _alphanum\r
+    for i, c in enumerate(pattern):\r
+        if c not in alphanum:\r
+            if c == "\000":\r
+                s[i] = "\\000"\r
+            else:\r
+                s[i] = "\\" + c\r
+    return pattern[:0].join(s)\r
+\r
+# --------------------------------------------------------------------\r
+# internals\r
+\r
+_cache = {}\r
+_cache_repl = {}\r
+\r
+_pattern_type = type(sre_compile.compile("", 0))\r
+\r
+_MAXCACHE = 100\r
+\r
+def _compile(*key):\r
+    # internal: compile pattern\r
+    pattern, flags = key\r
+    bypass_cache = flags & DEBUG\r
+    if not bypass_cache:\r
+        cachekey = (type(key[0]),) + key\r
+        try:\r
+            p, loc = _cache[cachekey]\r
+            if loc is None or loc == _locale.setlocale(_locale.LC_CTYPE):\r
+                return p\r
+        except KeyError:\r
+            pass\r
+    if isinstance(pattern, _pattern_type):\r
+        if flags:\r
+            raise ValueError('Cannot process flags argument with a compiled pattern')\r
+        return pattern\r
+    if not sre_compile.isstring(pattern):\r
+        raise TypeError, "first argument must be string or compiled pattern"\r
+    try:\r
+        p = sre_compile.compile(pattern, flags)\r
+    except error, v:\r
+        raise error, v # invalid expression\r
+    if not bypass_cache:\r
+        if len(_cache) >= _MAXCACHE:\r
+            _cache.clear()\r
+        if p.flags & LOCALE:\r
+            if not _locale:\r
+                return p\r
+            loc = _locale.setlocale(_locale.LC_CTYPE)\r
+        else:\r
+            loc = None\r
+        _cache[cachekey] = p, loc\r
+    return p\r
+\r
+def _compile_repl(*key):\r
+    # internal: compile replacement pattern\r
+    p = _cache_repl.get(key)\r
+    if p is not None:\r
+        return p\r
+    repl, pattern = key\r
+    try:\r
+        p = sre_parse.parse_template(repl, pattern)\r
+    except error, v:\r
+        raise error, v # invalid expression\r
+    if len(_cache_repl) >= _MAXCACHE:\r
+        _cache_repl.clear()\r
+    _cache_repl[key] = p\r
+    return p\r
+\r
+def _expand(pattern, match, template):\r
+    # internal: match.expand implementation hook\r
+    template = sre_parse.parse_template(template, pattern)\r
+    return sre_parse.expand_template(template, match)\r
+\r
+def _subx(pattern, template):\r
+    # internal: pattern.sub/subn implementation helper\r
+    template = _compile_repl(template, pattern)\r
+    if not template[0] and len(template[1]) == 1:\r
+        # literal replacement\r
+        return template[1][0]\r
+    def filter(match, template=template):\r
+        return sre_parse.expand_template(template, match)\r
+    return filter\r
+\r
+# register myself for pickling\r
+\r
+import copy_reg\r
+\r
+def _pickle(p):\r
+    return _compile, (p.pattern, p.flags)\r
+\r
+copy_reg.pickle(_pattern_type, _pickle, _compile)\r
+\r
+# --------------------------------------------------------------------\r
+# experimental stuff (see python-dev discussions for details)\r
+\r
+class Scanner:\r
+    def __init__(self, lexicon, flags=0):\r
+        from sre_constants import BRANCH, SUBPATTERN\r
+        self.lexicon = lexicon\r
+        # combine phrases into a compound pattern\r
+        p = []\r
+        s = sre_parse.Pattern()\r
+        s.flags = flags\r
+        for phrase, action in lexicon:\r
+            p.append(sre_parse.SubPattern(s, [\r
+                (SUBPATTERN, (len(p)+1, sre_parse.parse(phrase, flags))),\r
+                ]))\r
+        s.groups = len(p)+1\r
+        p = sre_parse.SubPattern(s, [(BRANCH, (None, p))])\r
+        self.scanner = sre_compile.compile(p)\r
+    def scan(self, string):\r
+        result = []\r
+        append = result.append\r
+        match = self.scanner.scanner(string).match\r
+        i = 0\r
+        while 1:\r
+            m = match()\r
+            if not m:\r
+                break\r
+            j = m.end()\r
+            if i == j:\r
+                break\r
+            action = self.lexicon[m.lastindex-1][1]\r
+            if hasattr(action, '__call__'):\r
+                self.match = m\r
+                action = action(self, m.group())\r
+            if action is not None:\r
+                append(action)\r
+            i = j\r
+        return result, string[i:]\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/repr.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/repr.py
new file mode 100644 (file)
index 0000000..71a3a15
--- /dev/null
@@ -0,0 +1,132 @@
+"""Redo the builtin repr() (representation) but with limits on most sizes."""\r
+\r
+__all__ = ["Repr","repr"]\r
+\r
+import __builtin__\r
+from itertools import islice\r
+\r
+class Repr:\r
+\r
+    def __init__(self):\r
+        self.maxlevel = 6\r
+        self.maxtuple = 6\r
+        self.maxlist = 6\r
+        self.maxarray = 5\r
+        self.maxdict = 4\r
+        self.maxset = 6\r
+        self.maxfrozenset = 6\r
+        self.maxdeque = 6\r
+        self.maxstring = 30\r
+        self.maxlong = 40\r
+        self.maxother = 20\r
+\r
+    def repr(self, x):\r
+        return self.repr1(x, self.maxlevel)\r
+\r
+    def repr1(self, x, level):\r
+        typename = type(x).__name__\r
+        if ' ' in typename:\r
+            parts = typename.split()\r
+            typename = '_'.join(parts)\r
+        if hasattr(self, 'repr_' + typename):\r
+            return getattr(self, 'repr_' + typename)(x, level)\r
+        else:\r
+            s = __builtin__.repr(x)\r
+            if len(s) > self.maxother:\r
+                i = max(0, (self.maxother-3)//2)\r
+                j = max(0, self.maxother-3-i)\r
+                s = s[:i] + '...' + s[len(s)-j:]\r
+            return s\r
+\r
+    def _repr_iterable(self, x, level, left, right, maxiter, trail=''):\r
+        n = len(x)\r
+        if level <= 0 and n:\r
+            s = '...'\r
+        else:\r
+            newlevel = level - 1\r
+            repr1 = self.repr1\r
+            pieces = [repr1(elem, newlevel) for elem in islice(x, maxiter)]\r
+            if n > maxiter:  pieces.append('...')\r
+            s = ', '.join(pieces)\r
+            if n == 1 and trail:  right = trail + right\r
+        return '%s%s%s' % (left, s, right)\r
+\r
+    def repr_tuple(self, x, level):\r
+        return self._repr_iterable(x, level, '(', ')', self.maxtuple, ',')\r
+\r
+    def repr_list(self, x, level):\r
+        return self._repr_iterable(x, level, '[', ']', self.maxlist)\r
+\r
+    def repr_array(self, x, level):\r
+        header = "array('%s', [" % x.typecode\r
+        return self._repr_iterable(x, level, header, '])', self.maxarray)\r
+\r
+    def repr_set(self, x, level):\r
+        x = _possibly_sorted(x)\r
+        return self._repr_iterable(x, level, 'set([', '])', self.maxset)\r
+\r
+    def repr_frozenset(self, x, level):\r
+        x = _possibly_sorted(x)\r
+        return self._repr_iterable(x, level, 'frozenset([', '])',\r
+                                   self.maxfrozenset)\r
+\r
+    def repr_deque(self, x, level):\r
+        return self._repr_iterable(x, level, 'deque([', '])', self.maxdeque)\r
+\r
+    def repr_dict(self, x, level):\r
+        n = len(x)\r
+        if n == 0: return '{}'\r
+        if level <= 0: return '{...}'\r
+        newlevel = level - 1\r
+        repr1 = self.repr1\r
+        pieces = []\r
+        for key in islice(_possibly_sorted(x), self.maxdict):\r
+            keyrepr = repr1(key, newlevel)\r
+            valrepr = repr1(x[key], newlevel)\r
+            pieces.append('%s: %s' % (keyrepr, valrepr))\r
+        if n > self.maxdict: pieces.append('...')\r
+        s = ', '.join(pieces)\r
+        return '{%s}' % (s,)\r
+\r
+    def repr_str(self, x, level):\r
+        s = __builtin__.repr(x[:self.maxstring])\r
+        if len(s) > self.maxstring:\r
+            i = max(0, (self.maxstring-3)//2)\r
+            j = max(0, self.maxstring-3-i)\r
+            s = __builtin__.repr(x[:i] + x[len(x)-j:])\r
+            s = s[:i] + '...' + s[len(s)-j:]\r
+        return s\r
+\r
+    def repr_long(self, x, level):\r
+        s = __builtin__.repr(x) # XXX Hope this isn't too slow...\r
+        if len(s) > self.maxlong:\r
+            i = max(0, (self.maxlong-3)//2)\r
+            j = max(0, self.maxlong-3-i)\r
+            s = s[:i] + '...' + s[len(s)-j:]\r
+        return s\r
+\r
+    def repr_instance(self, x, level):\r
+        try:\r
+            s = __builtin__.repr(x)\r
+            # Bugs in x.__repr__() can cause arbitrary\r
+            # exceptions -- then make up something\r
+        except Exception:\r
+            return '<%s instance at %x>' % (x.__class__.__name__, id(x))\r
+        if len(s) > self.maxstring:\r
+            i = max(0, (self.maxstring-3)//2)\r
+            j = max(0, self.maxstring-3-i)\r
+            s = s[:i] + '...' + s[len(s)-j:]\r
+        return s\r
+\r
+\r
+def _possibly_sorted(x):\r
+    # Since not all sequences of items can be sorted and comparison\r
+    # functions may raise arbitrary exceptions, return an unsorted\r
+    # sequence in that case.\r
+    try:\r
+        return sorted(x)\r
+    except Exception:\r
+        return list(x)\r
+\r
+aRepr = Repr()\r
+repr = aRepr.repr\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/runpy.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/runpy.py
new file mode 100644 (file)
index 0000000..abbd1db
--- /dev/null
@@ -0,0 +1,278 @@
+"""runpy.py - locating and running Python code using the module namespace\r
+\r
+Provides support for locating and running Python scripts using the Python\r
+module namespace instead of the native filesystem.\r
+\r
+This allows Python code to play nicely with non-filesystem based PEP 302\r
+importers when locating support scripts as well as when importing modules.\r
+"""\r
+# Written by Nick Coghlan <ncoghlan at gmail.com>\r
+#    to implement PEP 338 (Executing Modules as Scripts)\r
+\r
+import sys\r
+import imp\r
+from pkgutil import read_code\r
+try:\r
+    from imp import get_loader\r
+except ImportError:\r
+    from pkgutil import get_loader\r
+\r
+__all__ = [\r
+    "run_module", "run_path",\r
+]\r
+\r
+class _TempModule(object):\r
+    """Temporarily replace a module in sys.modules with an empty namespace"""\r
+    def __init__(self, mod_name):\r
+        self.mod_name = mod_name\r
+        self.module = imp.new_module(mod_name)\r
+        self._saved_module = []\r
+\r
+    def __enter__(self):\r
+        mod_name = self.mod_name\r
+        try:\r
+            self._saved_module.append(sys.modules[mod_name])\r
+        except KeyError:\r
+            pass\r
+        sys.modules[mod_name] = self.module\r
+        return self\r
+\r
+    def __exit__(self, *args):\r
+        if self._saved_module:\r
+            sys.modules[self.mod_name] = self._saved_module[0]\r
+        else:\r
+            del sys.modules[self.mod_name]\r
+        self._saved_module = []\r
+\r
+class _ModifiedArgv0(object):\r
+    def __init__(self, value):\r
+        self.value = value\r
+        self._saved_value = self._sentinel = object()\r
+\r
+    def __enter__(self):\r
+        if self._saved_value is not self._sentinel:\r
+            raise RuntimeError("Already preserving saved value")\r
+        self._saved_value = sys.argv[0]\r
+        sys.argv[0] = self.value\r
+\r
+    def __exit__(self, *args):\r
+        self.value = self._sentinel\r
+        sys.argv[0] = self._saved_value\r
+\r
+def _run_code(code, run_globals, init_globals=None,\r
+              mod_name=None, mod_fname=None,\r
+              mod_loader=None, pkg_name=None):\r
+    """Helper to run code in nominated namespace"""\r
+    if init_globals is not None:\r
+        run_globals.update(init_globals)\r
+    run_globals.update(__name__ = mod_name,\r
+                       __file__ = mod_fname,\r
+                       __loader__ = mod_loader,\r
+                       __package__ = pkg_name)\r
+    exec code in run_globals\r
+    return run_globals\r
+\r
+def _run_module_code(code, init_globals=None,\r
+                    mod_name=None, mod_fname=None,\r
+                    mod_loader=None, pkg_name=None):\r
+    """Helper to run code in new namespace with sys modified"""\r
+    with _TempModule(mod_name) as temp_module, _ModifiedArgv0(mod_fname):\r
+        mod_globals = temp_module.module.__dict__\r
+        _run_code(code, mod_globals, init_globals,\r
+                  mod_name, mod_fname, mod_loader, pkg_name)\r
+    # Copy the globals of the temporary module, as they\r
+    # may be cleared when the temporary module goes away\r
+    return mod_globals.copy()\r
+\r
+\r
+# This helper is needed due to a missing component in the PEP 302\r
+# loader protocol (specifically, "get_filename" is non-standard)\r
+# Since we can't introduce new features in maintenance releases,\r
+# support was added to zipimporter under the name '_get_filename'\r
+def _get_filename(loader, mod_name):\r
+    for attr in ("get_filename", "_get_filename"):\r
+        meth = getattr(loader, attr, None)\r
+        if meth is not None:\r
+            return meth(mod_name)\r
+    return None\r
+\r
+# Helper to get the loader, code and filename for a module\r
+def _get_module_details(mod_name):\r
+    loader = get_loader(mod_name)\r
+    if loader is None:\r
+        raise ImportError("No module named %s" % mod_name)\r
+    if loader.is_package(mod_name):\r
+        if mod_name == "__main__" or mod_name.endswith(".__main__"):\r
+            raise ImportError("Cannot use package as __main__ module")\r
+        try:\r
+            pkg_main_name = mod_name + ".__main__"\r
+            return _get_module_details(pkg_main_name)\r
+        except ImportError, e:\r
+            raise ImportError(("%s; %r is a package and cannot " +\r
+                               "be directly executed") %(e, mod_name))\r
+    code = loader.get_code(mod_name)\r
+    if code is None:\r
+        raise ImportError("No code object available for %s" % mod_name)\r
+    filename = _get_filename(loader, mod_name)\r
+    return mod_name, loader, code, filename\r
+\r
+\r
+def _get_main_module_details():\r
+    # Helper that gives a nicer error message when attempting to\r
+    # execute a zipfile or directory by invoking __main__.py\r
+    main_name = "__main__"\r
+    try:\r
+        return _get_module_details(main_name)\r
+    except ImportError as exc:\r
+        if main_name in str(exc):\r
+            raise ImportError("can't find %r module in %r" %\r
+                              (main_name, sys.path[0]))\r
+        raise\r
+\r
+# This function is the actual implementation of the -m switch and direct\r
+# execution of zipfiles and directories and is deliberately kept private.\r
+# This avoids a repeat of the situation where run_module() no longer met the\r
+# needs of mainmodule.c, but couldn't be changed because it was public\r
+def _run_module_as_main(mod_name, alter_argv=True):\r
+    """Runs the designated module in the __main__ namespace\r
+\r
+       Note that the executed module will have full access to the\r
+       __main__ namespace. If this is not desirable, the run_module()\r
+       function should be used to run the module code in a fresh namespace.\r
+\r
+       At the very least, these variables in __main__ will be overwritten:\r
+           __name__\r
+           __file__\r
+           __loader__\r
+           __package__\r
+    """\r
+    try:\r
+        if alter_argv or mod_name != "__main__": # i.e. -m switch\r
+            mod_name, loader, code, fname = _get_module_details(mod_name)\r
+        else:          # i.e. directory or zipfile execution\r
+            mod_name, loader, code, fname = _get_main_module_details()\r
+    except ImportError as exc:\r
+        msg = "%s: %s" % (sys.executable, str(exc))\r
+        sys.exit(msg)\r
+    pkg_name = mod_name.rpartition('.')[0]\r
+    main_globals = sys.modules["__main__"].__dict__\r
+    if alter_argv:\r
+        sys.argv[0] = fname\r
+    return _run_code(code, main_globals, None,\r
+                     "__main__", fname, loader, pkg_name)\r
+\r
+def run_module(mod_name, init_globals=None,\r
+               run_name=None, alter_sys=False):\r
+    """Execute a module's code without importing it\r
+\r
+       Returns the resulting top level namespace dictionary\r
+    """\r
+    mod_name, loader, code, fname = _get_module_details(mod_name)\r
+    if run_name is None:\r
+        run_name = mod_name\r
+    pkg_name = mod_name.rpartition('.')[0]\r
+    if alter_sys:\r
+        return _run_module_code(code, init_globals, run_name,\r
+                                fname, loader, pkg_name)\r
+    else:\r
+        # Leave the sys module alone\r
+        return _run_code(code, {}, init_globals, run_name,\r
+                         fname, loader, pkg_name)\r
+\r
+\r
+# XXX (ncoghlan): Perhaps expose the C API function\r
+# as imp.get_importer instead of reimplementing it in Python?\r
+def _get_importer(path_name):\r
+    """Python version of PyImport_GetImporter C API function"""\r
+    cache = sys.path_importer_cache\r
+    try:\r
+        importer = cache[path_name]\r
+    except KeyError:\r
+        # Not yet cached. Flag as using the\r
+        # standard machinery until we finish\r
+        # checking the hooks\r
+        cache[path_name] = None\r
+        for hook in sys.path_hooks:\r
+            try:\r
+                importer = hook(path_name)\r
+                break\r
+            except ImportError:\r
+                pass\r
+        else:\r
+            # The following check looks a bit odd. The trick is that\r
+            # NullImporter raises ImportError if the supplied path is a\r
+            # *valid* directory entry (and hence able to be handled\r
+            # by the standard import machinery)\r
+            try:\r
+                importer = imp.NullImporter(path_name)\r
+            except ImportError:\r
+                return None\r
+        cache[path_name] = importer\r
+    return importer\r
+\r
+def _get_code_from_file(fname):\r
+    # Check for a compiled file first\r
+    with open(fname, "rb") as f:\r
+        code = read_code(f)\r
+    if code is None:\r
+        # That didn't work, so try it as normal source code\r
+        with open(fname, "rU") as f:\r
+            code = compile(f.read(), fname, 'exec')\r
+    return code\r
+\r
+def run_path(path_name, init_globals=None, run_name=None):\r
+    """Execute code located at the specified filesystem location\r
+\r
+       Returns the resulting top level namespace dictionary\r
+\r
+       The file path may refer directly to a Python script (i.e.\r
+       one that could be directly executed with execfile) or else\r
+       it may refer to a zipfile or directory containing a top\r
+       level __main__.py script.\r
+    """\r
+    if run_name is None:\r
+        run_name = "<run_path>"\r
+    importer = _get_importer(path_name)\r
+    if isinstance(importer, imp.NullImporter):\r
+        # Not a valid sys.path entry, so run the code directly\r
+        # execfile() doesn't help as we want to allow compiled files\r
+        code = _get_code_from_file(path_name)\r
+        return _run_module_code(code, init_globals, run_name, path_name)\r
+    else:\r
+        # Importer is defined for path, so add it to\r
+        # the start of sys.path\r
+        sys.path.insert(0, path_name)\r
+        try:\r
+            # Here's where things are a little different from the run_module\r
+            # case. There, we only had to replace the module in sys while the\r
+            # code was running and doing so was somewhat optional. Here, we\r
+            # have no choice and we have to remove it even while we read the\r
+            # code. If we don't do this, a __loader__ attribute in the\r
+            # existing __main__ module may prevent location of the new module.\r
+            main_name = "__main__"\r
+            saved_main = sys.modules[main_name]\r
+            del sys.modules[main_name]\r
+            try:\r
+                mod_name, loader, code, fname = _get_main_module_details()\r
+            finally:\r
+                sys.modules[main_name] = saved_main\r
+            pkg_name = ""\r
+            with _TempModule(run_name) as temp_module, \\r
+                 _ModifiedArgv0(path_name):\r
+                mod_globals = temp_module.module.__dict__\r
+                return _run_code(code, mod_globals, init_globals,\r
+                                    run_name, fname, loader, pkg_name).copy()\r
+        finally:\r
+            try:\r
+                sys.path.remove(path_name)\r
+            except ValueError:\r
+                pass\r
+\r
+\r
+if __name__ == "__main__":\r
+    # Run the module specified as the next command line argument\r
+    if len(sys.argv) < 2:\r
+        print >> sys.stderr, "No module specified for execution"\r
+    else:\r
+        del sys.argv[0] # Make the requested module sys.argv[0]\r
+        _run_module_as_main(sys.argv[0])\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sha.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sha.py
new file mode 100644 (file)
index 0000000..93a17bc
--- /dev/null
@@ -0,0 +1,15 @@
+# $Id$\r
+#\r
+#  Copyright (C) 2005   Gregory P. Smith (greg@krypto.org)\r
+#  Licensed to PSF under a Contributor Agreement.\r
+\r
+import warnings\r
+warnings.warn("the sha module is deprecated; use the hashlib module instead",\r
+                DeprecationWarning, 2)\r
+\r
+from hashlib import sha1 as sha\r
+new = sha\r
+\r
+blocksize = 1        # legacy value (wrong in any useful sense)\r
+digest_size = 20\r
+digestsize = 20\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/shutil.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/shutil.py
new file mode 100644 (file)
index 0000000..539c5b9
--- /dev/null
@@ -0,0 +1,555 @@
+"""Utility functions for copying and archiving files and directory trees.\r
+\r
+XXX The functions here don't copy the resource fork or other metadata on Mac.\r
+\r
+"""\r
+\r
+import os\r
+import sys\r
+import stat\r
+from os.path import abspath\r
+import fnmatch\r
+import collections\r
+import errno\r
+\r
+try:\r
+    from pwd import getpwnam\r
+except ImportError:\r
+    getpwnam = None\r
+\r
+try:\r
+    from grp import getgrnam\r
+except ImportError:\r
+    getgrnam = None\r
+\r
+__all__ = ["copyfileobj", "copyfile", "copymode", "copystat", "copy", "copy2",\r
+           "copytree", "move", "rmtree", "Error", "SpecialFileError",\r
+           "ExecError", "make_archive", "get_archive_formats",\r
+           "register_archive_format", "unregister_archive_format",\r
+           "ignore_patterns"]\r
+\r
+class Error(EnvironmentError):\r
+    pass\r
+\r
+class SpecialFileError(EnvironmentError):\r
+    """Raised when trying to do a kind of operation (e.g. copying) which is\r
+    not supported on a special file (e.g. a named pipe)"""\r
+\r
+class ExecError(EnvironmentError):\r
+    """Raised when a command could not be executed"""\r
+\r
+try:\r
+    WindowsError\r
+except NameError:\r
+    WindowsError = None\r
+\r
+def copyfileobj(fsrc, fdst, length=16*1024):\r
+    """copy data from file-like object fsrc to file-like object fdst"""\r
+    while 1:\r
+        buf = fsrc.read(length)\r
+        if not buf:\r
+            break\r
+        fdst.write(buf)\r
+\r
+def _samefile(src, dst):\r
+    # Macintosh, Unix.\r
+    if hasattr(os.path, 'samefile'):\r
+        try:\r
+            return os.path.samefile(src, dst)\r
+        except OSError:\r
+            return False\r
+\r
+    # All other platforms: check for same pathname.\r
+    return (os.path.normcase(os.path.abspath(src)) ==\r
+            os.path.normcase(os.path.abspath(dst)))\r
+\r
+def copyfile(src, dst):\r
+    """Copy data from src to dst"""\r
+    if _samefile(src, dst):\r
+        raise Error("`%s` and `%s` are the same file" % (src, dst))\r
+\r
+    for fn in [src, dst]:\r
+        try:\r
+            st = os.stat(fn)\r
+        except OSError:\r
+            # File most likely does not exist\r
+            pass\r
+        else:\r
+            # XXX What about other special files? (sockets, devices...)\r
+            if stat.S_ISFIFO(st.st_mode):\r
+                raise SpecialFileError("`%s` is a named pipe" % fn)\r
+\r
+    with open(src, 'rb') as fsrc:\r
+        with open(dst, 'wb') as fdst:\r
+            copyfileobj(fsrc, fdst)\r
+\r
+def copymode(src, dst):\r
+    """Copy mode bits from src to dst"""\r
+    if hasattr(os, 'chmod'):\r
+        st = os.stat(src)\r
+        mode = stat.S_IMODE(st.st_mode)\r
+        os.chmod(dst, mode)\r
+\r
+def copystat(src, dst):\r
+    """Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""\r
+    st = os.stat(src)\r
+    mode = stat.S_IMODE(st.st_mode)\r
+    if hasattr(os, 'utime'):\r
+        os.utime(dst, (st.st_atime, st.st_mtime))\r
+    if hasattr(os, 'chmod'):\r
+        os.chmod(dst, mode)\r
+    if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):\r
+        try:\r
+            os.chflags(dst, st.st_flags)\r
+        except OSError, why:\r
+            for err in 'EOPNOTSUPP', 'ENOTSUP':\r
+                if hasattr(errno, err) and why.errno == getattr(errno, err):\r
+                    break\r
+            else:\r
+                raise\r
+\r
+def copy(src, dst):\r
+    """Copy data and mode bits ("cp src dst").\r
+\r
+    The destination may be a directory.\r
+\r
+    """\r
+    if os.path.isdir(dst):\r
+        dst = os.path.join(dst, os.path.basename(src))\r
+    copyfile(src, dst)\r
+    copymode(src, dst)\r
+\r
+def copy2(src, dst):\r
+    """Copy data and all stat info ("cp -p src dst").\r
+\r
+    The destination may be a directory.\r
+\r
+    """\r
+    if os.path.isdir(dst):\r
+        dst = os.path.join(dst, os.path.basename(src))\r
+    copyfile(src, dst)\r
+    copystat(src, dst)\r
+\r
+def ignore_patterns(*patterns):\r
+    """Function that can be used as copytree() ignore parameter.\r
+\r
+    Patterns is a sequence of glob-style patterns\r
+    that are used to exclude files"""\r
+    def _ignore_patterns(path, names):\r
+        ignored_names = []\r
+        for pattern in patterns:\r
+            ignored_names.extend(fnmatch.filter(names, pattern))\r
+        return set(ignored_names)\r
+    return _ignore_patterns\r
+\r
+def copytree(src, dst, symlinks=False, ignore=None):\r
+    """Recursively copy a directory tree using copy2().\r
+\r
+    The destination directory must not already exist.\r
+    If exception(s) occur, an Error is raised with a list of reasons.\r
+\r
+    If the optional symlinks flag is true, symbolic links in the\r
+    source tree result in symbolic links in the destination tree; if\r
+    it is false, the contents of the files pointed to by symbolic\r
+    links are copied.\r
+\r
+    The optional ignore argument is a callable. If given, it\r
+    is called with the `src` parameter, which is the directory\r
+    being visited by copytree(), and `names` which is the list of\r
+    `src` contents, as returned by os.listdir():\r
+\r
+        callable(src, names) -> ignored_names\r
+\r
+    Since copytree() is called recursively, the callable will be\r
+    called once for each directory that is copied. It returns a\r
+    list of names relative to the `src` directory that should\r
+    not be copied.\r
+\r
+    XXX Consider this example code rather than the ultimate tool.\r
+\r
+    """\r
+    names = os.listdir(src)\r
+    if ignore is not None:\r
+        ignored_names = ignore(src, names)\r
+    else:\r
+        ignored_names = set()\r
+\r
+    os.makedirs(dst)\r
+    errors = []\r
+    for name in names:\r
+        if name in ignored_names:\r
+            continue\r
+        srcname = os.path.join(src, name)\r
+        dstname = os.path.join(dst, name)\r
+        try:\r
+            if symlinks and os.path.islink(srcname):\r
+                linkto = os.readlink(srcname)\r
+                os.symlink(linkto, dstname)\r
+            elif os.path.isdir(srcname):\r
+                copytree(srcname, dstname, symlinks, ignore)\r
+            else:\r
+                # Will raise a SpecialFileError for unsupported file types\r
+                copy2(srcname, dstname)\r
+        # catch the Error from the recursive copytree so that we can\r
+        # continue with other files\r
+        except Error, err:\r
+            errors.extend(err.args[0])\r
+        except EnvironmentError, why:\r
+            errors.append((srcname, dstname, str(why)))\r
+    try:\r
+        copystat(src, dst)\r
+    except OSError, why:\r
+        if WindowsError is not None and isinstance(why, WindowsError):\r
+            # Copying file access times may fail on Windows\r
+            pass\r
+        else:\r
+            errors.append((src, dst, str(why)))\r
+    if errors:\r
+        raise Error, errors\r
+\r
+def rmtree(path, ignore_errors=False, onerror=None):\r
+    """Recursively delete a directory tree.\r
+\r
+    If ignore_errors is set, errors are ignored; otherwise, if onerror\r
+    is set, it is called to handle the error with arguments (func,\r
+    path, exc_info) where func is os.listdir, os.remove, or os.rmdir;\r
+    path is the argument to that function that caused it to fail; and\r
+    exc_info is a tuple returned by sys.exc_info().  If ignore_errors\r
+    is false and onerror is None, an exception is raised.\r
+\r
+    """\r
+    if ignore_errors:\r
+        def onerror(*args):\r
+            pass\r
+    elif onerror is None:\r
+        def onerror(*args):\r
+            raise\r
+    try:\r
+        if os.path.islink(path):\r
+            # symlinks to directories are forbidden, see bug #1669\r
+            raise OSError("Cannot call rmtree on a symbolic link")\r
+    except OSError:\r
+        onerror(os.path.islink, path, sys.exc_info())\r
+        # can't continue even if onerror hook returns\r
+        return\r
+    names = []\r
+    try:\r
+        names = os.listdir(path)\r
+    except os.error, err:\r
+        onerror(os.listdir, path, sys.exc_info())\r
+    for name in names:\r
+        fullname = os.path.join(path, name)\r
+        try:\r
+            mode = os.lstat(fullname).st_mode\r
+        except os.error:\r
+            mode = 0\r
+        if stat.S_ISDIR(mode):\r
+            rmtree(fullname, ignore_errors, onerror)\r
+        else:\r
+            try:\r
+                os.remove(fullname)\r
+            except os.error, err:\r
+                onerror(os.remove, fullname, sys.exc_info())\r
+    try:\r
+        os.rmdir(path)\r
+    except os.error:\r
+        onerror(os.rmdir, path, sys.exc_info())\r
+\r
+\r
+def _basename(path):\r
+    # A basename() variant which first strips the trailing slash, if present.\r
+    # Thus we always get the last component of the path, even for directories.\r
+    sep = os.path.sep + (os.path.altsep or '')\r
+    return os.path.basename(path.rstrip(sep))\r
+\r
+def move(src, dst):\r
+    """Recursively move a file or directory to another location. This is\r
+    similar to the Unix "mv" command.\r
+\r
+    If the destination is a directory or a symlink to a directory, the source\r
+    is moved inside the directory. The destination path must not already\r
+    exist.\r
+\r
+    If the destination already exists but is not a directory, it may be\r
+    overwritten depending on os.rename() semantics.\r
+\r
+    If the destination is on our current filesystem, then rename() is used.\r
+    Otherwise, src is copied to the destination and then removed.\r
+    A lot more could be done here...  A look at a mv.c shows a lot of\r
+    the issues this implementation glosses over.\r
+\r
+    """\r
+    real_dst = dst\r
+    if os.path.isdir(dst):\r
+        if _samefile(src, dst):\r
+            # We might be on a case insensitive filesystem,\r
+            # perform the rename anyway.\r
+            os.rename(src, dst)\r
+            return\r
+\r
+        real_dst = os.path.join(dst, _basename(src))\r
+        if os.path.exists(real_dst):\r
+            raise Error, "Destination path '%s' already exists" % real_dst\r
+    try:\r
+        os.rename(src, real_dst)\r
+    except OSError:\r
+        if os.path.isdir(src):\r
+            if _destinsrc(src, dst):\r
+                raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst)\r
+            copytree(src, real_dst, symlinks=True)\r
+            rmtree(src)\r
+        else:\r
+            copy2(src, real_dst)\r
+            os.unlink(src)\r
+\r
+def _destinsrc(src, dst):\r
+    src = abspath(src)\r
+    dst = abspath(dst)\r
+    if not src.endswith(os.path.sep):\r
+        src += os.path.sep\r
+    if not dst.endswith(os.path.sep):\r
+        dst += os.path.sep\r
+    return dst.startswith(src)\r
+\r
+def _get_gid(name):\r
+    """Returns a gid, given a group name."""\r
+    if getgrnam is None or name is None:\r
+        return None\r
+    try:\r
+        result = getgrnam(name)\r
+    except KeyError:\r
+        result = None\r
+    if result is not None:\r
+        return result[2]\r
+    return None\r
+\r
+def _get_uid(name):\r
+    """Returns an uid, given a user name."""\r
+    if getpwnam is None or name is None:\r
+        return None\r
+    try:\r
+        result = getpwnam(name)\r
+    except KeyError:\r
+        result = None\r
+    if result is not None:\r
+        return result[2]\r
+    return None\r
+\r
+def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,\r
+                  owner=None, group=None, logger=None):\r
+    """Create a (possibly compressed) tar file from all the files under\r
+    'base_dir'.\r
+\r
+    'compress' must be "gzip" (the default), "bzip2", or None.\r
+\r
+    'owner' and 'group' can be used to define an owner and a group for the\r
+    archive that is being built. If not provided, the current owner and group\r
+    will be used.\r
+\r
+    The output tar file will be named 'base_name' +  ".tar", possibly plus\r
+    the appropriate compression extension (".gz", or ".bz2").\r
+\r
+    Returns the output filename.\r
+    """\r
+    tar_compression = {'gzip': 'gz', 'bzip2': 'bz2', None: ''}\r
+    compress_ext = {'gzip': '.gz', 'bzip2': '.bz2'}\r
+\r
+    # flags for compression program, each element of list will be an argument\r
+    if compress is not None and compress not in compress_ext.keys():\r
+        raise ValueError, \\r
+              ("bad value for 'compress': must be None, 'gzip' or 'bzip2'")\r
+\r
+    archive_name = base_name + '.tar' + compress_ext.get(compress, '')\r
+    archive_dir = os.path.dirname(archive_name)\r
+\r
+    if archive_dir and not os.path.exists(archive_dir):\r
+        if logger is not None:\r
+            logger.info("creating %s", archive_dir)\r
+        if not dry_run:\r
+            os.makedirs(archive_dir)\r
+\r
+\r
+    # creating the tarball\r
+    import tarfile  # late import so Python build itself doesn't break\r
+\r
+    if logger is not None:\r
+        logger.info('Creating tar archive')\r
+\r
+    uid = _get_uid(owner)\r
+    gid = _get_gid(group)\r
+\r
+    def _set_uid_gid(tarinfo):\r
+        if gid is not None:\r
+            tarinfo.gid = gid\r
+            tarinfo.gname = group\r
+        if uid is not None:\r
+            tarinfo.uid = uid\r
+            tarinfo.uname = owner\r
+        return tarinfo\r
+\r
+    if not dry_run:\r
+        tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress])\r
+        try:\r
+            tar.add(base_dir, filter=_set_uid_gid)\r
+        finally:\r
+            tar.close()\r
+\r
+    return archive_name\r
+\r
+def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):\r
+    # XXX see if we want to keep an external call here\r
+    if verbose:\r
+        zipoptions = "-r"\r
+    else:\r
+        zipoptions = "-rq"\r
+    from distutils.errors import DistutilsExecError\r
+    from distutils.spawn import spawn\r
+    try:\r
+        spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run)\r
+    except DistutilsExecError:\r
+        # XXX really should distinguish between "couldn't find\r
+        # external 'zip' command" and "zip failed".\r
+        raise ExecError, \\r
+            ("unable to create zip file '%s': "\r
+            "could neither import the 'zipfile' module nor "\r
+            "find a standalone zip utility") % zip_filename\r
+\r
+def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None):\r
+    """Create a zip file from all the files under 'base_dir'.\r
+\r
+    The output zip file will be named 'base_name' + ".zip".  Uses either the\r
+    "zipfile" Python module (if available) or the InfoZIP "zip" utility\r
+    (if installed and found on the default search path).  If neither tool is\r
+    available, raises ExecError.  Returns the name of the output zip\r
+    file.\r
+    """\r
+    zip_filename = base_name + ".zip"\r
+    archive_dir = os.path.dirname(base_name)\r
+\r
+    if archive_dir and not os.path.exists(archive_dir):\r
+        if logger is not None:\r
+            logger.info("creating %s", archive_dir)\r
+        if not dry_run:\r
+            os.makedirs(archive_dir)\r
+\r
+    # If zipfile module is not available, try spawning an external 'zip'\r
+    # command.\r
+    try:\r
+        import zipfile\r
+    except ImportError:\r
+        zipfile = None\r
+\r
+    if zipfile is None:\r
+        _call_external_zip(base_dir, zip_filename, verbose, dry_run)\r
+    else:\r
+        if logger is not None:\r
+            logger.info("creating '%s' and adding '%s' to it",\r
+                        zip_filename, base_dir)\r
+\r
+        if not dry_run:\r
+            with zipfile.ZipFile(zip_filename, "w",\r
+                                 compression=zipfile.ZIP_DEFLATED) as zf:\r
+                for dirpath, dirnames, filenames in os.walk(base_dir):\r
+                    for name in filenames:\r
+                        path = os.path.normpath(os.path.join(dirpath, name))\r
+                        if os.path.isfile(path):\r
+                            zf.write(path, path)\r
+                            if logger is not None:\r
+                                logger.info("adding '%s'", path)\r
+\r
+    return zip_filename\r
+\r
+_ARCHIVE_FORMATS = {\r
+    'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"),\r
+    'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"),\r
+    'tar':   (_make_tarball, [('compress', None)], "uncompressed tar file"),\r
+    'zip':   (_make_zipfile, [],"ZIP file")\r
+    }\r
+\r
+def get_archive_formats():\r
+    """Returns a list of supported formats for archiving and unarchiving.\r
+\r
+    Each element of the returned sequence is a tuple (name, description)\r
+    """\r
+    formats = [(name, registry[2]) for name, registry in\r
+               _ARCHIVE_FORMATS.items()]\r
+    formats.sort()\r
+    return formats\r
+\r
+def register_archive_format(name, function, extra_args=None, description=''):\r
+    """Registers an archive format.\r
+\r
+    name is the name of the format. function is the callable that will be\r
+    used to create archives. If provided, extra_args is a sequence of\r
+    (name, value) tuples that will be passed as arguments to the callable.\r
+    description can be provided to describe the format, and will be returned\r
+    by the get_archive_formats() function.\r
+    """\r
+    if extra_args is None:\r
+        extra_args = []\r
+    if not isinstance(function, collections.Callable):\r
+        raise TypeError('The %s object is not callable' % function)\r
+    if not isinstance(extra_args, (tuple, list)):\r
+        raise TypeError('extra_args needs to be a sequence')\r
+    for element in extra_args:\r
+        if not isinstance(element, (tuple, list)) or len(element) !=2 :\r
+            raise TypeError('extra_args elements are : (arg_name, value)')\r
+\r
+    _ARCHIVE_FORMATS[name] = (function, extra_args, description)\r
+\r
+def unregister_archive_format(name):\r
+    del _ARCHIVE_FORMATS[name]\r
+\r
+def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0,\r
+                 dry_run=0, owner=None, group=None, logger=None):\r
+    """Create an archive file (eg. zip or tar).\r
+\r
+    'base_name' is the name of the file to create, minus any format-specific\r
+    extension; 'format' is the archive format: one of "zip", "tar", "bztar"\r
+    or "gztar".\r
+\r
+    'root_dir' is a directory that will be the root directory of the\r
+    archive; ie. we typically chdir into 'root_dir' before creating the\r
+    archive.  'base_dir' is the directory where we start archiving from;\r
+    ie. 'base_dir' will be the common prefix of all files and\r
+    directories in the archive.  'root_dir' and 'base_dir' both default\r
+    to the current directory.  Returns the name of the archive file.\r
+\r
+    'owner' and 'group' are used when creating a tar archive. By default,\r
+    uses the current owner and group.\r
+    """\r
+    save_cwd = os.getcwd()\r
+    if root_dir is not None:\r
+        if logger is not None:\r
+            logger.debug("changing into '%s'", root_dir)\r
+        base_name = os.path.abspath(base_name)\r
+        if not dry_run:\r
+            os.chdir(root_dir)\r
+\r
+    if base_dir is None:\r
+        base_dir = os.curdir\r
+\r
+    kwargs = {'dry_run': dry_run, 'logger': logger}\r
+\r
+    try:\r
+        format_info = _ARCHIVE_FORMATS[format]\r
+    except KeyError:\r
+        raise ValueError, "unknown archive format '%s'" % format\r
+\r
+    func = format_info[0]\r
+    for arg, val in format_info[1]:\r
+        kwargs[arg] = val\r
+\r
+    if format != 'zip':\r
+        kwargs['owner'] = owner\r
+        kwargs['group'] = group\r
+\r
+    try:\r
+        filename = func(base_name, base_dir, **kwargs)\r
+    finally:\r
+        if root_dir is not None:\r
+            if logger is not None:\r
+                logger.debug("changing back to '%s'", save_cwd)\r
+            os.chdir(save_cwd)\r
+\r
+    return filename\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/site-packages/README b/AppPkg/Applications/Python/Python-2.7.10/Lib/site-packages/README
new file mode 100644 (file)
index 0000000..74df190
--- /dev/null
@@ -0,0 +1,2 @@
+This directory exists so that 3rd party packages can be installed\r
+here.  Read the source for site.py for more details.\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/socket.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/socket.py
new file mode 100644 (file)
index 0000000..670bde1
--- /dev/null
@@ -0,0 +1,577 @@
+# Wrapper module for _socket, providing some additional facilities\r
+# implemented in Python.\r
+\r
+"""\\r
+This module provides socket operations and some related functions.\r
+On Unix, it supports IP (Internet Protocol) and Unix domain sockets.\r
+On other systems, it only supports IP. Functions specific for a\r
+socket are available as methods of the socket object.\r
+\r
+Functions:\r
+\r
+socket() -- create a new socket object\r
+socketpair() -- create a pair of new socket objects [*]\r
+fromfd() -- create a socket object from an open file descriptor [*]\r
+gethostname() -- return the current hostname\r
+gethostbyname() -- map a hostname to its IP number\r
+gethostbyaddr() -- map an IP number or hostname to DNS info\r
+getservbyname() -- map a service name and a protocol name to a port number\r
+getprotobyname() -- map a protocol name (e.g. 'tcp') to a number\r
+ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order\r
+htons(), htonl() -- convert 16, 32 bit int from host to network byte order\r
+inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format\r
+inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)\r
+ssl() -- secure socket layer support (only available if configured)\r
+socket.getdefaulttimeout() -- get the default timeout value\r
+socket.setdefaulttimeout() -- set the default timeout value\r
+create_connection() -- connects to an address, with an optional timeout and\r
+                       optional source address.\r
+\r
+ [*] not available on all platforms!\r
+\r
+Special objects:\r
+\r
+SocketType -- type object for socket objects\r
+error -- exception raised for I/O errors\r
+has_ipv6 -- boolean value indicating if IPv6 is supported\r
+\r
+Integer constants:\r
+\r
+AF_INET, AF_UNIX -- socket domains (first argument to socket() call)\r
+SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)\r
+\r
+Many other constants may be defined; these may be used in calls to\r
+the setsockopt() and getsockopt() methods.\r
+"""\r
+\r
+import _socket\r
+from _socket import *\r
+from functools import partial\r
+from types import MethodType\r
+\r
+try:\r
+    import _ssl\r
+except ImportError:\r
+    # no SSL support\r
+    pass\r
+else:\r
+    def ssl(sock, keyfile=None, certfile=None):\r
+        # we do an internal import here because the ssl\r
+        # module imports the socket module\r
+        import ssl as _realssl\r
+        warnings.warn("socket.ssl() is deprecated.  Use ssl.wrap_socket() instead.",\r
+                      DeprecationWarning, stacklevel=2)\r
+        return _realssl.sslwrap_simple(sock, keyfile, certfile)\r
+\r
+    # we need to import the same constants we used to...\r
+    from _ssl import SSLError as sslerror\r
+    from _ssl import \\r
+         RAND_add, \\r
+         RAND_status, \\r
+         SSL_ERROR_ZERO_RETURN, \\r
+         SSL_ERROR_WANT_READ, \\r
+         SSL_ERROR_WANT_WRITE, \\r
+         SSL_ERROR_WANT_X509_LOOKUP, \\r
+         SSL_ERROR_SYSCALL, \\r
+         SSL_ERROR_SSL, \\r
+         SSL_ERROR_WANT_CONNECT, \\r
+         SSL_ERROR_EOF, \\r
+         SSL_ERROR_INVALID_ERROR_CODE\r
+    try:\r
+        from _ssl import RAND_egd\r
+    except ImportError:\r
+        # LibreSSL does not provide RAND_egd\r
+        pass\r
+\r
+import os, sys, warnings\r
+\r
+try:\r
+    from cStringIO import StringIO\r
+except ImportError:\r
+    from StringIO import StringIO\r
+\r
+try:\r
+    import errno\r
+except ImportError:\r
+    errno = None\r
+EBADF = getattr(errno, 'EBADF', 9)\r
+EINTR = getattr(errno, 'EINTR', 4)\r
+\r
+__all__ = ["getfqdn", "create_connection"]\r
+__all__.extend(os._get_exports_list(_socket))\r
+\r
+\r
+_realsocket = socket\r
+\r
+# WSA error codes\r
+if sys.platform.lower().startswith("win"):\r
+    errorTab = {}\r
+    errorTab[10004] = "The operation was interrupted."\r
+    errorTab[10009] = "A bad file handle was passed."\r
+    errorTab[10013] = "Permission denied."\r
+    errorTab[10014] = "A fault occurred on the network??" # WSAEFAULT\r
+    errorTab[10022] = "An invalid operation was attempted."\r
+    errorTab[10035] = "The socket operation would block"\r
+    errorTab[10036] = "A blocking operation is already in progress."\r
+    errorTab[10048] = "The network address is in use."\r
+    errorTab[10054] = "The connection has been reset."\r
+    errorTab[10058] = "The network has been shut down."\r
+    errorTab[10060] = "The operation timed out."\r
+    errorTab[10061] = "Connection refused."\r
+    errorTab[10063] = "The name is too long."\r
+    errorTab[10064] = "The host is down."\r
+    errorTab[10065] = "The host is unreachable."\r
+    __all__.append("errorTab")\r
+\r
+\r
+\r
+def getfqdn(name=''):\r
+    """Get fully qualified domain name from name.\r
+\r
+    An empty argument is interpreted as meaning the local host.\r
+\r
+    First the hostname returned by gethostbyaddr() is checked, then\r
+    possibly existing aliases. In case no FQDN is available, hostname\r
+    from gethostname() is returned.\r
+    """\r
+    name = name.strip()\r
+    if not name or name == '0.0.0.0':\r
+        name = gethostname()\r
+    try:\r
+        hostname, aliases, ipaddrs = gethostbyaddr(name)\r
+    except error:\r
+        pass\r
+    else:\r
+        aliases.insert(0, hostname)\r
+        for name in aliases:\r
+            if '.' in name:\r
+                break\r
+        else:\r
+            name = hostname\r
+    return name\r
+\r
+\r
+_socketmethods = (\r
+    'bind', 'connect', 'connect_ex', 'fileno', 'listen',\r
+    'getpeername', 'getsockname', 'getsockopt', 'setsockopt',\r
+    'sendall', 'setblocking',\r
+    'settimeout', 'gettimeout', 'shutdown')\r
+\r
+if os.name == "nt":\r
+    _socketmethods = _socketmethods + ('ioctl',)\r
+\r
+if sys.platform == "riscos":\r
+    _socketmethods = _socketmethods + ('sleeptaskw',)\r
+\r
+# All the method names that must be delegated to either the real socket\r
+# object or the _closedsocket object.\r
+_delegate_methods = ("recv", "recvfrom", "recv_into", "recvfrom_into",\r
+                     "send", "sendto")\r
+\r
+class _closedsocket(object):\r
+    __slots__ = []\r
+    def _dummy(*args):\r
+        raise error(EBADF, 'Bad file descriptor')\r
+    # All _delegate_methods must also be initialized here.\r
+    send = recv = recv_into = sendto = recvfrom = recvfrom_into = _dummy\r
+    __getattr__ = _dummy\r
+\r
+# Wrapper around platform socket objects. This implements\r
+# a platform-independent dup() functionality. The\r
+# implementation currently relies on reference counting\r
+# to close the underlying socket object.\r
+class _socketobject(object):\r
+\r
+    __doc__ = _realsocket.__doc__\r
+\r
+    __slots__ = ["_sock", "__weakref__"] + list(_delegate_methods)\r
+\r
+    def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None):\r
+        if _sock is None:\r
+            _sock = _realsocket(family, type, proto)\r
+        self._sock = _sock\r
+        for method in _delegate_methods:\r
+            setattr(self, method, getattr(_sock, method))\r
+\r
+    def close(self, _closedsocket=_closedsocket,\r
+              _delegate_methods=_delegate_methods, setattr=setattr):\r
+        # This function should not reference any globals. See issue #808164.\r
+        self._sock = _closedsocket()\r
+        dummy = self._sock._dummy\r
+        for method in _delegate_methods:\r
+            setattr(self, method, dummy)\r
+    close.__doc__ = _realsocket.close.__doc__\r
+\r
+    def accept(self):\r
+        sock, addr = self._sock.accept()\r
+        return _socketobject(_sock=sock), addr\r
+    accept.__doc__ = _realsocket.accept.__doc__\r
+\r
+    def dup(self):\r
+        """dup() -> socket object\r
+\r
+        Return a new socket object connected to the same system resource."""\r
+        return _socketobject(_sock=self._sock)\r
+\r
+    def makefile(self, mode='r', bufsize=-1):\r
+        """makefile([mode[, bufsize]]) -> file object\r
+\r
+        Return a regular file object corresponding to the socket.  The mode\r
+        and bufsize arguments are as for the built-in open() function."""\r
+        return _fileobject(self._sock, mode, bufsize)\r
+\r
+    family = property(lambda self: self._sock.family, doc="the socket family")\r
+    type = property(lambda self: self._sock.type, doc="the socket type")\r
+    proto = property(lambda self: self._sock.proto, doc="the socket protocol")\r
+\r
+def meth(name,self,*args):\r
+    return getattr(self._sock,name)(*args)\r
+\r
+for _m in _socketmethods:\r
+    p = partial(meth,_m)\r
+    p.__name__ = _m\r
+    p.__doc__ = getattr(_realsocket,_m).__doc__\r
+    m = MethodType(p,None,_socketobject)\r
+    setattr(_socketobject,_m,m)\r
+\r
+socket = SocketType = _socketobject\r
+\r
+class _fileobject(object):\r
+    """Faux file object attached to a socket object."""\r
+\r
+    default_bufsize = 8192\r
+    name = "<socket>"\r
+\r
+    __slots__ = ["mode", "bufsize", "softspace",\r
+                 # "closed" is a property, see below\r
+                 "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf", "_wbuf_len",\r
+                 "_close"]\r
+\r
+    def __init__(self, sock, mode='rb', bufsize=-1, close=False):\r
+        self._sock = sock\r
+        self.mode = mode # Not actually used in this version\r
+        if bufsize < 0:\r
+            bufsize = self.default_bufsize\r
+        self.bufsize = bufsize\r
+        self.softspace = False\r
+        # _rbufsize is the suggested recv buffer size.  It is *strictly*\r
+        # obeyed within readline() for recv calls.  If it is larger than\r
+        # default_bufsize it will be used for recv calls within read().\r
+        if bufsize == 0:\r
+            self._rbufsize = 1\r
+        elif bufsize == 1:\r
+            self._rbufsize = self.default_bufsize\r
+        else:\r
+            self._rbufsize = bufsize\r
+        self._wbufsize = bufsize\r
+        # We use StringIO for the read buffer to avoid holding a list\r
+        # of variously sized string objects which have been known to\r
+        # fragment the heap due to how they are malloc()ed and often\r
+        # realloc()ed down much smaller than their original allocation.\r
+        self._rbuf = StringIO()\r
+        self._wbuf = [] # A list of strings\r
+        self._wbuf_len = 0\r
+        self._close = close\r
+\r
+    def _getclosed(self):\r
+        return self._sock is None\r
+    closed = property(_getclosed, doc="True if the file is closed")\r
+\r
+    def close(self):\r
+        try:\r
+            if self._sock:\r
+                self.flush()\r
+        finally:\r
+            if self._close:\r
+                self._sock.close()\r
+            self._sock = None\r
+\r
+    def __del__(self):\r
+        try:\r
+            self.close()\r
+        except:\r
+            # close() may fail if __init__ didn't complete\r
+            pass\r
+\r
+    def flush(self):\r
+        if self._wbuf:\r
+            data = "".join(self._wbuf)\r
+            self._wbuf = []\r
+            self._wbuf_len = 0\r
+            buffer_size = max(self._rbufsize, self.default_bufsize)\r
+            data_size = len(data)\r
+            write_offset = 0\r
+            view = memoryview(data)\r
+            try:\r
+                while write_offset < data_size:\r
+                    self._sock.sendall(view[write_offset:write_offset+buffer_size])\r
+                    write_offset += buffer_size\r
+            finally:\r
+                if write_offset < data_size:\r
+                    remainder = data[write_offset:]\r
+                    del view, data  # explicit free\r
+                    self._wbuf.append(remainder)\r
+                    self._wbuf_len = len(remainder)\r
+\r
+    def fileno(self):\r
+        return self._sock.fileno()\r
+\r
+    def write(self, data):\r
+        data = str(data) # XXX Should really reject non-string non-buffers\r
+        if not data:\r
+            return\r
+        self._wbuf.append(data)\r
+        self._wbuf_len += len(data)\r
+        if (self._wbufsize == 0 or\r
+            (self._wbufsize == 1 and '\n' in data) or\r
+            (self._wbufsize > 1 and self._wbuf_len >= self._wbufsize)):\r
+            self.flush()\r
+\r
+    def writelines(self, list):\r
+        # XXX We could do better here for very long lists\r
+        # XXX Should really reject non-string non-buffers\r
+        lines = filter(None, map(str, list))\r
+        self._wbuf_len += sum(map(len, lines))\r
+        self._wbuf.extend(lines)\r
+        if (self._wbufsize <= 1 or\r
+            self._wbuf_len >= self._wbufsize):\r
+            self.flush()\r
+\r
+    def read(self, size=-1):\r
+        # Use max, disallow tiny reads in a loop as they are very inefficient.\r
+        # We never leave read() with any leftover data from a new recv() call\r
+        # in our internal buffer.\r
+        rbufsize = max(self._rbufsize, self.default_bufsize)\r
+        # Our use of StringIO rather than lists of string objects returned by\r
+        # recv() minimizes memory usage and fragmentation that occurs when\r
+        # rbufsize is large compared to the typical return value of recv().\r
+        buf = self._rbuf\r
+        buf.seek(0, 2)  # seek end\r
+        if size < 0:\r
+            # Read until EOF\r
+            self._rbuf = StringIO()  # reset _rbuf.  we consume it via buf.\r
+            while True:\r
+                try:\r
+                    data = self._sock.recv(rbufsize)\r
+                except error, e:\r
+                    if e.args[0] == EINTR:\r
+                        continue\r
+                    raise\r
+                if not data:\r
+                    break\r
+                buf.write(data)\r
+            return buf.getvalue()\r
+        else:\r
+            # Read until size bytes or EOF seen, whichever comes first\r
+            buf_len = buf.tell()\r
+            if buf_len >= size:\r
+                # Already have size bytes in our buffer?  Extract and return.\r
+                buf.seek(0)\r
+                rv = buf.read(size)\r
+                self._rbuf = StringIO()\r
+                self._rbuf.write(buf.read())\r
+                return rv\r
+\r
+            self._rbuf = StringIO()  # reset _rbuf.  we consume it via buf.\r
+            while True:\r
+                left = size - buf_len\r
+                # recv() will malloc the amount of memory given as its\r
+                # parameter even though it often returns much less data\r
+                # than that.  The returned data string is short lived\r
+                # as we copy it into a StringIO and free it.  This avoids\r
+                # fragmentation issues on many platforms.\r
+                try:\r
+                    data = self._sock.recv(left)\r
+                except error, e:\r
+                    if e.args[0] == EINTR:\r
+                        continue\r
+                    raise\r
+                if not data:\r
+                    break\r
+                n = len(data)\r
+                if n == size and not buf_len:\r
+                    # Shortcut.  Avoid buffer data copies when:\r
+                    # - We have no data in our buffer.\r
+                    # AND\r
+                    # - Our call to recv returned exactly the\r
+                    #   number of bytes we were asked to read.\r
+                    return data\r
+                if n == left:\r
+                    buf.write(data)\r
+                    del data  # explicit free\r
+                    break\r
+                assert n <= left, "recv(%d) returned %d bytes" % (left, n)\r
+                buf.write(data)\r
+                buf_len += n\r
+                del data  # explicit free\r
+                #assert buf_len == buf.tell()\r
+            return buf.getvalue()\r
+\r
+    def readline(self, size=-1):\r
+        buf = self._rbuf\r
+        buf.seek(0, 2)  # seek end\r
+        if buf.tell() > 0:\r
+            # check if we already have it in our buffer\r
+            buf.seek(0)\r
+            bline = buf.readline(size)\r
+            if bline.endswith('\n') or len(bline) == size:\r
+                self._rbuf = StringIO()\r
+                self._rbuf.write(buf.read())\r
+                return bline\r
+            del bline\r
+        if size < 0:\r
+            # Read until \n or EOF, whichever comes first\r
+            if self._rbufsize <= 1:\r
+                # Speed up unbuffered case\r
+                buf.seek(0)\r
+                buffers = [buf.read()]\r
+                self._rbuf = StringIO()  # reset _rbuf.  we consume it via buf.\r
+                data = None\r
+                recv = self._sock.recv\r
+                while True:\r
+                    try:\r
+                        while data != "\n":\r
+                            data = recv(1)\r
+                            if not data:\r
+                                break\r
+                            buffers.append(data)\r
+                    except error, e:\r
+                        # The try..except to catch EINTR was moved outside the\r
+                        # recv loop to avoid the per byte overhead.\r
+                        if e.args[0] == EINTR:\r
+                            continue\r
+                        raise\r
+                    break\r
+                return "".join(buffers)\r
+\r
+            buf.seek(0, 2)  # seek end\r
+            self._rbuf = StringIO()  # reset _rbuf.  we consume it via buf.\r
+            while True:\r
+                try:\r
+                    data = self._sock.recv(self._rbufsize)\r
+                except error, e:\r
+                    if e.args[0] == EINTR:\r
+                        continue\r
+                    raise\r
+                if not data:\r
+                    break\r
+                nl = data.find('\n')\r
+                if nl >= 0:\r
+                    nl += 1\r
+                    buf.write(data[:nl])\r
+                    self._rbuf.write(data[nl:])\r
+                    del data\r
+                    break\r
+                buf.write(data)\r
+            return buf.getvalue()\r
+        else:\r
+            # Read until size bytes or \n or EOF seen, whichever comes first\r
+            buf.seek(0, 2)  # seek end\r
+            buf_len = buf.tell()\r
+            if buf_len >= size:\r
+                buf.seek(0)\r
+                rv = buf.read(size)\r
+                self._rbuf = StringIO()\r
+                self._rbuf.write(buf.read())\r
+                return rv\r
+            self._rbuf = StringIO()  # reset _rbuf.  we consume it via buf.\r
+            while True:\r
+                try:\r
+                    data = self._sock.recv(self._rbufsize)\r
+                except error, e:\r
+                    if e.args[0] == EINTR:\r
+                        continue\r
+                    raise\r
+                if not data:\r
+                    break\r
+                left = size - buf_len\r
+                # did we just receive a newline?\r
+                nl = data.find('\n', 0, left)\r
+                if nl >= 0:\r
+                    nl += 1\r
+                    # save the excess data to _rbuf\r
+                    self._rbuf.write(data[nl:])\r
+                    if buf_len:\r
+                        buf.write(data[:nl])\r
+                        break\r
+                    else:\r
+                        # Shortcut.  Avoid data copy through buf when returning\r
+                        # a substring of our first recv().\r
+                        return data[:nl]\r
+                n = len(data)\r
+                if n == size and not buf_len:\r
+                    # Shortcut.  Avoid data copy through buf when\r
+                    # returning exactly all of our first recv().\r
+                    return data\r
+                if n >= left:\r
+                    buf.write(data[:left])\r
+                    self._rbuf.write(data[left:])\r
+                    break\r
+                buf.write(data)\r
+                buf_len += n\r
+                #assert buf_len == buf.tell()\r
+            return buf.getvalue()\r
+\r
+    def readlines(self, sizehint=0):\r
+        total = 0\r
+        list = []\r
+        while True:\r
+            line = self.readline()\r
+            if not line:\r
+                break\r
+            list.append(line)\r
+            total += len(line)\r
+            if sizehint and total >= sizehint:\r
+                break\r
+        return list\r
+\r
+    # Iterator protocols\r
+\r
+    def __iter__(self):\r
+        return self\r
+\r
+    def next(self):\r
+        line = self.readline()\r
+        if not line:\r
+            raise StopIteration\r
+        return line\r
+\r
+_GLOBAL_DEFAULT_TIMEOUT = object()\r
+\r
+def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,\r
+                      source_address=None):\r
+    """Connect to *address* and return the socket object.\r
+\r
+    Convenience function.  Connect to *address* (a 2-tuple ``(host,\r
+    port)``) and return the socket object.  Passing the optional\r
+    *timeout* parameter will set the timeout on the socket instance\r
+    before attempting to connect.  If no *timeout* is supplied, the\r
+    global default timeout setting returned by :func:`getdefaulttimeout`\r
+    is used.  If *source_address* is set it must be a tuple of (host, port)\r
+    for the socket to bind as a source address before making the connection.\r
+    An host of '' or port 0 tells the OS to use the default.\r
+    """\r
+\r
+    host, port = address\r
+    err = None\r
+    for res in getaddrinfo(host, port, 0, SOCK_STREAM):\r
+        af, socktype, proto, canonname, sa = res\r
+        sock = None\r
+        try:\r
+            sock = socket(af, socktype, proto)\r
+            if timeout is not _GLOBAL_DEFAULT_TIMEOUT:\r
+                sock.settimeout(timeout)\r
+            if source_address:\r
+                sock.bind(source_address)\r
+            sock.connect(sa)\r
+            return sock\r
+\r
+        except error as _:\r
+            err = _\r
+            if sock is not None:\r
+                sock.close()\r
+\r
+    if err is not None:\r
+        raise err\r
+    else:\r
+        raise error("getaddrinfo returns an empty list")\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre.py
new file mode 100644 (file)
index 0000000..6d376ad
--- /dev/null
@@ -0,0 +1,13 @@
+"""This file is only retained for backwards compatibility.\r
+It will be removed in the future.  sre was moved to re in version 2.5.\r
+"""\r
+\r
+import warnings\r
+warnings.warn("The sre module is deprecated, please import re.",\r
+              DeprecationWarning, 2)\r
+\r
+from re import *\r
+from re import __all__\r
+\r
+# old pickles expect the _compile() reconstructor in this module\r
+from re import _compile\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_compile.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_compile.py
new file mode 100644 (file)
index 0000000..6a74d04
--- /dev/null
@@ -0,0 +1,596 @@
+# -*- coding: utf-8 -*-\r
+#\r
+# Secret Labs' Regular Expression Engine\r
+#\r
+# convert template to internal format\r
+#\r
+# Copyright (c) 1997-2001 by Secret Labs AB.  All rights reserved.\r
+#\r
+# See the sre.py file for information on usage and redistribution.\r
+#\r
+\r
+"""Internal support module for sre"""\r
+\r
+import _sre, sys\r
+import sre_parse\r
+from sre_constants import *\r
+\r
+assert _sre.MAGIC == MAGIC, "SRE module mismatch"\r
+\r
+if _sre.CODESIZE == 2:\r
+    MAXCODE = 65535\r
+else:\r
+    MAXCODE = 0xFFFFFFFFL\r
+\r
+_LITERAL_CODES = set([LITERAL, NOT_LITERAL])\r
+_REPEATING_CODES = set([REPEAT, MIN_REPEAT, MAX_REPEAT])\r
+_SUCCESS_CODES = set([SUCCESS, FAILURE])\r
+_ASSERT_CODES = set([ASSERT, ASSERT_NOT])\r
+\r
+# Sets of lowercase characters which have the same uppercase.\r
+_equivalences = (\r
+    # LATIN SMALL LETTER I, LATIN SMALL LETTER DOTLESS I\r
+    (0x69, 0x131), # iı\r
+    # LATIN SMALL LETTER S, LATIN SMALL LETTER LONG S\r
+    (0x73, 0x17f), # sſ\r
+    # MICRO SIGN, GREEK SMALL LETTER MU\r
+    (0xb5, 0x3bc), # µμ\r
+    # COMBINING GREEK YPOGEGRAMMENI, GREEK SMALL LETTER IOTA, GREEK PROSGEGRAMMENI\r
+    (0x345, 0x3b9, 0x1fbe), # \u0345ιι\r
+    # GREEK SMALL LETTER BETA, GREEK BETA SYMBOL\r
+    (0x3b2, 0x3d0), # βϐ\r
+    # GREEK SMALL LETTER EPSILON, GREEK LUNATE EPSILON SYMBOL\r
+    (0x3b5, 0x3f5), # εϵ\r
+    # GREEK SMALL LETTER THETA, GREEK THETA SYMBOL\r
+    (0x3b8, 0x3d1), # θϑ\r
+    # GREEK SMALL LETTER KAPPA, GREEK KAPPA SYMBOL\r
+    (0x3ba, 0x3f0), # κϰ\r
+    # GREEK SMALL LETTER PI, GREEK PI SYMBOL\r
+    (0x3c0, 0x3d6), # πϖ\r
+    # GREEK SMALL LETTER RHO, GREEK RHO SYMBOL\r
+    (0x3c1, 0x3f1), # ρϱ\r
+    # GREEK SMALL LETTER FINAL SIGMA, GREEK SMALL LETTER SIGMA\r
+    (0x3c2, 0x3c3), # ςσ\r
+    # GREEK SMALL LETTER PHI, GREEK PHI SYMBOL\r
+    (0x3c6, 0x3d5), # φϕ\r
+    # LATIN SMALL LETTER S WITH DOT ABOVE, LATIN SMALL LETTER LONG S WITH DOT ABOVE\r
+    (0x1e61, 0x1e9b), # ṡẛ\r
+)\r
+\r
+# Maps the lowercase code to lowercase codes which have the same uppercase.\r
+_ignorecase_fixes = {i: tuple(j for j in t if i != j)\r
+                     for t in _equivalences for i in t}\r
+\r
+def _compile(code, pattern, flags):\r
+    # internal: compile a (sub)pattern\r
+    emit = code.append\r
+    _len = len\r
+    LITERAL_CODES = _LITERAL_CODES\r
+    REPEATING_CODES = _REPEATING_CODES\r
+    SUCCESS_CODES = _SUCCESS_CODES\r
+    ASSERT_CODES = _ASSERT_CODES\r
+    if (flags & SRE_FLAG_IGNORECASE and\r
+            not (flags & SRE_FLAG_LOCALE) and\r
+            flags & SRE_FLAG_UNICODE):\r
+        fixes = _ignorecase_fixes\r
+    else:\r
+        fixes = None\r
+    for op, av in pattern:\r
+        if op in LITERAL_CODES:\r
+            if flags & SRE_FLAG_IGNORECASE:\r
+                lo = _sre.getlower(av, flags)\r
+                if fixes and lo in fixes:\r
+                    emit(OPCODES[IN_IGNORE])\r
+                    skip = _len(code); emit(0)\r
+                    if op is NOT_LITERAL:\r
+                        emit(OPCODES[NEGATE])\r
+                    for k in (lo,) + fixes[lo]:\r
+                        emit(OPCODES[LITERAL])\r
+                        emit(k)\r
+                    emit(OPCODES[FAILURE])\r
+                    code[skip] = _len(code) - skip\r
+                else:\r
+                    emit(OPCODES[OP_IGNORE[op]])\r
+                    emit(lo)\r
+            else:\r
+                emit(OPCODES[op])\r
+                emit(av)\r
+        elif op is IN:\r
+            if flags & SRE_FLAG_IGNORECASE:\r
+                emit(OPCODES[OP_IGNORE[op]])\r
+                def fixup(literal, flags=flags):\r
+                    return _sre.getlower(literal, flags)\r
+            else:\r
+                emit(OPCODES[op])\r
+                fixup = None\r
+            skip = _len(code); emit(0)\r
+            _compile_charset(av, flags, code, fixup, fixes)\r
+            code[skip] = _len(code) - skip\r
+        elif op is ANY:\r
+            if flags & SRE_FLAG_DOTALL:\r
+                emit(OPCODES[ANY_ALL])\r
+            else:\r
+                emit(OPCODES[ANY])\r
+        elif op in REPEATING_CODES:\r
+            if flags & SRE_FLAG_TEMPLATE:\r
+                raise error, "internal: unsupported template operator"\r
+                emit(OPCODES[REPEAT])\r
+                skip = _len(code); emit(0)\r
+                emit(av[0])\r
+                emit(av[1])\r
+                _compile(code, av[2], flags)\r
+                emit(OPCODES[SUCCESS])\r
+                code[skip] = _len(code) - skip\r
+            elif _simple(av) and op is not REPEAT:\r
+                if op is MAX_REPEAT:\r
+                    emit(OPCODES[REPEAT_ONE])\r
+                else:\r
+                    emit(OPCODES[MIN_REPEAT_ONE])\r
+                skip = _len(code); emit(0)\r
+                emit(av[0])\r
+                emit(av[1])\r
+                _compile(code, av[2], flags)\r
+                emit(OPCODES[SUCCESS])\r
+                code[skip] = _len(code) - skip\r
+            else:\r
+                emit(OPCODES[REPEAT])\r
+                skip = _len(code); emit(0)\r
+                emit(av[0])\r
+                emit(av[1])\r
+                _compile(code, av[2], flags)\r
+                code[skip] = _len(code) - skip\r
+                if op is MAX_REPEAT:\r
+                    emit(OPCODES[MAX_UNTIL])\r
+                else:\r
+                    emit(OPCODES[MIN_UNTIL])\r
+        elif op is SUBPATTERN:\r
+            if av[0]:\r
+                emit(OPCODES[MARK])\r
+                emit((av[0]-1)*2)\r
+            # _compile_info(code, av[1], flags)\r
+            _compile(code, av[1], flags)\r
+            if av[0]:\r
+                emit(OPCODES[MARK])\r
+                emit((av[0]-1)*2+1)\r
+        elif op in SUCCESS_CODES:\r
+            emit(OPCODES[op])\r
+        elif op in ASSERT_CODES:\r
+            emit(OPCODES[op])\r
+            skip = _len(code); emit(0)\r
+            if av[0] >= 0:\r
+                emit(0) # look ahead\r
+            else:\r
+                lo, hi = av[1].getwidth()\r
+                if lo != hi:\r
+                    raise error, "look-behind requires fixed-width pattern"\r
+                emit(lo) # look behind\r
+            _compile(code, av[1], flags)\r
+            emit(OPCODES[SUCCESS])\r
+            code[skip] = _len(code) - skip\r
+        elif op is CALL:\r
+            emit(OPCODES[op])\r
+            skip = _len(code); emit(0)\r
+            _compile(code, av, flags)\r
+            emit(OPCODES[SUCCESS])\r
+            code[skip] = _len(code) - skip\r
+        elif op is AT:\r
+            emit(OPCODES[op])\r
+            if flags & SRE_FLAG_MULTILINE:\r
+                av = AT_MULTILINE.get(av, av)\r
+            if flags & SRE_FLAG_LOCALE:\r
+                av = AT_LOCALE.get(av, av)\r
+            elif flags & SRE_FLAG_UNICODE:\r
+                av = AT_UNICODE.get(av, av)\r
+            emit(ATCODES[av])\r
+        elif op is BRANCH:\r
+            emit(OPCODES[op])\r
+            tail = []\r
+            tailappend = tail.append\r
+            for av in av[1]:\r
+                skip = _len(code); emit(0)\r
+                # _compile_info(code, av, flags)\r
+                _compile(code, av, flags)\r
+                emit(OPCODES[JUMP])\r
+                tailappend(_len(code)); emit(0)\r
+                code[skip] = _len(code) - skip\r
+            emit(0) # end of branch\r
+            for tail in tail:\r
+                code[tail] = _len(code) - tail\r
+        elif op is CATEGORY:\r
+            emit(OPCODES[op])\r
+            if flags & SRE_FLAG_LOCALE:\r
+                av = CH_LOCALE[av]\r
+            elif flags & SRE_FLAG_UNICODE:\r
+                av = CH_UNICODE[av]\r
+            emit(CHCODES[av])\r
+        elif op is GROUPREF:\r
+            if flags & SRE_FLAG_IGNORECASE:\r
+                emit(OPCODES[OP_IGNORE[op]])\r
+            else:\r
+                emit(OPCODES[op])\r
+            emit(av-1)\r
+        elif op is GROUPREF_EXISTS:\r
+            emit(OPCODES[op])\r
+            emit(av[0]-1)\r
+            skipyes = _len(code); emit(0)\r
+            _compile(code, av[1], flags)\r
+            if av[2]:\r
+                emit(OPCODES[JUMP])\r
+                skipno = _len(code); emit(0)\r
+                code[skipyes] = _len(code) - skipyes + 1\r
+                _compile(code, av[2], flags)\r
+                code[skipno] = _len(code) - skipno\r
+            else:\r
+                code[skipyes] = _len(code) - skipyes + 1\r
+        else:\r
+            raise ValueError, ("unsupported operand type", op)\r
+\r
+def _compile_charset(charset, flags, code, fixup=None, fixes=None):\r
+    # compile charset subprogram\r
+    emit = code.append\r
+    for op, av in _optimize_charset(charset, fixup, fixes,\r
+                                    flags & SRE_FLAG_UNICODE):\r
+        emit(OPCODES[op])\r
+        if op is NEGATE:\r
+            pass\r
+        elif op is LITERAL:\r
+            emit(av)\r
+        elif op is RANGE:\r
+            emit(av[0])\r
+            emit(av[1])\r
+        elif op is CHARSET:\r
+            code.extend(av)\r
+        elif op is BIGCHARSET:\r
+            code.extend(av)\r
+        elif op is CATEGORY:\r
+            if flags & SRE_FLAG_LOCALE:\r
+                emit(CHCODES[CH_LOCALE[av]])\r
+            elif flags & SRE_FLAG_UNICODE:\r
+                emit(CHCODES[CH_UNICODE[av]])\r
+            else:\r
+                emit(CHCODES[av])\r
+        else:\r
+            raise error, "internal: unsupported set operator"\r
+    emit(OPCODES[FAILURE])\r
+\r
+def _optimize_charset(charset, fixup, fixes, isunicode):\r
+    # internal: optimize character set\r
+    out = []\r
+    tail = []\r
+    charmap = bytearray(256)\r
+    for op, av in charset:\r
+        while True:\r
+            try:\r
+                if op is LITERAL:\r
+                    if fixup:\r
+                        i = fixup(av)\r
+                        charmap[i] = 1\r
+                        if fixes and i in fixes:\r
+                            for k in fixes[i]:\r
+                                charmap[k] = 1\r
+                    else:\r
+                        charmap[av] = 1\r
+                elif op is RANGE:\r
+                    r = range(av[0], av[1]+1)\r
+                    if fixup:\r
+                        r = map(fixup, r)\r
+                    if fixup and fixes:\r
+                        for i in r:\r
+                            charmap[i] = 1\r
+                            if i in fixes:\r
+                                for k in fixes[i]:\r
+                                    charmap[k] = 1\r
+                    else:\r
+                        for i in r:\r
+                            charmap[i] = 1\r
+                elif op is NEGATE:\r
+                    out.append((op, av))\r
+                else:\r
+                    tail.append((op, av))\r
+            except IndexError:\r
+                if len(charmap) == 256:\r
+                    # character set contains non-UCS1 character codes\r
+                    charmap += b'\0' * 0xff00\r
+                    continue\r
+                # character set contains non-BMP character codes\r
+                if fixup and isunicode and op is RANGE:\r
+                    lo, hi = av\r
+                    ranges = [av]\r
+                    # There are only two ranges of cased astral characters:\r
+                    # 10400-1044F (Deseret) and 118A0-118DF (Warang Citi).\r
+                    _fixup_range(max(0x10000, lo), min(0x11fff, hi),\r
+                                 ranges, fixup)\r
+                    for lo, hi in ranges:\r
+                        if lo == hi:\r
+                            tail.append((LITERAL, hi))\r
+                        else:\r
+                            tail.append((RANGE, (lo, hi)))\r
+                else:\r
+                    tail.append((op, av))\r
+            break\r
+\r
+    # compress character map\r
+    runs = []\r
+    q = 0\r
+    while True:\r
+        p = charmap.find(b'\1', q)\r
+        if p < 0:\r
+            break\r
+        if len(runs) >= 2:\r
+            runs = None\r
+            break\r
+        q = charmap.find(b'\0', p)\r
+        if q < 0:\r
+            runs.append((p, len(charmap)))\r
+            break\r
+        runs.append((p, q))\r
+    if runs is not None:\r
+        # use literal/range\r
+        for p, q in runs:\r
+            if q - p == 1:\r
+                out.append((LITERAL, p))\r
+            else:\r
+                out.append((RANGE, (p, q - 1)))\r
+        out += tail\r
+        # if the case was changed or new representation is more compact\r
+        if fixup or len(out) < len(charset):\r
+            return out\r
+        # else original character set is good enough\r
+        return charset\r
+\r
+    # use bitmap\r
+    if len(charmap) == 256:\r
+        data = _mk_bitmap(charmap)\r
+        out.append((CHARSET, data))\r
+        out += tail\r
+        return out\r
+\r
+    # To represent a big charset, first a bitmap of all characters in the\r
+    # set is constructed. Then, this bitmap is sliced into chunks of 256\r
+    # characters, duplicate chunks are eliminated, and each chunk is\r
+    # given a number. In the compiled expression, the charset is\r
+    # represented by a 32-bit word sequence, consisting of one word for\r
+    # the number of different chunks, a sequence of 256 bytes (64 words)\r
+    # of chunk numbers indexed by their original chunk position, and a\r
+    # sequence of 256-bit chunks (8 words each).\r
+\r
+    # Compression is normally good: in a typical charset, large ranges of\r
+    # Unicode will be either completely excluded (e.g. if only cyrillic\r
+    # letters are to be matched), or completely included (e.g. if large\r
+    # subranges of Kanji match). These ranges will be represented by\r
+    # chunks of all one-bits or all zero-bits.\r
+\r
+    # Matching can be also done efficiently: the more significant byte of\r
+    # the Unicode character is an index into the chunk number, and the\r
+    # less significant byte is a bit index in the chunk (just like the\r
+    # CHARSET matching).\r
+\r
+    # In UCS-4 mode, the BIGCHARSET opcode still supports only subsets\r
+    # of the basic multilingual plane; an efficient representation\r
+    # for all of Unicode has not yet been developed.\r
+\r
+    charmap = bytes(charmap) # should be hashable\r
+    comps = {}\r
+    mapping = bytearray(256)\r
+    block = 0\r
+    data = bytearray()\r
+    for i in range(0, 65536, 256):\r
+        chunk = charmap[i: i + 256]\r
+        if chunk in comps:\r
+            mapping[i // 256] = comps[chunk]\r
+        else:\r
+            mapping[i // 256] = comps[chunk] = block\r
+            block += 1\r
+            data += chunk\r
+    data = _mk_bitmap(data)\r
+    data[0:0] = [block] + _bytes_to_codes(mapping)\r
+    out.append((BIGCHARSET, data))\r
+    out += tail\r
+    return out\r
+\r
+def _fixup_range(lo, hi, ranges, fixup):\r
+    for i in map(fixup, range(lo, hi+1)):\r
+        for k, (lo, hi) in enumerate(ranges):\r
+            if i < lo:\r
+                if l == lo - 1:\r
+                    ranges[k] = (i, hi)\r
+                else:\r
+                    ranges.insert(k, (i, i))\r
+                break\r
+            elif i > hi:\r
+                if i == hi + 1:\r
+                    ranges[k] = (lo, i)\r
+                    break\r
+            else:\r
+                break\r
+        else:\r
+            ranges.append((i, i))\r
+\r
+_CODEBITS = _sre.CODESIZE * 8\r
+_BITS_TRANS = b'0' + b'1' * 255\r
+def _mk_bitmap(bits, _CODEBITS=_CODEBITS, _int=int):\r
+    s = bytes(bits).translate(_BITS_TRANS)[::-1]\r
+    return [_int(s[i - _CODEBITS: i], 2)\r
+            for i in range(len(s), 0, -_CODEBITS)]\r
+\r
+def _bytes_to_codes(b):\r
+    # Convert block indices to word array\r
+    import array\r
+    if _sre.CODESIZE == 2:\r
+        code = 'H'\r
+    else:\r
+        code = 'I'\r
+    a = array.array(code, bytes(b))\r
+    assert a.itemsize == _sre.CODESIZE\r
+    assert len(a) * a.itemsize == len(b)\r
+    return a.tolist()\r
+\r
+def _simple(av):\r
+    # check if av is a "simple" operator\r
+    lo, hi = av[2].getwidth()\r
+    return lo == hi == 1 and av[2][0][0] != SUBPATTERN\r
+\r
+def _compile_info(code, pattern, flags):\r
+    # internal: compile an info block.  in the current version,\r
+    # this contains min/max pattern width, and an optional literal\r
+    # prefix or a character map\r
+    lo, hi = pattern.getwidth()\r
+    if lo == 0:\r
+        return # not worth it\r
+    # look for a literal prefix\r
+    prefix = []\r
+    prefixappend = prefix.append\r
+    prefix_skip = 0\r
+    charset = [] # not used\r
+    charsetappend = charset.append\r
+    if not (flags & SRE_FLAG_IGNORECASE):\r
+        # look for literal prefix\r
+        for op, av in pattern.data:\r
+            if op is LITERAL:\r
+                if len(prefix) == prefix_skip:\r
+                    prefix_skip = prefix_skip + 1\r
+                prefixappend(av)\r
+            elif op is SUBPATTERN and len(av[1]) == 1:\r
+                op, av = av[1][0]\r
+                if op is LITERAL:\r
+                    prefixappend(av)\r
+                else:\r
+                    break\r
+            else:\r
+                break\r
+        # if no prefix, look for charset prefix\r
+        if not prefix and pattern.data:\r
+            op, av = pattern.data[0]\r
+            if op is SUBPATTERN and av[1]:\r
+                op, av = av[1][0]\r
+                if op is LITERAL:\r
+                    charsetappend((op, av))\r
+                elif op is BRANCH:\r
+                    c = []\r
+                    cappend = c.append\r
+                    for p in av[1]:\r
+                        if not p:\r
+                            break\r
+                        op, av = p[0]\r
+                        if op is LITERAL:\r
+                            cappend((op, av))\r
+                        else:\r
+                            break\r
+                    else:\r
+                        charset = c\r
+            elif op is BRANCH:\r
+                c = []\r
+                cappend = c.append\r
+                for p in av[1]:\r
+                    if not p:\r
+                        break\r
+                    op, av = p[0]\r
+                    if op is LITERAL:\r
+                        cappend((op, av))\r
+                    else:\r
+                        break\r
+                else:\r
+                    charset = c\r
+            elif op is IN:\r
+                charset = av\r
+##     if prefix:\r
+##         print "*** PREFIX", prefix, prefix_skip\r
+##     if charset:\r
+##         print "*** CHARSET", charset\r
+    # add an info block\r
+    emit = code.append\r
+    emit(OPCODES[INFO])\r
+    skip = len(code); emit(0)\r
+    # literal flag\r
+    mask = 0\r
+    if prefix:\r
+        mask = SRE_INFO_PREFIX\r
+        if len(prefix) == prefix_skip == len(pattern.data):\r
+            mask = mask + SRE_INFO_LITERAL\r
+    elif charset:\r
+        mask = mask + SRE_INFO_CHARSET\r
+    emit(mask)\r
+    # pattern length\r
+    if lo < MAXCODE:\r
+        emit(lo)\r
+    else:\r
+        emit(MAXCODE)\r
+        prefix = prefix[:MAXCODE]\r
+    if hi < MAXCODE:\r
+        emit(hi)\r
+    else:\r
+        emit(0)\r
+    # add literal prefix\r
+    if prefix:\r
+        emit(len(prefix)) # length\r
+        emit(prefix_skip) # skip\r
+        code.extend(prefix)\r
+        # generate overlap table\r
+        table = [-1] + ([0]*len(prefix))\r
+        for i in xrange(len(prefix)):\r
+            table[i+1] = table[i]+1\r
+            while table[i+1] > 0 and prefix[i] != prefix[table[i+1]-1]:\r
+                table[i+1] = table[table[i+1]-1]+1\r
+        code.extend(table[1:]) # don't store first entry\r
+    elif charset:\r
+        _compile_charset(charset, flags, code)\r
+    code[skip] = len(code) - skip\r
+\r
+try:\r
+    unicode\r
+except NameError:\r
+    STRING_TYPES = (type(""),)\r
+else:\r
+    STRING_TYPES = (type(""), type(unicode("")))\r
+\r
+def isstring(obj):\r
+    for tp in STRING_TYPES:\r
+        if isinstance(obj, tp):\r
+            return 1\r
+    return 0\r
+\r
+def _code(p, flags):\r
+\r
+    flags = p.pattern.flags | flags\r
+    code = []\r
+\r
+    # compile info block\r
+    _compile_info(code, p, flags)\r
+\r
+    # compile the pattern\r
+    _compile(code, p.data, flags)\r
+\r
+    code.append(OPCODES[SUCCESS])\r
+\r
+    return code\r
+\r
+def compile(p, flags=0):\r
+    # internal: convert pattern list to internal format\r
+\r
+    if isstring(p):\r
+        pattern = p\r
+        p = sre_parse.parse(p, flags)\r
+    else:\r
+        pattern = None\r
+\r
+    code = _code(p, flags)\r
+\r
+    # print code\r
+\r
+    # XXX: <fl> get rid of this limitation!\r
+    if p.pattern.groups > 100:\r
+        raise AssertionError(\r
+            "sorry, but this version only supports 100 named groups"\r
+            )\r
+\r
+    # map in either direction\r
+    groupindex = p.pattern.groupdict\r
+    indexgroup = [None] * p.pattern.groups\r
+    for k, i in groupindex.items():\r
+        indexgroup[i] = k\r
+\r
+    return _sre.compile(\r
+        pattern, flags | p.pattern.flags, code,\r
+        p.pattern.groups-1,\r
+        groupindex, indexgroup\r
+        )\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_constants.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_constants.py
new file mode 100644 (file)
index 0000000..cabbda4
--- /dev/null
@@ -0,0 +1,263 @@
+#\r
+# Secret Labs' Regular Expression Engine\r
+#\r
+# various symbols used by the regular expression engine.\r
+# run this script to update the _sre include files!\r
+#\r
+# Copyright (c) 1998-2001 by Secret Labs AB.  All rights reserved.\r
+#\r
+# See the sre.py file for information on usage and redistribution.\r
+#\r
+\r
+"""Internal support module for sre"""\r
+\r
+# update when constants are added or removed\r
+\r
+MAGIC = 20031017\r
+\r
+try:\r
+    from _sre import MAXREPEAT\r
+except ImportError:\r
+    import _sre\r
+    MAXREPEAT = _sre.MAXREPEAT = 65535\r
+\r
+# SRE standard exception (access as sre.error)\r
+# should this really be here?\r
+\r
+class error(Exception):\r
+    pass\r
+\r
+# operators\r
+\r
+FAILURE = "failure"\r
+SUCCESS = "success"\r
+\r
+ANY = "any"\r
+ANY_ALL = "any_all"\r
+ASSERT = "assert"\r
+ASSERT_NOT = "assert_not"\r
+AT = "at"\r
+BIGCHARSET = "bigcharset"\r
+BRANCH = "branch"\r
+CALL = "call"\r
+CATEGORY = "category"\r
+CHARSET = "charset"\r
+GROUPREF = "groupref"\r
+GROUPREF_IGNORE = "groupref_ignore"\r
+GROUPREF_EXISTS = "groupref_exists"\r
+IN = "in"\r
+IN_IGNORE = "in_ignore"\r
+INFO = "info"\r
+JUMP = "jump"\r
+LITERAL = "literal"\r
+LITERAL_IGNORE = "literal_ignore"\r
+MARK = "mark"\r
+MAX_REPEAT = "max_repeat"\r
+MAX_UNTIL = "max_until"\r
+MIN_REPEAT = "min_repeat"\r
+MIN_UNTIL = "min_until"\r
+NEGATE = "negate"\r
+NOT_LITERAL = "not_literal"\r
+NOT_LITERAL_IGNORE = "not_literal_ignore"\r
+RANGE = "range"\r
+REPEAT = "repeat"\r
+REPEAT_ONE = "repeat_one"\r
+SUBPATTERN = "subpattern"\r
+MIN_REPEAT_ONE = "min_repeat_one"\r
+\r
+# positions\r
+AT_BEGINNING = "at_beginning"\r
+AT_BEGINNING_LINE = "at_beginning_line"\r
+AT_BEGINNING_STRING = "at_beginning_string"\r
+AT_BOUNDARY = "at_boundary"\r
+AT_NON_BOUNDARY = "at_non_boundary"\r
+AT_END = "at_end"\r
+AT_END_LINE = "at_end_line"\r
+AT_END_STRING = "at_end_string"\r
+AT_LOC_BOUNDARY = "at_loc_boundary"\r
+AT_LOC_NON_BOUNDARY = "at_loc_non_boundary"\r
+AT_UNI_BOUNDARY = "at_uni_boundary"\r
+AT_UNI_NON_BOUNDARY = "at_uni_non_boundary"\r
+\r
+# categories\r
+CATEGORY_DIGIT = "category_digit"\r
+CATEGORY_NOT_DIGIT = "category_not_digit"\r
+CATEGORY_SPACE = "category_space"\r
+CATEGORY_NOT_SPACE = "category_not_space"\r
+CATEGORY_WORD = "category_word"\r
+CATEGORY_NOT_WORD = "category_not_word"\r
+CATEGORY_LINEBREAK = "category_linebreak"\r
+CATEGORY_NOT_LINEBREAK = "category_not_linebreak"\r
+CATEGORY_LOC_WORD = "category_loc_word"\r
+CATEGORY_LOC_NOT_WORD = "category_loc_not_word"\r
+CATEGORY_UNI_DIGIT = "category_uni_digit"\r
+CATEGORY_UNI_NOT_DIGIT = "category_uni_not_digit"\r
+CATEGORY_UNI_SPACE = "category_uni_space"\r
+CATEGORY_UNI_NOT_SPACE = "category_uni_not_space"\r
+CATEGORY_UNI_WORD = "category_uni_word"\r
+CATEGORY_UNI_NOT_WORD = "category_uni_not_word"\r
+CATEGORY_UNI_LINEBREAK = "category_uni_linebreak"\r
+CATEGORY_UNI_NOT_LINEBREAK = "category_uni_not_linebreak"\r
+\r
+OPCODES = [\r
+\r
+    # failure=0 success=1 (just because it looks better that way :-)\r
+    FAILURE, SUCCESS,\r
+\r
+    ANY, ANY_ALL,\r
+    ASSERT, ASSERT_NOT,\r
+    AT,\r
+    BRANCH,\r
+    CALL,\r
+    CATEGORY,\r
+    CHARSET, BIGCHARSET,\r
+    GROUPREF, GROUPREF_EXISTS, GROUPREF_IGNORE,\r
+    IN, IN_IGNORE,\r
+    INFO,\r
+    JUMP,\r
+    LITERAL, LITERAL_IGNORE,\r
+    MARK,\r
+    MAX_UNTIL,\r
+    MIN_UNTIL,\r
+    NOT_LITERAL, NOT_LITERAL_IGNORE,\r
+    NEGATE,\r
+    RANGE,\r
+    REPEAT,\r
+    REPEAT_ONE,\r
+    SUBPATTERN,\r
+    MIN_REPEAT_ONE\r
+\r
+]\r
+\r
+ATCODES = [\r
+    AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY,\r
+    AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING,\r
+    AT_LOC_BOUNDARY, AT_LOC_NON_BOUNDARY, AT_UNI_BOUNDARY,\r
+    AT_UNI_NON_BOUNDARY\r
+]\r
+\r
+CHCODES = [\r
+    CATEGORY_DIGIT, CATEGORY_NOT_DIGIT, CATEGORY_SPACE,\r
+    CATEGORY_NOT_SPACE, CATEGORY_WORD, CATEGORY_NOT_WORD,\r
+    CATEGORY_LINEBREAK, CATEGORY_NOT_LINEBREAK, CATEGORY_LOC_WORD,\r
+    CATEGORY_LOC_NOT_WORD, CATEGORY_UNI_DIGIT, CATEGORY_UNI_NOT_DIGIT,\r
+    CATEGORY_UNI_SPACE, CATEGORY_UNI_NOT_SPACE, CATEGORY_UNI_WORD,\r
+    CATEGORY_UNI_NOT_WORD, CATEGORY_UNI_LINEBREAK,\r
+    CATEGORY_UNI_NOT_LINEBREAK\r
+]\r
+\r
+def makedict(list):\r
+    d = {}\r
+    i = 0\r
+    for item in list:\r
+        d[item] = i\r
+        i = i + 1\r
+    return d\r
+\r
+OPCODES = makedict(OPCODES)\r
+ATCODES = makedict(ATCODES)\r
+CHCODES = makedict(CHCODES)\r
+\r
+# replacement operations for "ignore case" mode\r
+OP_IGNORE = {\r
+    GROUPREF: GROUPREF_IGNORE,\r
+    IN: IN_IGNORE,\r
+    LITERAL: LITERAL_IGNORE,\r
+    NOT_LITERAL: NOT_LITERAL_IGNORE\r
+}\r
+\r
+AT_MULTILINE = {\r
+    AT_BEGINNING: AT_BEGINNING_LINE,\r
+    AT_END: AT_END_LINE\r
+}\r
+\r
+AT_LOCALE = {\r
+    AT_BOUNDARY: AT_LOC_BOUNDARY,\r
+    AT_NON_BOUNDARY: AT_LOC_NON_BOUNDARY\r
+}\r
+\r
+AT_UNICODE = {\r
+    AT_BOUNDARY: AT_UNI_BOUNDARY,\r
+    AT_NON_BOUNDARY: AT_UNI_NON_BOUNDARY\r
+}\r
+\r
+CH_LOCALE = {\r
+    CATEGORY_DIGIT: CATEGORY_DIGIT,\r
+    CATEGORY_NOT_DIGIT: CATEGORY_NOT_DIGIT,\r
+    CATEGORY_SPACE: CATEGORY_SPACE,\r
+    CATEGORY_NOT_SPACE: CATEGORY_NOT_SPACE,\r
+    CATEGORY_WORD: CATEGORY_LOC_WORD,\r
+    CATEGORY_NOT_WORD: CATEGORY_LOC_NOT_WORD,\r
+    CATEGORY_LINEBREAK: CATEGORY_LINEBREAK,\r
+    CATEGORY_NOT_LINEBREAK: CATEGORY_NOT_LINEBREAK\r
+}\r
+\r
+CH_UNICODE = {\r
+    CATEGORY_DIGIT: CATEGORY_UNI_DIGIT,\r
+    CATEGORY_NOT_DIGIT: CATEGORY_UNI_NOT_DIGIT,\r
+    CATEGORY_SPACE: CATEGORY_UNI_SPACE,\r
+    CATEGORY_NOT_SPACE: CATEGORY_UNI_NOT_SPACE,\r
+    CATEGORY_WORD: CATEGORY_UNI_WORD,\r
+    CATEGORY_NOT_WORD: CATEGORY_UNI_NOT_WORD,\r
+    CATEGORY_LINEBREAK: CATEGORY_UNI_LINEBREAK,\r
+    CATEGORY_NOT_LINEBREAK: CATEGORY_UNI_NOT_LINEBREAK\r
+}\r
+\r
+# flags\r
+SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)\r
+SRE_FLAG_IGNORECASE = 2 # case insensitive\r
+SRE_FLAG_LOCALE = 4 # honour system locale\r
+SRE_FLAG_MULTILINE = 8 # treat target as multiline string\r
+SRE_FLAG_DOTALL = 16 # treat target as a single string\r
+SRE_FLAG_UNICODE = 32 # use unicode locale\r
+SRE_FLAG_VERBOSE = 64 # ignore whitespace and comments\r
+SRE_FLAG_DEBUG = 128 # debugging\r
+\r
+# flags for INFO primitive\r
+SRE_INFO_PREFIX = 1 # has prefix\r
+SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix)\r
+SRE_INFO_CHARSET = 4 # pattern starts with character from given set\r
+\r
+if __name__ == "__main__":\r
+    def dump(f, d, prefix):\r
+        items = d.items()\r
+        items.sort(key=lambda a: a[1])\r
+        for k, v in items:\r
+            f.write("#define %s_%s %s\n" % (prefix, k.upper(), v))\r
+    f = open("sre_constants.h", "w")\r
+    f.write("""\\r
+/*\r
+ * Secret Labs' Regular Expression Engine\r
+ *\r
+ * regular expression matching engine\r
+ *\r
+ * NOTE: This file is generated by sre_constants.py.  If you need\r
+ * to change anything in here, edit sre_constants.py and run it.\r
+ *\r
+ * Copyright (c) 1997-2001 by Secret Labs AB.  All rights reserved.\r
+ *\r
+ * See the _sre.c file for information on usage and redistribution.\r
+ */\r
+\r
+""")\r
+\r
+    f.write("#define SRE_MAGIC %d\n" % MAGIC)\r
+\r
+    dump(f, OPCODES, "SRE_OP")\r
+    dump(f, ATCODES, "SRE")\r
+    dump(f, CHCODES, "SRE")\r
+\r
+    f.write("#define SRE_FLAG_TEMPLATE %d\n" % SRE_FLAG_TEMPLATE)\r
+    f.write("#define SRE_FLAG_IGNORECASE %d\n" % SRE_FLAG_IGNORECASE)\r
+    f.write("#define SRE_FLAG_LOCALE %d\n" % SRE_FLAG_LOCALE)\r
+    f.write("#define SRE_FLAG_MULTILINE %d\n" % SRE_FLAG_MULTILINE)\r
+    f.write("#define SRE_FLAG_DOTALL %d\n" % SRE_FLAG_DOTALL)\r
+    f.write("#define SRE_FLAG_UNICODE %d\n" % SRE_FLAG_UNICODE)\r
+    f.write("#define SRE_FLAG_VERBOSE %d\n" % SRE_FLAG_VERBOSE)\r
+\r
+    f.write("#define SRE_INFO_PREFIX %d\n" % SRE_INFO_PREFIX)\r
+    f.write("#define SRE_INFO_LITERAL %d\n" % SRE_INFO_LITERAL)\r
+    f.write("#define SRE_INFO_CHARSET %d\n" % SRE_INFO_CHARSET)\r
+\r
+    f.close()\r
+    print "done"\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_parse.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_parse.py
new file mode 100644 (file)
index 0000000..803c09d
--- /dev/null
@@ -0,0 +1,834 @@
+#\r
+# Secret Labs' Regular Expression Engine\r
+#\r
+# convert re-style regular expression to sre pattern\r
+#\r
+# Copyright (c) 1998-2001 by Secret Labs AB.  All rights reserved.\r
+#\r
+# See the sre.py file for information on usage and redistribution.\r
+#\r
+\r
+"""Internal support module for sre"""\r
+\r
+# XXX: show string offset and offending character for all errors\r
+\r
+import sys\r
+\r
+from sre_constants import *\r
+\r
+SPECIAL_CHARS = ".\\[{()*+?^$|"\r
+REPEAT_CHARS = "*+?{"\r
+\r
+DIGITS = set("0123456789")\r
+\r
+OCTDIGITS = set("01234567")\r
+HEXDIGITS = set("0123456789abcdefABCDEF")\r
+\r
+WHITESPACE = set(" \t\n\r\v\f")\r
+\r
+ESCAPES = {\r
+    r"\a": (LITERAL, ord("\a")),\r
+    r"\b": (LITERAL, ord("\b")),\r
+    r"\f": (LITERAL, ord("\f")),\r
+    r"\n": (LITERAL, ord("\n")),\r
+    r"\r": (LITERAL, ord("\r")),\r
+    r"\t": (LITERAL, ord("\t")),\r
+    r"\v": (LITERAL, ord("\v")),\r
+    r"\\": (LITERAL, ord("\\"))\r
+}\r
+\r
+CATEGORIES = {\r
+    r"\A": (AT, AT_BEGINNING_STRING), # start of string\r
+    r"\b": (AT, AT_BOUNDARY),\r
+    r"\B": (AT, AT_NON_BOUNDARY),\r
+    r"\d": (IN, [(CATEGORY, CATEGORY_DIGIT)]),\r
+    r"\D": (IN, [(CATEGORY, CATEGORY_NOT_DIGIT)]),\r
+    r"\s": (IN, [(CATEGORY, CATEGORY_SPACE)]),\r
+    r"\S": (IN, [(CATEGORY, CATEGORY_NOT_SPACE)]),\r
+    r"\w": (IN, [(CATEGORY, CATEGORY_WORD)]),\r
+    r"\W": (IN, [(CATEGORY, CATEGORY_NOT_WORD)]),\r
+    r"\Z": (AT, AT_END_STRING), # end of string\r
+}\r
+\r
+FLAGS = {\r
+    # standard flags\r
+    "i": SRE_FLAG_IGNORECASE,\r
+    "L": SRE_FLAG_LOCALE,\r
+    "m": SRE_FLAG_MULTILINE,\r
+    "s": SRE_FLAG_DOTALL,\r
+    "x": SRE_FLAG_VERBOSE,\r
+    # extensions\r
+    "t": SRE_FLAG_TEMPLATE,\r
+    "u": SRE_FLAG_UNICODE,\r
+}\r
+\r
+class Pattern:\r
+    # master pattern object.  keeps track of global attributes\r
+    def __init__(self):\r
+        self.flags = 0\r
+        self.open = []\r
+        self.groups = 1\r
+        self.groupdict = {}\r
+        self.lookbehind = 0\r
+\r
+    def opengroup(self, name=None):\r
+        gid = self.groups\r
+        self.groups = gid + 1\r
+        if name is not None:\r
+            ogid = self.groupdict.get(name, None)\r
+            if ogid is not None:\r
+                raise error, ("redefinition of group name %s as group %d; "\r
+                              "was group %d" % (repr(name), gid,  ogid))\r
+            self.groupdict[name] = gid\r
+        self.open.append(gid)\r
+        return gid\r
+    def closegroup(self, gid):\r
+        self.open.remove(gid)\r
+    def checkgroup(self, gid):\r
+        return gid < self.groups and gid not in self.open\r
+\r
+class SubPattern:\r
+    # a subpattern, in intermediate form\r
+    def __init__(self, pattern, data=None):\r
+        self.pattern = pattern\r
+        if data is None:\r
+            data = []\r
+        self.data = data\r
+        self.width = None\r
+    def dump(self, level=0):\r
+        seqtypes = (tuple, list)\r
+        for op, av in self.data:\r
+            print level*"  " + op,\r
+            if op == IN:\r
+                # member sublanguage\r
+                print\r
+                for op, a in av:\r
+                    print (level+1)*"  " + op, a\r
+            elif op == BRANCH:\r
+                print\r
+                for i, a in enumerate(av[1]):\r
+                    if i:\r
+                        print level*"  " + "or"\r
+                    a.dump(level+1)\r
+            elif op == GROUPREF_EXISTS:\r
+                condgroup, item_yes, item_no = av\r
+                print condgroup\r
+                item_yes.dump(level+1)\r
+                if item_no:\r
+                    print level*"  " + "else"\r
+                    item_no.dump(level+1)\r
+            elif isinstance(av, seqtypes):\r
+                nl = 0\r
+                for a in av:\r
+                    if isinstance(a, SubPattern):\r
+                        if not nl:\r
+                            print\r
+                        a.dump(level+1)\r
+                        nl = 1\r
+                    else:\r
+                        print a,\r
+                        nl = 0\r
+                if not nl:\r
+                    print\r
+            else:\r
+                print av\r
+    def __repr__(self):\r
+        return repr(self.data)\r
+    def __len__(self):\r
+        return len(self.data)\r
+    def __delitem__(self, index):\r
+        del self.data[index]\r
+    def __getitem__(self, index):\r
+        if isinstance(index, slice):\r
+            return SubPattern(self.pattern, self.data[index])\r
+        return self.data[index]\r
+    def __setitem__(self, index, code):\r
+        self.data[index] = code\r
+    def insert(self, index, code):\r
+        self.data.insert(index, code)\r
+    def append(self, code):\r
+        self.data.append(code)\r
+    def getwidth(self):\r
+        # determine the width (min, max) for this subpattern\r
+        if self.width:\r
+            return self.width\r
+        lo = hi = 0\r
+        UNITCODES = (ANY, RANGE, IN, LITERAL, NOT_LITERAL, CATEGORY)\r
+        REPEATCODES = (MIN_REPEAT, MAX_REPEAT)\r
+        for op, av in self.data:\r
+            if op is BRANCH:\r
+                i = MAXREPEAT - 1\r
+                j = 0\r
+                for av in av[1]:\r
+                    l, h = av.getwidth()\r
+                    i = min(i, l)\r
+                    j = max(j, h)\r
+                lo = lo + i\r
+                hi = hi + j\r
+            elif op is CALL:\r
+                i, j = av.getwidth()\r
+                lo = lo + i\r
+                hi = hi + j\r
+            elif op is SUBPATTERN:\r
+                i, j = av[1].getwidth()\r
+                lo = lo + i\r
+                hi = hi + j\r
+            elif op in REPEATCODES:\r
+                i, j = av[2].getwidth()\r
+                lo = lo + i * av[0]\r
+                hi = hi + j * av[1]\r
+            elif op in UNITCODES:\r
+                lo = lo + 1\r
+                hi = hi + 1\r
+            elif op == SUCCESS:\r
+                break\r
+        self.width = min(lo, MAXREPEAT - 1), min(hi, MAXREPEAT)\r
+        return self.width\r
+\r
+class Tokenizer:\r
+    def __init__(self, string):\r
+        self.string = string\r
+        self.index = 0\r
+        self.__next()\r
+    def __next(self):\r
+        if self.index >= len(self.string):\r
+            self.next = None\r
+            return\r
+        char = self.string[self.index]\r
+        if char[0] == "\\":\r
+            try:\r
+                c = self.string[self.index + 1]\r
+            except IndexError:\r
+                raise error, "bogus escape (end of line)"\r
+            char = char + c\r
+        self.index = self.index + len(char)\r
+        self.next = char\r
+    def match(self, char, skip=1):\r
+        if char == self.next:\r
+            if skip:\r
+                self.__next()\r
+            return 1\r
+        return 0\r
+    def get(self):\r
+        this = self.next\r
+        self.__next()\r
+        return this\r
+    def tell(self):\r
+        return self.index, self.next\r
+    def seek(self, index):\r
+        self.index, self.next = index\r
+\r
+def isident(char):\r
+    return "a" <= char <= "z" or "A" <= char <= "Z" or char == "_"\r
+\r
+def isdigit(char):\r
+    return "0" <= char <= "9"\r
+\r
+def isname(name):\r
+    # check that group name is a valid string\r
+    if not isident(name[0]):\r
+        return False\r
+    for char in name[1:]:\r
+        if not isident(char) and not isdigit(char):\r
+            return False\r
+    return True\r
+\r
+def _class_escape(source, escape):\r
+    # handle escape code inside character class\r
+    code = ESCAPES.get(escape)\r
+    if code:\r
+        return code\r
+    code = CATEGORIES.get(escape)\r
+    if code and code[0] == IN:\r
+        return code\r
+    try:\r
+        c = escape[1:2]\r
+        if c == "x":\r
+            # hexadecimal escape (exactly two digits)\r
+            while source.next in HEXDIGITS and len(escape) < 4:\r
+                escape = escape + source.get()\r
+            escape = escape[2:]\r
+            if len(escape) != 2:\r
+                raise error, "bogus escape: %s" % repr("\\" + escape)\r
+            return LITERAL, int(escape, 16) & 0xff\r
+        elif c in OCTDIGITS:\r
+            # octal escape (up to three digits)\r
+            while source.next in OCTDIGITS and len(escape) < 4:\r
+                escape = escape + source.get()\r
+            escape = escape[1:]\r
+            return LITERAL, int(escape, 8) & 0xff\r
+        elif c in DIGITS:\r
+            raise error, "bogus escape: %s" % repr(escape)\r
+        if len(escape) == 2:\r
+            return LITERAL, ord(escape[1])\r
+    except ValueError:\r
+        pass\r
+    raise error, "bogus escape: %s" % repr(escape)\r
+\r
+def _escape(source, escape, state):\r
+    # handle escape code in expression\r
+    code = CATEGORIES.get(escape)\r
+    if code:\r
+        return code\r
+    code = ESCAPES.get(escape)\r
+    if code:\r
+        return code\r
+    try:\r
+        c = escape[1:2]\r
+        if c == "x":\r
+            # hexadecimal escape\r
+            while source.next in HEXDIGITS and len(escape) < 4:\r
+                escape = escape + source.get()\r
+            if len(escape) != 4:\r
+                raise ValueError\r
+            return LITERAL, int(escape[2:], 16) & 0xff\r
+        elif c == "0":\r
+            # octal escape\r
+            while source.next in OCTDIGITS and len(escape) < 4:\r
+                escape = escape + source.get()\r
+            return LITERAL, int(escape[1:], 8) & 0xff\r
+        elif c in DIGITS:\r
+            # octal escape *or* decimal group reference (sigh)\r
+            if source.next in DIGITS:\r
+                escape = escape + source.get()\r
+                if (escape[1] in OCTDIGITS and escape[2] in OCTDIGITS and\r
+                    source.next in OCTDIGITS):\r
+                    # got three octal digits; this is an octal escape\r
+                    escape = escape + source.get()\r
+                    return LITERAL, int(escape[1:], 8) & 0xff\r
+            # not an octal escape, so this is a group reference\r
+            group = int(escape[1:])\r
+            if group < state.groups:\r
+                if not state.checkgroup(group):\r
+                    raise error, "cannot refer to open group"\r
+                if state.lookbehind:\r
+                    import warnings\r
+                    warnings.warn('group references in lookbehind '\r
+                                  'assertions are not supported',\r
+                                  RuntimeWarning)\r
+                return GROUPREF, group\r
+            raise ValueError\r
+        if len(escape) == 2:\r
+            return LITERAL, ord(escape[1])\r
+    except ValueError:\r
+        pass\r
+    raise error, "bogus escape: %s" % repr(escape)\r
+\r
+def _parse_sub(source, state, nested=1):\r
+    # parse an alternation: a|b|c\r
+\r
+    items = []\r
+    itemsappend = items.append\r
+    sourcematch = source.match\r
+    while 1:\r
+        itemsappend(_parse(source, state))\r
+        if sourcematch("|"):\r
+            continue\r
+        if not nested:\r
+            break\r
+        if not source.next or sourcematch(")", 0):\r
+            break\r
+        else:\r
+            raise error, "pattern not properly closed"\r
+\r
+    if len(items) == 1:\r
+        return items[0]\r
+\r
+    subpattern = SubPattern(state)\r
+    subpatternappend = subpattern.append\r
+\r
+    # check if all items share a common prefix\r
+    while 1:\r
+        prefix = None\r
+        for item in items:\r
+            if not item:\r
+                break\r
+            if prefix is None:\r
+                prefix = item[0]\r
+            elif item[0] != prefix:\r
+                break\r
+        else:\r
+            # all subitems start with a common "prefix".\r
+            # move it out of the branch\r
+            for item in items:\r
+                del item[0]\r
+            subpatternappend(prefix)\r
+            continue # check next one\r
+        break\r
+\r
+    # check if the branch can be replaced by a character set\r
+    for item in items:\r
+        if len(item) != 1 or item[0][0] != LITERAL:\r
+            break\r
+    else:\r
+        # we can store this as a character set instead of a\r
+        # branch (the compiler may optimize this even more)\r
+        set = []\r
+        setappend = set.append\r
+        for item in items:\r
+            setappend(item[0])\r
+        subpatternappend((IN, set))\r
+        return subpattern\r
+\r
+    subpattern.append((BRANCH, (None, items)))\r
+    return subpattern\r
+\r
+def _parse_sub_cond(source, state, condgroup):\r
+    item_yes = _parse(source, state)\r
+    if source.match("|"):\r
+        item_no = _parse(source, state)\r
+        if source.match("|"):\r
+            raise error, "conditional backref with more than two branches"\r
+    else:\r
+        item_no = None\r
+    if source.next and not source.match(")", 0):\r
+        raise error, "pattern not properly closed"\r
+    subpattern = SubPattern(state)\r
+    subpattern.append((GROUPREF_EXISTS, (condgroup, item_yes, item_no)))\r
+    return subpattern\r
+\r
+_PATTERNENDERS = set("|)")\r
+_ASSERTCHARS = set("=!<")\r
+_LOOKBEHINDASSERTCHARS = set("=!")\r
+_REPEATCODES = set([MIN_REPEAT, MAX_REPEAT])\r
+\r
+def _parse(source, state):\r
+    # parse a simple pattern\r
+    subpattern = SubPattern(state)\r
+\r
+    # precompute constants into local variables\r
+    subpatternappend = subpattern.append\r
+    sourceget = source.get\r
+    sourcematch = source.match\r
+    _len = len\r
+    PATTERNENDERS = _PATTERNENDERS\r
+    ASSERTCHARS = _ASSERTCHARS\r
+    LOOKBEHINDASSERTCHARS = _LOOKBEHINDASSERTCHARS\r
+    REPEATCODES = _REPEATCODES\r
+\r
+    while 1:\r
+\r
+        if source.next in PATTERNENDERS:\r
+            break # end of subpattern\r
+        this = sourceget()\r
+        if this is None:\r
+            break # end of pattern\r
+\r
+        if state.flags & SRE_FLAG_VERBOSE:\r
+            # skip whitespace and comments\r
+            if this in WHITESPACE:\r
+                continue\r
+            if this == "#":\r
+                while 1:\r
+                    this = sourceget()\r
+                    if this in (None, "\n"):\r
+                        break\r
+                continue\r
+\r
+        if this and this[0] not in SPECIAL_CHARS:\r
+            subpatternappend((LITERAL, ord(this)))\r
+\r
+        elif this == "[":\r
+            # character set\r
+            set = []\r
+            setappend = set.append\r
+##          if sourcematch(":"):\r
+##              pass # handle character classes\r
+            if sourcematch("^"):\r
+                setappend((NEGATE, None))\r
+            # check remaining characters\r
+            start = set[:]\r
+            while 1:\r
+                this = sourceget()\r
+                if this == "]" and set != start:\r
+                    break\r
+                elif this and this[0] == "\\":\r
+                    code1 = _class_escape(source, this)\r
+                elif this:\r
+                    code1 = LITERAL, ord(this)\r
+                else:\r
+                    raise error, "unexpected end of regular expression"\r
+                if sourcematch("-"):\r
+                    # potential range\r
+                    this = sourceget()\r
+                    if this == "]":\r
+                        if code1[0] is IN:\r
+                            code1 = code1[1][0]\r
+                        setappend(code1)\r
+                        setappend((LITERAL, ord("-")))\r
+                        break\r
+                    elif this:\r
+                        if this[0] == "\\":\r
+                            code2 = _class_escape(source, this)\r
+                        else:\r
+                            code2 = LITERAL, ord(this)\r
+                        if code1[0] != LITERAL or code2[0] != LITERAL:\r
+                            raise error, "bad character range"\r
+                        lo = code1[1]\r
+                        hi = code2[1]\r
+                        if hi < lo:\r
+                            raise error, "bad character range"\r
+                        setappend((RANGE, (lo, hi)))\r
+                    else:\r
+                        raise error, "unexpected end of regular expression"\r
+                else:\r
+                    if code1[0] is IN:\r
+                        code1 = code1[1][0]\r
+                    setappend(code1)\r
+\r
+            # XXX: <fl> should move set optimization to compiler!\r
+            if _len(set)==1 and set[0][0] is LITERAL:\r
+                subpatternappend(set[0]) # optimization\r
+            elif _len(set)==2 and set[0][0] is NEGATE and set[1][0] is LITERAL:\r
+                subpatternappend((NOT_LITERAL, set[1][1])) # optimization\r
+            else:\r
+                # XXX: <fl> should add charmap optimization here\r
+                subpatternappend((IN, set))\r
+\r
+        elif this and this[0] in REPEAT_CHARS:\r
+            # repeat previous item\r
+            if this == "?":\r
+                min, max = 0, 1\r
+            elif this == "*":\r
+                min, max = 0, MAXREPEAT\r
+\r
+            elif this == "+":\r
+                min, max = 1, MAXREPEAT\r
+            elif this == "{":\r
+                if source.next == "}":\r
+                    subpatternappend((LITERAL, ord(this)))\r
+                    continue\r
+                here = source.tell()\r
+                min, max = 0, MAXREPEAT\r
+                lo = hi = ""\r
+                while source.next in DIGITS:\r
+                    lo = lo + source.get()\r
+                if sourcematch(","):\r
+                    while source.next in DIGITS:\r
+                        hi = hi + sourceget()\r
+                else:\r
+                    hi = lo\r
+                if not sourcematch("}"):\r
+                    subpatternappend((LITERAL, ord(this)))\r
+                    source.seek(here)\r
+                    continue\r
+                if lo:\r
+                    min = int(lo)\r
+                    if min >= MAXREPEAT:\r
+                        raise OverflowError("the repetition number is too large")\r
+                if hi:\r
+                    max = int(hi)\r
+                    if max >= MAXREPEAT:\r
+                        raise OverflowError("the repetition number is too large")\r
+                    if max < min:\r
+                        raise error("bad repeat interval")\r
+            else:\r
+                raise error, "not supported"\r
+            # figure out which item to repeat\r
+            if subpattern:\r
+                item = subpattern[-1:]\r
+            else:\r
+                item = None\r
+            if not item or (_len(item) == 1 and item[0][0] == AT):\r
+                raise error, "nothing to repeat"\r
+            if item[0][0] in REPEATCODES:\r
+                raise error, "multiple repeat"\r
+            if sourcematch("?"):\r
+                subpattern[-1] = (MIN_REPEAT, (min, max, item))\r
+            else:\r
+                subpattern[-1] = (MAX_REPEAT, (min, max, item))\r
+\r
+        elif this == ".":\r
+            subpatternappend((ANY, None))\r
+\r
+        elif this == "(":\r
+            group = 1\r
+            name = None\r
+            condgroup = None\r
+            if sourcematch("?"):\r
+                group = 0\r
+                # options\r
+                if sourcematch("P"):\r
+                    # python extensions\r
+                    if sourcematch("<"):\r
+                        # named group: skip forward to end of name\r
+                        name = ""\r
+                        while 1:\r
+                            char = sourceget()\r
+                            if char is None:\r
+                                raise error, "unterminated name"\r
+                            if char == ">":\r
+                                break\r
+                            name = name + char\r
+                        group = 1\r
+                        if not name:\r
+                            raise error("missing group name")\r
+                        if not isname(name):\r
+                            raise error("bad character in group name %r" %\r
+                                        name)\r
+                    elif sourcematch("="):\r
+                        # named backreference\r
+                        name = ""\r
+                        while 1:\r
+                            char = sourceget()\r
+                            if char is None:\r
+                                raise error, "unterminated name"\r
+                            if char == ")":\r
+                                break\r
+                            name = name + char\r
+                        if not name:\r
+                            raise error("missing group name")\r
+                        if not isname(name):\r
+                            raise error("bad character in backref group name "\r
+                                        "%r" % name)\r
+                        gid = state.groupdict.get(name)\r
+                        if gid is None:\r
+                            msg = "unknown group name: {0!r}".format(name)\r
+                            raise error(msg)\r
+                        if state.lookbehind:\r
+                            import warnings\r
+                            warnings.warn('group references in lookbehind '\r
+                                          'assertions are not supported',\r
+                                          RuntimeWarning)\r
+                        subpatternappend((GROUPREF, gid))\r
+                        continue\r
+                    else:\r
+                        char = sourceget()\r
+                        if char is None:\r
+                            raise error, "unexpected end of pattern"\r
+                        raise error, "unknown specifier: ?P%s" % char\r
+                elif sourcematch(":"):\r
+                    # non-capturing group\r
+                    group = 2\r
+                elif sourcematch("#"):\r
+                    # comment\r
+                    while 1:\r
+                        if source.next is None or source.next == ")":\r
+                            break\r
+                        sourceget()\r
+                    if not sourcematch(")"):\r
+                        raise error, "unbalanced parenthesis"\r
+                    continue\r
+                elif source.next in ASSERTCHARS:\r
+                    # lookahead assertions\r
+                    char = sourceget()\r
+                    dir = 1\r
+                    if char == "<":\r
+                        if source.next not in LOOKBEHINDASSERTCHARS:\r
+                            raise error, "syntax error"\r
+                        dir = -1 # lookbehind\r
+                        char = sourceget()\r
+                        state.lookbehind += 1\r
+                    p = _parse_sub(source, state)\r
+                    if dir < 0:\r
+                        state.lookbehind -= 1\r
+                    if not sourcematch(")"):\r
+                        raise error, "unbalanced parenthesis"\r
+                    if char == "=":\r
+                        subpatternappend((ASSERT, (dir, p)))\r
+                    else:\r
+                        subpatternappend((ASSERT_NOT, (dir, p)))\r
+                    continue\r
+                elif sourcematch("("):\r
+                    # conditional backreference group\r
+                    condname = ""\r
+                    while 1:\r
+                        char = sourceget()\r
+                        if char is None:\r
+                            raise error, "unterminated name"\r
+                        if char == ")":\r
+                            break\r
+                        condname = condname + char\r
+                    group = 2\r
+                    if not condname:\r
+                        raise error("missing group name")\r
+                    if isname(condname):\r
+                        condgroup = state.groupdict.get(condname)\r
+                        if condgroup is None:\r
+                            msg = "unknown group name: {0!r}".format(condname)\r
+                            raise error(msg)\r
+                    else:\r
+                        try:\r
+                            condgroup = int(condname)\r
+                        except ValueError:\r
+                            raise error, "bad character in group name"\r
+                    if state.lookbehind:\r
+                        import warnings\r
+                        warnings.warn('group references in lookbehind '\r
+                                      'assertions are not supported',\r
+                                      RuntimeWarning)\r
+                else:\r
+                    # flags\r
+                    if not source.next in FLAGS:\r
+                        raise error, "unexpected end of pattern"\r
+                    while source.next in FLAGS:\r
+                        state.flags = state.flags | FLAGS[sourceget()]\r
+            if group:\r
+                # parse group contents\r
+                if group == 2:\r
+                    # anonymous group\r
+                    group = None\r
+                else:\r
+                    group = state.opengroup(name)\r
+                if condgroup:\r
+                    p = _parse_sub_cond(source, state, condgroup)\r
+                else:\r
+                    p = _parse_sub(source, state)\r
+                if not sourcematch(")"):\r
+                    raise error, "unbalanced parenthesis"\r
+                if group is not None:\r
+                    state.closegroup(group)\r
+                subpatternappend((SUBPATTERN, (group, p)))\r
+            else:\r
+                while 1:\r
+                    char = sourceget()\r
+                    if char is None:\r
+                        raise error, "unexpected end of pattern"\r
+                    if char == ")":\r
+                        break\r
+                    raise error, "unknown extension"\r
+\r
+        elif this == "^":\r
+            subpatternappend((AT, AT_BEGINNING))\r
+\r
+        elif this == "$":\r
+            subpattern.append((AT, AT_END))\r
+\r
+        elif this and this[0] == "\\":\r
+            code = _escape(source, this, state)\r
+            subpatternappend(code)\r
+\r
+        else:\r
+            raise error, "parser error"\r
+\r
+    return subpattern\r
+\r
+def parse(str, flags=0, pattern=None):\r
+    # parse 're' pattern into list of (opcode, argument) tuples\r
+\r
+    source = Tokenizer(str)\r
+\r
+    if pattern is None:\r
+        pattern = Pattern()\r
+    pattern.flags = flags\r
+    pattern.str = str\r
+\r
+    p = _parse_sub(source, pattern, 0)\r
+\r
+    tail = source.get()\r
+    if tail == ")":\r
+        raise error, "unbalanced parenthesis"\r
+    elif tail:\r
+        raise error, "bogus characters at end of regular expression"\r
+\r
+    if flags & SRE_FLAG_DEBUG:\r
+        p.dump()\r
+\r
+    if not (flags & SRE_FLAG_VERBOSE) and p.pattern.flags & SRE_FLAG_VERBOSE:\r
+        # the VERBOSE flag was switched on inside the pattern.  to be\r
+        # on the safe side, we'll parse the whole thing again...\r
+        return parse(str, p.pattern.flags)\r
+\r
+    return p\r
+\r
+def parse_template(source, pattern):\r
+    # parse 're' replacement string into list of literals and\r
+    # group references\r
+    s = Tokenizer(source)\r
+    sget = s.get\r
+    p = []\r
+    a = p.append\r
+    def literal(literal, p=p, pappend=a):\r
+        if p and p[-1][0] is LITERAL:\r
+            p[-1] = LITERAL, p[-1][1] + literal\r
+        else:\r
+            pappend((LITERAL, literal))\r
+    sep = source[:0]\r
+    if type(sep) is type(""):\r
+        makechar = chr\r
+    else:\r
+        makechar = unichr\r
+    while 1:\r
+        this = sget()\r
+        if this is None:\r
+            break # end of replacement string\r
+        if this and this[0] == "\\":\r
+            # group\r
+            c = this[1:2]\r
+            if c == "g":\r
+                name = ""\r
+                if s.match("<"):\r
+                    while 1:\r
+                        char = sget()\r
+                        if char is None:\r
+                            raise error, "unterminated group name"\r
+                        if char == ">":\r
+                            break\r
+                        name = name + char\r
+                if not name:\r
+                    raise error, "missing group name"\r
+                try:\r
+                    index = int(name)\r
+                    if index < 0:\r
+                        raise error, "negative group number"\r
+                except ValueError:\r
+                    if not isname(name):\r
+                        raise error, "bad character in group name"\r
+                    try:\r
+                        index = pattern.groupindex[name]\r
+                    except KeyError:\r
+                        msg = "unknown group name: {0!r}".format(name)\r
+                        raise IndexError(msg)\r
+                a((MARK, index))\r
+            elif c == "0":\r
+                if s.next in OCTDIGITS:\r
+                    this = this + sget()\r
+                    if s.next in OCTDIGITS:\r
+                        this = this + sget()\r
+                literal(makechar(int(this[1:], 8) & 0xff))\r
+            elif c in DIGITS:\r
+                isoctal = False\r
+                if s.next in DIGITS:\r
+                    this = this + sget()\r
+                    if (c in OCTDIGITS and this[2] in OCTDIGITS and\r
+                        s.next in OCTDIGITS):\r
+                        this = this + sget()\r
+                        isoctal = True\r
+                        literal(makechar(int(this[1:], 8) & 0xff))\r
+                if not isoctal:\r
+                    a((MARK, int(this[1:])))\r
+            else:\r
+                try:\r
+                    this = makechar(ESCAPES[this][1])\r
+                except KeyError:\r
+                    pass\r
+                literal(this)\r
+        else:\r
+            literal(this)\r
+    # convert template to groups and literals lists\r
+    i = 0\r
+    groups = []\r
+    groupsappend = groups.append\r
+    literals = [None] * len(p)\r
+    for c, s in p:\r
+        if c is MARK:\r
+            groupsappend((i, s))\r
+            # literal[i] is already None\r
+        else:\r
+            literals[i] = s\r
+        i = i + 1\r
+    return groups, literals\r
+\r
+def expand_template(template, match):\r
+    g = match.group\r
+    sep = match.string[:0]\r
+    groups, literals = template\r
+    literals = literals[:]\r
+    try:\r
+        for index, group in groups:\r
+            literals[index] = s = g(group)\r
+            if s is None:\r
+                raise error, "unmatched group"\r
+    except IndexError:\r
+        raise error, "invalid group reference"\r
+    return sep.join(literals)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/stat.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/stat.py
new file mode 100644 (file)
index 0000000..e917fc1
--- /dev/null
@@ -0,0 +1,96 @@
+"""Constants/functions for interpreting results of os.stat() and os.lstat().\r
+\r
+Suggested usage: from stat import *\r
+"""\r
+\r
+# Indices for stat struct members in the tuple returned by os.stat()\r
+\r
+ST_MODE  = 0\r
+ST_INO   = 1\r
+ST_DEV   = 2\r
+ST_NLINK = 3\r
+ST_UID   = 4\r
+ST_GID   = 5\r
+ST_SIZE  = 6\r
+ST_ATIME = 7\r
+ST_MTIME = 8\r
+ST_CTIME = 9\r
+\r
+# Extract bits from the mode\r
+\r
+def S_IMODE(mode):\r
+    return mode & 07777\r
+\r
+def S_IFMT(mode):\r
+    return mode & 0170000\r
+\r
+# Constants used as S_IFMT() for various file types\r
+# (not all are implemented on all systems)\r
+\r
+S_IFDIR  = 0040000\r
+S_IFCHR  = 0020000\r
+S_IFBLK  = 0060000\r
+S_IFREG  = 0100000\r
+S_IFIFO  = 0010000\r
+S_IFLNK  = 0120000\r
+S_IFSOCK = 0140000\r
+\r
+# Functions to test for each file type\r
+\r
+def S_ISDIR(mode):\r
+    return S_IFMT(mode) == S_IFDIR\r
+\r
+def S_ISCHR(mode):\r
+    return S_IFMT(mode) == S_IFCHR\r
+\r
+def S_ISBLK(mode):\r
+    return S_IFMT(mode) == S_IFBLK\r
+\r
+def S_ISREG(mode):\r
+    return S_IFMT(mode) == S_IFREG\r
+\r
+def S_ISFIFO(mode):\r
+    return S_IFMT(mode) == S_IFIFO\r
+\r
+def S_ISLNK(mode):\r
+    return S_IFMT(mode) == S_IFLNK\r
+\r
+def S_ISSOCK(mode):\r
+    return S_IFMT(mode) == S_IFSOCK\r
+\r
+# Names for permission bits\r
+\r
+S_ISUID = 04000\r
+S_ISGID = 02000\r
+S_ENFMT = S_ISGID\r
+S_ISVTX = 01000\r
+S_IREAD = 00400\r
+S_IWRITE = 00200\r
+S_IEXEC = 00100\r
+S_IRWXU = 00700\r
+S_IRUSR = 00400\r
+S_IWUSR = 00200\r
+S_IXUSR = 00100\r
+S_IRWXG = 00070\r
+S_IRGRP = 00040\r
+S_IWGRP = 00020\r
+S_IXGRP = 00010\r
+S_IRWXO = 00007\r
+S_IROTH = 00004\r
+S_IWOTH = 00002\r
+S_IXOTH = 00001\r
+\r
+# Names for file flags\r
+\r
+UF_NODUMP    = 0x00000001\r
+UF_IMMUTABLE = 0x00000002\r
+UF_APPEND    = 0x00000004\r
+UF_OPAQUE    = 0x00000008\r
+UF_NOUNLINK  = 0x00000010\r
+UF_COMPRESSED = 0x00000020  # OS X: file is hfs-compressed\r
+UF_HIDDEN    = 0x00008000   # OS X: file should not be displayed\r
+SF_ARCHIVED  = 0x00010000\r
+SF_IMMUTABLE = 0x00020000\r
+SF_APPEND    = 0x00040000\r
+SF_NOUNLINK  = 0x00100000\r
+SF_SNAPSHOT  = 0x00200000\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/string.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/string.py
new file mode 100644 (file)
index 0000000..3509872
--- /dev/null
@@ -0,0 +1,656 @@
+"""A collection of string operations (most are no longer used).\r
+\r
+Warning: most of the code you see here isn't normally used nowadays.\r
+Beginning with Python 1.6, many of these functions are implemented as\r
+methods on the standard string object. They used to be implemented by\r
+a built-in module called strop, but strop is now obsolete itself.\r
+\r
+Public module variables:\r
+\r
+whitespace -- a string containing all characters considered whitespace\r
+lowercase -- a string containing all characters considered lowercase letters\r
+uppercase -- a string containing all characters considered uppercase letters\r
+letters -- a string containing all characters considered letters\r
+digits -- a string containing all characters considered decimal digits\r
+hexdigits -- a string containing all characters considered hexadecimal digits\r
+octdigits -- a string containing all characters considered octal digits\r
+punctuation -- a string containing all characters considered punctuation\r
+printable -- a string containing all characters considered printable\r
+\r
+"""\r
+\r
+# Some strings for ctype-style character classification\r
+whitespace = ' \t\n\r\v\f'\r
+lowercase = 'abcdefghijklmnopqrstuvwxyz'\r
+uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\r
+letters = lowercase + uppercase\r
+ascii_lowercase = lowercase\r
+ascii_uppercase = uppercase\r
+ascii_letters = ascii_lowercase + ascii_uppercase\r
+digits = '0123456789'\r
+hexdigits = digits + 'abcdef' + 'ABCDEF'\r
+octdigits = '01234567'\r
+punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""\r
+printable = digits + letters + punctuation + whitespace\r
+\r
+# Case conversion helpers\r
+# Use str to convert Unicode literal in case of -U\r
+l = map(chr, xrange(256))\r
+_idmap = str('').join(l)\r
+del l\r
+\r
+# Functions which aren't available as string methods.\r
+\r
+# Capitalize the words in a string, e.g. " aBc  dEf " -> "Abc Def".\r
+def capwords(s, sep=None):\r
+    """capwords(s [,sep]) -> string\r
+\r
+    Split the argument into words using split, capitalize each\r
+    word using capitalize, and join the capitalized words using\r
+    join.  If the optional second argument sep is absent or None,\r
+    runs of whitespace characters are replaced by a single space\r
+    and leading and trailing whitespace are removed, otherwise\r
+    sep is used to split and join the words.\r
+\r
+    """\r
+    return (sep or ' ').join(x.capitalize() for x in s.split(sep))\r
+\r
+\r
+# Construct a translation string\r
+_idmapL = None\r
+def maketrans(fromstr, tostr):\r
+    """maketrans(frm, to) -> string\r
+\r
+    Return a translation table (a string of 256 bytes long)\r
+    suitable for use in string.translate.  The strings frm and to\r
+    must be of the same length.\r
+\r
+    """\r
+    if len(fromstr) != len(tostr):\r
+        raise ValueError, "maketrans arguments must have same length"\r
+    global _idmapL\r
+    if not _idmapL:\r
+        _idmapL = list(_idmap)\r
+    L = _idmapL[:]\r
+    fromstr = map(ord, fromstr)\r
+    for i in range(len(fromstr)):\r
+        L[fromstr[i]] = tostr[i]\r
+    return ''.join(L)\r
+\r
+\r
+\r
+####################################################################\r
+import re as _re\r
+\r
+class _multimap:\r
+    """Helper class for combining multiple mappings.\r
+\r
+    Used by .{safe_,}substitute() to combine the mapping and keyword\r
+    arguments.\r
+    """\r
+    def __init__(self, primary, secondary):\r
+        self._primary = primary\r
+        self._secondary = secondary\r
+\r
+    def __getitem__(self, key):\r
+        try:\r
+            return self._primary[key]\r
+        except KeyError:\r
+            return self._secondary[key]\r
+\r
+\r
+class _TemplateMetaclass(type):\r
+    pattern = r"""\r
+    %(delim)s(?:\r
+      (?P<escaped>%(delim)s) |   # Escape sequence of two delimiters\r
+      (?P<named>%(id)s)      |   # delimiter and a Python identifier\r
+      {(?P<braced>%(id)s)}   |   # delimiter and a braced identifier\r
+      (?P<invalid>)              # Other ill-formed delimiter exprs\r
+    )\r
+    """\r
+\r
+    def __init__(cls, name, bases, dct):\r
+        super(_TemplateMetaclass, cls).__init__(name, bases, dct)\r
+        if 'pattern' in dct:\r
+            pattern = cls.pattern\r
+        else:\r
+            pattern = _TemplateMetaclass.pattern % {\r
+                'delim' : _re.escape(cls.delimiter),\r
+                'id'    : cls.idpattern,\r
+                }\r
+        cls.pattern = _re.compile(pattern, _re.IGNORECASE | _re.VERBOSE)\r
+\r
+\r
+class Template:\r
+    """A string class for supporting $-substitutions."""\r
+    __metaclass__ = _TemplateMetaclass\r
+\r
+    delimiter = '$'\r
+    idpattern = r'[_a-z][_a-z0-9]*'\r
+\r
+    def __init__(self, template):\r
+        self.template = template\r
+\r
+    # Search for $$, $identifier, ${identifier}, and any bare $'s\r
+\r
+    def _invalid(self, mo):\r
+        i = mo.start('invalid')\r
+        lines = self.template[:i].splitlines(True)\r
+        if not lines:\r
+            colno = 1\r
+            lineno = 1\r
+        else:\r
+            colno = i - len(''.join(lines[:-1]))\r
+            lineno = len(lines)\r
+        raise ValueError('Invalid placeholder in string: line %d, col %d' %\r
+                         (lineno, colno))\r
+\r
+    def substitute(*args, **kws):\r
+        if not args:\r
+            raise TypeError("descriptor 'substitute' of 'Template' object "\r
+                            "needs an argument")\r
+        self, args = args[0], args[1:]  # allow the "self" keyword be passed\r
+        if len(args) > 1:\r
+            raise TypeError('Too many positional arguments')\r
+        if not args:\r
+            mapping = kws\r
+        elif kws:\r
+            mapping = _multimap(kws, args[0])\r
+        else:\r
+            mapping = args[0]\r
+        # Helper function for .sub()\r
+        def convert(mo):\r
+            # Check the most common path first.\r
+            named = mo.group('named') or mo.group('braced')\r
+            if named is not None:\r
+                val = mapping[named]\r
+                # We use this idiom instead of str() because the latter will\r
+                # fail if val is a Unicode containing non-ASCII characters.\r
+                return '%s' % (val,)\r
+            if mo.group('escaped') is not None:\r
+                return self.delimiter\r
+            if mo.group('invalid') is not None:\r
+                self._invalid(mo)\r
+            raise ValueError('Unrecognized named group in pattern',\r
+                             self.pattern)\r
+        return self.pattern.sub(convert, self.template)\r
+\r
+    def safe_substitute(*args, **kws):\r
+        if not args:\r
+            raise TypeError("descriptor 'safe_substitute' of 'Template' object "\r
+                            "needs an argument")\r
+        self, args = args[0], args[1:]  # allow the "self" keyword be passed\r
+        if len(args) > 1:\r
+            raise TypeError('Too many positional arguments')\r
+        if not args:\r
+            mapping = kws\r
+        elif kws:\r
+            mapping = _multimap(kws, args[0])\r
+        else:\r
+            mapping = args[0]\r
+        # Helper function for .sub()\r
+        def convert(mo):\r
+            named = mo.group('named') or mo.group('braced')\r
+            if named is not None:\r
+                try:\r
+                    # We use this idiom instead of str() because the latter\r
+                    # will fail if val is a Unicode containing non-ASCII\r
+                    return '%s' % (mapping[named],)\r
+                except KeyError:\r
+                    return mo.group()\r
+            if mo.group('escaped') is not None:\r
+                return self.delimiter\r
+            if mo.group('invalid') is not None:\r
+                return mo.group()\r
+            raise ValueError('Unrecognized named group in pattern',\r
+                             self.pattern)\r
+        return self.pattern.sub(convert, self.template)\r
+\r
+\r
+\r
+####################################################################\r
+# NOTE: Everything below here is deprecated.  Use string methods instead.\r
+# This stuff will go away in Python 3.0.\r
+\r
+# Backward compatible names for exceptions\r
+index_error = ValueError\r
+atoi_error = ValueError\r
+atof_error = ValueError\r
+atol_error = ValueError\r
+\r
+# convert UPPER CASE letters to lower case\r
+def lower(s):\r
+    """lower(s) -> string\r
+\r
+    Return a copy of the string s converted to lowercase.\r
+\r
+    """\r
+    return s.lower()\r
+\r
+# Convert lower case letters to UPPER CASE\r
+def upper(s):\r
+    """upper(s) -> string\r
+\r
+    Return a copy of the string s converted to uppercase.\r
+\r
+    """\r
+    return s.upper()\r
+\r
+# Swap lower case letters and UPPER CASE\r
+def swapcase(s):\r
+    """swapcase(s) -> string\r
+\r
+    Return a copy of the string s with upper case characters\r
+    converted to lowercase and vice versa.\r
+\r
+    """\r
+    return s.swapcase()\r
+\r
+# Strip leading and trailing tabs and spaces\r
+def strip(s, chars=None):\r
+    """strip(s [,chars]) -> string\r
+\r
+    Return a copy of the string s with leading and trailing\r
+    whitespace removed.\r
+    If chars is given and not None, remove characters in chars instead.\r
+    If chars is unicode, S will be converted to unicode before stripping.\r
+\r
+    """\r
+    return s.strip(chars)\r
+\r
+# Strip leading tabs and spaces\r
+def lstrip(s, chars=None):\r
+    """lstrip(s [,chars]) -> string\r
+\r
+    Return a copy of the string s with leading whitespace removed.\r
+    If chars is given and not None, remove characters in chars instead.\r
+\r
+    """\r
+    return s.lstrip(chars)\r
+\r
+# Strip trailing tabs and spaces\r
+def rstrip(s, chars=None):\r
+    """rstrip(s [,chars]) -> string\r
+\r
+    Return a copy of the string s with trailing whitespace removed.\r
+    If chars is given and not None, remove characters in chars instead.\r
+\r
+    """\r
+    return s.rstrip(chars)\r
+\r
+\r
+# Split a string into a list of space/tab-separated words\r
+def split(s, sep=None, maxsplit=-1):\r
+    """split(s [,sep [,maxsplit]]) -> list of strings\r
+\r
+    Return a list of the words in the string s, using sep as the\r
+    delimiter string.  If maxsplit is given, splits at no more than\r
+    maxsplit places (resulting in at most maxsplit+1 words).  If sep\r
+    is not specified or is None, any whitespace string is a separator.\r
+\r
+    (split and splitfields are synonymous)\r
+\r
+    """\r
+    return s.split(sep, maxsplit)\r
+splitfields = split\r
+\r
+# Split a string into a list of space/tab-separated words\r
+def rsplit(s, sep=None, maxsplit=-1):\r
+    """rsplit(s [,sep [,maxsplit]]) -> list of strings\r
+\r
+    Return a list of the words in the string s, using sep as the\r
+    delimiter string, starting at the end of the string and working\r
+    to the front.  If maxsplit is given, at most maxsplit splits are\r
+    done. If sep is not specified or is None, any whitespace string\r
+    is a separator.\r
+    """\r
+    return s.rsplit(sep, maxsplit)\r
+\r
+# Join fields with optional separator\r
+def join(words, sep = ' '):\r
+    """join(list [,sep]) -> string\r
+\r
+    Return a string composed of the words in list, with\r
+    intervening occurrences of sep.  The default separator is a\r
+    single space.\r
+\r
+    (joinfields and join are synonymous)\r
+\r
+    """\r
+    return sep.join(words)\r
+joinfields = join\r
+\r
+# Find substring, raise exception if not found\r
+def index(s, *args):\r
+    """index(s, sub [,start [,end]]) -> int\r
+\r
+    Like find but raises ValueError when the substring is not found.\r
+\r
+    """\r
+    return s.index(*args)\r
+\r
+# Find last substring, raise exception if not found\r
+def rindex(s, *args):\r
+    """rindex(s, sub [,start [,end]]) -> int\r
+\r
+    Like rfind but raises ValueError when the substring is not found.\r
+\r
+    """\r
+    return s.rindex(*args)\r
+\r
+# Count non-overlapping occurrences of substring\r
+def count(s, *args):\r
+    """count(s, sub[, start[,end]]) -> int\r
+\r
+    Return the number of occurrences of substring sub in string\r
+    s[start:end].  Optional arguments start and end are\r
+    interpreted as in slice notation.\r
+\r
+    """\r
+    return s.count(*args)\r
+\r
+# Find substring, return -1 if not found\r
+def find(s, *args):\r
+    """find(s, sub [,start [,end]]) -> in\r
+\r
+    Return the lowest index in s where substring sub is found,\r
+    such that sub is contained within s[start,end].  Optional\r
+    arguments start and end are interpreted as in slice notation.\r
+\r
+    Return -1 on failure.\r
+\r
+    """\r
+    return s.find(*args)\r
+\r
+# Find last substring, return -1 if not found\r
+def rfind(s, *args):\r
+    """rfind(s, sub [,start [,end]]) -> int\r
+\r
+    Return the highest index in s where substring sub is found,\r
+    such that sub is contained within s[start,end].  Optional\r
+    arguments start and end are interpreted as in slice notation.\r
+\r
+    Return -1 on failure.\r
+\r
+    """\r
+    return s.rfind(*args)\r
+\r
+# for a bit of speed\r
+_float = float\r
+_int = int\r
+_long = long\r
+\r
+# Convert string to float\r
+def atof(s):\r
+    """atof(s) -> float\r
+\r
+    Return the floating point number represented by the string s.\r
+\r
+    """\r
+    return _float(s)\r
+\r
+\r
+# Convert string to integer\r
+def atoi(s , base=10):\r
+    """atoi(s [,base]) -> int\r
+\r
+    Return the integer represented by the string s in the given\r
+    base, which defaults to 10.  The string s must consist of one\r
+    or more digits, possibly preceded by a sign.  If base is 0, it\r
+    is chosen from the leading characters of s, 0 for octal, 0x or\r
+    0X for hexadecimal.  If base is 16, a preceding 0x or 0X is\r
+    accepted.\r
+\r
+    """\r
+    return _int(s, base)\r
+\r
+\r
+# Convert string to long integer\r
+def atol(s, base=10):\r
+    """atol(s [,base]) -> long\r
+\r
+    Return the long integer represented by the string s in the\r
+    given base, which defaults to 10.  The string s must consist\r
+    of one or more digits, possibly preceded by a sign.  If base\r
+    is 0, it is chosen from the leading characters of s, 0 for\r
+    octal, 0x or 0X for hexadecimal.  If base is 16, a preceding\r
+    0x or 0X is accepted.  A trailing L or l is not accepted,\r
+    unless base is 0.\r
+\r
+    """\r
+    return _long(s, base)\r
+\r
+\r
+# Left-justify a string\r
+def ljust(s, width, *args):\r
+    """ljust(s, width[, fillchar]) -> string\r
+\r
+    Return a left-justified version of s, in a field of the\r
+    specified width, padded with spaces as needed.  The string is\r
+    never truncated.  If specified the fillchar is used instead of spaces.\r
+\r
+    """\r
+    return s.ljust(width, *args)\r
+\r
+# Right-justify a string\r
+def rjust(s, width, *args):\r
+    """rjust(s, width[, fillchar]) -> string\r
+\r
+    Return a right-justified version of s, in a field of the\r
+    specified width, padded with spaces as needed.  The string is\r
+    never truncated.  If specified the fillchar is used instead of spaces.\r
+\r
+    """\r
+    return s.rjust(width, *args)\r
+\r
+# Center a string\r
+def center(s, width, *args):\r
+    """center(s, width[, fillchar]) -> string\r
+\r
+    Return a center version of s, in a field of the specified\r
+    width. padded with spaces as needed.  The string is never\r
+    truncated.  If specified the fillchar is used instead of spaces.\r
+\r
+    """\r
+    return s.center(width, *args)\r
+\r
+# Zero-fill a number, e.g., (12, 3) --> '012' and (-3, 3) --> '-03'\r
+# Decadent feature: the argument may be a string or a number\r
+# (Use of this is deprecated; it should be a string as with ljust c.s.)\r
+def zfill(x, width):\r
+    """zfill(x, width) -> string\r
+\r
+    Pad a numeric string x with zeros on the left, to fill a field\r
+    of the specified width.  The string x is never truncated.\r
+\r
+    """\r
+    if not isinstance(x, basestring):\r
+        x = repr(x)\r
+    return x.zfill(width)\r
+\r
+# Expand tabs in a string.\r
+# Doesn't take non-printing chars into account, but does understand \n.\r
+def expandtabs(s, tabsize=8):\r
+    """expandtabs(s [,tabsize]) -> string\r
+\r
+    Return a copy of the string s with all tab characters replaced\r
+    by the appropriate number of spaces, depending on the current\r
+    column, and the tabsize (default 8).\r
+\r
+    """\r
+    return s.expandtabs(tabsize)\r
+\r
+# Character translation through look-up table.\r
+def translate(s, table, deletions=""):\r
+    """translate(s,table [,deletions]) -> string\r
+\r
+    Return a copy of the string s, where all characters occurring\r
+    in the optional argument deletions are removed, and the\r
+    remaining characters have been mapped through the given\r
+    translation table, which must be a string of length 256.  The\r
+    deletions argument is not allowed for Unicode strings.\r
+\r
+    """\r
+    if deletions or table is None:\r
+        return s.translate(table, deletions)\r
+    else:\r
+        # Add s[:0] so that if s is Unicode and table is an 8-bit string,\r
+        # table is converted to Unicode.  This means that table *cannot*\r
+        # be a dictionary -- for that feature, use u.translate() directly.\r
+        return s.translate(table + s[:0])\r
+\r
+# Capitalize a string, e.g. "aBc  dEf" -> "Abc  def".\r
+def capitalize(s):\r
+    """capitalize(s) -> string\r
+\r
+    Return a copy of the string s with only its first character\r
+    capitalized.\r
+\r
+    """\r
+    return s.capitalize()\r
+\r
+# Substring replacement (global)\r
+def replace(s, old, new, maxreplace=-1):\r
+    """replace (str, old, new[, maxreplace]) -> string\r
+\r
+    Return a copy of string str with all occurrences of substring\r
+    old replaced by new. If the optional argument maxreplace is\r
+    given, only the first maxreplace occurrences are replaced.\r
+\r
+    """\r
+    return s.replace(old, new, maxreplace)\r
+\r
+\r
+# Try importing optional built-in module "strop" -- if it exists,\r
+# it redefines some string operations that are 100-1000 times faster.\r
+# It also defines values for whitespace, lowercase and uppercase\r
+# that match <ctype.h>'s definitions.\r
+\r
+try:\r
+    from strop import maketrans, lowercase, uppercase, whitespace\r
+    letters = lowercase + uppercase\r
+except ImportError:\r
+    pass                                          # Use the original versions\r
+\r
+########################################################################\r
+# the Formatter class\r
+# see PEP 3101 for details and purpose of this class\r
+\r
+# The hard parts are reused from the C implementation.  They're exposed as "_"\r
+# prefixed methods of str and unicode.\r
+\r
+# The overall parser is implemented in str._formatter_parser.\r
+# The field name parser is implemented in str._formatter_field_name_split\r
+\r
+class Formatter(object):\r
+    def format(*args, **kwargs):\r
+        if not args:\r
+            raise TypeError("descriptor 'format' of 'Formatter' object "\r
+                            "needs an argument")\r
+        self, args = args[0], args[1:]  # allow the "self" keyword be passed\r
+        try:\r
+            format_string, args = args[0], args[1:] # allow the "format_string" keyword be passed\r
+        except IndexError:\r
+            if 'format_string' in kwargs:\r
+                format_string = kwargs.pop('format_string')\r
+            else:\r
+                raise TypeError("format() missing 1 required positional "\r
+                                "argument: 'format_string'")\r
+        return self.vformat(format_string, args, kwargs)\r
+\r
+    def vformat(self, format_string, args, kwargs):\r
+        used_args = set()\r
+        result = self._vformat(format_string, args, kwargs, used_args, 2)\r
+        self.check_unused_args(used_args, args, kwargs)\r
+        return result\r
+\r
+    def _vformat(self, format_string, args, kwargs, used_args, recursion_depth):\r
+        if recursion_depth < 0:\r
+            raise ValueError('Max string recursion exceeded')\r
+        result = []\r
+        for literal_text, field_name, format_spec, conversion in \\r
+                self.parse(format_string):\r
+\r
+            # output the literal text\r
+            if literal_text:\r
+                result.append(literal_text)\r
+\r
+            # if there's a field, output it\r
+            if field_name is not None:\r
+                # this is some markup, find the object and do\r
+                #  the formatting\r
+\r
+                # given the field_name, find the object it references\r
+                #  and the argument it came from\r
+                obj, arg_used = self.get_field(field_name, args, kwargs)\r
+                used_args.add(arg_used)\r
+\r
+                # do any conversion on the resulting object\r
+                obj = self.convert_field(obj, conversion)\r
+\r
+                # expand the format spec, if needed\r
+                format_spec = self._vformat(format_spec, args, kwargs,\r
+                                            used_args, recursion_depth-1)\r
+\r
+                # format the object and append to the result\r
+                result.append(self.format_field(obj, format_spec))\r
+\r
+        return ''.join(result)\r
+\r
+\r
+    def get_value(self, key, args, kwargs):\r
+        if isinstance(key, (int, long)):\r
+            return args[key]\r
+        else:\r
+            return kwargs[key]\r
+\r
+\r
+    def check_unused_args(self, used_args, args, kwargs):\r
+        pass\r
+\r
+\r
+    def format_field(self, value, format_spec):\r
+        return format(value, format_spec)\r
+\r
+\r
+    def convert_field(self, value, conversion):\r
+        # do any conversion on the resulting object\r
+        if conversion is None:\r
+            return value\r
+        elif conversion == 's':\r
+            return str(value)\r
+        elif conversion == 'r':\r
+            return repr(value)\r
+        raise ValueError("Unknown conversion specifier {0!s}".format(conversion))\r
+\r
+\r
+    # returns an iterable that contains tuples of the form:\r
+    # (literal_text, field_name, format_spec, conversion)\r
+    # literal_text can be zero length\r
+    # field_name can be None, in which case there's no\r
+    #  object to format and output\r
+    # if field_name is not None, it is looked up, formatted\r
+    #  with format_spec and conversion and then used\r
+    def parse(self, format_string):\r
+        return format_string._formatter_parser()\r
+\r
+\r
+    # given a field_name, find the object it references.\r
+    #  field_name:   the field being looked up, e.g. "0.name"\r
+    #                 or "lookup[3]"\r
+    #  used_args:    a set of which args have been used\r
+    #  args, kwargs: as passed in to vformat\r
+    def get_field(self, field_name, args, kwargs):\r
+        first, rest = field_name._formatter_field_name_split()\r
+\r
+        obj = self.get_value(first, args, kwargs)\r
+\r
+        # loop through the rest of the field_name, doing\r
+        #  getattr or getitem as needed\r
+        for is_attr, i in rest:\r
+            if is_attr:\r
+                obj = getattr(obj, i)\r
+            else:\r
+                obj = obj[i]\r
+\r
+        return obj, first\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/struct.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/struct.py
new file mode 100644 (file)
index 0000000..f7c44e9
--- /dev/null
@@ -0,0 +1,3 @@
+from _struct import *\r
+from _struct import _clearcache\r
+from _struct import __doc__\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sysconfig.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sysconfig.py
new file mode 100644 (file)
index 0000000..f365443
--- /dev/null
@@ -0,0 +1,640 @@
+"""Provide access to Python's configuration information.\r
+\r
+"""\r
+import sys\r
+import os\r
+from os.path import pardir, realpath\r
+\r
+_INSTALL_SCHEMES = {\r
+    'posix_prefix': {\r
+        'stdlib': '{base}/lib/python{py_version_short}',\r
+        'platstdlib': '{platbase}/lib/python{py_version_short}',\r
+        'purelib': '{base}/lib/python{py_version_short}/site-packages',\r
+        'platlib': '{platbase}/lib/python{py_version_short}/site-packages',\r
+        'include': '{base}/include/python{py_version_short}',\r
+        'platinclude': '{platbase}/include/python{py_version_short}',\r
+        'scripts': '{base}/bin',\r
+        'data': '{base}',\r
+        },\r
+    'posix_home': {\r
+        'stdlib': '{base}/lib/python',\r
+        'platstdlib': '{base}/lib/python',\r
+        'purelib': '{base}/lib/python',\r
+        'platlib': '{base}/lib/python',\r
+        'include': '{base}/include/python',\r
+        'platinclude': '{base}/include/python',\r
+        'scripts': '{base}/bin',\r
+        'data'   : '{base}',\r
+        },\r
+    'nt': {\r
+        'stdlib': '{base}/Lib',\r
+        'platstdlib': '{base}/Lib',\r
+        'purelib': '{base}/Lib/site-packages',\r
+        'platlib': '{base}/Lib/site-packages',\r
+        'include': '{base}/Include',\r
+        'platinclude': '{base}/Include',\r
+        'scripts': '{base}/Scripts',\r
+        'data'   : '{base}',\r
+        },\r
+    'os2': {\r
+        'stdlib': '{base}/Lib',\r
+        'platstdlib': '{base}/Lib',\r
+        'purelib': '{base}/Lib/site-packages',\r
+        'platlib': '{base}/Lib/site-packages',\r
+        'include': '{base}/Include',\r
+        'platinclude': '{base}/Include',\r
+        'scripts': '{base}/Scripts',\r
+        'data'   : '{base}',\r
+        },\r
+    'os2_home': {\r
+        'stdlib': '{userbase}/lib/python{py_version_short}',\r
+        'platstdlib': '{userbase}/lib/python{py_version_short}',\r
+        'purelib': '{userbase}/lib/python{py_version_short}/site-packages',\r
+        'platlib': '{userbase}/lib/python{py_version_short}/site-packages',\r
+        'include': '{userbase}/include/python{py_version_short}',\r
+        'scripts': '{userbase}/bin',\r
+        'data'   : '{userbase}',\r
+        },\r
+    'nt_user': {\r
+        'stdlib': '{userbase}/Python{py_version_nodot}',\r
+        'platstdlib': '{userbase}/Python{py_version_nodot}',\r
+        'purelib': '{userbase}/Python{py_version_nodot}/site-packages',\r
+        'platlib': '{userbase}/Python{py_version_nodot}/site-packages',\r
+        'include': '{userbase}/Python{py_version_nodot}/Include',\r
+        'scripts': '{userbase}/Scripts',\r
+        'data'   : '{userbase}',\r
+        },\r
+    'posix_user': {\r
+        'stdlib': '{userbase}/lib/python{py_version_short}',\r
+        'platstdlib': '{userbase}/lib/python{py_version_short}',\r
+        'purelib': '{userbase}/lib/python{py_version_short}/site-packages',\r
+        'platlib': '{userbase}/lib/python{py_version_short}/site-packages',\r
+        'include': '{userbase}/include/python{py_version_short}',\r
+        'scripts': '{userbase}/bin',\r
+        'data'   : '{userbase}',\r
+        },\r
+    'osx_framework_user': {\r
+        'stdlib': '{userbase}/lib/python',\r
+        'platstdlib': '{userbase}/lib/python',\r
+        'purelib': '{userbase}/lib/python/site-packages',\r
+        'platlib': '{userbase}/lib/python/site-packages',\r
+        'include': '{userbase}/include',\r
+        'scripts': '{userbase}/bin',\r
+        'data'   : '{userbase}',\r
+        },\r
+    }\r
+\r
+_SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include',\r
+                'scripts', 'data')\r
+_PY_VERSION = sys.version.split()[0]\r
+_PY_VERSION_SHORT = sys.version[:3]\r
+_PY_VERSION_SHORT_NO_DOT = _PY_VERSION[0] + _PY_VERSION[2]\r
+_PREFIX = os.path.normpath(sys.prefix)\r
+_EXEC_PREFIX = os.path.normpath(sys.exec_prefix)\r
+_CONFIG_VARS = None\r
+_USER_BASE = None\r
+\r
+def _safe_realpath(path):\r
+    try:\r
+        return realpath(path)\r
+    except OSError:\r
+        return path\r
+\r
+if sys.executable:\r
+    _PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable))\r
+else:\r
+    # sys.executable can be empty if argv[0] has been changed and Python is\r
+    # unable to retrieve the real program name\r
+    _PROJECT_BASE = _safe_realpath(os.getcwd())\r
+\r
+if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower():\r
+    _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir))\r
+# PC/VS7.1\r
+if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower():\r
+    _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))\r
+# PC/AMD64\r
+if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower():\r
+    _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))\r
+\r
+# set for cross builds\r
+if "_PYTHON_PROJECT_BASE" in os.environ:\r
+    # the build directory for posix builds\r
+    _PROJECT_BASE = os.path.normpath(os.path.abspath("."))\r
+def is_python_build():\r
+    for fn in ("Setup.dist", "Setup.local"):\r
+        if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)):\r
+            return True\r
+    return False\r
+\r
+_PYTHON_BUILD = is_python_build()\r
+\r
+if _PYTHON_BUILD:\r
+    for scheme in ('posix_prefix', 'posix_home'):\r
+        _INSTALL_SCHEMES[scheme]['include'] = '{projectbase}/Include'\r
+        _INSTALL_SCHEMES[scheme]['platinclude'] = '{srcdir}'\r
+\r
+def _subst_vars(s, local_vars):\r
+    try:\r
+        return s.format(**local_vars)\r
+    except KeyError:\r
+        try:\r
+            return s.format(**os.environ)\r
+        except KeyError, var:\r
+            raise AttributeError('{%s}' % var)\r
+\r
+def _extend_dict(target_dict, other_dict):\r
+    target_keys = target_dict.keys()\r
+    for key, value in other_dict.items():\r
+        if key in target_keys:\r
+            continue\r
+        target_dict[key] = value\r
+\r
+def _expand_vars(scheme, vars):\r
+    res = {}\r
+    if vars is None:\r
+        vars = {}\r
+    _extend_dict(vars, get_config_vars())\r
+\r
+    for key, value in _INSTALL_SCHEMES[scheme].items():\r
+        if os.name in ('posix', 'nt'):\r
+            value = os.path.expanduser(value)\r
+        res[key] = os.path.normpath(_subst_vars(value, vars))\r
+    return res\r
+\r
+def _get_default_scheme():\r
+    if os.name == 'posix':\r
+        # the default scheme for posix is posix_prefix\r
+        return 'posix_prefix'\r
+    return os.name\r
+\r
+def _getuserbase():\r
+    env_base = os.environ.get("PYTHONUSERBASE", None)\r
+    def joinuser(*args):\r
+        return os.path.expanduser(os.path.join(*args))\r
+\r
+    # what about 'os2emx', 'riscos' ?\r
+    if os.name == "nt":\r
+        base = os.environ.get("APPDATA") or "~"\r
+        return env_base if env_base else joinuser(base, "Python")\r
+\r
+    if sys.platform == "darwin":\r
+        framework = get_config_var("PYTHONFRAMEWORK")\r
+        if framework:\r
+            return env_base if env_base else \\r
+                               joinuser("~", "Library", framework, "%d.%d"\r
+                                            % (sys.version_info[:2]))\r
+\r
+    return env_base if env_base else joinuser("~", ".local")\r
+\r
+\r
+def _parse_makefile(filename, vars=None):\r
+    """Parse a Makefile-style file.\r
+\r
+    A dictionary containing name/value pairs is returned.  If an\r
+    optional dictionary is passed in as the second argument, it is\r
+    used instead of a new dictionary.\r
+    """\r
+    import re\r
+    # Regexes needed for parsing Makefile (and similar syntaxes,\r
+    # like old-style Setup files).\r
+    _variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")\r
+    _findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")\r
+    _findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")\r
+\r
+    if vars is None:\r
+        vars = {}\r
+    done = {}\r
+    notdone = {}\r
+\r
+    with open(filename) as f:\r
+        lines = f.readlines()\r
+\r
+    for line in lines:\r
+        if line.startswith('#') or line.strip() == '':\r
+            continue\r
+        m = _variable_rx.match(line)\r
+        if m:\r
+            n, v = m.group(1, 2)\r
+            v = v.strip()\r
+            # `$$' is a literal `$' in make\r
+            tmpv = v.replace('$$', '')\r
+\r
+            if "$" in tmpv:\r
+                notdone[n] = v\r
+            else:\r
+                try:\r
+                    v = int(v)\r
+                except ValueError:\r
+                    # insert literal `$'\r
+                    done[n] = v.replace('$$', '$')\r
+                else:\r
+                    done[n] = v\r
+\r
+    # do variable interpolation here\r
+    while notdone:\r
+        for name in notdone.keys():\r
+            value = notdone[name]\r
+            m = _findvar1_rx.search(value) or _findvar2_rx.search(value)\r
+            if m:\r
+                n = m.group(1)\r
+                found = True\r
+                if n in done:\r
+                    item = str(done[n])\r
+                elif n in notdone:\r
+                    # get it on a subsequent round\r
+                    found = False\r
+                elif n in os.environ:\r
+                    # do it like make: fall back to environment\r
+                    item = os.environ[n]\r
+                else:\r
+                    done[n] = item = ""\r
+                if found:\r
+                    after = value[m.end():]\r
+                    value = value[:m.start()] + item + after\r
+                    if "$" in after:\r
+                        notdone[name] = value\r
+                    else:\r
+                        try: value = int(value)\r
+                        except ValueError:\r
+                            done[name] = value.strip()\r
+                        else:\r
+                            done[name] = value\r
+                        del notdone[name]\r
+            else:\r
+                # bogus variable reference; just drop it since we can't deal\r
+                del notdone[name]\r
+    # strip spurious spaces\r
+    for k, v in done.items():\r
+        if isinstance(v, str):\r
+            done[k] = v.strip()\r
+\r
+    # save the results in the global dictionary\r
+    vars.update(done)\r
+    return vars\r
+\r
+\r
+def get_makefile_filename():\r
+    """Return the path of the Makefile."""\r
+    if _PYTHON_BUILD:\r
+        return os.path.join(_PROJECT_BASE, "Makefile")\r
+    return os.path.join(get_path('platstdlib'), "config", "Makefile")\r
+\r
+# Issue #22199: retain undocumented private name for compatibility\r
+_get_makefile_filename = get_makefile_filename\r
+\r
+def _generate_posix_vars():\r
+    """Generate the Python module containing build-time variables."""\r
+    import pprint\r
+    vars = {}\r
+    # load the installed Makefile:\r
+    makefile = get_makefile_filename()\r
+    try:\r
+        _parse_makefile(makefile, vars)\r
+    except IOError, e:\r
+        msg = "invalid Python installation: unable to open %s" % makefile\r
+        if hasattr(e, "strerror"):\r
+            msg = msg + " (%s)" % e.strerror\r
+        raise IOError(msg)\r
+\r
+    # load the installed pyconfig.h:\r
+    config_h = get_config_h_filename()\r
+    try:\r
+        with open(config_h) as f:\r
+            parse_config_h(f, vars)\r
+    except IOError, e:\r
+        msg = "invalid Python installation: unable to open %s" % config_h\r
+        if hasattr(e, "strerror"):\r
+            msg = msg + " (%s)" % e.strerror\r
+        raise IOError(msg)\r
+\r
+    # On AIX, there are wrong paths to the linker scripts in the Makefile\r
+    # -- these paths are relative to the Python source, but when installed\r
+    # the scripts are in another directory.\r
+    if _PYTHON_BUILD:\r
+        vars['LDSHARED'] = vars['BLDSHARED']\r
+\r
+    # There's a chicken-and-egg situation on OS X with regards to the\r
+    # _sysconfigdata module after the changes introduced by #15298:\r
+    # get_config_vars() is called by get_platform() as part of the\r
+    # `make pybuilddir.txt` target -- which is a precursor to the\r
+    # _sysconfigdata.py module being constructed.  Unfortunately,\r
+    # get_config_vars() eventually calls _init_posix(), which attempts\r
+    # to import _sysconfigdata, which we won't have built yet.  In order\r
+    # for _init_posix() to work, if we're on Darwin, just mock up the\r
+    # _sysconfigdata module manually and populate it with the build vars.\r
+    # This is more than sufficient for ensuring the subsequent call to\r
+    # get_platform() succeeds.\r
+    name = '_sysconfigdata'\r
+    if 'darwin' in sys.platform:\r
+        import imp\r
+        module = imp.new_module(name)\r
+        module.build_time_vars = vars\r
+        sys.modules[name] = module\r
+\r
+    pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3])\r
+    if hasattr(sys, "gettotalrefcount"):\r
+        pybuilddir += '-pydebug'\r
+    try:\r
+        os.makedirs(pybuilddir)\r
+    except OSError:\r
+        pass\r
+    destfile = os.path.join(pybuilddir, name + '.py')\r
+\r
+    with open(destfile, 'wb') as f:\r
+        f.write('# system configuration generated and used by'\r
+                ' the sysconfig module\n')\r
+        f.write('build_time_vars = ')\r
+        pprint.pprint(vars, stream=f)\r
+\r
+    # Create file used for sys.path fixup -- see Modules/getpath.c\r
+    with open('pybuilddir.txt', 'w') as f:\r
+        f.write(pybuilddir)\r
+\r
+def _init_posix(vars):\r
+    """Initialize the module as appropriate for POSIX systems."""\r
+    # _sysconfigdata is generated at build time, see _generate_posix_vars()\r
+    from _sysconfigdata import build_time_vars\r
+    vars.update(build_time_vars)\r
+\r
+def _init_non_posix(vars):\r
+    """Initialize the module as appropriate for NT"""\r
+    # set basic install directories\r
+    vars['LIBDEST'] = get_path('stdlib')\r
+    vars['BINLIBDEST'] = get_path('platstdlib')\r
+    vars['INCLUDEPY'] = get_path('include')\r
+    vars['SO'] = '.pyd'\r
+    vars['EXE'] = '.exe'\r
+    vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT\r
+    vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))\r
+\r
+#\r
+# public APIs\r
+#\r
+\r
+\r
+def parse_config_h(fp, vars=None):\r
+    """Parse a config.h-style file.\r
+\r
+    A dictionary containing name/value pairs is returned.  If an\r
+    optional dictionary is passed in as the second argument, it is\r
+    used instead of a new dictionary.\r
+    """\r
+    import re\r
+    if vars is None:\r
+        vars = {}\r
+    define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")\r
+    undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")\r
+\r
+    while True:\r
+        line = fp.readline()\r
+        if not line:\r
+            break\r
+        m = define_rx.match(line)\r
+        if m:\r
+            n, v = m.group(1, 2)\r
+            try: v = int(v)\r
+            except ValueError: pass\r
+            vars[n] = v\r
+        else:\r
+            m = undef_rx.match(line)\r
+            if m:\r
+                vars[m.group(1)] = 0\r
+    return vars\r
+\r
+def get_config_h_filename():\r
+    """Returns the path of pyconfig.h."""\r
+    if _PYTHON_BUILD:\r
+        if os.name == "nt":\r
+            inc_dir = os.path.join(_PROJECT_BASE, "PC")\r
+        else:\r
+            inc_dir = _PROJECT_BASE\r
+    else:\r
+        inc_dir = get_path('platinclude')\r
+    return os.path.join(inc_dir, 'pyconfig.h')\r
+\r
+def get_scheme_names():\r
+    """Returns a tuple containing the schemes names."""\r
+    schemes = _INSTALL_SCHEMES.keys()\r
+    schemes.sort()\r
+    return tuple(schemes)\r
+\r
+def get_path_names():\r
+    """Returns a tuple containing the paths names."""\r
+    return _SCHEME_KEYS\r
+\r
+def get_paths(scheme=_get_default_scheme(), vars=None, expand=True):\r
+    """Returns a mapping containing an install scheme.\r
+\r
+    ``scheme`` is the install scheme name. If not provided, it will\r
+    return the default scheme for the current platform.\r
+    """\r
+    if expand:\r
+        return _expand_vars(scheme, vars)\r
+    else:\r
+        return _INSTALL_SCHEMES[scheme]\r
+\r
+def get_path(name, scheme=_get_default_scheme(), vars=None, expand=True):\r
+    """Returns a path corresponding to the scheme.\r
+\r
+    ``scheme`` is the install scheme name.\r
+    """\r
+    return get_paths(scheme, vars, expand)[name]\r
+\r
+def get_config_vars(*args):\r
+    """With no arguments, return a dictionary of all configuration\r
+    variables relevant for the current platform.\r
+\r
+    On Unix, this means every variable defined in Python's installed Makefile;\r
+    On Windows and Mac OS it's a much smaller set.\r
+\r
+    With arguments, return a list of values that result from looking up\r
+    each argument in the configuration variable dictionary.\r
+    """\r
+    import re\r
+    global _CONFIG_VARS\r
+    if _CONFIG_VARS is None:\r
+        _CONFIG_VARS = {}\r
+        # Normalized versions of prefix and exec_prefix are handy to have;\r
+        # in fact, these are the standard versions used most places in the\r
+        # Distutils.\r
+        _CONFIG_VARS['prefix'] = _PREFIX\r
+        _CONFIG_VARS['exec_prefix'] = _EXEC_PREFIX\r
+        _CONFIG_VARS['py_version'] = _PY_VERSION\r
+        _CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT\r
+        _CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2]\r
+        _CONFIG_VARS['base'] = _PREFIX\r
+        _CONFIG_VARS['platbase'] = _EXEC_PREFIX\r
+        _CONFIG_VARS['projectbase'] = _PROJECT_BASE\r
+\r
+        if os.name in ('nt', 'os2'):\r
+            _init_non_posix(_CONFIG_VARS)\r
+        if os.name == 'posix':\r
+            _init_posix(_CONFIG_VARS)\r
+\r
+        # Setting 'userbase' is done below the call to the\r
+        # init function to enable using 'get_config_var' in\r
+        # the init-function.\r
+        _CONFIG_VARS['userbase'] = _getuserbase()\r
+\r
+        if 'srcdir' not in _CONFIG_VARS:\r
+            _CONFIG_VARS['srcdir'] = _PROJECT_BASE\r
+\r
+        # Convert srcdir into an absolute path if it appears necessary.\r
+        # Normally it is relative to the build directory.  However, during\r
+        # testing, for example, we might be running a non-installed python\r
+        # from a different directory.\r
+        if _PYTHON_BUILD and os.name == "posix":\r
+            base = _PROJECT_BASE\r
+            try:\r
+                cwd = os.getcwd()\r
+            except OSError:\r
+                cwd = None\r
+            if (not os.path.isabs(_CONFIG_VARS['srcdir']) and\r
+                base != cwd):\r
+                # srcdir is relative and we are not in the same directory\r
+                # as the executable. Assume executable is in the build\r
+                # directory and make srcdir absolute.\r
+                srcdir = os.path.join(base, _CONFIG_VARS['srcdir'])\r
+                _CONFIG_VARS['srcdir'] = os.path.normpath(srcdir)\r
+\r
+        # OS X platforms require special customization to handle\r
+        # multi-architecture, multi-os-version installers\r
+        if sys.platform == 'darwin':\r
+            import _osx_support\r
+            _osx_support.customize_config_vars(_CONFIG_VARS)\r
+\r
+    if args:\r
+        vals = []\r
+        for name in args:\r
+            vals.append(_CONFIG_VARS.get(name))\r
+        return vals\r
+    else:\r
+        return _CONFIG_VARS\r
+\r
+def get_config_var(name):\r
+    """Return the value of a single variable using the dictionary returned by\r
+    'get_config_vars()'.\r
+\r
+    Equivalent to get_config_vars().get(name)\r
+    """\r
+    return get_config_vars().get(name)\r
+\r
+def get_platform():\r
+    """Return a string that identifies the current platform.\r
+\r
+    This is used mainly to distinguish platform-specific build directories and\r
+    platform-specific built distributions.  Typically includes the OS name\r
+    and version and the architecture (as supplied by 'os.uname()'),\r
+    although the exact information included depends on the OS; eg. for IRIX\r
+    the architecture isn't particularly important (IRIX only runs on SGI\r
+    hardware), but for Linux the kernel version isn't particularly\r
+    important.\r
+\r
+    Examples of returned values:\r
+       linux-i586\r
+       linux-alpha (?)\r
+       solaris-2.6-sun4u\r
+       irix-5.3\r
+       irix64-6.2\r
+\r
+    Windows will return one of:\r
+       win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)\r
+       win-ia64 (64bit Windows on Itanium)\r
+       win32 (all others - specifically, sys.platform is returned)\r
+\r
+    For other non-POSIX platforms, currently just returns 'sys.platform'.\r
+    """\r
+    import re\r
+    if os.name == 'nt':\r
+        # sniff sys.version for architecture.\r
+        prefix = " bit ("\r
+        i = sys.version.find(prefix)\r
+        if i == -1:\r
+            return sys.platform\r
+        j = sys.version.find(")", i)\r
+        look = sys.version[i+len(prefix):j].lower()\r
+        if look == 'amd64':\r
+            return 'win-amd64'\r
+        if look == 'itanium':\r
+            return 'win-ia64'\r
+        return sys.platform\r
+\r
+    # Set for cross builds explicitly\r
+    if "_PYTHON_HOST_PLATFORM" in os.environ:\r
+        return os.environ["_PYTHON_HOST_PLATFORM"]\r
+\r
+    if os.name != "posix" or not hasattr(os, 'uname'):\r
+        # XXX what about the architecture? NT is Intel or Alpha,\r
+        # Mac OS is M68k or PPC, etc.\r
+        return sys.platform\r
+\r
+    # Try to distinguish various flavours of Unix\r
+    osname, host, release, version, machine = os.uname()\r
+\r
+    # Convert the OS name to lowercase, remove '/' characters\r
+    # (to accommodate BSD/OS), and translate spaces (for "Power Macintosh")\r
+    osname = osname.lower().replace('/', '')\r
+    machine = machine.replace(' ', '_')\r
+    machine = machine.replace('/', '-')\r
+\r
+    if osname[:5] == "linux":\r
+        # At least on Linux/Intel, 'machine' is the processor --\r
+        # i386, etc.\r
+        # XXX what about Alpha, SPARC, etc?\r
+        return  "%s-%s" % (osname, machine)\r
+    elif osname[:5] == "sunos":\r
+        if release[0] >= "5":           # SunOS 5 == Solaris 2\r
+            osname = "solaris"\r
+            release = "%d.%s" % (int(release[0]) - 3, release[2:])\r
+            # We can't use "platform.architecture()[0]" because a\r
+            # bootstrap problem. We use a dict to get an error\r
+            # if some suspicious happens.\r
+            bitness = {2147483647:"32bit", 9223372036854775807:"64bit"}\r
+            machine += ".%s" % bitness[sys.maxint]\r
+        # fall through to standard osname-release-machine representation\r
+    elif osname[:4] == "irix":              # could be "irix64"!\r
+        return "%s-%s" % (osname, release)\r
+    elif osname[:3] == "aix":\r
+        return "%s-%s.%s" % (osname, version, release)\r
+    elif osname[:6] == "cygwin":\r
+        osname = "cygwin"\r
+        rel_re = re.compile (r'[\d.]+')\r
+        m = rel_re.match(release)\r
+        if m:\r
+            release = m.group()\r
+    elif osname[:6] == "darwin":\r
+        import _osx_support\r
+        osname, release, machine = _osx_support.get_platform_osx(\r
+                                            get_config_vars(),\r
+                                            osname, release, machine)\r
+\r
+    return "%s-%s-%s" % (osname, release, machine)\r
+\r
+\r
+def get_python_version():\r
+    return _PY_VERSION_SHORT\r
+\r
+\r
+def _print_dict(title, data):\r
+    for index, (key, value) in enumerate(sorted(data.items())):\r
+        if index == 0:\r
+            print '%s: ' % (title)\r
+        print '\t%s = "%s"' % (key, value)\r
+\r
+\r
+def _main():\r
+    """Display all information sysconfig detains."""\r
+    if '--generate-posix-vars' in sys.argv:\r
+        _generate_posix_vars()\r
+        return\r
+    print 'Platform: "%s"' % get_platform()\r
+    print 'Python version: "%s"' % get_python_version()\r
+    print 'Current installation scheme: "%s"' % _get_default_scheme()\r
+    print\r
+    _print_dict('Paths', get_paths())\r
+    print\r
+    _print_dict('Variables', get_config_vars())\r
+\r
+\r
+if __name__ == '__main__':\r
+    _main()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/textwrap.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/textwrap.py
new file mode 100644 (file)
index 0000000..131de9b
--- /dev/null
@@ -0,0 +1,425 @@
+"""Text wrapping and filling.\r
+"""\r
+\r
+# Copyright (C) 1999-2001 Gregory P. Ward.\r
+# Copyright (C) 2002, 2003 Python Software Foundation.\r
+# Written by Greg Ward <gward@python.net>\r
+\r
+__revision__ = "$Id$"\r
+\r
+import string, re\r
+\r
+try:\r
+    _unicode = unicode\r
+except NameError:\r
+    # If Python is built without Unicode support, the unicode type\r
+    # will not exist. Fake one.\r
+    class _unicode(object):\r
+        pass\r
+\r
+# Do the right thing with boolean values for all known Python versions\r
+# (so this module can be copied to projects that don't depend on Python\r
+# 2.3, e.g. Optik and Docutils) by uncommenting the block of code below.\r
+#try:\r
+#    True, False\r
+#except NameError:\r
+#    (True, False) = (1, 0)\r
+\r
+__all__ = ['TextWrapper', 'wrap', 'fill', 'dedent']\r
+\r
+# Hardcode the recognized whitespace characters to the US-ASCII\r
+# whitespace characters.  The main reason for doing this is that in\r
+# ISO-8859-1, 0xa0 is non-breaking whitespace, so in certain locales\r
+# that character winds up in string.whitespace.  Respecting\r
+# string.whitespace in those cases would 1) make textwrap treat 0xa0 the\r
+# same as any other whitespace char, which is clearly wrong (it's a\r
+# *non-breaking* space), 2) possibly cause problems with Unicode,\r
+# since 0xa0 is not in range(128).\r
+_whitespace = '\t\n\x0b\x0c\r '\r
+\r
+class TextWrapper:\r
+    """\r
+    Object for wrapping/filling text.  The public interface consists of\r
+    the wrap() and fill() methods; the other methods are just there for\r
+    subclasses to override in order to tweak the default behaviour.\r
+    If you want to completely replace the main wrapping algorithm,\r
+    you'll probably have to override _wrap_chunks().\r
+\r
+    Several instance attributes control various aspects of wrapping:\r
+      width (default: 70)\r
+        the maximum width of wrapped lines (unless break_long_words\r
+        is false)\r
+      initial_indent (default: "")\r
+        string that will be prepended to the first line of wrapped\r
+        output.  Counts towards the line's width.\r
+      subsequent_indent (default: "")\r
+        string that will be prepended to all lines save the first\r
+        of wrapped output; also counts towards each line's width.\r
+      expand_tabs (default: true)\r
+        Expand tabs in input text to spaces before further processing.\r
+        Each tab will become 1 .. 8 spaces, depending on its position in\r
+        its line.  If false, each tab is treated as a single character.\r
+      replace_whitespace (default: true)\r
+        Replace all whitespace characters in the input text by spaces\r
+        after tab expansion.  Note that if expand_tabs is false and\r
+        replace_whitespace is true, every tab will be converted to a\r
+        single space!\r
+      fix_sentence_endings (default: false)\r
+        Ensure that sentence-ending punctuation is always followed\r
+        by two spaces.  Off by default because the algorithm is\r
+        (unavoidably) imperfect.\r
+      break_long_words (default: true)\r
+        Break words longer than 'width'.  If false, those words will not\r
+        be broken, and some lines might be longer than 'width'.\r
+      break_on_hyphens (default: true)\r
+        Allow breaking hyphenated words. If true, wrapping will occur\r
+        preferably on whitespaces and right after hyphens part of\r
+        compound words.\r
+      drop_whitespace (default: true)\r
+        Drop leading and trailing whitespace from lines.\r
+    """\r
+\r
+    whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace))\r
+\r
+    unicode_whitespace_trans = {}\r
+    uspace = ord(u' ')\r
+    for x in map(ord, _whitespace):\r
+        unicode_whitespace_trans[x] = uspace\r
+\r
+    # This funky little regex is just the trick for splitting\r
+    # text up into word-wrappable chunks.  E.g.\r
+    #   "Hello there -- you goof-ball, use the -b option!"\r
+    # splits into\r
+    #   Hello/ /there/ /--/ /you/ /goof-/ball,/ /use/ /the/ /-b/ /option!\r
+    # (after stripping out empty strings).\r
+    wordsep_re = re.compile(\r
+        r'(\s+|'                                  # any whitespace\r
+        r'[^\s\w]*\w+[^0-9\W]-(?=\w+[^0-9\W])|'   # hyphenated words\r
+        r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))')   # em-dash\r
+\r
+    # This less funky little regex just split on recognized spaces. E.g.\r
+    #   "Hello there -- you goof-ball, use the -b option!"\r
+    # splits into\r
+    #   Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/\r
+    wordsep_simple_re = re.compile(r'(\s+)')\r
+\r
+    # XXX this is not locale- or charset-aware -- string.lowercase\r
+    # is US-ASCII only (and therefore English-only)\r
+    sentence_end_re = re.compile(r'[%s]'              # lowercase letter\r
+                                 r'[\.\!\?]'          # sentence-ending punct.\r
+                                 r'[\"\']?'           # optional end-of-quote\r
+                                 r'\Z'                # end of chunk\r
+                                 % string.lowercase)\r
+\r
+\r
+    def __init__(self,\r
+                 width=70,\r
+                 initial_indent="",\r
+                 subsequent_indent="",\r
+                 expand_tabs=True,\r
+                 replace_whitespace=True,\r
+                 fix_sentence_endings=False,\r
+                 break_long_words=True,\r
+                 drop_whitespace=True,\r
+                 break_on_hyphens=True):\r
+        self.width = width\r
+        self.initial_indent = initial_indent\r
+        self.subsequent_indent = subsequent_indent\r
+        self.expand_tabs = expand_tabs\r
+        self.replace_whitespace = replace_whitespace\r
+        self.fix_sentence_endings = fix_sentence_endings\r
+        self.break_long_words = break_long_words\r
+        self.drop_whitespace = drop_whitespace\r
+        self.break_on_hyphens = break_on_hyphens\r
+\r
+        # recompile the regexes for Unicode mode -- done in this clumsy way for\r
+        # backwards compatibility because it's rather common to monkey-patch\r
+        # the TextWrapper class' wordsep_re attribute.\r
+        self.wordsep_re_uni = re.compile(self.wordsep_re.pattern, re.U)\r
+        self.wordsep_simple_re_uni = re.compile(\r
+            self.wordsep_simple_re.pattern, re.U)\r
+\r
+\r
+    # -- Private methods -----------------------------------------------\r
+    # (possibly useful for subclasses to override)\r
+\r
+    def _munge_whitespace(self, text):\r
+        """_munge_whitespace(text : string) -> string\r
+\r
+        Munge whitespace in text: expand tabs and convert all other\r
+        whitespace characters to spaces.  Eg. " foo\\tbar\\n\\nbaz"\r
+        becomes " foo    bar  baz".\r
+        """\r
+        if self.expand_tabs:\r
+            text = text.expandtabs()\r
+        if self.replace_whitespace:\r
+            if isinstance(text, str):\r
+                text = text.translate(self.whitespace_trans)\r
+            elif isinstance(text, _unicode):\r
+                text = text.translate(self.unicode_whitespace_trans)\r
+        return text\r
+\r
+\r
+    def _split(self, text):\r
+        """_split(text : string) -> [string]\r
+\r
+        Split the text to wrap into indivisible chunks.  Chunks are\r
+        not quite the same as words; see _wrap_chunks() for full\r
+        details.  As an example, the text\r
+          Look, goof-ball -- use the -b option!\r
+        breaks into the following chunks:\r
+          'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',\r
+          'use', ' ', 'the', ' ', '-b', ' ', 'option!'\r
+        if break_on_hyphens is True, or in:\r
+          'Look,', ' ', 'goof-ball', ' ', '--', ' ',\r
+          'use', ' ', 'the', ' ', '-b', ' ', option!'\r
+        otherwise.\r
+        """\r
+        if isinstance(text, _unicode):\r
+            if self.break_on_hyphens:\r
+                pat = self.wordsep_re_uni\r
+            else:\r
+                pat = self.wordsep_simple_re_uni\r
+        else:\r
+            if self.break_on_hyphens:\r
+                pat = self.wordsep_re\r
+            else:\r
+                pat = self.wordsep_simple_re\r
+        chunks = pat.split(text)\r
+        chunks = filter(None, chunks)  # remove empty chunks\r
+        return chunks\r
+\r
+    def _fix_sentence_endings(self, chunks):\r
+        """_fix_sentence_endings(chunks : [string])\r
+\r
+        Correct for sentence endings buried in 'chunks'.  Eg. when the\r
+        original text contains "... foo.\\nBar ...", munge_whitespace()\r
+        and split() will convert that to [..., "foo.", " ", "Bar", ...]\r
+        which has one too few spaces; this method simply changes the one\r
+        space to two.\r
+        """\r
+        i = 0\r
+        patsearch = self.sentence_end_re.search\r
+        while i < len(chunks)-1:\r
+            if chunks[i+1] == " " and patsearch(chunks[i]):\r
+                chunks[i+1] = "  "\r
+                i += 2\r
+            else:\r
+                i += 1\r
+\r
+    def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):\r
+        """_handle_long_word(chunks : [string],\r
+                             cur_line : [string],\r
+                             cur_len : int, width : int)\r
+\r
+        Handle a chunk of text (most likely a word, not whitespace) that\r
+        is too long to fit in any line.\r
+        """\r
+        # Figure out when indent is larger than the specified width, and make\r
+        # sure at least one character is stripped off on every pass\r
+        if width < 1:\r
+            space_left = 1\r
+        else:\r
+            space_left = width - cur_len\r
+\r
+        # If we're allowed to break long words, then do so: put as much\r
+        # of the next chunk onto the current line as will fit.\r
+        if self.break_long_words:\r
+            cur_line.append(reversed_chunks[-1][:space_left])\r
+            reversed_chunks[-1] = reversed_chunks[-1][space_left:]\r
+\r
+        # Otherwise, we have to preserve the long word intact.  Only add\r
+        # it to the current line if there's nothing already there --\r
+        # that minimizes how much we violate the width constraint.\r
+        elif not cur_line:\r
+            cur_line.append(reversed_chunks.pop())\r
+\r
+        # If we're not allowed to break long words, and there's already\r
+        # text on the current line, do nothing.  Next time through the\r
+        # main loop of _wrap_chunks(), we'll wind up here again, but\r
+        # cur_len will be zero, so the next line will be entirely\r
+        # devoted to the long word that we can't handle right now.\r
+\r
+    def _wrap_chunks(self, chunks):\r
+        """_wrap_chunks(chunks : [string]) -> [string]\r
+\r
+        Wrap a sequence of text chunks and return a list of lines of\r
+        length 'self.width' or less.  (If 'break_long_words' is false,\r
+        some lines may be longer than this.)  Chunks correspond roughly\r
+        to words and the whitespace between them: each chunk is\r
+        indivisible (modulo 'break_long_words'), but a line break can\r
+        come between any two chunks.  Chunks should not have internal\r
+        whitespace; ie. a chunk is either all whitespace or a "word".\r
+        Whitespace chunks will be removed from the beginning and end of\r
+        lines, but apart from that whitespace is preserved.\r
+        """\r
+        lines = []\r
+        if self.width <= 0:\r
+            raise ValueError("invalid width %r (must be > 0)" % self.width)\r
+\r
+        # Arrange in reverse order so items can be efficiently popped\r
+        # from a stack of chucks.\r
+        chunks.reverse()\r
+\r
+        while chunks:\r
+\r
+            # Start the list of chunks that will make up the current line.\r
+            # cur_len is just the length of all the chunks in cur_line.\r
+            cur_line = []\r
+            cur_len = 0\r
+\r
+            # Figure out which static string will prefix this line.\r
+            if lines:\r
+                indent = self.subsequent_indent\r
+            else:\r
+                indent = self.initial_indent\r
+\r
+            # Maximum width for this line.\r
+            width = self.width - len(indent)\r
+\r
+            # First chunk on line is whitespace -- drop it, unless this\r
+            # is the very beginning of the text (ie. no lines started yet).\r
+            if self.drop_whitespace and chunks[-1].strip() == '' and lines:\r
+                del chunks[-1]\r
+\r
+            while chunks:\r
+                l = len(chunks[-1])\r
+\r
+                # Can at least squeeze this chunk onto the current line.\r
+                if cur_len + l <= width:\r
+                    cur_line.append(chunks.pop())\r
+                    cur_len += l\r
+\r
+                # Nope, this line is full.\r
+                else:\r
+                    break\r
+\r
+            # The current line is full, and the next chunk is too big to\r
+            # fit on *any* line (not just this one).\r
+            if chunks and len(chunks[-1]) > width:\r
+                self._handle_long_word(chunks, cur_line, cur_len, width)\r
+\r
+            # If the last chunk on this line is all whitespace, drop it.\r
+            if self.drop_whitespace and cur_line and cur_line[-1].strip() == '':\r
+                del cur_line[-1]\r
+\r
+            # Convert current line back to a string and store it in list\r
+            # of all lines (return value).\r
+            if cur_line:\r
+                lines.append(indent + ''.join(cur_line))\r
+\r
+        return lines\r
+\r
+\r
+    # -- Public interface ----------------------------------------------\r
+\r
+    def wrap(self, text):\r
+        """wrap(text : string) -> [string]\r
+\r
+        Reformat the single paragraph in 'text' so it fits in lines of\r
+        no more than 'self.width' columns, and return a list of wrapped\r
+        lines.  Tabs in 'text' are expanded with string.expandtabs(),\r
+        and all other whitespace characters (including newline) are\r
+        converted to space.\r
+        """\r
+        text = self._munge_whitespace(text)\r
+        chunks = self._split(text)\r
+        if self.fix_sentence_endings:\r
+            self._fix_sentence_endings(chunks)\r
+        return self._wrap_chunks(chunks)\r
+\r
+    def fill(self, text):\r
+        """fill(text : string) -> string\r
+\r
+        Reformat the single paragraph in 'text' to fit in lines of no\r
+        more than 'self.width' columns, and return a new string\r
+        containing the entire wrapped paragraph.\r
+        """\r
+        return "\n".join(self.wrap(text))\r
+\r
+\r
+# -- Convenience interface ---------------------------------------------\r
+\r
+def wrap(text, width=70, **kwargs):\r
+    """Wrap a single paragraph of text, returning a list of wrapped lines.\r
+\r
+    Reformat the single paragraph in 'text' so it fits in lines of no\r
+    more than 'width' columns, and return a list of wrapped lines.  By\r
+    default, tabs in 'text' are expanded with string.expandtabs(), and\r
+    all other whitespace characters (including newline) are converted to\r
+    space.  See TextWrapper class for available keyword args to customize\r
+    wrapping behaviour.\r
+    """\r
+    w = TextWrapper(width=width, **kwargs)\r
+    return w.wrap(text)\r
+\r
+def fill(text, width=70, **kwargs):\r
+    """Fill a single paragraph of text, returning a new string.\r
+\r
+    Reformat the single paragraph in 'text' to fit in lines of no more\r
+    than 'width' columns, and return a new string containing the entire\r
+    wrapped paragraph.  As with wrap(), tabs are expanded and other\r
+    whitespace characters converted to space.  See TextWrapper class for\r
+    available keyword args to customize wrapping behaviour.\r
+    """\r
+    w = TextWrapper(width=width, **kwargs)\r
+    return w.fill(text)\r
+\r
+\r
+# -- Loosely related functionality -------------------------------------\r
+\r
+_whitespace_only_re = re.compile('^[ \t]+$', re.MULTILINE)\r
+_leading_whitespace_re = re.compile('(^[ \t]*)(?:[^ \t\n])', re.MULTILINE)\r
+\r
+def dedent(text):\r
+    """Remove any common leading whitespace from every line in `text`.\r
+\r
+    This can be used to make triple-quoted strings line up with the left\r
+    edge of the display, while still presenting them in the source code\r
+    in indented form.\r
+\r
+    Note that tabs and spaces are both treated as whitespace, but they\r
+    are not equal: the lines "  hello" and "\\thello" are\r
+    considered to have no common leading whitespace.  (This behaviour is\r
+    new in Python 2.5; older versions of this module incorrectly\r
+    expanded tabs before searching for common leading whitespace.)\r
+    """\r
+    # Look for the longest leading string of spaces and tabs common to\r
+    # all lines.\r
+    margin = None\r
+    text = _whitespace_only_re.sub('', text)\r
+    indents = _leading_whitespace_re.findall(text)\r
+    for indent in indents:\r
+        if margin is None:\r
+            margin = indent\r
+\r
+        # Current line more deeply indented than previous winner:\r
+        # no change (previous winner is still on top).\r
+        elif indent.startswith(margin):\r
+            pass\r
+\r
+        # Current line consistent with and no deeper than previous winner:\r
+        # it's the new winner.\r
+        elif margin.startswith(indent):\r
+            margin = indent\r
+\r
+        # Current line and previous winner have no common whitespace:\r
+        # there is no margin.\r
+        else:\r
+            margin = ""\r
+            break\r
+\r
+    # sanity check (testing/debugging only)\r
+    if 0 and margin:\r
+        for line in text.split("\n"):\r
+            assert not line or line.startswith(margin), \\r
+                   "line = %r, margin = %r" % (line, margin)\r
+\r
+    if margin:\r
+        text = re.sub(r'(?m)^' + margin, '', text)\r
+    return text\r
+\r
+if __name__ == "__main__":\r
+    #print dedent("\tfoo\n\tbar")\r
+    #print dedent("  \thello there\n  \t  how are you?")\r
+    print dedent("Hello there.\n  This is indented.")\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/token.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/token.py
new file mode 100644 (file)
index 0000000..7808128
--- /dev/null
@@ -0,0 +1,140 @@
+"""Token constants (from "token.h")."""\r
+\r
+#  This file is automatically generated; please don't muck it up!\r
+#\r
+#  To update the symbols in this file, 'cd' to the top directory of\r
+#  the python source tree after building the interpreter and run:\r
+#\r
+#    ./python Lib/token.py\r
+\r
+#--start constants--\r
+ENDMARKER = 0\r
+NAME = 1\r
+NUMBER = 2\r
+STRING = 3\r
+NEWLINE = 4\r
+INDENT = 5\r
+DEDENT = 6\r
+LPAR = 7\r
+RPAR = 8\r
+LSQB = 9\r
+RSQB = 10\r
+COLON = 11\r
+COMMA = 12\r
+SEMI = 13\r
+PLUS = 14\r
+MINUS = 15\r
+STAR = 16\r
+SLASH = 17\r
+VBAR = 18\r
+AMPER = 19\r
+LESS = 20\r
+GREATER = 21\r
+EQUAL = 22\r
+DOT = 23\r
+PERCENT = 24\r
+BACKQUOTE = 25\r
+LBRACE = 26\r
+RBRACE = 27\r
+EQEQUAL = 28\r
+NOTEQUAL = 29\r
+LESSEQUAL = 30\r
+GREATEREQUAL = 31\r
+TILDE = 32\r
+CIRCUMFLEX = 33\r
+LEFTSHIFT = 34\r
+RIGHTSHIFT = 35\r
+DOUBLESTAR = 36\r
+PLUSEQUAL = 37\r
+MINEQUAL = 38\r
+STAREQUAL = 39\r
+SLASHEQUAL = 40\r
+PERCENTEQUAL = 41\r
+AMPEREQUAL = 42\r
+VBAREQUAL = 43\r
+CIRCUMFLEXEQUAL = 44\r
+LEFTSHIFTEQUAL = 45\r
+RIGHTSHIFTEQUAL = 46\r
+DOUBLESTAREQUAL = 47\r
+DOUBLESLASH = 48\r
+DOUBLESLASHEQUAL = 49\r
+AT = 50\r
+OP = 51\r
+ERRORTOKEN = 52\r
+N_TOKENS = 53\r
+NT_OFFSET = 256\r
+#--end constants--\r
+\r
+tok_name = {}\r
+for _name, _value in globals().items():\r
+    if type(_value) is type(0):\r
+        tok_name[_value] = _name\r
+del _name, _value\r
+\r
+\r
+def ISTERMINAL(x):\r
+    return x < NT_OFFSET\r
+\r
+def ISNONTERMINAL(x):\r
+    return x >= NT_OFFSET\r
+\r
+def ISEOF(x):\r
+    return x == ENDMARKER\r
+\r
+\r
+def main():\r
+    import re\r
+    import sys\r
+    args = sys.argv[1:]\r
+    inFileName = args and args[0] or "Include/token.h"\r
+    outFileName = "Lib/token.py"\r
+    if len(args) > 1:\r
+        outFileName = args[1]\r
+    try:\r
+        fp = open(inFileName)\r
+    except IOError, err:\r
+        sys.stdout.write("I/O error: %s\n" % str(err))\r
+        sys.exit(1)\r
+    lines = fp.read().split("\n")\r
+    fp.close()\r
+    prog = re.compile(\r
+        "#define[ \t][ \t]*([A-Z0-9][A-Z0-9_]*)[ \t][ \t]*([0-9][0-9]*)",\r
+        re.IGNORECASE)\r
+    tokens = {}\r
+    for line in lines:\r
+        match = prog.match(line)\r
+        if match:\r
+            name, val = match.group(1, 2)\r
+            val = int(val)\r
+            tokens[val] = name          # reverse so we can sort them...\r
+    keys = tokens.keys()\r
+    keys.sort()\r
+    # load the output skeleton from the target:\r
+    try:\r
+        fp = open(outFileName)\r
+    except IOError, err:\r
+        sys.stderr.write("I/O error: %s\n" % str(err))\r
+        sys.exit(2)\r
+    format = fp.read().split("\n")\r
+    fp.close()\r
+    try:\r
+        start = format.index("#--start constants--") + 1\r
+        end = format.index("#--end constants--")\r
+    except ValueError:\r
+        sys.stderr.write("target does not contain format markers")\r
+        sys.exit(3)\r
+    lines = []\r
+    for val in keys:\r
+        lines.append("%s = %d" % (tokens[val], val))\r
+    format[start:end] = lines\r
+    try:\r
+        fp = open(outFileName, 'w')\r
+    except IOError, err:\r
+        sys.stderr.write("I/O error: %s\n" % str(err))\r
+        sys.exit(4)\r
+    fp.write("\n".join(format))\r
+    fp.close()\r
+\r
+\r
+if __name__ == "__main__":\r
+    main()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/tokenize.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/tokenize.py
new file mode 100644 (file)
index 0000000..9e7e1dc
--- /dev/null
@@ -0,0 +1,432 @@
+"""Tokenization help for Python programs.\r
+\r
+generate_tokens(readline) is a generator that breaks a stream of\r
+text into Python tokens.  It accepts a readline-like method which is called\r
+repeatedly to get the next line of input (or "" for EOF).  It generates\r
+5-tuples with these members:\r
+\r
+    the token type (see token.py)\r
+    the token (a string)\r
+    the starting (row, column) indices of the token (a 2-tuple of ints)\r
+    the ending (row, column) indices of the token (a 2-tuple of ints)\r
+    the original line (string)\r
+\r
+It is designed to match the working of the Python tokenizer exactly, except\r
+that it produces COMMENT tokens for comments and gives type OP for all\r
+operators\r
+\r
+Older entry points\r
+    tokenize_loop(readline, tokeneater)\r
+    tokenize(readline, tokeneater=printtoken)\r
+are the same, except instead of generating tokens, tokeneater is a callback\r
+function to which the 5 fields described above are passed as 5 arguments,\r
+each time a new token is found."""\r
+\r
+__author__ = 'Ka-Ping Yee <ping@lfw.org>'\r
+__credits__ = ('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, '\r
+               'Skip Montanaro, Raymond Hettinger')\r
+\r
+from itertools import chain\r
+import string, re\r
+from token import *\r
+\r
+import token\r
+__all__ = [x for x in dir(token) if not x.startswith("_")]\r
+__all__ += ["COMMENT", "tokenize", "generate_tokens", "NL", "untokenize"]\r
+del x\r
+del token\r
+\r
+COMMENT = N_TOKENS\r
+tok_name[COMMENT] = 'COMMENT'\r
+NL = N_TOKENS + 1\r
+tok_name[NL] = 'NL'\r
+N_TOKENS += 2\r
+\r
+def group(*choices): return '(' + '|'.join(choices) + ')'\r
+def any(*choices): return group(*choices) + '*'\r
+def maybe(*choices): return group(*choices) + '?'\r
+\r
+Whitespace = r'[ \f\t]*'\r
+Comment = r'#[^\r\n]*'\r
+Ignore = Whitespace + any(r'\\\r?\n' + Whitespace) + maybe(Comment)\r
+Name = r'[a-zA-Z_]\w*'\r
+\r
+Hexnumber = r'0[xX][\da-fA-F]+[lL]?'\r
+Octnumber = r'(0[oO][0-7]+)|(0[0-7]*)[lL]?'\r
+Binnumber = r'0[bB][01]+[lL]?'\r
+Decnumber = r'[1-9]\d*[lL]?'\r
+Intnumber = group(Hexnumber, Binnumber, Octnumber, Decnumber)\r
+Exponent = r'[eE][-+]?\d+'\r
+Pointfloat = group(r'\d+\.\d*', r'\.\d+') + maybe(Exponent)\r
+Expfloat = r'\d+' + Exponent\r
+Floatnumber = group(Pointfloat, Expfloat)\r
+Imagnumber = group(r'\d+[jJ]', Floatnumber + r'[jJ]')\r
+Number = group(Imagnumber, Floatnumber, Intnumber)\r
+\r
+# Tail end of ' string.\r
+Single = r"[^'\\]*(?:\\.[^'\\]*)*'"\r
+# Tail end of " string.\r
+Double = r'[^"\\]*(?:\\.[^"\\]*)*"'\r
+# Tail end of ''' string.\r
+Single3 = r"[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''"\r
+# Tail end of """ string.\r
+Double3 = r'[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""'\r
+Triple = group("[uUbB]?[rR]?'''", '[uUbB]?[rR]?"""')\r
+# Single-line ' or " string.\r
+String = group(r"[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*'",\r
+               r'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*"')\r
+\r
+# Because of leftmost-then-longest match semantics, be sure to put the\r
+# longest operators first (e.g., if = came before ==, == would get\r
+# recognized as two instances of =).\r
+Operator = group(r"\*\*=?", r">>=?", r"<<=?", r"<>", r"!=",\r
+                 r"//=?",\r
+                 r"[+\-*/%&|^=<>]=?",\r
+                 r"~")\r
+\r
+Bracket = '[][(){}]'\r
+Special = group(r'\r?\n', r'[:;.,`@]')\r
+Funny = group(Operator, Bracket, Special)\r
+\r
+PlainToken = group(Number, Funny, String, Name)\r
+Token = Ignore + PlainToken\r
+\r
+# First (or only) line of ' or " string.\r
+ContStr = group(r"[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*" +\r
+                group("'", r'\\\r?\n'),\r
+                r'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*' +\r
+                group('"', r'\\\r?\n'))\r
+PseudoExtras = group(r'\\\r?\n|\Z', Comment, Triple)\r
+PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name)\r
+\r
+tokenprog, pseudoprog, single3prog, double3prog = map(\r
+    re.compile, (Token, PseudoToken, Single3, Double3))\r
+endprogs = {"'": re.compile(Single), '"': re.compile(Double),\r
+            "'''": single3prog, '"""': double3prog,\r
+            "r'''": single3prog, 'r"""': double3prog,\r
+            "u'''": single3prog, 'u"""': double3prog,\r
+            "ur'''": single3prog, 'ur"""': double3prog,\r
+            "R'''": single3prog, 'R"""': double3prog,\r
+            "U'''": single3prog, 'U"""': double3prog,\r
+            "uR'''": single3prog, 'uR"""': double3prog,\r
+            "Ur'''": single3prog, 'Ur"""': double3prog,\r
+            "UR'''": single3prog, 'UR"""': double3prog,\r
+            "b'''": single3prog, 'b"""': double3prog,\r
+            "br'''": single3prog, 'br"""': double3prog,\r
+            "B'''": single3prog, 'B"""': double3prog,\r
+            "bR'''": single3prog, 'bR"""': double3prog,\r
+            "Br'''": single3prog, 'Br"""': double3prog,\r
+            "BR'''": single3prog, 'BR"""': double3prog,\r
+            'r': None, 'R': None, 'u': None, 'U': None,\r
+            'b': None, 'B': None}\r
+\r
+triple_quoted = {}\r
+for t in ("'''", '"""',\r
+          "r'''", 'r"""', "R'''", 'R"""',\r
+          "u'''", 'u"""', "U'''", 'U"""',\r
+          "ur'''", 'ur"""', "Ur'''", 'Ur"""',\r
+          "uR'''", 'uR"""', "UR'''", 'UR"""',\r
+          "b'''", 'b"""', "B'''", 'B"""',\r
+          "br'''", 'br"""', "Br'''", 'Br"""',\r
+          "bR'''", 'bR"""', "BR'''", 'BR"""'):\r
+    triple_quoted[t] = t\r
+single_quoted = {}\r
+for t in ("'", '"',\r
+          "r'", 'r"', "R'", 'R"',\r
+          "u'", 'u"', "U'", 'U"',\r
+          "ur'", 'ur"', "Ur'", 'Ur"',\r
+          "uR'", 'uR"', "UR'", 'UR"',\r
+          "b'", 'b"', "B'", 'B"',\r
+          "br'", 'br"', "Br'", 'Br"',\r
+          "bR'", 'bR"', "BR'", 'BR"' ):\r
+    single_quoted[t] = t\r
+\r
+tabsize = 8\r
+\r
+class TokenError(Exception): pass\r
+\r
+class StopTokenizing(Exception): pass\r
+\r
+def printtoken(type, token, srow_scol, erow_ecol, line): # for testing\r
+    srow, scol = srow_scol\r
+    erow, ecol = erow_ecol\r
+    print "%d,%d-%d,%d:\t%s\t%s" % \\r
+        (srow, scol, erow, ecol, tok_name[type], repr(token))\r
+\r
+def tokenize(readline, tokeneater=printtoken):\r
+    """\r
+    The tokenize() function accepts two parameters: one representing the\r
+    input stream, and one providing an output mechanism for tokenize().\r
+\r
+    The first parameter, readline, must be a callable object which provides\r
+    the same interface as the readline() method of built-in file objects.\r
+    Each call to the function should return one line of input as a string.\r
+\r
+    The second parameter, tokeneater, must also be a callable object. It is\r
+    called once for each token, with five arguments, corresponding to the\r
+    tuples generated by generate_tokens().\r
+    """\r
+    try:\r
+        tokenize_loop(readline, tokeneater)\r
+    except StopTokenizing:\r
+        pass\r
+\r
+# backwards compatible interface\r
+def tokenize_loop(readline, tokeneater):\r
+    for token_info in generate_tokens(readline):\r
+        tokeneater(*token_info)\r
+\r
+class Untokenizer:\r
+\r
+    def __init__(self):\r
+        self.tokens = []\r
+        self.prev_row = 1\r
+        self.prev_col = 0\r
+\r
+    def add_whitespace(self, start):\r
+        row, col = start\r
+        if row < self.prev_row or row == self.prev_row and col < self.prev_col:\r
+            raise ValueError("start ({},{}) precedes previous end ({},{})"\r
+                             .format(row, col, self.prev_row, self.prev_col))\r
+        row_offset = row - self.prev_row\r
+        if row_offset:\r
+            self.tokens.append("\\\n" * row_offset)\r
+            self.prev_col = 0\r
+        col_offset = col - self.prev_col\r
+        if col_offset:\r
+            self.tokens.append(" " * col_offset)\r
+\r
+    def untokenize(self, iterable):\r
+        it = iter(iterable)\r
+        for t in it:\r
+            if len(t) == 2:\r
+                self.compat(t, it)\r
+                break\r
+            tok_type, token, start, end, line = t\r
+            if tok_type == ENDMARKER:\r
+                break\r
+            self.add_whitespace(start)\r
+            self.tokens.append(token)\r
+            self.prev_row, self.prev_col = end\r
+            if tok_type in (NEWLINE, NL):\r
+                self.prev_row += 1\r
+                self.prev_col = 0\r
+        return "".join(self.tokens)\r
+\r
+    def compat(self, token, iterable):\r
+        indents = []\r
+        toks_append = self.tokens.append\r
+        startline = token[0] in (NEWLINE, NL)\r
+        prevstring = False\r
+\r
+        for tok in chain([token], iterable):\r
+            toknum, tokval = tok[:2]\r
+\r
+            if toknum in (NAME, NUMBER):\r
+                tokval += ' '\r
+\r
+            # Insert a space between two consecutive strings\r
+            if toknum == STRING:\r
+                if prevstring:\r
+                    tokval = ' ' + tokval\r
+                prevstring = True\r
+            else:\r
+                prevstring = False\r
+\r
+            if toknum == INDENT:\r
+                indents.append(tokval)\r
+                continue\r
+            elif toknum == DEDENT:\r
+                indents.pop()\r
+                continue\r
+            elif toknum in (NEWLINE, NL):\r
+                startline = True\r
+            elif startline and indents:\r
+                toks_append(indents[-1])\r
+                startline = False\r
+            toks_append(tokval)\r
+\r
+def untokenize(iterable):\r
+    """Transform tokens back into Python source code.\r
+\r
+    Each element returned by the iterable must be a token sequence\r
+    with at least two elements, a token number and token value.  If\r
+    only two tokens are passed, the resulting output is poor.\r
+\r
+    Round-trip invariant for full input:\r
+        Untokenized source will match input source exactly\r
+\r
+    Round-trip invariant for limited intput:\r
+        # Output text will tokenize the back to the input\r
+        t1 = [tok[:2] for tok in generate_tokens(f.readline)]\r
+        newcode = untokenize(t1)\r
+        readline = iter(newcode.splitlines(1)).next\r
+        t2 = [tok[:2] for tok in generate_tokens(readline)]\r
+        assert t1 == t2\r
+    """\r
+    ut = Untokenizer()\r
+    return ut.untokenize(iterable)\r
+\r
+def generate_tokens(readline):\r
+    """\r
+    The generate_tokens() generator requires one argument, readline, which\r
+    must be a callable object which provides the same interface as the\r
+    readline() method of built-in file objects. Each call to the function\r
+    should return one line of input as a string.  Alternately, readline\r
+    can be a callable function terminating with StopIteration:\r
+        readline = open(myfile).next    # Example of alternate readline\r
+\r
+    The generator produces 5-tuples with these members: the token type; the\r
+    token string; a 2-tuple (srow, scol) of ints specifying the row and\r
+    column where the token begins in the source; a 2-tuple (erow, ecol) of\r
+    ints specifying the row and column where the token ends in the source;\r
+    and the line on which the token was found. The line passed is the\r
+    logical line; continuation lines are included.\r
+    """\r
+    lnum = parenlev = continued = 0\r
+    namechars, numchars = string.ascii_letters + '_', '0123456789'\r
+    contstr, needcont = '', 0\r
+    contline = None\r
+    indents = [0]\r
+\r
+    while 1:                                   # loop over lines in stream\r
+        try:\r
+            line = readline()\r
+        except StopIteration:\r
+            line = ''\r
+        lnum += 1\r
+        pos, max = 0, len(line)\r
+\r
+        if contstr:                            # continued string\r
+            if not line:\r
+                raise TokenError, ("EOF in multi-line string", strstart)\r
+            endmatch = endprog.match(line)\r
+            if endmatch:\r
+                pos = end = endmatch.end(0)\r
+                yield (STRING, contstr + line[:end],\r
+                       strstart, (lnum, end), contline + line)\r
+                contstr, needcont = '', 0\r
+                contline = None\r
+            elif needcont and line[-2:] != '\\\n' and line[-3:] != '\\\r\n':\r
+                yield (ERRORTOKEN, contstr + line,\r
+                           strstart, (lnum, len(line)), contline)\r
+                contstr = ''\r
+                contline = None\r
+                continue\r
+            else:\r
+                contstr = contstr + line\r
+                contline = contline + line\r
+                continue\r
+\r
+        elif parenlev == 0 and not continued:  # new statement\r
+            if not line: break\r
+            column = 0\r
+            while pos < max:                   # measure leading whitespace\r
+                if line[pos] == ' ':\r
+                    column += 1\r
+                elif line[pos] == '\t':\r
+                    column = (column//tabsize + 1)*tabsize\r
+                elif line[pos] == '\f':\r
+                    column = 0\r
+                else:\r
+                    break\r
+                pos += 1\r
+            if pos == max:\r
+                break\r
+\r
+            if line[pos] in '#\r\n':           # skip comments or blank lines\r
+                if line[pos] == '#':\r
+                    comment_token = line[pos:].rstrip('\r\n')\r
+                    nl_pos = pos + len(comment_token)\r
+                    yield (COMMENT, comment_token,\r
+                           (lnum, pos), (lnum, pos + len(comment_token)), line)\r
+                    yield (NL, line[nl_pos:],\r
+                           (lnum, nl_pos), (lnum, len(line)), line)\r
+                else:\r
+                    yield ((NL, COMMENT)[line[pos] == '#'], line[pos:],\r
+                           (lnum, pos), (lnum, len(line)), line)\r
+                continue\r
+\r
+            if column > indents[-1]:           # count indents or dedents\r
+                indents.append(column)\r
+                yield (INDENT, line[:pos], (lnum, 0), (lnum, pos), line)\r
+            while column < indents[-1]:\r
+                if column not in indents:\r
+                    raise IndentationError(\r
+                        "unindent does not match any outer indentation level",\r
+                        ("<tokenize>", lnum, pos, line))\r
+                indents = indents[:-1]\r
+                yield (DEDENT, '', (lnum, pos), (lnum, pos), line)\r
+\r
+        else:                                  # continued statement\r
+            if not line:\r
+                raise TokenError, ("EOF in multi-line statement", (lnum, 0))\r
+            continued = 0\r
+\r
+        while pos < max:\r
+            pseudomatch = pseudoprog.match(line, pos)\r
+            if pseudomatch:                                # scan for tokens\r
+                start, end = pseudomatch.span(1)\r
+                spos, epos, pos = (lnum, start), (lnum, end), end\r
+                if start == end:\r
+                    continue\r
+                token, initial = line[start:end], line[start]\r
+\r
+                if initial in numchars or \\r
+                   (initial == '.' and token != '.'):      # ordinary number\r
+                    yield (NUMBER, token, spos, epos, line)\r
+                elif initial in '\r\n':\r
+                    yield (NL if parenlev > 0 else NEWLINE,\r
+                           token, spos, epos, line)\r
+                elif initial == '#':\r
+                    assert not token.endswith("\n")\r
+                    yield (COMMENT, token, spos, epos, line)\r
+                elif token in triple_quoted:\r
+                    endprog = endprogs[token]\r
+                    endmatch = endprog.match(line, pos)\r
+                    if endmatch:                           # all on one line\r
+                        pos = endmatch.end(0)\r
+                        token = line[start:pos]\r
+                        yield (STRING, token, spos, (lnum, pos), line)\r
+                    else:\r
+                        strstart = (lnum, start)           # multiple lines\r
+                        contstr = line[start:]\r
+                        contline = line\r
+                        break\r
+                elif initial in single_quoted or \\r
+                    token[:2] in single_quoted or \\r
+                    token[:3] in single_quoted:\r
+                    if token[-1] == '\n':                  # continued string\r
+                        strstart = (lnum, start)\r
+                        endprog = (endprogs[initial] or endprogs[token[1]] or\r
+                                   endprogs[token[2]])\r
+                        contstr, needcont = line[start:], 1\r
+                        contline = line\r
+                        break\r
+                    else:                                  # ordinary string\r
+                        yield (STRING, token, spos, epos, line)\r
+                elif initial in namechars:                 # ordinary name\r
+                    yield (NAME, token, spos, epos, line)\r
+                elif initial == '\\':                      # continued stmt\r
+                    continued = 1\r
+                else:\r
+                    if initial in '([{':\r
+                        parenlev += 1\r
+                    elif initial in ')]}':\r
+                        parenlev -= 1\r
+                    yield (OP, token, spos, epos, line)\r
+            else:\r
+                yield (ERRORTOKEN, line[pos],\r
+                           (lnum, pos), (lnum, pos+1), line)\r
+                pos += 1\r
+\r
+    for indent in indents[1:]:                 # pop remaining indent levels\r
+        yield (DEDENT, '', (lnum, 0), (lnum, 0), '')\r
+    yield (ENDMARKER, '', (lnum, 0), (lnum, 0), '')\r
+\r
+if __name__ == '__main__':                     # testing\r
+    import sys\r
+    if len(sys.argv) > 1:\r
+        tokenize(open(sys.argv[1]).readline)\r
+    else:\r
+        tokenize(sys.stdin.readline)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/traceback.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/traceback.py
new file mode 100644 (file)
index 0000000..4e2b291
--- /dev/null
@@ -0,0 +1,320 @@
+"""Extract, format and print information about Python stack traces."""\r
+\r
+import linecache\r
+import sys\r
+import types\r
+\r
+__all__ = ['extract_stack', 'extract_tb', 'format_exception',\r
+           'format_exception_only', 'format_list', 'format_stack',\r
+           'format_tb', 'print_exc', 'format_exc', 'print_exception',\r
+           'print_last', 'print_stack', 'print_tb', 'tb_lineno']\r
+\r
+def _print(file, str='', terminator='\n'):\r
+    file.write(str+terminator)\r
+\r
+\r
+def print_list(extracted_list, file=None):\r
+    """Print the list of tuples as returned by extract_tb() or\r
+    extract_stack() as a formatted stack trace to the given file."""\r
+    if file is None:\r
+        file = sys.stderr\r
+    for filename, lineno, name, line in extracted_list:\r
+        _print(file,\r
+               '  File "%s", line %d, in %s' % (filename,lineno,name))\r
+        if line:\r
+            _print(file, '    %s' % line.strip())\r
+\r
+def format_list(extracted_list):\r
+    """Format a list of traceback entry tuples for printing.\r
+\r
+    Given a list of tuples as returned by extract_tb() or\r
+    extract_stack(), return a list of strings ready for printing.\r
+    Each string in the resulting list corresponds to the item with the\r
+    same index in the argument list.  Each string ends in a newline;\r
+    the strings may contain internal newlines as well, for those items\r
+    whose source text line is not None.\r
+    """\r
+    list = []\r
+    for filename, lineno, name, line in extracted_list:\r
+        item = '  File "%s", line %d, in %s\n' % (filename,lineno,name)\r
+        if line:\r
+            item = item + '    %s\n' % line.strip()\r
+        list.append(item)\r
+    return list\r
+\r
+\r
+def print_tb(tb, limit=None, file=None):\r
+    """Print up to 'limit' stack trace entries from the traceback 'tb'.\r
+\r
+    If 'limit' is omitted or None, all entries are printed.  If 'file'\r
+    is omitted or None, the output goes to sys.stderr; otherwise\r
+    'file' should be an open file or file-like object with a write()\r
+    method.\r
+    """\r
+    if file is None:\r
+        file = sys.stderr\r
+    if limit is None:\r
+        if hasattr(sys, 'tracebacklimit'):\r
+            limit = sys.tracebacklimit\r
+    n = 0\r
+    while tb is not None and (limit is None or n < limit):\r
+        f = tb.tb_frame\r
+        lineno = tb.tb_lineno\r
+        co = f.f_code\r
+        filename = co.co_filename\r
+        name = co.co_name\r
+        _print(file,\r
+               '  File "%s", line %d, in %s' % (filename, lineno, name))\r
+        linecache.checkcache(filename)\r
+        line = linecache.getline(filename, lineno, f.f_globals)\r
+        if line: _print(file, '    ' + line.strip())\r
+        tb = tb.tb_next\r
+        n = n+1\r
+\r
+def format_tb(tb, limit = None):\r
+    """A shorthand for 'format_list(extract_tb(tb, limit))'."""\r
+    return format_list(extract_tb(tb, limit))\r
+\r
+def extract_tb(tb, limit = None):\r
+    """Return list of up to limit pre-processed entries from traceback.\r
+\r
+    This is useful for alternate formatting of stack traces.  If\r
+    'limit' is omitted or None, all entries are extracted.  A\r
+    pre-processed stack trace entry is a quadruple (filename, line\r
+    number, function name, text) representing the information that is\r
+    usually printed for a stack trace.  The text is a string with\r
+    leading and trailing whitespace stripped; if the source is not\r
+    available it is None.\r
+    """\r
+    if limit is None:\r
+        if hasattr(sys, 'tracebacklimit'):\r
+            limit = sys.tracebacklimit\r
+    list = []\r
+    n = 0\r
+    while tb is not None and (limit is None or n < limit):\r
+        f = tb.tb_frame\r
+        lineno = tb.tb_lineno\r
+        co = f.f_code\r
+        filename = co.co_filename\r
+        name = co.co_name\r
+        linecache.checkcache(filename)\r
+        line = linecache.getline(filename, lineno, f.f_globals)\r
+        if line: line = line.strip()\r
+        else: line = None\r
+        list.append((filename, lineno, name, line))\r
+        tb = tb.tb_next\r
+        n = n+1\r
+    return list\r
+\r
+\r
+def print_exception(etype, value, tb, limit=None, file=None):\r
+    """Print exception up to 'limit' stack trace entries from 'tb' to 'file'.\r
+\r
+    This differs from print_tb() in the following ways: (1) if\r
+    traceback is not None, it prints a header "Traceback (most recent\r
+    call last):"; (2) it prints the exception type and value after the\r
+    stack trace; (3) if type is SyntaxError and value has the\r
+    appropriate format, it prints the line where the syntax error\r
+    occurred with a caret on the next line indicating the approximate\r
+    position of the error.\r
+    """\r
+    if file is None:\r
+        file = sys.stderr\r
+    if tb:\r
+        _print(file, 'Traceback (most recent call last):')\r
+        print_tb(tb, limit, file)\r
+    lines = format_exception_only(etype, value)\r
+    for line in lines:\r
+        _print(file, line, '')\r
+\r
+def format_exception(etype, value, tb, limit = None):\r
+    """Format a stack trace and the exception information.\r
+\r
+    The arguments have the same meaning as the corresponding arguments\r
+    to print_exception().  The return value is a list of strings, each\r
+    ending in a newline and some containing internal newlines.  When\r
+    these lines are concatenated and printed, exactly the same text is\r
+    printed as does print_exception().\r
+    """\r
+    if tb:\r
+        list = ['Traceback (most recent call last):\n']\r
+        list = list + format_tb(tb, limit)\r
+    else:\r
+        list = []\r
+    list = list + format_exception_only(etype, value)\r
+    return list\r
+\r
+def format_exception_only(etype, value):\r
+    """Format the exception part of a traceback.\r
+\r
+    The arguments are the exception type and value such as given by\r
+    sys.last_type and sys.last_value. The return value is a list of\r
+    strings, each ending in a newline.\r
+\r
+    Normally, the list contains a single string; however, for\r
+    SyntaxError exceptions, it contains several lines that (when\r
+    printed) display detailed information about where the syntax\r
+    error occurred.\r
+\r
+    The message indicating which exception occurred is always the last\r
+    string in the list.\r
+\r
+    """\r
+\r
+    # An instance should not have a meaningful value parameter, but\r
+    # sometimes does, particularly for string exceptions, such as\r
+    # >>> raise string1, string2  # deprecated\r
+    #\r
+    # Clear these out first because issubtype(string1, SyntaxError)\r
+    # would raise another exception and mask the original problem.\r
+    if (isinstance(etype, BaseException) or\r
+        isinstance(etype, types.InstanceType) or\r
+        etype is None or type(etype) is str):\r
+        return [_format_final_exc_line(etype, value)]\r
+\r
+    stype = etype.__name__\r
+\r
+    if not issubclass(etype, SyntaxError):\r
+        return [_format_final_exc_line(stype, value)]\r
+\r
+    # It was a syntax error; show exactly where the problem was found.\r
+    lines = []\r
+    try:\r
+        msg, (filename, lineno, offset, badline) = value.args\r
+    except Exception:\r
+        pass\r
+    else:\r
+        filename = filename or "<string>"\r
+        lines.append('  File "%s", line %d\n' % (filename, lineno))\r
+        if badline is not None:\r
+            lines.append('    %s\n' % badline.strip())\r
+            if offset is not None:\r
+                caretspace = badline.rstrip('\n')\r
+                offset = min(len(caretspace), offset) - 1\r
+                caretspace = caretspace[:offset].lstrip()\r
+                # non-space whitespace (likes tabs) must be kept for alignment\r
+                caretspace = ((c.isspace() and c or ' ') for c in caretspace)\r
+                lines.append('    %s^\n' % ''.join(caretspace))\r
+        value = msg\r
+\r
+    lines.append(_format_final_exc_line(stype, value))\r
+    return lines\r
+\r
+def _format_final_exc_line(etype, value):\r
+    """Return a list of a single line -- normal case for format_exception_only"""\r
+    valuestr = _some_str(value)\r
+    if value is None or not valuestr:\r
+        line = "%s\n" % etype\r
+    else:\r
+        line = "%s: %s\n" % (etype, valuestr)\r
+    return line\r
+\r
+def _some_str(value):\r
+    try:\r
+        return str(value)\r
+    except Exception:\r
+        pass\r
+    try:\r
+        value = unicode(value)\r
+        return value.encode("ascii", "backslashreplace")\r
+    except Exception:\r
+        pass\r
+    return '<unprintable %s object>' % type(value).__name__\r
+\r
+\r
+def print_exc(limit=None, file=None):\r
+    """Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'.\r
+    (In fact, it uses sys.exc_info() to retrieve the same information\r
+    in a thread-safe way.)"""\r
+    if file is None:\r
+        file = sys.stderr\r
+    try:\r
+        etype, value, tb = sys.exc_info()\r
+        print_exception(etype, value, tb, limit, file)\r
+    finally:\r
+        etype = value = tb = None\r
+\r
+\r
+def format_exc(limit=None):\r
+    """Like print_exc() but return a string."""\r
+    try:\r
+        etype, value, tb = sys.exc_info()\r
+        return ''.join(format_exception(etype, value, tb, limit))\r
+    finally:\r
+        etype = value = tb = None\r
+\r
+\r
+def print_last(limit=None, file=None):\r
+    """This is a shorthand for 'print_exception(sys.last_type,\r
+    sys.last_value, sys.last_traceback, limit, file)'."""\r
+    if not hasattr(sys, "last_type"):\r
+        raise ValueError("no last exception")\r
+    if file is None:\r
+        file = sys.stderr\r
+    print_exception(sys.last_type, sys.last_value, sys.last_traceback,\r
+                    limit, file)\r
+\r
+\r
+def print_stack(f=None, limit=None, file=None):\r
+    """Print a stack trace from its invocation point.\r
+\r
+    The optional 'f' argument can be used to specify an alternate\r
+    stack frame at which to start. The optional 'limit' and 'file'\r
+    arguments have the same meaning as for print_exception().\r
+    """\r
+    if f is None:\r
+        try:\r
+            raise ZeroDivisionError\r
+        except ZeroDivisionError:\r
+            f = sys.exc_info()[2].tb_frame.f_back\r
+    print_list(extract_stack(f, limit), file)\r
+\r
+def format_stack(f=None, limit=None):\r
+    """Shorthand for 'format_list(extract_stack(f, limit))'."""\r
+    if f is None:\r
+        try:\r
+            raise ZeroDivisionError\r
+        except ZeroDivisionError:\r
+            f = sys.exc_info()[2].tb_frame.f_back\r
+    return format_list(extract_stack(f, limit))\r
+\r
+def extract_stack(f=None, limit = None):\r
+    """Extract the raw traceback from the current stack frame.\r
+\r
+    The return value has the same format as for extract_tb().  The\r
+    optional 'f' and 'limit' arguments have the same meaning as for\r
+    print_stack().  Each item in the list is a quadruple (filename,\r
+    line number, function name, text), and the entries are in order\r
+    from oldest to newest stack frame.\r
+    """\r
+    if f is None:\r
+        try:\r
+            raise ZeroDivisionError\r
+        except ZeroDivisionError:\r
+            f = sys.exc_info()[2].tb_frame.f_back\r
+    if limit is None:\r
+        if hasattr(sys, 'tracebacklimit'):\r
+            limit = sys.tracebacklimit\r
+    list = []\r
+    n = 0\r
+    while f is not None and (limit is None or n < limit):\r
+        lineno = f.f_lineno\r
+        co = f.f_code\r
+        filename = co.co_filename\r
+        name = co.co_name\r
+        linecache.checkcache(filename)\r
+        line = linecache.getline(filename, lineno, f.f_globals)\r
+        if line: line = line.strip()\r
+        else: line = None\r
+        list.append((filename, lineno, name, line))\r
+        f = f.f_back\r
+        n = n+1\r
+    list.reverse()\r
+    return list\r
+\r
+def tb_lineno(tb):\r
+    """Calculate correct line number of traceback given in tb.\r
+\r
+    Obsolete in 2.3.\r
+    """\r
+    return tb.tb_lineno\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/types.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/types.py
new file mode 100644 (file)
index 0000000..f1f18c7
--- /dev/null
@@ -0,0 +1,86 @@
+"""Define names for all type symbols known in the standard interpreter.\r
+\r
+Types that are part of optional modules (e.g. array) are not listed.\r
+"""\r
+import sys\r
+\r
+# Iterators in Python aren't a matter of type but of protocol.  A large\r
+# and changing number of builtin types implement *some* flavor of\r
+# iterator.  Don't check the type!  Use hasattr to check for both\r
+# "__iter__" and "next" attributes instead.\r
+\r
+NoneType = type(None)\r
+TypeType = type\r
+ObjectType = object\r
+\r
+IntType = int\r
+LongType = long\r
+FloatType = float\r
+BooleanType = bool\r
+try:\r
+    ComplexType = complex\r
+except NameError:\r
+    pass\r
+\r
+StringType = str\r
+\r
+# StringTypes is already outdated.  Instead of writing "type(x) in\r
+# types.StringTypes", you should use "isinstance(x, basestring)".  But\r
+# we keep around for compatibility with Python 2.2.\r
+try:\r
+    UnicodeType = unicode\r
+    StringTypes = (StringType, UnicodeType)\r
+except NameError:\r
+    StringTypes = (StringType,)\r
+\r
+BufferType = buffer\r
+\r
+TupleType = tuple\r
+ListType = list\r
+DictType = DictionaryType = dict\r
+\r
+def _f(): pass\r
+FunctionType = type(_f)\r
+LambdaType = type(lambda: None)         # Same as FunctionType\r
+CodeType = type(_f.func_code)\r
+\r
+def _g():\r
+    yield 1\r
+GeneratorType = type(_g())\r
+\r
+class _C:\r
+    def _m(self): pass\r
+ClassType = type(_C)\r
+UnboundMethodType = type(_C._m)         # Same as MethodType\r
+_x = _C()\r
+InstanceType = type(_x)\r
+MethodType = type(_x._m)\r
+\r
+BuiltinFunctionType = type(len)\r
+BuiltinMethodType = type([].append)     # Same as BuiltinFunctionType\r
+\r
+ModuleType = type(sys)\r
+FileType = file\r
+XRangeType = xrange\r
+\r
+try:\r
+    raise TypeError\r
+except TypeError:\r
+    tb = sys.exc_info()[2]\r
+    TracebackType = type(tb)\r
+    FrameType = type(tb.tb_frame)\r
+    del tb\r
+\r
+SliceType = slice\r
+EllipsisType = type(Ellipsis)\r
+\r
+DictProxyType = type(TypeType.__dict__)\r
+NotImplementedType = type(NotImplemented)\r
+\r
+# For Jython, the following two types are identical\r
+GetSetDescriptorType = type(FunctionType.func_code)\r
+MemberDescriptorType = type(FunctionType.func_globals)\r
+\r
+del sys, _f, _g, _C, _x                           # Not for export\r
+\r
+__all__ = list(n for n in globals() if n[:1] != '_')\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/urlparse.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/urlparse.py
new file mode 100644 (file)
index 0000000..c4de785
--- /dev/null
@@ -0,0 +1,428 @@
+"""Parse (absolute and relative) URLs.\r
+\r
+urlparse module is based upon the following RFC specifications.\r
+\r
+RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding\r
+and L.  Masinter, January 2005.\r
+\r
+RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter\r
+and L.Masinter, December 1999.\r
+\r
+RFC 2396:  "Uniform Resource Identifiers (URI)": Generic Syntax by T.\r
+Berners-Lee, R. Fielding, and L. Masinter, August 1998.\r
+\r
+RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zwinski, July 1998.\r
+\r
+RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June\r
+1995.\r
+\r
+RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M.\r
+McCahill, December 1994\r
+\r
+RFC 3986 is considered the current standard and any future changes to\r
+urlparse module should conform with it.  The urlparse module is\r
+currently not entirely compliant with this RFC due to defacto\r
+scenarios for parsing, and for backward compatibility purposes, some\r
+parsing quirks from older RFCs are retained. The testcases in\r
+test_urlparse.py provides a good indicator of parsing behavior.\r
+\r
+"""\r
+\r
+import re\r
+\r
+__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",\r
+           "urlsplit", "urlunsplit", "parse_qs", "parse_qsl"]\r
+\r
+# A classification of schemes ('' means apply by default)\r
+uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap',\r
+                 'wais', 'file', 'https', 'shttp', 'mms',\r
+                 'prospero', 'rtsp', 'rtspu', '', 'sftp',\r
+                 'svn', 'svn+ssh']\r
+uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',\r
+               'imap', 'wais', 'file', 'mms', 'https', 'shttp',\r
+               'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '',\r
+               'svn', 'svn+ssh', 'sftp','nfs','git', 'git+ssh']\r
+uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',\r
+               'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',\r
+               'mms', '', 'sftp', 'tel']\r
+\r
+# These are not actually used anymore, but should stay for backwards\r
+# compatibility.  (They are undocumented, but have a public-looking name.)\r
+non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',\r
+                    'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']\r
+uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',\r
+              'gopher', 'rtsp', 'rtspu', 'sip', 'sips', '']\r
+uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news',\r
+                 'nntp', 'wais', 'https', 'shttp', 'snews',\r
+                 'file', 'prospero', '']\r
+\r
+# Characters valid in scheme names\r
+scheme_chars = ('abcdefghijklmnopqrstuvwxyz'\r
+                'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\r
+                '0123456789'\r
+                '+-.')\r
+\r
+MAX_CACHE_SIZE = 20\r
+_parse_cache = {}\r
+\r
+def clear_cache():\r
+    """Clear the parse cache."""\r
+    _parse_cache.clear()\r
+\r
+\r
+class ResultMixin(object):\r
+    """Shared methods for the parsed result objects."""\r
+\r
+    @property\r
+    def username(self):\r
+        netloc = self.netloc\r
+        if "@" in netloc:\r
+            userinfo = netloc.rsplit("@", 1)[0]\r
+            if ":" in userinfo:\r
+                userinfo = userinfo.split(":", 1)[0]\r
+            return userinfo\r
+        return None\r
+\r
+    @property\r
+    def password(self):\r
+        netloc = self.netloc\r
+        if "@" in netloc:\r
+            userinfo = netloc.rsplit("@", 1)[0]\r
+            if ":" in userinfo:\r
+                return userinfo.split(":", 1)[1]\r
+        return None\r
+\r
+    @property\r
+    def hostname(self):\r
+        netloc = self.netloc.split('@')[-1]\r
+        if '[' in netloc and ']' in netloc:\r
+            return netloc.split(']')[0][1:].lower()\r
+        elif ':' in netloc:\r
+            return netloc.split(':')[0].lower()\r
+        elif netloc == '':\r
+            return None\r
+        else:\r
+            return netloc.lower()\r
+\r
+    @property\r
+    def port(self):\r
+        netloc = self.netloc.split('@')[-1].split(']')[-1]\r
+        if ':' in netloc:\r
+            port = netloc.split(':')[1]\r
+            if port:\r
+                port = int(port, 10)\r
+                # verify legal port\r
+                if (0 <= port <= 65535):\r
+                    return port\r
+        return None\r
+\r
+from collections import namedtuple\r
+\r
+class SplitResult(namedtuple('SplitResult', 'scheme netloc path query fragment'), ResultMixin):\r
+\r
+    __slots__ = ()\r
+\r
+    def geturl(self):\r
+        return urlunsplit(self)\r
+\r
+\r
+class ParseResult(namedtuple('ParseResult', 'scheme netloc path params query fragment'), ResultMixin):\r
+\r
+    __slots__ = ()\r
+\r
+    def geturl(self):\r
+        return urlunparse(self)\r
+\r
+\r
+def urlparse(url, scheme='', allow_fragments=True):\r
+    """Parse a URL into 6 components:\r
+    <scheme>://<netloc>/<path>;<params>?<query>#<fragment>\r
+    Return a 6-tuple: (scheme, netloc, path, params, query, fragment).\r
+    Note that we don't break the components up in smaller bits\r
+    (e.g. netloc is a single string) and we don't expand % escapes."""\r
+    tuple = urlsplit(url, scheme, allow_fragments)\r
+    scheme, netloc, url, query, fragment = tuple\r
+    if scheme in uses_params and ';' in url:\r
+        url, params = _splitparams(url)\r
+    else:\r
+        params = ''\r
+    return ParseResult(scheme, netloc, url, params, query, fragment)\r
+\r
+def _splitparams(url):\r
+    if '/'  in url:\r
+        i = url.find(';', url.rfind('/'))\r
+        if i < 0:\r
+            return url, ''\r
+    else:\r
+        i = url.find(';')\r
+    return url[:i], url[i+1:]\r
+\r
+def _splitnetloc(url, start=0):\r
+    delim = len(url)   # position of end of domain part of url, default is end\r
+    for c in '/?#':    # look for delimiters; the order is NOT important\r
+        wdelim = url.find(c, start)        # find first of this delim\r
+        if wdelim >= 0:                    # if found\r
+            delim = min(delim, wdelim)     # use earliest delim position\r
+    return url[start:delim], url[delim:]   # return (domain, rest)\r
+\r
+def urlsplit(url, scheme='', allow_fragments=True):\r
+    """Parse a URL into 5 components:\r
+    <scheme>://<netloc>/<path>?<query>#<fragment>\r
+    Return a 5-tuple: (scheme, netloc, path, query, fragment).\r
+    Note that we don't break the components up in smaller bits\r
+    (e.g. netloc is a single string) and we don't expand % escapes."""\r
+    allow_fragments = bool(allow_fragments)\r
+    key = url, scheme, allow_fragments, type(url), type(scheme)\r
+    cached = _parse_cache.get(key, None)\r
+    if cached:\r
+        return cached\r
+    if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth\r
+        clear_cache()\r
+    netloc = query = fragment = ''\r
+    i = url.find(':')\r
+    if i > 0:\r
+        if url[:i] == 'http': # optimize the common case\r
+            scheme = url[:i].lower()\r
+            url = url[i+1:]\r
+            if url[:2] == '//':\r
+                netloc, url = _splitnetloc(url, 2)\r
+                if (('[' in netloc and ']' not in netloc) or\r
+                        (']' in netloc and '[' not in netloc)):\r
+                    raise ValueError("Invalid IPv6 URL")\r
+            if allow_fragments and '#' in url:\r
+                url, fragment = url.split('#', 1)\r
+            if '?' in url:\r
+                url, query = url.split('?', 1)\r
+            v = SplitResult(scheme, netloc, url, query, fragment)\r
+            _parse_cache[key] = v\r
+            return v\r
+        for c in url[:i]:\r
+            if c not in scheme_chars:\r
+                break\r
+        else:\r
+            # make sure "url" is not actually a port number (in which case\r
+            # "scheme" is really part of the path)\r
+            rest = url[i+1:]\r
+            if not rest or any(c not in '0123456789' for c in rest):\r
+                # not a port number\r
+                scheme, url = url[:i].lower(), rest\r
+\r
+    if url[:2] == '//':\r
+        netloc, url = _splitnetloc(url, 2)\r
+        if (('[' in netloc and ']' not in netloc) or\r
+                (']' in netloc and '[' not in netloc)):\r
+            raise ValueError("Invalid IPv6 URL")\r
+    if allow_fragments and '#' in url:\r
+        url, fragment = url.split('#', 1)\r
+    if '?' in url:\r
+        url, query = url.split('?', 1)\r
+    v = SplitResult(scheme, netloc, url, query, fragment)\r
+    _parse_cache[key] = v\r
+    return v\r
+\r
+def urlunparse(data):\r
+    """Put a parsed URL back together again.  This may result in a\r
+    slightly different, but equivalent URL, if the URL that was parsed\r
+    originally had redundant delimiters, e.g. a ? with an empty query\r
+    (the draft states that these are equivalent)."""\r
+    scheme, netloc, url, params, query, fragment = data\r
+    if params:\r
+        url = "%s;%s" % (url, params)\r
+    return urlunsplit((scheme, netloc, url, query, fragment))\r
+\r
+def urlunsplit(data):\r
+    """Combine the elements of a tuple as returned by urlsplit() into a\r
+    complete URL as a string. The data argument can be any five-item iterable.\r
+    This may result in a slightly different, but equivalent URL, if the URL that\r
+    was parsed originally had unnecessary delimiters (for example, a ? with an\r
+    empty query; the RFC states that these are equivalent)."""\r
+    scheme, netloc, url, query, fragment = data\r
+    if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):\r
+        if url and url[:1] != '/': url = '/' + url\r
+        url = '//' + (netloc or '') + url\r
+    if scheme:\r
+        url = scheme + ':' + url\r
+    if query:\r
+        url = url + '?' + query\r
+    if fragment:\r
+        url = url + '#' + fragment\r
+    return url\r
+\r
+def urljoin(base, url, allow_fragments=True):\r
+    """Join a base URL and a possibly relative URL to form an absolute\r
+    interpretation of the latter."""\r
+    if not base:\r
+        return url\r
+    if not url:\r
+        return base\r
+    bscheme, bnetloc, bpath, bparams, bquery, bfragment = \\r
+            urlparse(base, '', allow_fragments)\r
+    scheme, netloc, path, params, query, fragment = \\r
+            urlparse(url, bscheme, allow_fragments)\r
+    if scheme != bscheme or scheme not in uses_relative:\r
+        return url\r
+    if scheme in uses_netloc:\r
+        if netloc:\r
+            return urlunparse((scheme, netloc, path,\r
+                               params, query, fragment))\r
+        netloc = bnetloc\r
+    if path[:1] == '/':\r
+        return urlunparse((scheme, netloc, path,\r
+                           params, query, fragment))\r
+    if not path and not params:\r
+        path = bpath\r
+        params = bparams\r
+        if not query:\r
+            query = bquery\r
+        return urlunparse((scheme, netloc, path,\r
+                           params, query, fragment))\r
+    segments = bpath.split('/')[:-1] + path.split('/')\r
+    # XXX The stuff below is bogus in various ways...\r
+    if segments[-1] == '.':\r
+        segments[-1] = ''\r
+    while '.' in segments:\r
+        segments.remove('.')\r
+    while 1:\r
+        i = 1\r
+        n = len(segments) - 1\r
+        while i < n:\r
+            if (segments[i] == '..'\r
+                and segments[i-1] not in ('', '..')):\r
+                del segments[i-1:i+1]\r
+                break\r
+            i = i+1\r
+        else:\r
+            break\r
+    if segments == ['', '..']:\r
+        segments[-1] = ''\r
+    elif len(segments) >= 2 and segments[-1] == '..':\r
+        segments[-2:] = ['']\r
+    return urlunparse((scheme, netloc, '/'.join(segments),\r
+                       params, query, fragment))\r
+\r
+def urldefrag(url):\r
+    """Removes any existing fragment from URL.\r
+\r
+    Returns a tuple of the defragmented URL and the fragment.  If\r
+    the URL contained no fragments, the second element is the\r
+    empty string.\r
+    """\r
+    if '#' in url:\r
+        s, n, p, a, q, frag = urlparse(url)\r
+        defrag = urlunparse((s, n, p, a, q, ''))\r
+        return defrag, frag\r
+    else:\r
+        return url, ''\r
+\r
+try:\r
+    unicode\r
+except NameError:\r
+    def _is_unicode(x):\r
+        return 0\r
+else:\r
+    def _is_unicode(x):\r
+        return isinstance(x, unicode)\r
+\r
+# unquote method for parse_qs and parse_qsl\r
+# Cannot use directly from urllib as it would create a circular reference\r
+# because urllib uses urlparse methods (urljoin).  If you update this function,\r
+# update it also in urllib.  This code duplication does not existin in Python3.\r
+\r
+_hexdig = '0123456789ABCDEFabcdef'\r
+_hextochr = dict((a+b, chr(int(a+b,16)))\r
+                 for a in _hexdig for b in _hexdig)\r
+_asciire = re.compile('([\x00-\x7f]+)')\r
+\r
+def unquote(s):\r
+    """unquote('abc%20def') -> 'abc def'."""\r
+    if _is_unicode(s):\r
+        if '%' not in s:\r
+            return s\r
+        bits = _asciire.split(s)\r
+        res = [bits[0]]\r
+        append = res.append\r
+        for i in range(1, len(bits), 2):\r
+            append(unquote(str(bits[i])).decode('latin1'))\r
+            append(bits[i + 1])\r
+        return ''.join(res)\r
+\r
+    bits = s.split('%')\r
+    # fastpath\r
+    if len(bits) == 1:\r
+        return s\r
+    res = [bits[0]]\r
+    append = res.append\r
+    for item in bits[1:]:\r
+        try:\r
+            append(_hextochr[item[:2]])\r
+            append(item[2:])\r
+        except KeyError:\r
+            append('%')\r
+            append(item)\r
+    return ''.join(res)\r
+\r
+def parse_qs(qs, keep_blank_values=0, strict_parsing=0):\r
+    """Parse a query given as a string argument.\r
+\r
+        Arguments:\r
+\r
+        qs: percent-encoded query string to be parsed\r
+\r
+        keep_blank_values: flag indicating whether blank values in\r
+            percent-encoded queries should be treated as blank strings.\r
+            A true value indicates that blanks should be retained as\r
+            blank strings.  The default false value indicates that\r
+            blank values are to be ignored and treated as if they were\r
+            not included.\r
+\r
+        strict_parsing: flag indicating what to do with parsing errors.\r
+            If false (the default), errors are silently ignored.\r
+            If true, errors raise a ValueError exception.\r
+    """\r
+    dict = {}\r
+    for name, value in parse_qsl(qs, keep_blank_values, strict_parsing):\r
+        if name in dict:\r
+            dict[name].append(value)\r
+        else:\r
+            dict[name] = [value]\r
+    return dict\r
+\r
+def parse_qsl(qs, keep_blank_values=0, strict_parsing=0):\r
+    """Parse a query given as a string argument.\r
+\r
+    Arguments:\r
+\r
+    qs: percent-encoded query string to be parsed\r
+\r
+    keep_blank_values: flag indicating whether blank values in\r
+        percent-encoded queries should be treated as blank strings.  A\r
+        true value indicates that blanks should be retained as blank\r
+        strings.  The default false value indicates that blank values\r
+        are to be ignored and treated as if they were  not included.\r
+\r
+    strict_parsing: flag indicating what to do with parsing errors. If\r
+        false (the default), errors are silently ignored. If true,\r
+        errors raise a ValueError exception.\r
+\r
+    Returns a list, as G-d intended.\r
+    """\r
+    pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]\r
+    r = []\r
+    for name_value in pairs:\r
+        if not name_value and not strict_parsing:\r
+            continue\r
+        nv = name_value.split('=', 1)\r
+        if len(nv) != 2:\r
+            if strict_parsing:\r
+                raise ValueError, "bad query field: %r" % (name_value,)\r
+            # Handle case of a control-name with no equal sign\r
+            if keep_blank_values:\r
+                nv.append('')\r
+            else:\r
+                continue\r
+        if len(nv[1]) or keep_blank_values:\r
+            name = unquote(nv[0].replace('+', ' '))\r
+            value = unquote(nv[1].replace('+', ' '))\r
+            r.append((name, value))\r
+\r
+    return r\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/warnings.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/warnings.py
new file mode 100644 (file)
index 0000000..8098c6e
--- /dev/null
@@ -0,0 +1,404 @@
+"""Python part of the warnings subsystem."""\r
+\r
+# Note: function level imports should *not* be used\r
+# in this module as it may cause import lock deadlock.\r
+# See bug 683658.\r
+import linecache\r
+import sys\r
+import types\r
+\r
+__all__ = ["warn", "warn_explicit", "showwarning",\r
+           "formatwarning", "filterwarnings", "simplefilter",\r
+           "resetwarnings", "catch_warnings"]\r
+\r
+\r
+def warnpy3k(message, category=None, stacklevel=1):\r
+    """Issue a deprecation warning for Python 3.x related changes.\r
+\r
+    Warnings are omitted unless Python is started with the -3 option.\r
+    """\r
+    if sys.py3kwarning:\r
+        if category is None:\r
+            category = DeprecationWarning\r
+        warn(message, category, stacklevel+1)\r
+\r
+def _show_warning(message, category, filename, lineno, file=None, line=None):\r
+    """Hook to write a warning to a file; replace if you like."""\r
+    if file is None:\r
+        file = sys.stderr\r
+        if file is None:\r
+            # sys.stderr is None - warnings get lost\r
+            return\r
+    try:\r
+        file.write(formatwarning(message, category, filename, lineno, line))\r
+    except IOError:\r
+        pass # the file (probably stderr) is invalid - this warning gets lost.\r
+# Keep a working version around in case the deprecation of the old API is\r
+# triggered.\r
+showwarning = _show_warning\r
+\r
+def formatwarning(message, category, filename, lineno, line=None):\r
+    """Function to format a warning the standard way."""\r
+    s =  "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message)\r
+    line = linecache.getline(filename, lineno) if line is None else line\r
+    if line:\r
+        line = line.strip()\r
+        s += "  %s\n" % line\r
+    return s\r
+\r
+def filterwarnings(action, message="", category=Warning, module="", lineno=0,\r
+                   append=0):\r
+    """Insert an entry into the list of warnings filters (at the front).\r
+\r
+    'action' -- one of "error", "ignore", "always", "default", "module",\r
+                or "once"\r
+    'message' -- a regex that the warning message must match\r
+    'category' -- a class that the warning must be a subclass of\r
+    'module' -- a regex that the module name must match\r
+    'lineno' -- an integer line number, 0 matches all warnings\r
+    'append' -- if true, append to the list of filters\r
+    """\r
+    import re\r
+    assert action in ("error", "ignore", "always", "default", "module",\r
+                      "once"), "invalid action: %r" % (action,)\r
+    assert isinstance(message, basestring), "message must be a string"\r
+    assert isinstance(category, (type, types.ClassType)), \\r
+           "category must be a class"\r
+    assert issubclass(category, Warning), "category must be a Warning subclass"\r
+    assert isinstance(module, basestring), "module must be a string"\r
+    assert isinstance(lineno, int) and lineno >= 0, \\r
+           "lineno must be an int >= 0"\r
+    item = (action, re.compile(message, re.I), category,\r
+            re.compile(module), lineno)\r
+    if append:\r
+        filters.append(item)\r
+    else:\r
+        filters.insert(0, item)\r
+\r
+def simplefilter(action, category=Warning, lineno=0, append=0):\r
+    """Insert a simple entry into the list of warnings filters (at the front).\r
+\r
+    A simple filter matches all modules and messages.\r
+    'action' -- one of "error", "ignore", "always", "default", "module",\r
+                or "once"\r
+    'category' -- a class that the warning must be a subclass of\r
+    'lineno' -- an integer line number, 0 matches all warnings\r
+    'append' -- if true, append to the list of filters\r
+    """\r
+    assert action in ("error", "ignore", "always", "default", "module",\r
+                      "once"), "invalid action: %r" % (action,)\r
+    assert isinstance(lineno, int) and lineno >= 0, \\r
+           "lineno must be an int >= 0"\r
+    item = (action, None, category, None, lineno)\r
+    if append:\r
+        filters.append(item)\r
+    else:\r
+        filters.insert(0, item)\r
+\r
+def resetwarnings():\r
+    """Clear the list of warning filters, so that no filters are active."""\r
+    filters[:] = []\r
+\r
+class _OptionError(Exception):\r
+    """Exception used by option processing helpers."""\r
+    pass\r
+\r
+# Helper to process -W options passed via sys.warnoptions\r
+def _processoptions(args):\r
+    for arg in args:\r
+        try:\r
+            _setoption(arg)\r
+        except _OptionError, msg:\r
+            print >>sys.stderr, "Invalid -W option ignored:", msg\r
+\r
+# Helper for _processoptions()\r
+def _setoption(arg):\r
+    import re\r
+    parts = arg.split(':')\r
+    if len(parts) > 5:\r
+        raise _OptionError("too many fields (max 5): %r" % (arg,))\r
+    while len(parts) < 5:\r
+        parts.append('')\r
+    action, message, category, module, lineno = [s.strip()\r
+                                                 for s in parts]\r
+    action = _getaction(action)\r
+    message = re.escape(message)\r
+    category = _getcategory(category)\r
+    module = re.escape(module)\r
+    if module:\r
+        module = module + '$'\r
+    if lineno:\r
+        try:\r
+            lineno = int(lineno)\r
+            if lineno < 0:\r
+                raise ValueError\r
+        except (ValueError, OverflowError):\r
+            raise _OptionError("invalid lineno %r" % (lineno,))\r
+    else:\r
+        lineno = 0\r
+    filterwarnings(action, message, category, module, lineno)\r
+\r
+# Helper for _setoption()\r
+def _getaction(action):\r
+    if not action:\r
+        return "default"\r
+    if action == "all": return "always" # Alias\r
+    for a in ('default', 'always', 'ignore', 'module', 'once', 'error'):\r
+        if a.startswith(action):\r
+            return a\r
+    raise _OptionError("invalid action: %r" % (action,))\r
+\r
+# Helper for _setoption()\r
+def _getcategory(category):\r
+    import re\r
+    if not category:\r
+        return Warning\r
+    if re.match("^[a-zA-Z0-9_]+$", category):\r
+        try:\r
+            cat = eval(category)\r
+        except NameError:\r
+            raise _OptionError("unknown warning category: %r" % (category,))\r
+    else:\r
+        i = category.rfind(".")\r
+        module = category[:i]\r
+        klass = category[i+1:]\r
+        try:\r
+            m = __import__(module, None, None, [klass])\r
+        except ImportError:\r
+            raise _OptionError("invalid module name: %r" % (module,))\r
+        try:\r
+            cat = getattr(m, klass)\r
+        except AttributeError:\r
+            raise _OptionError("unknown warning category: %r" % (category,))\r
+    if not issubclass(cat, Warning):\r
+        raise _OptionError("invalid warning category: %r" % (category,))\r
+    return cat\r
+\r
+\r
+# Code typically replaced by _warnings\r
+def warn(message, category=None, stacklevel=1):\r
+    """Issue a warning, or maybe ignore it or raise an exception."""\r
+    # Check if message is already a Warning object\r
+    if isinstance(message, Warning):\r
+        category = message.__class__\r
+    # Check category argument\r
+    if category is None:\r
+        category = UserWarning\r
+    assert issubclass(category, Warning)\r
+    # Get context information\r
+    try:\r
+        caller = sys._getframe(stacklevel)\r
+    except ValueError:\r
+        globals = sys.__dict__\r
+        lineno = 1\r
+    else:\r
+        globals = caller.f_globals\r
+        lineno = caller.f_lineno\r
+    if '__name__' in globals:\r
+        module = globals['__name__']\r
+    else:\r
+        module = "<string>"\r
+    filename = globals.get('__file__')\r
+    if filename:\r
+        fnl = filename.lower()\r
+        if fnl.endswith((".pyc", ".pyo")):\r
+            filename = filename[:-1]\r
+    else:\r
+        if module == "__main__":\r
+            try:\r
+                filename = sys.argv[0]\r
+            except AttributeError:\r
+                # embedded interpreters don't have sys.argv, see bug #839151\r
+                filename = '__main__'\r
+        if not filename:\r
+            filename = module\r
+    registry = globals.setdefault("__warningregistry__", {})\r
+    warn_explicit(message, category, filename, lineno, module, registry,\r
+                  globals)\r
+\r
+def warn_explicit(message, category, filename, lineno,\r
+                  module=None, registry=None, module_globals=None):\r
+    lineno = int(lineno)\r
+    if module is None:\r
+        module = filename or "<unknown>"\r
+        if module[-3:].lower() == ".py":\r
+            module = module[:-3] # XXX What about leading pathname?\r
+    if registry is None:\r
+        registry = {}\r
+    if isinstance(message, Warning):\r
+        text = str(message)\r
+        category = message.__class__\r
+    else:\r
+        text = message\r
+        message = category(message)\r
+    key = (text, category, lineno)\r
+    # Quick test for common case\r
+    if registry.get(key):\r
+        return\r
+    # Search the filters\r
+    for item in filters:\r
+        action, msg, cat, mod, ln = item\r
+        if ((msg is None or msg.match(text)) and\r
+            issubclass(category, cat) and\r
+            (mod is None or mod.match(module)) and\r
+            (ln == 0 or lineno == ln)):\r
+            break\r
+    else:\r
+        action = defaultaction\r
+    # Early exit actions\r
+    if action == "ignore":\r
+        registry[key] = 1\r
+        return\r
+\r
+    # Prime the linecache for formatting, in case the\r
+    # "file" is actually in a zipfile or something.\r
+    linecache.getlines(filename, module_globals)\r
+\r
+    if action == "error":\r
+        raise message\r
+    # Other actions\r
+    if action == "once":\r
+        registry[key] = 1\r
+        oncekey = (text, category)\r
+        if onceregistry.get(oncekey):\r
+            return\r
+        onceregistry[oncekey] = 1\r
+    elif action == "always":\r
+        pass\r
+    elif action == "module":\r
+        registry[key] = 1\r
+        altkey = (text, category, 0)\r
+        if registry.get(altkey):\r
+            return\r
+        registry[altkey] = 1\r
+    elif action == "default":\r
+        registry[key] = 1\r
+    else:\r
+        # Unrecognized actions are errors\r
+        raise RuntimeError(\r
+              "Unrecognized action (%r) in warnings.filters:\n %s" %\r
+              (action, item))\r
+    # Print message and context\r
+    showwarning(message, category, filename, lineno)\r
+\r
+\r
+class WarningMessage(object):\r
+\r
+    """Holds the result of a single showwarning() call."""\r
+\r
+    _WARNING_DETAILS = ("message", "category", "filename", "lineno", "file",\r
+                        "line")\r
+\r
+    def __init__(self, message, category, filename, lineno, file=None,\r
+                    line=None):\r
+        local_values = locals()\r
+        for attr in self._WARNING_DETAILS:\r
+            setattr(self, attr, local_values[attr])\r
+        self._category_name = category.__name__ if category else None\r
+\r
+    def __str__(self):\r
+        return ("{message : %r, category : %r, filename : %r, lineno : %s, "\r
+                    "line : %r}" % (self.message, self._category_name,\r
+                                    self.filename, self.lineno, self.line))\r
+\r
+\r
+class catch_warnings(object):\r
+\r
+    """A context manager that copies and restores the warnings filter upon\r
+    exiting the context.\r
+\r
+    The 'record' argument specifies whether warnings should be captured by a\r
+    custom implementation of warnings.showwarning() and be appended to a list\r
+    returned by the context manager. Otherwise None is returned by the context\r
+    manager. The objects appended to the list are arguments whose attributes\r
+    mirror the arguments to showwarning().\r
+\r
+    The 'module' argument is to specify an alternative module to the module\r
+    named 'warnings' and imported under that name. This argument is only useful\r
+    when testing the warnings module itself.\r
+\r
+    """\r
+\r
+    def __init__(self, record=False, module=None):\r
+        """Specify whether to record warnings and if an alternative module\r
+        should be used other than sys.modules['warnings'].\r
+\r
+        For compatibility with Python 3.0, please consider all arguments to be\r
+        keyword-only.\r
+\r
+        """\r
+        self._record = record\r
+        self._module = sys.modules['warnings'] if module is None else module\r
+        self._entered = False\r
+\r
+    def __repr__(self):\r
+        args = []\r
+        if self._record:\r
+            args.append("record=True")\r
+        if self._module is not sys.modules['warnings']:\r
+            args.append("module=%r" % self._module)\r
+        name = type(self).__name__\r
+        return "%s(%s)" % (name, ", ".join(args))\r
+\r
+    def __enter__(self):\r
+        if self._entered:\r
+            raise RuntimeError("Cannot enter %r twice" % self)\r
+        self._entered = True\r
+        self._filters = self._module.filters\r
+        self._module.filters = self._filters[:]\r
+        self._showwarning = self._module.showwarning\r
+        if self._record:\r
+            log = []\r
+            def showwarning(*args, **kwargs):\r
+                log.append(WarningMessage(*args, **kwargs))\r
+            self._module.showwarning = showwarning\r
+            return log\r
+        else:\r
+            return None\r
+\r
+    def __exit__(self, *exc_info):\r
+        if not self._entered:\r
+            raise RuntimeError("Cannot exit %r without entering first" % self)\r
+        self._module.filters = self._filters\r
+        self._module.showwarning = self._showwarning\r
+\r
+\r
+# filters contains a sequence of filter 5-tuples\r
+# The components of the 5-tuple are:\r
+# - an action: error, ignore, always, default, module, or once\r
+# - a compiled regex that must match the warning message\r
+# - a class representing the warning category\r
+# - a compiled regex that must match the module that is being warned\r
+# - a line number for the line being warning, or 0 to mean any line\r
+# If either if the compiled regexs are None, match anything.\r
+_warnings_defaults = False\r
+try:\r
+    from _warnings import (filters, default_action, once_registry,\r
+                            warn, warn_explicit)\r
+    defaultaction = default_action\r
+    onceregistry = once_registry\r
+    _warnings_defaults = True\r
+except ImportError:\r
+    filters = []\r
+    defaultaction = "default"\r
+    onceregistry = {}\r
+\r
+\r
+# Module initialization\r
+_processoptions(sys.warnoptions)\r
+if not _warnings_defaults:\r
+    silence = [ImportWarning, PendingDeprecationWarning]\r
+    # Don't silence DeprecationWarning if -3 or -Q was used.\r
+    if not sys.py3kwarning and not sys.flags.division_warning:\r
+        silence.append(DeprecationWarning)\r
+    for cls in silence:\r
+        simplefilter("ignore", category=cls)\r
+    bytes_warning = sys.flags.bytes_warning\r
+    if bytes_warning > 1:\r
+        bytes_action = "error"\r
+    elif bytes_warning:\r
+        bytes_action = "default"\r
+    else:\r
+        bytes_action = "ignore"\r
+    simplefilter(bytes_action, category=BytesWarning, append=1)\r
+del _warnings_defaults\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/weakref.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/weakref.py
new file mode 100644 (file)
index 0000000..dc6dbf0
--- /dev/null
@@ -0,0 +1,443 @@
+"""Weak reference support for Python.\r
+\r
+This module is an implementation of PEP 205:\r
+\r
+http://www.python.org/dev/peps/pep-0205/\r
+"""\r
+\r
+# Naming convention: Variables named "wr" are weak reference objects;\r
+# they are called this instead of "ref" to avoid name collisions with\r
+# the module-global ref() function imported from _weakref.\r
+\r
+import UserDict\r
+\r
+from _weakref import (\r
+     getweakrefcount,\r
+     getweakrefs,\r
+     ref,\r
+     proxy,\r
+     CallableProxyType,\r
+     ProxyType,\r
+     ReferenceType)\r
+\r
+from _weakrefset import WeakSet, _IterationGuard\r
+\r
+from exceptions import ReferenceError\r
+\r
+\r
+ProxyTypes = (ProxyType, CallableProxyType)\r
+\r
+__all__ = ["ref", "proxy", "getweakrefcount", "getweakrefs",\r
+           "WeakKeyDictionary", "ReferenceError", "ReferenceType", "ProxyType",\r
+           "CallableProxyType", "ProxyTypes", "WeakValueDictionary", 'WeakSet']\r
+\r
+\r
+class WeakValueDictionary(UserDict.UserDict):\r
+    """Mapping class that references values weakly.\r
+\r
+    Entries in the dictionary will be discarded when no strong\r
+    reference to the value exists anymore\r
+    """\r
+    # We inherit the constructor without worrying about the input\r
+    # dictionary; since it uses our .update() method, we get the right\r
+    # checks (if the other dictionary is a WeakValueDictionary,\r
+    # objects are unwrapped on the way out, and we always wrap on the\r
+    # way in).\r
+\r
+    def __init__(self, *args, **kw):\r
+        def remove(wr, selfref=ref(self)):\r
+            self = selfref()\r
+            if self is not None:\r
+                if self._iterating:\r
+                    self._pending_removals.append(wr.key)\r
+                else:\r
+                    del self.data[wr.key]\r
+        self._remove = remove\r
+        # A list of keys to be removed\r
+        self._pending_removals = []\r
+        self._iterating = set()\r
+        UserDict.UserDict.__init__(self, *args, **kw)\r
+\r
+    def _commit_removals(self):\r
+        l = self._pending_removals\r
+        d = self.data\r
+        # We shouldn't encounter any KeyError, because this method should\r
+        # always be called *before* mutating the dict.\r
+        while l:\r
+            del d[l.pop()]\r
+\r
+    def __getitem__(self, key):\r
+        o = self.data[key]()\r
+        if o is None:\r
+            raise KeyError, key\r
+        else:\r
+            return o\r
+\r
+    def __delitem__(self, key):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        del self.data[key]\r
+\r
+    def __contains__(self, key):\r
+        try:\r
+            o = self.data[key]()\r
+        except KeyError:\r
+            return False\r
+        return o is not None\r
+\r
+    def has_key(self, key):\r
+        try:\r
+            o = self.data[key]()\r
+        except KeyError:\r
+            return False\r
+        return o is not None\r
+\r
+    def __repr__(self):\r
+        return "<WeakValueDictionary at %s>" % id(self)\r
+\r
+    def __setitem__(self, key, value):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        self.data[key] = KeyedRef(value, self._remove, key)\r
+\r
+    def clear(self):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        self.data.clear()\r
+\r
+    def copy(self):\r
+        new = WeakValueDictionary()\r
+        for key, wr in self.data.items():\r
+            o = wr()\r
+            if o is not None:\r
+                new[key] = o\r
+        return new\r
+\r
+    __copy__ = copy\r
+\r
+    def __deepcopy__(self, memo):\r
+        from copy import deepcopy\r
+        new = self.__class__()\r
+        for key, wr in self.data.items():\r
+            o = wr()\r
+            if o is not None:\r
+                new[deepcopy(key, memo)] = o\r
+        return new\r
+\r
+    def get(self, key, default=None):\r
+        try:\r
+            wr = self.data[key]\r
+        except KeyError:\r
+            return default\r
+        else:\r
+            o = wr()\r
+            if o is None:\r
+                # This should only happen\r
+                return default\r
+            else:\r
+                return o\r
+\r
+    def items(self):\r
+        L = []\r
+        for key, wr in self.data.items():\r
+            o = wr()\r
+            if o is not None:\r
+                L.append((key, o))\r
+        return L\r
+\r
+    def iteritems(self):\r
+        with _IterationGuard(self):\r
+            for wr in self.data.itervalues():\r
+                value = wr()\r
+                if value is not None:\r
+                    yield wr.key, value\r
+\r
+    def iterkeys(self):\r
+        with _IterationGuard(self):\r
+            for k in self.data.iterkeys():\r
+                yield k\r
+\r
+    __iter__ = iterkeys\r
+\r
+    def itervaluerefs(self):\r
+        """Return an iterator that yields the weak references to the values.\r
+\r
+        The references are not guaranteed to be 'live' at the time\r
+        they are used, so the result of calling the references needs\r
+        to be checked before being used.  This can be used to avoid\r
+        creating references that will cause the garbage collector to\r
+        keep the values around longer than needed.\r
+\r
+        """\r
+        with _IterationGuard(self):\r
+            for wr in self.data.itervalues():\r
+                yield wr\r
+\r
+    def itervalues(self):\r
+        with _IterationGuard(self):\r
+            for wr in self.data.itervalues():\r
+                obj = wr()\r
+                if obj is not None:\r
+                    yield obj\r
+\r
+    def popitem(self):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        while 1:\r
+            key, wr = self.data.popitem()\r
+            o = wr()\r
+            if o is not None:\r
+                return key, o\r
+\r
+    def pop(self, key, *args):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        try:\r
+            o = self.data.pop(key)()\r
+        except KeyError:\r
+            if args:\r
+                return args[0]\r
+            raise\r
+        if o is None:\r
+            raise KeyError, key\r
+        else:\r
+            return o\r
+\r
+    def setdefault(self, key, default=None):\r
+        try:\r
+            wr = self.data[key]\r
+        except KeyError:\r
+            if self._pending_removals:\r
+                self._commit_removals()\r
+            self.data[key] = KeyedRef(default, self._remove, key)\r
+            return default\r
+        else:\r
+            return wr()\r
+\r
+    def update(self, dict=None, **kwargs):\r
+        if self._pending_removals:\r
+            self._commit_removals()\r
+        d = self.data\r
+        if dict is not None:\r
+            if not hasattr(dict, "items"):\r
+                dict = type({})(dict)\r
+            for key, o in dict.items():\r
+                d[key] = KeyedRef(o, self._remove, key)\r
+        if len(kwargs):\r
+            self.update(kwargs)\r
+\r
+    def valuerefs(self):\r
+        """Return a list of weak references to the values.\r
+\r
+        The references are not guaranteed to be 'live' at the time\r
+        they are used, so the result of calling the references needs\r
+        to be checked before being used.  This can be used to avoid\r
+        creating references that will cause the garbage collector to\r
+        keep the values around longer than needed.\r
+\r
+        """\r
+        return self.data.values()\r
+\r
+    def values(self):\r
+        L = []\r
+        for wr in self.data.values():\r
+            o = wr()\r
+            if o is not None:\r
+                L.append(o)\r
+        return L\r
+\r
+\r
+class KeyedRef(ref):\r
+    """Specialized reference that includes a key corresponding to the value.\r
+\r
+    This is used in the WeakValueDictionary to avoid having to create\r
+    a function object for each key stored in the mapping.  A shared\r
+    callback object can use the 'key' attribute of a KeyedRef instead\r
+    of getting a reference to the key from an enclosing scope.\r
+\r
+    """\r
+\r
+    __slots__ = "key",\r
+\r
+    def __new__(type, ob, callback, key):\r
+        self = ref.__new__(type, ob, callback)\r
+        self.key = key\r
+        return self\r
+\r
+    def __init__(self, ob, callback, key):\r
+        super(KeyedRef,  self).__init__(ob, callback)\r
+\r
+\r
+class WeakKeyDictionary(UserDict.UserDict):\r
+    """ Mapping class that references keys weakly.\r
+\r
+    Entries in the dictionary will be discarded when there is no\r
+    longer a strong reference to the key. This can be used to\r
+    associate additional data with an object owned by other parts of\r
+    an application without adding attributes to those objects. This\r
+    can be especially useful with objects that override attribute\r
+    accesses.\r
+    """\r
+\r
+    def __init__(self, dict=None):\r
+        self.data = {}\r
+        def remove(k, selfref=ref(self)):\r
+            self = selfref()\r
+            if self is not None:\r
+                if self._iterating:\r
+                    self._pending_removals.append(k)\r
+                else:\r
+                    del self.data[k]\r
+        self._remove = remove\r
+        # A list of dead weakrefs (keys to be removed)\r
+        self._pending_removals = []\r
+        self._iterating = set()\r
+        if dict is not None:\r
+            self.update(dict)\r
+\r
+    def _commit_removals(self):\r
+        # NOTE: We don't need to call this method before mutating the dict,\r
+        # because a dead weakref never compares equal to a live weakref,\r
+        # even if they happened to refer to equal objects.\r
+        # However, it means keys may already have been removed.\r
+        l = self._pending_removals\r
+        d = self.data\r
+        while l:\r
+            try:\r
+                del d[l.pop()]\r
+            except KeyError:\r
+                pass\r
+\r
+    def __delitem__(self, key):\r
+        del self.data[ref(key)]\r
+\r
+    def __getitem__(self, key):\r
+        return self.data[ref(key)]\r
+\r
+    def __repr__(self):\r
+        return "<WeakKeyDictionary at %s>" % id(self)\r
+\r
+    def __setitem__(self, key, value):\r
+        self.data[ref(key, self._remove)] = value\r
+\r
+    def copy(self):\r
+        new = WeakKeyDictionary()\r
+        for key, value in self.data.items():\r
+            o = key()\r
+            if o is not None:\r
+                new[o] = value\r
+        return new\r
+\r
+    __copy__ = copy\r
+\r
+    def __deepcopy__(self, memo):\r
+        from copy import deepcopy\r
+        new = self.__class__()\r
+        for key, value in self.data.items():\r
+            o = key()\r
+            if o is not None:\r
+                new[o] = deepcopy(value, memo)\r
+        return new\r
+\r
+    def get(self, key, default=None):\r
+        return self.data.get(ref(key),default)\r
+\r
+    def has_key(self, key):\r
+        try:\r
+            wr = ref(key)\r
+        except TypeError:\r
+            return 0\r
+        return wr in self.data\r
+\r
+    def __contains__(self, key):\r
+        try:\r
+            wr = ref(key)\r
+        except TypeError:\r
+            return 0\r
+        return wr in self.data\r
+\r
+    def items(self):\r
+        L = []\r
+        for key, value in self.data.items():\r
+            o = key()\r
+            if o is not None:\r
+                L.append((o, value))\r
+        return L\r
+\r
+    def iteritems(self):\r
+        with _IterationGuard(self):\r
+            for wr, value in self.data.iteritems():\r
+                key = wr()\r
+                if key is not None:\r
+                    yield key, value\r
+\r
+    def iterkeyrefs(self):\r
+        """Return an iterator that yields the weak references to the keys.\r
+\r
+        The references are not guaranteed to be 'live' at the time\r
+        they are used, so the result of calling the references needs\r
+        to be checked before being used.  This can be used to avoid\r
+        creating references that will cause the garbage collector to\r
+        keep the keys around longer than needed.\r
+\r
+        """\r
+        with _IterationGuard(self):\r
+            for wr in self.data.iterkeys():\r
+                yield wr\r
+\r
+    def iterkeys(self):\r
+        with _IterationGuard(self):\r
+            for wr in self.data.iterkeys():\r
+                obj = wr()\r
+                if obj is not None:\r
+                    yield obj\r
+\r
+    __iter__ = iterkeys\r
+\r
+    def itervalues(self):\r
+        with _IterationGuard(self):\r
+            for value in self.data.itervalues():\r
+                yield value\r
+\r
+    def keyrefs(self):\r
+        """Return a list of weak references to the keys.\r
+\r
+        The references are not guaranteed to be 'live' at the time\r
+        they are used, so the result of calling the references needs\r
+        to be checked before being used.  This can be used to avoid\r
+        creating references that will cause the garbage collector to\r
+        keep the keys around longer than needed.\r
+\r
+        """\r
+        return self.data.keys()\r
+\r
+    def keys(self):\r
+        L = []\r
+        for wr in self.data.keys():\r
+            o = wr()\r
+            if o is not None:\r
+                L.append(o)\r
+        return L\r
+\r
+    def popitem(self):\r
+        while 1:\r
+            key, value = self.data.popitem()\r
+            o = key()\r
+            if o is not None:\r
+                return o, value\r
+\r
+    def pop(self, key, *args):\r
+        return self.data.pop(ref(key), *args)\r
+\r
+    def setdefault(self, key, default=None):\r
+        return self.data.setdefault(ref(key, self._remove),default)\r
+\r
+    def update(self, dict=None, **kwargs):\r
+        d = self.data\r
+        if dict is not None:\r
+            if not hasattr(dict, "items"):\r
+                dict = type({})(dict)\r
+            for key, value in dict.items():\r
+                d[ref(key, self._remove)] = value\r
+        if len(kwargs):\r
+            self.update(kwargs)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/__init__.py
new file mode 100644 (file)
index 0000000..086543a
--- /dev/null
@@ -0,0 +1,41 @@
+"""Core XML support for Python.\r
+\r
+This package contains four sub-packages:\r
+\r
+dom -- The W3C Document Object Model.  This supports DOM Level 1 +\r
+       Namespaces.\r
+\r
+parsers -- Python wrappers for XML parsers (currently only supports Expat).\r
+\r
+sax -- The Simple API for XML, developed by XML-Dev, led by David\r
+       Megginson and ported to Python by Lars Marius Garshol.  This\r
+       supports the SAX 2 API.\r
+\r
+etree -- The ElementTree XML library.  This is a subset of the full\r
+       ElementTree XML release.\r
+\r
+"""\r
+\r
+\r
+__all__ = ["dom", "parsers", "sax", "etree"]\r
+\r
+_MINIMUM_XMLPLUS_VERSION = (0, 8, 4)\r
+\r
+\r
+try:\r
+    import _xmlplus\r
+except ImportError:\r
+    pass\r
+else:\r
+    try:\r
+        v = _xmlplus.version_info\r
+    except AttributeError:\r
+        # _xmlplus is too old; ignore it\r
+        pass\r
+    else:\r
+        if v >= _MINIMUM_XMLPLUS_VERSION:\r
+            import sys\r
+            _xmlplus.__path__.extend(__path__)\r
+            sys.modules[__name__] = _xmlplus\r
+        else:\r
+            del v\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/NodeFilter.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/NodeFilter.py
new file mode 100644 (file)
index 0000000..07886e0
--- /dev/null
@@ -0,0 +1,27 @@
+# This is the Python mapping for interface NodeFilter from\r
+# DOM2-Traversal-Range. It contains only constants.\r
+\r
+class NodeFilter:\r
+    """\r
+    This is the DOM2 NodeFilter interface. It contains only constants.\r
+    """\r
+    FILTER_ACCEPT = 1\r
+    FILTER_REJECT = 2\r
+    FILTER_SKIP   = 3\r
+\r
+    SHOW_ALL                    = 0xFFFFFFFFL\r
+    SHOW_ELEMENT                = 0x00000001\r
+    SHOW_ATTRIBUTE              = 0x00000002\r
+    SHOW_TEXT                   = 0x00000004\r
+    SHOW_CDATA_SECTION          = 0x00000008\r
+    SHOW_ENTITY_REFERENCE       = 0x00000010\r
+    SHOW_ENTITY                 = 0x00000020\r
+    SHOW_PROCESSING_INSTRUCTION = 0x00000040\r
+    SHOW_COMMENT                = 0x00000080\r
+    SHOW_DOCUMENT               = 0x00000100\r
+    SHOW_DOCUMENT_TYPE          = 0x00000200\r
+    SHOW_DOCUMENT_FRAGMENT      = 0x00000400\r
+    SHOW_NOTATION               = 0x00000800\r
+\r
+    def acceptNode(self, node):\r
+        raise NotImplementedError\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/__init__.py
new file mode 100644 (file)
index 0000000..5da489d
--- /dev/null
@@ -0,0 +1,139 @@
+"""W3C Document Object Model implementation for Python.\r
+\r
+The Python mapping of the Document Object Model is documented in the\r
+Python Library Reference in the section on the xml.dom package.\r
+\r
+This package contains the following modules:\r
+\r
+minidom -- A simple implementation of the Level 1 DOM with namespace\r
+           support added (based on the Level 2 specification) and other\r
+           minor Level 2 functionality.\r
+\r
+pulldom -- DOM builder supporting on-demand tree-building for selected\r
+           subtrees of the document.\r
+\r
+"""\r
+\r
+\r
+class Node:\r
+    """Class giving the NodeType constants."""\r
+\r
+    # DOM implementations may use this as a base class for their own\r
+    # Node implementations.  If they don't, the constants defined here\r
+    # should still be used as the canonical definitions as they match\r
+    # the values given in the W3C recommendation.  Client code can\r
+    # safely refer to these values in all tests of Node.nodeType\r
+    # values.\r
+\r
+    ELEMENT_NODE                = 1\r
+    ATTRIBUTE_NODE              = 2\r
+    TEXT_NODE                   = 3\r
+    CDATA_SECTION_NODE          = 4\r
+    ENTITY_REFERENCE_NODE       = 5\r
+    ENTITY_NODE                 = 6\r
+    PROCESSING_INSTRUCTION_NODE = 7\r
+    COMMENT_NODE                = 8\r
+    DOCUMENT_NODE               = 9\r
+    DOCUMENT_TYPE_NODE          = 10\r
+    DOCUMENT_FRAGMENT_NODE      = 11\r
+    NOTATION_NODE               = 12\r
+\r
+\r
+#ExceptionCode\r
+INDEX_SIZE_ERR                 = 1\r
+DOMSTRING_SIZE_ERR             = 2\r
+HIERARCHY_REQUEST_ERR          = 3\r
+WRONG_DOCUMENT_ERR             = 4\r
+INVALID_CHARACTER_ERR          = 5\r
+NO_DATA_ALLOWED_ERR            = 6\r
+NO_MODIFICATION_ALLOWED_ERR    = 7\r
+NOT_FOUND_ERR                  = 8\r
+NOT_SUPPORTED_ERR              = 9\r
+INUSE_ATTRIBUTE_ERR            = 10\r
+INVALID_STATE_ERR              = 11\r
+SYNTAX_ERR                     = 12\r
+INVALID_MODIFICATION_ERR       = 13\r
+NAMESPACE_ERR                  = 14\r
+INVALID_ACCESS_ERR             = 15\r
+VALIDATION_ERR                 = 16\r
+\r
+\r
+class DOMException(Exception):\r
+    """Abstract base class for DOM exceptions.\r
+    Exceptions with specific codes are specializations of this class."""\r
+\r
+    def __init__(self, *args, **kw):\r
+        if self.__class__ is DOMException:\r
+            raise RuntimeError(\r
+                "DOMException should not be instantiated directly")\r
+        Exception.__init__(self, *args, **kw)\r
+\r
+    def _get_code(self):\r
+        return self.code\r
+\r
+\r
+class IndexSizeErr(DOMException):\r
+    code = INDEX_SIZE_ERR\r
+\r
+class DomstringSizeErr(DOMException):\r
+    code = DOMSTRING_SIZE_ERR\r
+\r
+class HierarchyRequestErr(DOMException):\r
+    code = HIERARCHY_REQUEST_ERR\r
+\r
+class WrongDocumentErr(DOMException):\r
+    code = WRONG_DOCUMENT_ERR\r
+\r
+class InvalidCharacterErr(DOMException):\r
+    code = INVALID_CHARACTER_ERR\r
+\r
+class NoDataAllowedErr(DOMException):\r
+    code = NO_DATA_ALLOWED_ERR\r
+\r
+class NoModificationAllowedErr(DOMException):\r
+    code = NO_MODIFICATION_ALLOWED_ERR\r
+\r
+class NotFoundErr(DOMException):\r
+    code = NOT_FOUND_ERR\r
+\r
+class NotSupportedErr(DOMException):\r
+    code = NOT_SUPPORTED_ERR\r
+\r
+class InuseAttributeErr(DOMException):\r
+    code = INUSE_ATTRIBUTE_ERR\r
+\r
+class InvalidStateErr(DOMException):\r
+    code = INVALID_STATE_ERR\r
+\r
+class SyntaxErr(DOMException):\r
+    code = SYNTAX_ERR\r
+\r
+class InvalidModificationErr(DOMException):\r
+    code = INVALID_MODIFICATION_ERR\r
+\r
+class NamespaceErr(DOMException):\r
+    code = NAMESPACE_ERR\r
+\r
+class InvalidAccessErr(DOMException):\r
+    code = INVALID_ACCESS_ERR\r
+\r
+class ValidationErr(DOMException):\r
+    code = VALIDATION_ERR\r
+\r
+class UserDataHandler:\r
+    """Class giving the operation constants for UserDataHandler.handle()."""\r
+\r
+    # Based on DOM Level 3 (WD 9 April 2002)\r
+\r
+    NODE_CLONED   = 1\r
+    NODE_IMPORTED = 2\r
+    NODE_DELETED  = 3\r
+    NODE_RENAMED  = 4\r
+\r
+XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"\r
+XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/"\r
+XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml"\r
+EMPTY_NAMESPACE = None\r
+EMPTY_PREFIX = None\r
+\r
+from domreg import getDOMImplementation,registerDOMImplementation\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/domreg.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/domreg.py
new file mode 100644 (file)
index 0000000..751f54a
--- /dev/null
@@ -0,0 +1,99 @@
+"""Registration facilities for DOM. This module should not be used\r
+directly. Instead, the functions getDOMImplementation and\r
+registerDOMImplementation should be imported from xml.dom."""\r
+\r
+from xml.dom.minicompat import *  # isinstance, StringTypes\r
+\r
+# This is a list of well-known implementations.  Well-known names\r
+# should be published by posting to xml-sig@python.org, and are\r
+# subsequently recorded in this file.\r
+\r
+well_known_implementations = {\r
+    'minidom':'xml.dom.minidom',\r
+    '4DOM': 'xml.dom.DOMImplementation',\r
+    }\r
+\r
+# DOM implementations not officially registered should register\r
+# themselves with their\r
+\r
+registered = {}\r
+\r
+def registerDOMImplementation(name, factory):\r
+    """registerDOMImplementation(name, factory)\r
+\r
+    Register the factory function with the name. The factory function\r
+    should return an object which implements the DOMImplementation\r
+    interface. The factory function can either return the same object,\r
+    or a new one (e.g. if that implementation supports some\r
+    customization)."""\r
+\r
+    registered[name] = factory\r
+\r
+def _good_enough(dom, features):\r
+    "_good_enough(dom, features) -> Return 1 if the dom offers the features"\r
+    for f,v in features:\r
+        if not dom.hasFeature(f,v):\r
+            return 0\r
+    return 1\r
+\r
+def getDOMImplementation(name = None, features = ()):\r
+    """getDOMImplementation(name = None, features = ()) -> DOM implementation.\r
+\r
+    Return a suitable DOM implementation. The name is either\r
+    well-known, the module name of a DOM implementation, or None. If\r
+    it is not None, imports the corresponding module and returns\r
+    DOMImplementation object if the import succeeds.\r
+\r
+    If name is not given, consider the available implementations to\r
+    find one with the required feature set. If no implementation can\r
+    be found, raise an ImportError. The features list must be a sequence\r
+    of (feature, version) pairs which are passed to hasFeature."""\r
+\r
+    import os\r
+    creator = None\r
+    mod = well_known_implementations.get(name)\r
+    if mod:\r
+        mod = __import__(mod, {}, {}, ['getDOMImplementation'])\r
+        return mod.getDOMImplementation()\r
+    elif name:\r
+        return registered[name]()\r
+    elif "PYTHON_DOM" in os.environ:\r
+        return getDOMImplementation(name = os.environ["PYTHON_DOM"])\r
+\r
+    # User did not specify a name, try implementations in arbitrary\r
+    # order, returning the one that has the required features\r
+    if isinstance(features, StringTypes):\r
+        features = _parse_feature_string(features)\r
+    for creator in registered.values():\r
+        dom = creator()\r
+        if _good_enough(dom, features):\r
+            return dom\r
+\r
+    for creator in well_known_implementations.keys():\r
+        try:\r
+            dom = getDOMImplementation(name = creator)\r
+        except StandardError: # typically ImportError, or AttributeError\r
+            continue\r
+        if _good_enough(dom, features):\r
+            return dom\r
+\r
+    raise ImportError,"no suitable DOM implementation found"\r
+\r
+def _parse_feature_string(s):\r
+    features = []\r
+    parts = s.split()\r
+    i = 0\r
+    length = len(parts)\r
+    while i < length:\r
+        feature = parts[i]\r
+        if feature[0] in "0123456789":\r
+            raise ValueError, "bad feature name: %r" % (feature,)\r
+        i = i + 1\r
+        version = None\r
+        if i < length:\r
+            v = parts[i]\r
+            if v[0] in "0123456789":\r
+                i = i + 1\r
+                version = v\r
+        features.append((feature, version))\r
+    return tuple(features)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/expatbuilder.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/expatbuilder.py
new file mode 100644 (file)
index 0000000..95c23a0
--- /dev/null
@@ -0,0 +1,983 @@
+"""Facility to use the Expat parser to load a minidom instance\r
+from a string or file.\r
+\r
+This avoids all the overhead of SAX and pulldom to gain performance.\r
+"""\r
+\r
+# Warning!\r
+#\r
+# This module is tightly bound to the implementation details of the\r
+# minidom DOM and can't be used with other DOM implementations.  This\r
+# is due, in part, to a lack of appropriate methods in the DOM (there is\r
+# no way to create Entity and Notation nodes via the DOM Level 2\r
+# interface), and for performance.  The later is the cause of some fairly\r
+# cryptic code.\r
+#\r
+# Performance hacks:\r
+#\r
+#   -  .character_data_handler() has an extra case in which continuing\r
+#      data is appended to an existing Text node; this can be a\r
+#      speedup since pyexpat can break up character data into multiple\r
+#      callbacks even though we set the buffer_text attribute on the\r
+#      parser.  This also gives us the advantage that we don't need a\r
+#      separate normalization pass.\r
+#\r
+#   -  Determining that a node exists is done using an identity comparison\r
+#      with None rather than a truth test; this avoids searching for and\r
+#      calling any methods on the node object if it exists.  (A rather\r
+#      nice speedup is achieved this way as well!)\r
+\r
+from xml.dom import xmlbuilder, minidom, Node\r
+from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE\r
+from xml.parsers import expat\r
+from xml.dom.minidom import _append_child, _set_attribute_node\r
+from xml.dom.NodeFilter import NodeFilter\r
+\r
+from xml.dom.minicompat import *\r
+\r
+TEXT_NODE = Node.TEXT_NODE\r
+CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE\r
+DOCUMENT_NODE = Node.DOCUMENT_NODE\r
+\r
+FILTER_ACCEPT = xmlbuilder.DOMBuilderFilter.FILTER_ACCEPT\r
+FILTER_REJECT = xmlbuilder.DOMBuilderFilter.FILTER_REJECT\r
+FILTER_SKIP = xmlbuilder.DOMBuilderFilter.FILTER_SKIP\r
+FILTER_INTERRUPT = xmlbuilder.DOMBuilderFilter.FILTER_INTERRUPT\r
+\r
+theDOMImplementation = minidom.getDOMImplementation()\r
+\r
+# Expat typename -> TypeInfo\r
+_typeinfo_map = {\r
+    "CDATA":    minidom.TypeInfo(None, "cdata"),\r
+    "ENUM":     minidom.TypeInfo(None, "enumeration"),\r
+    "ENTITY":   minidom.TypeInfo(None, "entity"),\r
+    "ENTITIES": minidom.TypeInfo(None, "entities"),\r
+    "ID":       minidom.TypeInfo(None, "id"),\r
+    "IDREF":    minidom.TypeInfo(None, "idref"),\r
+    "IDREFS":   minidom.TypeInfo(None, "idrefs"),\r
+    "NMTOKEN":  minidom.TypeInfo(None, "nmtoken"),\r
+    "NMTOKENS": minidom.TypeInfo(None, "nmtokens"),\r
+    }\r
+\r
+class ElementInfo(object):\r
+    __slots__ = '_attr_info', '_model', 'tagName'\r
+\r
+    def __init__(self, tagName, model=None):\r
+        self.tagName = tagName\r
+        self._attr_info = []\r
+        self._model = model\r
+\r
+    def __getstate__(self):\r
+        return self._attr_info, self._model, self.tagName\r
+\r
+    def __setstate__(self, state):\r
+        self._attr_info, self._model, self.tagName = state\r
+\r
+    def getAttributeType(self, aname):\r
+        for info in self._attr_info:\r
+            if info[1] == aname:\r
+                t = info[-2]\r
+                if t[0] == "(":\r
+                    return _typeinfo_map["ENUM"]\r
+                else:\r
+                    return _typeinfo_map[info[-2]]\r
+        return minidom._no_type\r
+\r
+    def getAttributeTypeNS(self, namespaceURI, localName):\r
+        return minidom._no_type\r
+\r
+    def isElementContent(self):\r
+        if self._model:\r
+            type = self._model[0]\r
+            return type not in (expat.model.XML_CTYPE_ANY,\r
+                                expat.model.XML_CTYPE_MIXED)\r
+        else:\r
+            return False\r
+\r
+    def isEmpty(self):\r
+        if self._model:\r
+            return self._model[0] == expat.model.XML_CTYPE_EMPTY\r
+        else:\r
+            return False\r
+\r
+    def isId(self, aname):\r
+        for info in self._attr_info:\r
+            if info[1] == aname:\r
+                return info[-2] == "ID"\r
+        return False\r
+\r
+    def isIdNS(self, euri, ename, auri, aname):\r
+        # not sure this is meaningful\r
+        return self.isId((auri, aname))\r
+\r
+def _intern(builder, s):\r
+    return builder._intern_setdefault(s, s)\r
+\r
+def _parse_ns_name(builder, name):\r
+    assert ' ' in name\r
+    parts = name.split(' ')\r
+    intern = builder._intern_setdefault\r
+    if len(parts) == 3:\r
+        uri, localname, prefix = parts\r
+        prefix = intern(prefix, prefix)\r
+        qname = "%s:%s" % (prefix, localname)\r
+        qname = intern(qname, qname)\r
+        localname = intern(localname, localname)\r
+    else:\r
+        uri, localname = parts\r
+        prefix = EMPTY_PREFIX\r
+        qname = localname = intern(localname, localname)\r
+    return intern(uri, uri), localname, prefix, qname\r
+\r
+\r
+class ExpatBuilder:\r
+    """Document builder that uses Expat to build a ParsedXML.DOM document\r
+    instance."""\r
+\r
+    def __init__(self, options=None):\r
+        if options is None:\r
+            options = xmlbuilder.Options()\r
+        self._options = options\r
+        if self._options.filter is not None:\r
+            self._filter = FilterVisibilityController(self._options.filter)\r
+        else:\r
+            self._filter = None\r
+            # This *really* doesn't do anything in this case, so\r
+            # override it with something fast & minimal.\r
+            self._finish_start_element = id\r
+        self._parser = None\r
+        self.reset()\r
+\r
+    def createParser(self):\r
+        """Create a new parser object."""\r
+        return expat.ParserCreate()\r
+\r
+    def getParser(self):\r
+        """Return the parser object, creating a new one if needed."""\r
+        if not self._parser:\r
+            self._parser = self.createParser()\r
+            self._intern_setdefault = self._parser.intern.setdefault\r
+            self._parser.buffer_text = True\r
+            self._parser.ordered_attributes = True\r
+            self._parser.specified_attributes = True\r
+            self.install(self._parser)\r
+        return self._parser\r
+\r
+    def reset(self):\r
+        """Free all data structures used during DOM construction."""\r
+        self.document = theDOMImplementation.createDocument(\r
+            EMPTY_NAMESPACE, None, None)\r
+        self.curNode = self.document\r
+        self._elem_info = self.document._elem_info\r
+        self._cdata = False\r
+\r
+    def install(self, parser):\r
+        """Install the callbacks needed to build the DOM into the parser."""\r
+        # This creates circular references!\r
+        parser.StartDoctypeDeclHandler = self.start_doctype_decl_handler\r
+        parser.StartElementHandler = self.first_element_handler\r
+        parser.EndElementHandler = self.end_element_handler\r
+        parser.ProcessingInstructionHandler = self.pi_handler\r
+        if self._options.entities:\r
+            parser.EntityDeclHandler = self.entity_decl_handler\r
+        parser.NotationDeclHandler = self.notation_decl_handler\r
+        if self._options.comments:\r
+            parser.CommentHandler = self.comment_handler\r
+        if self._options.cdata_sections:\r
+            parser.StartCdataSectionHandler = self.start_cdata_section_handler\r
+            parser.EndCdataSectionHandler = self.end_cdata_section_handler\r
+            parser.CharacterDataHandler = self.character_data_handler_cdata\r
+        else:\r
+            parser.CharacterDataHandler = self.character_data_handler\r
+        parser.ExternalEntityRefHandler = self.external_entity_ref_handler\r
+        parser.XmlDeclHandler = self.xml_decl_handler\r
+        parser.ElementDeclHandler = self.element_decl_handler\r
+        parser.AttlistDeclHandler = self.attlist_decl_handler\r
+\r
+    def parseFile(self, file):\r
+        """Parse a document from a file object, returning the document\r
+        node."""\r
+        parser = self.getParser()\r
+        first_buffer = True\r
+        try:\r
+            while 1:\r
+                buffer = file.read(16*1024)\r
+                if not buffer:\r
+                    break\r
+                parser.Parse(buffer, 0)\r
+                if first_buffer and self.document.documentElement:\r
+                    self._setup_subset(buffer)\r
+                first_buffer = False\r
+            parser.Parse("", True)\r
+        except ParseEscape:\r
+            pass\r
+        doc = self.document\r
+        self.reset()\r
+        self._parser = None\r
+        return doc\r
+\r
+    def parseString(self, string):\r
+        """Parse a document from a string, returning the document node."""\r
+        parser = self.getParser()\r
+        try:\r
+            parser.Parse(string, True)\r
+            self._setup_subset(string)\r
+        except ParseEscape:\r
+            pass\r
+        doc = self.document\r
+        self.reset()\r
+        self._parser = None\r
+        return doc\r
+\r
+    def _setup_subset(self, buffer):\r
+        """Load the internal subset if there might be one."""\r
+        if self.document.doctype:\r
+            extractor = InternalSubsetExtractor()\r
+            extractor.parseString(buffer)\r
+            subset = extractor.getSubset()\r
+            self.document.doctype.internalSubset = subset\r
+\r
+    def start_doctype_decl_handler(self, doctypeName, systemId, publicId,\r
+                                   has_internal_subset):\r
+        doctype = self.document.implementation.createDocumentType(\r
+            doctypeName, publicId, systemId)\r
+        doctype.ownerDocument = self.document\r
+        _append_child(self.document, doctype)\r
+        self.document.doctype = doctype\r
+        if self._filter and self._filter.acceptNode(doctype) == FILTER_REJECT:\r
+            self.document.doctype = None\r
+            del self.document.childNodes[-1]\r
+            doctype = None\r
+            self._parser.EntityDeclHandler = None\r
+            self._parser.NotationDeclHandler = None\r
+        if has_internal_subset:\r
+            if doctype is not None:\r
+                doctype.entities._seq = []\r
+                doctype.notations._seq = []\r
+            self._parser.CommentHandler = None\r
+            self._parser.ProcessingInstructionHandler = None\r
+            self._parser.EndDoctypeDeclHandler = self.end_doctype_decl_handler\r
+\r
+    def end_doctype_decl_handler(self):\r
+        if self._options.comments:\r
+            self._parser.CommentHandler = self.comment_handler\r
+        self._parser.ProcessingInstructionHandler = self.pi_handler\r
+        if not (self._elem_info or self._filter):\r
+            self._finish_end_element = id\r
+\r
+    def pi_handler(self, target, data):\r
+        node = self.document.createProcessingInstruction(target, data)\r
+        _append_child(self.curNode, node)\r
+        if self._filter and self._filter.acceptNode(node) == FILTER_REJECT:\r
+            self.curNode.removeChild(node)\r
+\r
+    def character_data_handler_cdata(self, data):\r
+        childNodes = self.curNode.childNodes\r
+        if self._cdata:\r
+            if (  self._cdata_continue\r
+                  and childNodes[-1].nodeType == CDATA_SECTION_NODE):\r
+                childNodes[-1].appendData(data)\r
+                return\r
+            node = self.document.createCDATASection(data)\r
+            self._cdata_continue = True\r
+        elif childNodes and childNodes[-1].nodeType == TEXT_NODE:\r
+            node = childNodes[-1]\r
+            value = node.data + data\r
+            d = node.__dict__\r
+            d['data'] = d['nodeValue'] = value\r
+            return\r
+        else:\r
+            node = minidom.Text()\r
+            d = node.__dict__\r
+            d['data'] = d['nodeValue'] = data\r
+            d['ownerDocument'] = self.document\r
+        _append_child(self.curNode, node)\r
+\r
+    def character_data_handler(self, data):\r
+        childNodes = self.curNode.childNodes\r
+        if childNodes and childNodes[-1].nodeType == TEXT_NODE:\r
+            node = childNodes[-1]\r
+            d = node.__dict__\r
+            d['data'] = d['nodeValue'] = node.data + data\r
+            return\r
+        node = minidom.Text()\r
+        d = node.__dict__\r
+        d['data'] = d['nodeValue'] = node.data + data\r
+        d['ownerDocument'] = self.document\r
+        _append_child(self.curNode, node)\r
+\r
+    def entity_decl_handler(self, entityName, is_parameter_entity, value,\r
+                            base, systemId, publicId, notationName):\r
+        if is_parameter_entity:\r
+            # we don't care about parameter entities for the DOM\r
+            return\r
+        if not self._options.entities:\r
+            return\r
+        node = self.document._create_entity(entityName, publicId,\r
+                                            systemId, notationName)\r
+        if value is not None:\r
+            # internal entity\r
+            # node *should* be readonly, but we'll cheat\r
+            child = self.document.createTextNode(value)\r
+            node.childNodes.append(child)\r
+        self.document.doctype.entities._seq.append(node)\r
+        if self._filter and self._filter.acceptNode(node) == FILTER_REJECT:\r
+            del self.document.doctype.entities._seq[-1]\r
+\r
+    def notation_decl_handler(self, notationName, base, systemId, publicId):\r
+        node = self.document._create_notation(notationName, publicId, systemId)\r
+        self.document.doctype.notations._seq.append(node)\r
+        if self._filter and self._filter.acceptNode(node) == FILTER_ACCEPT:\r
+            del self.document.doctype.notations._seq[-1]\r
+\r
+    def comment_handler(self, data):\r
+        node = self.document.createComment(data)\r
+        _append_child(self.curNode, node)\r
+        if self._filter and self._filter.acceptNode(node) == FILTER_REJECT:\r
+            self.curNode.removeChild(node)\r
+\r
+    def start_cdata_section_handler(self):\r
+        self._cdata = True\r
+        self._cdata_continue = False\r
+\r
+    def end_cdata_section_handler(self):\r
+        self._cdata = False\r
+        self._cdata_continue = False\r
+\r
+    def external_entity_ref_handler(self, context, base, systemId, publicId):\r
+        return 1\r
+\r
+    def first_element_handler(self, name, attributes):\r
+        if self._filter is None and not self._elem_info:\r
+            self._finish_end_element = id\r
+        self.getParser().StartElementHandler = self.start_element_handler\r
+        self.start_element_handler(name, attributes)\r
+\r
+    def start_element_handler(self, name, attributes):\r
+        node = self.document.createElement(name)\r
+        _append_child(self.curNode, node)\r
+        self.curNode = node\r
+\r
+        if attributes:\r
+            for i in range(0, len(attributes), 2):\r
+                a = minidom.Attr(attributes[i], EMPTY_NAMESPACE,\r
+                                 None, EMPTY_PREFIX)\r
+                value = attributes[i+1]\r
+                d = a.childNodes[0].__dict__\r
+                d['data'] = d['nodeValue'] = value\r
+                d = a.__dict__\r
+                d['value'] = d['nodeValue'] = value\r
+                d['ownerDocument'] = self.document\r
+                _set_attribute_node(node, a)\r
+\r
+        if node is not self.document.documentElement:\r
+            self._finish_start_element(node)\r
+\r
+    def _finish_start_element(self, node):\r
+        if self._filter:\r
+            # To be general, we'd have to call isSameNode(), but this\r
+            # is sufficient for minidom:\r
+            if node is self.document.documentElement:\r
+                return\r
+            filt = self._filter.startContainer(node)\r
+            if filt == FILTER_REJECT:\r
+                # ignore this node & all descendents\r
+                Rejecter(self)\r
+            elif filt == FILTER_SKIP:\r
+                # ignore this node, but make it's children become\r
+                # children of the parent node\r
+                Skipper(self)\r
+            else:\r
+                return\r
+            self.curNode = node.parentNode\r
+            node.parentNode.removeChild(node)\r
+            node.unlink()\r
+\r
+    # If this ever changes, Namespaces.end_element_handler() needs to\r
+    # be changed to match.\r
+    #\r
+    def end_element_handler(self, name):\r
+        curNode = self.curNode\r
+        self.curNode = curNode.parentNode\r
+        self._finish_end_element(curNode)\r
+\r
+    def _finish_end_element(self, curNode):\r
+        info = self._elem_info.get(curNode.tagName)\r
+        if info:\r
+            self._handle_white_text_nodes(curNode, info)\r
+        if self._filter:\r
+            if curNode is self.document.documentElement:\r
+                return\r
+            if self._filter.acceptNode(curNode) == FILTER_REJECT:\r
+                self.curNode.removeChild(curNode)\r
+                curNode.unlink()\r
+\r
+    def _handle_white_text_nodes(self, node, info):\r
+        if (self._options.whitespace_in_element_content\r
+            or not info.isElementContent()):\r
+            return\r
+\r
+        # We have element type information and should remove ignorable\r
+        # whitespace; identify for text nodes which contain only\r
+        # whitespace.\r
+        L = []\r
+        for child in node.childNodes:\r
+            if child.nodeType == TEXT_NODE and not child.data.strip():\r
+                L.append(child)\r
+\r
+        # Remove ignorable whitespace from the tree.\r
+        for child in L:\r
+            node.removeChild(child)\r
+\r
+    def element_decl_handler(self, name, model):\r
+        info = self._elem_info.get(name)\r
+        if info is None:\r
+            self._elem_info[name] = ElementInfo(name, model)\r
+        else:\r
+            assert info._model is None\r
+            info._model = model\r
+\r
+    def attlist_decl_handler(self, elem, name, type, default, required):\r
+        info = self._elem_info.get(elem)\r
+        if info is None:\r
+            info = ElementInfo(elem)\r
+            self._elem_info[elem] = info\r
+        info._attr_info.append(\r
+            [None, name, None, None, default, 0, type, required])\r
+\r
+    def xml_decl_handler(self, version, encoding, standalone):\r
+        self.document.version = version\r
+        self.document.encoding = encoding\r
+        # This is still a little ugly, thanks to the pyexpat API. ;-(\r
+        if standalone >= 0:\r
+            if standalone:\r
+                self.document.standalone = True\r
+            else:\r
+                self.document.standalone = False\r
+\r
+\r
+# Don't include FILTER_INTERRUPT, since that's checked separately\r
+# where allowed.\r
+_ALLOWED_FILTER_RETURNS = (FILTER_ACCEPT, FILTER_REJECT, FILTER_SKIP)\r
+\r
+class FilterVisibilityController(object):\r
+    """Wrapper around a DOMBuilderFilter which implements the checks\r
+    to make the whatToShow filter attribute work."""\r
+\r
+    __slots__ = 'filter',\r
+\r
+    def __init__(self, filter):\r
+        self.filter = filter\r
+\r
+    def startContainer(self, node):\r
+        mask = self._nodetype_mask[node.nodeType]\r
+        if self.filter.whatToShow & mask:\r
+            val = self.filter.startContainer(node)\r
+            if val == FILTER_INTERRUPT:\r
+                raise ParseEscape\r
+            if val not in _ALLOWED_FILTER_RETURNS:\r
+                raise ValueError, \\r
+                      "startContainer() returned illegal value: " + repr(val)\r
+            return val\r
+        else:\r
+            return FILTER_ACCEPT\r
+\r
+    def acceptNode(self, node):\r
+        mask = self._nodetype_mask[node.nodeType]\r
+        if self.filter.whatToShow & mask:\r
+            val = self.filter.acceptNode(node)\r
+            if val == FILTER_INTERRUPT:\r
+                raise ParseEscape\r
+            if val == FILTER_SKIP:\r
+                # move all child nodes to the parent, and remove this node\r
+                parent = node.parentNode\r
+                for child in node.childNodes[:]:\r
+                    parent.appendChild(child)\r
+                # node is handled by the caller\r
+                return FILTER_REJECT\r
+            if val not in _ALLOWED_FILTER_RETURNS:\r
+                raise ValueError, \\r
+                      "acceptNode() returned illegal value: " + repr(val)\r
+            return val\r
+        else:\r
+            return FILTER_ACCEPT\r
+\r
+    _nodetype_mask = {\r
+        Node.ELEMENT_NODE:                NodeFilter.SHOW_ELEMENT,\r
+        Node.ATTRIBUTE_NODE:              NodeFilter.SHOW_ATTRIBUTE,\r
+        Node.TEXT_NODE:                   NodeFilter.SHOW_TEXT,\r
+        Node.CDATA_SECTION_NODE:          NodeFilter.SHOW_CDATA_SECTION,\r
+        Node.ENTITY_REFERENCE_NODE:       NodeFilter.SHOW_ENTITY_REFERENCE,\r
+        Node.ENTITY_NODE:                 NodeFilter.SHOW_ENTITY,\r
+        Node.PROCESSING_INSTRUCTION_NODE: NodeFilter.SHOW_PROCESSING_INSTRUCTION,\r
+        Node.COMMENT_NODE:                NodeFilter.SHOW_COMMENT,\r
+        Node.DOCUMENT_NODE:               NodeFilter.SHOW_DOCUMENT,\r
+        Node.DOCUMENT_TYPE_NODE:          NodeFilter.SHOW_DOCUMENT_TYPE,\r
+        Node.DOCUMENT_FRAGMENT_NODE:      NodeFilter.SHOW_DOCUMENT_FRAGMENT,\r
+        Node.NOTATION_NODE:               NodeFilter.SHOW_NOTATION,\r
+        }\r
+\r
+\r
+class FilterCrutch(object):\r
+    __slots__ = '_builder', '_level', '_old_start', '_old_end'\r
+\r
+    def __init__(self, builder):\r
+        self._level = 0\r
+        self._builder = builder\r
+        parser = builder._parser\r
+        self._old_start = parser.StartElementHandler\r
+        self._old_end = parser.EndElementHandler\r
+        parser.StartElementHandler = self.start_element_handler\r
+        parser.EndElementHandler = self.end_element_handler\r
+\r
+class Rejecter(FilterCrutch):\r
+    __slots__ = ()\r
+\r
+    def __init__(self, builder):\r
+        FilterCrutch.__init__(self, builder)\r
+        parser = builder._parser\r
+        for name in ("ProcessingInstructionHandler",\r
+                     "CommentHandler",\r
+                     "CharacterDataHandler",\r
+                     "StartCdataSectionHandler",\r
+                     "EndCdataSectionHandler",\r
+                     "ExternalEntityRefHandler",\r
+                     ):\r
+            setattr(parser, name, None)\r
+\r
+    def start_element_handler(self, *args):\r
+        self._level = self._level + 1\r
+\r
+    def end_element_handler(self, *args):\r
+        if self._level == 0:\r
+            # restore the old handlers\r
+            parser = self._builder._parser\r
+            self._builder.install(parser)\r
+            parser.StartElementHandler = self._old_start\r
+            parser.EndElementHandler = self._old_end\r
+        else:\r
+            self._level = self._level - 1\r
+\r
+class Skipper(FilterCrutch):\r
+    __slots__ = ()\r
+\r
+    def start_element_handler(self, *args):\r
+        node = self._builder.curNode\r
+        self._old_start(*args)\r
+        if self._builder.curNode is not node:\r
+            self._level = self._level + 1\r
+\r
+    def end_element_handler(self, *args):\r
+        if self._level == 0:\r
+            # We're popping back out of the node we're skipping, so we\r
+            # shouldn't need to do anything but reset the handlers.\r
+            self._builder._parser.StartElementHandler = self._old_start\r
+            self._builder._parser.EndElementHandler = self._old_end\r
+            self._builder = None\r
+        else:\r
+            self._level = self._level - 1\r
+            self._old_end(*args)\r
+\r
+\r
+# framework document used by the fragment builder.\r
+# Takes a string for the doctype, subset string, and namespace attrs string.\r
+\r
+_FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID = \\r
+    "http://xml.python.org/entities/fragment-builder/internal"\r
+\r
+_FRAGMENT_BUILDER_TEMPLATE = (\r
+    '''\\r
+<!DOCTYPE wrapper\r
+  %%s [\r
+  <!ENTITY fragment-builder-internal\r
+    SYSTEM "%s">\r
+%%s\r
+]>\r
+<wrapper %%s\r
+>&fragment-builder-internal;</wrapper>'''\r
+    % _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID)\r
+\r
+\r
+class FragmentBuilder(ExpatBuilder):\r
+    """Builder which constructs document fragments given XML source\r
+    text and a context node.\r
+\r
+    The context node is expected to provide information about the\r
+    namespace declarations which are in scope at the start of the\r
+    fragment.\r
+    """\r
+\r
+    def __init__(self, context, options=None):\r
+        if context.nodeType == DOCUMENT_NODE:\r
+            self.originalDocument = context\r
+            self.context = context\r
+        else:\r
+            self.originalDocument = context.ownerDocument\r
+            self.context = context\r
+        ExpatBuilder.__init__(self, options)\r
+\r
+    def reset(self):\r
+        ExpatBuilder.reset(self)\r
+        self.fragment = None\r
+\r
+    def parseFile(self, file):\r
+        """Parse a document fragment from a file object, returning the\r
+        fragment node."""\r
+        return self.parseString(file.read())\r
+\r
+    def parseString(self, string):\r
+        """Parse a document fragment from a string, returning the\r
+        fragment node."""\r
+        self._source = string\r
+        parser = self.getParser()\r
+        doctype = self.originalDocument.doctype\r
+        ident = ""\r
+        if doctype:\r
+            subset = doctype.internalSubset or self._getDeclarations()\r
+            if doctype.publicId:\r
+                ident = ('PUBLIC "%s" "%s"'\r
+                         % (doctype.publicId, doctype.systemId))\r
+            elif doctype.systemId:\r
+                ident = 'SYSTEM "%s"' % doctype.systemId\r
+        else:\r
+            subset = ""\r
+        nsattrs = self._getNSattrs() # get ns decls from node's ancestors\r
+        document = _FRAGMENT_BUILDER_TEMPLATE % (ident, subset, nsattrs)\r
+        try:\r
+            parser.Parse(document, 1)\r
+        except:\r
+            self.reset()\r
+            raise\r
+        fragment = self.fragment\r
+        self.reset()\r
+##         self._parser = None\r
+        return fragment\r
+\r
+    def _getDeclarations(self):\r
+        """Re-create the internal subset from the DocumentType node.\r
+\r
+        This is only needed if we don't already have the\r
+        internalSubset as a string.\r
+        """\r
+        doctype = self.context.ownerDocument.doctype\r
+        s = ""\r
+        if doctype:\r
+            for i in range(doctype.notations.length):\r
+                notation = doctype.notations.item(i)\r
+                if s:\r
+                    s = s + "\n  "\r
+                s = "%s<!NOTATION %s" % (s, notation.nodeName)\r
+                if notation.publicId:\r
+                    s = '%s PUBLIC "%s"\n             "%s">' \\r
+                        % (s, notation.publicId, notation.systemId)\r
+                else:\r
+                    s = '%s SYSTEM "%s">' % (s, notation.systemId)\r
+            for i in range(doctype.entities.length):\r
+                entity = doctype.entities.item(i)\r
+                if s:\r
+                    s = s + "\n  "\r
+                s = "%s<!ENTITY %s" % (s, entity.nodeName)\r
+                if entity.publicId:\r
+                    s = '%s PUBLIC "%s"\n             "%s"' \\r
+                        % (s, entity.publicId, entity.systemId)\r
+                elif entity.systemId:\r
+                    s = '%s SYSTEM "%s"' % (s, entity.systemId)\r
+                else:\r
+                    s = '%s "%s"' % (s, entity.firstChild.data)\r
+                if entity.notationName:\r
+                    s = "%s NOTATION %s" % (s, entity.notationName)\r
+                s = s + ">"\r
+        return s\r
+\r
+    def _getNSattrs(self):\r
+        return ""\r
+\r
+    def external_entity_ref_handler(self, context, base, systemId, publicId):\r
+        if systemId == _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID:\r
+            # this entref is the one that we made to put the subtree\r
+            # in; all of our given input is parsed in here.\r
+            old_document = self.document\r
+            old_cur_node = self.curNode\r
+            parser = self._parser.ExternalEntityParserCreate(context)\r
+            # put the real document back, parse into the fragment to return\r
+            self.document = self.originalDocument\r
+            self.fragment = self.document.createDocumentFragment()\r
+            self.curNode = self.fragment\r
+            try:\r
+                parser.Parse(self._source, 1)\r
+            finally:\r
+                self.curNode = old_cur_node\r
+                self.document = old_document\r
+                self._source = None\r
+            return -1\r
+        else:\r
+            return ExpatBuilder.external_entity_ref_handler(\r
+                self, context, base, systemId, publicId)\r
+\r
+\r
+class Namespaces:\r
+    """Mix-in class for builders; adds support for namespaces."""\r
+\r
+    def _initNamespaces(self):\r
+        # list of (prefix, uri) ns declarations.  Namespace attrs are\r
+        # constructed from this and added to the element's attrs.\r
+        self._ns_ordered_prefixes = []\r
+\r
+    def createParser(self):\r
+        """Create a new namespace-handling parser."""\r
+        parser = expat.ParserCreate(namespace_separator=" ")\r
+        parser.namespace_prefixes = True\r
+        return parser\r
+\r
+    def install(self, parser):\r
+        """Insert the namespace-handlers onto the parser."""\r
+        ExpatBuilder.install(self, parser)\r
+        if self._options.namespace_declarations:\r
+            parser.StartNamespaceDeclHandler = (\r
+                self.start_namespace_decl_handler)\r
+\r
+    def start_namespace_decl_handler(self, prefix, uri):\r
+        """Push this namespace declaration on our storage."""\r
+        self._ns_ordered_prefixes.append((prefix, uri))\r
+\r
+    def start_element_handler(self, name, attributes):\r
+        if ' ' in name:\r
+            uri, localname, prefix, qname = _parse_ns_name(self, name)\r
+        else:\r
+            uri = EMPTY_NAMESPACE\r
+            qname = name\r
+            localname = None\r
+            prefix = EMPTY_PREFIX\r
+        node = minidom.Element(qname, uri, prefix, localname)\r
+        node.ownerDocument = self.document\r
+        _append_child(self.curNode, node)\r
+        self.curNode = node\r
+\r
+        if self._ns_ordered_prefixes:\r
+            for prefix, uri in self._ns_ordered_prefixes:\r
+                if prefix:\r
+                    a = minidom.Attr(_intern(self, 'xmlns:' + prefix),\r
+                                     XMLNS_NAMESPACE, prefix, "xmlns")\r
+                else:\r
+                    a = minidom.Attr("xmlns", XMLNS_NAMESPACE,\r
+                                     "xmlns", EMPTY_PREFIX)\r
+                d = a.childNodes[0].__dict__\r
+                d['data'] = d['nodeValue'] = uri\r
+                d = a.__dict__\r
+                d['value'] = d['nodeValue'] = uri\r
+                d['ownerDocument'] = self.document\r
+                _set_attribute_node(node, a)\r
+            del self._ns_ordered_prefixes[:]\r
+\r
+        if attributes:\r
+            _attrs = node._attrs\r
+            _attrsNS = node._attrsNS\r
+            for i in range(0, len(attributes), 2):\r
+                aname = attributes[i]\r
+                value = attributes[i+1]\r
+                if ' ' in aname:\r
+                    uri, localname, prefix, qname = _parse_ns_name(self, aname)\r
+                    a = minidom.Attr(qname, uri, localname, prefix)\r
+                    _attrs[qname] = a\r
+                    _attrsNS[(uri, localname)] = a\r
+                else:\r
+                    a = minidom.Attr(aname, EMPTY_NAMESPACE,\r
+                                     aname, EMPTY_PREFIX)\r
+                    _attrs[aname] = a\r
+                    _attrsNS[(EMPTY_NAMESPACE, aname)] = a\r
+                d = a.childNodes[0].__dict__\r
+                d['data'] = d['nodeValue'] = value\r
+                d = a.__dict__\r
+                d['ownerDocument'] = self.document\r
+                d['value'] = d['nodeValue'] = value\r
+                d['ownerElement'] = node\r
+\r
+    if __debug__:\r
+        # This only adds some asserts to the original\r
+        # end_element_handler(), so we only define this when -O is not\r
+        # used.  If changing one, be sure to check the other to see if\r
+        # it needs to be changed as well.\r
+        #\r
+        def end_element_handler(self, name):\r
+            curNode = self.curNode\r
+            if ' ' in name:\r
+                uri, localname, prefix, qname = _parse_ns_name(self, name)\r
+                assert (curNode.namespaceURI == uri\r
+                        and curNode.localName == localname\r
+                        and curNode.prefix == prefix), \\r
+                        "element stack messed up! (namespace)"\r
+            else:\r
+                assert curNode.nodeName == name, \\r
+                       "element stack messed up - bad nodeName"\r
+                assert curNode.namespaceURI == EMPTY_NAMESPACE, \\r
+                       "element stack messed up - bad namespaceURI"\r
+            self.curNode = curNode.parentNode\r
+            self._finish_end_element(curNode)\r
+\r
+\r
+class ExpatBuilderNS(Namespaces, ExpatBuilder):\r
+    """Document builder that supports namespaces."""\r
+\r
+    def reset(self):\r
+        ExpatBuilder.reset(self)\r
+        self._initNamespaces()\r
+\r
+\r
+class FragmentBuilderNS(Namespaces, FragmentBuilder):\r
+    """Fragment builder that supports namespaces."""\r
+\r
+    def reset(self):\r
+        FragmentBuilder.reset(self)\r
+        self._initNamespaces()\r
+\r
+    def _getNSattrs(self):\r
+        """Return string of namespace attributes from this element and\r
+        ancestors."""\r
+        # XXX This needs to be re-written to walk the ancestors of the\r
+        # context to build up the namespace information from\r
+        # declarations, elements, and attributes found in context.\r
+        # Otherwise we have to store a bunch more data on the DOM\r
+        # (though that *might* be more reliable -- not clear).\r
+        attrs = ""\r
+        context = self.context\r
+        L = []\r
+        while context:\r
+            if hasattr(context, '_ns_prefix_uri'):\r
+                for prefix, uri in context._ns_prefix_uri.items():\r
+                    # add every new NS decl from context to L and attrs string\r
+                    if prefix in L:\r
+                        continue\r
+                    L.append(prefix)\r
+                    if prefix:\r
+                        declname = "xmlns:" + prefix\r
+                    else:\r
+                        declname = "xmlns"\r
+                    if attrs:\r
+                        attrs = "%s\n    %s='%s'" % (attrs, declname, uri)\r
+                    else:\r
+                        attrs = " %s='%s'" % (declname, uri)\r
+            context = context.parentNode\r
+        return attrs\r
+\r
+\r
+class ParseEscape(Exception):\r
+    """Exception raised to short-circuit parsing in InternalSubsetExtractor."""\r
+    pass\r
+\r
+class InternalSubsetExtractor(ExpatBuilder):\r
+    """XML processor which can rip out the internal document type subset."""\r
+\r
+    subset = None\r
+\r
+    def getSubset(self):\r
+        """Return the internal subset as a string."""\r
+        return self.subset\r
+\r
+    def parseFile(self, file):\r
+        try:\r
+            ExpatBuilder.parseFile(self, file)\r
+        except ParseEscape:\r
+            pass\r
+\r
+    def parseString(self, string):\r
+        try:\r
+            ExpatBuilder.parseString(self, string)\r
+        except ParseEscape:\r
+            pass\r
+\r
+    def install(self, parser):\r
+        parser.StartDoctypeDeclHandler = self.start_doctype_decl_handler\r
+        parser.StartElementHandler = self.start_element_handler\r
+\r
+    def start_doctype_decl_handler(self, name, publicId, systemId,\r
+                                   has_internal_subset):\r
+        if has_internal_subset:\r
+            parser = self.getParser()\r
+            self.subset = []\r
+            parser.DefaultHandler = self.subset.append\r
+            parser.EndDoctypeDeclHandler = self.end_doctype_decl_handler\r
+        else:\r
+            raise ParseEscape()\r
+\r
+    def end_doctype_decl_handler(self):\r
+        s = ''.join(self.subset).replace('\r\n', '\n').replace('\r', '\n')\r
+        self.subset = s\r
+        raise ParseEscape()\r
+\r
+    def start_element_handler(self, name, attrs):\r
+        raise ParseEscape()\r
+\r
+\r
+def parse(file, namespaces=True):\r
+    """Parse a document, returning the resulting Document node.\r
+\r
+    'file' may be either a file name or an open file object.\r
+    """\r
+    if namespaces:\r
+        builder = ExpatBuilderNS()\r
+    else:\r
+        builder = ExpatBuilder()\r
+\r
+    if isinstance(file, StringTypes):\r
+        fp = open(file, 'rb')\r
+        try:\r
+            result = builder.parseFile(fp)\r
+        finally:\r
+            fp.close()\r
+    else:\r
+        result = builder.parseFile(file)\r
+    return result\r
+\r
+\r
+def parseString(string, namespaces=True):\r
+    """Parse a document from a string, returning the resulting\r
+    Document node.\r
+    """\r
+    if namespaces:\r
+        builder = ExpatBuilderNS()\r
+    else:\r
+        builder = ExpatBuilder()\r
+    return builder.parseString(string)\r
+\r
+\r
+def parseFragment(file, context, namespaces=True):\r
+    """Parse a fragment of a document, given the context from which it\r
+    was originally extracted.  context should be the parent of the\r
+    node(s) which are in the fragment.\r
+\r
+    'file' may be either a file name or an open file object.\r
+    """\r
+    if namespaces:\r
+        builder = FragmentBuilderNS(context)\r
+    else:\r
+        builder = FragmentBuilder(context)\r
+\r
+    if isinstance(file, StringTypes):\r
+        fp = open(file, 'rb')\r
+        try:\r
+            result = builder.parseFile(fp)\r
+        finally:\r
+            fp.close()\r
+    else:\r
+        result = builder.parseFile(file)\r
+    return result\r
+\r
+\r
+def parseFragmentString(string, context, namespaces=True):\r
+    """Parse a fragment of a document from a string, given the context\r
+    from which it was originally extracted.  context should be the\r
+    parent of the node(s) which are in the fragment.\r
+    """\r
+    if namespaces:\r
+        builder = FragmentBuilderNS(context)\r
+    else:\r
+        builder = FragmentBuilder(context)\r
+    return builder.parseString(string)\r
+\r
+\r
+def makeBuilder(options):\r
+    """Create a builder based on an Options object."""\r
+    if options.namespaces:\r
+        return ExpatBuilderNS(options)\r
+    else:\r
+        return ExpatBuilder(options)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minicompat.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minicompat.py
new file mode 100644 (file)
index 0000000..a5fcee0
--- /dev/null
@@ -0,0 +1,110 @@
+"""Python version compatibility support for minidom."""\r
+\r
+# This module should only be imported using "import *".\r
+#\r
+# The following names are defined:\r
+#\r
+#   NodeList      -- lightest possible NodeList implementation\r
+#\r
+#   EmptyNodeList -- lightest possible NodeList that is guaranteed to\r
+#                    remain empty (immutable)\r
+#\r
+#   StringTypes   -- tuple of defined string types\r
+#\r
+#   defproperty   -- function used in conjunction with GetattrMagic;\r
+#                    using these together is needed to make them work\r
+#                    as efficiently as possible in both Python 2.2+\r
+#                    and older versions.  For example:\r
+#\r
+#                        class MyClass(GetattrMagic):\r
+#                            def _get_myattr(self):\r
+#                                return something\r
+#\r
+#                        defproperty(MyClass, "myattr",\r
+#                                    "return some value")\r
+#\r
+#                    For Python 2.2 and newer, this will construct a\r
+#                    property object on the class, which avoids\r
+#                    needing to override __getattr__().  It will only\r
+#                    work for read-only attributes.\r
+#\r
+#                    For older versions of Python, inheriting from\r
+#                    GetattrMagic will use the traditional\r
+#                    __getattr__() hackery to achieve the same effect,\r
+#                    but less efficiently.\r
+#\r
+#                    defproperty() should be used for each version of\r
+#                    the relevant _get_<property>() function.\r
+\r
+__all__ = ["NodeList", "EmptyNodeList", "StringTypes", "defproperty"]\r
+\r
+import xml.dom\r
+\r
+try:\r
+    unicode\r
+except NameError:\r
+    StringTypes = type(''),\r
+else:\r
+    StringTypes = type(''), type(unicode(''))\r
+\r
+\r
+class NodeList(list):\r
+    __slots__ = ()\r
+\r
+    def item(self, index):\r
+        if 0 <= index < len(self):\r
+            return self[index]\r
+\r
+    def _get_length(self):\r
+        return len(self)\r
+\r
+    def _set_length(self, value):\r
+        raise xml.dom.NoModificationAllowedErr(\r
+            "attempt to modify read-only attribute 'length'")\r
+\r
+    length = property(_get_length, _set_length,\r
+                      doc="The number of nodes in the NodeList.")\r
+\r
+    def __getstate__(self):\r
+        return list(self)\r
+\r
+    def __setstate__(self, state):\r
+        self[:] = state\r
+\r
+\r
+class EmptyNodeList(tuple):\r
+    __slots__ = ()\r
+\r
+    def __add__(self, other):\r
+        NL = NodeList()\r
+        NL.extend(other)\r
+        return NL\r
+\r
+    def __radd__(self, other):\r
+        NL = NodeList()\r
+        NL.extend(other)\r
+        return NL\r
+\r
+    def item(self, index):\r
+        return None\r
+\r
+    def _get_length(self):\r
+        return 0\r
+\r
+    def _set_length(self, value):\r
+        raise xml.dom.NoModificationAllowedErr(\r
+            "attempt to modify read-only attribute 'length'")\r
+\r
+    length = property(_get_length, _set_length,\r
+                      doc="The number of nodes in the NodeList.")\r
+\r
+\r
+def defproperty(klass, name, doc):\r
+    get = getattr(klass, ("_get_" + name)).im_func\r
+    def set(self, value, name=name):\r
+        raise xml.dom.NoModificationAllowedErr(\r
+            "attempt to modify read-only attribute " + repr(name))\r
+    assert not hasattr(klass, "_set_" + name), \\r
+           "expected not to find _set_" + name\r
+    prop = property(get, set, doc=doc)\r
+    setattr(klass, name, prop)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minidom.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minidom.py
new file mode 100644 (file)
index 0000000..54b41c4
--- /dev/null
@@ -0,0 +1,1941 @@
+"""Simple implementation of the Level 1 DOM.\r
+\r
+Namespaces and other minor Level 2 features are also supported.\r
+\r
+parse("foo.xml")\r
+\r
+parseString("<foo><bar/></foo>")\r
+\r
+Todo:\r
+=====\r
+ * convenience methods for getting elements and text.\r
+ * more testing\r
+ * bring some of the writer and linearizer code into conformance with this\r
+        interface\r
+ * SAX 2 namespaces\r
+"""\r
+\r
+import xml.dom\r
+\r
+from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE, domreg\r
+from xml.dom.minicompat import *\r
+from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS\r
+\r
+# This is used by the ID-cache invalidation checks; the list isn't\r
+# actually complete, since the nodes being checked will never be the\r
+# DOCUMENT_NODE or DOCUMENT_FRAGMENT_NODE.  (The node being checked is\r
+# the node being added or removed, not the node being modified.)\r
+#\r
+_nodeTypes_with_children = (xml.dom.Node.ELEMENT_NODE,\r
+                            xml.dom.Node.ENTITY_REFERENCE_NODE)\r
+\r
+\r
+class Node(xml.dom.Node):\r
+    namespaceURI = None # this is non-null only for elements and attributes\r
+    parentNode = None\r
+    ownerDocument = None\r
+    nextSibling = None\r
+    previousSibling = None\r
+\r
+    prefix = EMPTY_PREFIX # non-null only for NS elements and attributes\r
+\r
+    def __nonzero__(self):\r
+        return True\r
+\r
+    def toxml(self, encoding = None):\r
+        return self.toprettyxml("", "", encoding)\r
+\r
+    def toprettyxml(self, indent="\t", newl="\n", encoding = None):\r
+        # indent = the indentation string to prepend, per level\r
+        # newl = the newline string to append\r
+        writer = _get_StringIO()\r
+        if encoding is not None:\r
+            import codecs\r
+            # Can't use codecs.getwriter to preserve 2.0 compatibility\r
+            writer = codecs.lookup(encoding)[3](writer)\r
+        if self.nodeType == Node.DOCUMENT_NODE:\r
+            # Can pass encoding only to document, to put it into XML header\r
+            self.writexml(writer, "", indent, newl, encoding)\r
+        else:\r
+            self.writexml(writer, "", indent, newl)\r
+        return writer.getvalue()\r
+\r
+    def hasChildNodes(self):\r
+        if self.childNodes:\r
+            return True\r
+        else:\r
+            return False\r
+\r
+    def _get_childNodes(self):\r
+        return self.childNodes\r
+\r
+    def _get_firstChild(self):\r
+        if self.childNodes:\r
+            return self.childNodes[0]\r
+\r
+    def _get_lastChild(self):\r
+        if self.childNodes:\r
+            return self.childNodes[-1]\r
+\r
+    def insertBefore(self, newChild, refChild):\r
+        if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE:\r
+            for c in tuple(newChild.childNodes):\r
+                self.insertBefore(c, refChild)\r
+            ### The DOM does not clearly specify what to return in this case\r
+            return newChild\r
+        if newChild.nodeType not in self._child_node_types:\r
+            raise xml.dom.HierarchyRequestErr(\r
+                "%s cannot be child of %s" % (repr(newChild), repr(self)))\r
+        if newChild.parentNode is not None:\r
+            newChild.parentNode.removeChild(newChild)\r
+        if refChild is None:\r
+            self.appendChild(newChild)\r
+        else:\r
+            try:\r
+                index = self.childNodes.index(refChild)\r
+            except ValueError:\r
+                raise xml.dom.NotFoundErr()\r
+            if newChild.nodeType in _nodeTypes_with_children:\r
+                _clear_id_cache(self)\r
+            self.childNodes.insert(index, newChild)\r
+            newChild.nextSibling = refChild\r
+            refChild.previousSibling = newChild\r
+            if index:\r
+                node = self.childNodes[index-1]\r
+                node.nextSibling = newChild\r
+                newChild.previousSibling = node\r
+            else:\r
+                newChild.previousSibling = None\r
+            newChild.parentNode = self\r
+        return newChild\r
+\r
+    def appendChild(self, node):\r
+        if node.nodeType == self.DOCUMENT_FRAGMENT_NODE:\r
+            for c in tuple(node.childNodes):\r
+                self.appendChild(c)\r
+            ### The DOM does not clearly specify what to return in this case\r
+            return node\r
+        if node.nodeType not in self._child_node_types:\r
+            raise xml.dom.HierarchyRequestErr(\r
+                "%s cannot be child of %s" % (repr(node), repr(self)))\r
+        elif node.nodeType in _nodeTypes_with_children:\r
+            _clear_id_cache(self)\r
+        if node.parentNode is not None:\r
+            node.parentNode.removeChild(node)\r
+        _append_child(self, node)\r
+        node.nextSibling = None\r
+        return node\r
+\r
+    def replaceChild(self, newChild, oldChild):\r
+        if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE:\r
+            refChild = oldChild.nextSibling\r
+            self.removeChild(oldChild)\r
+            return self.insertBefore(newChild, refChild)\r
+        if newChild.nodeType not in self._child_node_types:\r
+            raise xml.dom.HierarchyRequestErr(\r
+                "%s cannot be child of %s" % (repr(newChild), repr(self)))\r
+        if newChild is oldChild:\r
+            return\r
+        if newChild.parentNode is not None:\r
+            newChild.parentNode.removeChild(newChild)\r
+        try:\r
+            index = self.childNodes.index(oldChild)\r
+        except ValueError:\r
+            raise xml.dom.NotFoundErr()\r
+        self.childNodes[index] = newChild\r
+        newChild.parentNode = self\r
+        oldChild.parentNode = None\r
+        if (newChild.nodeType in _nodeTypes_with_children\r
+            or oldChild.nodeType in _nodeTypes_with_children):\r
+            _clear_id_cache(self)\r
+        newChild.nextSibling = oldChild.nextSibling\r
+        newChild.previousSibling = oldChild.previousSibling\r
+        oldChild.nextSibling = None\r
+        oldChild.previousSibling = None\r
+        if newChild.previousSibling:\r
+            newChild.previousSibling.nextSibling = newChild\r
+        if newChild.nextSibling:\r
+            newChild.nextSibling.previousSibling = newChild\r
+        return oldChild\r
+\r
+    def removeChild(self, oldChild):\r
+        try:\r
+            self.childNodes.remove(oldChild)\r
+        except ValueError:\r
+            raise xml.dom.NotFoundErr()\r
+        if oldChild.nextSibling is not None:\r
+            oldChild.nextSibling.previousSibling = oldChild.previousSibling\r
+        if oldChild.previousSibling is not None:\r
+            oldChild.previousSibling.nextSibling = oldChild.nextSibling\r
+        oldChild.nextSibling = oldChild.previousSibling = None\r
+        if oldChild.nodeType in _nodeTypes_with_children:\r
+            _clear_id_cache(self)\r
+\r
+        oldChild.parentNode = None\r
+        return oldChild\r
+\r
+    def normalize(self):\r
+        L = []\r
+        for child in self.childNodes:\r
+            if child.nodeType == Node.TEXT_NODE:\r
+                if not child.data:\r
+                    # empty text node; discard\r
+                    if L:\r
+                        L[-1].nextSibling = child.nextSibling\r
+                    if child.nextSibling:\r
+                        child.nextSibling.previousSibling = child.previousSibling\r
+                    child.unlink()\r
+                elif L and L[-1].nodeType == child.nodeType:\r
+                    # collapse text node\r
+                    node = L[-1]\r
+                    node.data = node.data + child.data\r
+                    node.nextSibling = child.nextSibling\r
+                    if child.nextSibling:\r
+                        child.nextSibling.previousSibling = node\r
+                    child.unlink()\r
+                else:\r
+                    L.append(child)\r
+            else:\r
+                L.append(child)\r
+                if child.nodeType == Node.ELEMENT_NODE:\r
+                    child.normalize()\r
+        self.childNodes[:] = L\r
+\r
+    def cloneNode(self, deep):\r
+        return _clone_node(self, deep, self.ownerDocument or self)\r
+\r
+    def isSupported(self, feature, version):\r
+        return self.ownerDocument.implementation.hasFeature(feature, version)\r
+\r
+    def _get_localName(self):\r
+        # Overridden in Element and Attr where localName can be Non-Null\r
+        return None\r
+\r
+    # Node interfaces from Level 3 (WD 9 April 2002)\r
+\r
+    def isSameNode(self, other):\r
+        return self is other\r
+\r
+    def getInterface(self, feature):\r
+        if self.isSupported(feature, None):\r
+            return self\r
+        else:\r
+            return None\r
+\r
+    # The "user data" functions use a dictionary that is only present\r
+    # if some user data has been set, so be careful not to assume it\r
+    # exists.\r
+\r
+    def getUserData(self, key):\r
+        try:\r
+            return self._user_data[key][0]\r
+        except (AttributeError, KeyError):\r
+            return None\r
+\r
+    def setUserData(self, key, data, handler):\r
+        old = None\r
+        try:\r
+            d = self._user_data\r
+        except AttributeError:\r
+            d = {}\r
+            self._user_data = d\r
+        if key in d:\r
+            old = d[key][0]\r
+        if data is None:\r
+            # ignore handlers passed for None\r
+            handler = None\r
+            if old is not None:\r
+                del d[key]\r
+        else:\r
+            d[key] = (data, handler)\r
+        return old\r
+\r
+    def _call_user_data_handler(self, operation, src, dst):\r
+        if hasattr(self, "_user_data"):\r
+            for key, (data, handler) in self._user_data.items():\r
+                if handler is not None:\r
+                    handler.handle(operation, key, data, src, dst)\r
+\r
+    # minidom-specific API:\r
+\r
+    def unlink(self):\r
+        self.parentNode = self.ownerDocument = None\r
+        if self.childNodes:\r
+            for child in self.childNodes:\r
+                child.unlink()\r
+            self.childNodes = NodeList()\r
+        self.previousSibling = None\r
+        self.nextSibling = None\r
+\r
+defproperty(Node, "firstChild", doc="First child node, or None.")\r
+defproperty(Node, "lastChild",  doc="Last child node, or None.")\r
+defproperty(Node, "localName",  doc="Namespace-local name of this node.")\r
+\r
+\r
+def _append_child(self, node):\r
+    # fast path with less checks; usable by DOM builders if careful\r
+    childNodes = self.childNodes\r
+    if childNodes:\r
+        last = childNodes[-1]\r
+        node.__dict__["previousSibling"] = last\r
+        last.__dict__["nextSibling"] = node\r
+    childNodes.append(node)\r
+    node.__dict__["parentNode"] = self\r
+\r
+def _in_document(node):\r
+    # return True iff node is part of a document tree\r
+    while node is not None:\r
+        if node.nodeType == Node.DOCUMENT_NODE:\r
+            return True\r
+        node = node.parentNode\r
+    return False\r
+\r
+def _write_data(writer, data):\r
+    "Writes datachars to writer."\r
+    if data:\r
+        data = data.replace("&", "&amp;").replace("<", "&lt;"). \\r
+                    replace("\"", "&quot;").replace(">", "&gt;")\r
+        writer.write(data)\r
+\r
+def _get_elements_by_tagName_helper(parent, name, rc):\r
+    for node in parent.childNodes:\r
+        if node.nodeType == Node.ELEMENT_NODE and \\r
+            (name == "*" or node.tagName == name):\r
+            rc.append(node)\r
+        _get_elements_by_tagName_helper(node, name, rc)\r
+    return rc\r
+\r
+def _get_elements_by_tagName_ns_helper(parent, nsURI, localName, rc):\r
+    for node in parent.childNodes:\r
+        if node.nodeType == Node.ELEMENT_NODE:\r
+            if ((localName == "*" or node.localName == localName) and\r
+                (nsURI == "*" or node.namespaceURI == nsURI)):\r
+                rc.append(node)\r
+            _get_elements_by_tagName_ns_helper(node, nsURI, localName, rc)\r
+    return rc\r
+\r
+class DocumentFragment(Node):\r
+    nodeType = Node.DOCUMENT_FRAGMENT_NODE\r
+    nodeName = "#document-fragment"\r
+    nodeValue = None\r
+    attributes = None\r
+    parentNode = None\r
+    _child_node_types = (Node.ELEMENT_NODE,\r
+                         Node.TEXT_NODE,\r
+                         Node.CDATA_SECTION_NODE,\r
+                         Node.ENTITY_REFERENCE_NODE,\r
+                         Node.PROCESSING_INSTRUCTION_NODE,\r
+                         Node.COMMENT_NODE,\r
+                         Node.NOTATION_NODE)\r
+\r
+    def __init__(self):\r
+        self.childNodes = NodeList()\r
+\r
+\r
+class Attr(Node):\r
+    nodeType = Node.ATTRIBUTE_NODE\r
+    attributes = None\r
+    ownerElement = None\r
+    specified = False\r
+    _is_id = False\r
+\r
+    _child_node_types = (Node.TEXT_NODE, Node.ENTITY_REFERENCE_NODE)\r
+\r
+    def __init__(self, qName, namespaceURI=EMPTY_NAMESPACE, localName=None,\r
+                 prefix=None):\r
+        # skip setattr for performance\r
+        d = self.__dict__\r
+        d["nodeName"] = d["name"] = qName\r
+        d["namespaceURI"] = namespaceURI\r
+        d["prefix"] = prefix\r
+        d['childNodes'] = NodeList()\r
+\r
+        # Add the single child node that represents the value of the attr\r
+        self.childNodes.append(Text())\r
+\r
+        # nodeValue and value are set elsewhere\r
+\r
+    def _get_localName(self):\r
+        return self.nodeName.split(":", 1)[-1]\r
+\r
+    def _get_specified(self):\r
+        return self.specified\r
+\r
+    def __setattr__(self, name, value):\r
+        d = self.__dict__\r
+        if name in ("value", "nodeValue"):\r
+            d["value"] = d["nodeValue"] = value\r
+            d2 = self.childNodes[0].__dict__\r
+            d2["data"] = d2["nodeValue"] = value\r
+            if self.ownerElement is not None:\r
+                _clear_id_cache(self.ownerElement)\r
+        elif name in ("name", "nodeName"):\r
+            d["name"] = d["nodeName"] = value\r
+            if self.ownerElement is not None:\r
+                _clear_id_cache(self.ownerElement)\r
+        else:\r
+            d[name] = value\r
+\r
+    def _set_prefix(self, prefix):\r
+        nsuri = self.namespaceURI\r
+        if prefix == "xmlns":\r
+            if nsuri and nsuri != XMLNS_NAMESPACE:\r
+                raise xml.dom.NamespaceErr(\r
+                    "illegal use of 'xmlns' prefix for the wrong namespace")\r
+        d = self.__dict__\r
+        d['prefix'] = prefix\r
+        if prefix is None:\r
+            newName = self.localName\r
+        else:\r
+            newName = "%s:%s" % (prefix, self.localName)\r
+        if self.ownerElement:\r
+            _clear_id_cache(self.ownerElement)\r
+        d['nodeName'] = d['name'] = newName\r
+\r
+    def _set_value(self, value):\r
+        d = self.__dict__\r
+        d['value'] = d['nodeValue'] = value\r
+        if self.ownerElement:\r
+            _clear_id_cache(self.ownerElement)\r
+        self.childNodes[0].data = value\r
+\r
+    def unlink(self):\r
+        # This implementation does not call the base implementation\r
+        # since most of that is not needed, and the expense of the\r
+        # method call is not warranted.  We duplicate the removal of\r
+        # children, but that's all we needed from the base class.\r
+        elem = self.ownerElement\r
+        if elem is not None:\r
+            del elem._attrs[self.nodeName]\r
+            del elem._attrsNS[(self.namespaceURI, self.localName)]\r
+            if self._is_id:\r
+                self._is_id = False\r
+                elem._magic_id_nodes -= 1\r
+                self.ownerDocument._magic_id_count -= 1\r
+        for child in self.childNodes:\r
+            child.unlink()\r
+        del self.childNodes[:]\r
+\r
+    def _get_isId(self):\r
+        if self._is_id:\r
+            return True\r
+        doc = self.ownerDocument\r
+        elem = self.ownerElement\r
+        if doc is None or elem is None:\r
+            return False\r
+\r
+        info = doc._get_elem_info(elem)\r
+        if info is None:\r
+            return False\r
+        if self.namespaceURI:\r
+            return info.isIdNS(self.namespaceURI, self.localName)\r
+        else:\r
+            return info.isId(self.nodeName)\r
+\r
+    def _get_schemaType(self):\r
+        doc = self.ownerDocument\r
+        elem = self.ownerElement\r
+        if doc is None or elem is None:\r
+            return _no_type\r
+\r
+        info = doc._get_elem_info(elem)\r
+        if info is None:\r
+            return _no_type\r
+        if self.namespaceURI:\r
+            return info.getAttributeTypeNS(self.namespaceURI, self.localName)\r
+        else:\r
+            return info.getAttributeType(self.nodeName)\r
+\r
+defproperty(Attr, "isId",       doc="True if this attribute is an ID.")\r
+defproperty(Attr, "localName",  doc="Namespace-local name of this attribute.")\r
+defproperty(Attr, "schemaType", doc="Schema type for this attribute.")\r
+\r
+\r
+class NamedNodeMap(object):\r
+    """The attribute list is a transient interface to the underlying\r
+    dictionaries.  Mutations here will change the underlying element's\r
+    dictionary.\r
+\r
+    Ordering is imposed artificially and does not reflect the order of\r
+    attributes as found in an input document.\r
+    """\r
+\r
+    __slots__ = ('_attrs', '_attrsNS', '_ownerElement')\r
+\r
+    def __init__(self, attrs, attrsNS, ownerElement):\r
+        self._attrs = attrs\r
+        self._attrsNS = attrsNS\r
+        self._ownerElement = ownerElement\r
+\r
+    def _get_length(self):\r
+        return len(self._attrs)\r
+\r
+    def item(self, index):\r
+        try:\r
+            return self[self._attrs.keys()[index]]\r
+        except IndexError:\r
+            return None\r
+\r
+    def items(self):\r
+        L = []\r
+        for node in self._attrs.values():\r
+            L.append((node.nodeName, node.value))\r
+        return L\r
+\r
+    def itemsNS(self):\r
+        L = []\r
+        for node in self._attrs.values():\r
+            L.append(((node.namespaceURI, node.localName), node.value))\r
+        return L\r
+\r
+    def has_key(self, key):\r
+        if isinstance(key, StringTypes):\r
+            return key in self._attrs\r
+        else:\r
+            return key in self._attrsNS\r
+\r
+    def keys(self):\r
+        return self._attrs.keys()\r
+\r
+    def keysNS(self):\r
+        return self._attrsNS.keys()\r
+\r
+    def values(self):\r
+        return self._attrs.values()\r
+\r
+    def get(self, name, value=None):\r
+        return self._attrs.get(name, value)\r
+\r
+    __len__ = _get_length\r
+\r
+    __hash__ = None # Mutable type can't be correctly hashed\r
+    def __cmp__(self, other):\r
+        if self._attrs is getattr(other, "_attrs", None):\r
+            return 0\r
+        else:\r
+            return cmp(id(self), id(other))\r
+\r
+    def __getitem__(self, attname_or_tuple):\r
+        if isinstance(attname_or_tuple, tuple):\r
+            return self._attrsNS[attname_or_tuple]\r
+        else:\r
+            return self._attrs[attname_or_tuple]\r
+\r
+    # same as set\r
+    def __setitem__(self, attname, value):\r
+        if isinstance(value, StringTypes):\r
+            try:\r
+                node = self._attrs[attname]\r
+            except KeyError:\r
+                node = Attr(attname)\r
+                node.ownerDocument = self._ownerElement.ownerDocument\r
+                self.setNamedItem(node)\r
+            node.value = value\r
+        else:\r
+            if not isinstance(value, Attr):\r
+                raise TypeError, "value must be a string or Attr object"\r
+            node = value\r
+            self.setNamedItem(node)\r
+\r
+    def getNamedItem(self, name):\r
+        try:\r
+            return self._attrs[name]\r
+        except KeyError:\r
+            return None\r
+\r
+    def getNamedItemNS(self, namespaceURI, localName):\r
+        try:\r
+            return self._attrsNS[(namespaceURI, localName)]\r
+        except KeyError:\r
+            return None\r
+\r
+    def removeNamedItem(self, name):\r
+        n = self.getNamedItem(name)\r
+        if n is not None:\r
+            _clear_id_cache(self._ownerElement)\r
+            del self._attrs[n.nodeName]\r
+            del self._attrsNS[(n.namespaceURI, n.localName)]\r
+            if 'ownerElement' in n.__dict__:\r
+                n.__dict__['ownerElement'] = None\r
+            return n\r
+        else:\r
+            raise xml.dom.NotFoundErr()\r
+\r
+    def removeNamedItemNS(self, namespaceURI, localName):\r
+        n = self.getNamedItemNS(namespaceURI, localName)\r
+        if n is not None:\r
+            _clear_id_cache(self._ownerElement)\r
+            del self._attrsNS[(n.namespaceURI, n.localName)]\r
+            del self._attrs[n.nodeName]\r
+            if 'ownerElement' in n.__dict__:\r
+                n.__dict__['ownerElement'] = None\r
+            return n\r
+        else:\r
+            raise xml.dom.NotFoundErr()\r
+\r
+    def setNamedItem(self, node):\r
+        if not isinstance(node, Attr):\r
+            raise xml.dom.HierarchyRequestErr(\r
+                "%s cannot be child of %s" % (repr(node), repr(self)))\r
+        old = self._attrs.get(node.name)\r
+        if old:\r
+            old.unlink()\r
+        self._attrs[node.name] = node\r
+        self._attrsNS[(node.namespaceURI, node.localName)] = node\r
+        node.ownerElement = self._ownerElement\r
+        _clear_id_cache(node.ownerElement)\r
+        return old\r
+\r
+    def setNamedItemNS(self, node):\r
+        return self.setNamedItem(node)\r
+\r
+    def __delitem__(self, attname_or_tuple):\r
+        node = self[attname_or_tuple]\r
+        _clear_id_cache(node.ownerElement)\r
+        node.unlink()\r
+\r
+    def __getstate__(self):\r
+        return self._attrs, self._attrsNS, self._ownerElement\r
+\r
+    def __setstate__(self, state):\r
+        self._attrs, self._attrsNS, self._ownerElement = state\r
+\r
+defproperty(NamedNodeMap, "length",\r
+            doc="Number of nodes in the NamedNodeMap.")\r
+\r
+AttributeList = NamedNodeMap\r
+\r
+\r
+class TypeInfo(object):\r
+    __slots__ = 'namespace', 'name'\r
+\r
+    def __init__(self, namespace, name):\r
+        self.namespace = namespace\r
+        self.name = name\r
+\r
+    def __repr__(self):\r
+        if self.namespace:\r
+            return "<TypeInfo %r (from %r)>" % (self.name, self.namespace)\r
+        else:\r
+            return "<TypeInfo %r>" % self.name\r
+\r
+    def _get_name(self):\r
+        return self.name\r
+\r
+    def _get_namespace(self):\r
+        return self.namespace\r
+\r
+_no_type = TypeInfo(None, None)\r
+\r
+class Element(Node):\r
+    nodeType = Node.ELEMENT_NODE\r
+    nodeValue = None\r
+    schemaType = _no_type\r
+\r
+    _magic_id_nodes = 0\r
+\r
+    _child_node_types = (Node.ELEMENT_NODE,\r
+                         Node.PROCESSING_INSTRUCTION_NODE,\r
+                         Node.COMMENT_NODE,\r
+                         Node.TEXT_NODE,\r
+                         Node.CDATA_SECTION_NODE,\r
+                         Node.ENTITY_REFERENCE_NODE)\r
+\r
+    def __init__(self, tagName, namespaceURI=EMPTY_NAMESPACE, prefix=None,\r
+                 localName=None):\r
+        self.tagName = self.nodeName = tagName\r
+        self.prefix = prefix\r
+        self.namespaceURI = namespaceURI\r
+        self.childNodes = NodeList()\r
+\r
+        self._attrs = {}   # attributes are double-indexed:\r
+        self._attrsNS = {} #    tagName -> Attribute\r
+                           #    URI,localName -> Attribute\r
+                           # in the future: consider lazy generation\r
+                           # of attribute objects this is too tricky\r
+                           # for now because of headaches with\r
+                           # namespaces.\r
+\r
+    def _get_localName(self):\r
+        return self.tagName.split(":", 1)[-1]\r
+\r
+    def _get_tagName(self):\r
+        return self.tagName\r
+\r
+    def unlink(self):\r
+        for attr in self._attrs.values():\r
+            attr.unlink()\r
+        self._attrs = None\r
+        self._attrsNS = None\r
+        Node.unlink(self)\r
+\r
+    def getAttribute(self, attname):\r
+        try:\r
+            return self._attrs[attname].value\r
+        except KeyError:\r
+            return ""\r
+\r
+    def getAttributeNS(self, namespaceURI, localName):\r
+        try:\r
+            return self._attrsNS[(namespaceURI, localName)].value\r
+        except KeyError:\r
+            return ""\r
+\r
+    def setAttribute(self, attname, value):\r
+        attr = self.getAttributeNode(attname)\r
+        if attr is None:\r
+            attr = Attr(attname)\r
+            # for performance\r
+            d = attr.__dict__\r
+            d["value"] = d["nodeValue"] = value\r
+            d["ownerDocument"] = self.ownerDocument\r
+            self.setAttributeNode(attr)\r
+        elif value != attr.value:\r
+            d = attr.__dict__\r
+            d["value"] = d["nodeValue"] = value\r
+            if attr.isId:\r
+                _clear_id_cache(self)\r
+\r
+    def setAttributeNS(self, namespaceURI, qualifiedName, value):\r
+        prefix, localname = _nssplit(qualifiedName)\r
+        attr = self.getAttributeNodeNS(namespaceURI, localname)\r
+        if attr is None:\r
+            # for performance\r
+            attr = Attr(qualifiedName, namespaceURI, localname, prefix)\r
+            d = attr.__dict__\r
+            d["prefix"] = prefix\r
+            d["nodeName"] = qualifiedName\r
+            d["value"] = d["nodeValue"] = value\r
+            d["ownerDocument"] = self.ownerDocument\r
+            self.setAttributeNode(attr)\r
+        else:\r
+            d = attr.__dict__\r
+            if value != attr.value:\r
+                d["value"] = d["nodeValue"] = value\r
+                if attr.isId:\r
+                    _clear_id_cache(self)\r
+            if attr.prefix != prefix:\r
+                d["prefix"] = prefix\r
+                d["nodeName"] = qualifiedName\r
+\r
+    def getAttributeNode(self, attrname):\r
+        return self._attrs.get(attrname)\r
+\r
+    def getAttributeNodeNS(self, namespaceURI, localName):\r
+        return self._attrsNS.get((namespaceURI, localName))\r
+\r
+    def setAttributeNode(self, attr):\r
+        if attr.ownerElement not in (None, self):\r
+            raise xml.dom.InuseAttributeErr("attribute node already owned")\r
+        old1 = self._attrs.get(attr.name, None)\r
+        if old1 is not None:\r
+            self.removeAttributeNode(old1)\r
+        old2 = self._attrsNS.get((attr.namespaceURI, attr.localName), None)\r
+        if old2 is not None and old2 is not old1:\r
+            self.removeAttributeNode(old2)\r
+        _set_attribute_node(self, attr)\r
+\r
+        if old1 is not attr:\r
+            # It might have already been part of this node, in which case\r
+            # it doesn't represent a change, and should not be returned.\r
+            return old1\r
+        if old2 is not attr:\r
+            return old2\r
+\r
+    setAttributeNodeNS = setAttributeNode\r
+\r
+    def removeAttribute(self, name):\r
+        try:\r
+            attr = self._attrs[name]\r
+        except KeyError:\r
+            raise xml.dom.NotFoundErr()\r
+        self.removeAttributeNode(attr)\r
+\r
+    def removeAttributeNS(self, namespaceURI, localName):\r
+        try:\r
+            attr = self._attrsNS[(namespaceURI, localName)]\r
+        except KeyError:\r
+            raise xml.dom.NotFoundErr()\r
+        self.removeAttributeNode(attr)\r
+\r
+    def removeAttributeNode(self, node):\r
+        if node is None:\r
+            raise xml.dom.NotFoundErr()\r
+        try:\r
+            self._attrs[node.name]\r
+        except KeyError:\r
+            raise xml.dom.NotFoundErr()\r
+        _clear_id_cache(self)\r
+        node.unlink()\r
+        # Restore this since the node is still useful and otherwise\r
+        # unlinked\r
+        node.ownerDocument = self.ownerDocument\r
+\r
+    removeAttributeNodeNS = removeAttributeNode\r
+\r
+    def hasAttribute(self, name):\r
+        return name in self._attrs\r
+\r
+    def hasAttributeNS(self, namespaceURI, localName):\r
+        return (namespaceURI, localName) in self._attrsNS\r
+\r
+    def getElementsByTagName(self, name):\r
+        return _get_elements_by_tagName_helper(self, name, NodeList())\r
+\r
+    def getElementsByTagNameNS(self, namespaceURI, localName):\r
+        return _get_elements_by_tagName_ns_helper(\r
+            self, namespaceURI, localName, NodeList())\r
+\r
+    def __repr__(self):\r
+        return "<DOM Element: %s at %#x>" % (self.tagName, id(self))\r
+\r
+    def writexml(self, writer, indent="", addindent="", newl=""):\r
+        # indent = current indentation\r
+        # addindent = indentation to add to higher levels\r
+        # newl = newline string\r
+        writer.write(indent+"<" + self.tagName)\r
+\r
+        attrs = self._get_attributes()\r
+        a_names = attrs.keys()\r
+        a_names.sort()\r
+\r
+        for a_name in a_names:\r
+            writer.write(" %s=\"" % a_name)\r
+            _write_data(writer, attrs[a_name].value)\r
+            writer.write("\"")\r
+        if self.childNodes:\r
+            writer.write(">")\r
+            if (len(self.childNodes) == 1 and\r
+                self.childNodes[0].nodeType == Node.TEXT_NODE):\r
+                self.childNodes[0].writexml(writer, '', '', '')\r
+            else:\r
+                writer.write(newl)\r
+                for node in self.childNodes:\r
+                    node.writexml(writer, indent+addindent, addindent, newl)\r
+                writer.write(indent)\r
+            writer.write("</%s>%s" % (self.tagName, newl))\r
+        else:\r
+            writer.write("/>%s"%(newl))\r
+\r
+    def _get_attributes(self):\r
+        return NamedNodeMap(self._attrs, self._attrsNS, self)\r
+\r
+    def hasAttributes(self):\r
+        if self._attrs:\r
+            return True\r
+        else:\r
+            return False\r
+\r
+    # DOM Level 3 attributes, based on the 22 Oct 2002 draft\r
+\r
+    def setIdAttribute(self, name):\r
+        idAttr = self.getAttributeNode(name)\r
+        self.setIdAttributeNode(idAttr)\r
+\r
+    def setIdAttributeNS(self, namespaceURI, localName):\r
+        idAttr = self.getAttributeNodeNS(namespaceURI, localName)\r
+        self.setIdAttributeNode(idAttr)\r
+\r
+    def setIdAttributeNode(self, idAttr):\r
+        if idAttr is None or not self.isSameNode(idAttr.ownerElement):\r
+            raise xml.dom.NotFoundErr()\r
+        if _get_containing_entref(self) is not None:\r
+            raise xml.dom.NoModificationAllowedErr()\r
+        if not idAttr._is_id:\r
+            idAttr.__dict__['_is_id'] = True\r
+            self._magic_id_nodes += 1\r
+            self.ownerDocument._magic_id_count += 1\r
+            _clear_id_cache(self)\r
+\r
+defproperty(Element, "attributes",\r
+            doc="NamedNodeMap of attributes on the element.")\r
+defproperty(Element, "localName",\r
+            doc="Namespace-local name of this element.")\r
+\r
+\r
+def _set_attribute_node(element, attr):\r
+    _clear_id_cache(element)\r
+    element._attrs[attr.name] = attr\r
+    element._attrsNS[(attr.namespaceURI, attr.localName)] = attr\r
+\r
+    # This creates a circular reference, but Element.unlink()\r
+    # breaks the cycle since the references to the attribute\r
+    # dictionaries are tossed.\r
+    attr.__dict__['ownerElement'] = element\r
+\r
+\r
+class Childless:\r
+    """Mixin that makes childless-ness easy to implement and avoids\r
+    the complexity of the Node methods that deal with children.\r
+    """\r
+\r
+    attributes = None\r
+    childNodes = EmptyNodeList()\r
+    firstChild = None\r
+    lastChild = None\r
+\r
+    def _get_firstChild(self):\r
+        return None\r
+\r
+    def _get_lastChild(self):\r
+        return None\r
+\r
+    def appendChild(self, node):\r
+        raise xml.dom.HierarchyRequestErr(\r
+            self.nodeName + " nodes cannot have children")\r
+\r
+    def hasChildNodes(self):\r
+        return False\r
+\r
+    def insertBefore(self, newChild, refChild):\r
+        raise xml.dom.HierarchyRequestErr(\r
+            self.nodeName + " nodes do not have children")\r
+\r
+    def removeChild(self, oldChild):\r
+        raise xml.dom.NotFoundErr(\r
+            self.nodeName + " nodes do not have children")\r
+\r
+    def normalize(self):\r
+        # For childless nodes, normalize() has nothing to do.\r
+        pass\r
+\r
+    def replaceChild(self, newChild, oldChild):\r
+        raise xml.dom.HierarchyRequestErr(\r
+            self.nodeName + " nodes do not have children")\r
+\r
+\r
+class ProcessingInstruction(Childless, Node):\r
+    nodeType = Node.PROCESSING_INSTRUCTION_NODE\r
+\r
+    def __init__(self, target, data):\r
+        self.target = self.nodeName = target\r
+        self.data = self.nodeValue = data\r
+\r
+    def _get_data(self):\r
+        return self.data\r
+    def _set_data(self, value):\r
+        d = self.__dict__\r
+        d['data'] = d['nodeValue'] = value\r
+\r
+    def _get_target(self):\r
+        return self.target\r
+    def _set_target(self, value):\r
+        d = self.__dict__\r
+        d['target'] = d['nodeName'] = value\r
+\r
+    def __setattr__(self, name, value):\r
+        if name == "data" or name == "nodeValue":\r
+            self.__dict__['data'] = self.__dict__['nodeValue'] = value\r
+        elif name == "target" or name == "nodeName":\r
+            self.__dict__['target'] = self.__dict__['nodeName'] = value\r
+        else:\r
+            self.__dict__[name] = value\r
+\r
+    def writexml(self, writer, indent="", addindent="", newl=""):\r
+        writer.write("%s<?%s %s?>%s" % (indent,self.target, self.data, newl))\r
+\r
+\r
+class CharacterData(Childless, Node):\r
+    def _get_length(self):\r
+        return len(self.data)\r
+    __len__ = _get_length\r
+\r
+    def _get_data(self):\r
+        return self.__dict__['data']\r
+    def _set_data(self, data):\r
+        d = self.__dict__\r
+        d['data'] = d['nodeValue'] = data\r
+\r
+    _get_nodeValue = _get_data\r
+    _set_nodeValue = _set_data\r
+\r
+    def __setattr__(self, name, value):\r
+        if name == "data" or name == "nodeValue":\r
+            self.__dict__['data'] = self.__dict__['nodeValue'] = value\r
+        else:\r
+            self.__dict__[name] = value\r
+\r
+    def __repr__(self):\r
+        data = self.data\r
+        if len(data) > 10:\r
+            dotdotdot = "..."\r
+        else:\r
+            dotdotdot = ""\r
+        return '<DOM %s node "%r%s">' % (\r
+            self.__class__.__name__, data[0:10], dotdotdot)\r
+\r
+    def substringData(self, offset, count):\r
+        if offset < 0:\r
+            raise xml.dom.IndexSizeErr("offset cannot be negative")\r
+        if offset >= len(self.data):\r
+            raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")\r
+        if count < 0:\r
+            raise xml.dom.IndexSizeErr("count cannot be negative")\r
+        return self.data[offset:offset+count]\r
+\r
+    def appendData(self, arg):\r
+        self.data = self.data + arg\r
+\r
+    def insertData(self, offset, arg):\r
+        if offset < 0:\r
+            raise xml.dom.IndexSizeErr("offset cannot be negative")\r
+        if offset >= len(self.data):\r
+            raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")\r
+        if arg:\r
+            self.data = "%s%s%s" % (\r
+                self.data[:offset], arg, self.data[offset:])\r
+\r
+    def deleteData(self, offset, count):\r
+        if offset < 0:\r
+            raise xml.dom.IndexSizeErr("offset cannot be negative")\r
+        if offset >= len(self.data):\r
+            raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")\r
+        if count < 0:\r
+            raise xml.dom.IndexSizeErr("count cannot be negative")\r
+        if count:\r
+            self.data = self.data[:offset] + self.data[offset+count:]\r
+\r
+    def replaceData(self, offset, count, arg):\r
+        if offset < 0:\r
+            raise xml.dom.IndexSizeErr("offset cannot be negative")\r
+        if offset >= len(self.data):\r
+            raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")\r
+        if count < 0:\r
+            raise xml.dom.IndexSizeErr("count cannot be negative")\r
+        if count:\r
+            self.data = "%s%s%s" % (\r
+                self.data[:offset], arg, self.data[offset+count:])\r
+\r
+defproperty(CharacterData, "length", doc="Length of the string data.")\r
+\r
+\r
+class Text(CharacterData):\r
+    # Make sure we don't add an instance __dict__ if we don't already\r
+    # have one, at least when that's possible:\r
+    # XXX this does not work, CharacterData is an old-style class\r
+    # __slots__ = ()\r
+\r
+    nodeType = Node.TEXT_NODE\r
+    nodeName = "#text"\r
+    attributes = None\r
+\r
+    def splitText(self, offset):\r
+        if offset < 0 or offset > len(self.data):\r
+            raise xml.dom.IndexSizeErr("illegal offset value")\r
+        newText = self.__class__()\r
+        newText.data = self.data[offset:]\r
+        newText.ownerDocument = self.ownerDocument\r
+        next = self.nextSibling\r
+        if self.parentNode and self in self.parentNode.childNodes:\r
+            if next is None:\r
+                self.parentNode.appendChild(newText)\r
+            else:\r
+                self.parentNode.insertBefore(newText, next)\r
+        self.data = self.data[:offset]\r
+        return newText\r
+\r
+    def writexml(self, writer, indent="", addindent="", newl=""):\r
+        _write_data(writer, "%s%s%s" % (indent, self.data, newl))\r
+\r
+    # DOM Level 3 (WD 9 April 2002)\r
+\r
+    def _get_wholeText(self):\r
+        L = [self.data]\r
+        n = self.previousSibling\r
+        while n is not None:\r
+            if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):\r
+                L.insert(0, n.data)\r
+                n = n.previousSibling\r
+            else:\r
+                break\r
+        n = self.nextSibling\r
+        while n is not None:\r
+            if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):\r
+                L.append(n.data)\r
+                n = n.nextSibling\r
+            else:\r
+                break\r
+        return ''.join(L)\r
+\r
+    def replaceWholeText(self, content):\r
+        # XXX This needs to be seriously changed if minidom ever\r
+        # supports EntityReference nodes.\r
+        parent = self.parentNode\r
+        n = self.previousSibling\r
+        while n is not None:\r
+            if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):\r
+                next = n.previousSibling\r
+                parent.removeChild(n)\r
+                n = next\r
+            else:\r
+                break\r
+        n = self.nextSibling\r
+        if not content:\r
+            parent.removeChild(self)\r
+        while n is not None:\r
+            if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):\r
+                next = n.nextSibling\r
+                parent.removeChild(n)\r
+                n = next\r
+            else:\r
+                break\r
+        if content:\r
+            d = self.__dict__\r
+            d['data'] = content\r
+            d['nodeValue'] = content\r
+            return self\r
+        else:\r
+            return None\r
+\r
+    def _get_isWhitespaceInElementContent(self):\r
+        if self.data.strip():\r
+            return False\r
+        elem = _get_containing_element(self)\r
+        if elem is None:\r
+            return False\r
+        info = self.ownerDocument._get_elem_info(elem)\r
+        if info is None:\r
+            return False\r
+        else:\r
+            return info.isElementContent()\r
+\r
+defproperty(Text, "isWhitespaceInElementContent",\r
+            doc="True iff this text node contains only whitespace"\r
+                " and is in element content.")\r
+defproperty(Text, "wholeText",\r
+            doc="The text of all logically-adjacent text nodes.")\r
+\r
+\r
+def _get_containing_element(node):\r
+    c = node.parentNode\r
+    while c is not None:\r
+        if c.nodeType == Node.ELEMENT_NODE:\r
+            return c\r
+        c = c.parentNode\r
+    return None\r
+\r
+def _get_containing_entref(node):\r
+    c = node.parentNode\r
+    while c is not None:\r
+        if c.nodeType == Node.ENTITY_REFERENCE_NODE:\r
+            return c\r
+        c = c.parentNode\r
+    return None\r
+\r
+\r
+class Comment(Childless, CharacterData):\r
+    nodeType = Node.COMMENT_NODE\r
+    nodeName = "#comment"\r
+\r
+    def __init__(self, data):\r
+        self.data = self.nodeValue = data\r
+\r
+    def writexml(self, writer, indent="", addindent="", newl=""):\r
+        if "--" in self.data:\r
+            raise ValueError("'--' is not allowed in a comment node")\r
+        writer.write("%s<!--%s-->%s" % (indent, self.data, newl))\r
+\r
+\r
+class CDATASection(Text):\r
+    # Make sure we don't add an instance __dict__ if we don't already\r
+    # have one, at least when that's possible:\r
+    # XXX this does not work, Text is an old-style class\r
+    # __slots__ = ()\r
+\r
+    nodeType = Node.CDATA_SECTION_NODE\r
+    nodeName = "#cdata-section"\r
+\r
+    def writexml(self, writer, indent="", addindent="", newl=""):\r
+        if self.data.find("]]>") >= 0:\r
+            raise ValueError("']]>' not allowed in a CDATA section")\r
+        writer.write("<![CDATA[%s]]>" % self.data)\r
+\r
+\r
+class ReadOnlySequentialNamedNodeMap(object):\r
+    __slots__ = '_seq',\r
+\r
+    def __init__(self, seq=()):\r
+        # seq should be a list or tuple\r
+        self._seq = seq\r
+\r
+    def __len__(self):\r
+        return len(self._seq)\r
+\r
+    def _get_length(self):\r
+        return len(self._seq)\r
+\r
+    def getNamedItem(self, name):\r
+        for n in self._seq:\r
+            if n.nodeName == name:\r
+                return n\r
+\r
+    def getNamedItemNS(self, namespaceURI, localName):\r
+        for n in self._seq:\r
+            if n.namespaceURI == namespaceURI and n.localName == localName:\r
+                return n\r
+\r
+    def __getitem__(self, name_or_tuple):\r
+        if isinstance(name_or_tuple, tuple):\r
+            node = self.getNamedItemNS(*name_or_tuple)\r
+        else:\r
+            node = self.getNamedItem(name_or_tuple)\r
+        if node is None:\r
+            raise KeyError, name_or_tuple\r
+        return node\r
+\r
+    def item(self, index):\r
+        if index < 0:\r
+            return None\r
+        try:\r
+            return self._seq[index]\r
+        except IndexError:\r
+            return None\r
+\r
+    def removeNamedItem(self, name):\r
+        raise xml.dom.NoModificationAllowedErr(\r
+            "NamedNodeMap instance is read-only")\r
+\r
+    def removeNamedItemNS(self, namespaceURI, localName):\r
+        raise xml.dom.NoModificationAllowedErr(\r
+            "NamedNodeMap instance is read-only")\r
+\r
+    def setNamedItem(self, node):\r
+        raise xml.dom.NoModificationAllowedErr(\r
+            "NamedNodeMap instance is read-only")\r
+\r
+    def setNamedItemNS(self, node):\r
+        raise xml.dom.NoModificationAllowedErr(\r
+            "NamedNodeMap instance is read-only")\r
+\r
+    def __getstate__(self):\r
+        return [self._seq]\r
+\r
+    def __setstate__(self, state):\r
+        self._seq = state[0]\r
+\r
+defproperty(ReadOnlySequentialNamedNodeMap, "length",\r
+            doc="Number of entries in the NamedNodeMap.")\r
+\r
+\r
+class Identified:\r
+    """Mix-in class that supports the publicId and systemId attributes."""\r
+\r
+    # XXX this does not work, this is an old-style class\r
+    # __slots__ = 'publicId', 'systemId'\r
+\r
+    def _identified_mixin_init(self, publicId, systemId):\r
+        self.publicId = publicId\r
+        self.systemId = systemId\r
+\r
+    def _get_publicId(self):\r
+        return self.publicId\r
+\r
+    def _get_systemId(self):\r
+        return self.systemId\r
+\r
+class DocumentType(Identified, Childless, Node):\r
+    nodeType = Node.DOCUMENT_TYPE_NODE\r
+    nodeValue = None\r
+    name = None\r
+    publicId = None\r
+    systemId = None\r
+    internalSubset = None\r
+\r
+    def __init__(self, qualifiedName):\r
+        self.entities = ReadOnlySequentialNamedNodeMap()\r
+        self.notations = ReadOnlySequentialNamedNodeMap()\r
+        if qualifiedName:\r
+            prefix, localname = _nssplit(qualifiedName)\r
+            self.name = localname\r
+        self.nodeName = self.name\r
+\r
+    def _get_internalSubset(self):\r
+        return self.internalSubset\r
+\r
+    def cloneNode(self, deep):\r
+        if self.ownerDocument is None:\r
+            # it's ok\r
+            clone = DocumentType(None)\r
+            clone.name = self.name\r
+            clone.nodeName = self.name\r
+            operation = xml.dom.UserDataHandler.NODE_CLONED\r
+            if deep:\r
+                clone.entities._seq = []\r
+                clone.notations._seq = []\r
+                for n in self.notations._seq:\r
+                    notation = Notation(n.nodeName, n.publicId, n.systemId)\r
+                    clone.notations._seq.append(notation)\r
+                    n._call_user_data_handler(operation, n, notation)\r
+                for e in self.entities._seq:\r
+                    entity = Entity(e.nodeName, e.publicId, e.systemId,\r
+                                    e.notationName)\r
+                    entity.actualEncoding = e.actualEncoding\r
+                    entity.encoding = e.encoding\r
+                    entity.version = e.version\r
+                    clone.entities._seq.append(entity)\r
+                    e._call_user_data_handler(operation, n, entity)\r
+            self._call_user_data_handler(operation, self, clone)\r
+            return clone\r
+        else:\r
+            return None\r
+\r
+    def writexml(self, writer, indent="", addindent="", newl=""):\r
+        writer.write("<!DOCTYPE ")\r
+        writer.write(self.name)\r
+        if self.publicId:\r
+            writer.write("%s  PUBLIC '%s'%s  '%s'"\r
+                         % (newl, self.publicId, newl, self.systemId))\r
+        elif self.systemId:\r
+            writer.write("%s  SYSTEM '%s'" % (newl, self.systemId))\r
+        if self.internalSubset is not None:\r
+            writer.write(" [")\r
+            writer.write(self.internalSubset)\r
+            writer.write("]")\r
+        writer.write(">"+newl)\r
+\r
+class Entity(Identified, Node):\r
+    attributes = None\r
+    nodeType = Node.ENTITY_NODE\r
+    nodeValue = None\r
+\r
+    actualEncoding = None\r
+    encoding = None\r
+    version = None\r
+\r
+    def __init__(self, name, publicId, systemId, notation):\r
+        self.nodeName = name\r
+        self.notationName = notation\r
+        self.childNodes = NodeList()\r
+        self._identified_mixin_init(publicId, systemId)\r
+\r
+    def _get_actualEncoding(self):\r
+        return self.actualEncoding\r
+\r
+    def _get_encoding(self):\r
+        return self.encoding\r
+\r
+    def _get_version(self):\r
+        return self.version\r
+\r
+    def appendChild(self, newChild):\r
+        raise xml.dom.HierarchyRequestErr(\r
+            "cannot append children to an entity node")\r
+\r
+    def insertBefore(self, newChild, refChild):\r
+        raise xml.dom.HierarchyRequestErr(\r
+            "cannot insert children below an entity node")\r
+\r
+    def removeChild(self, oldChild):\r
+        raise xml.dom.HierarchyRequestErr(\r
+            "cannot remove children from an entity node")\r
+\r
+    def replaceChild(self, newChild, oldChild):\r
+        raise xml.dom.HierarchyRequestErr(\r
+            "cannot replace children of an entity node")\r
+\r
+class Notation(Identified, Childless, Node):\r
+    nodeType = Node.NOTATION_NODE\r
+    nodeValue = None\r
+\r
+    def __init__(self, name, publicId, systemId):\r
+        self.nodeName = name\r
+        self._identified_mixin_init(publicId, systemId)\r
+\r
+\r
+class DOMImplementation(DOMImplementationLS):\r
+    _features = [("core", "1.0"),\r
+                 ("core", "2.0"),\r
+                 ("core", None),\r
+                 ("xml", "1.0"),\r
+                 ("xml", "2.0"),\r
+                 ("xml", None),\r
+                 ("ls-load", "3.0"),\r
+                 ("ls-load", None),\r
+                 ]\r
+\r
+    def hasFeature(self, feature, version):\r
+        if version == "":\r
+            version = None\r
+        return (feature.lower(), version) in self._features\r
+\r
+    def createDocument(self, namespaceURI, qualifiedName, doctype):\r
+        if doctype and doctype.parentNode is not None:\r
+            raise xml.dom.WrongDocumentErr(\r
+                "doctype object owned by another DOM tree")\r
+        doc = self._create_document()\r
+\r
+        add_root_element = not (namespaceURI is None\r
+                                and qualifiedName is None\r
+                                and doctype is None)\r
+\r
+        if not qualifiedName and add_root_element:\r
+            # The spec is unclear what to raise here; SyntaxErr\r
+            # would be the other obvious candidate. Since Xerces raises\r
+            # InvalidCharacterErr, and since SyntaxErr is not listed\r
+            # for createDocument, that seems to be the better choice.\r
+            # XXX: need to check for illegal characters here and in\r
+            # createElement.\r
+\r
+            # DOM Level III clears this up when talking about the return value\r
+            # of this function.  If namespaceURI, qName and DocType are\r
+            # Null the document is returned without a document element\r
+            # Otherwise if doctype or namespaceURI are not None\r
+            # Then we go back to the above problem\r
+            raise xml.dom.InvalidCharacterErr("Element with no name")\r
+\r
+        if add_root_element:\r
+            prefix, localname = _nssplit(qualifiedName)\r
+            if prefix == "xml" \\r
+               and namespaceURI != "http://www.w3.org/XML/1998/namespace":\r
+                raise xml.dom.NamespaceErr("illegal use of 'xml' prefix")\r
+            if prefix and not namespaceURI:\r
+                raise xml.dom.NamespaceErr(\r
+                    "illegal use of prefix without namespaces")\r
+            element = doc.createElementNS(namespaceURI, qualifiedName)\r
+            if doctype:\r
+                doc.appendChild(doctype)\r
+            doc.appendChild(element)\r
+\r
+        if doctype:\r
+            doctype.parentNode = doctype.ownerDocument = doc\r
+\r
+        doc.doctype = doctype\r
+        doc.implementation = self\r
+        return doc\r
+\r
+    def createDocumentType(self, qualifiedName, publicId, systemId):\r
+        doctype = DocumentType(qualifiedName)\r
+        doctype.publicId = publicId\r
+        doctype.systemId = systemId\r
+        return doctype\r
+\r
+    # DOM Level 3 (WD 9 April 2002)\r
+\r
+    def getInterface(self, feature):\r
+        if self.hasFeature(feature, None):\r
+            return self\r
+        else:\r
+            return None\r
+\r
+    # internal\r
+    def _create_document(self):\r
+        return Document()\r
+\r
+class ElementInfo(object):\r
+    """Object that represents content-model information for an element.\r
+\r
+    This implementation is not expected to be used in practice; DOM\r
+    builders should provide implementations which do the right thing\r
+    using information available to it.\r
+\r
+    """\r
+\r
+    __slots__ = 'tagName',\r
+\r
+    def __init__(self, name):\r
+        self.tagName = name\r
+\r
+    def getAttributeType(self, aname):\r
+        return _no_type\r
+\r
+    def getAttributeTypeNS(self, namespaceURI, localName):\r
+        return _no_type\r
+\r
+    def isElementContent(self):\r
+        return False\r
+\r
+    def isEmpty(self):\r
+        """Returns true iff this element is declared to have an EMPTY\r
+        content model."""\r
+        return False\r
+\r
+    def isId(self, aname):\r
+        """Returns true iff the named attribute is a DTD-style ID."""\r
+        return False\r
+\r
+    def isIdNS(self, namespaceURI, localName):\r
+        """Returns true iff the identified attribute is a DTD-style ID."""\r
+        return False\r
+\r
+    def __getstate__(self):\r
+        return self.tagName\r
+\r
+    def __setstate__(self, state):\r
+        self.tagName = state\r
+\r
+def _clear_id_cache(node):\r
+    if node.nodeType == Node.DOCUMENT_NODE:\r
+        node._id_cache.clear()\r
+        node._id_search_stack = None\r
+    elif _in_document(node):\r
+        node.ownerDocument._id_cache.clear()\r
+        node.ownerDocument._id_search_stack= None\r
+\r
+class Document(Node, DocumentLS):\r
+    _child_node_types = (Node.ELEMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE,\r
+                         Node.COMMENT_NODE, Node.DOCUMENT_TYPE_NODE)\r
+\r
+    nodeType = Node.DOCUMENT_NODE\r
+    nodeName = "#document"\r
+    nodeValue = None\r
+    attributes = None\r
+    doctype = None\r
+    parentNode = None\r
+    previousSibling = nextSibling = None\r
+\r
+    implementation = DOMImplementation()\r
+\r
+    # Document attributes from Level 3 (WD 9 April 2002)\r
+\r
+    actualEncoding = None\r
+    encoding = None\r
+    standalone = None\r
+    version = None\r
+    strictErrorChecking = False\r
+    errorHandler = None\r
+    documentURI = None\r
+\r
+    _magic_id_count = 0\r
+\r
+    def __init__(self):\r
+        self.childNodes = NodeList()\r
+        # mapping of (namespaceURI, localName) -> ElementInfo\r
+        #        and tagName -> ElementInfo\r
+        self._elem_info = {}\r
+        self._id_cache = {}\r
+        self._id_search_stack = None\r
+\r
+    def _get_elem_info(self, element):\r
+        if element.namespaceURI:\r
+            key = element.namespaceURI, element.localName\r
+        else:\r
+            key = element.tagName\r
+        return self._elem_info.get(key)\r
+\r
+    def _get_actualEncoding(self):\r
+        return self.actualEncoding\r
+\r
+    def _get_doctype(self):\r
+        return self.doctype\r
+\r
+    def _get_documentURI(self):\r
+        return self.documentURI\r
+\r
+    def _get_encoding(self):\r
+        return self.encoding\r
+\r
+    def _get_errorHandler(self):\r
+        return self.errorHandler\r
+\r
+    def _get_standalone(self):\r
+        return self.standalone\r
+\r
+    def _get_strictErrorChecking(self):\r
+        return self.strictErrorChecking\r
+\r
+    def _get_version(self):\r
+        return self.version\r
+\r
+    def appendChild(self, node):\r
+        if node.nodeType not in self._child_node_types:\r
+            raise xml.dom.HierarchyRequestErr(\r
+                "%s cannot be child of %s" % (repr(node), repr(self)))\r
+        if node.parentNode is not None:\r
+            # This needs to be done before the next test since this\r
+            # may *be* the document element, in which case it should\r
+            # end up re-ordered to the end.\r
+            node.parentNode.removeChild(node)\r
+\r
+        if node.nodeType == Node.ELEMENT_NODE \\r
+           and self._get_documentElement():\r
+            raise xml.dom.HierarchyRequestErr(\r
+                "two document elements disallowed")\r
+        return Node.appendChild(self, node)\r
+\r
+    def removeChild(self, oldChild):\r
+        try:\r
+            self.childNodes.remove(oldChild)\r
+        except ValueError:\r
+            raise xml.dom.NotFoundErr()\r
+        oldChild.nextSibling = oldChild.previousSibling = None\r
+        oldChild.parentNode = None\r
+        if self.documentElement is oldChild:\r
+            self.documentElement = None\r
+\r
+        return oldChild\r
+\r
+    def _get_documentElement(self):\r
+        for node in self.childNodes:\r
+            if node.nodeType == Node.ELEMENT_NODE:\r
+                return node\r
+\r
+    def unlink(self):\r
+        if self.doctype is not None:\r
+            self.doctype.unlink()\r
+            self.doctype = None\r
+        Node.unlink(self)\r
+\r
+    def cloneNode(self, deep):\r
+        if not deep:\r
+            return None\r
+        clone = self.implementation.createDocument(None, None, None)\r
+        clone.encoding = self.encoding\r
+        clone.standalone = self.standalone\r
+        clone.version = self.version\r
+        for n in self.childNodes:\r
+            childclone = _clone_node(n, deep, clone)\r
+            assert childclone.ownerDocument.isSameNode(clone)\r
+            clone.childNodes.append(childclone)\r
+            if childclone.nodeType == Node.DOCUMENT_NODE:\r
+                assert clone.documentElement is None\r
+            elif childclone.nodeType == Node.DOCUMENT_TYPE_NODE:\r
+                assert clone.doctype is None\r
+                clone.doctype = childclone\r
+            childclone.parentNode = clone\r
+        self._call_user_data_handler(xml.dom.UserDataHandler.NODE_CLONED,\r
+                                     self, clone)\r
+        return clone\r
+\r
+    def createDocumentFragment(self):\r
+        d = DocumentFragment()\r
+        d.ownerDocument = self\r
+        return d\r
+\r
+    def createElement(self, tagName):\r
+        e = Element(tagName)\r
+        e.ownerDocument = self\r
+        return e\r
+\r
+    def createTextNode(self, data):\r
+        if not isinstance(data, StringTypes):\r
+            raise TypeError, "node contents must be a string"\r
+        t = Text()\r
+        t.data = data\r
+        t.ownerDocument = self\r
+        return t\r
+\r
+    def createCDATASection(self, data):\r
+        if not isinstance(data, StringTypes):\r
+            raise TypeError, "node contents must be a string"\r
+        c = CDATASection()\r
+        c.data = data\r
+        c.ownerDocument = self\r
+        return c\r
+\r
+    def createComment(self, data):\r
+        c = Comment(data)\r
+        c.ownerDocument = self\r
+        return c\r
+\r
+    def createProcessingInstruction(self, target, data):\r
+        p = ProcessingInstruction(target, data)\r
+        p.ownerDocument = self\r
+        return p\r
+\r
+    def createAttribute(self, qName):\r
+        a = Attr(qName)\r
+        a.ownerDocument = self\r
+        a.value = ""\r
+        return a\r
+\r
+    def createElementNS(self, namespaceURI, qualifiedName):\r
+        prefix, localName = _nssplit(qualifiedName)\r
+        e = Element(qualifiedName, namespaceURI, prefix)\r
+        e.ownerDocument = self\r
+        return e\r
+\r
+    def createAttributeNS(self, namespaceURI, qualifiedName):\r
+        prefix, localName = _nssplit(qualifiedName)\r
+        a = Attr(qualifiedName, namespaceURI, localName, prefix)\r
+        a.ownerDocument = self\r
+        a.value = ""\r
+        return a\r
+\r
+    # A couple of implementation-specific helpers to create node types\r
+    # not supported by the W3C DOM specs:\r
+\r
+    def _create_entity(self, name, publicId, systemId, notationName):\r
+        e = Entity(name, publicId, systemId, notationName)\r
+        e.ownerDocument = self\r
+        return e\r
+\r
+    def _create_notation(self, name, publicId, systemId):\r
+        n = Notation(name, publicId, systemId)\r
+        n.ownerDocument = self\r
+        return n\r
+\r
+    def getElementById(self, id):\r
+        if id in self._id_cache:\r
+            return self._id_cache[id]\r
+        if not (self._elem_info or self._magic_id_count):\r
+            return None\r
+\r
+        stack = self._id_search_stack\r
+        if stack is None:\r
+            # we never searched before, or the cache has been cleared\r
+            stack = [self.documentElement]\r
+            self._id_search_stack = stack\r
+        elif not stack:\r
+            # Previous search was completed and cache is still valid;\r
+            # no matching node.\r
+            return None\r
+\r
+        result = None\r
+        while stack:\r
+            node = stack.pop()\r
+            # add child elements to stack for continued searching\r
+            stack.extend([child for child in node.childNodes\r
+                          if child.nodeType in _nodeTypes_with_children])\r
+            # check this node\r
+            info = self._get_elem_info(node)\r
+            if info:\r
+                # We have to process all ID attributes before\r
+                # returning in order to get all the attributes set to\r
+                # be IDs using Element.setIdAttribute*().\r
+                for attr in node.attributes.values():\r
+                    if attr.namespaceURI:\r
+                        if info.isIdNS(attr.namespaceURI, attr.localName):\r
+                            self._id_cache[attr.value] = node\r
+                            if attr.value == id:\r
+                                result = node\r
+                            elif not node._magic_id_nodes:\r
+                                break\r
+                    elif info.isId(attr.name):\r
+                        self._id_cache[attr.value] = node\r
+                        if attr.value == id:\r
+                            result = node\r
+                        elif not node._magic_id_nodes:\r
+                            break\r
+                    elif attr._is_id:\r
+                        self._id_cache[attr.value] = node\r
+                        if attr.value == id:\r
+                            result = node\r
+                        elif node._magic_id_nodes == 1:\r
+                            break\r
+            elif node._magic_id_nodes:\r
+                for attr in node.attributes.values():\r
+                    if attr._is_id:\r
+                        self._id_cache[attr.value] = node\r
+                        if attr.value == id:\r
+                            result = node\r
+            if result is not None:\r
+                break\r
+        return result\r
+\r
+    def getElementsByTagName(self, name):\r
+        return _get_elements_by_tagName_helper(self, name, NodeList())\r
+\r
+    def getElementsByTagNameNS(self, namespaceURI, localName):\r
+        return _get_elements_by_tagName_ns_helper(\r
+            self, namespaceURI, localName, NodeList())\r
+\r
+    def isSupported(self, feature, version):\r
+        return self.implementation.hasFeature(feature, version)\r
+\r
+    def importNode(self, node, deep):\r
+        if node.nodeType == Node.DOCUMENT_NODE:\r
+            raise xml.dom.NotSupportedErr("cannot import document nodes")\r
+        elif node.nodeType == Node.DOCUMENT_TYPE_NODE:\r
+            raise xml.dom.NotSupportedErr("cannot import document type nodes")\r
+        return _clone_node(node, deep, self)\r
+\r
+    def writexml(self, writer, indent="", addindent="", newl="",\r
+                 encoding = None):\r
+        if encoding is None:\r
+            writer.write('<?xml version="1.0" ?>'+newl)\r
+        else:\r
+            writer.write('<?xml version="1.0" encoding="%s"?>%s' % (encoding, newl))\r
+        for node in self.childNodes:\r
+            node.writexml(writer, indent, addindent, newl)\r
+\r
+    # DOM Level 3 (WD 9 April 2002)\r
+\r
+    def renameNode(self, n, namespaceURI, name):\r
+        if n.ownerDocument is not self:\r
+            raise xml.dom.WrongDocumentErr(\r
+                "cannot rename nodes from other documents;\n"\r
+                "expected %s,\nfound %s" % (self, n.ownerDocument))\r
+        if n.nodeType not in (Node.ELEMENT_NODE, Node.ATTRIBUTE_NODE):\r
+            raise xml.dom.NotSupportedErr(\r
+                "renameNode() only applies to element and attribute nodes")\r
+        if namespaceURI != EMPTY_NAMESPACE:\r
+            if ':' in name:\r
+                prefix, localName = name.split(':', 1)\r
+                if (  prefix == "xmlns"\r
+                      and namespaceURI != xml.dom.XMLNS_NAMESPACE):\r
+                    raise xml.dom.NamespaceErr(\r
+                        "illegal use of 'xmlns' prefix")\r
+            else:\r
+                if (  name == "xmlns"\r
+                      and namespaceURI != xml.dom.XMLNS_NAMESPACE\r
+                      and n.nodeType == Node.ATTRIBUTE_NODE):\r
+                    raise xml.dom.NamespaceErr(\r
+                        "illegal use of the 'xmlns' attribute")\r
+                prefix = None\r
+                localName = name\r
+        else:\r
+            prefix = None\r
+            localName = None\r
+        if n.nodeType == Node.ATTRIBUTE_NODE:\r
+            element = n.ownerElement\r
+            if element is not None:\r
+                is_id = n._is_id\r
+                element.removeAttributeNode(n)\r
+        else:\r
+            element = None\r
+        # avoid __setattr__\r
+        d = n.__dict__\r
+        d['prefix'] = prefix\r
+        d['localName'] = localName\r
+        d['namespaceURI'] = namespaceURI\r
+        d['nodeName'] = name\r
+        if n.nodeType == Node.ELEMENT_NODE:\r
+            d['tagName'] = name\r
+        else:\r
+            # attribute node\r
+            d['name'] = name\r
+            if element is not None:\r
+                element.setAttributeNode(n)\r
+                if is_id:\r
+                    element.setIdAttributeNode(n)\r
+        # It's not clear from a semantic perspective whether we should\r
+        # call the user data handlers for the NODE_RENAMED event since\r
+        # we're re-using the existing node.  The draft spec has been\r
+        # interpreted as meaning "no, don't call the handler unless a\r
+        # new node is created."\r
+        return n\r
+\r
+defproperty(Document, "documentElement",\r
+            doc="Top-level element of this document.")\r
+\r
+\r
+def _clone_node(node, deep, newOwnerDocument):\r
+    """\r
+    Clone a node and give it the new owner document.\r
+    Called by Node.cloneNode and Document.importNode\r
+    """\r
+    if node.ownerDocument.isSameNode(newOwnerDocument):\r
+        operation = xml.dom.UserDataHandler.NODE_CLONED\r
+    else:\r
+        operation = xml.dom.UserDataHandler.NODE_IMPORTED\r
+    if node.nodeType == Node.ELEMENT_NODE:\r
+        clone = newOwnerDocument.createElementNS(node.namespaceURI,\r
+                                                 node.nodeName)\r
+        for attr in node.attributes.values():\r
+            clone.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.value)\r
+            a = clone.getAttributeNodeNS(attr.namespaceURI, attr.localName)\r
+            a.specified = attr.specified\r
+\r
+        if deep:\r
+            for child in node.childNodes:\r
+                c = _clone_node(child, deep, newOwnerDocument)\r
+                clone.appendChild(c)\r
+\r
+    elif node.nodeType == Node.DOCUMENT_FRAGMENT_NODE:\r
+        clone = newOwnerDocument.createDocumentFragment()\r
+        if deep:\r
+            for child in node.childNodes:\r
+                c = _clone_node(child, deep, newOwnerDocument)\r
+                clone.appendChild(c)\r
+\r
+    elif node.nodeType == Node.TEXT_NODE:\r
+        clone = newOwnerDocument.createTextNode(node.data)\r
+    elif node.nodeType == Node.CDATA_SECTION_NODE:\r
+        clone = newOwnerDocument.createCDATASection(node.data)\r
+    elif node.nodeType == Node.PROCESSING_INSTRUCTION_NODE:\r
+        clone = newOwnerDocument.createProcessingInstruction(node.target,\r
+                                                             node.data)\r
+    elif node.nodeType == Node.COMMENT_NODE:\r
+        clone = newOwnerDocument.createComment(node.data)\r
+    elif node.nodeType == Node.ATTRIBUTE_NODE:\r
+        clone = newOwnerDocument.createAttributeNS(node.namespaceURI,\r
+                                                   node.nodeName)\r
+        clone.specified = True\r
+        clone.value = node.value\r
+    elif node.nodeType == Node.DOCUMENT_TYPE_NODE:\r
+        assert node.ownerDocument is not newOwnerDocument\r
+        operation = xml.dom.UserDataHandler.NODE_IMPORTED\r
+        clone = newOwnerDocument.implementation.createDocumentType(\r
+            node.name, node.publicId, node.systemId)\r
+        clone.ownerDocument = newOwnerDocument\r
+        if deep:\r
+            clone.entities._seq = []\r
+            clone.notations._seq = []\r
+            for n in node.notations._seq:\r
+                notation = Notation(n.nodeName, n.publicId, n.systemId)\r
+                notation.ownerDocument = newOwnerDocument\r
+                clone.notations._seq.append(notation)\r
+                if hasattr(n, '_call_user_data_handler'):\r
+                    n._call_user_data_handler(operation, n, notation)\r
+            for e in node.entities._seq:\r
+                entity = Entity(e.nodeName, e.publicId, e.systemId,\r
+                                e.notationName)\r
+                entity.actualEncoding = e.actualEncoding\r
+                entity.encoding = e.encoding\r
+                entity.version = e.version\r
+                entity.ownerDocument = newOwnerDocument\r
+                clone.entities._seq.append(entity)\r
+                if hasattr(e, '_call_user_data_handler'):\r
+                    e._call_user_data_handler(operation, n, entity)\r
+    else:\r
+        # Note the cloning of Document and DocumentType nodes is\r
+        # implementation specific.  minidom handles those cases\r
+        # directly in the cloneNode() methods.\r
+        raise xml.dom.NotSupportedErr("Cannot clone node %s" % repr(node))\r
+\r
+    # Check for _call_user_data_handler() since this could conceivably\r
+    # used with other DOM implementations (one of the FourThought\r
+    # DOMs, perhaps?).\r
+    if hasattr(node, '_call_user_data_handler'):\r
+        node._call_user_data_handler(operation, node, clone)\r
+    return clone\r
+\r
+\r
+def _nssplit(qualifiedName):\r
+    fields = qualifiedName.split(':', 1)\r
+    if len(fields) == 2:\r
+        return fields\r
+    else:\r
+        return (None, fields[0])\r
+\r
+\r
+def _get_StringIO():\r
+    # we can't use cStringIO since it doesn't support Unicode strings\r
+    from StringIO import StringIO\r
+    return StringIO()\r
+\r
+def _do_pulldom_parse(func, args, kwargs):\r
+    events = func(*args, **kwargs)\r
+    toktype, rootNode = events.getEvent()\r
+    events.expandNode(rootNode)\r
+    events.clear()\r
+    return rootNode\r
+\r
+def parse(file, parser=None, bufsize=None):\r
+    """Parse a file into a DOM by filename or file object."""\r
+    if parser is None and not bufsize:\r
+        from xml.dom import expatbuilder\r
+        return expatbuilder.parse(file)\r
+    else:\r
+        from xml.dom import pulldom\r
+        return _do_pulldom_parse(pulldom.parse, (file,),\r
+            {'parser': parser, 'bufsize': bufsize})\r
+\r
+def parseString(string, parser=None):\r
+    """Parse a file into a DOM from a string."""\r
+    if parser is None:\r
+        from xml.dom import expatbuilder\r
+        return expatbuilder.parseString(string)\r
+    else:\r
+        from xml.dom import pulldom\r
+        return _do_pulldom_parse(pulldom.parseString, (string,),\r
+                                 {'parser': parser})\r
+\r
+def getDOMImplementation(features=None):\r
+    if features:\r
+        if isinstance(features, StringTypes):\r
+            features = domreg._parse_feature_string(features)\r
+        for f, v in features:\r
+            if not Document.implementation.hasFeature(f, v):\r
+                return None\r
+    return Document.implementation\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/pulldom.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/pulldom.py
new file mode 100644 (file)
index 0000000..cdec746
--- /dev/null
@@ -0,0 +1,351 @@
+import xml.sax\r
+import xml.sax.handler\r
+import types\r
+\r
+try:\r
+    _StringTypes = [types.StringType, types.UnicodeType]\r
+except AttributeError:\r
+    _StringTypes = [types.StringType]\r
+\r
+START_ELEMENT = "START_ELEMENT"\r
+END_ELEMENT = "END_ELEMENT"\r
+COMMENT = "COMMENT"\r
+START_DOCUMENT = "START_DOCUMENT"\r
+END_DOCUMENT = "END_DOCUMENT"\r
+PROCESSING_INSTRUCTION = "PROCESSING_INSTRUCTION"\r
+IGNORABLE_WHITESPACE = "IGNORABLE_WHITESPACE"\r
+CHARACTERS = "CHARACTERS"\r
+\r
+class PullDOM(xml.sax.ContentHandler):\r
+    _locator = None\r
+    document = None\r
+\r
+    def __init__(self, documentFactory=None):\r
+        from xml.dom import XML_NAMESPACE\r
+        self.documentFactory = documentFactory\r
+        self.firstEvent = [None, None]\r
+        self.lastEvent = self.firstEvent\r
+        self.elementStack = []\r
+        self.push = self.elementStack.append\r
+        try:\r
+            self.pop = self.elementStack.pop\r
+        except AttributeError:\r
+            # use class' pop instead\r
+            pass\r
+        self._ns_contexts = [{XML_NAMESPACE:'xml'}] # contains uri -> prefix dicts\r
+        self._current_context = self._ns_contexts[-1]\r
+        self.pending_events = []\r
+\r
+    def pop(self):\r
+        result = self.elementStack[-1]\r
+        del self.elementStack[-1]\r
+        return result\r
+\r
+    def setDocumentLocator(self, locator):\r
+        self._locator = locator\r
+\r
+    def startPrefixMapping(self, prefix, uri):\r
+        if not hasattr(self, '_xmlns_attrs'):\r
+            self._xmlns_attrs = []\r
+        self._xmlns_attrs.append((prefix or 'xmlns', uri))\r
+        self._ns_contexts.append(self._current_context.copy())\r
+        self._current_context[uri] = prefix or None\r
+\r
+    def endPrefixMapping(self, prefix):\r
+        self._current_context = self._ns_contexts.pop()\r
+\r
+    def startElementNS(self, name, tagName , attrs):\r
+        # Retrieve xml namespace declaration attributes.\r
+        xmlns_uri = 'http://www.w3.org/2000/xmlns/'\r
+        xmlns_attrs = getattr(self, '_xmlns_attrs', None)\r
+        if xmlns_attrs is not None:\r
+            for aname, value in xmlns_attrs:\r
+                attrs._attrs[(xmlns_uri, aname)] = value\r
+            self._xmlns_attrs = []\r
+        uri, localname = name\r
+        if uri:\r
+            # When using namespaces, the reader may or may not\r
+            # provide us with the original name. If not, create\r
+            # *a* valid tagName from the current context.\r
+            if tagName is None:\r
+                prefix = self._current_context[uri]\r
+                if prefix:\r
+                    tagName = prefix + ":" + localname\r
+                else:\r
+                    tagName = localname\r
+            if self.document:\r
+                node = self.document.createElementNS(uri, tagName)\r
+            else:\r
+                node = self.buildDocument(uri, tagName)\r
+        else:\r
+            # When the tagname is not prefixed, it just appears as\r
+            # localname\r
+            if self.document:\r
+                node = self.document.createElement(localname)\r
+            else:\r
+                node = self.buildDocument(None, localname)\r
+\r
+        for aname,value in attrs.items():\r
+            a_uri, a_localname = aname\r
+            if a_uri == xmlns_uri:\r
+                if a_localname == 'xmlns':\r
+                    qname = a_localname\r
+                else:\r
+                    qname = 'xmlns:' + a_localname\r
+                attr = self.document.createAttributeNS(a_uri, qname)\r
+                node.setAttributeNodeNS(attr)\r
+            elif a_uri:\r
+                prefix = self._current_context[a_uri]\r
+                if prefix:\r
+                    qname = prefix + ":" + a_localname\r
+                else:\r
+                    qname = a_localname\r
+                attr = self.document.createAttributeNS(a_uri, qname)\r
+                node.setAttributeNodeNS(attr)\r
+            else:\r
+                attr = self.document.createAttribute(a_localname)\r
+                node.setAttributeNode(attr)\r
+            attr.value = value\r
+\r
+        self.lastEvent[1] = [(START_ELEMENT, node), None]\r
+        self.lastEvent = self.lastEvent[1]\r
+        self.push(node)\r
+\r
+    def endElementNS(self, name, tagName):\r
+        self.lastEvent[1] = [(END_ELEMENT, self.pop()), None]\r
+        self.lastEvent = self.lastEvent[1]\r
+\r
+    def startElement(self, name, attrs):\r
+        if self.document:\r
+            node = self.document.createElement(name)\r
+        else:\r
+            node = self.buildDocument(None, name)\r
+\r
+        for aname,value in attrs.items():\r
+            attr = self.document.createAttribute(aname)\r
+            attr.value = value\r
+            node.setAttributeNode(attr)\r
+\r
+        self.lastEvent[1] = [(START_ELEMENT, node), None]\r
+        self.lastEvent = self.lastEvent[1]\r
+        self.push(node)\r
+\r
+    def endElement(self, name):\r
+        self.lastEvent[1] = [(END_ELEMENT, self.pop()), None]\r
+        self.lastEvent = self.lastEvent[1]\r
+\r
+    def comment(self, s):\r
+        if self.document:\r
+            node = self.document.createComment(s)\r
+            self.lastEvent[1] = [(COMMENT, node), None]\r
+            self.lastEvent = self.lastEvent[1]\r
+        else:\r
+            event = [(COMMENT, s), None]\r
+            self.pending_events.append(event)\r
+\r
+    def processingInstruction(self, target, data):\r
+        if self.document:\r
+            node = self.document.createProcessingInstruction(target, data)\r
+            self.lastEvent[1] = [(PROCESSING_INSTRUCTION, node), None]\r
+            self.lastEvent = self.lastEvent[1]\r
+        else:\r
+            event = [(PROCESSING_INSTRUCTION, target, data), None]\r
+            self.pending_events.append(event)\r
+\r
+    def ignorableWhitespace(self, chars):\r
+        node = self.document.createTextNode(chars)\r
+        self.lastEvent[1] = [(IGNORABLE_WHITESPACE, node), None]\r
+        self.lastEvent = self.lastEvent[1]\r
+\r
+    def characters(self, chars):\r
+        node = self.document.createTextNode(chars)\r
+        self.lastEvent[1] = [(CHARACTERS, node), None]\r
+        self.lastEvent = self.lastEvent[1]\r
+\r
+    def startDocument(self):\r
+        if self.documentFactory is None:\r
+            import xml.dom.minidom\r
+            self.documentFactory = xml.dom.minidom.Document.implementation\r
+\r
+    def buildDocument(self, uri, tagname):\r
+        # Can't do that in startDocument, since we need the tagname\r
+        # XXX: obtain DocumentType\r
+        node = self.documentFactory.createDocument(uri, tagname, None)\r
+        self.document = node\r
+        self.lastEvent[1] = [(START_DOCUMENT, node), None]\r
+        self.lastEvent = self.lastEvent[1]\r
+        self.push(node)\r
+        # Put everything we have seen so far into the document\r
+        for e in self.pending_events:\r
+            if e[0][0] == PROCESSING_INSTRUCTION:\r
+                _,target,data = e[0]\r
+                n = self.document.createProcessingInstruction(target, data)\r
+                e[0] = (PROCESSING_INSTRUCTION, n)\r
+            elif e[0][0] == COMMENT:\r
+                n = self.document.createComment(e[0][1])\r
+                e[0] = (COMMENT, n)\r
+            else:\r
+                raise AssertionError("Unknown pending event ",e[0][0])\r
+            self.lastEvent[1] = e\r
+            self.lastEvent = e\r
+        self.pending_events = None\r
+        return node.firstChild\r
+\r
+    def endDocument(self):\r
+        self.lastEvent[1] = [(END_DOCUMENT, self.document), None]\r
+        self.pop()\r
+\r
+    def clear(self):\r
+        "clear(): Explicitly release parsing structures"\r
+        self.document = None\r
+\r
+class ErrorHandler:\r
+    def warning(self, exception):\r
+        print exception\r
+    def error(self, exception):\r
+        raise exception\r
+    def fatalError(self, exception):\r
+        raise exception\r
+\r
+class DOMEventStream:\r
+    def __init__(self, stream, parser, bufsize):\r
+        self.stream = stream\r
+        self.parser = parser\r
+        self.bufsize = bufsize\r
+        if not hasattr(self.parser, 'feed'):\r
+            self.getEvent = self._slurp\r
+        self.reset()\r
+\r
+    def reset(self):\r
+        self.pulldom = PullDOM()\r
+        # This content handler relies on namespace support\r
+        self.parser.setFeature(xml.sax.handler.feature_namespaces, 1)\r
+        self.parser.setContentHandler(self.pulldom)\r
+\r
+    def __getitem__(self, pos):\r
+        rc = self.getEvent()\r
+        if rc:\r
+            return rc\r
+        raise IndexError\r
+\r
+    def next(self):\r
+        rc = self.getEvent()\r
+        if rc:\r
+            return rc\r
+        raise StopIteration\r
+\r
+    def __iter__(self):\r
+        return self\r
+\r
+    def expandNode(self, node):\r
+        event = self.getEvent()\r
+        parents = [node]\r
+        while event:\r
+            token, cur_node = event\r
+            if cur_node is node:\r
+                return\r
+            if token != END_ELEMENT:\r
+                parents[-1].appendChild(cur_node)\r
+            if token == START_ELEMENT:\r
+                parents.append(cur_node)\r
+            elif token == END_ELEMENT:\r
+                del parents[-1]\r
+            event = self.getEvent()\r
+\r
+    def getEvent(self):\r
+        # use IncrementalParser interface, so we get the desired\r
+        # pull effect\r
+        if not self.pulldom.firstEvent[1]:\r
+            self.pulldom.lastEvent = self.pulldom.firstEvent\r
+        while not self.pulldom.firstEvent[1]:\r
+            buf = self.stream.read(self.bufsize)\r
+            if not buf:\r
+                self.parser.close()\r
+                return None\r
+            self.parser.feed(buf)\r
+        rc = self.pulldom.firstEvent[1][0]\r
+        self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1]\r
+        return rc\r
+\r
+    def _slurp(self):\r
+        """ Fallback replacement for getEvent() using the\r
+            standard SAX2 interface, which means we slurp the\r
+            SAX events into memory (no performance gain, but\r
+            we are compatible to all SAX parsers).\r
+        """\r
+        self.parser.parse(self.stream)\r
+        self.getEvent = self._emit\r
+        return self._emit()\r
+\r
+    def _emit(self):\r
+        """ Fallback replacement for getEvent() that emits\r
+            the events that _slurp() read previously.\r
+        """\r
+        rc = self.pulldom.firstEvent[1][0]\r
+        self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1]\r
+        return rc\r
+\r
+    def clear(self):\r
+        """clear(): Explicitly release parsing objects"""\r
+        self.pulldom.clear()\r
+        del self.pulldom\r
+        self.parser = None\r
+        self.stream = None\r
+\r
+class SAX2DOM(PullDOM):\r
+\r
+    def startElementNS(self, name, tagName , attrs):\r
+        PullDOM.startElementNS(self, name, tagName, attrs)\r
+        curNode = self.elementStack[-1]\r
+        parentNode = self.elementStack[-2]\r
+        parentNode.appendChild(curNode)\r
+\r
+    def startElement(self, name, attrs):\r
+        PullDOM.startElement(self, name, attrs)\r
+        curNode = self.elementStack[-1]\r
+        parentNode = self.elementStack[-2]\r
+        parentNode.appendChild(curNode)\r
+\r
+    def processingInstruction(self, target, data):\r
+        PullDOM.processingInstruction(self, target, data)\r
+        node = self.lastEvent[0][1]\r
+        parentNode = self.elementStack[-1]\r
+        parentNode.appendChild(node)\r
+\r
+    def ignorableWhitespace(self, chars):\r
+        PullDOM.ignorableWhitespace(self, chars)\r
+        node = self.lastEvent[0][1]\r
+        parentNode = self.elementStack[-1]\r
+        parentNode.appendChild(node)\r
+\r
+    def characters(self, chars):\r
+        PullDOM.characters(self, chars)\r
+        node = self.lastEvent[0][1]\r
+        parentNode = self.elementStack[-1]\r
+        parentNode.appendChild(node)\r
+\r
+\r
+default_bufsize = (2 ** 14) - 20\r
+\r
+def parse(stream_or_string, parser=None, bufsize=None):\r
+    if bufsize is None:\r
+        bufsize = default_bufsize\r
+    if type(stream_or_string) in _StringTypes:\r
+        stream = open(stream_or_string)\r
+    else:\r
+        stream = stream_or_string\r
+    if not parser:\r
+        parser = xml.sax.make_parser()\r
+    return DOMEventStream(stream, parser, bufsize)\r
+\r
+def parseString(string, parser=None):\r
+    try:\r
+        from cStringIO import StringIO\r
+    except ImportError:\r
+        from StringIO import StringIO\r
+\r
+    bufsize = len(string)\r
+    buf = StringIO(string)\r
+    if not parser:\r
+        parser = xml.sax.make_parser()\r
+    return DOMEventStream(buf, parser, bufsize)\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/xmlbuilder.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/xmlbuilder.py
new file mode 100644 (file)
index 0000000..c386b26
--- /dev/null
@@ -0,0 +1,386 @@
+"""Implementation of the DOM Level 3 'LS-Load' feature."""\r
+\r
+import copy\r
+import xml.dom\r
+\r
+from xml.dom.NodeFilter import NodeFilter\r
+\r
+\r
+__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"]\r
+\r
+\r
+class Options:\r
+    """Features object that has variables set for each DOMBuilder feature.\r
+\r
+    The DOMBuilder class uses an instance of this class to pass settings to\r
+    the ExpatBuilder class.\r
+    """\r
+\r
+    # Note that the DOMBuilder class in LoadSave constrains which of these\r
+    # values can be set using the DOM Level 3 LoadSave feature.\r
+\r
+    namespaces = 1\r
+    namespace_declarations = True\r
+    validation = False\r
+    external_parameter_entities = True\r
+    external_general_entities = True\r
+    external_dtd_subset = True\r
+    validate_if_schema = False\r
+    validate = False\r
+    datatype_normalization = False\r
+    create_entity_ref_nodes = True\r
+    entities = True\r
+    whitespace_in_element_content = True\r
+    cdata_sections = True\r
+    comments = True\r
+    charset_overrides_xml_encoding = True\r
+    infoset = False\r
+    supported_mediatypes_only = False\r
+\r
+    errorHandler = None\r
+    filter = None\r
+\r
+\r
+class DOMBuilder:\r
+    entityResolver = None\r
+    errorHandler = None\r
+    filter = None\r
+\r
+    ACTION_REPLACE = 1\r
+    ACTION_APPEND_AS_CHILDREN = 2\r
+    ACTION_INSERT_AFTER = 3\r
+    ACTION_INSERT_BEFORE = 4\r
+\r
+    _legal_actions = (ACTION_REPLACE, ACTION_APPEND_AS_CHILDREN,\r
+                      ACTION_INSERT_AFTER, ACTION_INSERT_BEFORE)\r
+\r
+    def __init__(self):\r
+        self._options = Options()\r
+\r
+    def _get_entityResolver(self):\r
+        return self.entityResolver\r
+    def _set_entityResolver(self, entityResolver):\r
+        self.entityResolver = entityResolver\r
+\r
+    def _get_errorHandler(self):\r
+        return self.errorHandler\r
+    def _set_errorHandler(self, errorHandler):\r
+        self.errorHandler = errorHandler\r
+\r
+    def _get_filter(self):\r
+        return self.filter\r
+    def _set_filter(self, filter):\r
+        self.filter = filter\r
+\r
+    def setFeature(self, name, state):\r
+        if self.supportsFeature(name):\r
+            state = state and 1 or 0\r
+            try:\r
+                settings = self._settings[(_name_xform(name), state)]\r
+            except KeyError:\r
+                raise xml.dom.NotSupportedErr(\r
+                    "unsupported feature: %r" % (name,))\r
+            else:\r
+                for name, value in settings:\r
+                    setattr(self._options, name, value)\r
+        else:\r
+            raise xml.dom.NotFoundErr("unknown feature: " + repr(name))\r
+\r
+    def supportsFeature(self, name):\r
+        return hasattr(self._options, _name_xform(name))\r
+\r
+    def canSetFeature(self, name, state):\r
+        key = (_name_xform(name), state and 1 or 0)\r
+        return key in self._settings\r
+\r
+    # This dictionary maps from (feature,value) to a list of\r
+    # (option,value) pairs that should be set on the Options object.\r
+    # If a (feature,value) setting is not in this dictionary, it is\r
+    # not supported by the DOMBuilder.\r
+    #\r
+    _settings = {\r
+        ("namespace_declarations", 0): [\r
+            ("namespace_declarations", 0)],\r
+        ("namespace_declarations", 1): [\r
+            ("namespace_declarations", 1)],\r
+        ("validation", 0): [\r
+            ("validation", 0)],\r
+        ("external_general_entities", 0): [\r
+            ("external_general_entities", 0)],\r
+        ("external_general_entities", 1): [\r
+            ("external_general_entities", 1)],\r
+        ("external_parameter_entities", 0): [\r
+            ("external_parameter_entities", 0)],\r
+        ("external_parameter_entities", 1): [\r
+            ("external_parameter_entities", 1)],\r
+        ("validate_if_schema", 0): [\r
+            ("validate_if_schema", 0)],\r
+        ("create_entity_ref_nodes", 0): [\r
+            ("create_entity_ref_nodes", 0)],\r
+        ("create_entity_ref_nodes", 1): [\r
+            ("create_entity_ref_nodes", 1)],\r
+        ("entities", 0): [\r
+            ("create_entity_ref_nodes", 0),\r
+            ("entities", 0)],\r
+        ("entities", 1): [\r
+            ("entities", 1)],\r
+        ("whitespace_in_element_content", 0): [\r
+            ("whitespace_in_element_content", 0)],\r
+        ("whitespace_in_element_content", 1): [\r
+            ("whitespace_in_element_content", 1)],\r
+        ("cdata_sections", 0): [\r
+            ("cdata_sections", 0)],\r
+        ("cdata_sections", 1): [\r
+            ("cdata_sections", 1)],\r
+        ("comments", 0): [\r
+            ("comments", 0)],\r
+        ("comments", 1): [\r
+            ("comments", 1)],\r
+        ("charset_overrides_xml_encoding", 0): [\r
+            ("charset_overrides_xml_encoding", 0)],\r
+        ("charset_overrides_xml_encoding", 1): [\r
+            ("charset_overrides_xml_encoding", 1)],\r
+        ("infoset", 0): [],\r
+        ("infoset", 1): [\r
+            ("namespace_declarations", 0),\r
+            ("validate_if_schema", 0),\r
+            ("create_entity_ref_nodes", 0),\r
+            ("entities", 0),\r
+            ("cdata_sections", 0),\r
+            ("datatype_normalization", 1),\r
+            ("whitespace_in_element_content", 1),\r
+            ("comments", 1),\r
+            ("charset_overrides_xml_encoding", 1)],\r
+        ("supported_mediatypes_only", 0): [\r
+            ("supported_mediatypes_only", 0)],\r
+        ("namespaces", 0): [\r
+            ("namespaces", 0)],\r
+        ("namespaces", 1): [\r
+            ("namespaces", 1)],\r
+    }\r
+\r
+    def getFeature(self, name):\r
+        xname = _name_xform(name)\r
+        try:\r
+            return getattr(self._options, xname)\r
+        except AttributeError:\r
+            if name == "infoset":\r
+                options = self._options\r
+                return (options.datatype_normalization\r
+                        and options.whitespace_in_element_content\r
+                        and options.comments\r
+                        and options.charset_overrides_xml_encoding\r
+                        and not (options.namespace_declarations\r
+                                 or options.validate_if_schema\r
+                                 or options.create_entity_ref_nodes\r
+                                 or options.entities\r
+                                 or options.cdata_sections))\r
+            raise xml.dom.NotFoundErr("feature %s not known" % repr(name))\r
+\r
+    def parseURI(self, uri):\r
+        if self.entityResolver:\r
+            input = self.entityResolver.resolveEntity(None, uri)\r
+        else:\r
+            input = DOMEntityResolver().resolveEntity(None, uri)\r
+        return self.parse(input)\r
+\r
+    def parse(self, input):\r
+        options = copy.copy(self._options)\r
+        options.filter = self.filter\r
+        options.errorHandler = self.errorHandler\r
+        fp = input.byteStream\r
+        if fp is None and options.systemId:\r
+            import urllib2\r
+            fp = urllib2.urlopen(input.systemId)\r
+        return self._parse_bytestream(fp, options)\r
+\r
+    def parseWithContext(self, input, cnode, action):\r
+        if action not in self._legal_actions:\r
+            raise ValueError("not a legal action")\r
+        raise NotImplementedError("Haven't written this yet...")\r
+\r
+    def _parse_bytestream(self, stream, options):\r
+        import xml.dom.expatbuilder\r
+        builder = xml.dom.expatbuilder.makeBuilder(options)\r
+        return builder.parseFile(stream)\r
+\r
+\r
+def _name_xform(name):\r
+    return name.lower().replace('-', '_')\r
+\r
+\r
+class DOMEntityResolver(object):\r
+    __slots__ = '_opener',\r
+\r
+    def resolveEntity(self, publicId, systemId):\r
+        assert systemId is not None\r
+        source = DOMInputSource()\r
+        source.publicId = publicId\r
+        source.systemId = systemId\r
+        source.byteStream = self._get_opener().open(systemId)\r
+\r
+        # determine the encoding if the transport provided it\r
+        source.encoding = self._guess_media_encoding(source)\r
+\r
+        # determine the base URI is we can\r
+        import posixpath, urlparse\r
+        parts = urlparse.urlparse(systemId)\r
+        scheme, netloc, path, params, query, fragment = parts\r
+        # XXX should we check the scheme here as well?\r
+        if path and not path.endswith("/"):\r
+            path = posixpath.dirname(path) + "/"\r
+            parts = scheme, netloc, path, params, query, fragment\r
+            source.baseURI = urlparse.urlunparse(parts)\r
+\r
+        return source\r
+\r
+    def _get_opener(self):\r
+        try:\r
+            return self._opener\r
+        except AttributeError:\r
+            self._opener = self._create_opener()\r
+            return self._opener\r
+\r
+    def _create_opener(self):\r
+        import urllib2\r
+        return urllib2.build_opener()\r
+\r
+    def _guess_media_encoding(self, source):\r
+        info = source.byteStream.info()\r
+        if "Content-Type" in info:\r
+            for param in info.getplist():\r
+                if param.startswith("charset="):\r
+                    return param.split("=", 1)[1].lower()\r
+\r
+\r
+class DOMInputSource(object):\r
+    __slots__ = ('byteStream', 'characterStream', 'stringData',\r
+                 'encoding', 'publicId', 'systemId', 'baseURI')\r
+\r
+    def __init__(self):\r
+        self.byteStream = None\r
+        self.characterStream = None\r
+        self.stringData = None\r
+        self.encoding = None\r
+        self.publicId = None\r
+        self.systemId = None\r
+        self.baseURI = None\r
+\r
+    def _get_byteStream(self):\r
+        return self.byteStream\r
+    def _set_byteStream(self, byteStream):\r
+        self.byteStream = byteStream\r
+\r
+    def _get_characterStream(self):\r
+        return self.characterStream\r
+    def _set_characterStream(self, characterStream):\r
+        self.characterStream = characterStream\r
+\r
+    def _get_stringData(self):\r
+        return self.stringData\r
+    def _set_stringData(self, data):\r
+        self.stringData = data\r
+\r
+    def _get_encoding(self):\r
+        return self.encoding\r
+    def _set_encoding(self, encoding):\r
+        self.encoding = encoding\r
+\r
+    def _get_publicId(self):\r
+        return self.publicId\r
+    def _set_publicId(self, publicId):\r
+        self.publicId = publicId\r
+\r
+    def _get_systemId(self):\r
+        return self.systemId\r
+    def _set_systemId(self, systemId):\r
+        self.systemId = systemId\r
+\r
+    def _get_baseURI(self):\r
+        return self.baseURI\r
+    def _set_baseURI(self, uri):\r
+        self.baseURI = uri\r
+\r
+\r
+class DOMBuilderFilter:\r
+    """Element filter which can be used to tailor construction of\r
+    a DOM instance.\r
+    """\r
+\r
+    # There's really no need for this class; concrete implementations\r
+    # should just implement the endElement() and startElement()\r
+    # methods as appropriate.  Using this makes it easy to only\r
+    # implement one of them.\r
+\r
+    FILTER_ACCEPT = 1\r
+    FILTER_REJECT = 2\r
+    FILTER_SKIP = 3\r
+    FILTER_INTERRUPT = 4\r
+\r
+    whatToShow = NodeFilter.SHOW_ALL\r
+\r
+    def _get_whatToShow(self):\r
+        return self.whatToShow\r
+\r
+    def acceptNode(self, element):\r
+        return self.FILTER_ACCEPT\r
+\r
+    def startContainer(self, element):\r
+        return self.FILTER_ACCEPT\r
+\r
+del NodeFilter\r
+\r
+\r
+class DocumentLS:\r
+    """Mixin to create documents that conform to the load/save spec."""\r
+\r
+    async = False\r
+\r
+    def _get_async(self):\r
+        return False\r
+    def _set_async(self, async):\r
+        if async:\r
+            raise xml.dom.NotSupportedErr(\r
+                "asynchronous document loading is not supported")\r
+\r
+    def abort(self):\r
+        # What does it mean to "clear" a document?  Does the\r
+        # documentElement disappear?\r
+        raise NotImplementedError(\r
+            "haven't figured out what this means yet")\r
+\r
+    def load(self, uri):\r
+        raise NotImplementedError("haven't written this yet")\r
+\r
+    def loadXML(self, source):\r
+        raise NotImplementedError("haven't written this yet")\r
+\r
+    def saveXML(self, snode):\r
+        if snode is None:\r
+            snode = self\r
+        elif snode.ownerDocument is not self:\r
+            raise xml.dom.WrongDocumentErr()\r
+        return snode.toxml()\r
+\r
+\r
+class DOMImplementationLS:\r
+    MODE_SYNCHRONOUS = 1\r
+    MODE_ASYNCHRONOUS = 2\r
+\r
+    def createDOMBuilder(self, mode, schemaType):\r
+        if schemaType is not None:\r
+            raise xml.dom.NotSupportedErr(\r
+                "schemaType not yet supported")\r
+        if mode == self.MODE_SYNCHRONOUS:\r
+            return DOMBuilder()\r
+        if mode == self.MODE_ASYNCHRONOUS:\r
+            raise xml.dom.NotSupportedErr(\r
+                "asynchronous builders are not supported")\r
+        raise ValueError("unknown value for mode")\r
+\r
+    def createDOMWriter(self):\r
+        raise NotImplementedError(\r
+            "the writer interface hasn't been written yet!")\r
+\r
+    def createDOMInputSource(self):\r
+        return DOMInputSource()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementInclude.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementInclude.py
new file mode 100644 (file)
index 0000000..2bfac34
--- /dev/null
@@ -0,0 +1,142 @@
+#\r
+# ElementTree\r
+# $Id: ElementInclude.py 3375 2008-02-13 08:05:08Z fredrik $\r
+#\r
+# limited xinclude support for element trees\r
+#\r
+# history:\r
+# 2003-08-15 fl   created\r
+# 2003-11-14 fl   fixed default loader\r
+#\r
+# Copyright (c) 2003-2004 by Fredrik Lundh.  All rights reserved.\r
+#\r
+# fredrik@pythonware.com\r
+# http://www.pythonware.com\r
+#\r
+# --------------------------------------------------------------------\r
+# The ElementTree toolkit is\r
+#\r
+# Copyright (c) 1999-2008 by Fredrik Lundh\r
+#\r
+# By obtaining, using, and/or copying this software and/or its\r
+# associated documentation, you agree that you have read, understood,\r
+# and will comply with the following terms and conditions:\r
+#\r
+# Permission to use, copy, modify, and distribute this software and\r
+# its associated documentation for any purpose and without fee is\r
+# hereby granted, provided that the above copyright notice appears in\r
+# all copies, and that both that copyright notice and this permission\r
+# notice appear in supporting documentation, and that the name of\r
+# Secret Labs AB or the author not be used in advertising or publicity\r
+# pertaining to distribution of the software without specific, written\r
+# prior permission.\r
+#\r
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD\r
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-\r
+# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR\r
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY\r
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\r
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\r
+# OF THIS SOFTWARE.\r
+# --------------------------------------------------------------------\r
+\r
+# Licensed to PSF under a Contributor Agreement.\r
+# See http://www.python.org/psf/license for licensing details.\r
+\r
+##\r
+# Limited XInclude support for the ElementTree package.\r
+##\r
+\r
+import copy\r
+from . import ElementTree\r
+\r
+XINCLUDE = "{http://www.w3.org/2001/XInclude}"\r
+\r
+XINCLUDE_INCLUDE = XINCLUDE + "include"\r
+XINCLUDE_FALLBACK = XINCLUDE + "fallback"\r
+\r
+##\r
+# Fatal include error.\r
+\r
+class FatalIncludeError(SyntaxError):\r
+    pass\r
+\r
+##\r
+# Default loader.  This loader reads an included resource from disk.\r
+#\r
+# @param href Resource reference.\r
+# @param parse Parse mode.  Either "xml" or "text".\r
+# @param encoding Optional text encoding.\r
+# @return The expanded resource.  If the parse mode is "xml", this\r
+#    is an ElementTree instance.  If the parse mode is "text", this\r
+#    is a Unicode string.  If the loader fails, it can return None\r
+#    or raise an IOError exception.\r
+# @throws IOError If the loader fails to load the resource.\r
+\r
+def default_loader(href, parse, encoding=None):\r
+    with open(href) as file:\r
+        if parse == "xml":\r
+            data = ElementTree.parse(file).getroot()\r
+        else:\r
+            data = file.read()\r
+            if encoding:\r
+                data = data.decode(encoding)\r
+    return data\r
+\r
+##\r
+# Expand XInclude directives.\r
+#\r
+# @param elem Root element.\r
+# @param loader Optional resource loader.  If omitted, it defaults\r
+#     to {@link default_loader}.  If given, it should be a callable\r
+#     that implements the same interface as <b>default_loader</b>.\r
+# @throws FatalIncludeError If the function fails to include a given\r
+#     resource, or if the tree contains malformed XInclude elements.\r
+# @throws IOError If the function fails to load a given resource.\r
+\r
+def include(elem, loader=None):\r
+    if loader is None:\r
+        loader = default_loader\r
+    # look for xinclude elements\r
+    i = 0\r
+    while i < len(elem):\r
+        e = elem[i]\r
+        if e.tag == XINCLUDE_INCLUDE:\r
+            # process xinclude directive\r
+            href = e.get("href")\r
+            parse = e.get("parse", "xml")\r
+            if parse == "xml":\r
+                node = loader(href, parse)\r
+                if node is None:\r
+                    raise FatalIncludeError(\r
+                        "cannot load %r as %r" % (href, parse)\r
+                        )\r
+                node = copy.copy(node)\r
+                if e.tail:\r
+                    node.tail = (node.tail or "") + e.tail\r
+                elem[i] = node\r
+            elif parse == "text":\r
+                text = loader(href, parse, e.get("encoding"))\r
+                if text is None:\r
+                    raise FatalIncludeError(\r
+                        "cannot load %r as %r" % (href, parse)\r
+                        )\r
+                if i:\r
+                    node = elem[i-1]\r
+                    node.tail = (node.tail or "") + text + (e.tail or "")\r
+                else:\r
+                    elem.text = (elem.text or "") + text + (e.tail or "")\r
+                del elem[i]\r
+                continue\r
+            else:\r
+                raise FatalIncludeError(\r
+                    "unknown parse type in xi:include tag (%r)" % parse\r
+                )\r
+        elif e.tag == XINCLUDE_FALLBACK:\r
+            raise FatalIncludeError(\r
+                "xi:fallback tag must be child of xi:include (%r)" % e.tag\r
+                )\r
+        else:\r
+            include(e, loader)\r
+        i = i + 1\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementPath.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementPath.py
new file mode 100644 (file)
index 0000000..5c117c3
--- /dev/null
@@ -0,0 +1,303 @@
+#\r
+# ElementTree\r
+# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $\r
+#\r
+# limited xpath support for element trees\r
+#\r
+# history:\r
+# 2003-05-23 fl   created\r
+# 2003-05-28 fl   added support for // etc\r
+# 2003-08-27 fl   fixed parsing of periods in element names\r
+# 2007-09-10 fl   new selection engine\r
+# 2007-09-12 fl   fixed parent selector\r
+# 2007-09-13 fl   added iterfind; changed findall to return a list\r
+# 2007-11-30 fl   added namespaces support\r
+# 2009-10-30 fl   added child element value filter\r
+#\r
+# Copyright (c) 2003-2009 by Fredrik Lundh.  All rights reserved.\r
+#\r
+# fredrik@pythonware.com\r
+# http://www.pythonware.com\r
+#\r
+# --------------------------------------------------------------------\r
+# The ElementTree toolkit is\r
+#\r
+# Copyright (c) 1999-2009 by Fredrik Lundh\r
+#\r
+# By obtaining, using, and/or copying this software and/or its\r
+# associated documentation, you agree that you have read, understood,\r
+# and will comply with the following terms and conditions:\r
+#\r
+# Permission to use, copy, modify, and distribute this software and\r
+# its associated documentation for any purpose and without fee is\r
+# hereby granted, provided that the above copyright notice appears in\r
+# all copies, and that both that copyright notice and this permission\r
+# notice appear in supporting documentation, and that the name of\r
+# Secret Labs AB or the author not be used in advertising or publicity\r
+# pertaining to distribution of the software without specific, written\r
+# prior permission.\r
+#\r
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD\r
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-\r
+# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR\r
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY\r
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\r
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\r
+# OF THIS SOFTWARE.\r
+# --------------------------------------------------------------------\r
+\r
+# Licensed to PSF under a Contributor Agreement.\r
+# See http://www.python.org/psf/license for licensing details.\r
+\r
+##\r
+# Implementation module for XPath support.  There's usually no reason\r
+# to import this module directly; the <b>ElementTree</b> does this for\r
+# you, if needed.\r
+##\r
+\r
+import re\r
+\r
+xpath_tokenizer_re = re.compile(\r
+    "("\r
+    "'[^']*'|\"[^\"]*\"|"\r
+    "::|"\r
+    "//?|"\r
+    "\.\.|"\r
+    "\(\)|"\r
+    "[/.*:\[\]\(\)@=])|"\r
+    "((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|"\r
+    "\s+"\r
+    )\r
+\r
+def xpath_tokenizer(pattern, namespaces=None):\r
+    for token in xpath_tokenizer_re.findall(pattern):\r
+        tag = token[1]\r
+        if tag and tag[0] != "{" and ":" in tag:\r
+            try:\r
+                prefix, uri = tag.split(":", 1)\r
+                if not namespaces:\r
+                    raise KeyError\r
+                yield token[0], "{%s}%s" % (namespaces[prefix], uri)\r
+            except KeyError:\r
+                raise SyntaxError("prefix %r not found in prefix map" % prefix)\r
+        else:\r
+            yield token\r
+\r
+def get_parent_map(context):\r
+    parent_map = context.parent_map\r
+    if parent_map is None:\r
+        context.parent_map = parent_map = {}\r
+        for p in context.root.iter():\r
+            for e in p:\r
+                parent_map[e] = p\r
+    return parent_map\r
+\r
+def prepare_child(next, token):\r
+    tag = token[1]\r
+    def select(context, result):\r
+        for elem in result:\r
+            for e in elem:\r
+                if e.tag == tag:\r
+                    yield e\r
+    return select\r
+\r
+def prepare_star(next, token):\r
+    def select(context, result):\r
+        for elem in result:\r
+            for e in elem:\r
+                yield e\r
+    return select\r
+\r
+def prepare_self(next, token):\r
+    def select(context, result):\r
+        for elem in result:\r
+            yield elem\r
+    return select\r
+\r
+def prepare_descendant(next, token):\r
+    token = next()\r
+    if token[0] == "*":\r
+        tag = "*"\r
+    elif not token[0]:\r
+        tag = token[1]\r
+    else:\r
+        raise SyntaxError("invalid descendant")\r
+    def select(context, result):\r
+        for elem in result:\r
+            for e in elem.iter(tag):\r
+                if e is not elem:\r
+                    yield e\r
+    return select\r
+\r
+def prepare_parent(next, token):\r
+    def select(context, result):\r
+        # FIXME: raise error if .. is applied at toplevel?\r
+        parent_map = get_parent_map(context)\r
+        result_map = {}\r
+        for elem in result:\r
+            if elem in parent_map:\r
+                parent = parent_map[elem]\r
+                if parent not in result_map:\r
+                    result_map[parent] = None\r
+                    yield parent\r
+    return select\r
+\r
+def prepare_predicate(next, token):\r
+    # FIXME: replace with real parser!!! refs:\r
+    # http://effbot.org/zone/simple-iterator-parser.htm\r
+    # http://javascript.crockford.com/tdop/tdop.html\r
+    signature = []\r
+    predicate = []\r
+    while 1:\r
+        token = next()\r
+        if token[0] == "]":\r
+            break\r
+        if token[0] and token[0][:1] in "'\"":\r
+            token = "'", token[0][1:-1]\r
+        signature.append(token[0] or "-")\r
+        predicate.append(token[1])\r
+    signature = "".join(signature)\r
+    # use signature to determine predicate type\r
+    if signature == "@-":\r
+        # [@attribute] predicate\r
+        key = predicate[1]\r
+        def select(context, result):\r
+            for elem in result:\r
+                if elem.get(key) is not None:\r
+                    yield elem\r
+        return select\r
+    if signature == "@-='":\r
+        # [@attribute='value']\r
+        key = predicate[1]\r
+        value = predicate[-1]\r
+        def select(context, result):\r
+            for elem in result:\r
+                if elem.get(key) == value:\r
+                    yield elem\r
+        return select\r
+    if signature == "-" and not re.match("\d+$", predicate[0]):\r
+        # [tag]\r
+        tag = predicate[0]\r
+        def select(context, result):\r
+            for elem in result:\r
+                if elem.find(tag) is not None:\r
+                    yield elem\r
+        return select\r
+    if signature == "-='" and not re.match("\d+$", predicate[0]):\r
+        # [tag='value']\r
+        tag = predicate[0]\r
+        value = predicate[-1]\r
+        def select(context, result):\r
+            for elem in result:\r
+                for e in elem.findall(tag):\r
+                    if "".join(e.itertext()) == value:\r
+                        yield elem\r
+                        break\r
+        return select\r
+    if signature == "-" or signature == "-()" or signature == "-()-":\r
+        # [index] or [last()] or [last()-index]\r
+        if signature == "-":\r
+            index = int(predicate[0]) - 1\r
+        else:\r
+            if predicate[0] != "last":\r
+                raise SyntaxError("unsupported function")\r
+            if signature == "-()-":\r
+                try:\r
+                    index = int(predicate[2]) - 1\r
+                except ValueError:\r
+                    raise SyntaxError("unsupported expression")\r
+            else:\r
+                index = -1\r
+        def select(context, result):\r
+            parent_map = get_parent_map(context)\r
+            for elem in result:\r
+                try:\r
+                    parent = parent_map[elem]\r
+                    # FIXME: what if the selector is "*" ?\r
+                    elems = list(parent.findall(elem.tag))\r
+                    if elems[index] is elem:\r
+                        yield elem\r
+                except (IndexError, KeyError):\r
+                    pass\r
+        return select\r
+    raise SyntaxError("invalid predicate")\r
+\r
+ops = {\r
+    "": prepare_child,\r
+    "*": prepare_star,\r
+    ".": prepare_self,\r
+    "..": prepare_parent,\r
+    "//": prepare_descendant,\r
+    "[": prepare_predicate,\r
+    }\r
+\r
+_cache = {}\r
+\r
+class _SelectorContext:\r
+    parent_map = None\r
+    def __init__(self, root):\r
+        self.root = root\r
+\r
+# --------------------------------------------------------------------\r
+\r
+##\r
+# Generate all matching objects.\r
+\r
+def iterfind(elem, path, namespaces=None):\r
+    # compile selector pattern\r
+    if path[-1:] == "/":\r
+        path = path + "*" # implicit all (FIXME: keep this?)\r
+    try:\r
+        selector = _cache[path]\r
+    except KeyError:\r
+        if len(_cache) > 100:\r
+            _cache.clear()\r
+        if path[:1] == "/":\r
+            raise SyntaxError("cannot use absolute path on element")\r
+        next = iter(xpath_tokenizer(path, namespaces)).next\r
+        token = next()\r
+        selector = []\r
+        while 1:\r
+            try:\r
+                selector.append(ops[token[0]](next, token))\r
+            except StopIteration:\r
+                raise SyntaxError("invalid path")\r
+            try:\r
+                token = next()\r
+                if token[0] == "/":\r
+                    token = next()\r
+            except StopIteration:\r
+                break\r
+        _cache[path] = selector\r
+    # execute selector pattern\r
+    result = [elem]\r
+    context = _SelectorContext(elem)\r
+    for select in selector:\r
+        result = select(context, result)\r
+    return result\r
+\r
+##\r
+# Find first matching object.\r
+\r
+def find(elem, path, namespaces=None):\r
+    try:\r
+        return iterfind(elem, path, namespaces).next()\r
+    except StopIteration:\r
+        return None\r
+\r
+##\r
+# Find all matching objects.\r
+\r
+def findall(elem, path, namespaces=None):\r
+    return list(iterfind(elem, path, namespaces))\r
+\r
+##\r
+# Find text for first matching object.\r
+\r
+def findtext(elem, path, default=None, namespaces=None):\r
+    try:\r
+        elem = iterfind(elem, path, namespaces).next()\r
+        return elem.text or ""\r
+    except StopIteration:\r
+        return default\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementTree.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementTree.py
new file mode 100644 (file)
index 0000000..7ae11bc
--- /dev/null
@@ -0,0 +1,1667 @@
+#\r
+# ElementTree\r
+# $Id: ElementTree.py 3440 2008-07-18 14:45:01Z fredrik $\r
+#\r
+# light-weight XML support for Python 2.3 and later.\r
+#\r
+# history (since 1.2.6):\r
+# 2005-11-12 fl   added tostringlist/fromstringlist helpers\r
+# 2006-07-05 fl   merged in selected changes from the 1.3 sandbox\r
+# 2006-07-05 fl   removed support for 2.1 and earlier\r
+# 2007-06-21 fl   added deprecation/future warnings\r
+# 2007-08-25 fl   added doctype hook, added parser version attribute etc\r
+# 2007-08-26 fl   added new serializer code (better namespace handling, etc)\r
+# 2007-08-27 fl   warn for broken /tag searches on tree level\r
+# 2007-09-02 fl   added html/text methods to serializer (experimental)\r
+# 2007-09-05 fl   added method argument to tostring/tostringlist\r
+# 2007-09-06 fl   improved error handling\r
+# 2007-09-13 fl   added itertext, iterfind; assorted cleanups\r
+# 2007-12-15 fl   added C14N hooks, copy method (experimental)\r
+#\r
+# Copyright (c) 1999-2008 by Fredrik Lundh.  All rights reserved.\r
+#\r
+# fredrik@pythonware.com\r
+# http://www.pythonware.com\r
+#\r
+# --------------------------------------------------------------------\r
+# The ElementTree toolkit is\r
+#\r
+# Copyright (c) 1999-2008 by Fredrik Lundh\r
+#\r
+# By obtaining, using, and/or copying this software and/or its\r
+# associated documentation, you agree that you have read, understood,\r
+# and will comply with the following terms and conditions:\r
+#\r
+# Permission to use, copy, modify, and distribute this software and\r
+# its associated documentation for any purpose and without fee is\r
+# hereby granted, provided that the above copyright notice appears in\r
+# all copies, and that both that copyright notice and this permission\r
+# notice appear in supporting documentation, and that the name of\r
+# Secret Labs AB or the author not be used in advertising or publicity\r
+# pertaining to distribution of the software without specific, written\r
+# prior permission.\r
+#\r
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD\r
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-\r
+# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR\r
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY\r
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\r
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\r
+# OF THIS SOFTWARE.\r
+# --------------------------------------------------------------------\r
+\r
+# Licensed to PSF under a Contributor Agreement.\r
+# See http://www.python.org/psf/license for licensing details.\r
+\r
+__all__ = [\r
+    # public symbols\r
+    "Comment",\r
+    "dump",\r
+    "Element", "ElementTree",\r
+    "fromstring", "fromstringlist",\r
+    "iselement", "iterparse",\r
+    "parse", "ParseError",\r
+    "PI", "ProcessingInstruction",\r
+    "QName",\r
+    "SubElement",\r
+    "tostring", "tostringlist",\r
+    "TreeBuilder",\r
+    "VERSION",\r
+    "XML",\r
+    "XMLParser", "XMLTreeBuilder",\r
+    ]\r
+\r
+VERSION = "1.3.0"\r
+\r
+##\r
+# The <b>Element</b> type is a flexible container object, designed to\r
+# store hierarchical data structures in memory. The type can be\r
+# described as a cross between a list and a dictionary.\r
+# <p>\r
+# Each element has a number of properties associated with it:\r
+# <ul>\r
+# <li>a <i>tag</i>. This is a string identifying what kind of data\r
+# this element represents (the element type, in other words).</li>\r
+# <li>a number of <i>attributes</i>, stored in a Python dictionary.</li>\r
+# <li>a <i>text</i> string.</li>\r
+# <li>an optional <i>tail</i> string.</li>\r
+# <li>a number of <i>child elements</i>, stored in a Python sequence</li>\r
+# </ul>\r
+#\r
+# To create an element instance, use the {@link #Element} constructor\r
+# or the {@link #SubElement} factory function.\r
+# <p>\r
+# The {@link #ElementTree} class can be used to wrap an element\r
+# structure, and convert it from and to XML.\r
+##\r
+\r
+import sys\r
+import re\r
+import warnings\r
+\r
+\r
+class _SimpleElementPath(object):\r
+    # emulate pre-1.2 find/findtext/findall behaviour\r
+    def find(self, element, tag, namespaces=None):\r
+        for elem in element:\r
+            if elem.tag == tag:\r
+                return elem\r
+        return None\r
+    def findtext(self, element, tag, default=None, namespaces=None):\r
+        elem = self.find(element, tag)\r
+        if elem is None:\r
+            return default\r
+        return elem.text or ""\r
+    def iterfind(self, element, tag, namespaces=None):\r
+        if tag[:3] == ".//":\r
+            for elem in element.iter(tag[3:]):\r
+                yield elem\r
+        for elem in element:\r
+            if elem.tag == tag:\r
+                yield elem\r
+    def findall(self, element, tag, namespaces=None):\r
+        return list(self.iterfind(element, tag, namespaces))\r
+\r
+try:\r
+    from . import ElementPath\r
+except ImportError:\r
+    ElementPath = _SimpleElementPath()\r
+\r
+##\r
+# Parser error.  This is a subclass of <b>SyntaxError</b>.\r
+# <p>\r
+# In addition to the exception value, an exception instance contains a\r
+# specific exception code in the <b>code</b> attribute, and the line and\r
+# column of the error in the <b>position</b> attribute.\r
+\r
+class ParseError(SyntaxError):\r
+    pass\r
+\r
+# --------------------------------------------------------------------\r
+\r
+##\r
+# Checks if an object appears to be a valid element object.\r
+#\r
+# @param An element instance.\r
+# @return A true value if this is an element object.\r
+# @defreturn flag\r
+\r
+def iselement(element):\r
+    # FIXME: not sure about this; might be a better idea to look\r
+    # for tag/attrib/text attributes\r
+    return isinstance(element, Element) or hasattr(element, "tag")\r
+\r
+##\r
+# Element class.  This class defines the Element interface, and\r
+# provides a reference implementation of this interface.\r
+# <p>\r
+# The element name, attribute names, and attribute values can be\r
+# either ASCII strings (ordinary Python strings containing only 7-bit\r
+# ASCII characters) or Unicode strings.\r
+#\r
+# @param tag The element name.\r
+# @param attrib An optional dictionary, containing element attributes.\r
+# @param **extra Additional attributes, given as keyword arguments.\r
+# @see Element\r
+# @see SubElement\r
+# @see Comment\r
+# @see ProcessingInstruction\r
+\r
+class Element(object):\r
+    # <tag attrib>text<child/>...</tag>tail\r
+\r
+    ##\r
+    # (Attribute) Element tag.\r
+\r
+    tag = None\r
+\r
+    ##\r
+    # (Attribute) Element attribute dictionary.  Where possible, use\r
+    # {@link #Element.get},\r
+    # {@link #Element.set},\r
+    # {@link #Element.keys}, and\r
+    # {@link #Element.items} to access\r
+    # element attributes.\r
+\r
+    attrib = None\r
+\r
+    ##\r
+    # (Attribute) Text before first subelement.  This is either a\r
+    # string or the value None.  Note that if there was no text, this\r
+    # attribute may be either None or an empty string, depending on\r
+    # the parser.\r
+\r
+    text = None\r
+\r
+    ##\r
+    # (Attribute) Text after this element's end tag, but before the\r
+    # next sibling element's start tag.  This is either a string or\r
+    # the value None.  Note that if there was no text, this attribute\r
+    # may be either None or an empty string, depending on the parser.\r
+\r
+    tail = None # text after end tag, if any\r
+\r
+    # constructor\r
+\r
+    def __init__(self, tag, attrib={}, **extra):\r
+        attrib = attrib.copy()\r
+        attrib.update(extra)\r
+        self.tag = tag\r
+        self.attrib = attrib\r
+        self._children = []\r
+\r
+    def __repr__(self):\r
+        return "<Element %s at 0x%x>" % (repr(self.tag), id(self))\r
+\r
+    ##\r
+    # Creates a new element object of the same type as this element.\r
+    #\r
+    # @param tag Element tag.\r
+    # @param attrib Element attributes, given as a dictionary.\r
+    # @return A new element instance.\r
+\r
+    def makeelement(self, tag, attrib):\r
+        return self.__class__(tag, attrib)\r
+\r
+    ##\r
+    # (Experimental) Copies the current element.  This creates a\r
+    # shallow copy; subelements will be shared with the original tree.\r
+    #\r
+    # @return A new element instance.\r
+\r
+    def copy(self):\r
+        elem = self.makeelement(self.tag, self.attrib)\r
+        elem.text = self.text\r
+        elem.tail = self.tail\r
+        elem[:] = self\r
+        return elem\r
+\r
+    ##\r
+    # Returns the number of subelements.  Note that this only counts\r
+    # full elements; to check if there's any content in an element, you\r
+    # have to check both the length and the <b>text</b> attribute.\r
+    #\r
+    # @return The number of subelements.\r
+\r
+    def __len__(self):\r
+        return len(self._children)\r
+\r
+    def __nonzero__(self):\r
+        warnings.warn(\r
+            "The behavior of this method will change in future versions.  "\r
+            "Use specific 'len(elem)' or 'elem is not None' test instead.",\r
+            FutureWarning, stacklevel=2\r
+            )\r
+        return len(self._children) != 0 # emulate old behaviour, for now\r
+\r
+    ##\r
+    # Returns the given subelement, by index.\r
+    #\r
+    # @param index What subelement to return.\r
+    # @return The given subelement.\r
+    # @exception IndexError If the given element does not exist.\r
+\r
+    def __getitem__(self, index):\r
+        return self._children[index]\r
+\r
+    ##\r
+    # Replaces the given subelement, by index.\r
+    #\r
+    # @param index What subelement to replace.\r
+    # @param element The new element value.\r
+    # @exception IndexError If the given element does not exist.\r
+\r
+    def __setitem__(self, index, element):\r
+        # if isinstance(index, slice):\r
+        #     for elt in element:\r
+        #         assert iselement(elt)\r
+        # else:\r
+        #     assert iselement(element)\r
+        self._children[index] = element\r
+\r
+    ##\r
+    # Deletes the given subelement, by index.\r
+    #\r
+    # @param index What subelement to delete.\r
+    # @exception IndexError If the given element does not exist.\r
+\r
+    def __delitem__(self, index):\r
+        del self._children[index]\r
+\r
+    ##\r
+    # Adds a subelement to the end of this element.  In document order,\r
+    # the new element will appear after the last existing subelement (or\r
+    # directly after the text, if it's the first subelement), but before\r
+    # the end tag for this element.\r
+    #\r
+    # @param element The element to add.\r
+\r
+    def append(self, element):\r
+        # assert iselement(element)\r
+        self._children.append(element)\r
+\r
+    ##\r
+    # Appends subelements from a sequence.\r
+    #\r
+    # @param elements A sequence object with zero or more elements.\r
+    # @since 1.3\r
+\r
+    def extend(self, elements):\r
+        # for element in elements:\r
+        #     assert iselement(element)\r
+        self._children.extend(elements)\r
+\r
+    ##\r
+    # Inserts a subelement at the given position in this element.\r
+    #\r
+    # @param index Where to insert the new subelement.\r
+\r
+    def insert(self, index, element):\r
+        # assert iselement(element)\r
+        self._children.insert(index, element)\r
+\r
+    ##\r
+    # Removes a matching subelement.  Unlike the <b>find</b> methods,\r
+    # this method compares elements based on identity, not on tag\r
+    # value or contents.  To remove subelements by other means, the\r
+    # easiest way is often to use a list comprehension to select what\r
+    # elements to keep, and use slice assignment to update the parent\r
+    # element.\r
+    #\r
+    # @param element What element to remove.\r
+    # @exception ValueError If a matching element could not be found.\r
+\r
+    def remove(self, element):\r
+        # assert iselement(element)\r
+        self._children.remove(element)\r
+\r
+    ##\r
+    # (Deprecated) Returns all subelements.  The elements are returned\r
+    # in document order.\r
+    #\r
+    # @return A list of subelements.\r
+    # @defreturn list of Element instances\r
+\r
+    def getchildren(self):\r
+        warnings.warn(\r
+            "This method will be removed in future versions.  "\r
+            "Use 'list(elem)' or iteration over elem instead.",\r
+            DeprecationWarning, stacklevel=2\r
+            )\r
+        return self._children\r
+\r
+    ##\r
+    # Finds the first matching subelement, by tag name or path.\r
+    #\r
+    # @param path What element to look for.\r
+    # @keyparam namespaces Optional namespace prefix map.\r
+    # @return The first matching element, or None if no element was found.\r
+    # @defreturn Element or None\r
+\r
+    def find(self, path, namespaces=None):\r
+        return ElementPath.find(self, path, namespaces)\r
+\r
+    ##\r
+    # Finds text for the first matching subelement, by tag name or path.\r
+    #\r
+    # @param path What element to look for.\r
+    # @param default What to return if the element was not found.\r
+    # @keyparam namespaces Optional namespace prefix map.\r
+    # @return The text content of the first matching element, or the\r
+    #     default value no element was found.  Note that if the element\r
+    #     is found, but has no text content, this method returns an\r
+    #     empty string.\r
+    # @defreturn string\r
+\r
+    def findtext(self, path, default=None, namespaces=None):\r
+        return ElementPath.findtext(self, path, default, namespaces)\r
+\r
+    ##\r
+    # Finds all matching subelements, by tag name or path.\r
+    #\r
+    # @param path What element to look for.\r
+    # @keyparam namespaces Optional namespace prefix map.\r
+    # @return A list or other sequence containing all matching elements,\r
+    #    in document order.\r
+    # @defreturn list of Element instances\r
+\r
+    def findall(self, path, namespaces=None):\r
+        return ElementPath.findall(self, path, namespaces)\r
+\r
+    ##\r
+    # Finds all matching subelements, by tag name or path.\r
+    #\r
+    # @param path What element to look for.\r
+    # @keyparam namespaces Optional namespace prefix map.\r
+    # @return An iterator or sequence containing all matching elements,\r
+    #    in document order.\r
+    # @defreturn a generated sequence of Element instances\r
+\r
+    def iterfind(self, path, namespaces=None):\r
+        return ElementPath.iterfind(self, path, namespaces)\r
+\r
+    ##\r
+    # Resets an element.  This function removes all subelements, clears\r
+    # all attributes, and sets the <b>text</b> and <b>tail</b> attributes\r
+    # to None.\r
+\r
+    def clear(self):\r
+        self.attrib.clear()\r
+        self._children = []\r
+        self.text = self.tail = None\r
+\r
+    ##\r
+    # Gets an element attribute.  Equivalent to <b>attrib.get</b>, but\r
+    # some implementations may handle this a bit more efficiently.\r
+    #\r
+    # @param key What attribute to look for.\r
+    # @param default What to return if the attribute was not found.\r
+    # @return The attribute value, or the default value, if the\r
+    #     attribute was not found.\r
+    # @defreturn string or None\r
+\r
+    def get(self, key, default=None):\r
+        return self.attrib.get(key, default)\r
+\r
+    ##\r
+    # Sets an element attribute.  Equivalent to <b>attrib[key] = value</b>,\r
+    # but some implementations may handle this a bit more efficiently.\r
+    #\r
+    # @param key What attribute to set.\r
+    # @param value The attribute value.\r
+\r
+    def set(self, key, value):\r
+        self.attrib[key] = value\r
+\r
+    ##\r
+    # Gets a list of attribute names.  The names are returned in an\r
+    # arbitrary order (just like for an ordinary Python dictionary).\r
+    # Equivalent to <b>attrib.keys()</b>.\r
+    #\r
+    # @return A list of element attribute names.\r
+    # @defreturn list of strings\r
+\r
+    def keys(self):\r
+        return self.attrib.keys()\r
+\r
+    ##\r
+    # Gets element attributes, as a sequence.  The attributes are\r
+    # returned in an arbitrary order.  Equivalent to <b>attrib.items()</b>.\r
+    #\r
+    # @return A list of (name, value) tuples for all attributes.\r
+    # @defreturn list of (string, string) tuples\r
+\r
+    def items(self):\r
+        return self.attrib.items()\r
+\r
+    ##\r
+    # Creates a tree iterator.  The iterator loops over this element\r
+    # and all subelements, in document order, and returns all elements\r
+    # with a matching tag.\r
+    # <p>\r
+    # If the tree structure is modified during iteration, new or removed\r
+    # elements may or may not be included.  To get a stable set, use the\r
+    # list() function on the iterator, and loop over the resulting list.\r
+    #\r
+    # @param tag What tags to look for (default is to return all elements).\r
+    # @return An iterator containing all the matching elements.\r
+    # @defreturn iterator\r
+\r
+    def iter(self, tag=None):\r
+        if tag == "*":\r
+            tag = None\r
+        if tag is None or self.tag == tag:\r
+            yield self\r
+        for e in self._children:\r
+            for e in e.iter(tag):\r
+                yield e\r
+\r
+    # compatibility\r
+    def getiterator(self, tag=None):\r
+        # Change for a DeprecationWarning in 1.4\r
+        warnings.warn(\r
+            "This method will be removed in future versions.  "\r
+            "Use 'elem.iter()' or 'list(elem.iter())' instead.",\r
+            PendingDeprecationWarning, stacklevel=2\r
+        )\r
+        return list(self.iter(tag))\r
+\r
+    ##\r
+    # Creates a text iterator.  The iterator loops over this element\r
+    # and all subelements, in document order, and returns all inner\r
+    # text.\r
+    #\r
+    # @return An iterator containing all inner text.\r
+    # @defreturn iterator\r
+\r
+    def itertext(self):\r
+        tag = self.tag\r
+        if not isinstance(tag, basestring) and tag is not None:\r
+            return\r
+        if self.text:\r
+            yield self.text\r
+        for e in self:\r
+            for s in e.itertext():\r
+                yield s\r
+            if e.tail:\r
+                yield e.tail\r
+\r
+# compatibility\r
+_Element = _ElementInterface = Element\r
+\r
+##\r
+# Subelement factory.  This function creates an element instance, and\r
+# appends it to an existing element.\r
+# <p>\r
+# The element name, attribute names, and attribute values can be\r
+# either 8-bit ASCII strings or Unicode strings.\r
+#\r
+# @param parent The parent element.\r
+# @param tag The subelement name.\r
+# @param attrib An optional dictionary, containing element attributes.\r
+# @param **extra Additional attributes, given as keyword arguments.\r
+# @return An element instance.\r
+# @defreturn Element\r
+\r
+def SubElement(parent, tag, attrib={}, **extra):\r
+    attrib = attrib.copy()\r
+    attrib.update(extra)\r
+    element = parent.makeelement(tag, attrib)\r
+    parent.append(element)\r
+    return element\r
+\r
+##\r
+# Comment element factory.  This factory function creates a special\r
+# element that will be serialized as an XML comment by the standard\r
+# serializer.\r
+# <p>\r
+# The comment string can be either an 8-bit ASCII string or a Unicode\r
+# string.\r
+#\r
+# @param text A string containing the comment string.\r
+# @return An element instance, representing a comment.\r
+# @defreturn Element\r
+\r
+def Comment(text=None):\r
+    element = Element(Comment)\r
+    element.text = text\r
+    return element\r
+\r
+##\r
+# PI element factory.  This factory function creates a special element\r
+# that will be serialized as an XML processing instruction by the standard\r
+# serializer.\r
+#\r
+# @param target A string containing the PI target.\r
+# @param text A string containing the PI contents, if any.\r
+# @return An element instance, representing a PI.\r
+# @defreturn Element\r
+\r
+def ProcessingInstruction(target, text=None):\r
+    element = Element(ProcessingInstruction)\r
+    element.text = target\r
+    if text:\r
+        element.text = element.text + " " + text\r
+    return element\r
+\r
+PI = ProcessingInstruction\r
+\r
+##\r
+# QName wrapper.  This can be used to wrap a QName attribute value, in\r
+# order to get proper namespace handling on output.\r
+#\r
+# @param text A string containing the QName value, in the form {uri}local,\r
+#     or, if the tag argument is given, the URI part of a QName.\r
+# @param tag Optional tag.  If given, the first argument is interpreted as\r
+#     an URI, and this argument is interpreted as a local name.\r
+# @return An opaque object, representing the QName.\r
+\r
+class QName(object):\r
+    def __init__(self, text_or_uri, tag=None):\r
+        if tag:\r
+            text_or_uri = "{%s}%s" % (text_or_uri, tag)\r
+        self.text = text_or_uri\r
+    def __str__(self):\r
+        return self.text\r
+    def __hash__(self):\r
+        return hash(self.text)\r
+    def __cmp__(self, other):\r
+        if isinstance(other, QName):\r
+            return cmp(self.text, other.text)\r
+        return cmp(self.text, other)\r
+\r
+# --------------------------------------------------------------------\r
+\r
+##\r
+# ElementTree wrapper class.  This class represents an entire element\r
+# hierarchy, and adds some extra support for serialization to and from\r
+# standard XML.\r
+#\r
+# @param element Optional root element.\r
+# @keyparam file Optional file handle or file name.  If given, the\r
+#     tree is initialized with the contents of this XML file.\r
+\r
+class ElementTree(object):\r
+\r
+    def __init__(self, element=None, file=None):\r
+        # assert element is None or iselement(element)\r
+        self._root = element # first node\r
+        if file:\r
+            self.parse(file)\r
+\r
+    ##\r
+    # Gets the root element for this tree.\r
+    #\r
+    # @return An element instance.\r
+    # @defreturn Element\r
+\r
+    def getroot(self):\r
+        return self._root\r
+\r
+    ##\r
+    # Replaces the root element for this tree.  This discards the\r
+    # current contents of the tree, and replaces it with the given\r
+    # element.  Use with care.\r
+    #\r
+    # @param element An element instance.\r
+\r
+    def _setroot(self, element):\r
+        # assert iselement(element)\r
+        self._root = element\r
+\r
+    ##\r
+    # Loads an external XML document into this element tree.\r
+    #\r
+    # @param source A file name or file object.  If a file object is\r
+    #     given, it only has to implement a <b>read(n)</b> method.\r
+    # @keyparam parser An optional parser instance.  If not given, the\r
+    #     standard {@link XMLParser} parser is used.\r
+    # @return The document root element.\r
+    # @defreturn Element\r
+    # @exception ParseError If the parser fails to parse the document.\r
+\r
+    def parse(self, source, parser=None):\r
+        close_source = False\r
+        if not hasattr(source, "read"):\r
+            source = open(source, "rb")\r
+            close_source = True\r
+        try:\r
+            if not parser:\r
+                parser = XMLParser(target=TreeBuilder())\r
+            while 1:\r
+                data = source.read(65536)\r
+                if not data:\r
+                    break\r
+                parser.feed(data)\r
+            self._root = parser.close()\r
+            return self._root\r
+        finally:\r
+            if close_source:\r
+                source.close()\r
+\r
+    ##\r
+    # Creates a tree iterator for the root element.  The iterator loops\r
+    # over all elements in this tree, in document order.\r
+    #\r
+    # @param tag What tags to look for (default is to return all elements)\r
+    # @return An iterator.\r
+    # @defreturn iterator\r
+\r
+    def iter(self, tag=None):\r
+        # assert self._root is not None\r
+        return self._root.iter(tag)\r
+\r
+    # compatibility\r
+    def getiterator(self, tag=None):\r
+        # Change for a DeprecationWarning in 1.4\r
+        warnings.warn(\r
+            "This method will be removed in future versions.  "\r
+            "Use 'tree.iter()' or 'list(tree.iter())' instead.",\r
+            PendingDeprecationWarning, stacklevel=2\r
+        )\r
+        return list(self.iter(tag))\r
+\r
+    ##\r
+    # Same as getroot().find(path), starting at the root of the\r
+    # tree.\r
+    #\r
+    # @param path What element to look for.\r
+    # @keyparam namespaces Optional namespace prefix map.\r
+    # @return The first matching element, or None if no element was found.\r
+    # @defreturn Element or None\r
+\r
+    def find(self, path, namespaces=None):\r
+        # assert self._root is not None\r
+        if path[:1] == "/":\r
+            path = "." + path\r
+            warnings.warn(\r
+                "This search is broken in 1.3 and earlier, and will be "\r
+                "fixed in a future version.  If you rely on the current "\r
+                "behaviour, change it to %r" % path,\r
+                FutureWarning, stacklevel=2\r
+                )\r
+        return self._root.find(path, namespaces)\r
+\r
+    ##\r
+    # Same as getroot().findtext(path), starting at the root of the tree.\r
+    #\r
+    # @param path What element to look for.\r
+    # @param default What to return if the element was not found.\r
+    # @keyparam namespaces Optional namespace prefix map.\r
+    # @return The text content of the first matching element, or the\r
+    #     default value no element was found.  Note that if the element\r
+    #     is found, but has no text content, this method returns an\r
+    #     empty string.\r
+    # @defreturn string\r
+\r
+    def findtext(self, path, default=None, namespaces=None):\r
+        # assert self._root is not None\r
+        if path[:1] == "/":\r
+            path = "." + path\r
+            warnings.warn(\r
+                "This search is broken in 1.3 and earlier, and will be "\r
+                "fixed in a future version.  If you rely on the current "\r
+                "behaviour, change it to %r" % path,\r
+                FutureWarning, stacklevel=2\r
+                )\r
+        return self._root.findtext(path, default, namespaces)\r
+\r
+    ##\r
+    # Same as getroot().findall(path), starting at the root of the tree.\r
+    #\r
+    # @param path What element to look for.\r
+    # @keyparam namespaces Optional namespace prefix map.\r
+    # @return A list or iterator containing all matching elements,\r
+    #    in document order.\r
+    # @defreturn list of Element instances\r
+\r
+    def findall(self, path, namespaces=None):\r
+        # assert self._root is not None\r
+        if path[:1] == "/":\r
+            path = "." + path\r
+            warnings.warn(\r
+                "This search is broken in 1.3 and earlier, and will be "\r
+                "fixed in a future version.  If you rely on the current "\r
+                "behaviour, change it to %r" % path,\r
+                FutureWarning, stacklevel=2\r
+                )\r
+        return self._root.findall(path, namespaces)\r
+\r
+    ##\r
+    # Finds all matching subelements, by tag name or path.\r
+    # Same as getroot().iterfind(path).\r
+    #\r
+    # @param path What element to look for.\r
+    # @keyparam namespaces Optional namespace prefix map.\r
+    # @return An iterator or sequence containing all matching elements,\r
+    #    in document order.\r
+    # @defreturn a generated sequence of Element instances\r
+\r
+    def iterfind(self, path, namespaces=None):\r
+        # assert self._root is not None\r
+        if path[:1] == "/":\r
+            path = "." + path\r
+            warnings.warn(\r
+                "This search is broken in 1.3 and earlier, and will be "\r
+                "fixed in a future version.  If you rely on the current "\r
+                "behaviour, change it to %r" % path,\r
+                FutureWarning, stacklevel=2\r
+                )\r
+        return self._root.iterfind(path, namespaces)\r
+\r
+    ##\r
+    # Writes the element tree to a file, as XML.\r
+    #\r
+    # @def write(file, **options)\r
+    # @param file A file name, or a file object opened for writing.\r
+    # @param **options Options, given as keyword arguments.\r
+    # @keyparam encoding Optional output encoding (default is US-ASCII).\r
+    # @keyparam xml_declaration Controls if an XML declaration should\r
+    #     be added to the file.  Use False for never, True for always,\r
+    #     None for only if not US-ASCII or UTF-8.  None is default.\r
+    # @keyparam default_namespace Sets the default XML namespace (for "xmlns").\r
+    # @keyparam method Optional output method ("xml", "html", "text" or\r
+    #     "c14n"; default is "xml").\r
+\r
+    def write(self, file_or_filename,\r
+              # keyword arguments\r
+              encoding=None,\r
+              xml_declaration=None,\r
+              default_namespace=None,\r
+              method=None):\r
+        # assert self._root is not None\r
+        if not method:\r
+            method = "xml"\r
+        elif method not in _serialize:\r
+            # FIXME: raise an ImportError for c14n if ElementC14N is missing?\r
+            raise ValueError("unknown method %r" % method)\r
+        if hasattr(file_or_filename, "write"):\r
+            file = file_or_filename\r
+        else:\r
+            file = open(file_or_filename, "wb")\r
+        write = file.write\r
+        if not encoding:\r
+            if method == "c14n":\r
+                encoding = "utf-8"\r
+            else:\r
+                encoding = "us-ascii"\r
+        elif xml_declaration or (xml_declaration is None and\r
+                                 encoding not in ("utf-8", "us-ascii")):\r
+            if method == "xml":\r
+                write("<?xml version='1.0' encoding='%s'?>\n" % encoding)\r
+        if method == "text":\r
+            _serialize_text(write, self._root, encoding)\r
+        else:\r
+            qnames, namespaces = _namespaces(\r
+                self._root, encoding, default_namespace\r
+                )\r
+            serialize = _serialize[method]\r
+            serialize(write, self._root, encoding, qnames, namespaces)\r
+        if file_or_filename is not file:\r
+            file.close()\r
+\r
+    def write_c14n(self, file):\r
+        # lxml.etree compatibility.  use output method instead\r
+        return self.write(file, method="c14n")\r
+\r
+# --------------------------------------------------------------------\r
+# serialization support\r
+\r
+def _namespaces(elem, encoding, default_namespace=None):\r
+    # identify namespaces used in this tree\r
+\r
+    # maps qnames to *encoded* prefix:local names\r
+    qnames = {None: None}\r
+\r
+    # maps uri:s to prefixes\r
+    namespaces = {}\r
+    if default_namespace:\r
+        namespaces[default_namespace] = ""\r
+\r
+    def encode(text):\r
+        return text.encode(encoding)\r
+\r
+    def add_qname(qname):\r
+        # calculate serialized qname representation\r
+        try:\r
+            if qname[:1] == "{":\r
+                uri, tag = qname[1:].rsplit("}", 1)\r
+                prefix = namespaces.get(uri)\r
+                if prefix is None:\r
+                    prefix = _namespace_map.get(uri)\r
+                    if prefix is None:\r
+                        prefix = "ns%d" % len(namespaces)\r
+                    if prefix != "xml":\r
+                        namespaces[uri] = prefix\r
+                if prefix:\r
+                    qnames[qname] = encode("%s:%s" % (prefix, tag))\r
+                else:\r
+                    qnames[qname] = encode(tag) # default element\r
+            else:\r
+                if default_namespace:\r
+                    # FIXME: can this be handled in XML 1.0?\r
+                    raise ValueError(\r
+                        "cannot use non-qualified names with "\r
+                        "default_namespace option"\r
+                        )\r
+                qnames[qname] = encode(qname)\r
+        except TypeError:\r
+            _raise_serialization_error(qname)\r
+\r
+    # populate qname and namespaces table\r
+    try:\r
+        iterate = elem.iter\r
+    except AttributeError:\r
+        iterate = elem.getiterator # cET compatibility\r
+    for elem in iterate():\r
+        tag = elem.tag\r
+        if isinstance(tag, QName):\r
+            if tag.text not in qnames:\r
+                add_qname(tag.text)\r
+        elif isinstance(tag, basestring):\r
+            if tag not in qnames:\r
+                add_qname(tag)\r
+        elif tag is not None and tag is not Comment and tag is not PI:\r
+            _raise_serialization_error(tag)\r
+        for key, value in elem.items():\r
+            if isinstance(key, QName):\r
+                key = key.text\r
+            if key not in qnames:\r
+                add_qname(key)\r
+            if isinstance(value, QName) and value.text not in qnames:\r
+                add_qname(value.text)\r
+        text = elem.text\r
+        if isinstance(text, QName) and text.text not in qnames:\r
+            add_qname(text.text)\r
+    return qnames, namespaces\r
+\r
+def _serialize_xml(write, elem, encoding, qnames, namespaces):\r
+    tag = elem.tag\r
+    text = elem.text\r
+    if tag is Comment:\r
+        write("<!--%s-->" % _encode(text, encoding))\r
+    elif tag is ProcessingInstruction:\r
+        write("<?%s?>" % _encode(text, encoding))\r
+    else:\r
+        tag = qnames[tag]\r
+        if tag is None:\r
+            if text:\r
+                write(_escape_cdata(text, encoding))\r
+            for e in elem:\r
+                _serialize_xml(write, e, encoding, qnames, None)\r
+        else:\r
+            write("<" + tag)\r
+            items = elem.items()\r
+            if items or namespaces:\r
+                if namespaces:\r
+                    for v, k in sorted(namespaces.items(),\r
+                                       key=lambda x: x[1]):  # sort on prefix\r
+                        if k:\r
+                            k = ":" + k\r
+                        write(" xmlns%s=\"%s\"" % (\r
+                            k.encode(encoding),\r
+                            _escape_attrib(v, encoding)\r
+                            ))\r
+                for k, v in sorted(items):  # lexical order\r
+                    if isinstance(k, QName):\r
+                        k = k.text\r
+                    if isinstance(v, QName):\r
+                        v = qnames[v.text]\r
+                    else:\r
+                        v = _escape_attrib(v, encoding)\r
+                    write(" %s=\"%s\"" % (qnames[k], v))\r
+            if text or len(elem):\r
+                write(">")\r
+                if text:\r
+                    write(_escape_cdata(text, encoding))\r
+                for e in elem:\r
+                    _serialize_xml(write, e, encoding, qnames, None)\r
+                write("</" + tag + ">")\r
+            else:\r
+                write(" />")\r
+    if elem.tail:\r
+        write(_escape_cdata(elem.tail, encoding))\r
+\r
+HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr",\r
+              "img", "input", "isindex", "link", "meta", "param")\r
+\r
+try:\r
+    HTML_EMPTY = set(HTML_EMPTY)\r
+except NameError:\r
+    pass\r
+\r
+def _serialize_html(write, elem, encoding, qnames, namespaces):\r
+    tag = elem.tag\r
+    text = elem.text\r
+    if tag is Comment:\r
+        write("<!--%s-->" % _escape_cdata(text, encoding))\r
+    elif tag is ProcessingInstruction:\r
+        write("<?%s?>" % _escape_cdata(text, encoding))\r
+    else:\r
+        tag = qnames[tag]\r
+        if tag is None:\r
+            if text:\r
+                write(_escape_cdata(text, encoding))\r
+            for e in elem:\r
+                _serialize_html(write, e, encoding, qnames, None)\r
+        else:\r
+            write("<" + tag)\r
+            items = elem.items()\r
+            if items or namespaces:\r
+                if namespaces:\r
+                    for v, k in sorted(namespaces.items(),\r
+                                       key=lambda x: x[1]):  # sort on prefix\r
+                        if k:\r
+                            k = ":" + k\r
+                        write(" xmlns%s=\"%s\"" % (\r
+                            k.encode(encoding),\r
+                            _escape_attrib(v, encoding)\r
+                            ))\r
+                for k, v in sorted(items):  # lexical order\r
+                    if isinstance(k, QName):\r
+                        k = k.text\r
+                    if isinstance(v, QName):\r
+                        v = qnames[v.text]\r
+                    else:\r
+                        v = _escape_attrib_html(v, encoding)\r
+                    # FIXME: handle boolean attributes\r
+                    write(" %s=\"%s\"" % (qnames[k], v))\r
+            write(">")\r
+            ltag = tag.lower()\r
+            if text:\r
+                if ltag == "script" or ltag == "style":\r
+                    write(_encode(text, encoding))\r
+                else:\r
+                    write(_escape_cdata(text, encoding))\r
+            for e in elem:\r
+                _serialize_html(write, e, encoding, qnames, None)\r
+            if ltag not in HTML_EMPTY:\r
+                write("</" + tag + ">")\r
+    if elem.tail:\r
+        write(_escape_cdata(elem.tail, encoding))\r
+\r
+def _serialize_text(write, elem, encoding):\r
+    for part in elem.itertext():\r
+        write(part.encode(encoding))\r
+    if elem.tail:\r
+        write(elem.tail.encode(encoding))\r
+\r
+_serialize = {\r
+    "xml": _serialize_xml,\r
+    "html": _serialize_html,\r
+    "text": _serialize_text,\r
+# this optional method is imported at the end of the module\r
+#   "c14n": _serialize_c14n,\r
+}\r
+\r
+##\r
+# Registers a namespace prefix.  The registry is global, and any\r
+# existing mapping for either the given prefix or the namespace URI\r
+# will be removed.\r
+#\r
+# @param prefix Namespace prefix.\r
+# @param uri Namespace uri.  Tags and attributes in this namespace\r
+#     will be serialized with the given prefix, if at all possible.\r
+# @exception ValueError If the prefix is reserved, or is otherwise\r
+#     invalid.\r
+\r
+def register_namespace(prefix, uri):\r
+    if re.match("ns\d+$", prefix):\r
+        raise ValueError("Prefix format reserved for internal use")\r
+    for k, v in _namespace_map.items():\r
+        if k == uri or v == prefix:\r
+            del _namespace_map[k]\r
+    _namespace_map[uri] = prefix\r
+\r
+_namespace_map = {\r
+    # "well-known" namespace prefixes\r
+    "http://www.w3.org/XML/1998/namespace": "xml",\r
+    "http://www.w3.org/1999/xhtml": "html",\r
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf",\r
+    "http://schemas.xmlsoap.org/wsdl/": "wsdl",\r
+    # xml schema\r
+    "http://www.w3.org/2001/XMLSchema": "xs",\r
+    "http://www.w3.org/2001/XMLSchema-instance": "xsi",\r
+    # dublin core\r
+    "http://purl.org/dc/elements/1.1/": "dc",\r
+}\r
+\r
+def _raise_serialization_error(text):\r
+    raise TypeError(\r
+        "cannot serialize %r (type %s)" % (text, type(text).__name__)\r
+        )\r
+\r
+def _encode(text, encoding):\r
+    try:\r
+        return text.encode(encoding, "xmlcharrefreplace")\r
+    except (TypeError, AttributeError):\r
+        _raise_serialization_error(text)\r
+\r
+def _escape_cdata(text, encoding):\r
+    # escape character data\r
+    try:\r
+        # it's worth avoiding do-nothing calls for strings that are\r
+        # shorter than 500 character, or so.  assume that's, by far,\r
+        # the most common case in most applications.\r
+        if "&" in text:\r
+            text = text.replace("&", "&amp;")\r
+        if "<" in text:\r
+            text = text.replace("<", "&lt;")\r
+        if ">" in text:\r
+            text = text.replace(">", "&gt;")\r
+        return text.encode(encoding, "xmlcharrefreplace")\r
+    except (TypeError, AttributeError):\r
+        _raise_serialization_error(text)\r
+\r
+def _escape_attrib(text, encoding):\r
+    # escape attribute value\r
+    try:\r
+        if "&" in text:\r
+            text = text.replace("&", "&amp;")\r
+        if "<" in text:\r
+            text = text.replace("<", "&lt;")\r
+        if ">" in text:\r
+            text = text.replace(">", "&gt;")\r
+        if "\"" in text:\r
+            text = text.replace("\"", "&quot;")\r
+        if "\n" in text:\r
+            text = text.replace("\n", "&#10;")\r
+        return text.encode(encoding, "xmlcharrefreplace")\r
+    except (TypeError, AttributeError):\r
+        _raise_serialization_error(text)\r
+\r
+def _escape_attrib_html(text, encoding):\r
+    # escape attribute value\r
+    try:\r
+        if "&" in text:\r
+            text = text.replace("&", "&amp;")\r
+        if ">" in text:\r
+            text = text.replace(">", "&gt;")\r
+        if "\"" in text:\r
+            text = text.replace("\"", "&quot;")\r
+        return text.encode(encoding, "xmlcharrefreplace")\r
+    except (TypeError, AttributeError):\r
+        _raise_serialization_error(text)\r
+\r
+# --------------------------------------------------------------------\r
+\r
+##\r
+# Generates a string representation of an XML element, including all\r
+# subelements.\r
+#\r
+# @param element An Element instance.\r
+# @keyparam encoding Optional output encoding (default is US-ASCII).\r
+# @keyparam method Optional output method ("xml", "html", "text" or\r
+#     "c14n"; default is "xml").\r
+# @return An encoded string containing the XML data.\r
+# @defreturn string\r
+\r
+def tostring(element, encoding=None, method=None):\r
+    class dummy:\r
+        pass\r
+    data = []\r
+    file = dummy()\r
+    file.write = data.append\r
+    ElementTree(element).write(file, encoding, method=method)\r
+    return "".join(data)\r
+\r
+##\r
+# Generates a string representation of an XML element, including all\r
+# subelements.  The string is returned as a sequence of string fragments.\r
+#\r
+# @param element An Element instance.\r
+# @keyparam encoding Optional output encoding (default is US-ASCII).\r
+# @keyparam method Optional output method ("xml", "html", "text" or\r
+#     "c14n"; default is "xml").\r
+# @return A sequence object containing the XML data.\r
+# @defreturn sequence\r
+# @since 1.3\r
+\r
+def tostringlist(element, encoding=None, method=None):\r
+    class dummy:\r
+        pass\r
+    data = []\r
+    file = dummy()\r
+    file.write = data.append\r
+    ElementTree(element).write(file, encoding, method=method)\r
+    # FIXME: merge small fragments into larger parts\r
+    return data\r
+\r
+##\r
+# Writes an element tree or element structure to sys.stdout.  This\r
+# function should be used for debugging only.\r
+# <p>\r
+# The exact output format is implementation dependent.  In this\r
+# version, it's written as an ordinary XML file.\r
+#\r
+# @param elem An element tree or an individual element.\r
+\r
+def dump(elem):\r
+    # debugging\r
+    if not isinstance(elem, ElementTree):\r
+        elem = ElementTree(elem)\r
+    elem.write(sys.stdout)\r
+    tail = elem.getroot().tail\r
+    if not tail or tail[-1] != "\n":\r
+        sys.stdout.write("\n")\r
+\r
+# --------------------------------------------------------------------\r
+# parsing\r
+\r
+##\r
+# Parses an XML document into an element tree.\r
+#\r
+# @param source A filename or file object containing XML data.\r
+# @param parser An optional parser instance.  If not given, the\r
+#     standard {@link XMLParser} parser is used.\r
+# @return An ElementTree instance\r
+\r
+def parse(source, parser=None):\r
+    tree = ElementTree()\r
+    tree.parse(source, parser)\r
+    return tree\r
+\r
+##\r
+# Parses an XML document into an element tree incrementally, and reports\r
+# what's going on to the user.\r
+#\r
+# @param source A filename or file object containing XML data.\r
+# @param events A list of events to report back.  If omitted, only "end"\r
+#     events are reported.\r
+# @param parser An optional parser instance.  If not given, the\r
+#     standard {@link XMLParser} parser is used.\r
+# @return A (event, elem) iterator.\r
+\r
+def iterparse(source, events=None, parser=None):\r
+    close_source = False\r
+    if not hasattr(source, "read"):\r
+        source = open(source, "rb")\r
+        close_source = True\r
+    if not parser:\r
+        parser = XMLParser(target=TreeBuilder())\r
+    return _IterParseIterator(source, events, parser, close_source)\r
+\r
+class _IterParseIterator(object):\r
+\r
+    def __init__(self, source, events, parser, close_source=False):\r
+        self._file = source\r
+        self._close_file = close_source\r
+        self._events = []\r
+        self._index = 0\r
+        self._error = None\r
+        self.root = self._root = None\r
+        self._parser = parser\r
+        # wire up the parser for event reporting\r
+        parser = self._parser._parser\r
+        append = self._events.append\r
+        if events is None:\r
+            events = ["end"]\r
+        for event in events:\r
+            if event == "start":\r
+                try:\r
+                    parser.ordered_attributes = 1\r
+                    parser.specified_attributes = 1\r
+                    def handler(tag, attrib_in, event=event, append=append,\r
+                                start=self._parser._start_list):\r
+                        append((event, start(tag, attrib_in)))\r
+                    parser.StartElementHandler = handler\r
+                except AttributeError:\r
+                    def handler(tag, attrib_in, event=event, append=append,\r
+                                start=self._parser._start):\r
+                        append((event, start(tag, attrib_in)))\r
+                    parser.StartElementHandler = handler\r
+            elif event == "end":\r
+                def handler(tag, event=event, append=append,\r
+                            end=self._parser._end):\r
+                    append((event, end(tag)))\r
+                parser.EndElementHandler = handler\r
+            elif event == "start-ns":\r
+                def handler(prefix, uri, event=event, append=append):\r
+                    try:\r
+                        uri = (uri or "").encode("ascii")\r
+                    except UnicodeError:\r
+                        pass\r
+                    append((event, (prefix or "", uri or "")))\r
+                parser.StartNamespaceDeclHandler = handler\r
+            elif event == "end-ns":\r
+                def handler(prefix, event=event, append=append):\r
+                    append((event, None))\r
+                parser.EndNamespaceDeclHandler = handler\r
+            else:\r
+                raise ValueError("unknown event %r" % event)\r
+\r
+    def next(self):\r
+        while 1:\r
+            try:\r
+                item = self._events[self._index]\r
+                self._index += 1\r
+                return item\r
+            except IndexError:\r
+                pass\r
+            if self._error:\r
+                e = self._error\r
+                self._error = None\r
+                raise e\r
+            if self._parser is None:\r
+                self.root = self._root\r
+                if self._close_file:\r
+                    self._file.close()\r
+                raise StopIteration\r
+            # load event buffer\r
+            del self._events[:]\r
+            self._index = 0\r
+            data = self._file.read(16384)\r
+            if data:\r
+                try:\r
+                    self._parser.feed(data)\r
+                except SyntaxError as exc:\r
+                    self._error = exc\r
+            else:\r
+                self._root = self._parser.close()\r
+                self._parser = None\r
+\r
+    def __iter__(self):\r
+        return self\r
+\r
+##\r
+# Parses an XML document from a string constant.  This function can\r
+# be used to embed "XML literals" in Python code.\r
+#\r
+# @param source A string containing XML data.\r
+# @param parser An optional parser instance.  If not given, the\r
+#     standard {@link XMLParser} parser is used.\r
+# @return An Element instance.\r
+# @defreturn Element\r
+\r
+def XML(text, parser=None):\r
+    if not parser:\r
+        parser = XMLParser(target=TreeBuilder())\r
+    parser.feed(text)\r
+    return parser.close()\r
+\r
+##\r
+# Parses an XML document from a string constant, and also returns\r
+# a dictionary which maps from element id:s to elements.\r
+#\r
+# @param source A string containing XML data.\r
+# @param parser An optional parser instance.  If not given, the\r
+#     standard {@link XMLParser} parser is used.\r
+# @return A tuple containing an Element instance and a dictionary.\r
+# @defreturn (Element, dictionary)\r
+\r
+def XMLID(text, parser=None):\r
+    if not parser:\r
+        parser = XMLParser(target=TreeBuilder())\r
+    parser.feed(text)\r
+    tree = parser.close()\r
+    ids = {}\r
+    for elem in tree.iter():\r
+        id = elem.get("id")\r
+        if id:\r
+            ids[id] = elem\r
+    return tree, ids\r
+\r
+##\r
+# Parses an XML document from a string constant.  Same as {@link #XML}.\r
+#\r
+# @def fromstring(text)\r
+# @param source A string containing XML data.\r
+# @return An Element instance.\r
+# @defreturn Element\r
+\r
+fromstring = XML\r
+\r
+##\r
+# Parses an XML document from a sequence of string fragments.\r
+#\r
+# @param sequence A list or other sequence containing XML data fragments.\r
+# @param parser An optional parser instance.  If not given, the\r
+#     standard {@link XMLParser} parser is used.\r
+# @return An Element instance.\r
+# @defreturn Element\r
+# @since 1.3\r
+\r
+def fromstringlist(sequence, parser=None):\r
+    if not parser:\r
+        parser = XMLParser(target=TreeBuilder())\r
+    for text in sequence:\r
+        parser.feed(text)\r
+    return parser.close()\r
+\r
+# --------------------------------------------------------------------\r
+\r
+##\r
+# Generic element structure builder.  This builder converts a sequence\r
+# of {@link #TreeBuilder.start}, {@link #TreeBuilder.data}, and {@link\r
+# #TreeBuilder.end} method calls to a well-formed element structure.\r
+# <p>\r
+# You can use this class to build an element structure using a custom XML\r
+# parser, or a parser for some other XML-like format.\r
+#\r
+# @param element_factory Optional element factory.  This factory\r
+#    is called to create new Element instances, as necessary.\r
+\r
+class TreeBuilder(object):\r
+\r
+    def __init__(self, element_factory=None):\r
+        self._data = [] # data collector\r
+        self._elem = [] # element stack\r
+        self._last = None # last element\r
+        self._tail = None # true if we're after an end tag\r
+        if element_factory is None:\r
+            element_factory = Element\r
+        self._factory = element_factory\r
+\r
+    ##\r
+    # Flushes the builder buffers, and returns the toplevel document\r
+    # element.\r
+    #\r
+    # @return An Element instance.\r
+    # @defreturn Element\r
+\r
+    def close(self):\r
+        assert len(self._elem) == 0, "missing end tags"\r
+        assert self._last is not None, "missing toplevel element"\r
+        return self._last\r
+\r
+    def _flush(self):\r
+        if self._data:\r
+            if self._last is not None:\r
+                text = "".join(self._data)\r
+                if self._tail:\r
+                    assert self._last.tail is None, "internal error (tail)"\r
+                    self._last.tail = text\r
+                else:\r
+                    assert self._last.text is None, "internal error (text)"\r
+                    self._last.text = text\r
+            self._data = []\r
+\r
+    ##\r
+    # Adds text to the current element.\r
+    #\r
+    # @param data A string.  This should be either an 8-bit string\r
+    #    containing ASCII text, or a Unicode string.\r
+\r
+    def data(self, data):\r
+        self._data.append(data)\r
+\r
+    ##\r
+    # Opens a new element.\r
+    #\r
+    # @param tag The element name.\r
+    # @param attrib A dictionary containing element attributes.\r
+    # @return The opened element.\r
+    # @defreturn Element\r
+\r
+    def start(self, tag, attrs):\r
+        self._flush()\r
+        self._last = elem = self._factory(tag, attrs)\r
+        if self._elem:\r
+            self._elem[-1].append(elem)\r
+        self._elem.append(elem)\r
+        self._tail = 0\r
+        return elem\r
+\r
+    ##\r
+    # Closes the current element.\r
+    #\r
+    # @param tag The element name.\r
+    # @return The closed element.\r
+    # @defreturn Element\r
+\r
+    def end(self, tag):\r
+        self._flush()\r
+        self._last = self._elem.pop()\r
+        assert self._last.tag == tag,\\r
+               "end tag mismatch (expected %s, got %s)" % (\r
+                   self._last.tag, tag)\r
+        self._tail = 1\r
+        return self._last\r
+\r
+##\r
+# Element structure builder for XML source data, based on the\r
+# <b>expat</b> parser.\r
+#\r
+# @keyparam target Target object.  If omitted, the builder uses an\r
+#     instance of the standard {@link #TreeBuilder} class.\r
+# @keyparam html Predefine HTML entities.  This flag is not supported\r
+#     by the current implementation.\r
+# @keyparam encoding Optional encoding.  If given, the value overrides\r
+#     the encoding specified in the XML file.\r
+# @see #ElementTree\r
+# @see #TreeBuilder\r
+\r
+class XMLParser(object):\r
+\r
+    def __init__(self, html=0, target=None, encoding=None):\r
+        try:\r
+            from xml.parsers import expat\r
+        except ImportError:\r
+            try:\r
+                import pyexpat as expat\r
+            except ImportError:\r
+                raise ImportError(\r
+                    "No module named expat; use SimpleXMLTreeBuilder instead"\r
+                    )\r
+        parser = expat.ParserCreate(encoding, "}")\r
+        if target is None:\r
+            target = TreeBuilder()\r
+        # underscored names are provided for compatibility only\r
+        self.parser = self._parser = parser\r
+        self.target = self._target = target\r
+        self._error = expat.error\r
+        self._names = {} # name memo cache\r
+        # callbacks\r
+        parser.DefaultHandlerExpand = self._default\r
+        parser.StartElementHandler = self._start\r
+        parser.EndElementHandler = self._end\r
+        parser.CharacterDataHandler = self._data\r
+        # optional callbacks\r
+        parser.CommentHandler = self._comment\r
+        parser.ProcessingInstructionHandler = self._pi\r
+        # let expat do the buffering, if supported\r
+        try:\r
+            self._parser.buffer_text = 1\r
+        except AttributeError:\r
+            pass\r
+        # use new-style attribute handling, if supported\r
+        try:\r
+            self._parser.ordered_attributes = 1\r
+            self._parser.specified_attributes = 1\r
+            parser.StartElementHandler = self._start_list\r
+        except AttributeError:\r
+            pass\r
+        self._doctype = None\r
+        self.entity = {}\r
+        try:\r
+            self.version = "Expat %d.%d.%d" % expat.version_info\r
+        except AttributeError:\r
+            pass # unknown\r
+\r
+    def _raiseerror(self, value):\r
+        err = ParseError(value)\r
+        err.code = value.code\r
+        err.position = value.lineno, value.offset\r
+        raise err\r
+\r
+    def _fixtext(self, text):\r
+        # convert text string to ascii, if possible\r
+        try:\r
+            return text.encode("ascii")\r
+        except UnicodeError:\r
+            return text\r
+\r
+    def _fixname(self, key):\r
+        # expand qname, and convert name string to ascii, if possible\r
+        try:\r
+            name = self._names[key]\r
+        except KeyError:\r
+            name = key\r
+            if "}" in name:\r
+                name = "{" + name\r
+            self._names[key] = name = self._fixtext(name)\r
+        return name\r
+\r
+    def _start(self, tag, attrib_in):\r
+        fixname = self._fixname\r
+        fixtext = self._fixtext\r
+        tag = fixname(tag)\r
+        attrib = {}\r
+        for key, value in attrib_in.items():\r
+            attrib[fixname(key)] = fixtext(value)\r
+        return self.target.start(tag, attrib)\r
+\r
+    def _start_list(self, tag, attrib_in):\r
+        fixname = self._fixname\r
+        fixtext = self._fixtext\r
+        tag = fixname(tag)\r
+        attrib = {}\r
+        if attrib_in:\r
+            for i in range(0, len(attrib_in), 2):\r
+                attrib[fixname(attrib_in[i])] = fixtext(attrib_in[i+1])\r
+        return self.target.start(tag, attrib)\r
+\r
+    def _data(self, text):\r
+        return self.target.data(self._fixtext(text))\r
+\r
+    def _end(self, tag):\r
+        return self.target.end(self._fixname(tag))\r
+\r
+    def _comment(self, data):\r
+        try:\r
+            comment = self.target.comment\r
+        except AttributeError:\r
+            pass\r
+        else:\r
+            return comment(self._fixtext(data))\r
+\r
+    def _pi(self, target, data):\r
+        try:\r
+            pi = self.target.pi\r
+        except AttributeError:\r
+            pass\r
+        else:\r
+            return pi(self._fixtext(target), self._fixtext(data))\r
+\r
+    def _default(self, text):\r
+        prefix = text[:1]\r
+        if prefix == "&":\r
+            # deal with undefined entities\r
+            try:\r
+                self.target.data(self.entity[text[1:-1]])\r
+            except KeyError:\r
+                from xml.parsers import expat\r
+                err = expat.error(\r
+                    "undefined entity %s: line %d, column %d" %\r
+                    (text, self._parser.ErrorLineNumber,\r
+                    self._parser.ErrorColumnNumber)\r
+                    )\r
+                err.code = 11 # XML_ERROR_UNDEFINED_ENTITY\r
+                err.lineno = self._parser.ErrorLineNumber\r
+                err.offset = self._parser.ErrorColumnNumber\r
+                raise err\r
+        elif prefix == "<" and text[:9] == "<!DOCTYPE":\r
+            self._doctype = [] # inside a doctype declaration\r
+        elif self._doctype is not None:\r
+            # parse doctype contents\r
+            if prefix == ">":\r
+                self._doctype = None\r
+                return\r
+            text = text.strip()\r
+            if not text:\r
+                return\r
+            self._doctype.append(text)\r
+            n = len(self._doctype)\r
+            if n > 2:\r
+                type = self._doctype[1]\r
+                if type == "PUBLIC" and n == 4:\r
+                    name, type, pubid, system = self._doctype\r
+                elif type == "SYSTEM" and n == 3:\r
+                    name, type, system = self._doctype\r
+                    pubid = None\r
+                else:\r
+                    return\r
+                if pubid:\r
+                    pubid = pubid[1:-1]\r
+                if hasattr(self.target, "doctype"):\r
+                    self.target.doctype(name, pubid, system[1:-1])\r
+                elif self.doctype is not self._XMLParser__doctype:\r
+                    # warn about deprecated call\r
+                    self._XMLParser__doctype(name, pubid, system[1:-1])\r
+                    self.doctype(name, pubid, system[1:-1])\r
+                self._doctype = None\r
+\r
+    ##\r
+    # (Deprecated) Handles a doctype declaration.\r
+    #\r
+    # @param name Doctype name.\r
+    # @param pubid Public identifier.\r
+    # @param system System identifier.\r
+\r
+    def doctype(self, name, pubid, system):\r
+        """This method of XMLParser is deprecated."""\r
+        warnings.warn(\r
+            "This method of XMLParser is deprecated.  Define doctype() "\r
+            "method on the TreeBuilder target.",\r
+            DeprecationWarning,\r
+            )\r
+\r
+    # sentinel, if doctype is redefined in a subclass\r
+    __doctype = doctype\r
+\r
+    ##\r
+    # Feeds data to the parser.\r
+    #\r
+    # @param data Encoded data.\r
+\r
+    def feed(self, data):\r
+        try:\r
+            self._parser.Parse(data, 0)\r
+        except self._error, v:\r
+            self._raiseerror(v)\r
+\r
+    ##\r
+    # Finishes feeding data to the parser.\r
+    #\r
+    # @return An element structure.\r
+    # @defreturn Element\r
+\r
+    def close(self):\r
+        try:\r
+            self._parser.Parse("", 1) # end of data\r
+        except self._error, v:\r
+            self._raiseerror(v)\r
+        tree = self.target.close()\r
+        del self.target, self._parser # get rid of circular references\r
+        return tree\r
+\r
+# compatibility\r
+XMLTreeBuilder = XMLParser\r
+\r
+# workaround circular import.\r
+try:\r
+    from ElementC14N import _serialize_c14n\r
+    _serialize["c14n"] = _serialize_c14n\r
+except ImportError:\r
+    pass\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/__init__.py
new file mode 100644 (file)
index 0000000..1fd62da
--- /dev/null
@@ -0,0 +1,33 @@
+# $Id: __init__.py 3375 2008-02-13 08:05:08Z fredrik $\r
+# elementtree package\r
+\r
+# --------------------------------------------------------------------\r
+# The ElementTree toolkit is\r
+#\r
+# Copyright (c) 1999-2008 by Fredrik Lundh\r
+#\r
+# By obtaining, using, and/or copying this software and/or its\r
+# associated documentation, you agree that you have read, understood,\r
+# and will comply with the following terms and conditions:\r
+#\r
+# Permission to use, copy, modify, and distribute this software and\r
+# its associated documentation for any purpose and without fee is\r
+# hereby granted, provided that the above copyright notice appears in\r
+# all copies, and that both that copyright notice and this permission\r
+# notice appear in supporting documentation, and that the name of\r
+# Secret Labs AB or the author not be used in advertising or publicity\r
+# pertaining to distribution of the software without specific, written\r
+# prior permission.\r
+#\r
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD\r
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-\r
+# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR\r
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY\r
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\r
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\r
+# OF THIS SOFTWARE.\r
+# --------------------------------------------------------------------\r
+\r
+# Licensed to PSF under a Contributor Agreement.\r
+# See http://www.python.org/psf/license for licensing details.\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/cElementTree.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/cElementTree.py
new file mode 100644 (file)
index 0000000..db12fde
--- /dev/null
@@ -0,0 +1,3 @@
+# Wrapper module for _elementtree\r
+\r
+from _elementtree import *\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/__init__.py
new file mode 100644 (file)
index 0000000..ee4380b
--- /dev/null
@@ -0,0 +1,8 @@
+"""Python interfaces to XML parsers.\r
+\r
+This package contains one module:\r
+\r
+expat -- Python wrapper for James Clark's Expat parser, with namespace\r
+         support.\r
+\r
+"""\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/expat.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/expat.py
new file mode 100644 (file)
index 0000000..77fed62
--- /dev/null
@@ -0,0 +1,4 @@
+"""Interface to the Expat non-validating XML parser."""\r
+__version__ = '$Revision: 17640 $'\r
+\r
+from pyexpat import *\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/__init__.py
new file mode 100644 (file)
index 0000000..2686c38
--- /dev/null
@@ -0,0 +1,108 @@
+"""Simple API for XML (SAX) implementation for Python.\r
+\r
+This module provides an implementation of the SAX 2 interface;\r
+information about the Java version of the interface can be found at\r
+http://www.megginson.com/SAX/.  The Python version of the interface is\r
+documented at <...>.\r
+\r
+This package contains the following modules:\r
+\r
+handler -- Base classes and constants which define the SAX 2 API for\r
+           the 'client-side' of SAX for Python.\r
+\r
+saxutils -- Implementation of the convenience classes commonly used to\r
+            work with SAX.\r
+\r
+xmlreader -- Base classes and constants which define the SAX 2 API for\r
+             the parsers used with SAX for Python.\r
+\r
+expatreader -- Driver that allows use of the Expat parser with SAX.\r
+"""\r
+\r
+from xmlreader import InputSource\r
+from handler import ContentHandler, ErrorHandler\r
+from _exceptions import SAXException, SAXNotRecognizedException, \\r
+                        SAXParseException, SAXNotSupportedException, \\r
+                        SAXReaderNotAvailable\r
+\r
+\r
+def parse(source, handler, errorHandler=ErrorHandler()):\r
+    parser = make_parser()\r
+    parser.setContentHandler(handler)\r
+    parser.setErrorHandler(errorHandler)\r
+    parser.parse(source)\r
+\r
+def parseString(string, handler, errorHandler=ErrorHandler()):\r
+    try:\r
+        from cStringIO import StringIO\r
+    except ImportError:\r
+        from StringIO import StringIO\r
+\r
+    if errorHandler is None:\r
+        errorHandler = ErrorHandler()\r
+    parser = make_parser()\r
+    parser.setContentHandler(handler)\r
+    parser.setErrorHandler(errorHandler)\r
+\r
+    inpsrc = InputSource()\r
+    inpsrc.setByteStream(StringIO(string))\r
+    parser.parse(inpsrc)\r
+\r
+# this is the parser list used by the make_parser function if no\r
+# alternatives are given as parameters to the function\r
+\r
+default_parser_list = ["xml.sax.expatreader"]\r
+\r
+# tell modulefinder that importing sax potentially imports expatreader\r
+_false = 0\r
+if _false:\r
+    import xml.sax.expatreader\r
+\r
+import os, sys\r
+if "PY_SAX_PARSER" in os.environ:\r
+    default_parser_list = os.environ["PY_SAX_PARSER"].split(",")\r
+del os\r
+\r
+_key = "python.xml.sax.parser"\r
+if sys.platform[:4] == "java" and sys.registry.containsKey(_key):\r
+    default_parser_list = sys.registry.getProperty(_key).split(",")\r
+\r
+\r
+def make_parser(parser_list = []):\r
+    """Creates and returns a SAX parser.\r
+\r
+    Creates the first parser it is able to instantiate of the ones\r
+    given in the list created by doing parser_list +\r
+    default_parser_list.  The lists must contain the names of Python\r
+    modules containing both a SAX parser and a create_parser function."""\r
+\r
+    for parser_name in parser_list + default_parser_list:\r
+        try:\r
+            return _create_parser(parser_name)\r
+        except ImportError,e:\r
+            import sys\r
+            if parser_name in sys.modules:\r
+                # The parser module was found, but importing it\r
+                # failed unexpectedly, pass this exception through\r
+                raise\r
+        except SAXReaderNotAvailable:\r
+            # The parser module detected that it won't work properly,\r
+            # so try the next one\r
+            pass\r
+\r
+    raise SAXReaderNotAvailable("No parsers found", None)\r
+\r
+# --- Internal utility methods used by make_parser\r
+\r
+if sys.platform[ : 4] == "java":\r
+    def _create_parser(parser_name):\r
+        from org.python.core import imp\r
+        drv_module = imp.importName(parser_name, 0, globals())\r
+        return drv_module.create_parser()\r
+\r
+else:\r
+    def _create_parser(parser_name):\r
+        drv_module = __import__(parser_name,{},{},['create_parser'])\r
+        return drv_module.create_parser()\r
+\r
+del sys\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/_exceptions.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/_exceptions.py
new file mode 100644 (file)
index 0000000..8477f0e
--- /dev/null
@@ -0,0 +1,131 @@
+"""Different kinds of SAX Exceptions"""\r
+import sys\r
+if sys.platform[:4] == "java":\r
+    from java.lang import Exception\r
+del sys\r
+\r
+# ===== SAXEXCEPTION =====\r
+\r
+class SAXException(Exception):\r
+    """Encapsulate an XML error or warning. This class can contain\r
+    basic error or warning information from either the XML parser or\r
+    the application: you can subclass it to provide additional\r
+    functionality, or to add localization. Note that although you will\r
+    receive a SAXException as the argument to the handlers in the\r
+    ErrorHandler interface, you are not actually required to raise\r
+    the exception; instead, you can simply read the information in\r
+    it."""\r
+\r
+    def __init__(self, msg, exception=None):\r
+        """Creates an exception. The message is required, but the exception\r
+        is optional."""\r
+        self._msg = msg\r
+        self._exception = exception\r
+        Exception.__init__(self, msg)\r
+\r
+    def getMessage(self):\r
+        "Return a message for this exception."\r
+        return self._msg\r
+\r
+    def getException(self):\r
+        "Return the embedded exception, or None if there was none."\r
+        return self._exception\r
+\r
+    def __str__(self):\r
+        "Create a string representation of the exception."\r
+        return self._msg\r
+\r
+    def __getitem__(self, ix):\r
+        """Avoids weird error messages if someone does exception[ix] by\r
+        mistake, since Exception has __getitem__ defined."""\r
+        raise AttributeError("__getitem__")\r
+\r
+\r
+# ===== SAXPARSEEXCEPTION =====\r
+\r
+class SAXParseException(SAXException):\r
+    """Encapsulate an XML parse error or warning.\r
+\r
+    This exception will include information for locating the error in\r
+    the original XML document. Note that although the application will\r
+    receive a SAXParseException as the argument to the handlers in the\r
+    ErrorHandler interface, the application is not actually required\r
+    to raise the exception; instead, it can simply read the\r
+    information in it and take a different action.\r
+\r
+    Since this exception is a subclass of SAXException, it inherits\r
+    the ability to wrap another exception."""\r
+\r
+    def __init__(self, msg, exception, locator):\r
+        "Creates the exception. The exception parameter is allowed to be None."\r
+        SAXException.__init__(self, msg, exception)\r
+        self._locator = locator\r
+\r
+        # We need to cache this stuff at construction time.\r
+        # If this exception is raised, the objects through which we must\r
+        # traverse to get this information may be deleted by the time\r
+        # it gets caught.\r
+        self._systemId = self._locator.getSystemId()\r
+        self._colnum = self._locator.getColumnNumber()\r
+        self._linenum = self._locator.getLineNumber()\r
+\r
+    def getColumnNumber(self):\r
+        """The column number of the end of the text where the exception\r
+        occurred."""\r
+        return self._colnum\r
+\r
+    def getLineNumber(self):\r
+        "The line number of the end of the text where the exception occurred."\r
+        return self._linenum\r
+\r
+    def getPublicId(self):\r
+        "Get the public identifier of the entity where the exception occurred."\r
+        return self._locator.getPublicId()\r
+\r
+    def getSystemId(self):\r
+        "Get the system identifier of the entity where the exception occurred."\r
+        return self._systemId\r
+\r
+    def __str__(self):\r
+        "Create a string representation of the exception."\r
+        sysid = self.getSystemId()\r
+        if sysid is None:\r
+            sysid = "<unknown>"\r
+        linenum = self.getLineNumber()\r
+        if linenum is None:\r
+            linenum = "?"\r
+        colnum = self.getColumnNumber()\r
+        if colnum is None:\r
+            colnum = "?"\r
+        return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg)\r
+\r
+\r
+# ===== SAXNOTRECOGNIZEDEXCEPTION =====\r
+\r
+class SAXNotRecognizedException(SAXException):\r
+    """Exception class for an unrecognized identifier.\r
+\r
+    An XMLReader will raise this exception when it is confronted with an\r
+    unrecognized feature or property. SAX applications and extensions may\r
+    use this class for similar purposes."""\r
+\r
+\r
+# ===== SAXNOTSUPPORTEDEXCEPTION =====\r
+\r
+class SAXNotSupportedException(SAXException):\r
+    """Exception class for an unsupported operation.\r
+\r
+    An XMLReader will raise this exception when a service it cannot\r
+    perform is requested (specifically setting a state or value). SAX\r
+    applications and extensions may use this class for similar\r
+    purposes."""\r
+\r
+# ===== SAXNOTSUPPORTEDEXCEPTION =====\r
+\r
+class SAXReaderNotAvailable(SAXNotSupportedException):\r
+    """Exception class for a missing driver.\r
+\r
+    An XMLReader module (driver) should raise this exception when it\r
+    is first imported, e.g. when a support module cannot be imported.\r
+    It also may be raised during parsing, e.g. if executing an external\r
+    program is not permitted."""\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/expatreader.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/expatreader.py
new file mode 100644 (file)
index 0000000..f573311
--- /dev/null
@@ -0,0 +1,430 @@
+"""\r
+SAX driver for the pyexpat C module.  This driver works with\r
+pyexpat.__version__ == '2.22'.\r
+"""\r
+\r
+version = "0.20"\r
+\r
+from xml.sax._exceptions import *\r
+from xml.sax.handler import feature_validation, feature_namespaces\r
+from xml.sax.handler import feature_namespace_prefixes\r
+from xml.sax.handler import feature_external_ges, feature_external_pes\r
+from xml.sax.handler import feature_string_interning\r
+from xml.sax.handler import property_xml_string, property_interning_dict\r
+\r
+# xml.parsers.expat does not raise ImportError in Jython\r
+import sys\r
+if sys.platform[:4] == "java":\r
+    raise SAXReaderNotAvailable("expat not available in Java", None)\r
+del sys\r
+\r
+try:\r
+    from xml.parsers import expat\r
+except ImportError:\r
+    raise SAXReaderNotAvailable("expat not supported", None)\r
+else:\r
+    if not hasattr(expat, "ParserCreate"):\r
+        raise SAXReaderNotAvailable("expat not supported", None)\r
+from xml.sax import xmlreader, saxutils, handler\r
+\r
+AttributesImpl = xmlreader.AttributesImpl\r
+AttributesNSImpl = xmlreader.AttributesNSImpl\r
+\r
+# If we're using a sufficiently recent version of Python, we can use\r
+# weak references to avoid cycles between the parser and content\r
+# handler, otherwise we'll just have to pretend.\r
+try:\r
+    import _weakref\r
+except ImportError:\r
+    def _mkproxy(o):\r
+        return o\r
+else:\r
+    import weakref\r
+    _mkproxy = weakref.proxy\r
+    del weakref, _weakref\r
+\r
+class _ClosedParser:\r
+    pass\r
+\r
+# --- ExpatLocator\r
+\r
+class ExpatLocator(xmlreader.Locator):\r
+    """Locator for use with the ExpatParser class.\r
+\r
+    This uses a weak reference to the parser object to avoid creating\r
+    a circular reference between the parser and the content handler.\r
+    """\r
+    def __init__(self, parser):\r
+        self._ref = _mkproxy(parser)\r
+\r
+    def getColumnNumber(self):\r
+        parser = self._ref\r
+        if parser._parser is None:\r
+            return None\r
+        return parser._parser.ErrorColumnNumber\r
+\r
+    def getLineNumber(self):\r
+        parser = self._ref\r
+        if parser._parser is None:\r
+            return 1\r
+        return parser._parser.ErrorLineNumber\r
+\r
+    def getPublicId(self):\r
+        parser = self._ref\r
+        if parser is None:\r
+            return None\r
+        return parser._source.getPublicId()\r
+\r
+    def getSystemId(self):\r
+        parser = self._ref\r
+        if parser is None:\r
+            return None\r
+        return parser._source.getSystemId()\r
+\r
+\r
+# --- ExpatParser\r
+\r
+class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):\r
+    """SAX driver for the pyexpat C module."""\r
+\r
+    def __init__(self, namespaceHandling=0, bufsize=2**16-20):\r
+        xmlreader.IncrementalParser.__init__(self, bufsize)\r
+        self._source = xmlreader.InputSource()\r
+        self._parser = None\r
+        self._namespaces = namespaceHandling\r
+        self._lex_handler_prop = None\r
+        self._parsing = 0\r
+        self._entity_stack = []\r
+        self._external_ges = 1\r
+        self._interning = None\r
+\r
+    # XMLReader methods\r
+\r
+    def parse(self, source):\r
+        "Parse an XML document from a URL or an InputSource."\r
+        source = saxutils.prepare_input_source(source)\r
+\r
+        self._source = source\r
+        self.reset()\r
+        self._cont_handler.setDocumentLocator(ExpatLocator(self))\r
+        xmlreader.IncrementalParser.parse(self, source)\r
+\r
+    def prepareParser(self, source):\r
+        if source.getSystemId() is not None:\r
+            base = source.getSystemId()\r
+            if isinstance(base, unicode):\r
+                base = base.encode('utf-8')\r
+            self._parser.SetBase(base)\r
+\r
+    # Redefined setContentHandler to allow changing handlers during parsing\r
+\r
+    def setContentHandler(self, handler):\r
+        xmlreader.IncrementalParser.setContentHandler(self, handler)\r
+        if self._parsing:\r
+            self._reset_cont_handler()\r
+\r
+    def getFeature(self, name):\r
+        if name == feature_namespaces:\r
+            return self._namespaces\r
+        elif name == feature_string_interning:\r
+            return self._interning is not None\r
+        elif name in (feature_validation, feature_external_pes,\r
+                      feature_namespace_prefixes):\r
+            return 0\r
+        elif name == feature_external_ges:\r
+            return self._external_ges\r
+        raise SAXNotRecognizedException("Feature '%s' not recognized" % name)\r
+\r
+    def setFeature(self, name, state):\r
+        if self._parsing:\r
+            raise SAXNotSupportedException("Cannot set features while parsing")\r
+\r
+        if name == feature_namespaces:\r
+            self._namespaces = state\r
+        elif name == feature_external_ges:\r
+            self._external_ges = state\r
+        elif name == feature_string_interning:\r
+            if state:\r
+                if self._interning is None:\r
+                    self._interning = {}\r
+            else:\r
+                self._interning = None\r
+        elif name == feature_validation:\r
+            if state:\r
+                raise SAXNotSupportedException(\r
+                    "expat does not support validation")\r
+        elif name == feature_external_pes:\r
+            if state:\r
+                raise SAXNotSupportedException(\r
+                    "expat does not read external parameter entities")\r
+        elif name == feature_namespace_prefixes:\r
+            if state:\r
+                raise SAXNotSupportedException(\r
+                    "expat does not report namespace prefixes")\r
+        else:\r
+            raise SAXNotRecognizedException(\r
+                "Feature '%s' not recognized" % name)\r
+\r
+    def getProperty(self, name):\r
+        if name == handler.property_lexical_handler:\r
+            return self._lex_handler_prop\r
+        elif name == property_interning_dict:\r
+            return self._interning\r
+        elif name == property_xml_string:\r
+            if self._parser:\r
+                if hasattr(self._parser, "GetInputContext"):\r
+                    return self._parser.GetInputContext()\r
+                else:\r
+                    raise SAXNotRecognizedException(\r
+                        "This version of expat does not support getting"\r
+                        " the XML string")\r
+            else:\r
+                raise SAXNotSupportedException(\r
+                    "XML string cannot be returned when not parsing")\r
+        raise SAXNotRecognizedException("Property '%s' not recognized" % name)\r
+\r
+    def setProperty(self, name, value):\r
+        if name == handler.property_lexical_handler:\r
+            self._lex_handler_prop = value\r
+            if self._parsing:\r
+                self._reset_lex_handler_prop()\r
+        elif name == property_interning_dict:\r
+            self._interning = value\r
+        elif name == property_xml_string:\r
+            raise SAXNotSupportedException("Property '%s' cannot be set" %\r
+                                           name)\r
+        else:\r
+            raise SAXNotRecognizedException("Property '%s' not recognized" %\r
+                                            name)\r
+\r
+    # IncrementalParser methods\r
+\r
+    def feed(self, data, isFinal = 0):\r
+        if not self._parsing:\r
+            self.reset()\r
+            self._parsing = 1\r
+            self._cont_handler.startDocument()\r
+\r
+        try:\r
+            # The isFinal parameter is internal to the expat reader.\r
+            # If it is set to true, expat will check validity of the entire\r
+            # document. When feeding chunks, they are not normally final -\r
+            # except when invoked from close.\r
+            self._parser.Parse(data, isFinal)\r
+        except expat.error, e:\r
+            exc = SAXParseException(expat.ErrorString(e.code), e, self)\r
+            # FIXME: when to invoke error()?\r
+            self._err_handler.fatalError(exc)\r
+\r
+    def close(self):\r
+        if (self._entity_stack or self._parser is None or\r
+            isinstance(self._parser, _ClosedParser)):\r
+            # If we are completing an external entity, do nothing here\r
+            return\r
+        try:\r
+            self.feed("", isFinal = 1)\r
+            self._cont_handler.endDocument()\r
+            self._parsing = 0\r
+            # break cycle created by expat handlers pointing to our methods\r
+            self._parser = None\r
+        finally:\r
+            self._parsing = 0\r
+            if self._parser is not None:\r
+                # Keep ErrorColumnNumber and ErrorLineNumber after closing.\r
+                parser = _ClosedParser()\r
+                parser.ErrorColumnNumber = self._parser.ErrorColumnNumber\r
+                parser.ErrorLineNumber = self._parser.ErrorLineNumber\r
+                self._parser = parser\r
+\r
+    def _reset_cont_handler(self):\r
+        self._parser.ProcessingInstructionHandler = \\r
+                                    self._cont_handler.processingInstruction\r
+        self._parser.CharacterDataHandler = self._cont_handler.characters\r
+\r
+    def _reset_lex_handler_prop(self):\r
+        lex = self._lex_handler_prop\r
+        parser = self._parser\r
+        if lex is None:\r
+            parser.CommentHandler = None\r
+            parser.StartCdataSectionHandler = None\r
+            parser.EndCdataSectionHandler = None\r
+            parser.StartDoctypeDeclHandler = None\r
+            parser.EndDoctypeDeclHandler = None\r
+        else:\r
+            parser.CommentHandler = lex.comment\r
+            parser.StartCdataSectionHandler = lex.startCDATA\r
+            parser.EndCdataSectionHandler = lex.endCDATA\r
+            parser.StartDoctypeDeclHandler = self.start_doctype_decl\r
+            parser.EndDoctypeDeclHandler = lex.endDTD\r
+\r
+    def reset(self):\r
+        if self._namespaces:\r
+            self._parser = expat.ParserCreate(self._source.getEncoding(), " ",\r
+                                              intern=self._interning)\r
+            self._parser.namespace_prefixes = 1\r
+            self._parser.StartElementHandler = self.start_element_ns\r
+            self._parser.EndElementHandler = self.end_element_ns\r
+        else:\r
+            self._parser = expat.ParserCreate(self._source.getEncoding(),\r
+                                              intern = self._interning)\r
+            self._parser.StartElementHandler = self.start_element\r
+            self._parser.EndElementHandler = self.end_element\r
+\r
+        self._reset_cont_handler()\r
+        self._parser.UnparsedEntityDeclHandler = self.unparsed_entity_decl\r
+        self._parser.NotationDeclHandler = self.notation_decl\r
+        self._parser.StartNamespaceDeclHandler = self.start_namespace_decl\r
+        self._parser.EndNamespaceDeclHandler = self.end_namespace_decl\r
+\r
+        self._decl_handler_prop = None\r
+        if self._lex_handler_prop:\r
+            self._reset_lex_handler_prop()\r
+#         self._parser.DefaultHandler =\r
+#         self._parser.DefaultHandlerExpand =\r
+#         self._parser.NotStandaloneHandler =\r
+        self._parser.ExternalEntityRefHandler = self.external_entity_ref\r
+        try:\r
+            self._parser.SkippedEntityHandler = self.skipped_entity_handler\r
+        except AttributeError:\r
+            # This pyexpat does not support SkippedEntity\r
+            pass\r
+        self._parser.SetParamEntityParsing(\r
+            expat.XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)\r
+\r
+        self._parsing = 0\r
+        self._entity_stack = []\r
+\r
+    # Locator methods\r
+\r
+    def getColumnNumber(self):\r
+        if self._parser is None:\r
+            return None\r
+        return self._parser.ErrorColumnNumber\r
+\r
+    def getLineNumber(self):\r
+        if self._parser is None:\r
+            return 1\r
+        return self._parser.ErrorLineNumber\r
+\r
+    def getPublicId(self):\r
+        return self._source.getPublicId()\r
+\r
+    def getSystemId(self):\r
+        return self._source.getSystemId()\r
+\r
+    # event handlers\r
+    def start_element(self, name, attrs):\r
+        self._cont_handler.startElement(name, AttributesImpl(attrs))\r
+\r
+    def end_element(self, name):\r
+        self._cont_handler.endElement(name)\r
+\r
+    def start_element_ns(self, name, attrs):\r
+        pair = name.split()\r
+        if len(pair) == 1:\r
+            # no namespace\r
+            pair = (None, name)\r
+        elif len(pair) == 3:\r
+            pair = pair[0], pair[1]\r
+        else:\r
+            # default namespace\r
+            pair = tuple(pair)\r
+\r
+        newattrs = {}\r
+        qnames = {}\r
+        for (aname, value) in attrs.items():\r
+            parts = aname.split()\r
+            length = len(parts)\r
+            if length == 1:\r
+                # no namespace\r
+                qname = aname\r
+                apair = (None, aname)\r
+            elif length == 3:\r
+                qname = "%s:%s" % (parts[2], parts[1])\r
+                apair = parts[0], parts[1]\r
+            else:\r
+                # default namespace\r
+                qname = parts[1]\r
+                apair = tuple(parts)\r
+\r
+            newattrs[apair] = value\r
+            qnames[apair] = qname\r
+\r
+        self._cont_handler.startElementNS(pair, None,\r
+                                          AttributesNSImpl(newattrs, qnames))\r
+\r
+    def end_element_ns(self, name):\r
+        pair = name.split()\r
+        if len(pair) == 1:\r
+            pair = (None, name)\r
+        elif len(pair) == 3:\r
+            pair = pair[0], pair[1]\r
+        else:\r
+            pair = tuple(pair)\r
+\r
+        self._cont_handler.endElementNS(pair, None)\r
+\r
+    # this is not used (call directly to ContentHandler)\r
+    def processing_instruction(self, target, data):\r
+        self._cont_handler.processingInstruction(target, data)\r
+\r
+    # this is not used (call directly to ContentHandler)\r
+    def character_data(self, data):\r
+        self._cont_handler.characters(data)\r
+\r
+    def start_namespace_decl(self, prefix, uri):\r
+        self._cont_handler.startPrefixMapping(prefix, uri)\r
+\r
+    def end_namespace_decl(self, prefix):\r
+        self._cont_handler.endPrefixMapping(prefix)\r
+\r
+    def start_doctype_decl(self, name, sysid, pubid, has_internal_subset):\r
+        self._lex_handler_prop.startDTD(name, pubid, sysid)\r
+\r
+    def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name):\r
+        self._dtd_handler.unparsedEntityDecl(name, pubid, sysid, notation_name)\r
+\r
+    def notation_decl(self, name, base, sysid, pubid):\r
+        self._dtd_handler.notationDecl(name, pubid, sysid)\r
+\r
+    def external_entity_ref(self, context, base, sysid, pubid):\r
+        if not self._external_ges:\r
+            return 1\r
+\r
+        source = self._ent_handler.resolveEntity(pubid, sysid)\r
+        source = saxutils.prepare_input_source(source,\r
+                                               self._source.getSystemId() or\r
+                                               "")\r
+\r
+        self._entity_stack.append((self._parser, self._source))\r
+        self._parser = self._parser.ExternalEntityParserCreate(context)\r
+        self._source = source\r
+\r
+        try:\r
+            xmlreader.IncrementalParser.parse(self, source)\r
+        except:\r
+            return 0  # FIXME: save error info here?\r
+\r
+        (self._parser, self._source) = self._entity_stack[-1]\r
+        del self._entity_stack[-1]\r
+        return 1\r
+\r
+    def skipped_entity_handler(self, name, is_pe):\r
+        if is_pe:\r
+            # The SAX spec requires to report skipped PEs with a '%'\r
+            name = '%'+name\r
+        self._cont_handler.skippedEntity(name)\r
+\r
+# ---\r
+\r
+def create_parser(*args, **kwargs):\r
+    return ExpatParser(*args, **kwargs)\r
+\r
+# ---\r
+\r
+if __name__ == "__main__":\r
+    import xml.sax.saxutils\r
+    p = create_parser()\r
+    p.setContentHandler(xml.sax.saxutils.XMLGenerator())\r
+    p.setErrorHandler(xml.sax.ErrorHandler())\r
+    p.parse("http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml")\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/handler.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/handler.py
new file mode 100644 (file)
index 0000000..378f4f1
--- /dev/null
@@ -0,0 +1,342 @@
+"""\r
+This module contains the core classes of version 2.0 of SAX for Python.\r
+This file provides only default classes with absolutely minimum\r
+functionality, from which drivers and applications can be subclassed.\r
+\r
+Many of these classes are empty and are included only as documentation\r
+of the interfaces.\r
+\r
+$Id$\r
+"""\r
+\r
+version = '2.0beta'\r
+\r
+#============================================================================\r
+#\r
+# HANDLER INTERFACES\r
+#\r
+#============================================================================\r
+\r
+# ===== ERRORHANDLER =====\r
+\r
+class ErrorHandler:\r
+    """Basic interface for SAX error handlers.\r
+\r
+    If you create an object that implements this interface, then\r
+    register the object with your XMLReader, the parser will call the\r
+    methods in your object to report all warnings and errors. There\r
+    are three levels of errors available: warnings, (possibly)\r
+    recoverable errors, and unrecoverable errors. All methods take a\r
+    SAXParseException as the only parameter."""\r
+\r
+    def error(self, exception):\r
+        "Handle a recoverable error."\r
+        raise exception\r
+\r
+    def fatalError(self, exception):\r
+        "Handle a non-recoverable error."\r
+        raise exception\r
+\r
+    def warning(self, exception):\r
+        "Handle a warning."\r
+        print exception\r
+\r
+\r
+# ===== CONTENTHANDLER =====\r
+\r
+class ContentHandler:\r
+    """Interface for receiving logical document content events.\r
+\r
+    This is the main callback interface in SAX, and the one most\r
+    important to applications. The order of events in this interface\r
+    mirrors the order of the information in the document."""\r
+\r
+    def __init__(self):\r
+        self._locator = None\r
+\r
+    def setDocumentLocator(self, locator):\r
+        """Called by the parser to give the application a locator for\r
+        locating the origin of document events.\r
+\r
+        SAX parsers are strongly encouraged (though not absolutely\r
+        required) to supply a locator: if it does so, it must supply\r
+        the locator to the application by invoking this method before\r
+        invoking any of the other methods in the DocumentHandler\r
+        interface.\r
+\r
+        The locator allows the application to determine the end\r
+        position of any document-related event, even if the parser is\r
+        not reporting an error. Typically, the application will use\r
+        this information for reporting its own errors (such as\r
+        character content that does not match an application's\r
+        business rules). The information returned by the locator is\r
+        probably not sufficient for use with a search engine.\r
+\r
+        Note that the locator will return correct information only\r
+        during the invocation of the events in this interface. The\r
+        application should not attempt to use it at any other time."""\r
+        self._locator = locator\r
+\r
+    def startDocument(self):\r
+        """Receive notification of the beginning of a document.\r
+\r
+        The SAX parser will invoke this method only once, before any\r
+        other methods in this interface or in DTDHandler (except for\r
+        setDocumentLocator)."""\r
+\r
+    def endDocument(self):\r
+        """Receive notification of the end of a document.\r
+\r
+        The SAX parser will invoke this method only once, and it will\r
+        be the last method invoked during the parse. The parser shall\r
+        not invoke this method until it has either abandoned parsing\r
+        (because of an unrecoverable error) or reached the end of\r
+        input."""\r
+\r
+    def startPrefixMapping(self, prefix, uri):\r
+        """Begin the scope of a prefix-URI Namespace mapping.\r
+\r
+        The information from this event is not necessary for normal\r
+        Namespace processing: the SAX XML reader will automatically\r
+        replace prefixes for element and attribute names when the\r
+        http://xml.org/sax/features/namespaces feature is true (the\r
+        default).\r
+\r
+        There are cases, however, when applications need to use\r
+        prefixes in character data or in attribute values, where they\r
+        cannot safely be expanded automatically; the\r
+        start/endPrefixMapping event supplies the information to the\r
+        application to expand prefixes in those contexts itself, if\r
+        necessary.\r
+\r
+        Note that start/endPrefixMapping events are not guaranteed to\r
+        be properly nested relative to each-other: all\r
+        startPrefixMapping events will occur before the corresponding\r
+        startElement event, and all endPrefixMapping events will occur\r
+        after the corresponding endElement event, but their order is\r
+        not guaranteed."""\r
+\r
+    def endPrefixMapping(self, prefix):\r
+        """End the scope of a prefix-URI mapping.\r
+\r
+        See startPrefixMapping for details. This event will always\r
+        occur after the corresponding endElement event, but the order\r
+        of endPrefixMapping events is not otherwise guaranteed."""\r
+\r
+    def startElement(self, name, attrs):\r
+        """Signals the start of an element in non-namespace mode.\r
+\r
+        The name parameter contains the raw XML 1.0 name of the\r
+        element type as a string and the attrs parameter holds an\r
+        instance of the Attributes class containing the attributes of\r
+        the element."""\r
+\r
+    def endElement(self, name):\r
+        """Signals the end of an element in non-namespace mode.\r
+\r
+        The name parameter contains the name of the element type, just\r
+        as with the startElement event."""\r
+\r
+    def startElementNS(self, name, qname, attrs):\r
+        """Signals the start of an element in namespace mode.\r
+\r
+        The name parameter contains the name of the element type as a\r
+        (uri, localname) tuple, the qname parameter the raw XML 1.0\r
+        name used in the source document, and the attrs parameter\r
+        holds an instance of the Attributes class containing the\r
+        attributes of the element.\r
+\r
+        The uri part of the name tuple is None for elements which have\r
+        no namespace."""\r
+\r
+    def endElementNS(self, name, qname):\r
+        """Signals the end of an element in namespace mode.\r
+\r
+        The name parameter contains the name of the element type, just\r
+        as with the startElementNS event."""\r
+\r
+    def characters(self, content):\r
+        """Receive notification of character data.\r
+\r
+        The Parser will call this method to report each chunk of\r
+        character data. SAX parsers may return all contiguous\r
+        character data in a single chunk, or they may split it into\r
+        several chunks; however, all of the characters in any single\r
+        event must come from the same external entity so that the\r
+        Locator provides useful information."""\r
+\r
+    def ignorableWhitespace(self, whitespace):\r
+        """Receive notification of ignorable whitespace in element content.\r
+\r
+        Validating Parsers must use this method to report each chunk\r
+        of ignorable whitespace (see the W3C XML 1.0 recommendation,\r
+        section 2.10): non-validating parsers may also use this method\r
+        if they are capable of parsing and using content models.\r
+\r
+        SAX parsers may return all contiguous whitespace in a single\r
+        chunk, or they may split it into several chunks; however, all\r
+        of the characters in any single event must come from the same\r
+        external entity, so that the Locator provides useful\r
+        information."""\r
+\r
+    def processingInstruction(self, target, data):\r
+        """Receive notification of a processing instruction.\r
+\r
+        The Parser will invoke this method once for each processing\r
+        instruction found: note that processing instructions may occur\r
+        before or after the main document element.\r
+\r
+        A SAX parser should never report an XML declaration (XML 1.0,\r
+        section 2.8) or a text declaration (XML 1.0, section 4.3.1)\r
+        using this method."""\r
+\r
+    def skippedEntity(self, name):\r
+        """Receive notification of a skipped entity.\r
+\r
+        The Parser will invoke this method once for each entity\r
+        skipped. Non-validating processors may skip entities if they\r
+        have not seen the declarations (because, for example, the\r
+        entity was declared in an external DTD subset). All processors\r
+        may skip external entities, depending on the values of the\r
+        http://xml.org/sax/features/external-general-entities and the\r
+        http://xml.org/sax/features/external-parameter-entities\r
+        properties."""\r
+\r
+\r
+# ===== DTDHandler =====\r
+\r
+class DTDHandler:\r
+    """Handle DTD events.\r
+\r
+    This interface specifies only those DTD events required for basic\r
+    parsing (unparsed entities and attributes)."""\r
+\r
+    def notationDecl(self, name, publicId, systemId):\r
+        "Handle a notation declaration event."\r
+\r
+    def unparsedEntityDecl(self, name, publicId, systemId, ndata):\r
+        "Handle an unparsed entity declaration event."\r
+\r
+\r
+# ===== ENTITYRESOLVER =====\r
+\r
+class EntityResolver:\r
+    """Basic interface for resolving entities. If you create an object\r
+    implementing this interface, then register the object with your\r
+    Parser, the parser will call the method in your object to\r
+    resolve all external entities. Note that DefaultHandler implements\r
+    this interface with the default behaviour."""\r
+\r
+    def resolveEntity(self, publicId, systemId):\r
+        """Resolve the system identifier of an entity and return either\r
+        the system identifier to read from as a string, or an InputSource\r
+        to read from."""\r
+        return systemId\r
+\r
+\r
+#============================================================================\r
+#\r
+# CORE FEATURES\r
+#\r
+#============================================================================\r
+\r
+feature_namespaces = "http://xml.org/sax/features/namespaces"\r
+# true: Perform Namespace processing (default).\r
+# false: Optionally do not perform Namespace processing\r
+#        (implies namespace-prefixes).\r
+# access: (parsing) read-only; (not parsing) read/write\r
+\r
+feature_namespace_prefixes = "http://xml.org/sax/features/namespace-prefixes"\r
+# true: Report the original prefixed names and attributes used for Namespace\r
+#       declarations.\r
+# false: Do not report attributes used for Namespace declarations, and\r
+#        optionally do not report original prefixed names (default).\r
+# access: (parsing) read-only; (not parsing) read/write\r
+\r
+feature_string_interning = "http://xml.org/sax/features/string-interning"\r
+# true: All element names, prefixes, attribute names, Namespace URIs, and\r
+#       local names are interned using the built-in intern function.\r
+# false: Names are not necessarily interned, although they may be (default).\r
+# access: (parsing) read-only; (not parsing) read/write\r
+\r
+feature_validation = "http://xml.org/sax/features/validation"\r
+# true: Report all validation errors (implies external-general-entities and\r
+#       external-parameter-entities).\r
+# false: Do not report validation errors.\r
+# access: (parsing) read-only; (not parsing) read/write\r
+\r
+feature_external_ges = "http://xml.org/sax/features/external-general-entities"\r
+# true: Include all external general (text) entities.\r
+# false: Do not include external general entities.\r
+# access: (parsing) read-only; (not parsing) read/write\r
+\r
+feature_external_pes = "http://xml.org/sax/features/external-parameter-entities"\r
+# true: Include all external parameter entities, including the external\r
+#       DTD subset.\r
+# false: Do not include any external parameter entities, even the external\r
+#        DTD subset.\r
+# access: (parsing) read-only; (not parsing) read/write\r
+\r
+all_features = [feature_namespaces,\r
+                feature_namespace_prefixes,\r
+                feature_string_interning,\r
+                feature_validation,\r
+                feature_external_ges,\r
+                feature_external_pes]\r
+\r
+\r
+#============================================================================\r
+#\r
+# CORE PROPERTIES\r
+#\r
+#============================================================================\r
+\r
+property_lexical_handler = "http://xml.org/sax/properties/lexical-handler"\r
+# data type: xml.sax.sax2lib.LexicalHandler\r
+# description: An optional extension handler for lexical events like comments.\r
+# access: read/write\r
+\r
+property_declaration_handler = "http://xml.org/sax/properties/declaration-handler"\r
+# data type: xml.sax.sax2lib.DeclHandler\r
+# description: An optional extension handler for DTD-related events other\r
+#              than notations and unparsed entities.\r
+# access: read/write\r
+\r
+property_dom_node = "http://xml.org/sax/properties/dom-node"\r
+# data type: org.w3c.dom.Node\r
+# description: When parsing, the current DOM node being visited if this is\r
+#              a DOM iterator; when not parsing, the root DOM node for\r
+#              iteration.\r
+# access: (parsing) read-only; (not parsing) read/write\r
+\r
+property_xml_string = "http://xml.org/sax/properties/xml-string"\r
+# data type: String\r
+# description: The literal string of characters that was the source for\r
+#              the current event.\r
+# access: read-only\r
+\r
+property_encoding = "http://www.python.org/sax/properties/encoding"\r
+# data type: String\r
+# description: The name of the encoding to assume for input data.\r
+# access: write: set the encoding, e.g. established by a higher-level\r
+#                protocol. May change during parsing (e.g. after\r
+#                processing a META tag)\r
+#         read:  return the current encoding (possibly established through\r
+#                auto-detection.\r
+# initial value: UTF-8\r
+#\r
+\r
+property_interning_dict = "http://www.python.org/sax/properties/interning-dict"\r
+# data type: Dictionary\r
+# description: The dictionary used to intern common strings in the document\r
+# access: write: Request that the parser uses a specific dictionary, to\r
+#                allow interning across different documents\r
+#         read:  return the current interning dictionary, or None\r
+#\r
+\r
+all_properties = [property_lexical_handler,\r
+                  property_dom_node,\r
+                  property_declaration_handler,\r
+                  property_xml_string,\r
+                  property_encoding,\r
+                  property_interning_dict]\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/saxutils.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/saxutils.py
new file mode 100644 (file)
index 0000000..674df6d
--- /dev/null
@@ -0,0 +1,353 @@
+"""\\r
+A library of useful helper classes to the SAX classes, for the\r
+convenience of application and driver writers.\r
+"""\r
+\r
+import os, urlparse, urllib, types\r
+import io\r
+import sys\r
+import handler\r
+import xmlreader\r
+\r
+try:\r
+    _StringTypes = [types.StringType, types.UnicodeType]\r
+except AttributeError:\r
+    _StringTypes = [types.StringType]\r
+\r
+def __dict_replace(s, d):\r
+    """Replace substrings of a string using a dictionary."""\r
+    for key, value in d.items():\r
+        s = s.replace(key, value)\r
+    return s\r
+\r
+def escape(data, entities={}):\r
+    """Escape &, <, and > in a string of data.\r
+\r
+    You can escape other strings of data by passing a dictionary as\r
+    the optional entities parameter.  The keys and values must all be\r
+    strings; each key will be replaced with its corresponding value.\r
+    """\r
+\r
+    # must do ampersand first\r
+    data = data.replace("&", "&amp;")\r
+    data = data.replace(">", "&gt;")\r
+    data = data.replace("<", "&lt;")\r
+    if entities:\r
+        data = __dict_replace(data, entities)\r
+    return data\r
+\r
+def unescape(data, entities={}):\r
+    """Unescape &amp;, &lt;, and &gt; in a string of data.\r
+\r
+    You can unescape other strings of data by passing a dictionary as\r
+    the optional entities parameter.  The keys and values must all be\r
+    strings; each key will be replaced with its corresponding value.\r
+    """\r
+    data = data.replace("&lt;", "<")\r
+    data = data.replace("&gt;", ">")\r
+    if entities:\r
+        data = __dict_replace(data, entities)\r
+    # must do ampersand last\r
+    return data.replace("&amp;", "&")\r
+\r
+def quoteattr(data, entities={}):\r
+    """Escape and quote an attribute value.\r
+\r
+    Escape &, <, and > in a string of data, then quote it for use as\r
+    an attribute value.  The \" character will be escaped as well, if\r
+    necessary.\r
+\r
+    You can escape other strings of data by passing a dictionary as\r
+    the optional entities parameter.  The keys and values must all be\r
+    strings; each key will be replaced with its corresponding value.\r
+    """\r
+    entities = entities.copy()\r
+    entities.update({'\n': '&#10;', '\r': '&#13;', '\t':'&#9;'})\r
+    data = escape(data, entities)\r
+    if '"' in data:\r
+        if "'" in data:\r
+            data = '"%s"' % data.replace('"', "&quot;")\r
+        else:\r
+            data = "'%s'" % data\r
+    else:\r
+        data = '"%s"' % data\r
+    return data\r
+\r
+\r
+def _gettextwriter(out, encoding):\r
+    if out is None:\r
+        import sys\r
+        out = sys.stdout\r
+\r
+    if isinstance(out, io.RawIOBase):\r
+        buffer = io.BufferedIOBase(out)\r
+        # Keep the original file open when the TextIOWrapper is\r
+        # destroyed\r
+        buffer.close = lambda: None\r
+    else:\r
+        # This is to handle passed objects that aren't in the\r
+        # IOBase hierarchy, but just have a write method\r
+        buffer = io.BufferedIOBase()\r
+        buffer.writable = lambda: True\r
+        buffer.write = out.write\r
+        try:\r
+            # TextIOWrapper uses this methods to determine\r
+            # if BOM (for UTF-16, etc) should be added\r
+            buffer.seekable = out.seekable\r
+            buffer.tell = out.tell\r
+        except AttributeError:\r
+            pass\r
+    # wrap a binary writer with TextIOWrapper\r
+    return _UnbufferedTextIOWrapper(buffer, encoding=encoding,\r
+                                   errors='xmlcharrefreplace',\r
+                                   newline='\n')\r
+\r
+\r
+class _UnbufferedTextIOWrapper(io.TextIOWrapper):\r
+    def write(self, s):\r
+        super(_UnbufferedTextIOWrapper, self).write(s)\r
+        self.flush()\r
+\r
+\r
+class XMLGenerator(handler.ContentHandler):\r
+\r
+    def __init__(self, out=None, encoding="iso-8859-1"):\r
+        handler.ContentHandler.__init__(self)\r
+        out = _gettextwriter(out, encoding)\r
+        self._write = out.write\r
+        self._flush = out.flush\r
+        self._ns_contexts = [{}] # contains uri -> prefix dicts\r
+        self._current_context = self._ns_contexts[-1]\r
+        self._undeclared_ns_maps = []\r
+        self._encoding = encoding\r
+\r
+    def _qname(self, name):\r
+        """Builds a qualified name from a (ns_url, localname) pair"""\r
+        if name[0]:\r
+            # Per http://www.w3.org/XML/1998/namespace, The 'xml' prefix is\r
+            # bound by definition to http://www.w3.org/XML/1998/namespace.  It\r
+            # does not need to be declared and will not usually be found in\r
+            # self._current_context.\r
+            if 'http://www.w3.org/XML/1998/namespace' == name[0]:\r
+                return 'xml:' + name[1]\r
+            # The name is in a non-empty namespace\r
+            prefix = self._current_context[name[0]]\r
+            if prefix:\r
+                # If it is not the default namespace, prepend the prefix\r
+                return prefix + ":" + name[1]\r
+        # Return the unqualified name\r
+        return name[1]\r
+\r
+    # ContentHandler methods\r
+\r
+    def startDocument(self):\r
+        self._write(u'<?xml version="1.0" encoding="%s"?>\n' %\r
+                        self._encoding)\r
+\r
+    def endDocument(self):\r
+        self._flush()\r
+\r
+    def startPrefixMapping(self, prefix, uri):\r
+        self._ns_contexts.append(self._current_context.copy())\r
+        self._current_context[uri] = prefix\r
+        self._undeclared_ns_maps.append((prefix, uri))\r
+\r
+    def endPrefixMapping(self, prefix):\r
+        self._current_context = self._ns_contexts[-1]\r
+        del self._ns_contexts[-1]\r
+\r
+    def startElement(self, name, attrs):\r
+        self._write(u'<' + name)\r
+        for (name, value) in attrs.items():\r
+            self._write(u' %s=%s' % (name, quoteattr(value)))\r
+        self._write(u'>')\r
+\r
+    def endElement(self, name):\r
+        self._write(u'</%s>' % name)\r
+\r
+    def startElementNS(self, name, qname, attrs):\r
+        self._write(u'<' + self._qname(name))\r
+\r
+        for prefix, uri in self._undeclared_ns_maps:\r
+            if prefix:\r
+                self._write(u' xmlns:%s="%s"' % (prefix, uri))\r
+            else:\r
+                self._write(u' xmlns="%s"' % uri)\r
+        self._undeclared_ns_maps = []\r
+\r
+        for (name, value) in attrs.items():\r
+            self._write(u' %s=%s' % (self._qname(name), quoteattr(value)))\r
+        self._write(u'>')\r
+\r
+    def endElementNS(self, name, qname):\r
+        self._write(u'</%s>' % self._qname(name))\r
+\r
+    def characters(self, content):\r
+        if not isinstance(content, unicode):\r
+            content = unicode(content, self._encoding)\r
+        self._write(escape(content))\r
+\r
+    def ignorableWhitespace(self, content):\r
+        if not isinstance(content, unicode):\r
+            content = unicode(content, self._encoding)\r
+        self._write(content)\r
+\r
+    def processingInstruction(self, target, data):\r
+        self._write(u'<?%s %s?>' % (target, data))\r
+\r
+\r
+class XMLFilterBase(xmlreader.XMLReader):\r
+    """This class is designed to sit between an XMLReader and the\r
+    client application's event handlers.  By default, it does nothing\r
+    but pass requests up to the reader and events on to the handlers\r
+    unmodified, but subclasses can override specific methods to modify\r
+    the event stream or the configuration requests as they pass\r
+    through."""\r
+\r
+    def __init__(self, parent = None):\r
+        xmlreader.XMLReader.__init__(self)\r
+        self._parent = parent\r
+\r
+    # ErrorHandler methods\r
+\r
+    def error(self, exception):\r
+        self._err_handler.error(exception)\r
+\r
+    def fatalError(self, exception):\r
+        self._err_handler.fatalError(exception)\r
+\r
+    def warning(self, exception):\r
+        self._err_handler.warning(exception)\r
+\r
+    # ContentHandler methods\r
+\r
+    def setDocumentLocator(self, locator):\r
+        self._cont_handler.setDocumentLocator(locator)\r
+\r
+    def startDocument(self):\r
+        self._cont_handler.startDocument()\r
+\r
+    def endDocument(self):\r
+        self._cont_handler.endDocument()\r
+\r
+    def startPrefixMapping(self, prefix, uri):\r
+        self._cont_handler.startPrefixMapping(prefix, uri)\r
+\r
+    def endPrefixMapping(self, prefix):\r
+        self._cont_handler.endPrefixMapping(prefix)\r
+\r
+    def startElement(self, name, attrs):\r
+        self._cont_handler.startElement(name, attrs)\r
+\r
+    def endElement(self, name):\r
+        self._cont_handler.endElement(name)\r
+\r
+    def startElementNS(self, name, qname, attrs):\r
+        self._cont_handler.startElementNS(name, qname, attrs)\r
+\r
+    def endElementNS(self, name, qname):\r
+        self._cont_handler.endElementNS(name, qname)\r
+\r
+    def characters(self, content):\r
+        self._cont_handler.characters(content)\r
+\r
+    def ignorableWhitespace(self, chars):\r
+        self._cont_handler.ignorableWhitespace(chars)\r
+\r
+    def processingInstruction(self, target, data):\r
+        self._cont_handler.processingInstruction(target, data)\r
+\r
+    def skippedEntity(self, name):\r
+        self._cont_handler.skippedEntity(name)\r
+\r
+    # DTDHandler methods\r
+\r
+    def notationDecl(self, name, publicId, systemId):\r
+        self._dtd_handler.notationDecl(name, publicId, systemId)\r
+\r
+    def unparsedEntityDecl(self, name, publicId, systemId, ndata):\r
+        self._dtd_handler.unparsedEntityDecl(name, publicId, systemId, ndata)\r
+\r
+    # EntityResolver methods\r
+\r
+    def resolveEntity(self, publicId, systemId):\r
+        return self._ent_handler.resolveEntity(publicId, systemId)\r
+\r
+    # XMLReader methods\r
+\r
+    def parse(self, source):\r
+        self._parent.setContentHandler(self)\r
+        self._parent.setErrorHandler(self)\r
+        self._parent.setEntityResolver(self)\r
+        self._parent.setDTDHandler(self)\r
+        self._parent.parse(source)\r
+\r
+    def setLocale(self, locale):\r
+        self._parent.setLocale(locale)\r
+\r
+    def getFeature(self, name):\r
+        return self._parent.getFeature(name)\r
+\r
+    def setFeature(self, name, state):\r
+        self._parent.setFeature(name, state)\r
+\r
+    def getProperty(self, name):\r
+        return self._parent.getProperty(name)\r
+\r
+    def setProperty(self, name, value):\r
+        self._parent.setProperty(name, value)\r
+\r
+    # XMLFilter methods\r
+\r
+    def getParent(self):\r
+        return self._parent\r
+\r
+    def setParent(self, parent):\r
+        self._parent = parent\r
+\r
+# --- Utility functions\r
+\r
+def prepare_input_source(source, base = ""):\r
+    """This function takes an InputSource and an optional base URL and\r
+    returns a fully resolved InputSource object ready for reading."""\r
+\r
+    if type(source) in _StringTypes:\r
+        source = xmlreader.InputSource(source)\r
+    elif hasattr(source, "read"):\r
+        f = source\r
+        source = xmlreader.InputSource()\r
+        source.setByteStream(f)\r
+        if hasattr(f, "name"):\r
+            source.setSystemId(f.name)\r
+\r
+    if source.getByteStream() is None:\r
+        try:\r
+            sysid = source.getSystemId()\r
+            basehead = os.path.dirname(os.path.normpath(base))\r
+            encoding = sys.getfilesystemencoding()\r
+            if isinstance(sysid, unicode):\r
+                if not isinstance(basehead, unicode):\r
+                    try:\r
+                        basehead = basehead.decode(encoding)\r
+                    except UnicodeDecodeError:\r
+                        sysid = sysid.encode(encoding)\r
+            else:\r
+                if isinstance(basehead, unicode):\r
+                    try:\r
+                        sysid = sysid.decode(encoding)\r
+                    except UnicodeDecodeError:\r
+                        basehead = basehead.encode(encoding)\r
+            sysidfilename = os.path.join(basehead, sysid)\r
+            isfile = os.path.isfile(sysidfilename)\r
+        except UnicodeError:\r
+            isfile = False\r
+        if isfile:\r
+            source.setSystemId(sysidfilename)\r
+            f = open(sysidfilename, "rb")\r
+        else:\r
+            source.setSystemId(urlparse.urljoin(base, source.getSystemId()))\r
+            f = urllib.urlopen(source.getSystemId())\r
+\r
+        source.setByteStream(f)\r
+\r
+    return source\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/xmlreader.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/xmlreader.py
new file mode 100644 (file)
index 0000000..05f2506
--- /dev/null
@@ -0,0 +1,381 @@
+"""An XML Reader is the SAX 2 name for an XML parser. XML Parsers\r
+should be based on this code. """\r
+\r
+import handler\r
+\r
+from _exceptions import SAXNotSupportedException, SAXNotRecognizedException\r
+\r
+\r
+# ===== XMLREADER =====\r
+\r
+class XMLReader:\r
+    """Interface for reading an XML document using callbacks.\r
+\r
+    XMLReader is the interface that an XML parser's SAX2 driver must\r
+    implement. This interface allows an application to set and query\r
+    features and properties in the parser, to register event handlers\r
+    for document processing, and to initiate a document parse.\r
+\r
+    All SAX interfaces are assumed to be synchronous: the parse\r
+    methods must not return until parsing is complete, and readers\r
+    must wait for an event-handler callback to return before reporting\r
+    the next event."""\r
+\r
+    def __init__(self):\r
+        self._cont_handler = handler.ContentHandler()\r
+        self._dtd_handler = handler.DTDHandler()\r
+        self._ent_handler = handler.EntityResolver()\r
+        self._err_handler = handler.ErrorHandler()\r
+\r
+    def parse(self, source):\r
+        "Parse an XML document from a system identifier or an InputSource."\r
+        raise NotImplementedError("This method must be implemented!")\r
+\r
+    def getContentHandler(self):\r
+        "Returns the current ContentHandler."\r
+        return self._cont_handler\r
+\r
+    def setContentHandler(self, handler):\r
+        "Registers a new object to receive document content events."\r
+        self._cont_handler = handler\r
+\r
+    def getDTDHandler(self):\r
+        "Returns the current DTD handler."\r
+        return self._dtd_handler\r
+\r
+    def setDTDHandler(self, handler):\r
+        "Register an object to receive basic DTD-related events."\r
+        self._dtd_handler = handler\r
+\r
+    def getEntityResolver(self):\r
+        "Returns the current EntityResolver."\r
+        return self._ent_handler\r
+\r
+    def setEntityResolver(self, resolver):\r
+        "Register an object to resolve external entities."\r
+        self._ent_handler = resolver\r
+\r
+    def getErrorHandler(self):\r
+        "Returns the current ErrorHandler."\r
+        return self._err_handler\r
+\r
+    def setErrorHandler(self, handler):\r
+        "Register an object to receive error-message events."\r
+        self._err_handler = handler\r
+\r
+    def setLocale(self, locale):\r
+        """Allow an application to set the locale for errors and warnings.\r
+\r
+        SAX parsers are not required to provide localization for errors\r
+        and warnings; if they cannot support the requested locale,\r
+        however, they must raise a SAX exception. Applications may\r
+        request a locale change in the middle of a parse."""\r
+        raise SAXNotSupportedException("Locale support not implemented")\r
+\r
+    def getFeature(self, name):\r
+        "Looks up and returns the state of a SAX2 feature."\r
+        raise SAXNotRecognizedException("Feature '%s' not recognized" % name)\r
+\r
+    def setFeature(self, name, state):\r
+        "Sets the state of a SAX2 feature."\r
+        raise SAXNotRecognizedException("Feature '%s' not recognized" % name)\r
+\r
+    def getProperty(self, name):\r
+        "Looks up and returns the value of a SAX2 property."\r
+        raise SAXNotRecognizedException("Property '%s' not recognized" % name)\r
+\r
+    def setProperty(self, name, value):\r
+        "Sets the value of a SAX2 property."\r
+        raise SAXNotRecognizedException("Property '%s' not recognized" % name)\r
+\r
+class IncrementalParser(XMLReader):\r
+    """This interface adds three extra methods to the XMLReader\r
+    interface that allow XML parsers to support incremental\r
+    parsing. Support for this interface is optional, since not all\r
+    underlying XML parsers support this functionality.\r
+\r
+    When the parser is instantiated it is ready to begin accepting\r
+    data from the feed method immediately. After parsing has been\r
+    finished with a call to close the reset method must be called to\r
+    make the parser ready to accept new data, either from feed or\r
+    using the parse method.\r
+\r
+    Note that these methods must _not_ be called during parsing, that\r
+    is, after parse has been called and before it returns.\r
+\r
+    By default, the class also implements the parse method of the XMLReader\r
+    interface using the feed, close and reset methods of the\r
+    IncrementalParser interface as a convenience to SAX 2.0 driver\r
+    writers."""\r
+\r
+    def __init__(self, bufsize=2**16):\r
+        self._bufsize = bufsize\r
+        XMLReader.__init__(self)\r
+\r
+    def parse(self, source):\r
+        import saxutils\r
+        source = saxutils.prepare_input_source(source)\r
+\r
+        self.prepareParser(source)\r
+        file = source.getByteStream()\r
+        buffer = file.read(self._bufsize)\r
+        while buffer != "":\r
+            self.feed(buffer)\r
+            buffer = file.read(self._bufsize)\r
+        self.close()\r
+\r
+    def feed(self, data):\r
+        """This method gives the raw XML data in the data parameter to\r
+        the parser and makes it parse the data, emitting the\r
+        corresponding events. It is allowed for XML constructs to be\r
+        split across several calls to feed.\r
+\r
+        feed may raise SAXException."""\r
+        raise NotImplementedError("This method must be implemented!")\r
+\r
+    def prepareParser(self, source):\r
+        """This method is called by the parse implementation to allow\r
+        the SAX 2.0 driver to prepare itself for parsing."""\r
+        raise NotImplementedError("prepareParser must be overridden!")\r
+\r
+    def close(self):\r
+        """This method is called when the entire XML document has been\r
+        passed to the parser through the feed method, to notify the\r
+        parser that there are no more data. This allows the parser to\r
+        do the final checks on the document and empty the internal\r
+        data buffer.\r
+\r
+        The parser will not be ready to parse another document until\r
+        the reset method has been called.\r
+\r
+        close may raise SAXException."""\r
+        raise NotImplementedError("This method must be implemented!")\r
+\r
+    def reset(self):\r
+        """This method is called after close has been called to reset\r
+        the parser so that it is ready to parse new documents. The\r
+        results of calling parse or feed after close without calling\r
+        reset are undefined."""\r
+        raise NotImplementedError("This method must be implemented!")\r
+\r
+# ===== LOCATOR =====\r
+\r
+class Locator:\r
+    """Interface for associating a SAX event with a document\r
+    location. A locator object will return valid results only during\r
+    calls to DocumentHandler methods; at any other time, the\r
+    results are unpredictable."""\r
+\r
+    def getColumnNumber(self):\r
+        "Return the column number where the current event ends."\r
+        return -1\r
+\r
+    def getLineNumber(self):\r
+        "Return the line number where the current event ends."\r
+        return -1\r
+\r
+    def getPublicId(self):\r
+        "Return the public identifier for the current event."\r
+        return None\r
+\r
+    def getSystemId(self):\r
+        "Return the system identifier for the current event."\r
+        return None\r
+\r
+# ===== INPUTSOURCE =====\r
+\r
+class InputSource:\r
+    """Encapsulation of the information needed by the XMLReader to\r
+    read entities.\r
+\r
+    This class may include information about the public identifier,\r
+    system identifier, byte stream (possibly with character encoding\r
+    information) and/or the character stream of an entity.\r
+\r
+    Applications will create objects of this class for use in the\r
+    XMLReader.parse method and for returning from\r
+    EntityResolver.resolveEntity.\r
+\r
+    An InputSource belongs to the application, the XMLReader is not\r
+    allowed to modify InputSource objects passed to it from the\r
+    application, although it may make copies and modify those."""\r
+\r
+    def __init__(self, system_id = None):\r
+        self.__system_id = system_id\r
+        self.__public_id = None\r
+        self.__encoding  = None\r
+        self.__bytefile  = None\r
+        self.__charfile  = None\r
+\r
+    def setPublicId(self, public_id):\r
+        "Sets the public identifier of this InputSource."\r
+        self.__public_id = public_id\r
+\r
+    def getPublicId(self):\r
+        "Returns the public identifier of this InputSource."\r
+        return self.__public_id\r
+\r
+    def setSystemId(self, system_id):\r
+        "Sets the system identifier of this InputSource."\r
+        self.__system_id = system_id\r
+\r
+    def getSystemId(self):\r
+        "Returns the system identifier of this InputSource."\r
+        return self.__system_id\r
+\r
+    def setEncoding(self, encoding):\r
+        """Sets the character encoding of this InputSource.\r
+\r
+        The encoding must be a string acceptable for an XML encoding\r
+        declaration (see section 4.3.3 of the XML recommendation).\r
+\r
+        The encoding attribute of the InputSource is ignored if the\r
+        InputSource also contains a character stream."""\r
+        self.__encoding = encoding\r
+\r
+    def getEncoding(self):\r
+        "Get the character encoding of this InputSource."\r
+        return self.__encoding\r
+\r
+    def setByteStream(self, bytefile):\r
+        """Set the byte stream (a Python file-like object which does\r
+        not perform byte-to-character conversion) for this input\r
+        source.\r
+\r
+        The SAX parser will ignore this if there is also a character\r
+        stream specified, but it will use a byte stream in preference\r
+        to opening a URI connection itself.\r
+\r
+        If the application knows the character encoding of the byte\r
+        stream, it should set it with the setEncoding method."""\r
+        self.__bytefile = bytefile\r
+\r
+    def getByteStream(self):\r
+        """Get the byte stream for this input source.\r
+\r
+        The getEncoding method will return the character encoding for\r
+        this byte stream, or None if unknown."""\r
+        return self.__bytefile\r
+\r
+    def setCharacterStream(self, charfile):\r
+        """Set the character stream for this input source. (The stream\r
+        must be a Python 2.0 Unicode-wrapped file-like that performs\r
+        conversion to Unicode strings.)\r
+\r
+        If there is a character stream specified, the SAX parser will\r
+        ignore any byte stream and will not attempt to open a URI\r
+        connection to the system identifier."""\r
+        self.__charfile = charfile\r
+\r
+    def getCharacterStream(self):\r
+        "Get the character stream for this input source."\r
+        return self.__charfile\r
+\r
+# ===== ATTRIBUTESIMPL =====\r
+\r
+class AttributesImpl:\r
+\r
+    def __init__(self, attrs):\r
+        """Non-NS-aware implementation.\r
+\r
+        attrs should be of the form {name : value}."""\r
+        self._attrs = attrs\r
+\r
+    def getLength(self):\r
+        return len(self._attrs)\r
+\r
+    def getType(self, name):\r
+        return "CDATA"\r
+\r
+    def getValue(self, name):\r
+        return self._attrs[name]\r
+\r
+    def getValueByQName(self, name):\r
+        return self._attrs[name]\r
+\r
+    def getNameByQName(self, name):\r
+        if not name in self._attrs:\r
+            raise KeyError, name\r
+        return name\r
+\r
+    def getQNameByName(self, name):\r
+        if not name in self._attrs:\r
+            raise KeyError, name\r
+        return name\r
+\r
+    def getNames(self):\r
+        return self._attrs.keys()\r
+\r
+    def getQNames(self):\r
+        return self._attrs.keys()\r
+\r
+    def __len__(self):\r
+        return len(self._attrs)\r
+\r
+    def __getitem__(self, name):\r
+        return self._attrs[name]\r
+\r
+    def keys(self):\r
+        return self._attrs.keys()\r
+\r
+    def has_key(self, name):\r
+        return name in self._attrs\r
+\r
+    def __contains__(self, name):\r
+        return name in self._attrs\r
+\r
+    def get(self, name, alternative=None):\r
+        return self._attrs.get(name, alternative)\r
+\r
+    def copy(self):\r
+        return self.__class__(self._attrs)\r
+\r
+    def items(self):\r
+        return self._attrs.items()\r
+\r
+    def values(self):\r
+        return self._attrs.values()\r
+\r
+# ===== ATTRIBUTESNSIMPL =====\r
+\r
+class AttributesNSImpl(AttributesImpl):\r
+\r
+    def __init__(self, attrs, qnames):\r
+        """NS-aware implementation.\r
+\r
+        attrs should be of the form {(ns_uri, lname): value, ...}.\r
+        qnames of the form {(ns_uri, lname): qname, ...}."""\r
+        self._attrs = attrs\r
+        self._qnames = qnames\r
+\r
+    def getValueByQName(self, name):\r
+        for (nsname, qname) in self._qnames.items():\r
+            if qname == name:\r
+                return self._attrs[nsname]\r
+\r
+        raise KeyError, name\r
+\r
+    def getNameByQName(self, name):\r
+        for (nsname, qname) in self._qnames.items():\r
+            if qname == name:\r
+                return nsname\r
+\r
+        raise KeyError, name\r
+\r
+    def getQNameByName(self, name):\r
+        return self._qnames[name]\r
+\r
+    def getQNames(self):\r
+        return self._qnames.values()\r
+\r
+    def copy(self):\r
+        return self.__class__(self._attrs, self._qnames)\r
+\r
+\r
+def _test():\r
+    XMLReader()\r
+    IncrementalParser()\r
+    Locator()\r
+\r
+if __name__ == "__main__":\r
+    _test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xmllib.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xmllib.py
new file mode 100644 (file)
index 0000000..79cd9c3
--- /dev/null
@@ -0,0 +1,930 @@
+"""A parser for XML, using the derived class as static DTD."""\r
+\r
+# Author: Sjoerd Mullender.\r
+\r
+import re\r
+import string\r
+\r
+import warnings\r
+warnings.warn("The xmllib module is obsolete.  Use xml.sax instead.",\r
+              DeprecationWarning, 2)\r
+del warnings\r
+\r
+version = '0.3'\r
+\r
+class Error(RuntimeError):\r
+    pass\r
+\r
+# Regular expressions used for parsing\r
+\r
+_S = '[ \t\r\n]+'                       # white space\r
+_opS = '[ \t\r\n]*'                     # optional white space\r
+_Name = '[a-zA-Z_:][-a-zA-Z0-9._:]*'    # valid XML name\r
+_QStr = "(?:'[^']*'|\"[^\"]*\")"        # quoted XML string\r
+illegal = re.compile('[^\t\r\n -\176\240-\377]') # illegal chars in content\r
+interesting = re.compile('[]&<]')\r
+\r
+amp = re.compile('&')\r
+ref = re.compile('&(' + _Name + '|#[0-9]+|#x[0-9a-fA-F]+)[^-a-zA-Z0-9._:]')\r
+entityref = re.compile('&(?P<name>' + _Name + ')[^-a-zA-Z0-9._:]')\r
+charref = re.compile('&#(?P<char>[0-9]+[^0-9]|x[0-9a-fA-F]+[^0-9a-fA-F])')\r
+space = re.compile(_S + '$')\r
+newline = re.compile('\n')\r
+\r
+attrfind = re.compile(\r
+    _S + '(?P<name>' + _Name + ')'\r
+    '(' + _opS + '=' + _opS +\r
+    '(?P<value>'+_QStr+'|[-a-zA-Z0-9.:+*%?!\(\)_#=~]+))?')\r
+starttagopen = re.compile('<' + _Name)\r
+starttagend = re.compile(_opS + '(?P<slash>/?)>')\r
+starttagmatch = re.compile('<(?P<tagname>'+_Name+')'\r
+                      '(?P<attrs>(?:'+attrfind.pattern+')*)'+\r
+                      starttagend.pattern)\r
+endtagopen = re.compile('</')\r
+endbracket = re.compile(_opS + '>')\r
+endbracketfind = re.compile('(?:[^>\'"]|'+_QStr+')*>')\r
+tagfind = re.compile(_Name)\r
+cdataopen = re.compile(r'<!\[CDATA\[')\r
+cdataclose = re.compile(r'\]\]>')\r
+# this matches one of the following:\r
+# SYSTEM SystemLiteral\r
+# PUBLIC PubidLiteral SystemLiteral\r
+_SystemLiteral = '(?P<%s>'+_QStr+')'\r
+_PublicLiteral = '(?P<%s>"[-\'\(\)+,./:=?;!*#@$_%% \n\ra-zA-Z0-9]*"|' \\r
+                        "'[-\(\)+,./:=?;!*#@$_%% \n\ra-zA-Z0-9]*')"\r
+_ExternalId = '(?:SYSTEM|' \\r
+                 'PUBLIC'+_S+_PublicLiteral%'pubid'+ \\r
+              ')'+_S+_SystemLiteral%'syslit'\r
+doctype = re.compile('<!DOCTYPE'+_S+'(?P<name>'+_Name+')'\r
+                     '(?:'+_S+_ExternalId+')?'+_opS)\r
+xmldecl = re.compile('<\?xml'+_S+\r
+                     'version'+_opS+'='+_opS+'(?P<version>'+_QStr+')'+\r
+                     '(?:'+_S+'encoding'+_opS+'='+_opS+\r
+                        "(?P<encoding>'[A-Za-z][-A-Za-z0-9._]*'|"\r
+                        '"[A-Za-z][-A-Za-z0-9._]*"))?'\r
+                     '(?:'+_S+'standalone'+_opS+'='+_opS+\r
+                        '(?P<standalone>\'(?:yes|no)\'|"(?:yes|no)"))?'+\r
+                     _opS+'\?>')\r
+procopen = re.compile(r'<\?(?P<proc>' + _Name + ')' + _opS)\r
+procclose = re.compile(_opS + r'\?>')\r
+commentopen = re.compile('<!--')\r
+commentclose = re.compile('-->')\r
+doubledash = re.compile('--')\r
+attrtrans = string.maketrans(' \r\n\t', '    ')\r
+\r
+# definitions for XML namespaces\r
+_NCName = '[a-zA-Z_][-a-zA-Z0-9._]*'    # XML Name, minus the ":"\r
+ncname = re.compile(_NCName + '$')\r
+qname = re.compile('(?:(?P<prefix>' + _NCName + '):)?' # optional prefix\r
+                   '(?P<local>' + _NCName + ')$')\r
+\r
+xmlns = re.compile('xmlns(?::(?P<ncname>'+_NCName+'))?$')\r
+\r
+# XML parser base class -- find tags and call handler functions.\r
+# Usage: p = XMLParser(); p.feed(data); ...; p.close().\r
+# The dtd is defined by deriving a class which defines methods with\r
+# special names to handle tags: start_foo and end_foo to handle <foo>\r
+# and </foo>, respectively.  The data between tags is passed to the\r
+# parser by calling self.handle_data() with some data as argument (the\r
+# data may be split up in arbitrary chunks).\r
+\r
+class XMLParser:\r
+    attributes = {}                     # default, to be overridden\r
+    elements = {}                       # default, to be overridden\r
+\r
+    # parsing options, settable using keyword args in __init__\r
+    __accept_unquoted_attributes = 0\r
+    __accept_missing_endtag_name = 0\r
+    __map_case = 0\r
+    __accept_utf8 = 0\r
+    __translate_attribute_references = 1\r
+\r
+    # Interface -- initialize and reset this instance\r
+    def __init__(self, **kw):\r
+        self.__fixed = 0\r
+        if 'accept_unquoted_attributes' in kw:\r
+            self.__accept_unquoted_attributes = kw['accept_unquoted_attributes']\r
+        if 'accept_missing_endtag_name' in kw:\r
+            self.__accept_missing_endtag_name = kw['accept_missing_endtag_name']\r
+        if 'map_case' in kw:\r
+            self.__map_case = kw['map_case']\r
+        if 'accept_utf8' in kw:\r
+            self.__accept_utf8 = kw['accept_utf8']\r
+        if 'translate_attribute_references' in kw:\r
+            self.__translate_attribute_references = kw['translate_attribute_references']\r
+        self.reset()\r
+\r
+    def __fixelements(self):\r
+        self.__fixed = 1\r
+        self.elements = {}\r
+        self.__fixdict(self.__dict__)\r
+        self.__fixclass(self.__class__)\r
+\r
+    def __fixclass(self, kl):\r
+        self.__fixdict(kl.__dict__)\r
+        for k in kl.__bases__:\r
+            self.__fixclass(k)\r
+\r
+    def __fixdict(self, dict):\r
+        for key in dict.keys():\r
+            if key[:6] == 'start_':\r
+                tag = key[6:]\r
+                start, end = self.elements.get(tag, (None, None))\r
+                if start is None:\r
+                    self.elements[tag] = getattr(self, key), end\r
+            elif key[:4] == 'end_':\r
+                tag = key[4:]\r
+                start, end = self.elements.get(tag, (None, None))\r
+                if end is None:\r
+                    self.elements[tag] = start, getattr(self, key)\r
+\r
+    # Interface -- reset this instance.  Loses all unprocessed data\r
+    def reset(self):\r
+        self.rawdata = ''\r
+        self.stack = []\r
+        self.nomoretags = 0\r
+        self.literal = 0\r
+        self.lineno = 1\r
+        self.__at_start = 1\r
+        self.__seen_doctype = None\r
+        self.__seen_starttag = 0\r
+        self.__use_namespaces = 0\r
+        self.__namespaces = {'xml':None}   # xml is implicitly declared\r
+        # backward compatibility hack: if elements not overridden,\r
+        # fill it in ourselves\r
+        if self.elements is XMLParser.elements:\r
+            self.__fixelements()\r
+\r
+    # For derived classes only -- enter literal mode (CDATA) till EOF\r
+    def setnomoretags(self):\r
+        self.nomoretags = self.literal = 1\r
+\r
+    # For derived classes only -- enter literal mode (CDATA)\r
+    def setliteral(self, *args):\r
+        self.literal = 1\r
+\r
+    # Interface -- feed some data to the parser.  Call this as\r
+    # often as you want, with as little or as much text as you\r
+    # want (may include '\n').  (This just saves the text, all the\r
+    # processing is done by goahead().)\r
+    def feed(self, data):\r
+        self.rawdata = self.rawdata + data\r
+        self.goahead(0)\r
+\r
+    # Interface -- handle the remaining data\r
+    def close(self):\r
+        self.goahead(1)\r
+        if self.__fixed:\r
+            self.__fixed = 0\r
+            # remove self.elements so that we don't leak\r
+            del self.elements\r
+\r
+    # Interface -- translate references\r
+    def translate_references(self, data, all = 1):\r
+        if not self.__translate_attribute_references:\r
+            return data\r
+        i = 0\r
+        while 1:\r
+            res = amp.search(data, i)\r
+            if res is None:\r
+                return data\r
+            s = res.start(0)\r
+            res = ref.match(data, s)\r
+            if res is None:\r
+                self.syntax_error("bogus `&'")\r
+                i = s+1\r
+                continue\r
+            i = res.end(0)\r
+            str = res.group(1)\r
+            rescan = 0\r
+            if str[0] == '#':\r
+                if str[1] == 'x':\r
+                    str = chr(int(str[2:], 16))\r
+                else:\r
+                    str = chr(int(str[1:]))\r
+                if data[i - 1] != ';':\r
+                    self.syntax_error("`;' missing after char reference")\r
+                    i = i-1\r
+            elif all:\r
+                if str in self.entitydefs:\r
+                    str = self.entitydefs[str]\r
+                    rescan = 1\r
+                elif data[i - 1] != ';':\r
+                    self.syntax_error("bogus `&'")\r
+                    i = s + 1 # just past the &\r
+                    continue\r
+                else:\r
+                    self.syntax_error("reference to unknown entity `&%s;'" % str)\r
+                    str = '&' + str + ';'\r
+            elif data[i - 1] != ';':\r
+                self.syntax_error("bogus `&'")\r
+                i = s + 1 # just past the &\r
+                continue\r
+\r
+            # when we get here, str contains the translated text and i points\r
+            # to the end of the string that is to be replaced\r
+            data = data[:s] + str + data[i:]\r
+            if rescan:\r
+                i = s\r
+            else:\r
+                i = s + len(str)\r
+\r
+    # Interface - return a dictionary of all namespaces currently valid\r
+    def getnamespace(self):\r
+        nsdict = {}\r
+        for t, d, nst in self.stack:\r
+            nsdict.update(d)\r
+        return nsdict\r
+\r
+    # Internal -- handle data as far as reasonable.  May leave state\r
+    # and data to be processed by a subsequent call.  If 'end' is\r
+    # true, force handling all data as if followed by EOF marker.\r
+    def goahead(self, end):\r
+        rawdata = self.rawdata\r
+        i = 0\r
+        n = len(rawdata)\r
+        while i < n:\r
+            if i > 0:\r
+                self.__at_start = 0\r
+            if self.nomoretags:\r
+                data = rawdata[i:n]\r
+                self.handle_data(data)\r
+                self.lineno = self.lineno + data.count('\n')\r
+                i = n\r
+                break\r
+            res = interesting.search(rawdata, i)\r
+            if res:\r
+                j = res.start(0)\r
+            else:\r
+                j = n\r
+            if i < j:\r
+                data = rawdata[i:j]\r
+                if self.__at_start and space.match(data) is None:\r
+                    self.syntax_error('illegal data at start of file')\r
+                self.__at_start = 0\r
+                if not self.stack and space.match(data) is None:\r
+                    self.syntax_error('data not in content')\r
+                if not self.__accept_utf8 and illegal.search(data):\r
+                    self.syntax_error('illegal character in content')\r
+                self.handle_data(data)\r
+                self.lineno = self.lineno + data.count('\n')\r
+            i = j\r
+            if i == n: break\r
+            if rawdata[i] == '<':\r
+                if starttagopen.match(rawdata, i):\r
+                    if self.literal:\r
+                        data = rawdata[i]\r
+                        self.handle_data(data)\r
+                        self.lineno = self.lineno + data.count('\n')\r
+                        i = i+1\r
+                        continue\r
+                    k = self.parse_starttag(i)\r
+                    if k < 0: break\r
+                    self.__seen_starttag = 1\r
+                    self.lineno = self.lineno + rawdata[i:k].count('\n')\r
+                    i = k\r
+                    continue\r
+                if endtagopen.match(rawdata, i):\r
+                    k = self.parse_endtag(i)\r
+                    if k < 0: break\r
+                    self.lineno = self.lineno + rawdata[i:k].count('\n')\r
+                    i =  k\r
+                    continue\r
+                if commentopen.match(rawdata, i):\r
+                    if self.literal:\r
+                        data = rawdata[i]\r
+                        self.handle_data(data)\r
+                        self.lineno = self.lineno + data.count('\n')\r
+                        i = i+1\r
+                        continue\r
+                    k = self.parse_comment(i)\r
+                    if k < 0: break\r
+                    self.lineno = self.lineno + rawdata[i:k].count('\n')\r
+                    i = k\r
+                    continue\r
+                if cdataopen.match(rawdata, i):\r
+                    k = self.parse_cdata(i)\r
+                    if k < 0: break\r
+                    self.lineno = self.lineno + rawdata[i:k].count('\n')\r
+                    i = k\r
+                    continue\r
+                res = xmldecl.match(rawdata, i)\r
+                if res:\r
+                    if not self.__at_start:\r
+                        self.syntax_error("<?xml?> declaration not at start of document")\r
+                    version, encoding, standalone = res.group('version',\r
+                                                              'encoding',\r
+                                                              'standalone')\r
+                    if version[1:-1] != '1.0':\r
+                        raise Error('only XML version 1.0 supported')\r
+                    if encoding: encoding = encoding[1:-1]\r
+                    if standalone: standalone = standalone[1:-1]\r
+                    self.handle_xml(encoding, standalone)\r
+                    i = res.end(0)\r
+                    continue\r
+                res = procopen.match(rawdata, i)\r
+                if res:\r
+                    k = self.parse_proc(i)\r
+                    if k < 0: break\r
+                    self.lineno = self.lineno + rawdata[i:k].count('\n')\r
+                    i = k\r
+                    continue\r
+                res = doctype.match(rawdata, i)\r
+                if res:\r
+                    if self.literal:\r
+                        data = rawdata[i]\r
+                        self.handle_data(data)\r
+                        self.lineno = self.lineno + data.count('\n')\r
+                        i = i+1\r
+                        continue\r
+                    if self.__seen_doctype:\r
+                        self.syntax_error('multiple DOCTYPE elements')\r
+                    if self.__seen_starttag:\r
+                        self.syntax_error('DOCTYPE not at beginning of document')\r
+                    k = self.parse_doctype(res)\r
+                    if k < 0: break\r
+                    self.__seen_doctype = res.group('name')\r
+                    if self.__map_case:\r
+                        self.__seen_doctype = self.__seen_doctype.lower()\r
+                    self.lineno = self.lineno + rawdata[i:k].count('\n')\r
+                    i = k\r
+                    continue\r
+            elif rawdata[i] == '&':\r
+                if self.literal:\r
+                    data = rawdata[i]\r
+                    self.handle_data(data)\r
+                    i = i+1\r
+                    continue\r
+                res = charref.match(rawdata, i)\r
+                if res is not None:\r
+                    i = res.end(0)\r
+                    if rawdata[i-1] != ';':\r
+                        self.syntax_error("`;' missing in charref")\r
+                        i = i-1\r
+                    if not self.stack:\r
+                        self.syntax_error('data not in content')\r
+                    self.handle_charref(res.group('char')[:-1])\r
+                    self.lineno = self.lineno + res.group(0).count('\n')\r
+                    continue\r
+                res = entityref.match(rawdata, i)\r
+                if res is not None:\r
+                    i = res.end(0)\r
+                    if rawdata[i-1] != ';':\r
+                        self.syntax_error("`;' missing in entityref")\r
+                        i = i-1\r
+                    name = res.group('name')\r
+                    if self.__map_case:\r
+                        name = name.lower()\r
+                    if name in self.entitydefs:\r
+                        self.rawdata = rawdata = rawdata[:res.start(0)] + self.entitydefs[name] + rawdata[i:]\r
+                        n = len(rawdata)\r
+                        i = res.start(0)\r
+                    else:\r
+                        self.unknown_entityref(name)\r
+                    self.lineno = self.lineno + res.group(0).count('\n')\r
+                    continue\r
+            elif rawdata[i] == ']':\r
+                if self.literal:\r
+                    data = rawdata[i]\r
+                    self.handle_data(data)\r
+                    i = i+1\r
+                    continue\r
+                if n-i < 3:\r
+                    break\r
+                if cdataclose.match(rawdata, i):\r
+                    self.syntax_error("bogus `]]>'")\r
+                self.handle_data(rawdata[i])\r
+                i = i+1\r
+                continue\r
+            else:\r
+                raise Error('neither < nor & ??')\r
+            # We get here only if incomplete matches but\r
+            # nothing else\r
+            break\r
+        # end while\r
+        if i > 0:\r
+            self.__at_start = 0\r
+        if end and i < n:\r
+            data = rawdata[i]\r
+            self.syntax_error("bogus `%s'" % data)\r
+            if not self.__accept_utf8 and illegal.search(data):\r
+                self.syntax_error('illegal character in content')\r
+            self.handle_data(data)\r
+            self.lineno = self.lineno + data.count('\n')\r
+            self.rawdata = rawdata[i+1:]\r
+            return self.goahead(end)\r
+        self.rawdata = rawdata[i:]\r
+        if end:\r
+            if not self.__seen_starttag:\r
+                self.syntax_error('no elements in file')\r
+            if self.stack:\r
+                self.syntax_error('missing end tags')\r
+                while self.stack:\r
+                    self.finish_endtag(self.stack[-1][0])\r
+\r
+    # Internal -- parse comment, return length or -1 if not terminated\r
+    def parse_comment(self, i):\r
+        rawdata = self.rawdata\r
+        if rawdata[i:i+4] != '<!--':\r
+            raise Error('unexpected call to handle_comment')\r
+        res = commentclose.search(rawdata, i+4)\r
+        if res is None:\r
+            return -1\r
+        if doubledash.search(rawdata, i+4, res.start(0)):\r
+            self.syntax_error("`--' inside comment")\r
+        if rawdata[res.start(0)-1] == '-':\r
+            self.syntax_error('comment cannot end in three dashes')\r
+        if not self.__accept_utf8 and \\r
+           illegal.search(rawdata, i+4, res.start(0)):\r
+            self.syntax_error('illegal character in comment')\r
+        self.handle_comment(rawdata[i+4: res.start(0)])\r
+        return res.end(0)\r
+\r
+    # Internal -- handle DOCTYPE tag, return length or -1 if not terminated\r
+    def parse_doctype(self, res):\r
+        rawdata = self.rawdata\r
+        n = len(rawdata)\r
+        name = res.group('name')\r
+        if self.__map_case:\r
+            name = name.lower()\r
+        pubid, syslit = res.group('pubid', 'syslit')\r
+        if pubid is not None:\r
+            pubid = pubid[1:-1]         # remove quotes\r
+            pubid = ' '.join(pubid.split()) # normalize\r
+        if syslit is not None: syslit = syslit[1:-1] # remove quotes\r
+        j = k = res.end(0)\r
+        if k >= n:\r
+            return -1\r
+        if rawdata[k] == '[':\r
+            level = 0\r
+            k = k+1\r
+            dq = sq = 0\r
+            while k < n:\r
+                c = rawdata[k]\r
+                if not sq and c == '"':\r
+                    dq = not dq\r
+                elif not dq and c == "'":\r
+                    sq = not sq\r
+                elif sq or dq:\r
+                    pass\r
+                elif level <= 0 and c == ']':\r
+                    res = endbracket.match(rawdata, k+1)\r
+                    if res is None:\r
+                        return -1\r
+                    self.handle_doctype(name, pubid, syslit, rawdata[j+1:k])\r
+                    return res.end(0)\r
+                elif c == '<':\r
+                    level = level + 1\r
+                elif c == '>':\r
+                    level = level - 1\r
+                    if level < 0:\r
+                        self.syntax_error("bogus `>' in DOCTYPE")\r
+                k = k+1\r
+        res = endbracketfind.match(rawdata, k)\r
+        if res is None:\r
+            return -1\r
+        if endbracket.match(rawdata, k) is None:\r
+            self.syntax_error('garbage in DOCTYPE')\r
+        self.handle_doctype(name, pubid, syslit, None)\r
+        return res.end(0)\r
+\r
+    # Internal -- handle CDATA tag, return length or -1 if not terminated\r
+    def parse_cdata(self, i):\r
+        rawdata = self.rawdata\r
+        if rawdata[i:i+9] != '<![CDATA[':\r
+            raise Error('unexpected call to parse_cdata')\r
+        res = cdataclose.search(rawdata, i+9)\r
+        if res is None:\r
+            return -1\r
+        if not self.__accept_utf8 and \\r
+           illegal.search(rawdata, i+9, res.start(0)):\r
+            self.syntax_error('illegal character in CDATA')\r
+        if not self.stack:\r
+            self.syntax_error('CDATA not in content')\r
+        self.handle_cdata(rawdata[i+9:res.start(0)])\r
+        return res.end(0)\r
+\r
+    __xml_namespace_attributes = {'ns':None, 'src':None, 'prefix':None}\r
+    # Internal -- handle a processing instruction tag\r
+    def parse_proc(self, i):\r
+        rawdata = self.rawdata\r
+        end = procclose.search(rawdata, i)\r
+        if end is None:\r
+            return -1\r
+        j = end.start(0)\r
+        if not self.__accept_utf8 and illegal.search(rawdata, i+2, j):\r
+            self.syntax_error('illegal character in processing instruction')\r
+        res = tagfind.match(rawdata, i+2)\r
+        if res is None:\r
+            raise Error('unexpected call to parse_proc')\r
+        k = res.end(0)\r
+        name = res.group(0)\r
+        if self.__map_case:\r
+            name = name.lower()\r
+        if name == 'xml:namespace':\r
+            self.syntax_error('old-fashioned namespace declaration')\r
+            self.__use_namespaces = -1\r
+            # namespace declaration\r
+            # this must come after the <?xml?> declaration (if any)\r
+            # and before the <!DOCTYPE> (if any).\r
+            if self.__seen_doctype or self.__seen_starttag:\r
+                self.syntax_error('xml:namespace declaration too late in document')\r
+            attrdict, namespace, k = self.parse_attributes(name, k, j)\r
+            if namespace:\r
+                self.syntax_error('namespace declaration inside namespace declaration')\r
+            for attrname in attrdict.keys():\r
+                if not attrname in self.__xml_namespace_attributes:\r
+                    self.syntax_error("unknown attribute `%s' in xml:namespace tag" % attrname)\r
+            if not 'ns' in attrdict or not 'prefix' in attrdict:\r
+                self.syntax_error('xml:namespace without required attributes')\r
+            prefix = attrdict.get('prefix')\r
+            if ncname.match(prefix) is None:\r
+                self.syntax_error('xml:namespace illegal prefix value')\r
+                return end.end(0)\r
+            if prefix in self.__namespaces:\r
+                self.syntax_error('xml:namespace prefix not unique')\r
+            self.__namespaces[prefix] = attrdict['ns']\r
+        else:\r
+            if name.lower() == 'xml':\r
+                self.syntax_error('illegal processing instruction target name')\r
+            self.handle_proc(name, rawdata[k:j])\r
+        return end.end(0)\r
+\r
+    # Internal -- parse attributes between i and j\r
+    def parse_attributes(self, tag, i, j):\r
+        rawdata = self.rawdata\r
+        attrdict = {}\r
+        namespace = {}\r
+        while i < j:\r
+            res = attrfind.match(rawdata, i)\r
+            if res is None:\r
+                break\r
+            attrname, attrvalue = res.group('name', 'value')\r
+            if self.__map_case:\r
+                attrname = attrname.lower()\r
+            i = res.end(0)\r
+            if attrvalue is None:\r
+                self.syntax_error("no value specified for attribute `%s'" % attrname)\r
+                attrvalue = attrname\r
+            elif attrvalue[:1] == "'" == attrvalue[-1:] or \\r
+                 attrvalue[:1] == '"' == attrvalue[-1:]:\r
+                attrvalue = attrvalue[1:-1]\r
+            elif not self.__accept_unquoted_attributes:\r
+                self.syntax_error("attribute `%s' value not quoted" % attrname)\r
+            res = xmlns.match(attrname)\r
+            if res is not None:\r
+                # namespace declaration\r
+                ncname = res.group('ncname')\r
+                namespace[ncname or ''] = attrvalue or None\r
+                if not self.__use_namespaces:\r
+                    self.__use_namespaces = len(self.stack)+1\r
+                continue\r
+            if '<' in attrvalue:\r
+                self.syntax_error("`<' illegal in attribute value")\r
+            if attrname in attrdict:\r
+                self.syntax_error("attribute `%s' specified twice" % attrname)\r
+            attrvalue = attrvalue.translate(attrtrans)\r
+            attrdict[attrname] = self.translate_references(attrvalue)\r
+        return attrdict, namespace, i\r
+\r
+    # Internal -- handle starttag, return length or -1 if not terminated\r
+    def parse_starttag(self, i):\r
+        rawdata = self.rawdata\r
+        # i points to start of tag\r
+        end = endbracketfind.match(rawdata, i+1)\r
+        if end is None:\r
+            return -1\r
+        tag = starttagmatch.match(rawdata, i)\r
+        if tag is None or tag.end(0) != end.end(0):\r
+            self.syntax_error('garbage in starttag')\r
+            return end.end(0)\r
+        nstag = tagname = tag.group('tagname')\r
+        if self.__map_case:\r
+            nstag = tagname = nstag.lower()\r
+        if not self.__seen_starttag and self.__seen_doctype and \\r
+           tagname != self.__seen_doctype:\r
+            self.syntax_error('starttag does not match DOCTYPE')\r
+        if self.__seen_starttag and not self.stack:\r
+            self.syntax_error('multiple elements on top level')\r
+        k, j = tag.span('attrs')\r
+        attrdict, nsdict, k = self.parse_attributes(tagname, k, j)\r
+        self.stack.append((tagname, nsdict, nstag))\r
+        if self.__use_namespaces:\r
+            res = qname.match(tagname)\r
+        else:\r
+            res = None\r
+        if res is not None:\r
+            prefix, nstag = res.group('prefix', 'local')\r
+            if prefix is None:\r
+                prefix = ''\r
+            ns = None\r
+            for t, d, nst in self.stack:\r
+                if prefix in d:\r
+                    ns = d[prefix]\r
+            if ns is None and prefix != '':\r
+                ns = self.__namespaces.get(prefix)\r
+            if ns is not None:\r
+                nstag = ns + ' ' + nstag\r
+            elif prefix != '':\r
+                nstag = prefix + ':' + nstag # undo split\r
+            self.stack[-1] = tagname, nsdict, nstag\r
+        # translate namespace of attributes\r
+        attrnamemap = {} # map from new name to old name (used for error reporting)\r
+        for key in attrdict.keys():\r
+            attrnamemap[key] = key\r
+        if self.__use_namespaces:\r
+            nattrdict = {}\r
+            for key, val in attrdict.items():\r
+                okey = key\r
+                res = qname.match(key)\r
+                if res is not None:\r
+                    aprefix, key = res.group('prefix', 'local')\r
+                    if self.__map_case:\r
+                        key = key.lower()\r
+                    if aprefix is not None:\r
+                        ans = None\r
+                        for t, d, nst in self.stack:\r
+                            if aprefix in d:\r
+                                ans = d[aprefix]\r
+                        if ans is None:\r
+                            ans = self.__namespaces.get(aprefix)\r
+                        if ans is not None:\r
+                            key = ans + ' ' + key\r
+                        else:\r
+                            key = aprefix + ':' + key\r
+                nattrdict[key] = val\r
+                attrnamemap[key] = okey\r
+            attrdict = nattrdict\r
+        attributes = self.attributes.get(nstag)\r
+        if attributes is not None:\r
+            for key in attrdict.keys():\r
+                if not key in attributes:\r
+                    self.syntax_error("unknown attribute `%s' in tag `%s'" % (attrnamemap[key], tagname))\r
+            for key, val in attributes.items():\r
+                if val is not None and not key in attrdict:\r
+                    attrdict[key] = val\r
+        method = self.elements.get(nstag, (None, None))[0]\r
+        self.finish_starttag(nstag, attrdict, method)\r
+        if tag.group('slash') == '/':\r
+            self.finish_endtag(tagname)\r
+        return tag.end(0)\r
+\r
+    # Internal -- parse endtag\r
+    def parse_endtag(self, i):\r
+        rawdata = self.rawdata\r
+        end = endbracketfind.match(rawdata, i+1)\r
+        if end is None:\r
+            return -1\r
+        res = tagfind.match(rawdata, i+2)\r
+        if res is None:\r
+            if self.literal:\r
+                self.handle_data(rawdata[i])\r
+                return i+1\r
+            if not self.__accept_missing_endtag_name:\r
+                self.syntax_error('no name specified in end tag')\r
+            tag = self.stack[-1][0]\r
+            k = i+2\r
+        else:\r
+            tag = res.group(0)\r
+            if self.__map_case:\r
+                tag = tag.lower()\r
+            if self.literal:\r
+                if not self.stack or tag != self.stack[-1][0]:\r
+                    self.handle_data(rawdata[i])\r
+                    return i+1\r
+            k = res.end(0)\r
+        if endbracket.match(rawdata, k) is None:\r
+            self.syntax_error('garbage in end tag')\r
+        self.finish_endtag(tag)\r
+        return end.end(0)\r
+\r
+    # Internal -- finish processing of start tag\r
+    def finish_starttag(self, tagname, attrdict, method):\r
+        if method is not None:\r
+            self.handle_starttag(tagname, method, attrdict)\r
+        else:\r
+            self.unknown_starttag(tagname, attrdict)\r
+\r
+    # Internal -- finish processing of end tag\r
+    def finish_endtag(self, tag):\r
+        self.literal = 0\r
+        if not tag:\r
+            self.syntax_error('name-less end tag')\r
+            found = len(self.stack) - 1\r
+            if found < 0:\r
+                self.unknown_endtag(tag)\r
+                return\r
+        else:\r
+            found = -1\r
+            for i in range(len(self.stack)):\r
+                if tag == self.stack[i][0]:\r
+                    found = i\r
+            if found == -1:\r
+                self.syntax_error('unopened end tag')\r
+                return\r
+        while len(self.stack) > found:\r
+            if found < len(self.stack) - 1:\r
+                self.syntax_error('missing close tag for %s' % self.stack[-1][2])\r
+            nstag = self.stack[-1][2]\r
+            method = self.elements.get(nstag, (None, None))[1]\r
+            if method is not None:\r
+                self.handle_endtag(nstag, method)\r
+            else:\r
+                self.unknown_endtag(nstag)\r
+            if self.__use_namespaces == len(self.stack):\r
+                self.__use_namespaces = 0\r
+            del self.stack[-1]\r
+\r
+    # Overridable -- handle xml processing instruction\r
+    def handle_xml(self, encoding, standalone):\r
+        pass\r
+\r
+    # Overridable -- handle DOCTYPE\r
+    def handle_doctype(self, tag, pubid, syslit, data):\r
+        pass\r
+\r
+    # Overridable -- handle start tag\r
+    def handle_starttag(self, tag, method, attrs):\r
+        method(attrs)\r
+\r
+    # Overridable -- handle end tag\r
+    def handle_endtag(self, tag, method):\r
+        method()\r
+\r
+    # Example -- handle character reference, no need to override\r
+    def handle_charref(self, name):\r
+        try:\r
+            if name[0] == 'x':\r
+                n = int(name[1:], 16)\r
+            else:\r
+                n = int(name)\r
+        except ValueError:\r
+            self.unknown_charref(name)\r
+            return\r
+        if not 0 <= n <= 255:\r
+            self.unknown_charref(name)\r
+            return\r
+        self.handle_data(chr(n))\r
+\r
+    # Definition of entities -- derived classes may override\r
+    entitydefs = {'lt': '&#60;',        # must use charref\r
+                  'gt': '&#62;',\r
+                  'amp': '&#38;',       # must use charref\r
+                  'quot': '&#34;',\r
+                  'apos': '&#39;',\r
+                  }\r
+\r
+    # Example -- handle data, should be overridden\r
+    def handle_data(self, data):\r
+        pass\r
+\r
+    # Example -- handle cdata, could be overridden\r
+    def handle_cdata(self, data):\r
+        pass\r
+\r
+    # Example -- handle comment, could be overridden\r
+    def handle_comment(self, data):\r
+        pass\r
+\r
+    # Example -- handle processing instructions, could be overridden\r
+    def handle_proc(self, name, data):\r
+        pass\r
+\r
+    # Example -- handle relatively harmless syntax errors, could be overridden\r
+    def syntax_error(self, message):\r
+        raise Error('Syntax error at line %d: %s' % (self.lineno, message))\r
+\r
+    # To be overridden -- handlers for unknown objects\r
+    def unknown_starttag(self, tag, attrs): pass\r
+    def unknown_endtag(self, tag): pass\r
+    def unknown_charref(self, ref): pass\r
+    def unknown_entityref(self, name):\r
+        self.syntax_error("reference to unknown entity `&%s;'" % name)\r
+\r
+\r
+class TestXMLParser(XMLParser):\r
+\r
+    def __init__(self, **kw):\r
+        self.testdata = ""\r
+        XMLParser.__init__(self, **kw)\r
+\r
+    def handle_xml(self, encoding, standalone):\r
+        self.flush()\r
+        print 'xml: encoding =',encoding,'standalone =',standalone\r
+\r
+    def handle_doctype(self, tag, pubid, syslit, data):\r
+        self.flush()\r
+        print 'DOCTYPE:',tag, repr(data)\r
+\r
+    def handle_data(self, data):\r
+        self.testdata = self.testdata + data\r
+        if len(repr(self.testdata)) >= 70:\r
+            self.flush()\r
+\r
+    def flush(self):\r
+        data = self.testdata\r
+        if data:\r
+            self.testdata = ""\r
+            print 'data:', repr(data)\r
+\r
+    def handle_cdata(self, data):\r
+        self.flush()\r
+        print 'cdata:', repr(data)\r
+\r
+    def handle_proc(self, name, data):\r
+        self.flush()\r
+        print 'processing:',name,repr(data)\r
+\r
+    def handle_comment(self, data):\r
+        self.flush()\r
+        r = repr(data)\r
+        if len(r) > 68:\r
+            r = r[:32] + '...' + r[-32:]\r
+        print 'comment:', r\r
+\r
+    def syntax_error(self, message):\r
+        print 'error at line %d:' % self.lineno, message\r
+\r
+    def unknown_starttag(self, tag, attrs):\r
+        self.flush()\r
+        if not attrs:\r
+            print 'start tag: <' + tag + '>'\r
+        else:\r
+            print 'start tag: <' + tag,\r
+            for name, value in attrs.items():\r
+                print name + '=' + '"' + value + '"',\r
+            print '>'\r
+\r
+    def unknown_endtag(self, tag):\r
+        self.flush()\r
+        print 'end tag: </' + tag + '>'\r
+\r
+    def unknown_entityref(self, ref):\r
+        self.flush()\r
+        print '*** unknown entity ref: &' + ref + ';'\r
+\r
+    def unknown_charref(self, ref):\r
+        self.flush()\r
+        print '*** unknown char ref: &#' + ref + ';'\r
+\r
+    def close(self):\r
+        XMLParser.close(self)\r
+        self.flush()\r
+\r
+def test(args = None):\r
+    import sys, getopt\r
+    from time import time\r
+\r
+    if not args:\r
+        args = sys.argv[1:]\r
+\r
+    opts, args = getopt.getopt(args, 'st')\r
+    klass = TestXMLParser\r
+    do_time = 0\r
+    for o, a in opts:\r
+        if o == '-s':\r
+            klass = XMLParser\r
+        elif o == '-t':\r
+            do_time = 1\r
+\r
+    if args:\r
+        file = args[0]\r
+    else:\r
+        file = 'test.xml'\r
+\r
+    if file == '-':\r
+        f = sys.stdin\r
+    else:\r
+        try:\r
+            f = open(file, 'r')\r
+        except IOError, msg:\r
+            print file, ":", msg\r
+            sys.exit(1)\r
+\r
+    data = f.read()\r
+    if f is not sys.stdin:\r
+        f.close()\r
+\r
+    x = klass()\r
+    t0 = time()\r
+    try:\r
+        if do_time:\r
+            x.feed(data)\r
+            x.close()\r
+        else:\r
+            for c in data:\r
+                x.feed(c)\r
+            x.close()\r
+    except Error, msg:\r
+        t1 = time()\r
+        print msg\r
+        if do_time:\r
+            print 'total time: %g' % (t1-t0)\r
+        sys.exit(1)\r
+    t1 = time()\r
+    if do_time:\r
+        print 'total time: %g' % (t1-t0)\r
+\r
+\r
+if __name__ == '__main__':\r
+    test()\r
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/zipfile.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/zipfile.py
new file mode 100644 (file)
index 0000000..96010ec
--- /dev/null
@@ -0,0 +1,1539 @@
+"""\r
+Read and write ZIP files.\r
+"""\r
+import struct, os, time, sys, shutil\r
+import binascii, cStringIO, stat\r
+import io\r
+import re\r
+import string\r
+\r
+try:\r
+    import zlib # We may need its compression method\r
+    crc32 = zlib.crc32\r
+except ImportError:\r
+    zlib = None\r
+    crc32 = binascii.crc32\r
+\r
+__all__ = ["BadZipfile", "error", "ZIP_STORED", "ZIP_DEFLATED", "is_zipfile",\r
+           "ZipInfo", "ZipFile", "PyZipFile", "LargeZipFile" ]\r
+\r
+class BadZipfile(Exception):\r
+    pass\r
+\r
+\r
+class LargeZipFile(Exception):\r
+    """\r
+    Raised when writing a zipfile, the zipfile requires ZIP64 extensions\r
+    and those extensions are disabled.\r
+    """\r
+\r
+error = BadZipfile      # The exception raised by this module\r
+\r
+ZIP64_LIMIT = (1 << 31) - 1\r
+ZIP_FILECOUNT_LIMIT = (1 << 16) - 1\r
+ZIP_MAX_COMMENT = (1 << 16) - 1\r
+\r
+# constants for Zip file compression methods\r
+ZIP_STORED = 0\r
+ZIP_DEFLATED = 8\r
+# Other ZIP compression methods not supported\r
+\r
+# Below are some formats and associated data for reading/writing headers using\r
+# the struct module.  The names and structures of headers/records are those used\r
+# in the PKWARE description of the ZIP file format:\r
+#     http://www.pkware.com/documents/casestudies/APPNOTE.TXT\r
+# (URL valid as of January 2008)\r
+\r
+# The "end of central directory" structure, magic number, size, and indices\r
+# (section V.I in the format document)\r
+structEndArchive = "<4s4H2LH"\r
+stringEndArchive = "PK\005\006"\r
+sizeEndCentDir = struct.calcsize(structEndArchive)\r
+\r
+_ECD_SIGNATURE = 0\r
+_ECD_DISK_NUMBER = 1\r
+_ECD_DISK_START = 2\r
+_ECD_ENTRIES_THIS_DISK = 3\r
+_ECD_ENTRIES_TOTAL = 4\r
+_ECD_SIZE = 5\r
+_ECD_OFFSET = 6\r
+_ECD_COMMENT_SIZE = 7\r
+# These last two indices are not part of the structure as defined in the\r
+# spec, but they are used internally by this module as a convenience\r
+_ECD_COMMENT = 8\r
+_ECD_LOCATION = 9\r
+\r
+# The "central directory" structure, magic number, size, and indices\r
+# of entries in the structure (section V.F in the format document)\r
+structCentralDir = "<4s4B4HL2L5H2L"\r
+stringCentralDir = "PK\001\002"\r
+sizeCentralDir = struct.calcsize(structCentralDir)\r
+\r
+# indexes of entries in the central directory structure\r
+_CD_SIGNATURE = 0\r
+_CD_CREATE_VERSION = 1\r
+_CD_CREATE_SYSTEM = 2\r
+_CD_EXTRACT_VERSION = 3\r
+_CD_EXTRACT_SYSTEM = 4\r
+_CD_FLAG_BITS = 5\r
+_CD_COMPRESS_TYPE = 6\r
+_CD_TIME = 7\r
+_CD_DATE = 8\r
+_CD_CRC = 9\r
+_CD_COMPRESSED_SIZE = 10\r
+_CD_UNCOMPRESSED_SIZE = 11\r
+_CD_FILENAME_LENGTH = 12\r
+_CD_EXTRA_FIELD_LENGTH = 13\r
+_CD_COMMENT_LENGTH = 14\r
+_CD_DISK_NUMBER_START = 15\r
+_CD_INTERNAL_FILE_ATTRIBUTES = 16\r
+_CD_EXTERNAL_FILE_ATTRIBUTES = 17\r
+_CD_LOCAL_HEADER_OFFSET = 18\r
+\r
+# The "local file header" structure, magic number, size, and indices\r
+# (section V.A in the format document)\r
+structFileHeader = "<4s2B4HL2L2H"\r
+stringFileHeader = "PK\003\004"\r
+sizeFileHeader = struct.calcsize(structFileHeader)\r
+\r
+_FH_SIGNATURE = 0\r
+_FH_EXTRACT_VERSION = 1\r
+_FH_EXTRACT_SYSTEM = 2\r
+_FH_GENERAL_PURPOSE_FLAG_BITS = 3\r
+_FH_COMPRESSION_METHOD = 4\r
+_FH_LAST_MOD_TIME = 5\r
+_FH_LAST_MOD_DATE = 6\r
+_FH_CRC = 7\r
+_FH_COMPRESSED_SIZE = 8\r
+_FH_UNCOMPRESSED_SIZE = 9\r
+_FH_FILENAME_LENGTH = 10\r
+_FH_EXTRA_FIELD_LENGTH = 11\r
+\r
+# The "Zip64 end of central directory locator" structure, magic number, and size\r
+structEndArchive64Locator = "<4sLQL"\r
+stringEndArchive64Locator = "PK\x06\x07"\r
+sizeEndCentDir64Locator = struct.calcsize(structEndArchive64Locator)\r
+\r
+# The "Zip64 end of central directory" record, magic number, size, and indices\r
+# (section V.G in the format document)\r
+structEndArchive64 = "<4sQ2H2L4Q"\r
+stringEndArchive64 = "PK\x06\x06"\r
+sizeEndCentDir64 = struct.calcsize(structEndArchive64)\r
+\r
+_CD64_SIGNATURE = 0\r
+_CD64_DIRECTORY_RECSIZE = 1\r
+_CD64_CREATE_VERSION = 2\r
+_CD64_EXTRACT_VERSION = 3\r
+_CD64_DISK_NUMBER = 4\r
+_CD64_DISK_NUMBER_START = 5\r
+_CD64_NUMBER_ENTRIES_THIS_DISK = 6\r
+_CD64_NUMBER_ENTRIES_TOTAL = 7\r
+_CD64_DIRECTORY_SIZE = 8\r
+_CD64_OFFSET_START_CENTDIR = 9\r
+\r
+def _check_zipfile(fp):\r
+    try:\r
+        if _EndRecData(fp):\r
+            return True         # file has correct magic number\r
+    except IOError:\r
+        pass\r
+    return False\r
+\r
+def is_zipfile(filename):\r
+    """Quickly see if a file is a ZIP file by checking the magic number.\r
+\r
+    The filename argument may be a file or file-like object too.\r
+    """\r
+    result = False\r
+    try:\r
+        if hasattr(filename, "read"):\r
+            result = _check_zipfile(fp=filename)\r
+        else:\r
+            with open(filename, "rb") as fp:\r
+                result = _check_zipfile(fp)\r
+    except IOError:\r
+        pass\r
+    return result\r
+\r
+def _EndRecData64(fpin, offset, endrec):\r
+    """\r
+    Read the ZIP64 end-of-archive records and use that to update endrec\r
+    """\r
+    try:\r
+        fpin.seek(offset - sizeEndCentDir64Locator, 2)\r
+    except IOError:\r
+        # If the seek fails, the file is not large enough to contain a ZIP64\r
+        # end-of-archive record, so just return the end record we were given.\r
+        return endrec\r
+\r
+    data = fpin.read(sizeEndCentDir64Locator)\r
+    if len(data) != sizeEndCentDir64Locator:\r
+        return endrec\r
+    sig, diskno, reloff, disks = struct.unpack(structEndArchive64Locator, data)\r
+    if sig != stringEndArchive64Locator:\r
+        return endrec\r
+\r
+    if diskno != 0 or disks != 1:\r
+        raise BadZipfile("zipfiles that span multiple disks are not supported")\r
+\r
+    # Assume no 'zip64 extensible data'\r
+    fpin.seek(offset - sizeEndCentDir64Locator - sizeEndCentDir64, 2)\r
+    data = fpin.read(sizeEndCentDir64)\r
+    if len(data) != sizeEndCentDir64:\r
+        return endrec\r
+    sig, sz, create_version, read_version, disk_num, disk_dir, \\r
+            dircount, dircount2, dirsize, diroffset = \\r
+            struct.unpack(structEndArchive64, data)\r
+    if sig != stringEndArchive64:\r
+        return endrec\r
+\r
+    # Update the original endrec using data from the ZIP64 record\r
+    endrec[_ECD_SIGNATURE] = sig\r
+    endrec[_ECD_DISK_NUMBER] = disk_num\r
+    endrec[_ECD_DISK_START] = disk_dir\r
+    endrec[_ECD_ENTRIES_THIS_DISK] = dircount\r
+    endrec[_ECD_ENTRIES_TOTAL] = dircount2\r
+    endrec[_ECD_SIZE] = dirsize\r
+    endrec[_ECD_OFFSET] = diroffset\r
+    return endrec\r
+\r
+\r
+def _EndRecData(fpin):\r
+    """Return data from the "End of Central Directory" record, or None.\r
+\r
+    The data is a list of the nine items in the ZIP "End of central dir"\r
+    record followed by a tenth item, the file seek offset of this record."""\r
+\r
+    # Determine file size\r
+    fpin.seek(0, 2)\r
+    filesize = fpin.tell()\r
+\r
+    # Check to see if this is ZIP file with no archive comment (the\r
+    # "end of central directory" structure should be the last item in the\r
+    # file if this is the case).\r
+    try:\r
+        fpin.seek(-sizeEndCentDir, 2)\r
+    except IOError:\r
+        return None\r
+    data = fpin.read()\r
+    if (len(data) == sizeEndCentDir and\r
+        data[0:4] == stringEndArchive and\r
+        data[-2:] == b"\000\000"):\r
+        # the signature is correct and there's no comment, unpack structure\r
+        endrec = struct.unpack(structEndArchive, data)\r
+        endrec=list(endrec)\r
+\r
+        # Append a blank comment and record start offset\r
+        endrec.append("")\r
+        endrec.append(filesize - sizeEndCentDir)\r
+\r
+        # Try to read the "Zip64 end of central directory" structure\r
+        return _EndRecData64(fpin, -sizeEndCentDir, endrec)\r
+\r
+    # Either this is not a ZIP file, or it is a ZIP file with an archive\r
+    # comment.  Search the end of the file for the "end of central directory"\r
+    # record signature. The comment is the last item in the ZIP file and may be\r
+    # up to 64K long.  It is assumed that the "end of central directory" magic\r
+    # number does not appear in the comment.\r
+    maxCommentStart = max(filesize - (1 << 16) - sizeEndCentDir, 0)\r
+    fpin.seek(maxCommentStart, 0)\r
+    data = fpin.read()\r
+    start = data.rfind(stringEndArchive)\r
+    if start >= 0:\r
+        # found the magic number; attempt to unpack and interpret\r
+        recData = data[start:start+sizeEndCentDir]\r
+        if len(recData) != sizeEndCentDir:\r
+            # Zip file is corrupted.\r
+            return None\r
+        endrec = list(struct.unpack(structEndArchive, recData))\r
+        commentSize = endrec[_ECD_COMMENT_SIZE] #as claimed by the zip file\r
+        comment = data[start+sizeEndCentDir:start+sizeEndCentDir+commentSize]\r
+        endrec.append(comment)\r
+        endrec.append(maxCommentStart + start)\r
+\r
+        # Try to read the "Zip64 end of central directory" structure\r
+        return _EndRecData64(fpin, maxCommentStart + start - filesize,\r
+                             endrec)\r
+\r
+    # Unable to find a valid end of central directory structure\r
+    return None\r
+\r
+\r
+class ZipInfo (object):\r
+    """Class with attributes describing each file in the ZIP archive."""\r
+\r
+    __slots__ = (\r
+            'orig_filename',\r
+            'filename',\r
+            'date_time',\r
+            'compress_type',\r
+            'comment',\r
+            'extra',\r
+            'create_system',\r
+            'create_version',\r
+            'extract_version',\r
+            'reserved',\r
+            'flag_bits',\r
+            'volume',\r
+            'internal_attr',\r
+            'external_attr',\r
+            'header_offset',\r
+            'CRC',\r
+            'compress_size',\r
+            'file_size',\r
+            '_raw_time',\r
+        )\r
+\r
+    def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)):\r
+        self.orig_filename = filename   # Original file name in archive\r
+\r
+        # Terminate the file name at the first null byte.  Null bytes in file\r
+        # names are used as tricks by viruses in archives.\r
+        null_byte = filename.find(chr(0))\r
+        if null_byte >= 0:\r
+            filename = filename[0:null_byte]\r
+        # This is used to ensure paths in generated ZIP files always use\r
+        # forward slashes as the directory separator, as required by the\r
+        # ZIP format specification.\r
+        if os.sep != "/" and os.sep in filename:\r
+            filename = filename.replace(os.sep, "/")\r
+\r
+        self.filename = filename        # Normalized file name\r
+        self.date_time = date_time      # year, month, day, hour, min, sec\r
+\r
+        if date_time[0] < 1980:\r
+            raise ValueError('ZIP does not support timestamps before 1980')\r
+\r
+        # Standard values:\r
+        self.compress_type = ZIP_STORED # Type of compression for the file\r
+        self.comment = ""               # Comment for each file\r
+        self.extra = ""                 # ZIP extra data\r
+        if sys.platform == 'win32':\r
+            self.create_system = 0          # System which created ZIP archive\r
+        else:\r
+            # Assume everything else is unix-y\r
+            self.create_system = 3          # System which created ZIP archive\r
+        self.create_version = 20        # Version which created ZIP archive\r
+        self.extract_version = 20       # Version needed to extract archive\r
+        self.reserved = 0               # Must be zero\r
+        self.flag_bits = 0              # ZIP flag bits\r
+        self.volume = 0                 # Volume number of file header\r
+        self.internal_attr = 0          # Internal attributes\r
+        self.external_attr = 0          # External file attributes\r
+        # Other attributes are set by class ZipFile:\r
+        # header_offset         Byte offset to the file header\r
+        # CRC                   CRC-32 of the uncompressed file\r
+        # compress_size         Size of the compressed file\r
+        # file_size             Size of the uncompressed file\r
+\r
+    def FileHeader(self, zip64=None):\r
+        """Return the per-file header as a string."""\r
+        dt = self.date_time\r
+        dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2]\r
+        dostime = dt[3] << 11 | dt[4] << 5 | (dt[5] // 2)\r
+        if self.flag_bits & 0x08:\r
+            # Set these to zero because we write them after the file data\r
+            CRC = compress_size = file_size = 0\r
+        else:\r
+            CRC = self.CRC\r
+            compress_size = self.compress_size\r
+            file_size = self.file_size\r
+\r
+        extra = self.extra\r
+\r
+        if zip64 is None:\r
+            zip64 = file_size > ZIP64_LIMIT or compress_size > ZIP64_LIMIT\r
+        if zip64:\r
+            fmt = '<HHQQ'\r
+            extra = extra + struct.pack(fmt,\r
+                    1, struct.calcsize(fmt)-4, file_size, compress_size)\r
+        if file_size > ZIP64_LIMIT or compress_size > ZIP64_LIMIT:\r
+            if not zip64:\r
+                raise LargeZipFile("Filesize would require ZIP64 extensions")\r
+            # File is larger than what fits into a 4 byte integer,\r
+            # fall back to the ZIP64 extension\r
+            file_size = 0xffffffff\r
+            compress_size = 0xffffffff\r
+            self.extract_version = max(45, self.extract_version)\r
+            self.create_version = max(45, self.extract_version)\r
+\r
+        filename, flag_bits = self._encodeFilenameFlags()\r
+        header = struct.pack(structFileHeader, stringFileHeader,\r
+                 self.extract_version, self.reserved, flag_bits,\r
+                 self.compress_type, dostime, dosdate, CRC,\r
+                 compress_size, file_size,\r
+                 len(filename), len(extra))\r
+        return header + filename + extra\r
+\r
+    def _encodeFilenameFlags(self):\r
+        if isinstance(self.filename, unicode):\r
+            try:\r
+                return self.filename.encode('ascii'), self.flag_bits\r
+            except UnicodeEncodeError:\r
+                return self.filename.encode('utf-8'), self.flag_bits | 0x800\r
+        else:\r
+            return self.filename, self.flag_bits\r
+\r
+    def _decodeFilename(self):\r
+        if self.flag_bits & 0x800:\r
+            return self.filename.decode('utf-8')\r
+        else:\r
+            return self.filename\r
+\r
+    def _decodeExtra(self):\r
+        # Try to decode the extra field.\r
+        extra = self.extra\r
+        unpack = struct.unpack\r
+        while len(extra) >= 4:\r
+            tp, ln = unpack('<HH', extra[:4])\r
+            if tp == 1:\r
+                if ln >= 24:\r
+                    counts = unpack('<QQQ', extra[4:28])\r
+                elif ln == 16:\r
+                    counts = unpack('<QQ', extra[4:20])\r
+                elif ln == 8:\r
+                    counts = unpack('<Q', extra[4:12])\r
+                elif ln == 0:\r
+                    counts = ()\r
+                else:\r
+                    raise RuntimeError, "Corrupt extra field %s"%(ln,)\r
+\r
+                idx = 0\r
+\r
+                # ZIP64 extension (large files and/or large archives)\r
+                if self.file_size in (0xffffffffffffffffL, 0xffffffffL):\r
+                    self.file_size = counts[idx]\r
+                    idx += 1\r
+\r
+                if self.compress_size == 0xFFFFFFFFL:\r
+                    self.compress_size = counts[idx]\r
+                    idx += 1\r
+\r
+                if self.header_offset == 0xffffffffL:\r
+                    old = self.header_offset\r
+                    self.header_offset = counts[idx]\r
+                    idx+=1\r
+\r
+            extra = extra[ln+4:]\r
+\r
+\r
+class _ZipDecrypter:\r
+    """Class to handle decryption of files stored within a ZIP archive.\r
+\r
+    ZIP supports a password-based form of encryption. Even though known\r
+    plaintext attacks have been found against it, it is still useful\r
+    to be able to get data out of such a file.\r
+\r
+    Usage:\r
+        zd = _ZipDecrypter(mypwd)\r
+        plain_char = zd(cypher_char)\r
+        plain_text = map(zd, cypher_text)\r
+    """\r
+\r
+    def _GenerateCRCTable():\r
+        """Generate a CRC-32 table.\r
+\r
+        ZIP encryption uses the CRC32 one-byte primitive for scrambling some\r
+        internal keys. We noticed that a direct implementation is faster than\r
+        relying on binascii.crc32().\r
+        """\r
+        poly = 0xedb88320\r
+        table = [0] * 256\r
+        for i in range(256):\r
+            crc = i\r
+            for j in range(8):\r
+                if crc & 1:\r
+                    crc = ((crc >> 1) & 0x7FFFFFFF) ^ poly\r
+                else:\r
+                    crc = ((crc >> 1) & 0x7FFFFFFF)\r
+            table[i] = crc\r
+        return table\r
+    crctable = _GenerateCRCTable()\r
+\r
+    def _crc32(self, ch, crc):\r
+        """Compute the CRC32 primitive on one byte."""\r
+        return ((crc >> 8) & 0xffffff) ^ self.crctable[(crc ^ ord(ch)) & 0xff]\r
+\r
+    def __init__(self, pwd):\r
+        self.key0 = 305419896\r
+        self.key1 = 591751049\r
+        self.key2 = 878082192\r
+        for p in pwd:\r
+            self._UpdateKeys(p)\r
+\r
+    def _UpdateKeys(self, c):\r
+        self.key0 = self._crc32(c, self.key0)\r
+        self.key1 = (self.key1 + (self.key0 & 255)) & 4294967295\r
+        self.key1 = (self.key1 * 134775813 + 1) & 4294967295\r
+        self.key2 = self._crc32(chr((self.key1 >> 24) & 255), self.key2)\r
+\r
+    def __call__(self, c):\r
+        """Decrypt a single character."""\r
+        c = ord(c)\r
+        k = self.key2 | 2\r
+        c = c ^ (((k * (k^1)) >> 8) & 255)\r
+        c = chr(c)\r
+        self._UpdateKeys(c)\r
+        return c\r
+\r
+\r
+compressor_names = {\r
+    0: 'store',\r
+    1: 'shrink',\r
+    2: 'reduce',\r
+    3: 'reduce',\r
+    4: 'reduce',\r
+    5: 'reduce',\r
+    6: 'implode',\r
+    7: 'tokenize',\r
+    8: 'deflate',\r
+    9: 'deflate64',\r
+    10: 'implode',\r
+    12: 'bzip2',\r
+    14: 'lzma',\r
+    18: 'terse',\r
+    19: 'lz77',\r
+    97: 'wavpack',\r
+    98: 'ppmd',\r
+}\r
+\r
+\r
+class ZipExtFile(io.BufferedIOBase):\r
+    """File-like object for reading an archive member.\r
+       Is returned by ZipFile.open().\r
+    """\r
+\r
+    # Max size supported by decompressor.\r
+    MAX_N = 1 << 31 - 1\r
+\r
+    # Read from compressed files in 4k blocks.\r
+    MIN_READ_SIZE = 4096\r
+\r
+    # Search for universal newlines or line chunks.\r
+    PATTERN = re.compile(r'^(?P<chunk>[^\r\n]+)|(?P<newline>\n|\r\n?)')\r
+\r
+    def __init__(self, fileobj, mode, zipinfo, decrypter=None,\r
+            close_fileobj=False):\r
+        self._fileobj = fileobj\r
+        self._decrypter = decrypter\r
+        self._close_fileobj = close_fileobj\r
+\r
+        self._compress_type = zipinfo.compress_type\r
+        self._compress_size = zipinfo.compress_size\r
+        self._compress_left = zipinfo.compress_size\r
+\r
+        if self._compress_type == ZIP_DEFLATED:\r
+            self._decompressor = zlib.decompressobj(-15)\r
+        elif self._compress_type != ZIP_STORED:\r
+            descr = compressor_names.get(self._compress_type)\r
+            if descr:\r
+                raise NotImplementedError("compression type %d (%s)" % (self._compress_type, descr))\r
+            else:\r
+                raise NotImplementedError("compression type %d" % (self._compress_type,))\r
+        self._unconsumed = ''\r
+\r
+        self._readbuffer = ''\r
+        self._offset = 0\r
+\r
+        self._universal = 'U' in mode\r
+        self.newlines = None\r
+\r
+        # Adjust read size for encrypted files since the first 12 bytes\r
+        # are for the encryption/password information.\r
+        if self._decrypter is not None:\r
+            self._compress_left -= 12\r
+\r
+        self.mode = mode\r
+        self.name = zipinfo.filename\r
+\r
+        if hasattr(zipinfo, 'CRC'):\r
+            self._expected_crc = zipinfo.CRC\r
+            self._running_crc = crc32(b'') & 0xffffffff\r
+        else:\r
+            self._expected_crc = None\r
+\r
+    def readline(self, limit=-1):\r
+        """Read and return a line from the stream.\r
+\r
+        If limit is specified, at most limit bytes will be read.\r
+        """\r
+\r
+        if not self._universal and limit < 0:\r
+            # Shortcut common case - newline found in buffer.\r
+            i = self._readbuffer.find('\n', self._offset) + 1\r
+            if i > 0:\r
+                line = self._readbuffer[self._offset: i]\r
+                self._offset = i\r
+                return line\r
+\r
+        if not self._universal:\r
+            return io.BufferedIOBase.readline(self, limit)\r
+\r
+        line = ''\r
+        while limit < 0 or len(line) < limit:\r
+            readahead = self.peek(2)\r
+            if readahead == '':\r
+                return line\r
+\r
+            #\r
+            # Search for universal newlines or line chunks.\r
+            #\r
+            # The pattern returns either a line chunk or a newline, but not\r
+            # both. Combined with peek(2), we are assured that the sequence\r
+            # '\r\n' is always retrieved completely and never split into\r
+            # separate newlines - '\r', '\n' due to coincidental readaheads.\r
+            #\r
+            match = self.PATTERN.search(readahead)\r
+            newline = match.group('newline')\r
+            if newline is not None:\r
+                if self.newlines is None:\r
+                    self.newlines = []\r
+                if newline not in self.newlines:\r
+                    self.newlines.append(newline)\r
+                self._offset += len(newline)\r
+                return line + '\n'\r
+\r
+            chunk = match.group('chunk')\r
+            if limit >= 0:\r
+                chunk = chunk[: limit - len(line)]\r
+\r
+            self._offset += len(chunk)\r
+            line += chunk\r
+\r
+        return line\r
+\r
+    def peek(self, n=1):\r
+        """Returns buffered bytes without advancing the position."""\r
+        if n > len(self._readbuffer) - self._offset:\r
+            chunk = self.read(n)\r
+            if len(chunk) > self._offset:\r
+                self._readbuffer = chunk + self._readbuffer[self._offset:]\r
+                self._offset = 0\r
+            else:\r
+                self._offset -= len(chunk)\r
+\r
+        # Return up to 512 bytes to reduce allocation overhead for tight loops.\r
+        return self._readbuffer[self._offset: self._offset + 512]\r
+\r
+    def readable(self):\r
+        return True\r
+\r
+    def read(self, n=-1):\r
+        """Read and return up to n bytes.\r
+        If the argument is omitted, None, or negative, data is read and returned until EOF is reached..\r
+        """\r
+        buf = ''\r
+        if n is None:\r
+            n = -1\r
+        while True:\r
+            if n < 0:\r
+                data = self.read1(n)\r
+            elif n > len(buf):\r
+                data = self.read1(n - len(buf))\r
+            else:\r
+                return buf\r
+            if len(data) == 0:\r
+                return buf\r
+            buf += data\r
+\r
+    def _update_crc(self, newdata, eof):\r
+        # Update the CRC using the given data.\r
+        if self._expected_crc is None:\r
+            # No need to compute the CRC if we don't have a reference value\r
+            return\r
+        self._running_crc = crc32(newdata, self._running_crc) & 0xffffffff\r
+        # Check the CRC if we're at the end of the file\r
+        if eof and self._running_crc != self._expected_crc:\r
+            raise BadZipfile("Bad CRC-32 for file %r" % self.name)\r
+\r
+    def read1(self, n):\r
+        """Read up to n bytes with at most one read() system call."""\r
+\r
+        # Simplify algorithm (branching) by transforming negative n to large n.\r
+        if n < 0 or n is None:\r
+            n = self.MAX_N\r
+\r
+        # Bytes available in read buffer.\r
+        len_readbuffer = len(self._readbuffer) - self._offset\r
+\r
+        # Read from file.\r
+        if self._compress_left > 0 and n > len_readbuffer + len(self._unconsumed):\r
+            nbytes = n - len_readbuffer - len(self._unconsumed)\r
+            nbytes = max(nbytes, self.MIN_READ_SIZE)\r
+            nbytes = min(nbytes, self._compress_left)\r
+\r
+            data = self._fileobj.read(nbytes)\r
+            self._compress_left -= len(data)\r
+\r
+            if data and self._decrypter is not None:\r
+                data = ''.join(map(self._decrypter, data))\r
+\r
+            if self._compress_type == ZIP_STORED:\r
+                self._update_crc(data, eof=(self._compress_left==0))\r
+                self._readbuffer = self._readbuffer[self._offset:] + data\r
+                self._offset = 0\r
+            else:\r
+                # Prepare deflated bytes for decompression.\r
+                self._unconsumed += data\r
+\r
+        # Handle unconsumed data.\r
+        if (len(self._unconsumed) > 0 and n > len_readbuffer and\r
+            self._compress_type == ZIP_DEFLATED):\r
+            data = self._decompressor.decompress(\r
+                self._unconsumed,\r
+                max(n - len_readbuffer, self.MIN_READ_SIZE)\r
+            )\r
+\r
+            self._unconsumed = self._decompressor.unconsumed_tail\r
+            eof = len(self._unconsumed) == 0 and self._compress_left == 0\r
+            if eof:\r
+                data += self._decompressor.flush()\r
+\r
+            self._update_crc(data, eof=eof)\r
+            self._readbuffer = self._readbuffer[self._offset:] + data\r
+            self._offset = 0\r
+\r
+        # Read from buffer.\r
+        data = self._readbuffer[self._offset: self._offset + n]\r
+        self._offset += len(data)\r
+        return data\r
+\r
+    def close(self):\r
+        try :\r
+            if self._close_fileobj:\r
+                self._fileobj.close()\r
+        finally:\r
+            super(ZipExtFile, self).close()\r
+\r
+\r
+class ZipFile(object):\r
+    """ Class with methods to open, read, write, close, list zip files.\r
+\r
+    z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=False)\r
+\r
+    file: Either the path to the file, or a file-like object.\r
+          If it is a path, the file will be opened and closed by ZipFile.\r
+    mode: The mode can be either read "r", write "w" or append "a".\r
+    compression: ZIP_STORED (no compression) or ZIP_DEFLATED (requires zlib).\r
+    allowZip64: if True ZipFile will create files with ZIP64 extensions when\r
+                needed, otherwise it will raise an exception when this would\r
+                be necessary.\r
+\r
+    """\r
+\r
+    fp = None                   # Set here since __del__ checks it\r
+\r
+    def __init__(self, file, mode="r", compression=ZIP_STORED, allowZip64=False):\r
+        """Open the ZIP file with mode read "r", write "w" or append "a"."""\r
+        if mode not in ("r", "w", "a"):\r
+            raise RuntimeError('ZipFile() requires mode "r", "w", or "a"')\r
+\r
+        if compression == ZIP_STORED:\r
+            pass\r
+        elif compression == ZIP_DEFLATED:\r
+            if not zlib:\r
+                raise RuntimeError,\\r
+                      "Compression requires the (missing) zlib module"\r
+        else:\r
+            raise RuntimeError, "That compression method is not supported"\r
+\r
+        self._allowZip64 = allowZip64\r
+        self._didModify = False\r
+        self.debug = 0  # Level of printing: 0 through 3\r
+        self.NameToInfo = {}    # Find file info given name\r
+        self.filelist = []      # List of ZipInfo instances for archive\r
+        self.compression = compression  # Method of compression\r
+        self.mode = key = mode.replace('b', '')[0]\r
+        self.pwd = None\r
+        self._comment = ''\r
+\r
+        # Check if we were passed a file-like object\r
+        if isinstance(file, basestring):\r
+            self._filePassed = 0\r
+            self.filename = file\r
+            modeDict = {'r' : 'rb', 'w': 'wb', 'a' : 'r+b'}\r
+            try:\r
+                self.fp = open(file, modeDict[mode])\r
+            except IOError:\r
+                if mode == 'a':\r
+                    mode = key = 'w'\r
+                    self.fp = open(file, modeDict[mode])\r
+                else:\r
+                    raise\r
+        else:\r
+            self._filePassed = 1\r
+            self.fp = file\r
+            self.filename = getattr(file, 'name', None)\r
+\r
+        try:\r
+            if key == 'r':\r
+                self._RealGetContents()\r
+            elif key == 'w':\r
+                # set the modified flag so central directory gets written\r
+                # even if no files are added to the archive\r
+                self._didModify = True\r
+            elif key == 'a':\r
+                try:\r
+                    # See if file is a zip file\r
+                    self._RealGetContents()\r
+                    # seek to start of directory and overwrite\r
+                    self.fp.seek(self.start_dir, 0)\r
+                except BadZipfile:\r
+                    # file is not a zip file, just append\r
+                    self.fp.seek(0, 2)\r
+\r
+                    # set the modified flag so central directory gets written\r
+                    # even if no files are added to the archive\r
+                    self._didModify = True\r
+            else:\r
+                raise RuntimeError('Mode must be "r", "w" or "a"')\r
+        except:\r
+            fp = self.fp\r
+            self.fp = None\r
+            if not self._filePassed:\r
+                fp.close()\r
+            raise\r
+\r
+    def __enter__(self):\r
+        return self\r
+\r
+    def __exit__(self, type, value, traceback):\r
+        self.close()\r
+\r
+    def _RealGetContents(self):\r
+        """Read in the table of contents for the ZIP file."""\r
+        fp = self.fp\r
+        try:\r
+            endrec = _EndRecData(fp)\r
+        except IOError:\r
+            raise BadZipfile("File is not a zip file")\r
+        if not endrec:\r
+            raise BadZipfile, "File is not a zip file"\r
+        if self.debug > 1:\r
+            print endrec\r
+        size_cd = endrec[_ECD_SIZE]             # bytes in central directory\r
+        offset_cd = endrec[_ECD_OFFSET]         # offset of central directory\r
+        self._comment = endrec[_ECD_COMMENT]    # archive comment\r
+\r
+        # "concat" is zero, unless zip was concatenated to another file\r
+        concat = endrec[_ECD_LOCATION] - size_cd - offset_cd\r
+        if endrec[_ECD_SIGNATURE] == stringEndArchive64:\r
+            # If Zip64 extension structures are present, account for them\r
+            concat -= (sizeEndCentDir64 + sizeEndCentDir64Locator)\r
+\r
+        if self.debug > 2:\r
+            inferred = concat + offset_cd\r
+            print "given, inferred, offset", offset_cd, inferred, concat\r
+        # self.start_dir:  Position of start of central directory\r
+        self.start_dir = offset_cd + concat\r
+        fp.seek(self.start_dir, 0)\r
+        data = fp.read(size_cd)\r
+        fp = cStringIO.StringIO(data)\r
+        total = 0\r
+        while total < size_cd:\r
+            centdir = fp.read(sizeCentralDir)\r
+            if len(centdir) != sizeCentralDir:\r
+                raise BadZipfile("Truncated central directory")\r
+            centdir = struct.unpack(structCentralDir, centdir)\r
+            if centdir[_CD_SIGNATURE] != stringCentralDir:\r
+                raise BadZipfile("Bad magic number for central directory")\r
+            if self.debug > 2:\r
+                print centdir\r
+            filename = fp.read(centdir[_CD_FILENAME_LENGTH])\r
+            # Create ZipInfo instance to store file information\r
+            x = ZipInfo(filename)\r
+            x.extra = fp.read(centdir[_CD_EXTRA_FIELD_LENGTH])\r
+            x.comment = fp.read(centdir[_CD_COMMENT_LENGTH])\r
+            x.header_offset = centdir[_CD_LOCAL_HEADER_OFFSET]\r
+            (x.create_version, x.create_system, x.extract_version, x.reserved,\r
+                x.flag_bits, x.compress_type, t, d,\r
+                x.CRC, x.compress_size, x.file_size) = centdir[1:12]\r
+            x.volume, x.internal_attr, x.external_attr = centdir[15:18]\r
+            # Convert date/time code to (year, month, day, hour, min, sec)\r
+            x._raw_time = t\r
+            x.date_time = ( (d>>9)+1980, (d>>5)&0xF, d&0x1F,\r
+                                     t>>11, (t>>5)&0x3F, (t&0x1F) * 2 )\r
+\r
+            x._decodeExtra()\r
+            x.header_offset = x.header_offset + concat\r
+            x.filename = x._decodeFilename()\r
+            self.filelist.append(x)\r
+            self.NameToInfo[x.filename] = x\r
+\r
+            # update total bytes read from central directory\r
+            total = (total + sizeCentralDir + centdir[_CD_FILENAME_LENGTH]\r
+                     + centdir[_CD_EXTRA_FIELD_LENGTH]\r
+                     + centdir[_CD_COMMENT_LENGTH])\r
+\r
+            if self.debug > 2:\r
+                print "total", total\r
+\r
+\r
+    def namelist(self):\r
+        """Return a list of file names in the archive."""\r
+        l = []\r
+        for data in self.filelist:\r
+            l.append(data.filename)\r
+        return l\r
+\r
+    def infolist(self):\r
+        """Return a list of class ZipInfo instances for files in the\r
+        archive."""\r
+        return self.filelist\r
+\r
+    def printdir(self):\r
+        """Print a table of contents for the zip file."""\r
+        print "%-46s %19s %12s" % ("File Name", "Modified    ", "Size")\r
+        for zinfo in self.filelist:\r
+            date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]\r
+            print "%-46s %s %12d" % (zinfo.filename, date, zinfo.file_size)\r
+\r
+    def testzip(self):\r
+        """Read all the files and check the CRC."""\r
+        chunk_size = 2 ** 20\r
+        for zinfo in self.filelist:\r
+            try:\r
+                # Read by chunks, to avoid an OverflowError or a\r
+                # MemoryError with very large embedded files.\r
+                with self.open(zinfo.filename, "r") as f:\r
+                    while f.read(chunk_size):     # Check CRC-32\r
+                        pass\r
+            except BadZipfile:\r
+                return zinfo.filename\r
+\r
+    def getinfo(self, name):\r
+        """Return the instance of ZipInfo given 'name'."""\r
+        info = self.NameToInfo.get(name)\r
+        if info is None:\r
+            raise KeyError(\r
+                'There is no item named %r in the archive' % name)\r
+\r
+        return info\r
+\r
+    def setpassword(self, pwd):\r
+        """Set default password for encrypted files."""\r
+        self.pwd = pwd\r
+\r
+    @property\r
+    def comment(self):\r
+        """The comment text associated with the ZIP file."""\r
+        return self._comment\r
+\r
+    @comment.setter\r
+    def comment(self, comment):\r
+        # check for valid comment length\r
+        if len(comment) > ZIP_MAX_COMMENT:\r
+            import warnings\r
+            warnings.warn('Archive comment is too long; truncating to %d bytes'\r
+                          % ZIP_MAX_COMMENT, stacklevel=2)\r
+            comment = comment[:ZIP_MAX_COMMENT]\r
+        self._comment = comment\r
+        self._didModify = True\r
+\r
+    def read(self, name, pwd=None):\r
+        """Return file bytes (as a string) for name."""\r
+        return self.open(name, "r", pwd).read()\r
+\r
+    def open(self, name, mode="r", pwd=None):\r
+        """Return file-like object for 'name'."""\r
+        if mode not in ("r", "U", "rU"):\r
+            raise RuntimeError, 'open() requires mode "r", "U", or "rU"'\r
+        if not self.fp:\r
+            raise RuntimeError, \\r
+                  "Attempt to read ZIP archive that was already closed"\r
+\r
+        # Only open a new file for instances where we were not\r
+        # given a file object in the constructor\r
+        if self._filePassed:\r
+            zef_file = self.fp\r
+            should_close = False\r
+        else:\r
+            zef_file = open(self.filename, 'rb')\r
+            should_close = True\r
+\r
+        try:\r
+            # Make sure we have an info object\r
+            if isinstance(name, ZipInfo):\r
+                # 'name' is already an info object\r
+                zinfo = name\r
+            else:\r
+                # Get info object for name\r
+                zinfo = self.getinfo(name)\r
+\r
+            zef_file.seek(zinfo.header_offset, 0)\r
+\r
+            # Skip the file header:\r
+            fheader = zef_file.read(sizeFileHeader)\r
+            if len(fheader) != sizeFileHeader:\r
+                raise BadZipfile("Truncated file header")\r
+            fheader = struct.unpack(structFileHeader, fheader)\r
+            if fheader[_FH_SIGNATURE] != stringFileHeader:\r
+                raise BadZipfile("Bad magic number for file header")\r
+\r
+            fname = zef_file.read(fheader[_FH_FILENAME_LENGTH])\r
+            if fheader[_FH_EXTRA_FIELD_LENGTH]:\r
+                zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH])\r
+\r
+            if fname != zinfo.orig_filename:\r
+                raise BadZipfile, \\r
+                        'File name in directory "%s" and header "%s" differ.' % (\r
+                            zinfo.orig_filename, fname)\r
+\r
+            # check for encrypted flag & handle password\r
+            is_encrypted = zinfo.flag_bits & 0x1\r
+            zd = None\r
+            if is_encrypted:\r
+                if not pwd:\r
+                    pwd = self.pwd\r
+                if not pwd:\r
+                    raise RuntimeError, "File %s is encrypted, " \\r
+                        "password required for extraction" % name\r
+\r
+                zd = _ZipDecrypter(pwd)\r
+                # The first 12 bytes in the cypher stream is an encryption header\r
+                #  used to strengthen the algorithm. The first 11 bytes are\r
+                #  completely random, while the 12th contains the MSB of the CRC,\r
+                #  or the MSB of the file time depending on the header type\r
+                #  and is used to check the correctness of the password.\r
+                bytes = zef_file.read(12)\r
+                h = map(zd, bytes[0:12])\r
+                if zinfo.flag_bits & 0x8:\r
+                    # compare against the file type from extended local headers\r
+                    check_byte = (zinfo._raw_time >> 8) & 0xff\r
+                else:\r
+                    # compare against the CRC otherwise\r
+                    check_byte = (zinfo.CRC >> 24) & 0xff\r
+                if ord(h[11]) != check_byte:\r
+                    raise RuntimeError("Bad password for file", name)\r
+\r
+            return ZipExtFile(zef_file, mode, zinfo, zd,\r
+                    close_fileobj=should_close)\r
+        except:\r
+            if should_close:\r
+                zef_file.close()\r
+            raise\r
+\r
+    def extract(self, member, path=None, pwd=None):\r
+        """Extract a member from the archive to the current working directory,\r
+           using its full name. Its file information is extracted as accurately\r
+           as possible. `member' may be a filename or a ZipInfo object. You can\r
+           specify a different directory using `path'.\r
+        """\r
+        if not isinstance(member, ZipInfo):\r
+            member = self.getinfo(member)\r
+\r
+        if path is None:\r
+            path = os.getcwd()\r
+\r
+        return self._extract_member(member, path, pwd)\r
+\r
+    def extractall(self, path=None, members=None, pwd=None):\r
+        """Extract all members from the archive to the current working\r
+           directory. `path' specifies a different directory to extract to.\r
+           `members' is optional and must be a subset of the list returned\r
+           by namelist().\r
+        """\r
+        if members is None:\r
+            members = self.namelist()\r
+\r
+        for zipinfo in members:\r
+            self.extract(zipinfo, path, pwd)\r
+\r
+    def _extract_member(self, member, targetpath, pwd):\r
+        """Extract the ZipInfo object 'member' to a physical\r
+           file on the path targetpath.\r
+        """\r
+        # build the destination pathname, replacing\r
+        # forward slashes to platform specific separators.\r
+        arcname = member.filename.replace('/', os.path.sep)\r
+\r
+        if os.path.altsep:\r
+            arcname = arcname.replace(os.path.altsep, os.path.sep)\r
+        # interpret absolute pathname as relative, remove drive letter or\r
+        # UNC path, redundant separators, "." and ".." components.\r
+        arcname = os.path.splitdrive(arcname)[1]\r
+        arcname = os.path.sep.join(x for x in arcname.split(os.path.sep)\r
+                    if x not in ('', os.path.curdir, os.path.pardir))\r
+        if os.path.sep == '\\':\r
+            # filter illegal characters on Windows\r
+            illegal = ':<>|"?*'\r
+            if isinstance(arcname, unicode):\r
+                table = {ord(c): ord('_') for c in illegal}\r
+            else:\r
+                table = string.maketrans(illegal, '_' * len(illegal))\r
+            arcname = arcname.translate(table)\r
+            # remove trailing dots\r
+            arcname = (x.rstrip('.') for x in arcname.split(os.path.sep))\r
+            arcname = os.path.sep.join(x for x in arcname if x)\r
+\r
+        targetpath = os.path.join(targetpath, arcname)\r
+        targetpath = os.path.normpath(targetpath)\r
+\r
+        # Create all upper directories if necessary.\r
+        upperdirs = os.path.dirname(targetpath)\r
+        if upperdirs and not os.path.exists(upperdirs):\r
+            os.makedirs(upperdirs)\r
+\r
+        if member.filename[-1] == '/':\r
+            if not os.path.isdir(targetpath):\r
+                os.mkdir(targetpath)\r
+            return targetpath\r
+\r
+        with self.open(member, pwd=pwd) as source, \\r
+             file(targetpath, "wb") as target:\r
+            shutil.copyfileobj(source, target)\r
+\r
+        return targetpath\r
+\r
+    def _writecheck(self, zinfo):\r
+        """Check for errors before writing a file to the archive."""\r
+        if zinfo.filename in self.NameToInfo:\r
+            import warnings\r
+            warnings.warn('Duplicate name: %r' % zinfo.filename, stacklevel=3)\r
+        if self.mode not in ("w", "a"):\r
+            raise RuntimeError, 'write() requires mode "w" or "a"'\r
+        if not self.fp:\r
+            raise RuntimeError, \\r
+                  "Attempt to write ZIP archive that was already closed"\r
+        if zinfo.compress_type == ZIP_DEFLATED and not zlib:\r
+            raise RuntimeError, \\r
+                  "Compression requires the (missing) zlib module"\r
+        if zinfo.compress_type not in (ZIP_STORED, ZIP_DEFLATED):\r
+            raise RuntimeError, \\r
+                  "That compression method is not supported"\r
+        if not self._allowZip64:\r
+            requires_zip64 = None\r
+            if len(self.filelist) >= ZIP_FILECOUNT_LIMIT:\r
+                requires_zip64 = "Files count"\r
+            elif zinfo.file_size > ZIP64_LIMIT:\r
+                requires_zip64 = "Filesize"\r
+            elif zinfo.header_offset > ZIP64_LIMIT:\r
+                requires_zip64 = "Zipfile size"\r
+            if requires_zip64:\r
+                raise LargeZipFile(requires_zip64 +\r
+                                   " would require ZIP64 extensions")\r
+\r
+    def write(self, filename, arcname=None, compress_type=None):\r
+        """Put the bytes from filename into the archive under the name\r
+        arcname."""\r
+        if not self.fp:\r
+            raise RuntimeError(\r
+                  "Attempt to write to ZIP archive that was already closed")\r
+\r
+        st = os.stat(filename)\r
+        isdir = stat.S_ISDIR(st.st_mode)\r
+        mtime = time.localtime(st.st_mtime)\r
+        date_time = mtime[0:6]\r
+        # Create ZipInfo instance to store file information\r
+        if arcname is None:\r
+            arcname = filename\r
+        arcname = os.path.normpath(os.path.splitdrive(arcname)[1])\r
+        while arcname[0] in (os.sep, os.altsep):\r
+            arcname = arcname[1:]\r
+        if isdir:\r
+            arcname += '/'\r
+        zinfo = ZipInfo(arcname, date_time)\r
+        zinfo.external_attr = (st[0] & 0xFFFF) << 16L      # Unix attributes\r
+        if compress_type is None:\r
+            zinfo.compress_type = self.compression\r
+        else:\r
+            zinfo.compress_type = compress_type\r
+\r
+        zinfo.file_size = st.st_size\r
+        zinfo.flag_bits = 0x00\r
+        zinfo.header_offset = self.fp.tell()    # Start of header bytes\r
+\r
+        self._writecheck(zinfo)\r
+        self._didModify = True\r
+\r
+        if isdir:\r
+            zinfo.file_size = 0\r
+            zinfo.compress_size = 0\r
+            zinfo.CRC = 0\r
+            zinfo.external_attr |= 0x10  # MS-DOS directory flag\r
+            self.filelist.append(zinfo)\r
+            self.NameToInfo[zinfo.filename] = zinfo\r
+            self.fp.write(zinfo.FileHeader(False))\r
+            return\r
+\r
+        with open(filename, "rb") as fp:\r
+            # Must overwrite CRC and sizes with correct data later\r
+            zinfo.CRC = CRC = 0\r
+            zinfo.compress_size = compress_size = 0\r
+            # Compressed size can be larger than uncompressed size\r
+            zip64 = self._allowZip64 and \\r
+                    zinfo.file_size * 1.05 > ZIP64_LIMIT\r
+            self.fp.write(zinfo.FileHeader(zip64))\r
+            if zinfo.compress_type == ZIP_DEFLATED:\r
+                cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION,\r
+                     zlib.DEFLATED, -15)\r
+            else:\r
+                cmpr = None\r
+            file_size = 0\r
+            while 1:\r
+                buf = fp.read(1024 * 8)\r
+                if not buf:\r
+                    break\r
+                file_size = file_size + len(buf)\r
+                CRC = crc32(buf, CRC) & 0xffffffff\r
+                if cmpr:\r
+                    buf = cmpr.compress(buf)\r
+                    compress_size = compress_size + len(buf)\r
+                self.fp.write(buf)\r
+        if cmpr:\r
+            buf = cmpr.flush()\r
+            compress_size = compress_size + len(buf)\r
+            self.fp.write(buf)\r
+            zinfo.compress_size = compress_size\r
+        else:\r
+            zinfo.compress_size = file_size\r
+        zinfo.CRC = CRC\r
+        zinfo.file_size = file_size\r
+        if not zip64 and self._allowZip64:\r
+            if file_size > ZIP64_LIMIT:\r
+                raise RuntimeError('File size has increased during compressing')\r
+            if compress_size > ZIP64_LIMIT:\r
+                raise RuntimeError('Compressed size larger than uncompressed size')\r
+        # Seek backwards and write file header (which will now include\r
+        # correct CRC and file sizes)\r
+        position = self.fp.tell()       # Preserve current position in file\r
+        self.fp.seek(zinfo.header_offset, 0)\r
+        self.fp.write(zinfo.FileHeader(zip64))\r
+        self.fp.seek(position, 0)\r
+        self.filelist.append(zinfo)\r
+        self.NameToInfo[zinfo.filename] = zinfo\r
+\r
+    def writestr(self, zinfo_or_arcname, bytes, compress_type=None):\r
+        """Write a file into the archive.  The contents is the string\r
+        'bytes'.  'zinfo_or_arcname' is either a ZipInfo instance or\r
+        the name of the file in the archive."""\r
+        if not isinstance(zinfo_or_arcname, ZipInfo):\r
+            zinfo = ZipInfo(filename=zinfo_or_arcname,\r
+                            date_time=time.localtime(time.time())[:6])\r
+\r
+            zinfo.compress_type = self.compression\r
+            if zinfo.filename[-1] == '/':\r
+                zinfo.external_attr = 0o40775 << 16   # drwxrwxr-x\r
+                zinfo.external_attr |= 0x10           # MS-DOS directory flag\r
+            else:\r
+                zinfo.external_attr = 0o600 << 16     # ?rw-------\r
+        else:\r
+            zinfo = zinfo_or_arcname\r
+\r
+        if not self.fp:\r
+            raise RuntimeError(\r
+                  "Attempt to write to ZIP archive that was already closed")\r
+\r
+        if compress_type is not None:\r
+            zinfo.compress_type = compress_type\r
+\r
+        zinfo.file_size = len(bytes)            # Uncompressed size\r
+        zinfo.header_offset = self.fp.tell()    # Start of header bytes\r
+        self._writecheck(zinfo)\r
+        self._didModify = True\r
+        zinfo.CRC = crc32(bytes) & 0xffffffff       # CRC-32 checksum\r
+        if zinfo.compress_type == ZIP_DEFLATED:\r
+            co = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION,\r
+                 zlib.DEFLATED, -15)\r
+            bytes = co.compress(bytes) + co.flush()\r
+            zinfo.compress_size = len(bytes)    # Compressed size\r
+        else:\r
+            zinfo.compress_size = zinfo.file_size\r
+        zip64 = zinfo.file_size > ZIP64_LIMIT or \\r
+                zinfo.compress_size > ZIP64_LIMIT\r
+        if zip64 and not self._allowZip64:\r
+            raise LargeZipFile("Filesize would require ZIP64 extensions")\r
+        self.fp.write(zinfo.FileHeader(zip64))\r
+        self.fp.write(bytes)\r
+        if zinfo.flag_bits & 0x08:\r
+            # Write CRC and file sizes after the file data\r
+            fmt = '<LQQ' if zip64 else '<LLL'\r
+            self.fp.write(struct.pack(fmt, zinfo.CRC, zinfo.compress_size,\r
+                  zinfo.file_size))\r
+        self.fp.flush()\r
+        self.filelist.append(zinfo)\r
+        self.NameToInfo[zinfo.filename] = zinfo\r
+\r
+    def __del__(self):\r
+        """Call the "close()" method in case the user forgot."""\r
+        self.close()\r
+\r
+    def close(self):\r
+        """Close the file, and for mode "w" and "a" write the ending\r
+        records."""\r
+        if self.fp is None:\r
+            return\r
+\r
+        try:\r
+            if self.mode in ("w", "a") and self._didModify: # write ending records\r
+                pos1 = self.fp.tell()\r
+                for zinfo in self.filelist:         # write central directory\r
+                    dt = zinfo.date_time\r
+                    dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2]\r
+                    dostime = dt[3] << 11 | dt[4] << 5 | (dt[5] // 2)\r
+                    extra = []\r
+                    if zinfo.file_size > ZIP64_LIMIT \\r
+                            or zinfo.compress_size > ZIP64_LIMIT:\r
+                        extra.append(zinfo.file_size)\r
+                        extra.append(zinfo.compress_size)\r
+                        file_size = 0xffffffff\r
+                        compress_size = 0xffffffff\r
+                    else:\r
+                        file_size = zinfo.file_size\r
+                        compress_size = zinfo.compress_size\r
+\r
+                    if zinfo.header_offset > ZIP64_LIMIT:\r
+                        extra.append(zinfo.header_offset)\r
+                        header_offset = 0xffffffffL\r
+                    else:\r
+                        header_offset = zinfo.header_offset\r
+\r
+                    extra_data = zinfo.extra\r
+                    if extra:\r
+                        # Append a ZIP64 field to the extra's\r
+                        extra_data = struct.pack(\r
+                                '<HH' + 'Q'*len(extra),\r
+                                1, 8*len(extra), *extra) + extra_data\r
+\r
+                        extract_version = max(45, zinfo.extract_version)\r
+                        create_version = max(45, zinfo.create_version)\r
+                    else:\r
+                        extract_version = zinfo.extract_version\r
+                        create_version = zinfo.create_version\r
+\r
+                    try:\r
+                        filename, flag_bits = zinfo._encodeFilenameFlags()\r
+                        centdir = struct.pack(structCentralDir,\r
+                        stringCentralDir, create_version,\r
+                        zinfo.create_system, extract_version, zinfo.reserved,\r
+                        flag_bits, zinfo.compress_type, dostime, dosdate,\r
+                        zinfo.CRC, compress_size, file_size,\r
+                        len(filename), len(extra_data), len(zinfo.comment),\r
+                        0, zinfo.internal_attr, zinfo.external_attr,\r
+                        header_offset)\r
+                    except DeprecationWarning:\r
+                        print >>sys.stderr, (structCentralDir,\r
+                        stringCentralDir, create_version,\r
+                        zinfo.create_system, extract_version, zinfo.reserved,\r
+                        zinfo.flag_bits, zinfo.compress_type, dostime, dosdate,\r
+                        zinfo.CRC, compress_size, file_size,\r
+                        len(zinfo.filename), len(extra_data), len(zinfo.comment),\r
+                        0, zinfo.internal_attr, zinfo.external_attr,\r
+                        header_offset)\r
+                        raise\r
+                    self.fp.write(centdir)\r
+                    self.fp.write(filename)\r
+                    self.fp.write(extra_data)\r
+                    self.fp.write(zinfo.comment)\r
+\r
+                pos2 = self.fp.tell()\r
+                # Write end-of-zip-archive record\r
+                centDirCount = len(self.filelist)\r
+                centDirSize = pos2 - pos1\r
+                centDirOffset = pos1\r
+                requires_zip64 = None\r
+                if centDirCount > ZIP_FILECOUNT_LIMIT:\r
+                    requires_zip64 = "Files count"\r
+                elif centDirOffset > ZIP64_LIMIT:\r
+                    requires_zip64 = "Central directory offset"\r
+                elif centDirSize > ZIP64_LIMIT:\r
+                    requires_zip64 = "Central directory size"\r
+                if requires_zip64:\r
+                    # Need to write the ZIP64 end-of-archive records\r
+                    if not self._allowZip64:\r
+                        raise LargeZipFile(requires_zip64 +\r
+                                           " would require ZIP64 extensions")\r
+                    zip64endrec = struct.pack(\r
+                            structEndArchive64, stringEndArchive64,\r
+                            44, 45, 45, 0, 0, centDirCount, centDirCount,\r
+                            centDirSize, centDirOffset)\r
+                    self.fp.write(zip64endrec)\r
+\r
+                    zip64locrec = struct.pack(\r
+                            structEndArchive64Locator,\r
+                            stringEndArchive64Locator, 0, pos2, 1)\r
+                    self.fp.write(zip64locrec)\r
+                    centDirCount = min(centDirCount, 0xFFFF)\r
+                    centDirSize = min(centDirSize, 0xFFFFFFFF)\r
+                    centDirOffset = min(centDirOffset, 0xFFFFFFFF)\r
+\r
+                endrec = struct.pack(structEndArchive, stringEndArchive,\r
+                                    0, 0, centDirCount, centDirCount,\r
+                                    centDirSize, centDirOffset, len(self._comment))\r
+                self.fp.write(endrec)\r
+                self.fp.write(self._comment)\r
+                self.fp.flush()\r
+        finally:\r
+            fp = self.fp\r
+            self.fp = None\r
+            if not self._filePassed:\r
+                fp.close()\r
+\r
+\r
+class PyZipFile(ZipFile):\r
+    """Class to create ZIP archives with Python library files and packages."""\r
+\r
+    def writepy(self, pathname, basename = ""):\r
+        """Add all files from "pathname" to the ZIP archive.\r
+\r
+        If pathname is a package directory, search the directory and\r
+        all package subdirectories recursively for all *.py and enter\r
+        the modules into the archive.  If pathname is a plain\r
+        directory, listdir *.py and enter all modules.  Else, pathname\r
+        must be a Python *.py file and the module will be put into the\r
+        archive.  Added modules are always module.pyo or module.pyc.\r
+        This method will compile the module.py into module.pyc if\r
+        necessary.\r
+        """\r
+        dir, name = os.path.split(pathname)\r
+        if os.path.isdir(pathname):\r
+            initname = os.path.join(pathname, "__init__.py")\r
+            if os.path.isfile(initname):\r
+                # This is a package directory, add it\r
+                if basename:\r
+                    basename = "%s/%s" % (basename, name)\r
+                else:\r
+                    basename = name\r
+                if self.debug:\r
+                    print "Adding package in", pathname, "as", basename\r
+                fname, arcname = self._get_codename(initname[0:-3], basename)\r
+                if self.debug:\r
+                    print "Adding", arcname\r
+                self.write(fname, arcname)\r
+                dirlist = os.listdir(pathname)\r
+                dirlist.remove("__init__.py")\r
+                # Add all *.py files and package subdirectories\r
+                for filename in dirlist:\r
+                    path = os.path.join(pathname, filename)\r
+                    root, ext = os.path.splitext(filename)\r
+                    if os.path.isdir(path):\r
+                        if os.path.isfile(os.path.join(path, "__init__.py")):\r
+                            # This is a package directory, add it\r
+                            self.writepy(path, basename)  # Recursive call\r
+                    elif ext == ".py":\r
+                        fname, arcname = self._get_codename(path[0:-3],\r
+                                         basename)\r
+                        if self.debug:\r
+                            print "Adding", arcname\r
+                        self.write(fname, arcname)\r
+            else:\r
+                # This is NOT a package directory, add its files at top level\r
+                if self.debug:\r
+                    print "Adding files from directory", pathname\r
+                for filename in os.listdir(pathname):\r
+                    path = os.path.join(pathname, filename)\r
+                    root, ext = os.path.splitext(filename)\r
+                    if ext == ".py":\r
+                        fname, arcname = self._get_codename(path[0:-3],\r
+                                         basename)\r
+                        if self.debug:\r
+                            print "Adding", arcname\r
+                        self.write(fname, arcname)\r
+        else:\r
+            if pathname[-3:] != ".py":\r
+                raise RuntimeError, \\r
+                      'Files added with writepy() must end with ".py"'\r
+            fname, arcname = self._get_codename(pathname[0:-3], basename)\r
+            if self.debug:\r
+                print "Adding file", arcname\r
+            self.write(fname, arcname)\r
+\r
+    def _get_codename(self, pathname, basename):\r
+        """Return (filename, archivename) for the path.\r
+\r
+        Given a module name path, return the correct file path and\r
+        archive name, compiling if necessary.  For example, given\r
+        /python/lib/string, return (/python/lib/string.pyc, string).\r
+        """\r
+        file_py  = pathname + ".py"\r
+        file_pyc = pathname + ".pyc"\r
+        file_pyo = pathname + ".pyo"\r
+        if os.path.isfile(file_pyo) and \\r
+                            os.stat(file_pyo).st_mtime >= os.stat(file_py).st_mtime:\r
+            fname = file_pyo    # Use .pyo file\r
+        elif not os.path.isfile(file_pyc) or \\r
+             os.stat(file_pyc).st_mtime < os.stat(file_py).st_mtime:\r
+            import py_compile\r
+            if self.debug:\r
+                print "Compiling", file_py\r
+            try:\r
+                py_compile.compile(file_py, file_pyc, None, True)\r
+            except py_compile.PyCompileError,err:\r
+                print err.msg\r
+            fname = file_pyc\r
+        else:\r
+            fname = file_pyc\r
+        archivename = os.path.split(fname)[1]\r
+        if basename:\r
+            archivename = "%s/%s" % (basename, archivename)\r
+        return (fname, archivename)\r
+\r
+\r
+def main(args = None):\r
+    import textwrap\r
+    USAGE=textwrap.dedent("""\\r
+        Usage:\r
+            zipfile.py -l zipfile.zip        # Show listing of a zipfile\r
+            zipfile.py -t zipfile.zip        # Test if a zipfile is valid\r
+            zipfile.py -e zipfile.zip target # Extract zipfile into target dir\r
+            zipfile.py -c zipfile.zip src ... # Create zipfile from sources\r
+        """)\r
+    if args is None:\r
+        args = sys.argv[1:]\r
+\r
+    if not args or args[0] not in ('-l', '-c', '-e', '-t'):\r
+        print USAGE\r
+        sys.exit(1)\r
+\r
+    if args[0] == '-l':\r
+        if len(args) != 2:\r
+            print USAGE\r
+            sys.exit(1)\r
+        with ZipFile(args[1], 'r') as zf:\r
+            zf.printdir()\r
+\r
+    elif args[0] == '-t':\r
+        if len(args) != 2:\r
+            print USAGE\r
+            sys.exit(1)\r
+        with ZipFile(args[1], 'r') as zf:\r
+            badfile = zf.testzip()\r
+        if badfile:\r
+            print("The following enclosed file is corrupted: {!r}".format(badfile))\r
+        print "Done testing"\r
+\r
+    elif args[0] == '-e':\r
+        if len(args) != 3:\r
+            print USAGE\r
+            sys.exit(1)\r
+\r
+        with ZipFile(args[1], 'r') as zf:\r
+            zf.extractall(args[2])\r
+\r
+    elif args[0] == '-c':\r
+        if len(args) < 3:\r
+            print USAGE\r
+            sys.exit(1)\r
+\r
+        def addToZip(zf, path, zippath):\r
+            if os.path.isfile(path):\r
+                zf.write(path, zippath, ZIP_DEFLATED)\r
+            elif os.path.isdir(path):\r
+                if zippath:\r
+                    zf.write(path, zippath)\r
+                for nm in os.listdir(path):\r
+                    addToZip(zf,\r
+                            os.path.join(path, nm), os.path.join(zippath, nm))\r
+            # else: ignore\r
+\r
+        with ZipFile(args[1], 'w', allowZip64=True) as zf:\r
+            for path in args[2:]:\r
+                zippath = os.path.basename(path)\r
+                if not zippath:\r
+                    zippath = os.path.basename(os.path.dirname(path))\r
+                if zippath in ('', os.curdir, os.pardir):\r
+                    zippath = ''\r
+                addToZip(zf, path, zippath)\r
+\r
+if __name__ == "__main__":\r
+    main()\r